Browse Source

Fixes #2274 graph3d disappears when setSize is called (#2293)

codeClimate
wimrijnders 8 years ago
committed by Alexander Wunschik
parent
commit
588d9b685a
1 changed files with 16 additions and 7 deletions
  1. +16
    -7
      lib/graph3d/Graph3d.js

+ 16
- 7
lib/graph3d/Graph3d.js View File

@ -708,19 +708,15 @@ Graph3d.prototype.create = function () {
/** /**
* Set a new size for the graph * 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.width = width;
this.frame.style.height = height; this.frame.style.height = height;
this._resizeCanvas(); this._resizeCanvas();
}; };
/** /**
* Resize the canvas to the current size of the frame * Resize the canvas to the current size of the frame
*/ */
@ -847,7 +843,7 @@ Graph3d.prototype.setOptions = function (options) {
Settings.setOptions(options, this); Settings.setOptions(options, this);
this.setPointDrawingMethod(); this.setPointDrawingMethod();
this.setSize(this.width, this.height);
this._setSize(this.width, this.height);
// re-load the data // re-load the data
if (this.dataTable) { 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 // End public methods for specific settings
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

Loading…
Cancel
Save