|
|
@ -100,7 +100,7 @@ function LineGraph(body, options) { |
|
|
|
this.hammer = null; |
|
|
|
this.groups = {}; |
|
|
|
this.abortedGraphUpdate = false; |
|
|
|
this.autoSizeSVG = false; |
|
|
|
this.updateSVGheight = false; |
|
|
|
|
|
|
|
var me = this; |
|
|
|
this.itemsData = null; // DataSet
|
|
|
@ -194,11 +194,11 @@ LineGraph.prototype.setOptions = function(options) { |
|
|
|
if (options) { |
|
|
|
var fields = ['sampling','defaultGroup','height','graphHeight','yAxisOrientation','style','barChart','dataAxis','sort','groups']; |
|
|
|
if (options.graphHeight === undefined && options.height !== undefined && this.body.domProps.centerContainer.height !== undefined) { |
|
|
|
this.autoSizeSVG = true; |
|
|
|
this.updateSVGheight = true; |
|
|
|
} |
|
|
|
else if (this.body.domProps.centerContainer.height !== undefined && options.graphHeight !== undefined) { |
|
|
|
if (parseInt((options.graphHeight + '').replace("px",'')) < this.body.domProps.centerContainer.height) { |
|
|
|
this.autoSizeSVG = true; |
|
|
|
this.updateSVGheight = true; |
|
|
|
} |
|
|
|
} |
|
|
|
util.selectiveDeepExtend(fields, this.options, options); |
|
|
@ -566,18 +566,20 @@ LineGraph.prototype.redraw = function(forceGraphUpdate) { |
|
|
|
if (resized == true) { |
|
|
|
this.svg.style.width = util.option.asSize(3*this.props.width); |
|
|
|
this.svg.style.left = util.option.asSize(-this.props.width); |
|
|
|
|
|
|
|
// if the height of the graph is set as proportional, change the height of the svg
|
|
|
|
if ((this.options.height + '').indexOf("%") != -1) { |
|
|
|
this.autoSizeSVG = true; |
|
|
|
this.updateSVGheight = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// update the height of the graph on each redraw of the graph.
|
|
|
|
if (this.autoSizeSVG == true) { |
|
|
|
if (this.updateSVGheight == true) { |
|
|
|
if (this.options.graphHeight != this.body.domProps.centerContainer.height + 'px') { |
|
|
|
this.options.graphHeight = this.body.domProps.centerContainer.height + 'px'; |
|
|
|
this.svg.style.height = this.body.domProps.centerContainer.height + 'px'; |
|
|
|
} |
|
|
|
this.autoSizeSVG = false; |
|
|
|
this.updateSVGheight = false; |
|
|
|
} |
|
|
|
else { |
|
|
|
this.svg.style.height = ('' + this.options.graphHeight).replace('px','') + 'px'; |
|
|
@ -602,7 +604,6 @@ LineGraph.prototype.redraw = function(forceGraphUpdate) { |
|
|
|
|
|
|
|
this.legendLeft.redraw(); |
|
|
|
this.legendRight.redraw(); |
|
|
|
|
|
|
|
return resized; |
|
|
|
}; |
|
|
|
|
|
|
@ -823,7 +824,7 @@ LineGraph.prototype._getYRanges = function (groupIds, groupsData, groupRanges) { |
|
|
|
* @private |
|
|
|
*/ |
|
|
|
LineGraph.prototype._updateYAxis = function (groupIds, groupRanges) { |
|
|
|
var changeCalled = false; |
|
|
|
var resized = false; |
|
|
|
var yAxisLeftUsed = false; |
|
|
|
var yAxisRightUsed = false; |
|
|
|
var minLeft = 1e9, minRight = 1e9, maxLeft = -1e9, maxRight = -1e9, minVal, maxVal; |
|
|
@ -872,8 +873,8 @@ LineGraph.prototype._updateYAxis = function (groupIds, groupRanges) { |
|
|
|
this.yAxisRight.setRange(minRight, maxRight); |
|
|
|
} |
|
|
|
} |
|
|
|
changeCalled = this._toggleAxisVisiblity(yAxisLeftUsed , this.yAxisLeft) || changeCalled; |
|
|
|
changeCalled = this._toggleAxisVisiblity(yAxisRightUsed, this.yAxisRight) || changeCalled; |
|
|
|
resized = this._toggleAxisVisiblity(yAxisLeftUsed , this.yAxisLeft) || resized; |
|
|
|
resized = this._toggleAxisVisiblity(yAxisRightUsed, this.yAxisRight) || resized; |
|
|
|
if (yAxisRightUsed == true && yAxisLeftUsed == true) { |
|
|
|
this.yAxisLeft.drawIcons = true; |
|
|
|
this.yAxisRight.drawIcons = true; |
|
|
@ -888,13 +889,13 @@ LineGraph.prototype._updateYAxis = function (groupIds, groupRanges) { |
|
|
|
if (yAxisRightUsed == true) {this.yAxisLeft.lineOffset = this.yAxisRight.width;} |
|
|
|
else {this.yAxisLeft.lineOffset = 0;} |
|
|
|
|
|
|
|
changeCalled = this.yAxisLeft.redraw() || changeCalled; |
|
|
|
resized = this.yAxisLeft.redraw() || resized; |
|
|
|
this.yAxisRight.stepPixelsForced = this.yAxisLeft.stepPixels; |
|
|
|
this.yAxisRight.zeroCrossing = this.yAxisLeft.zeroCrossing; |
|
|
|
changeCalled = this.yAxisRight.redraw() || changeCalled; |
|
|
|
resized = this.yAxisRight.redraw() || resized; |
|
|
|
} |
|
|
|
else { |
|
|
|
changeCalled = this.yAxisRight.redraw() || changeCalled; |
|
|
|
resized = this.yAxisRight.redraw() || resized; |
|
|
|
} |
|
|
|
|
|
|
|
// clean the accumulated lists
|
|
|
@ -905,7 +906,7 @@ LineGraph.prototype._updateYAxis = function (groupIds, groupRanges) { |
|
|
|
groupIds.splice(groupIds.indexOf('__barchartRight'),1); |
|
|
|
} |
|
|
|
|
|
|
|
return changeCalled; |
|
|
|
return resized; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|