|
|
@ -39,7 +39,9 @@ var OPTIONKEYS = [ |
|
|
|
'animationPreload', |
|
|
|
'animationAutoStart', |
|
|
|
'axisColor', |
|
|
|
'gridColor' |
|
|
|
'gridColor', |
|
|
|
'xCenter', |
|
|
|
'yCenter' |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
@ -78,7 +80,9 @@ var DEFAULTS = { |
|
|
|
animationInterval: 1000, // milliseconds
|
|
|
|
animationPreload : false, |
|
|
|
axisColor : '#4D4D4D', |
|
|
|
gridColor : '#D3D3D3' |
|
|
|
gridColor : '#D3D3D3', |
|
|
|
xCenter : '55%', |
|
|
|
yCenter : '50%' |
|
|
|
|
|
|
|
|
|
|
|
// Following not in defaults (yet) but present in user settings
|
|
|
@ -174,9 +178,6 @@ function Graph3d(container, data, options) { |
|
|
|
// These require special attention in some way
|
|
|
|
// TODO: handle these
|
|
|
|
|
|
|
|
this.defaultXCenter = '55%'; |
|
|
|
this.defaultYCenter = '50%'; |
|
|
|
|
|
|
|
this.showLegend = undefined; // auto by default (based on graph style)
|
|
|
|
|
|
|
|
this.style = Graph3d.STYLE.DOT; |
|
|
@ -345,8 +346,8 @@ Graph3d.prototype._convertTranslationToScreen = function(translation) { |
|
|
|
// shift and scale the point to the center of the screen
|
|
|
|
// use the width of the graph to scale both horizontally and vertically.
|
|
|
|
return new Point2d( |
|
|
|
this.xcenter + bx * this.frame.canvas.clientWidth, |
|
|
|
this.ycenter - by * this.frame.canvas.clientWidth); |
|
|
|
this.currentXCenter + bx * this.frame.canvas.clientWidth, |
|
|
|
this.currentYCenter - by * this.frame.canvas.clientWidth); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
@ -873,30 +874,30 @@ Graph3d.prototype.animationStop = function() { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* Resize the center position based on the current values in this.defaultXCenter |
|
|
|
* and this.defaultYCenter (which are strings with a percentage or a value |
|
|
|
* in pixels). The center positions are the variables this.xCenter |
|
|
|
* and this.yCenter |
|
|
|
* Resize the center position based on the current values in this.xCenter |
|
|
|
* and this.yCenter (which are strings with a percentage or a value |
|
|
|
* in pixels). The center positions are the variables this.currentXCenter |
|
|
|
* and this.currentYCenter |
|
|
|
*/ |
|
|
|
Graph3d.prototype._resizeCenter = function() { |
|
|
|
// calculate the horizontal center position
|
|
|
|
if (this.defaultXCenter.charAt(this.defaultXCenter.length-1) === '%') { |
|
|
|
this.xcenter = |
|
|
|
parseFloat(this.defaultXCenter) / 100 * |
|
|
|
if (this.xCenter.charAt(this.xCenter.length-1) === '%') { |
|
|
|
this.currentXCenter = |
|
|
|
parseFloat(this.xCenter) / 100 * |
|
|
|
this.frame.canvas.clientWidth; |
|
|
|
} |
|
|
|
else { |
|
|
|
this.xcenter = parseFloat(this.defaultXCenter); // supposed to be in px
|
|
|
|
this.currentXCenter = parseFloat(this.xCenter); // supposed to be in px
|
|
|
|
} |
|
|
|
|
|
|
|
// calculate the vertical center position
|
|
|
|
if (this.defaultYCenter.charAt(this.defaultYCenter.length-1) === '%') { |
|
|
|
this.ycenter = |
|
|
|
parseFloat(this.defaultYCenter) / 100 * |
|
|
|
if (this.yCenter.charAt(this.yCenter.length-1) === '%') { |
|
|
|
this.currentYCenter = |
|
|
|
parseFloat(this.yCenter) / 100 * |
|
|
|
(this.frame.canvas.clientHeight - this.frame.filter.clientHeight); |
|
|
|
} |
|
|
|
else { |
|
|
|
this.ycenter = parseFloat(this.defaultYCenter); // supposed to be in px
|
|
|
|
this.currentYCenter = parseFloat(this.yCenter); // supposed to be in px
|
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
@ -995,8 +996,6 @@ Graph3d.prototype.setOptions = function (options) { |
|
|
|
safeCopy(options, this, OPTIONKEYS); |
|
|
|
|
|
|
|
// Handle the rest of the parameters
|
|
|
|
if (options.xCenter !== undefined) this.defaultXCenter = options.xCenter; |
|
|
|
if (options.yCenter !== undefined) this.defaultYCenter = options.yCenter; |
|
|
|
if (options.showLegend !== undefined) this.defaultShowLegend = options.showLegend; |
|
|
|
|
|
|
|
if (options.style !== undefined) { |
|
|
|