From 588d9b685ab596ab3c18a0ce31cd0358d05a52df Mon Sep 17 00:00:00 2001 From: wimrijnders Date: Thu, 10 Nov 2016 19:06:40 +0100 Subject: [PATCH] Fixes #2274 graph3d disappears when setSize is called (#2293) --- lib/graph3d/Graph3d.js | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/graph3d/Graph3d.js b/lib/graph3d/Graph3d.js index f66912e8..7ae09e45 100644 --- a/lib/graph3d/Graph3d.js +++ b/lib/graph3d/Graph3d.js @@ -708,19 +708,15 @@ Graph3d.prototype.create = function () { /** * Set a new size for the graph - * - * @param {string} width Width in pixels or percentage (for example '800px' - * or '50%') - * @param {string} height Height in pixels or percentage (for example '400px' - * or '30%') */ -Graph3d.prototype.setSize = function(width, height) { +Graph3d.prototype._setSize = function(width, height) { this.frame.style.width = width; this.frame.style.height = height; this._resizeCanvas(); }; + /** * Resize the canvas to the current size of the frame */ @@ -847,7 +843,7 @@ Graph3d.prototype.setOptions = function (options) { Settings.setOptions(options, this); this.setPointDrawingMethod(); - this.setSize(this.width, this.height); + this._setSize(this.width, this.height); // re-load the data if (this.dataTable) { @@ -2365,6 +2361,19 @@ Graph3d.prototype.setCameraPosition = function(pos) { }; +/** + * Set a new size for the graph + * + * @param {string} width Width in pixels or percentage (for example '800px' + * or '50%') + * @param {string} height Height in pixels or percentage (for example '400px' + * or '30%') + */ +Graph3d.prototype.setSize = function(width, height) { + this._setSize(width, height); + this.redraw(); +}; + // ----------------------------------------------------------------------------- // End public methods for specific settings // -----------------------------------------------------------------------------