From 9a704c28b0a4026177be002eab85b6bf89e24283 Mon Sep 17 00:00:00 2001 From: NPellet Date: Sat, 3 Mar 2018 19:00:58 +0100 Subject: [PATCH] Release v2.0.72 --- bower.json | 2 +- dist/jsgraph-es6.js | 957 ++++----------- dist/jsgraph-es6.min.js | 2 +- dist/jsgraph-es6.min.js.map | 2 +- dist/jsgraph-module.js | 882 +++----------- dist/jsgraph-module.js.map | 2 +- dist/jsgraph-module.min.js | 2 +- dist/jsgraph-module.min.js.map | 2 +- dist/jsgraph.js | 1030 ++++------------- dist/jsgraph.min.js | 4 +- gruntfile.js | 10 +- jsdoc.json | 2 +- nmr/js/forms/form_coupling/formcoupling.jsx | 25 +- .../form_coupling/formcouplingelement.jsx | 20 +- nmr/js/nmr1d.jsx | 22 +- nmr/js/nmrrange.jsx | 41 +- nmr/js/nmrserie.jsx | 6 +- nmr/js/nmrsignal.jsx | 35 +- nmr/lib/jsgraph-es6.js | 31 +- nmr/lib/jsgraph-es6.min.js | 2 +- nmr/lib/jsgraph-es6.min.js.map | 2 +- package.json | 2 +- src/graph.axis.js | 11 +- src/graph.core.js | 8 +- src/series/graph.serie.js | 4 +- src/series/graph.serie.line.js | 19 - src/shapes/graph.shape.line.js | 10 +- src/shapes/graph.shape.nmrintegral.js | 14 +- src/util/package.json | 20 +- src/util/waveform.js | 571 ++------- 30 files changed, 793 insertions(+), 2947 deletions(-) diff --git a/bower.json b/bower.json index 1a4adbe3a..b87690979 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "jsgraph", - "version": "2.0.71", + "version": "2.0.72", "homepage": "http://jsgraph.org", "main": [ "dist/jsgraph.js", diff --git a/dist/jsgraph-es6.js b/dist/jsgraph-es6.js index b09e74ed1..0a3329ee2 100644 --- a/dist/jsgraph-es6.js +++ b/dist/jsgraph-es6.js @@ -3819,13 +3819,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ let min = this.getBoundaryAxis(this.axis[axisvars[j]][i], 'min', usingZValues); let max = this.getBoundaryAxis(this.axis[axisvars[j]][i], 'max', usingZValues); - if (isFinite(min)) { - axis.setMinValueData(min); - } - if (isFinite(max)) { axis.setMaxValueData(max); } + if (isFinite(min)) { + axis.setMinValueData(min); + } } } } @@ -6121,7 +6120,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ try { util.setAttributeTo(this.dom, { - 'data-jsgraph-version': 'v2.0.71' + 'data-jsgraph-version': 'v2.0.72' }); } catch (e) { // ignore @@ -6930,15 +6929,15 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (typeof exports !== "undefined") { - factory(module, exports, require('./fit_lm.js'), require('./data_aggregator.js')); + factory(module, exports, require('./fit_lm'), require('extend')); } else { var mod = { exports: {} }; - factory(mod, mod.exports, global.fit_lm, global.data_aggregator); + factory(mod, mod.exports, global.fit_lm, global.extend); global.waveform = mod.exports; } -})(this, function (module, exports, _fit_lm, _data_aggregator) { +})(this, function (module, exports, _fit_lm, _extend) { 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -6947,7 +6946,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ var _fit_lm2 = _interopRequireDefault(_fit_lm); - var _data_aggregator2 = _interopRequireDefault(_data_aggregator); + var _extend2 = _interopRequireDefault(_extend); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { @@ -6961,29 +6960,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ this.xOffset = xOffset; this.xScale = xScale; - - // Error bar handling - this.errors = { - - nb: 0, - - bars: { - above: null, - below: null - }, - - boxes: { - above: null, - below: null - } - }; - this.setData(data); - - this.BELOW = Waveform.BELOW; - this.ABOVE = Waveform.ABOVE; - this.BOX = Waveform.BOX; - this.BAR = Waveform.BAR; } /** [ [ x1, y1 ], [ x2, y2 ] ] */ @@ -7029,7 +7006,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ data.map((el, index) => { - if (!nanable && Number.isNaN(el[0]) || Number.isNaN(el[1])) { + if (!nanable && (el[0] !== el[0] || el[1] !== el[1])) { warnNaN = true; } @@ -7048,7 +7025,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return this; } - getY(index, optimized = false) { + getY(index, optimized) { if (optimized && this.dataInUse) { return this.dataInUse.y[index] * this.getScale() + this.getShift(); @@ -7073,7 +7050,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ if (Array.isArray(waveform)) { waveform = new Waveform(waveform); } else { - throw 'Cannot set X waveform. Data is not a valid array.'; + throw "Cannot set X waveform. Data is not a valid array."; } } @@ -7087,20 +7064,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } getXWaveform() { - if (this.xdata) { return this.xdata; } - let wave = new Waveform(), - xs = []; + var wave = new Waveform(); for (var i = 0; i < this.getLength(); i += 1) { - xs.push(this.getX(i)); + wave.append(this.getX(i)); } - - wave.setData(xs); - - this.xdata = wave; return wave; } @@ -7118,11 +7089,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ setTypedArrayClass(constructor) { if (this.getTypedArrayClass() && this.isNaNAllowed() && !this.isNaNAllowed(constructor)) { - this.warn('NaN values are not allowed by the new constructor (' + constructor.name + ') while it was allowed by the previous one (' + this._typedArrayClass.name + ')'); + this.warn("NaN values are not allowed by the new constructor (" + constructor.name + ") while it was allowed by the previous one (" + this._typedArrayClass.name + ")"); } if (this.getTypedArrayClass() && this.isUnsigned() && !this.isUnsigned(constructor)) { - this.warn('You are switching from signed values to unsigned values. You may experience data corruption if there were some negative values.'); + this.warn("You are switching from signed values to unsigned values. You may experience data corruption if there were some negative values."); } this._typedArrayClass = constructor; @@ -7144,7 +7115,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ isUnsigned(constructor = this._typedArrayClass) { - // The following types accept unsigned numbers + // The following types accept NaNs return constructor == Uint8Array || constructor == Uint8ClampedArray || constructor == Uint16Array || constructor == Uint32Array; } @@ -7168,11 +7139,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ prepend(x, y) { - if (typeof x == 'function') { + if (typeof x == "function") { x = x(this); } - if (typeof y == 'function') { + if (typeof y == "function") { y = y(this); } @@ -7192,15 +7163,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ append(x, y) { - if (!this.data) { - this.data = []; - } - - if (typeof x == 'function') { + if (typeof x == "function") { x = x(this); } - if (typeof y == 'function') { + if (typeof y == "function") { y = y(this); } @@ -7212,9 +7179,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } if (this.monotoneous) { - if (y >= this.data[this.data.y] && this.getMonotoneousAscending() === false) { + if (y > this.data[this.data.y] && this.getMonotoneousAscending() === false) { this.monotoneous = false; - } else if (y <= this.data[this.data.y] && this.getMonotoneousAscending() === true) { + } else if (y < this.data[this.data.y] && this.getMonotoneousAscending() === true) { this.monotoneous = false; } } @@ -7245,8 +7212,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return new Array(length); } - _setData(dataY = this.data) { - + _setData(dataY) { const l = dataY.length; let i = 1, monoDir = dataY[1] > dataY[0], @@ -7271,25 +7237,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ this._monotoneousAscending = dataY[1] > dataY[0]; } - if (this.hasErrorBars()) { - // If prefer to loop again here - - for (i = 0; i < l; i++) { - - if (dataY[i] === dataY[i]) { - // NaN support - - minY = Math.min(minY, dataY[i] - this.getMaxError(i, 'below')); - maxY = Math.max(maxY, dataY[i] + this.getMaxError(i, 'above')); - } - } - - this.minY = minY; - this.maxY = maxY; - } else { - this.minY = minY; - this.maxY = maxY; - } + this.minY = minY; + this.maxY = maxY; this.data = dataY; @@ -7303,7 +7252,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return; } - if (!this.xdata) { + if (this.xdata) { + + this.minX = this.xdata.getMin(); + this.maxX = this.xdata.getMax(); + } else { const b1 = this.xOffset + this.xScale * this.getLength(), b2 = this.xOffset; @@ -7331,7 +7284,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ position = this.getIndexFromData(val, data, this.data.getMonotoneousAscending(), roundingMethod); - if (useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateY') { + if (useDataToUse && this.dataInUse && this.dataInUseType == "aggregateY") { // In case of aggregation, round to the closest element of 4. return position - position % 4; } @@ -7346,19 +7299,18 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ if (useDataToUse && this.dataInUse) { xdata = this.dataInUse.x; } else if (this.xdata) { - xdata = this.xdata.data; + xdata = this.xdata.getData(); } let position; if (this.hasXWaveform()) { - // The x value HAS to be rescaled position = this.xdata.getIndexFromData(xval, xdata, this.xdata.getMonotoneousAscending(), roundingMethod); } else { position = Math.max(0, Math.min(this.getLength() - 1, roundingMethod((xval - this.xOffset) / this.xScale))); } - if (useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateX') { + if (useDataToUse && this.dataInUse && this.dataInUseType == "aggregateX") { // In case of aggregation, round to the closest element of 4. return position - position % 4; } @@ -7366,84 +7318,31 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return position; } - getIndexFromXY(xval, yval, useDataToUse = false, roundingMethod = Math.round, scaleX, scaleY) { - - let xdata, ydata; - - if (useDataToUse && this.dataInUse) { - - xdata = this.dataInUse.x; - ydata = this.dataInUse.y; - } else if (this.xdata) { - - xdata = this.xdata.data; - ydata = this.data; - } - - let position; - - if (this.isXMonotoneous()) { - // X lookup only + getIndexFromData(val, valCollection, isAscending, roundingMethod) { - if (this.hasXWaveform()) { - // The x value HAS to be rescaled - position = this.xdata.getIndexFromData(xval, xdata, this.xdata.getMonotoneousAscending(), roundingMethod); - } else { - position = Math.max(0, Math.min(this.getLength() - 1, roundingMethod((xval - this.xOffset) / this.xScale))); - } - } else if (!isNaN(yval)) { - - position = this.getIndexFromDataXY(xval, xdata, yval, ydata, scaleX, scaleY); - } else { - return; - } - - if (useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateX') { - // In case of aggregation, round to the closest element of 4. - return position - position % 4; + if (!this.isMonotoneous()) { + console.trace(); + throw "Impossible to get the index from a non-monotoneous wave !"; } - return position; - } - - getIndexFromData(val, valCollection, isAscending) { - let data, position; val -= this.getShift(); val /= this.getScale(); - if (!this.isMonotoneous()) { - console.trace(); - throw 'Impossible to get the index from a non-monotoneous wave !'; - } - return binarySearch(val, valCollection, !isAscending); } - getIndexFromDataXY(valX, dataX, valY, dataY, scaleX = 1, scaleY = 1) { - - let data, position; - - valX -= this.getXShift(); - valX /= this.getXScale(); - - valY -= this.getShift(); - valY /= this.getScale(); - - return euclidianSearch(valX, valY, dataX, dataY, scaleX, scaleY); - } - getReductionType() { return this.dataInUseType; } getXMin() { - return this.xdata ? this.xdata.getMin() : this.minX; + return this.minX * this.getXScale() + this.getXShift(); } getXMax() { - return this.xdata ? this.xdata.getMax() : this.maxX; + return this.maxX * this.getXScale() + this.getXShift(); } getYMin() { @@ -7463,11 +7362,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } getMinX() { - return this.getXMin(); + + return this.minX * this.getXScale() + this.getXShift(); } getMaxX() { - return this.getXMax(); + return this.maxX * this.getXScale() + this.getXShift(); } getMinY() { @@ -7511,11 +7411,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ // this.minY = ( this.minY - this.getShift() ) * scale; // this.maxY = ( this.maxY - this.getShift() ) * scale; this.scale = scale; + return this; } setXShift(shift = 0) { - if (!this.hasXWaveform()) { + if (!this.hasXWaveform) { return this; } @@ -7527,7 +7428,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return this; } - getXShift(shift) { + getXShift(shift = 0) { if (!this.hasXWaveform) { return 0; @@ -7556,9 +7457,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } getLength() { - if (!this.data) { - return 0; - } return this.data.length; } @@ -7598,7 +7496,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return new Promise(function (resolver, rejector) { - var fit = new _fit_lm2.default(Object.assign({}, { + var fit = new _fit_lm2.default((0, _extend2.default)({}, { dataY: self, dataX: self.getXWaveform(), @@ -7723,7 +7621,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ requireMonotonicity() { if (!this.isMonotoneous()) { - throw 'The wave must be monotonic'; + throw "The wave must be monotonic"; } } @@ -7741,7 +7639,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ invert(data) { - let d = data || this.data; + let d = dataY || this.data; d.reverse(); if (this.isMonotoneous()) { @@ -7779,11 +7677,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ const l = this.getLength(); if (!options.xPosition) { - throw 'No position calculation method provided'; + throw "No position calculation method provided"; } if (!options.resampleToPx) { - throw 'No "resampleToPx" method was provided. Unit: px per point'; + throw "No \"resampleToPx\" method was provided. Unit: px per point"; } if (options.minX > options.maxX) { @@ -7866,22 +7764,19 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ resampleMax = Math.max(resampleMax, dataY[i]); } - this.dataInUseType = 'resampled'; + this.dataInUseType = "resampled"; this.dataInUse = data; return dataMinMax; } interpolate(x) { - let xIndex; let yData = this.getDataY(); - - x = (x - this.getXShift()) / this.getXScale(); + let xIndex; if (this.xdata) { - let xData = this.xdata.getData(), - xIndex = binarySearch(x, xData, !this.xdata.getMonotoneousAscending()); - + let xData = this.xdata.getData(); + xIndex = binarySearch(x, xData, !this.xdata.getMonotoneousAscending()); if (xData[xIndex] == x) { return yData[xIndex]; } @@ -7893,10 +7788,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } } + interpolateIndex_X(index) { + + let yData = this.getDataY(); + if (this.xdata) { + let xData = this.xdata.getData(); + let indexStart = Math.floor(index); + + return (index - indexStart) * (xData[indexStart + 1] - xData[indexStart]) + xData[indexStart]; + } + } + getMonotoneousAscending() { if (!this.isMonotoneous()) { - return 'The waveform is not monotoneous'; + return "The waveform is not monotoneous"; } return this._monotoneousAscending; @@ -8067,12 +7973,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ var pow2 = pow2floor(this.getLength()); - this._dataAggregating = (0, _data_aggregator2.default)({ + this._dataAggregating = aggregator({ - minX: this.getMinX(), - maxX: this.getMaxX(), - minY: this.getMinY(), - maxY: this.getMaxY(), + minX: this.minX, + maxX: this.maxX, + minY: this.minY, + maxY: this.maxY, data: this.data, xdata: this.xdata ? this.xdata.getData() : undefined, xScale: this.xScale, @@ -8083,7 +7989,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ }).then(event => { this._dataAggregated = event.aggregates; - console.log(this._dataAggregated); this._dataAggregating = false; }); } @@ -8104,14 +8009,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } */ - if (pxWidth > 2147483647) { - pxWidth = 2147483647; - } var level = pow2ceil(pxWidth); if (this._dataAggregated[level]) { - this.dataInUseType = 'aggregate' + this._dataAggregationDirection; + this.dataInUseType = "aggregate" + this._dataAggregationDirection; this.dataInUse = this._dataAggregated[level]; return; } else if (this._dataAggregating) { @@ -8119,7 +8021,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return this._dataAggregating; } - this.dataInUseType = 'none'; + this.dataInUseType = "none"; this.dataInUse = { y: this.data, x: this.getXWaveform().data @@ -8248,7 +8150,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } getUnit() { - return this.unit || ''; + return this.unit || ""; } getXUnit() { @@ -8256,7 +8158,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return this.xdata.getUnit(); } - return this.xunit | ''; + return this.xunit | ""; } hasXUnit() { @@ -8269,7 +8171,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ findLevels(level, options) { - options = Object.assign({ + options = (0, _extend2.default)({ box: 1, edge: 'both', @@ -8283,7 +8185,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ var indices = []; var i = 0; - while (lvlIndex = this.findLevel(level, Object.assign({}, options, { + while (lvlIndex = this.findLevel(level, (0, _extend2.default)(true, {}, options, { rangeP: [lastLvlIndex, options.rangeP[1]] }))) { indices.push(lvlIndex); @@ -8301,7 +8203,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ // Find the first level in the specified range findLevel(level, options) { - options = Object.assign({ + options = (0, _extend2.default)({ box: 1, edge: 'both', @@ -8323,7 +8225,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ box++; } - if (options.direction == 'descending') { + if (options.direction == "descending") { i = options.rangeP[1], l = options.rangeP[0], increment = -1; } else { i = options.rangeP[0], l = options.rangeP[1], increment = +1; @@ -8331,7 +8233,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ for (;; i += increment) { - if (options.direction == 'descending') { + if (options.direction == "descending") { if (i < l) { break; } @@ -8365,7 +8267,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ for (j = i + (box - 1) / 2; j >= i - (box - 1) / 2; j--) { - if (this.data[j] >= level && this.data[j - 1] < level) { + if (this.data[j] >= level && this.data[j - 1] <= level) { // Find a crossing switch (options.rounding) { @@ -8392,7 +8294,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ for (j = i + (box - 1) / 2; j >= i - (box - 1) / 2; j--) { - if (this.data[j] <= level && this.data[j - 1] > level) { + if (this.data[j] <= level && this.data[j - 1] >= level) { // Find a crossing switch (options.rounding) { @@ -8478,262 +8380,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ this.setData(this.data); } - //////////////////////////////////////////////////////////// - ///// HANDLING ERRORS //////////////////////////////////// - //////////////////////////////////////////////////////////// - - setErrorBarX(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - xWave.setErrorBar(waveform); - return this; - } - - setErrorBarXBelow(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - xWave.setErrorBarBelow(waveform); - return this; - } - - setErrorBarXAbove(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - xWave.setErrorBarAbove(waveform); - return this; - } - - setErrorBoxX(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - xWave.setErrorBoxAbove(waveform); - xWave.setErrorBoxBelow(waveform); - return this; - } - - setErrorBoxXBelow(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - - xWave.setErrorBoxBelow(waveform); - return this; - } - - setErrorBoxXAbove(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - xWave.setErrorBoxAbove(waveform); - return this; - } - - setErrorBar(waveform, checkMinMax = true) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - this.errors.nb++; - this.errors.nb++; - this.errors.bars.bottom = waveform; - this.errors.bars.top = waveform; - - if (checkMinMax) { - this._setData(); - } - } - - setErrorBarBelow(waveform, checkMinMax = true) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - this.errors.nb++; - this.errors.bars.below = waveform; - - if (checkMinMax) { - this._setData(); - } - } - - setErrorBarAbove(waveform, checkMinMax = true) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - this.errors.nb++; - this.errors.bars.above = waveform; - - if (checkMinMax) { - this._setData(); - } - } - - setErrorBox(waveform, checkMinMax = true) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - this.errors.nb++; - this.errors.nb++; - this.errors.boxes.above = waveform; - this.errors.boxes.below = waveform; - - if (checkMinMax) { - this._setData(); - } - } - - setErrorBoxBelow(waveform, checkMinMax = true) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - this.errors.nb++; - this.errors.boxes.below = waveform; - - if (checkMinMax) { - this._setData(); - } - } - - setErrorBoxAbove(waveform, checkMinMax = true) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - this.errors.boxes.above = waveform; - if (checkMinMax) { - this._setData(); - } - } - - getMaxError(i, side = Waveform.ABOVE) { - - return Math.max(this.getMaxErrorType(i, side, Waveform.BOX), this.getMaxErrorType(i, side, Waveform.BAR)); - } - - getMaxErrorType(i, side = Waveform.ABOVE, type = Waveform.BOX) { - - let stack; - if (type == Waveform.BOX) { - stack = this.errors.boxes; - } else if (type == Waveform.BAR) { - stack = this.errors.bars; - } else { - throw 'Unknown type of error'; - } - - let waveform; - if (!(waveform = stack[side])) { - if (side == Waveform.ABOVE) { - if (stack[side] == Waveform.BELOW) { - waveform = stack.below; - } - } else { - if (stack[side] == Waveform.ABOVE) { - waveform = stack.above; - } - } - } - - if (!waveform) { - return 0; - } - - return waveform.getY(i); - } - - getErrorBarXBelow(index) { - return this.getErrorX(index, Waveform.BELOW, Waveform.BAR); - } - getErrorBarXAbove(index) { - return this.getErrorX(index, Waveform.ABOVE, Waveform.BAR); - } - getErrorBoxXBelow(index) { - return this.getErrorX(index, Waveform.BELOW, Waveform.BOX); - } - getErrorBoxXAbove(index) { - return this.getErrorX(index, Waveform.ABOVE, Waveform.BOX); - } - - getErrorBarYBelow(index) { - return this.getError(index, Waveform.BELOW, Waveform.BAR); - } - getErrorBarYAbove(index) { - return this.getError(index, Waveform.ABOVE, Waveform.BAR); - } - getErrorBoxYBelow(index) { - return this.getError(index, Waveform.BELOW, Waveform.BOX); - } - getErrorBoxYAbove(index) { - return this.getError(index, Waveform.ABOVE, Waveform.BOX); - } - - getErrorX(index, side = Waveform.ABOVE, type = Waveform.BAR) { - - if (!this.hasXWaveform()) { - return false; - } - - return this.xdata.getError(index, side, type); - } - - getError(index, side = Waveform.ABOVE, type = Waveform.BAR) { - - let errors = type == Waveform.BAR ? this.errors.bars : this.errors.boxes; - - if (!errors) { - return false; - } - - let wave; - if (wave = side == Waveform.ABOVE ? errors.above : errors.below) { - - if (wave == Waveform.ABOVE && side == Waveform.BELOW) { - wave = errors.above; - } else if (wave == Waveform.BELOW && side == Waveform.ABOVE) { - wave = errors.below; - } - - if (!wave) { - return false; - } - - return wave.getY(index); - } - } - - hasErrorBars() { + }; - return this.errors.nb > 0 || this.hasXWaveform() && this.xdata.errors.nb > 0; - } + const MULTIPLY = Symbol(); + const ADD = Symbol(); + const SUBTRACT = Symbol(); + const DIVIDE = Symbol(); - } // http://stackoverflow.com/questions/26965171/fast-nearest-power-of-2-in-javascript function pow2ceil(v) { v--; @@ -8758,27 +8411,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return (value - valueBefore) / (valueAfter - valueBefore) * (indexAfter - indexBefore) + indexBefore; } - function euclidianSearch(targetX, targetY, haystackX, haystackY, scaleX = 1, scaleY = 1) { - - let distance = Number.MAX_VALUE, - distance_i; - - let index = -1; - - for (var i = 0, l = haystackX.length; i < l; i++) { - - distance_i = Math.pow((targetX - haystackX[i]) * scaleX, 2) + Math.pow((targetY - haystackY[i]) * scaleY, 2); - - if (distance_i < distance) { - - index = i; - distance = distance_i; - } - } - - return index; - } - function binarySearch(target, haystack, reverse) { let seedA = 0, @@ -8799,7 +8431,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ while (true) { i++; if (i > 100) { - throw 'Error loop'; + throw "Error loop"; } seedInt = Math.floor((seedA + seedB) / 2); @@ -8844,19 +8476,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } } - Waveform.BELOW = Symbol(); - Waveform.ABOVE = Symbol(); - - Waveform.BOX = Symbol(); - Waveform.BAR = Symbol(); - - const MULTIPLY = Symbol(); - const ADD = Symbol(); - const SUBTRACT = Symbol(); - const DIVIDE = Symbol(); - - //module.exports = Waveform; - exports.default = Waveform; module.exports = exports['default']; }); @@ -9059,25 +8678,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } } - setWaveform(waveform) { - - if (!(waveform instanceof _waveform2.default)) { - throw 'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance'; - } - - this.waveform = waveform; - - this.minX = this.waveform.getXMin(); - this.maxX = this.waveform.getXMax(); - this.minY = this.waveform.getMin(); - this.maxY = this.waveform.getMax(); - - this.graph.updateDataMinMaxAxes(); - this.dataHasChanged(); - - return this; - } - /** * Sets the options of the serie * @see SerieLineDefaultOptions @@ -12065,7 +11665,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ setWaveform(waveform) { if (!(waveform instanceof _waveform2.default)) { - throw 'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance'; + console.trace(); + console.error(waveform); + throw new Error('Cannot assign waveform to serie. Waveform is not of the proper Waveform instance'); } this.waveform = waveform; @@ -13004,8 +12606,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ // 25.10.2017. This is to help in the case there's no autoscaling if (isNaN(this.getCurrentMin())) { - this.setCurrentMin(this.getMinValue()); - this.cache(); + //this.setCurrentMin( this.getMinValue() ); + //this.cache(); + } } @@ -13013,9 +12616,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ this.dataMax = max; // 25.10.2017. This is to help in the case there's no autoscaling + // 02.02.2018. Don't agree with this. Next time, put a link to show the use of this piece of code if (isNaN(this.getCurrentMax())) { - this.setCurrentMax(this.getMaxValue()); - this.cache(); + // this.setCurrentMax( this.getMaxValue() ); + //this.cache(); + } } @@ -13436,7 +13041,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ if (val === undefined || this.getForcedMin() !== false && (val < this.getForcedMin() || val === undefined)) { val = this.getMinValue(); } - this.currentAxisMin = val; if (this.options.logScale) { this.currentAxisMin = Math.max(1e-50, val); @@ -14130,6 +13734,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ // Ex 50 / (100) * (1000 - 700) + 700 //console.log( value, this.getCurrentMin(), this.getMaxPx(), this.getMinPx(), this.getCurrentInterval() ); + if (!this.options.logScale) { return (value - this.getCurrentMin()) / this.getCurrentInterval() * (this.getMaxPx() - this.getMinPx()) + this.getMinPx(); @@ -15828,20 +15433,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } if (this.moving) { - + console.log(this._data); // If the pos2 is defined by a delta, no need to move them - if (pos.x) { + if (pos.x && !this._data.noX) { pos.deltaPosition('x', deltaX, this.getXAxis()); } - if (pos.y) { + if (pos.y && !this._data.noY) { pos.deltaPosition('y', deltaY, this.getYAxis()); } // If the pos2 is defined by a delta, no need to move them - if (pos2.x) { + if (pos2.x && !this._data.noX) { pos2.deltaPosition('x', deltaX, this.getXAxis()); } - if (pos2.y) { + if (pos2.y && !this._data.noY) { pos2.deltaPosition('y', deltaY, this.getYAxis()); } } @@ -18484,260 +18089,94 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ /* 20 */ /***/ (function(module, exports, __webpack_require__) { -var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) { - if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), - __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? - (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if (typeof exports !== "undefined") { - factory(module, exports); - } else { - var mod = { - exports: {} - }; - factory(mod, mod.exports); - global.data_aggregator = mod.exports; - } -})(this, function (module, exports) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - var dataAggregator; - - if (typeof URL === 'undefined' || typeof URL.createObjectURL === 'undefined' || typeof Blob === 'undefined' || typeof Worker === 'undefined') { - dataAggregator = () => {}; - } else { - var aggregatorWorker; - var queue = {}; - - let string = function () { - - onmessage = function (e) { - - const data = e.data.data, - // The initial data - maxX = e.data.maxX, - minX = e.data.minX, - maxY = e.data.maxY, - minY = e.data.minY, - direction = e.data.direction; - - let numPoints = e.data.numPoints; // Total number of points in the slot - let l = data.length; // Number of data in the original buffer - let i = 0; - let k = -4; - let slots = []; - let dataAggregatedX = []; - let dataAggregatedY = []; - let aggregationSum = []; - let getX; - let slotNumber; - let lastAggregationX; - let lastAggregation; - let lastAggregationSum; - let newAggregation; - let newAggregationX; - - if (e.data.xdata) { - - getX = function getX(index) { - return e.data.xdata[index]; - }; - } else { - getX = function getX(index) { - return index * e.data.xScale + e.data.xOffset; - }; - } - - let aggregations = {}; - - // Direction x - if (direction == 'x') { - const dataPerSlot = numPoints / (maxX - minX); // Computed number of aggregation per slot - - for (; i < l; i++) { - - // dataPerSlot: 1 / 1000 ( compression by 1'000 ) - //console.log( dataPerSlot, getX( i ) ); - slotNumber = Math.floor((getX(i) - minX) * dataPerSlot); - - if (slots[k] !== slotNumber) { - k += 4; - slots[k] = slotNumber; - - let slotX = (slotNumber + 0.5) / dataPerSlot + minX; - - dataAggregatedX[k] = slotX; - dataAggregatedX[k + 1] = slotX; - dataAggregatedX[k + 2] = slotX; - dataAggregatedX[k + 3] = slotX; - - dataAggregatedY[k] = data[i]; - dataAggregatedY[k + 1] = data[i]; - dataAggregatedY[k + 2] = data[i]; - dataAggregatedY[k + 3] = data[i]; - aggregationSum[k] = 0; - } - - dataAggregatedY[k + 1] = Math.min(data[i], dataAggregatedY[k + 1]); - dataAggregatedY[k + 2] = Math.max(data[i], dataAggregatedY[k + 2]); - dataAggregatedY[k + 3] = data[i]; - aggregationSum[k] += data[i]; - } - } else { - // y - - const dataPerSlot = numPoints / (maxY - minY); // Computed number of aggregation per slot - - for (; i < l; i++) { - - // dataPerSlot: 1 / 1000 ( compression by 1'000 ) - //console.log( dataPerSlot, getX( i ) ); - slotNumber = Math.floor((data[i] - minY) * dataPerSlot); - - if (slots[k] !== slotNumber) { - k += 4; - slots[k] = slotNumber; - - let slotY = (slotNumber + 0.5) / dataPerSlot + minY; - - dataAggregatedY[k] = slotY; - dataAggregatedY[k + 1] = slotY; - dataAggregatedY[k + 2] = slotY; - dataAggregatedY[k + 3] = slotY; - - dataAggregatedX[k] = data[i]; - dataAggregatedX[k + 1] = data[i]; - dataAggregatedX[k + 2] = data[i]; - dataAggregatedX[k + 3] = data[i]; - aggregationSum[k] = 0; - } - dataAggregatedX[k + 1] = Math.min(getX(i), dataAggregatedX[k + 1]); - dataAggregatedX[k + 2] = Math.max(getX(i), dataAggregatedX[k + 2]); - dataAggregatedX[k + 3] = getX(i); - aggregationSum[k] += getX(i); - } - } - - aggregations[numPoints] = { - x: dataAggregatedX, - y: dataAggregatedY, - sums: aggregationSum - }; - - lastAggregation = dataAggregatedY; - lastAggregationX = dataAggregatedX; - lastAggregationSum = aggregationSum; +"use strict"; + + +var hasOwn = Object.prototype.hasOwnProperty; +var toStr = Object.prototype.toString; + +var isArray = function isArray(arr) { + if (typeof Array.isArray === 'function') { + return Array.isArray(arr); + } + + return toStr.call(arr) === '[object Array]'; +}; + +var isPlainObject = function isPlainObject(obj) { + if (!obj || toStr.call(obj) !== '[object Object]') { + return false; + } + + var hasOwnConstructor = hasOwn.call(obj, 'constructor'); + var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); + // Not own constructor property must be Object + if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { + return false; + } + + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + var key; + for (key in obj) { /**/ } + + return typeof key === 'undefined' || hasOwn.call(obj, key); +}; + +module.exports = function extend() { + var options, name, src, copy, copyIsArray, clone; + var target = arguments[0]; + var i = 1; + var length = arguments.length; + var deep = false; + + // Handle a deep copy situation + if (typeof target === 'boolean') { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { + target = {}; + } + + for (; i < length; ++i) { + options = arguments[i]; + // Only deal with non-null/undefined values + if (options != null) { + // Extend the base object + for (name in options) { + src = target[name]; + copy = options[name]; + + // Prevent never-ending loop + if (target !== copy) { + // Recurse if we're merging plain objects or arrays + if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { + if (copyIsArray) { + copyIsArray = false; + clone = src && isArray(src) ? src : []; + } else { + clone = src && isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[name] = extend(deep, clone, copy); + + // Don't bring in undefined values + } else if (typeof copy !== 'undefined') { + target[name] = copy; + } + } + } + } + } + + // Return the modified object + return target; +}; - while (numPoints > 256) { - - numPoints /= 2; - - newAggregation = []; - newAggregationX = []; - - k = 0; - - if (direction == 'x') { - - for (i = 0, l = lastAggregation.length - 8; i < l; i += 8) { - - newAggregationX[k] = (lastAggregationX[i] + lastAggregationX[i + 4]) / 2; - newAggregationX[k + 1] = newAggregationX[k]; - newAggregationX[k + 2] = newAggregationX[k]; - newAggregationX[k + 3] = newAggregationX[k]; - - newAggregation[k] = lastAggregation[i]; - newAggregation[k + 1] = Math.min(lastAggregation[i + 1], lastAggregation[i + 5]); - newAggregation[k + 2] = Math.max(lastAggregation[i + 2], lastAggregation[i + 6]); - newAggregation[k + 3] = lastAggregation[i + 7]; - - aggregationSum[k] = (lastAggregationSum[i] + lastAggregationSum[i + 4]) / 2; - - k += 4; - } - } else { - - for (i = 0, l = lastAggregation.length - 8; i < l; i += 8) { - - newAggregation[k] = (lastAggregation[i] + lastAggregation[i + 4]) / 2; - newAggregation[k + 1] = newAggregation[k]; - newAggregation[k + 2] = newAggregation[k]; - newAggregation[k + 3] = newAggregation[k]; - - newAggregationX[k] = lastAggregationX[i]; - newAggregationX[k + 1] = Math.min(lastAggregationX[i + 1], lastAggregationX[i + 5]); - newAggregationX[k + 2] = Math.max(lastAggregationX[i + 2], lastAggregationX[i + 6]); - newAggregationX[k + 3] = lastAggregationX[i + 7]; - - aggregationSum[k] = (lastAggregationSum[i] + lastAggregationSum[i + 4]) / 2; - - k += 4; - } - } - - aggregations[numPoints] = { - x: newAggregationX, - y: newAggregation, - sums: aggregationSum - }; - - lastAggregation = newAggregation; - lastAggregationX = newAggregationX; - lastAggregationSum = aggregationSum; - - aggregationSum = []; - } - - postMessage({ - aggregates: aggregations, - _queueId: e.data._queueId - }); - }; - }.toString(); - - string = string.replace(/^\s*function\s*\(\s*\)\s*\{/, ''); - string = string.replace(/}\s*$/, ''); - /* - if ( typeof URL == "undefined" ) { - module.exports = function() {}; - } else { - */ - - var workerUrl = URL.createObjectURL(new Blob([string], { - type: 'application/javascript' - })); - - aggregatorWorker = new Worker(workerUrl); - - aggregatorWorker.onmessage = function (e) { - - var id = e.data._queueId; - delete e.data._queueId; - queue[id](e.data); - delete queue[id]; - }; - - dataAggregator = function (toOptimize) { - - var requestId = Date.now(); - toOptimize._queueId = requestId; - - var prom = new Promise(resolver => { - queue[requestId] = resolver; - }); - - aggregatorWorker.postMessage(toOptimize); - return prom; - }; - } - - exports.default = dataAggregator; - module.exports = exports['default']; -}); /***/ }), /* 21 */ @@ -24214,7 +23653,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } this.setHandles();*/ - this.ratioLabel && this.updateIntegralValue(this.ratioLabel) || this.updateLabels(); + this.serie.ratioLabel && this.updateIntegralValue(this.serie.ratioLabel) || this.updateLabels(); this.changed(); this.handleCondition = !this.xor(incrementation == -1, flipped); @@ -24225,19 +23664,19 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return true; } - updateIntegralValue(ratioLabel = this.ratioLabel, forceValue) { - + updateIntegralValue(ratioLabel = this.serie.ratioLabel, forceValue) { + console.log(ratioLabel); if (ratioLabel) { - this.ratioLabel = ratioLabel; + this.serie.ratioLabel = ratioLabel; } - if (forceValue !== undefined) { - this.ratioLabel = forceValue / this.sumVal; + if (!isNaN(forceValue) && !isNaN(this.sumVal) && this.sumVal) { + this.serie.ratioLabel = forceValue / this.sumVal; } this.setLabelText(ratioLabel ? (Math.round(100 * this.sumVal * ratioLabel) / 100).toPrecision(3) : 'N/A', 0); this.updateLabels(); - return this.ratioLabel; + return this.serie.ratioLabel; } getAxis() { diff --git a/dist/jsgraph-es6.min.js b/dist/jsgraph-es6.min.js index 820193fd6..93e499867 100644 --- a/dist/jsgraph-es6.min.js +++ b/dist/jsgraph-es6.min.js @@ -1,2 +1,2 @@ -(function(e,t){'object'==typeof exports&&'object'==typeof module?module.exports=t():'function'==typeof define&&define.amd?define([],t):'object'==typeof exports?exports.Graph=t():e.Graph=t()})('undefined'==typeof self?this:self,function(){var e=Math.exp,t=Math.pow,r=Number.MAX_VALUE,a=Math.ceil,s=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,i=Math.log,n=Math.floor,d=Math.max,p=Math.abs,g=Math.min,u=Math.round;return function(e){function t(r){if(i[r])return i[r].exports;var a=i[r]={i:r,l:!1,exports:{}};return e[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}var i={};return t.m=e,t.c=i,t.d=function(e,i,r){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var i=e&&e.__esModule?function(){return e['default']}:function(){return e};return t.d(i,'a',i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p='',t(t.s=19)}([function(e,t){var i,r,a;(function(s,o){r=[t],i=o,a='function'==typeof i?i.apply(t,r):i,!(void 0!==a&&(e.exports=a))})(this,function(e){'use strict';function t(e,i,r){return 0>r&&(r+=1),1a?a*(1+i):a+i-a*i,l=2*a-n;s=t(l,n,e+1/3),r=t(l,n,e),o=t(l,n,e-1/3)}return[u(255*s),u(255*r),u(255*o)]},e.saveDomAttributes=function(e,t,a){if(e)for(var s in e._savedAttributesIds=e._savedAttributesIds||[],-1{this.group.removeChild(e)}),this._labelsBackground.map((e)=>{this.group.removeChild(e)}),this._labels=[],this._labelsBackground[e]=[];for(var e=0;void 0!==this.getProp('labelText',e);)this._labels[e]||(this._labels[e]=document.createElementNS(this.graph.ns,'text'),this._labels[e].setAttribute('data-label-i',e),this._labels[e].jsGraphIsShape=this,this._labelsBackground[e]=document.createElementNS(this.graph.ns,'rect'),this._labelsBackground[e].setAttribute('data-label-i',e),this._labelsBackground[e].jsGraphIsShape=this,this.group.appendChild(this._labelsBackground[e]),this.group.appendChild(this._labels[e]),this._labels[e].addEventListener('dblclick',(t)=>{t.stopPropagation(),this.labelDblClickListener(t)}),this._labelsBackground[e].addEventListener('dblclick',(t)=>{t.stopPropagation(),this.labelDblClickListener(t)})),e++;return this.updateLabels(),this}isLabelEditable(e){return this.getProp('labelEditable',e||0)}updateLabels(){this;this._labels=this._labels||[];for(var e=0,t=this._labels.length;e{var s=this,e=document.createElementNS(s.graph.ns,t);if(e.jsGraphIsShape=!0,r)for(var o in r)e.setAttribute(o,r[o]);e.addEventListener('mousedown',(t)=>{s.isResizable()&&(t.preventDefault(),t.stopPropagation(),s.graph.emit('beforeShapeResize',s),this.emit('beforeShapeResize'),!s.graph.prevent(!1)&&(s.resizing=!0,s.handleSelected=i,s.handleMouseDown(t)))}),a&&a(s.handles[i]),s.handles[i]=e}).call(this,o);return this.handles}}createHandles(){this.hasStaticHandles()&&(this.addHandles(),this.setHandles())}handleMouseDownImpl(){}handleMouseMoveImpl(){}handleMouseUpImpl(){}handleCreateImpl(){}handleMouseDown(t){if(!this.isLocked())return(this.isMovable()||this.isResizable())&&this.graph.elementMoving(this),this.getProp('selectOnMouseDown')&&this.graph.selectShape(this),this.isMovable()&&!this.resizing&&(this.graph.emit('beforeShapeMove',self),!this.graph.prevent(!1)&&(this.moving=!0,this.moved=!1)),this._mouseCoords=this.graph._getXY(t),this.handleMouseDownImpl(t,this._mouseCoords)}handleClick(t){return this.graph.emit('shapeClicked',this),this.emit('shapeClicked'),!!this.isSelectable()&&void(!t.shiftKey&&this.graph.unselectShapes(),this.getProp('selectOnClick')&&this.graph.selectShape(this))}handleMouseMove(t){if((this.resizing||this.moving)&&!this.isSelected()&&this.graph.selectShape(this),this.graph.emit('beforeShapeMouseMove',this),this.emit('beforeShapeMouseMove'),this.graph.prevent(!1)||!this._mouseCoords)return!1;this.moved=!0;var e=this.graph._getXY(t),i=this.getXAxis().getRelVal(e.x-this._mouseCoords.x),r=this.getYAxis().getRelVal(e.y-this._mouseCoords.y);(0!=i||0!==r)&&(this.preventUnselect=!0),this._mouseCoords=e;var a=this.handleMouseMoveImpl(t,i,r,e.x-this._mouseCoords.x,e.y-this._mouseCoords.y);return a}handleMouseUp(t){return this.moving&&this.moved&&(this.graph.emit('shapeMoved',this),this.emit('shapeMoved')),(this.handleSelected||this.resize)&&(this.graph.emit('shapeResized',this),this.emit('shapeResized')),this.moving=!1,this.resizing=!1,this.handleSelected=!1,this.graph.elementMoving(!1),this.handleMouseUpImpl(t)}handleDblClick(){}handleMouseOver(){!this.getProp('highlightOnMouseOver')||this.moving||this.resizing||this.highlight(),this.graph.emit('shapeMouseOver',this)}handleMouseOut(){this.getProp('highlightOnMouseOver')&&this.unHighlight(),this.graph.emit('shapeMouseOut',this)}lock(){return this.setProp('locked',!0),this}unlock(){return this.setProp('locked',!1),this}isLocked(){return this.getProp('locked')||this.graph.shapesLocked}movable(){this.setProp('movable',!0)}unmovable(){return this.setProp('movable',!1),!1}isMovable(){return this.getProp('movable')}resizable(){this.setProp('resizable',!0)}unresizable(){this.setProp('resizable',!1)}isResizable(){return this.getProp('resizable')}selectable(){this.setProp('selectable',!0)}unselectable(){this.graph.unselectShape(this),this.setProp('selectable',!1)}isSelectable(){return this.getProp('selectable')}highlight(e,t){return e||(e=this.getHighlightAttributes()),t||(t='highlight'),n.saveDomAttributes(this._dom,e,t),this.highlightImpl(),this}unHighlight(e){return e||(e='highlight'),n.restoreDomAttributes(this._dom,e),this.unHighlightImpl(),this}highlightImpl(){}unHighlightImpl(){}getHighlightAttributes(){return this._highlightAttributes}setHighlightAttributes(e){return this._highlightAttributes=e,this}getMaskingID(){return this.maskingId}maskWith(e){const t=e.getMaskingID();t?this._dom.setAttribute('mask','url(#'+t+')'):this._dom.removeAttribute('mask')}updateMask(){}labelDblClickListener(t){var e=parseInt(t.target.getAttribute('data-label-i')),i=this;if(isNaN(e))return;if(!this.isLabelEditable(e))return;t.preventDefault(),t.stopPropagation();var r=document.createElement('input');r.setAttribute('type','text'),r.setAttribute('value',i.getProp('labelText',e)),i.graph.wrapper.prepend(r),r.select(),n.setCSS(r,{position:'absolute',marginTop:parseInt(t.target.getAttribute('y').replace('px',''))+this.graph.getPaddingTop()-10+'px',marginLeft:parseInt(t.target.getAttribute('x').replace('px',''))+this.graph.getPaddingLeft()-50+'px',textAlign:'center',width:'100px'});const a=i.getLabelText(e),s=function(){i.setLabelText(r.value,e),i._labels[e].textContent=r.value;const t=r.value;r.remove(),r.removeEventListener('blur',s),r=!1,i.changed('shapeLabelChanged',{previousValue:a,nextValue:t})};r.addEventListener('blur',s),r.addEventListener('keyup',function(t){13===t.keyCode&&s()}),r.addEventListener('keypress',function(t){t.stopPropagation()}),r.addEventListener('keydown',function(t){t.stopPropagation()}),r.focus()}appendToDom(){return this._forcedParentDom?this._forcedParentDom.appendChild(this.group):this.graph.appendShapeToDom(this),this}forceParentDom(e){return this._forcedParentDom=e,this}isHTML(){return!1}}d.prototype.computePosition=d.prototype.calculatePosition,d.prototype.showLabel=d.prototype.displayLabel,d.prototype.remove=d.prototype.kill,t.default=d,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(7)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{static default(){return{}}constructor(e){super(...arguments),this.options=Object.assign({},a.default(),this.constructor.default(),e)}init(e){this.graph=e}onMouseDown(){}onMouseUp(){}onMouseMove(){}}t.default=a,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(6),i(0),i(7),i(4)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r,a,s){'use strict';function o(e){return e&&e.__esModule?e:{default:e}}function n(e,t,i,r){var a=e.getConstructor(r,!0);if(a||'string'!=typeof r||(a=e.getConstructor('graph.serie.'+r,!0)),a){var s=new a(e,t,i);e.appendSerieToDom(s)}else return E.throwError('No constructor exists for the serie type provided. Use Graph.registerConstructor( name, constructor ) first is you use your own series');return s}function l(e,t){for(var r=0,i=t.length,a;rt[r][s][1]&&e[1]>t[r][s][1]||(a=!1);if(a)return t[r].push(e),r}return t.push([e]),t.length-1}function g(e){var t={top:[],bottom:[],left:[],right:[]},i={top:[],bottom:[],left:[],right:[]};e._painted=!0,e._applyToAxes(function(e,r){if(!e.isShown())return void e.hideGroup();if(e.showGroup(),!e.floating){var a=l(e.getSpan(),i[r]);e.setLevel(a),t[r][a]=d(e.getAxisPosition(),t[r][a]||0)}},!1,!0,!1);var r=t.top.reduce(function(e,t){return e+t},0),a=t.bottom.reduce(function(e,t){return e+t},0);e.drawingSpaceHeight=e.getDrawingHeight()-r-a,[t.top,t.bottom].map(function(e){e.reduce(function(t,i,r){return e[r]=t+i,t+i},0)}),e._applyToAxes(function(e,i){!e.isShown()||e.floating||e.setShift(t[i][e.getLevel()])},!1,!0,!1),e._applyToAxes(function(s,o){if(s.isShown()?s.showGroup():s.hideGroup(),s.setMinPx(r),s.setMaxPx(e.getDrawingHeight(!0)-a),!s.floating){let e=s.linkedToAxis?0:s.draw();if(s.isShown()){var n=l(s.getSpan(),i[o]);s.setLevel(n),t[o][n]=d(e,t[o][n]||0)}}},!1,!1,!0);var s=E.extend(!0,{},t);e._applyToAxes(function(e,i){!e.isShown()||e.floating||(s[i][e.getLevel()]=d(t[i][e.getLevel()],e.equalizePosition(t[i][e.getLevel()])))},!1,!1,!0),t=s;var o=t.left.reduce(function(e,t){return e+t},0),n=t.right.reduce(function(e,t){return e+t},0);e.drawingSpaceWidth=e.getDrawingWidth()-o-n,[t.left,t.right].map(function(e){e.reduce(function(t,i,r){return e[r]=t+i,t+i},0)}),e._applyToAxes((e,i)=>{!e.isShown()||e.floating||e.setShift(t[i][e.getLevel()])},!1,!1,!0),e._applyToAxes(function(t){!t.isShown(),t.setMinPx(o),t.setMaxPx(e.getDrawingWidth(!0)-n);t.floating||!t.linkedToAxis&&t.draw()},!1,!0,!1),e._applyToAxes(function(e){if(e.floating){var t=e.getFloatingAxis(),i=e.getFloatingValue(),r=t.getPx(i);e.setShift(r),e.linkedToAxis||e.draw()}},!1,!0,!0),_(e,'right',e.getDrawingWidth(!0),e.getDrawingWidth(!0),r,e.getDrawingHeight(!0)-a),_(e,'left',0,0,r,e.getDrawingHeight(!0)-a),_(e,'top',o,e.getDrawingWidth(!0)-n,0,0),_(e,'bottom',o,e.getDrawingWidth(!0)-n,e.getDrawingHeight(!0)-a,e.getDrawingHeight(!0)-a),e.clipRect.setAttribute('y',r),e.clipRect.setAttribute('x',o),e.clipRect.setAttribute('width',e.getDrawingWidth()-o-n),e.clipRect.setAttribute('height',e.getDrawingHeight()-r-a),e.rectEvent.setAttribute('y',r+e.getPaddingTop()),e.rectEvent.setAttribute('x',o+e.getPaddingLeft()),e.rectEvent.setAttribute('width',e.drawingSpaceWidth),e.rectEvent.setAttribute('height',e.drawingSpaceHeight),e.drawingSpaceMinX=o+e.getPaddingLeft(),e.drawingSpaceMinY=r+e.getPaddingTop(),e.drawingSpaceMaxX=e.getDrawingWidth()-n+e.getPaddingLeft(),e.drawingSpaceMaxY=e.getDrawingHeight()-a+e.getPaddingTop(),e._applyToAxes(function(e){e.isShown()&&e.drawLines()},!1,!0,!0),e.shift=t,e.redrawShapes()}function u(e,t,i){return console.log(t,i),e.forcedPlugin?(e.activePlugin=e.forcedPlugin,void e._pluginExecute(e.activePlugin,i,[e,t])):void c(e,t,[e,t],i)}function c(t,r,e,a){var s=t.options.keyActions,o,i;for(o=0,i=s.length;o{e.kill(s[o].keepInDom)}))}return!1}function h(){this.dom=document.createElementNS(B.ns,'svg'),this.dom.setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:xlink','http://www.w3.org/1999/xlink'),E.setAttributeTo(this.dom,{xmlns:B.ns,"font-family":this.options.fontFamily,"font-size":this.options.fontSize});try{E.setAttributeTo(this.dom,{"data-jsgraph-version":'v2.0.71'})}catch(t){}this.defs=document.createElementNS(B.ns,'defs'),this.dom.appendChild(this.defs),this.groupEvent=document.createElementNS(B.ns,'g'),this.rectEvent=document.createElementNS(B.ns,'rect'),E.setAttributeTo(this.rectEvent,{"pointer-events":'fill',fill:'transparent'}),this.groupEvent.appendChild(this.rectEvent),this.dom.appendChild(this.groupEvent),this.domTitle=document.createElementNS(B.ns,'text'),this.setTitle(this.options.title),E.setAttributeTo(this.domTitle,{"text-anchor":'middle',y:20}),this.groupEvent.appendChild(this.domTitle),this.graphingZone=document.createElementNS(B.ns,'g'),this.updateGraphingZone(),this.groupEvent.appendChild(this.graphingZone),this.axisGroup=document.createElementNS(B.ns,'g'),this.graphingZone.appendChild(this.axisGroup),this.groupGrids=document.createElementNS(B.ns,'g'),this.groupPrimaryGrids=document.createElementNS(B.ns,'g'),this.groupSecondaryGrids=document.createElementNS(B.ns,'g'),this.axisGroup.appendChild(this.groupGrids),this.groupGrids.appendChild(this.groupSecondaryGrids),this.groupGrids.appendChild(this.groupPrimaryGrids),this.plotGroup=document.createElementNS(B.ns,'g'),this.graphingZone.appendChild(this.plotGroup),this.layers=[],this._makeClosingLines(),this.clip=document.createElementNS(B.ns,'clipPath'),this.clip.setAttribute('id','_clipplot'+this._creation),this.defs.appendChild(this.clip),this.clipRect=document.createElementNS(B.ns,'rect'),this.clip.appendChild(this.clipRect),this.clip.setAttribute('clipPathUnits','userSpaceOnUse'),this.markerArrow=document.createElementNS(this.ns,'marker'),this.markerArrow.setAttribute('viewBox','0 0 10 10'),this.markerArrow.setAttribute('id','arrow'+this._creation),this.markerArrow.setAttribute('refX','6'),this.markerArrow.setAttribute('refY','5'),this.markerArrow.setAttribute('markerUnits','strokeWidth'),this.markerArrow.setAttribute('markerWidth','8'),this.markerArrow.setAttribute('markerHeight','6'),this.markerArrow.setAttribute('orient','auto');var e=document.createElementNS(B.ns,'path');e.setAttribute('d','M 0 0 L 10 5 L 0 10 z'),this.markerArrow.appendChild(e),this.defs.appendChild(this.markerArrow),this.markerHorizontalSplit=document.createElementNS(B.ns,'marker'),this.markerHorizontalSplit.setAttribute('viewBox','0 0 6 8'),this.markerHorizontalSplit.setAttribute('id','horionzalsplit_'+this.getId()),this.markerHorizontalSplit.setAttribute('refX','3'),this.markerHorizontalSplit.setAttribute('refY','4'),this.markerHorizontalSplit.setAttribute('markerUnits','strokeWidth'),this.markerHorizontalSplit.setAttribute('markerWidth','6'),this.markerHorizontalSplit.setAttribute('markerHeight','8');var t=document.createElementNS(B.ns,'line');t.setAttribute('x1','0'),t.setAttribute('y1','8'),t.setAttribute('x2','6'),t.setAttribute('y2','0'),t.setAttribute('stroke','black'),this.markerHorizontalSplit.appendChild(t),this.defs.appendChild(this.markerHorizontalSplit),this.markerVerticalSplit=document.createElementNS(B.ns,'marker'),this.markerVerticalSplit.setAttribute('viewBox','0 0 8 6'),this.markerVerticalSplit.setAttribute('id','verticalsplit_'+this.getId()),this.markerVerticalSplit.setAttribute('refX','4'),this.markerVerticalSplit.setAttribute('refY','3'),this.markerVerticalSplit.setAttribute('markerUnits','strokeWidth'),this.markerVerticalSplit.setAttribute('markerWidth','8'),this.markerVerticalSplit.setAttribute('markerHeight','6');var t=document.createElementNS(B.ns,'line');t.setAttribute('x1','0'),t.setAttribute('y1','0'),t.setAttribute('x2','8'),t.setAttribute('y2','6'),t.setAttribute('stroke','black'),this.markerVerticalSplit.appendChild(t),this.defs.appendChild(this.markerVerticalSplit),this.vertLineArrow=document.createElementNS(B.ns,'marker'),this.vertLineArrow.setAttribute('viewBox','0 0 10 10'),this.vertLineArrow.setAttribute('id','verticalline'+this._creation),this.vertLineArrow.setAttribute('refX','0'),this.vertLineArrow.setAttribute('refY','5'),this.vertLineArrow.setAttribute('markerUnits','strokeWidth'),this.vertLineArrow.setAttribute('markerWidth','20'),this.vertLineArrow.setAttribute('markerHeight','10'),this.vertLineArrow.setAttribute('orient','auto'),this.vertLineArrow.setAttribute('stroke-width','1px');var i=document.createElementNS(B.ns,'path');i.setAttribute('d','M 0 -10 L 0 10'),i.setAttribute('stroke','black'),this.vertLineArrow.appendChild(i),this.defs.appendChild(this.vertLineArrow),this.bypassHandleMouse=!1}function x(t){if(!t.wrapper)throw'No wrapper exists. Cannot register the events.';t.dom.setAttribute('tabindex',0),t.dom.addEventListener('keydown',(i)=>{u(t,i,'keydown')}),t.dom.addEventListener('keypress',(i)=>{u(t,i,'keypress')}),t.dom.addEventListener('keyup',(i)=>{u(t,i,'keyup')}),t.dom.addEventListener('mousemove',(i)=>{var e=t._getXY(i);y(t,e.x,e.y,i)}),t.dom.addEventListener('mouseleave',()=>{C(t)}),t.groupEvent.addEventListener('mousedown',(i)=>{if(t.focus(),!(3==i.which||i.ctrlKey)){var e=t._getXY(i);m(t,e.x,e.y,i)}}),t.dom.addEventListener('mouseup',(i)=>{t.emit('mouseUp',i);var e=t._getXY(i);k(t,e.x,e.y,i)}),t.wrapper.addEventListener('mouseup',(t)=>{t.stopPropagation()}),t.dom.addEventListener('dblclick',(i)=>{t.emit('dblClick',i);var e=t._getXY(i);A(t,e.x,e.y,i)}),t.groupEvent.addEventListener('click',(i)=>{if(!(3==i.which||i.ctrlKey)){var e=t._getXY(i);t.prevent(!1)||M(t,e.x,e.y,i)}}),t.groupEvent.addEventListener('mousewheel',(i)=>{var e=i.wheelDeltaY||i.wheelDelta||-i.deltaY,r=t._getXY(i);return v(t,e,r.x,r.y,i),!1}),t.groupEvent.addEventListener('wheel',(i)=>{var e=t._getXY(i),r=i.wheelDeltaY||i.wheelDelta||-i.deltaY;return v(t,r,e.x,e.y,i),!1})}function m(t,i,r,a){return t.forcedPlugin?(t.activePlugin=t.forcedPlugin,void t._pluginExecute(t.activePlugin,'onMouseDown',[t,i,r,a])):void(t.activePlugin&&(t.activePlugin=!1),f(t,a,[t,i,r,a],'onMouseDown'))}function y(t,r,a,s){if(t.bypassHandleMouse)return void t.bypassHandleMouse.handleMouseMove(s);if(!(t.activePlugin&&t._pluginExecute(t.activePlugin,'onMouseMove',[t,r,a,s]))){if(t._applyToAxes('handleMouseMove',[r-t.options.paddingLeft,s],!0,!1),t._applyToAxes('handleMouseMove',[a-t.options.paddingTop,s],!1,!0),!t.activePlugin){var e;if(t.options.trackingLine&&t.options.trackingLine.enable&&t.options.trackingLine.snapToSerie&&'common'==t.options.trackingLine.mode){var o=t.options.trackingLine.snapToSerie;if(e=o.handleMouseMove(!1,!0),this.trackingObject)if(!e)t.trackingObject.hide();else{t.trackingObject.show(),t.trackingObject.getPosition(0).x=e.xClosest,t.trackingObject.getPosition(1).x=e.xClosest,t.trackingObject.redraw();var r=o.getXAxis().getPx(e.xClosest)+t.options.paddingLeft}var n=t.options.trackingLine.series;n||(n=t.getSeries().map(function(e){return{serie:e,withinPx:20,withinVal:-1}})),t._trackingLegend=N(t,n,r,a,t._trackingLegend,t.options.trackingLine.textMethod,e.xClosest)}}if(t.options.onMouseMoveData){for(var l={},d=0;d{t.getXAxis()==e&&t.kill()})),e.isY()&&(-1<(r=this.axis.left.indexOf(e))&&this.axis.left.splice(r,1),-1<(r=this.axis.right.indexOf(e))&&this.axis.right.splice(r,1),!i&&this.series.forEach((t)=>{t.getYAxis()==e&&t.kill()})),this.axisGroup.removeChild(e.group),this.groupPrimaryGrids.removeChild(e.gridPrimary),this.groupSecondaryGrids.removeChild(e.gridSecondary),t||this.draw(!0)}hasXAxis(e){return this.hasTopAxis(e)||this.hasBottomAxis(e)}hasYAxis(e){return this.hasLeftAxis(e)||this.hasRightAxis(e)}hasTopAxis(e){return this.hasAxis(e,this.axis.top)}hasBottomAxis(e){return this.hasAxis(e,this.axis.bottom)}hasLeftAxis(e){return this.hasAxis(e,this.axis.left)}hasRightAxis(e){return this.hasAxis(e,this.axis.right)}hasAxis(e,t){for(var r=0,i=t.length;re.include(t.getType()))}drawSerie(e,t){if(!e.draw)throw new Error('Serie has no method draw');e.draw(t)}drawSeries(e){if(this.width&&this.height)for(var t=this.series.length-1;0<=t;t--)this.series[t].isShown()&&this.drawSerie(this.series[t],e)}resetSeries(){this.removeSeries()}killSeries(){this.resetSeries()}removeSeries(){for(;this.series[0];)this.series[0].kill(!0);this.series=[],this.legend&&this.legend.update()}selectSerie(e,t){'object'==typeof e||(e=this.getSerie(e));this.selectedSerie==e&&this.selectedSerie.selectionType==t||(this.selectedSerie!==e&&this.selectedSerie&&this.unselectSerie(this.selectedSerie),this.selectedSerie=e,this.triggerEvent('onSelectSerie',e),e.select(t||'selected'))}getSelectedSerie(){return this.selectedSerie}unselectSerie(e){e.unselect&&(e.unselect(),this.selectedSerie=!1,this.triggerEvent('onUnselectSerie',e))}getShapesOfSerie(e){for(var t=[],r=this.shapes.length-1;0<=r;r--)this.shapes[r].getSerie()==e&&t.push(this.shapes[r]);return t}makeToolbar(e){var t=this.getConstructor('graph.toolbar');return t?this.toolbar=new t(this,e):E.throwError('No constructor exists for toolbar')}getShapes(){return this.shapes||[]}newShape(e,t,r=!1,a){if(this.prevent(!1),!r&&(this.emit('beforeNewShape',t),this.prevent(!1)))return!1;'object'==typeof e&&(r=t,t=e,e=t.type),t=t||{},t._id=E.guid();var s;if(s='function'==typeof e?e:this.getConstructor('graph.shape.'+e),!s)return E.throwError('No constructor for this shape');var o=new s(this,t);if(!o)return E.throwError('Failed to construct shape.');if(o.type=e,o.graph=this,o._data=t,void 0!==t.properties&&o.setProperties(t.properties),o.init(this,a),void 0!==t.props)for(var n in t.props)o.setProp(n,t.props[n]);if(t.position)for(var n=0,i=t.position.length;n{o.addTransform(e,t)}),void 0!==t.highlightOnMouseOver&&o.setProp('highlightOnMouseOver',!0),t.labelEditable&&o.setProp('labelEditable',t.labelEditable),t.labels&&!t.label&&(t.label=t.labels),void 0!==t.label){Array.isArray(t.label)||(t.label=[t.label]);for(var n=0,i=t.label.length;n[e.getZPos(),e]);n.sort((e,t)=>t[0]-e[0]);let l=0;n.forEach((e)=>{e[1].setLayer(l),this.appendSerieToDom(e[1]),l++}),this.drawSeries(!0)}kill(){this.wrapper.removeChild(this.dom)}_removeSerie(e){this.series.splice(this.series.indexOf(e),1),this._pluginsExecute('serieRemoved',e)}contextListen(e,t,i){if(this.options.onContextMenuListen)return this.options.onContextMenuListen(e,t,i)}lockShapes(){this.shapesLocked=!0;for(var e=0,t=this.shapes.length;ethis.drawingSpaceWidth}getDrawingSpaceHeight(){return()=>this.drawingSpaceHeight}getDrawingSpaceMinX(){return()=>this.drawingSpaceMinX}getDrawingSpaceMinY(){return()=>this.drawingSpaceMinY}getDrawingSpaceMaxX(){return()=>this.drawingSpaceMaxX}getDrawingSpaceMaxY(){return()=>this.drawingSpaceMaxY}trackingLine(e){var t=this;return'boolean'==typeof e?void(this.options.trackingLine&&(this.options.trackingLine.enable=e)):(e&&(this.options.trackingLine=e),e.series=e.series||[],e.enable=void 0===e.enable||!!e.enable,'individual'==e.mode?e.series&&(!Array.isArray(e.series)&&('all'==e.series?e.series=this.series.map((e)=>({serie:e})):e.series=[e.series]),e.series.forEach((e)=>{if('object'!=typeof e.serie){if('object'!=typeof e)throw new Error('Misuse of the trackingLine() method. Each serie must be an object with the serie property: { series: [ { serie: jsGraphSerie, options: { ... someOptions } } ] }');e.serie=this.getSerie(e.serie)}e.serie&&t.addSerieToTrackingLine(e.serie,e)})):e.series.forEach((e)=>{e.serie.disableTracking()}),!e.noLine)?(this.trackingObject||(this.trackingObject=this.newShape('line',E.extend(!0,{position:[{y:'min'},{y:'max'}],stroke:'black',layer:-1},e.trackingLineShapeOptions))),this.trackingObject.draw(),this.trackingObject):void 0}addSerieToTrackingLine(e,t){this.options.trackingLine||this.trackingLine({mode:'individual'}),this.options.trackingLine.series.forEach((t,i)=>{t.serie==e&&this.options.trackingLine.series.splice(i,1)}),this.options.trackingLine.series.push(Object.assign({serie:e},t)),e.enableTracking((e,i,r,a)=>{this.options.trackingLine.enable&&i&&(this.trackingObject&&(this.trackingObject.show(),this.trackingObject.getPosition(0).x=i.trueX,this.trackingObject.getPosition(1).x=i.trueX,this.trackingObject.redraw()),e._trackingLegend=N(this,{serie:e},r,a,e._trackingLegend,t.textMethod?t.textMethod:(e)=>{for(var t in e)return e[t].serie.serie.getName()+': '+e[t].serie.serie.getYAxis().valueToHtml(e[t].yValue)},i.trueX),e._trackingLegend&&(e._trackingLegend.style.display='block'))},(e)=>{this.trackingObject&&this.trackingObject.hide(),e.trackingShape&&e.trackingShape.hide(),e._trackingLegend&&(e._trackingLegend.style.display='none'),e._trackingLegend=N(this,{serie:e},!1,!1,e._trackingLegend,!1,!1)})}setKatexRenderer(e){this._katexRenderer=e}hasKatexRenderer(){return!!this._katexRenderer}renderWithKatex(e,t){if(this._katexRenderer){t?t.removeChild(t.firstChild):t=document.createElementNS(B.ns,'foreignObject');let i=document.createElement('div');return t.appendChild(i),this._katexRenderer(e,i),t}return!1}static fromJSON(e,t){let i={},r={left:[],top:[],right:[],bottom:[]},a,s;return e.title&&(i.title=e.title),e.axis&&e.axis.forEach(function(e){e.type||E.throwError('Axis type is required (top, bottom, left or right)');var t={};e.label&&(t.labelValue=e.label),void 0!==e.unit&&(t.unit=e.unit),void 0!==e.unitWrapperAfter&&(t.unitWrapperAfter=e.unitWrapperAfter),void 0!==e.unitWrapperBefore&&(t.unitWrapperBefore=e.unitWrapperBefore),void 0!==e.min&&(t.forcedMin=e.min),void 0!==e.max&&(t.forcedMax=e.max),void 0!==e.flip&&(t.flipped=e.flip),r[e.type].push(t),e._jsGraphIndex=r[e.type].length-1}),a=new B(t,i,r),e.width&&a.setWidth(e.width),e.height&&a.setHeight(e.width),a._resize(),e.data&&e.data.forEach(function(t){var r=t.type,o={},n,d;let p;switch(t.type){case'bar':E.throwError('Bar charts not supported'),r=!1;break;case'color':r=B.SERIE_LINE_COLORED;break;case'scatter':r=B.SERIE_SCATTER;break;case'box':r=B.SERIE_BOX,('x'==t.orientation||'y'==t.orientation)&&(o.orientation=t.orientation);break;default:r=B.SERIE_LINE;}if(r!==B.SERIE_BOX&&(p=B.newWaveform()),!r)return void E.throwError('No valid serie type was found');if(n=a.newSerie(t.id||t.label||E.guid(),o,r),t.lineStyle){let e;Array.isArray(e)&&(e={unselected:e}),Object.entries(e).forEach(([e,t])=>{var i={};r===B.SERIE_LINE?(void 0!==t.lineWidth&&(i.lineWidth=t.lineWidth),void 0!==t.color&&(i.lineColor=t.color),t.lineStyle&&(i.lineStyle=t.lineStyle),n.setStyle(i,e)):void 0})}let g={},u={};if(t.defaultStyle&&(g=t.defaultStyle),t.defaultStyles&&(u=t.defaultStyles),t.styles){let e=Array.isArray(t.styles)?{unselected:t.styles}:t.styles;let i=new Set(Object.keys(u).concat(Object.keys(e)));i.forEach((t)=>{let i=[],a;e&&e[t]&&(i=e[t],!Array.isArray(i)&&(i=[i]),a=i.map(function(e){switch(r){case B.SERIE_LINE:return{type:e.shape,zoom:e.zoom,strokeWidth:e.lineWidth,strokeColor:e.lineColor,fillColor:e.color,points:e.points};break;case B.SERIE_BOX:return e;break;case B.SERIE_SCATTER:return e;}})),r===B.SERIE_LINE?n.setMarkers(a,t):r===B.SERIE_SCATTER?n.setStyle(Object.assign({},D,g,u[t]||{}),a,t):r===B.SERIE_BOX?n.setStyle(a[0],t||'unselected'):void 0})}if(t.color&&r==B.SERIE_LINE_COLORED&&n.setColors(t.color),r!==B.SERIE_BOX&&p.setData(t.y,t.x),!!n){let o=[],l=[],g=[],u=[],h=[],x=[],m=[],y=[];if(void 0!==p){if(t.errorX)for(var c=0,i=t.errorX.length;c{this.axis[e]&&(t=t.concat(this.axis[e].map((t)=>({type:e,label:t.options.label,unit:t.options.unit,min:t.options.forcedMin,max:t.options.forcedMax,flip:t.options.flipped}))),'top'==e||'bottom'==e?i.x=i.x.concat(this.axis[e]):i.y=i.y.concat(this.axis[e]))}),e.axis=t;let r=(e)=>{switch(e){case B.SERIE_LINE:return'line';break;case B.SERIE_BAR:return'bar';break;case B.SERIE_LINE_COLORED:return'color';break;case B.SERIE_SCATTER:return'scatter';}},a=(e,t)=>{let r=[];switch(e.getType()){case B.SERIE_LINE:for(var a=0;a{let t=[],s=[];if(e.getType()==B.SERIE_LINE)for(var o in e.styles){s.push({styleName:o,color:e.styles[o].lineColor,lineWidth:e.styles[o].lineWidth,lineStyle:e.styles[o].lineStyle});let i={styleName:o,styles:[]};t.push(i),i.styles=i.styles.concat((e.styles[o].markers||[]).map((e)=>({shape:e.type,zoom:e.zoom,lineWidth:e.strokeWidth,lineColor:e.strokeColor,color:e.fillColor,points:e.points})))}return{label:e.getLabel(),id:e.getName(),type:r(e.getType()),x:a(e,!0),y:a(e,!1),xAxis:i.x.indexOf(e.getXAxis()),yAxis:i.y.indexOf(e.getYAxis()),style:t,lineStyle:s}})),e}static registerConstructor(e,t){return I.has(e)?E.throwError('Constructor '+t+' already exists.'):void I.set(e,t)}static getConstructor(e,t=!1){return I.has(e)?I.get(e):!t&&E.throwError('Constructor "'+e+'" doesn\'t exist')}static newWaveform(){return new T.default(...arguments)}static waveform(){return new T.default(...arguments)}}B.prototype.getConstructor=B.getConstructor;var N=function(e,t,i,r,a,s,o){var n=!1;Array.isArray(t)||(t=[t]);var l=[];if(!a&&e.options.trackingLine.legend&&(n=!0,a=b(e)),t.map((t)=>{var r=t.serie.handleMouseMove(o,!1);if(!r||!s)return t.serie.trackingShape&&t.serie.trackingShape.hide(),a;if(0t.serie.getXAxis().getVal(i-e.options.paddingLeft)/1e5)t.serie.trackingShape&&t.serie.trackingShape.hide();else{l[t.serie.getName()]={yValue:r.xClosest,xValue:r.yClosest,serie:t,index:r};let i;if(i=e.options.trackingLine&&e.options.trackingLine.serieShape?e.options.trackingLine.serieShape:{shape:'ellipse',properties:{rx:[3*t.serie.getLineWidth()+'px'],ry:[3*t.serie.getLineWidth()+'px']}},t.serie.trackingShape||(t.serie.trackingShape=e.newShape(i.shape,{fillColor:t.serie.getLineColor(),strokeColor:'White',strokeWidth:t.serie.getLineWidth()},!0,i.properties).setSerie(t.serie).forceParentDom(t.serie.groupMain).draw(),i.onCreated&&i.onCreated(t.serie.trackingShape),t.serie.trackingShape.on('changed',()=>{i.onChanged&&i.onChanged(t.serie.trackingShape)})),t.serie.trackingShape.show(),t.serie.trackingShape.getPosition(0).x=r.xClosest,i.magnet){let e=i.magnet,a=e.within,s;e.withinPx&&(a=t.serie.getXAxis().getRelVal(e.withinPx)),(s=t.serie.findLocalMinMax(r.xClosest,a,e.mode))&&(t.serie.trackingShape.getPosition(0).x=s)}t.serie.trackingShape.redraw()}}),!!e.options.trackingLine.legend){if(0==Object.keys(l).length||!s)a.style.display='none';else{'none'==a.style.display||n?O(e,a,i,r,!0):H(e,a,i,r),a.style.display='block';var d=s(l,o,i,r);a.innerHTML=d}return a}},O=function(e,t,i,r,a){function s(){var e=(Date.now()-o)/200;1e&&window.requestAnimationFrame(s)}var o=Date.now(),n=t.offsetHeight,l=parseInt(t.style.marginLeft.replace('px','')||0),d=parseInt(t.style.marginTop.replace('px','')||0);return i=i>e.getWidth()/2?i-i%10-20-t.offsetWidth:i-i%10+30,r=r-r%10+n/2,a?(t.style.marginLeft=i+'px',void(t.style.marginTop=r+'px')):void window.requestAnimationFrame(s)},H=E.debounce(O,50);B.SERIE_LINE=Symbol(),B.SERIE_SCATTER=Symbol(),B.SERIE_CONTOUR=Symbol(),B.SERIE_BAR=Symbol(),B.SERIE_BOX=Symbol(),B.SERIE_ZONE=Symbol(),B.SERIE_LINE_COLORED=Symbol(),B.SERIE_ZONE=Symbol(),B.SERIE_DENSITYMAP=Symbol(),B.SERIE_LINE_3D=Symbol(),B.SERIE_ZONE_3D=Symbol(),B.TICKS_OUTSIDE=Symbol(),B.TICKS_INSIDE=Symbol(),B.TICKS_CENTERED=Symbol(),B.ns='http://www.w3.org/2000/svg',B.nsxlink='http://www.w3.org/1999/xlink',t.default=B,e.exports=t['default']})},function(e,l,c){var h,x,m;(function(t,i){x=[e,l,c(13),c(20)],h=i,m='function'==typeof h?h.apply(l,x):h,!(void 0!==m&&(e.exports=m))})(this,function(e,l,c,h){'use strict';function x(e){return e&&e.__esModule?e:{default:e}}function m(e){e--;for(var t=2;e>>=1;)t<<=1;return t}function y(e){for(var t=1;e>>=1;)t<<=1;return t}function f(e,t,i,r,a){return(e-t)/(i-t)*(a-r)+r}function b(e,a,s,o,n=1,d=1){let p=r,g=-1,u;for(var c=0,i=s.length;c=t.length-1)return t.length-1;if(0>=d)return 0;d+=i}if(d==a||t[d]==e||d==o)return d;if(t[d]<=e)r?o=d:a=d;else if(t[d]>e)r?a=d:o=d;else return!1;i*=-1}}Object.defineProperty(l,'__esModule',{value:!0});var k=x(c),M=x(h);class S{constructor(e=[],t=0,i=1){this.xOffset=t,this.xScale=i,this.errors={nb:0,bars:{above:null,below:null},boxes:{above:null,below:null}},this.setData(e),this.BELOW=S.BELOW,this.ABOVE=S.ABOVE,this.BOX=S.BOX,this.BAR=S.BAR}setData(e,t=null){if(Array.isArray(e[0])){let t=[],i=[];e.forEach((e)=>{t.push(e[0]),i.push(e[1])}),this.setXWaveform(t),e=i}let i=this._makeArray(e.length),r=!1;const a=this.isNaNAllowed();return e.map((e,t)=>{var s=Number.isNaN;(!a&&s(e[0])||s(e[1]))&&(r=!0),i[t]=e}),r&&this.warn('Trying to assign NaN values to a typed array that does not support NaNs. 0\'s will be used instead'),this._setData(i),t&&this.setXWaveform(t),this}getY(e,t=!1){return t&&this.dataInUse?this.dataInUse.y[e]*this.getScale()+this.getShift():this.data[e]*this.getScale()+this.getShift()}setXWaveform(e){if(!(e instanceof S))if(Array.isArray(e))e=new S(e);else throw'Cannot set X waveform. Data is not a valid array.';return this.xdata=e,this.computeXMinMax(),this}hasXWaveform(){return!!this.xdata}getXWaveform(){if(this.xdata)return this.xdata;let e=new S,t=[];for(var r=0;rthis.maxX||this.maxX===void 0)&&(this.maxX=e),(tthis.maxY||this.maxY===void 0)&&(this.maxY=t)}prepend(e,t){return'function'==typeof e&&(e=e(this)),'function'==typeof t&&(t=t(this)),this.xdata?this.xdata.prepend(null,e):null===e?this.xOffset-=this.xScale:(this.xdata=this.getXWaveform(),this.xdata.prepend(null,e)),this.data.unshift(t),this.recalculateMinMaxNewPoint(e,t),this}append(e,t){return this.data||(this.data=[]),'function'==typeof e&&(e=e(this)),'function'==typeof t&&(t=t(this)),this.xdata?this.xdata.append(null,e):null!==e&&(this.xdata=this.getXWaveform(),this.xdata.append(null,e)),this.monotoneous&&(t>=this.data[this.data.y]&&!1===this.getMonotoneousAscending()?this.monotoneous=!1:t<=this.data[this.data.y]&&!0===this.getMonotoneousAscending()&&(this.monotoneous=!1)),(1==this.data.length||void 0===this._monotoneousAscending)&&(this.monotoneous=!0,this._monotoneousAscending=t==this.data[0]?void 0:t>this.data[0]),this.data.push(t),this.recalculateMinMaxNewPoint(e,t),this}_makeArray(e){const t=this.getTypedArrayClass();return t?new t(e):Array(e)}_setData(e=this.data){const t=e.length;let r=1,i=e[1]>e[0],a=e[0],s=e[0];for(this._monotoneous=!0;re[r-1]&&(this._monotoneous=!1),e[r]===e[r]&&(a=g(e[r],a),s=d(e[r],s));if(this._monotoneous&&(this._monotoneousAscending=e[1]>e[0]),this.hasErrorBars()){for(r=0;rt){let i=e;e=t,t=i}var i=t-e+1,r=0;let a=0,s;for(var o=this.getData();e<=t;e++)o.length-1>e&&(s=this.getX(e+1)-this.getX(e),a+=s,r+=o[e]*s);return[r,i,a]}integrateP(e,t){var i=this._integrateP(e,t);return i[0]}integrate(e,t){return this.integrateP(this.getIndexFromX(e),this.getIndexFromX(t))}average(e=0,t=this.getLength()-1){return this.getAverageP(e,t)}mean(){return this.average()}getAverageP(e,t){var i=this._integrateP(e,t);return i[0]/i[2]}getAverageX(e,t){var i=this._integrateX(e,t);return i[0]/i[2]}checkMonotonicity(){let e=1,t=this.getData();const i=this.data.length;for(let r=t[1]>t[0];et[e-1])return this._monotoneous=!1;return this._monotoneousAscending=t[1]>t[0],this._monotoneous=!0}requireXMonotonicity(){this.xdata&&this.xdata.requireMonotonicity()}requireMonotonicity(){if(!this.isMonotoneous())throw'The wave must be monotonic'}isMonotoneous(){return!!this._monotoneous}isXMonotoneous(){return!this.xdata||this.xdata.isMonotoneous()}invert(e){let t=e||this.data;return t.reverse(),this.isMonotoneous()&&(this._monotoneousAscending=!this._monotoneousAscending),t}resampleForDisplay(e){let t=0;this.requireXMonotonicity();let i=!1,r=this.getDataY(),a={x:[],y:[]},s=[],o=!1,n=0,u,c,h,x,m,y,f,b;const A=this.getLength();if(!e.xPosition)throw'No position calculation method provided';if(!e.resampleToPx)throw'No "resampleToPx" method was provided. Unit: px per point';if(e.minX>e.maxX){let t=e.minX;e.minX=e.maxX,e.maxX=t}for((this.xdata&&!this.xdata.getMonotoneousAscending()||!this.xdata&&-0>this.xScale)&&(i=!0,t=A);i?0b){n=t;continue}if(f=e.xPosition(b),!o){for(n?(a.x.push(b),a.y.push(r[n])):n=t;isNaN(r[t]);)i?t--:t++;u=c=h=r[n],x=1,y=f,m=b,n=0,o=!0;continue}if(p(f-y)>e.resampleToPx||t==A||0==t||isNaN(r[t])){let t=(m+b)/2;if(a.x.push(t),a.y.push(u/x),s.push(t,c,h),void 0!==e.maxX&&b>e.maxX)break;o=!1;continue}u+=r[t],x++,c=g(c,r[t]),h=d(h,r[t])}return this.dataInUseType='resampled',this.dataInUse=a,s}interpolate(e){let t=this.getDataY(),i;if(e=(e-this.getXShift())/this.getXScale(),this.xdata){let i=this.xdata.getData(),r=A(e,i,!this.xdata.getMonotoneousAscending());return i[r]==e?t[r]:(e-i[r])/(i[r+1]-i[r])*(t[r+1]-t[r])+t[r]}else{i=(e-this.xOffset)/this.xScale;let r=n(i);return(i-r)*(t[r+1]-t[r])+t[r]}}getMonotoneousAscending(){return this.isMonotoneous()?this._monotoneousAscending:'The waveform is not monotoneous'}getXMonotoneousAscending(){return this.xdata?this.xdata.getMonotoneousAscending():0i(e)/t)}add(e){return this._arithmetic(e,v)}addBy(){return this.add(...arguments)}subtract(e){return this._arithmetic(e,C)}subtractBy(){return this.subtract(...arguments)}math(e){for(var t=0;t{this._dataAggregated=e.aggregates,console.log(this._dataAggregated),this._dataAggregating=!1})}hasAggregation(){return!!this._dataAggregated}selectAggregatedData(e){if(2>e)return!1;2147483647=e&&this.data[a]n&&(n=this.getY(d),l=d)}else{n=s;for(var d=e;d<=t;d++)this.getY(d)n)break;if(!(ot.rangeP[1]-(r-1)/2)break;if(a=this.getAverageP(o-(r-1)/2,o+(r-1)/2),void 0==s){s=a=e&&s){if(s=!1,'ascending'==t.edge||'both'==t.edge)for(i=o+(r-1)/2;i>=o-(r-1)/2;i--)if(this.data[i]>=e&&this.data[i-1]=o-(r-1)/2;i--)if(this.data[i]<=e&&this.data[i-1]>e)switch(t.rounding){case'before':return i-1;break;case'after':return i;break;case'interpolate':return f(e,this.data[i],this.data[i-1],i,i-1);}}}}normalize(e){let t,r,a,s,o,n;if('max1'==e||'max100'==e){for(t=1,'max100'==e&&(t=100),s=this.data[0],n=1;ns&&(s=this.data[n]);for(n=0;ns?s=this.data[n]:this.data[n]{this.options.selectableOnClick&&(this.isSelected()?this.graph.unselectSerie(this):this.graph.selectSerie(this))}),this.options.markers&&this.setMarkers(this.options.markers,'unselected')}setWaveform(e){if(!(e instanceof m.default))throw'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance';return this.waveform=e,this.minX=this.waveform.getXMin(),this.maxX=this.waveform.getXMax(),this.minY=this.waveform.getMin(),this.maxY=this.waveform.getMax(),this.graph.updateDataMinMaxAxes(),this.dataHasChanged(),this}setOptions(e){return this.options=h.extend(!0,{},y.prototype.defaults,e||{}),this.styles.unselected={lineColor:this.options.lineColor,lineStyle:this.options.lineStyle,markers:this.options.markers},this.applyLineStyles(),this}onMouseOverMarker(t,e){this.toggleMarker(e,!0,!0);this.options.onMouseOverMarker&&this.options.onMouseOverMarker(e,!!this.infos&&(this.infos[e]||!1),[this.waveform.getX(e),this.waveform.getY(e)])}onMouseOutMarker(t,e){this.markersOffHover(),this.options.onMouseOutMarker&&this.options.onMouseOutMarker(e,!!this.infos&&(this.infos[e]||!1),[this.waveform.getX(e),this.waveform.getY(e)])}toggleMarker(e,t,r){let a=e;var i;'undefined'==typeof t&&(i=r?!this.domMarkerHover[e]:!this.domMarkerSelect[e]);var s=this['domMarker'+(r?'Hover':'Select')];if(i||!0===t){if(!s[e]){var o=document.createElementNS(this.graph.ns,'path');this.setMarkerStyleTo(o,this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(a)]),this['domMarker'+(r?'Hover':'Select')][e]=o,this.groupMarkerSelected.appendChild(o)}else o=s[e];let t=this.getX(this.waveform.getX(a)),i=this.getY(this.waveform.getY(a));o.setAttribute('d','M '+t+' '+i+' '+this.getMarkerPath(this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(a)],1)),r&&this.markerHovered++}else if((!i||!1===t)&&(r&&this.domMarkerHover[e]&&!this.domMarkerSelect[e]||this.domMarkerSelect[e])){if(!s[e])return;this.groupMarkerSelected.removeChild(s[e]),delete s[e],r&&this.markerHovered--}return i}markersOffHover(){for(var e in this.domMarkerHover)this.toggleMarker(e.split(','),!1,!0);return this}markersOffSelect(){for(var e in this.domMarkerSelect)this.toggleMarker(e.split(','),!1,!1);return this}onClickOnMarker(t,e){var i=this.toggleMarker(e);i&&this.options.onSelectMarker&&this.options.onSelectMarker(e,!!this.infos&&(this.infos[e[0]]||!1)),!i&&this.options.onUnselectMarker&&this.options.onUnselectMarker(e,!!this.infos&&(this.infos[e[0]]||!1)),this.options.onToggleMarker&&this.options.onToggleMarker(e,!!this.infos&&(this.infos[e[0]]||!1),i)}_getMarkerIndexFromEvent(t){var e=this.graph._getXY(t);return this.searchIndexByPxXY(e.x-this.graph.getPaddingLeft(),e.y-this.graph.getPaddingTop())}onMouseWheel(){}empty(){for(var e=0,t=this.lines.length;e{this.draw(e)}),!1;if(!1===r)return!1;this._dataToUse=this.waveform.getDataToUseFlat()}return!0}removeLinesGroup(){this._afterLinesGroup=this.groupLines.nextSibling,this.groupMain.removeChild(this.groupLines)}insertLinesGroup(){if(!this._afterLinesGroup)throw'Could not find group after lines to insertion.';this.groupMain.insertBefore(this.groupLines,this._afterLinesGroup),this._afterLinesGroup=!1}removeExtraLines(){for(var e=this.currentLineId,t=this.lines.length;eu.length&&(i=u.length));vp&&r>p||(!this.options.overflowY&&hg&&a>g)&&!this.options.lineToZero){r=c,a=h,M=!0;continue}if(this.counter2=v,_&&this.getMarkerCurrentFamily(this.counter2),y=this.getX(c),f=this.getY(h),y!=x||f!=m){if(y!=y||f!=f){0g):!this.options.overflowX&&(cp)||!this.options.overflowY&&(hg),this.options.lineToZero){if(k=cp,k)continue;}else if(k||M){!1!==r&&!1!==a||M?(Y=[],l=(c-n)/(c-r),C=h-l*(h-a),P=(c-p)/(c-r),w=h-P*(h-a),L=(h-d)/(h-a),E=c-L*(c-r),X=(h-g)/(h-a),T=c-X*(c-r),1>l&&0d&&Y.push([n,C]),1>P&&0d&&Y.push([p,w]),1>L&&0n&&Y.push([E,d]),1>X&&0n&&Y.push([T,g]),0{var e=this.graph._getXY(t),i=this.handleMouseMove(!1,!1);this._trackingCallback(this,i,e.x,e.y)}),this.groupMain.addEventListener('mouseleave',()=>{this._trackingOutCallback(this)})}return this}kill(){super.kill()}getMarkerCurrentFamily(e){if(this.markerPoints&&this.markerPoints[this.selectionType]){for(var t=0,i;t=e&&(this.markerCurrentFamily=this.markerPoints[this.selectionType][t][2],i=this.markerFamilies[this.selectionType][this.markerCurrentFamily]);return!!i&&(this.getMarkerDom(i),this.markerCurrentFamily)}}setMarkerStyleTo(e,t){if(!e||!t)throw console.trace(),'Cannot set marker style. DOM does not exist.';e.setAttribute('fill',t.fillColor||'transparent'),e.setAttribute('stroke',t.strokeColor||this.getLineColor()),e.setAttribute('stroke-width',t.strokeWidth||1)}hideTrackingMarker(){this.marker.setAttribute('display','none'),this.markerLabel.setAttribute('display','none'),this.markerLabelSquare.setAttribute('display','none')}_addPoint(e,t,i,r,a,s,o){if(e===e&&t===t)return 0==this.counter?this.currentLine='M ':this.options.lineToZero||s?this.currentLine+='M ':this.currentLine+='L ',this.currentLine+=e,this.currentLine+=' ',this.currentLine+=t,this.currentLine+=' ',this.options.lineToZero&&void 0!==this.pos0&&(this.currentLine+='L ',this.currentLine+=e,this.currentLine+=' ',this.currentLine+=this.pos0,this.currentLine+=' '),this.hasErrors()&&this.errorAddPoint(a,i,r,e,t),this.markerPoints?void(this.markersShown()&&!1!==o&&this.markerFamily&&p(this,this.markerFamily[this.markerCurrentFamily],e,t,this.markersDom.get(this.markerFamily[this.markerCurrentFamily])),this.counter++):void this.counter++}_createLine(){var e=this.currentLineId++,t;return this.lines[e]?t=this.lines[e]:(t=document.createElementNS(this.graph.ns,'path'),this.applyLineStyle(t),this.groupLines.appendChild(t),this.lines[e]=t),0==this.counter?t.setAttribute('d',''):t.setAttribute('d',this.currentLine),this.currentLine='M ',this.counter=0,t}applyLineStyles(){for(var e=0;e{this.onMouseOverMarker(i,t)}),i.addEventListener('mouseout',(i)=>{this.onMouseOutMarker(i,t)}),i.addEventListener('click',(i)=>{this.onClickOnMarker(i,t)}),this.independantMarkers[t]=i}return this.groupMarkers.appendChild(this.independantMarkers[t]),this.independantMarkers[t]}searchIndexByPxXY(e,i){for(var r=!1,a=!1,s=this._xDataToUse,o=0,n=this.waveform.getLength(),l,d,p;othis.waveform.getX(i)?0:1,Object.assign(r,{indexMin:i+a,indexMax:i+a+1,indexClosest:i,xMin:this.waveform.getX(i+a),xMax:this.waveform.getX(i+a+1),yMin:this.waveform.getY(i+a),yMax:this.waveform.getY(i+a+1),xClosest:this.waveform.getX(i),yClosest:this.waveform.getY(i),xExact:e}),r}}handleMouseMove(e,t,i){var r=e||this.getXAxis().getMouseVal(),a=i||this.getYAxis().getMouseVal(),s=this.searchClosestValue(r,a);if(s){var o;if(s.xMax==s.xMin&&(o=s.yMin),t&&this.options.trackMouse){if(void 0==s.xMin)return!1;if(!this.marker)return;var n=this.getX(this.getFlip()?s.yClosest:s.xClosest),l=this.getY(this.getFlip()?s.xClosest:s.yClosest);if(isNaN(n)||isNaN(l))return;switch(this.marker.setAttribute('display','block'),this.marker.setAttribute('cx',n),this.marker.setAttribute('cy',l),this.markerLabel.setAttribute('display','block'),this.markerLabelSquare.setAttribute('display','block'),this.options.trackMouseLabel){case!1:break;default:this.markerLabel.textContent=this.options.trackMouseLabel.replace('',r.toFixed(this.options.trackMouseLabelRouding)).replace('',o.toFixed(this.options.trackMouseLabelRouding));}this.markerLabel.setAttribute('x',n+5),this.markerLabel.setAttribute('y',l-5),this.markerLabelSquare.setAttribute('x',n+5),this.markerLabelSquare.setAttribute('y',l-5-this.graph.options.fontSize),this.markerLabelSquare.setAttribute('width',this.markerLabel.getComputedTextLength()+2),this.markerLabelSquare.setAttribute('height',this.graph.options.fontSize+2)}return{xBefore:s.xMin,xAfter:s.xMax,yBefore:s.yMin,yAfter:s.yMax,trueX:s.xExact,indexClosest:s.indexClosest,interpolatedY:o,xClosest:s.xClosest,yClosest:s.yClosest}}}getMax(e,t){var r=g(e,t),a=d(e,t),s=this.searchClosestValue(r),o=this.searchClosestValue(a),n=-Infinity,l,i,p,u;if(s||(r=this.minX,s=this.searchClosestValue(r)),o||(a=this.maxX,o=this.searchClosestValue(a)),!s||!o)return-Infinity;for(l=s.dataIndex;l<=o.dataIndex;l++)for(p=l==s.dataIndex?s.xBeforeIndexArr:0,u=l==o.dataIndex?o.xBeforeIndexArr:this.data[l].length,i=p;i<=u;i+=2)n=d(n,this.data[l][i+1]);return n}getMin(e,t){var r=g(e,t),a=d(e,t),s=this.searchClosestValue(r),o=this.searchClosestValue(a),n=Infinity,l,i,p,u;if(s||(r=this.minX,s=this.searchClosestValue(r)),o||(a=this.maxX,o=this.searchClosestValue(a)),!s||!o)return Infinity;for(l=s.dataIndex;l<=o.dataIndex;l++)for(p=l==s.dataIndex?s.xBeforeIndexArr:0,u=l==o.dataIndex?o.xBeforeIndexArr:this.data[l].length,i=p;i<=u;i+=2)n=g(n,this.data[l][i+1]);return n}setStyle(e,t='unselected'){this.styles[t]=e,this.styleHasChanged(t)}setLineStyle(e,t='unselected',i){return this.styles[t]=this.styles[t]||{},this.styles[t].lineStyle=e,i&&this.setLineStyle(e,'selected'),this.styleHasChanged(t),this}getLineStyle(e){return this.getStyle(e).lineStyle}getLineDashArray(e=this.selectionType||'unselected'){switch(this.getStyle(e).lineStyle){case 2:return'1, 1';break;case 3:return'2, 2';break;case 4:return'3, 3';break;case 5:return'4, 4';break;case 6:return'5, 5';break;case 7:return'5 2';break;case 8:return'2 5';break;case 9:return'4 2 4 4';break;case 10:return'1,3,1';break;case 11:return'9 2';break;case 12:return'2 9';break;case 1:case!1:return!1;break;default:return this.styles[e].lineStyle;}this.styleHasChanged(e)}getStyle(e=this.selectionType||'unselected'){return this.styles[e]}extendStyles(){for(var e in this.styles){var t=this.styles[e];t&&(this.styles[e]=h.extend(!0,{},this.styles.unselected,t))}}extendStyle(e,t){var i=this.styles[e];this.styles[e]=h.extend(!0,{},this.styles[t||'unselected'],i||{}),this.styles[e].markers.map(function(e){e.dom&&(e.dom='')}),this._recalculateMarkerPoints(e,this.styles[e].markers),this.styleHasChanged(e)}setLineWidth(e,t,i){return t=t||'unselected',this.styles[t]=this.styles[t]||{},this.styles[t].lineWidth=e,i&&this.setLineWidth(e,'selected'),this.styleHasChanged(t),this}getLineWidth(e){return this.getStyle(e).lineWidth||1}setLineColor(e,t,i){return t=t||'unselected',this.styles[t]=this.styles[t]||{},this.styles[t].lineColor=e,i&&this.setLineColor(e,'selected'),this.styleHasChanged(t),this}getLineColor(e){return this.getStyle(e).lineColor||'black'}showMarkers(e,t){return e=e||'unselected',this.styles[e]=this.styles[e]||{},this.styles[e].showMarkers=!0,t&&this._drawn?this.draw(!0):this.styleHasChanged(e),this}hideMarkers(e,t){return e=e||'unselected',this.styles[e].showMarkers=!1,t&&this._drawn?this.draw(!0):this.styleHasChanged(e),this}markersShown(e){return!1!==this.getStyle(e).showMarkers}areMarkersShown(){return this.markersShown.apply(this,arguments)}isMarkersShown(){return this.markersShown.apply(this,arguments)}setMarkers(e,t,i){return this.styles[t||'unselected']=this.styles[t||'unselected']||{},this.showMarkers(t,!1),Array.isArray(e)||'object'!=typeof e?!e&&(e=[{type:1,zoom:1,points:'all'}]):e=[e],this.styles[t||'unselected'].markers=e,i&&(this.styles.selected.markers=h.extend(!0,{},e)),this._recalculateMarkerPoints(t,e),this.styleHasChanged(t),this.dataHasChanged(!0),this}setMarkersPoints(e,t,i){this._extendMarkers('points',e,t,i,!0)}setMarkersColor(e,t,i){this._extendMarkers('color',e,t,i)}setMarkersType(e,t,i){this._extendMarkers('type',e,t,i)}setMarkersZoom(e,t,i){this._extendMarkers('zoom',e,t,i)}setMarkersStrokeColor(e,t,i){this._extendMarkers('strokeColor',e,t,i)}setMarkersStrokeWidth(e,t,i){this._extendMarkers('strokeWidth',e,t,i)}setMarkersFillColor(e,t,i){this._extendMarkers('fillColor',e,t,i)}_extendMarkers(e,t,i,r,a){(i=i||0,r=r||'unselected',this.styles[r]&&this.styles[r].markers)&&(this.styles[r].markers[i][e]=t,a&&this._recalculateMarkerPoints(r,this.styles[r].markers),this.markersDom[this.styles[r].markers[i]]&&this.setMarkerStyleTo(this.markersDom[this.styles[r].markers[i]].dom,this.styles[r].markers[i]))}_recalculateMarkerPoints(e,t){for(var r=[[0,Infinity,null]],a=0,i=t.length;a{e.redraw()}),this.emit('draw')}setData(e){if(e instanceof l.default)return this.setWaveform(e);throw'Setting data other than waveforms in not supported by default. You must implemented this method in the inherited class.'}_addData(){return[]}clearData(){return this.setData(new l.default),this}getData(){return this.data}setOptions(e){this.options=e||{}}setOption(e,t){this.options[e]=t}kill(e){return this.graph.removeSerieFromDom(this),this.graph._removeSerie(this),this.graph.legend&&!e&&this.graph.legend.update(),this.graph=void 0,this}hide(e,t=!1){if(this.hidden=!0,this.groupMain.setAttribute('display','none'),this.getSymbolForLegend().setAttribute('opacity',0.5),this.getTextForLegend().setAttribute('opacity',0.5),this.hideImpl(),e)for(var r=this.graph.getShapesOfSerie(this),a=0,i=r.length;ae;e++)arguments[e]&&this[arguments[e].isX()?'setXAxis':'setYAxis'](arguments[e]);return this.graph.updateDataMinMaxAxes(),this}getXAxis(){return this.xaxis}getYAxis(){return this.yaxis}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getWaveform(){return this.waveform}getWaveforms(){return[this.waveform]}setWaveform(e){if(!(e instanceof l.default))throw'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance';return this.waveform=e,this.minX=this.waveform.getXMin(),this.maxX=this.waveform.getXMax(),this.minY=this.waveform.getMin(),this.maxY=this.waveform.getMax(),this.graph.updateDataMinMaxAxes(),this.dataHasChanged(),this}getSymbolForLegend(){if(!this.lineForLegend){var e=document.createElementNS(this.graph.ns,'line');this.applyLineStyle(e),e.setAttribute('x1',5),e.setAttribute('x2',25),e.setAttribute('y1',0),e.setAttribute('y2',0),e.setAttribute('cursor','pointer'),this.lineForLegend=e}return this.lineForLegend}setLegendSymbolStyle(){this.applyLineStyle(this.getSymbolForLegend())}updateStyle(){this.setLegendSymbolStyle(),this.graph.updateLegend()}getTextForLegend(){if(!this.textForLegend){var e=document.createElementNS(this.graph.ns,'text');e.setAttribute('cursor','pointer'),e.textContent=this.getLabel(),this.textForLegend=e}return this.textForLegend}getIndex(){return this.graph.series.indexOf(this)}getLabel(){return this.options.label||this.name}setLabel(e){return this.options.label=e,this.textForLegend&&(this.textForLegend.textContent=e),this.graph.requireLegendUpdate(),this}setFlip(e){return this.options.flip=e,this}getFlip(){return this.options.flip}isFlipped(){return this.options.flip}setLayer(e){let t=parseInt(e)||1;return t!==this.options.layer&&(this.options.layer=t,this.graph.appendSerieToDom(this)),this}getLayer(){return this.options.layer||1}setStyle(e,t='unselected'){this.styles[t]=e,this.styleHasChanged(t)}styleHasChanged(e='unselected'){if(this._changedStyles=this._changedStyles||{},!1===e)for(var t in this._changedStyles)this._changedStyles[t]=!1;else this._changedStyles[e||'unselected']=!0;return this.graph.requireLegendUpdate(),this}hasStyleChanged(e){return this._changedStyles=this._changedStyles||{},this._changedStyles[e||'unselected']}dataHasChanged(e){return this._dataHasChanged=void 0===e||e,this}hasDataChanged(){return this._dataHasChanged}setInfo(e,t){return this.infos=this.infos||{},this.infos[e]=t,this}getInfo(e){return(this.infos||{})[e]}setAdditionalData(e){return this.additionalData=e,this}getAdditionalData(){return this.additionalData}select(){return this.selected=!0,this}unselect(){return this.selected=!1,this}enableTracking(e,t){return this._tracker=!0,this._trackingCallback=e,this._trackingOutCallback=t,this}disableTracking(){return this._trackerDom&&(this._trackerDom.remove(),this._trackerDom=null),this._tracker=!1,this._trackingCallback=null,this}allowTrackingLine(e){e=e||{},this.graph.addSerieToTrackingLine(this,e)}getMarkerForLegend(){return!1}get type(){return this._type}getType(){return this._type}set excludedFromLegend(e){this._excludedFromLegend=e}get excludedFromLegend(){return!!this._excludedFromLegend}setDataIndices(e,t){this.categoryIndices=e,this.nbCategories=t}hasErrors(){return!!this.waveform&&this.waveform.hasErrorBars()}}t.default=p,e.exports=t['default']})},function(r,s,o){var l,c,h;(function(e,t){c=[r,s,o(3),o(7),o(0)],l=t,h='function'==typeof l?l.apply(s,c):l,!(void 0!==h&&(r.exports=h))})(this,function(r,s,o,l,c){'use strict';function h(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(s,'__esModule',{value:!0});var x=h(o),m=h(l),y=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(c);const f={lineAt:!1,display:!0,flipped:!1,axisDataSpacing:{min:0.1,max:0.1},unitModification:!1,primaryGrid:!0,secondaryGrid:!0,primaryGridColor:'#f0f0f0',secondaryGridColor:'#f0f0f0',primaryGridWidth:1,secondaryGridWidth:1,hideWhenNoSeriesShown:!1,shiftToZero:!1,tickPosition:1,nbTicksPrimary:3,nbTicksSecondary:10,ticklabelratio:1,exponentialFactor:0,exponentialLabelFactor:0,logScale:!1,forcedMin:!1,forcedMax:!1,span:[0,1],marginMin:0,marginMax:0,scientificScale:!1,scientificScaleExponent:!1,engineeringScale:!1,unitInTicks:!1,unit:!1,unitWrapperBefore:'',unitWrapperAfter:'',splitMarks:!1,tickLabelOffset:0,useKatexForLabel:!1};class b extends m.default{constructor(){super()}init(e,t,i){this.unitModificationTimeTicks=[[1,[1,2,5,10,20,30]],[60,[1,2,5,10,20,30]],[3600,[1,2,6,12]],[86400,[1,2,3,4,5,10,20,40]]],this.graph=e,this.options=y.extend(!0,{},f,i,t),this.group=document.createElementNS(this.graph.ns,'g'),this.hasChanged=!0,this.rectEvent=document.createElementNS(this.graph.ns,'rect'),this.rectEvent.setAttribute('pointer-events','fill'),this.rectEvent.setAttribute('fill','transparent'),this.group.appendChild(this.rectEvent),this.graph.axisGroup.appendChild(this.group),this._lines=[],this.line=document.createElementNS(this.graph.ns,'line'),this.line.setAttribute('stroke','black'),this.line.setAttribute('shape-rendering','crispEdges'),this.line.setAttribute('stroke-linecap','square'),this.groupTicks=document.createElementNS(this.graph.ns,'g'),this.groupTickLabels=document.createElementNS(this.graph.ns,'g'),this.group.appendChild(this.groupTicks),this.group.appendChild(this.groupTickLabels),this.group.appendChild(this.line),this.label=document.createElementNS(this.graph.ns,'text'),this.labelTspan=document.createElementNS(this.graph.ns,'tspan'),this.preunit='',this.unitTspan=document.createElementNS(this.graph.ns,'tspan'),this.expTspan=document.createElementNS(this.graph.ns,'tspan'),this.expTspanExp=document.createElementNS(this.graph.ns,'tspan'),this.label.appendChild(this.labelTspan),this.label.appendChild(this.unitTspan),this.label.appendChild(this.expTspan),this.label.appendChild(this.expTspanExp),this.expTspan.setAttribute('dx',6),this.expTspanExp.setAttribute('dy',-5),this.expTspanExp.setAttribute('font-size','0.8em'),this.label.setAttribute('text-anchor','middle'),this.setTickPosition(this.options.tickPosition),this.gridLinePath={primary:'',secondary:''},this.gridPrimary=document.createElementNS(this.graph.ns,'path'),this.gridSecondary=document.createElementNS(this.graph.ns,'path'),this.graph.groupPrimaryGrids.appendChild(this.gridPrimary),this.graph.groupSecondaryGrids.appendChild(this.gridSecondary),this.setGridLinesStyle(),this.group.appendChild(this.label),this.groupSeries=document.createElementNS(this.graph.ns,'g'),this.group.appendChild(this.groupSeries),this.widthHeightTick=0,this.ticks={},this.ticksLabels=[],this.tickScaling={1:3,2:2,3:1,4:0.5},this.currentTick={},this.lastCurrentTick={},this.series=[],this.totalDelta=0,this.currentAction=!1,this.group.addEventListener('mousemove',(t)=>{t.preventDefault();var e=this.graph._getXY(t);this.handleMouseMoveLocal(e.x,e.y,t);for(var r=0,i=this.series.length;r{t.preventDefault();var e=this.graph._getXY(t);this.addLabel(this.getVal(e.x-this.graph.getPaddingLeft()))}),this.gridPrimary.setAttribute('clip-path','url(#_clipplot'+this.graph._creation+')'),this.gridSecondary.setAttribute('clip-path','url(#_clipplot'+this.graph._creation+')'),this.graph._axisHasChanged(this)}handleMouseMoveLocal(){}hide(){return this.options.display=!1,this}show(){return this.options.display=!0,this}setDisplay(e){return this.options.display=!!e,this}isDisplayed(){return this.options.hideWhenNoSeriesShown?this.graph.getSeriesFromAxis(this).reduce((e,t)=>e||t.isShown(),!1):this.options.display}isShown(){return this.isDisplayed(...arguments)}hideGroup(){this._hidden||(this._hidden=!0,this.group.setAttribute('display','none'))}showGroup(){this._hidden&&(this._hidden=!1,this.group.setAttribute('display','initial'))}kill(e,t){this.graph.killAxis(this,e,t)}setLineAt(e){return this.options.lineAt=e,this}adaptTo(e,t,i,r){return e?(this.options.adaptTo={axis:e,thisValue:t,foreignValue:i,preference:r},this.adapt(),this):(this.options.adaptTo=!1,this)}adapt(){if(this.options.adaptTo){var e=this.options.adaptTo.axis,t=this.options.adaptTo.thisValue,i=this.options.adaptTo.foreignValue;if((void 0===e.currentAxisMin||void 0===e.currentAxisMax)&&e.setMinMaxToFitSeries(),!1!==this.options.forcedMin&&!1==this.options.forcedMax||'max'!==this.options.adaptTo.preference){this.currentAxisMin=!1===this.options.forcedMin?this._zoomed?this.getCurrentMin():this.getMinValue()-(t-this.getMinValue())*(this.options.axisDataSpacing.min*(e.getCurrentMax()-e.getCurrentMin())/(i-e.getCurrentMin())):this.options.forcedMin,this.currentAxisMin==t&&(this.currentAxisMin-=this.options.axisDataSpacing.min*this.getInterval());var r=!1===this.options.forcedMin?this.currentAxisMin:this.options.forcedMin;this.currentAxisMax=(t-r)*(e.getCurrentMax()-e.getCurrentMin())/(i-e.getCurrentMin())+r}else{this.currentAxisMax=!1===this.options.forcedMax?this._zoomed?this.getCurrentMax():this.getMaxValue()+(this.getMaxValue()-t)*(this.options.axisDataSpacing.max*(e.getCurrentMax()-e.getCurrentMin())/(e.getCurrentMax()-i)):this.options.forcedMax,this.currentAxisMax==t&&(this.currentAxisMax+=this.options.axisDataSpacing.max*this.getInterval());var r=!1===this.options.forcedMax?this.currentAxisMax:this.options.forcedMax;this.currentAxisMin=(t-r)*(e.getCurrentMin()-e.getCurrentMax())/(i-e.getCurrentMax())+r}this.graph._axisHasChanged(this)}}setFloating(e,t){return this.floating=!0,this.floatingAxis=e,this.floatingValue=t,this}getFloatingAxis(){return this.floatingAxis}getFloatingValue(){return this.floatingValue}setAxisDataSpacing(e,t){return this.options.axisDataSpacing.min=e,this.options.axisDataSpacing.max=t||e,this}dataSpacing(){return this.setAxisDataSpacing(...arguments)}setAxisDataSpacingMin(e){this.options.axisDataSpacing.min=e}setAxisDataSpacingMax(e){this.options.axisDataSpacing.max=e}setMinPx(e){this.minPx=e,this.setMinMaxFlipped()}setMaxPx(e){this.maxPx=e,this.setMinMaxFlipped()}getMinPx(){return this.minPxFlipped}getMaxPx(){return this.maxPxFlipped}getMathMaxPx(){return this.maxPx}getMathMinPx(){return this.minPx}getMinValue(){return!1===this.options.forcedMin?this.dataMin:this.options.forcedMin}getMaxValue(){return!1===this.options.forcedMax?this.dataMax:this.options.forcedMax}setMinValueData(e){this.dataMin=e,isNaN(this.getCurrentMin())&&(this.setCurrentMin(this.getMinValue()),this.cache())}setMaxValueData(e){this.dataMax=e,isNaN(this.getCurrentMax())&&(this.setCurrentMax(this.getMaxValue()),this.cache())}getDataMax(){return this.dataMax}getDataMin(){return this.dataMin}forceMin(e,t=!1){return this.options.forcedMin=e,this.setCurrentMin(t?this.getCurrentMin():void 0),this.graph._axisHasChanged(this),this}forceMax(e,t=!1){return this.options.forcedMax=e,this.setCurrentMax(t?this.getCurrentMax():void 0),this.graph._axisHasChanged(this),this}getForcedMin(){return this.options.forcedMin}getForcedMax(){return this.options.forcedMax}forceToAxis(e){return e.getMaxValue&&e.getMinValue&&(this.options.forcedMin=e.getMinValue(),this.options.forcedMax=e.getMaxValue()),this}getNbTicksPrimary(){return this.options.nbTicksPrimary}setNbTicksPrimary(e){this.options.nbTicksPrimary=e}getNbTicksSecondary(){return this.options.nbTicksSecondary}setNbTicksSecondary(e){return this.options.nbTicksSecondary=e,this}handleMouseMove(e){this.mouseVal=this.getVal(e)}handleMouseWheel(t,i,e){t=g(0.2,d(-0.2,t)),'min'==e?e=this.getMinValue():'max'==e?e=this.getMaxValue():!e&&(e=0),this._doZoomVal((this.getCurrentMax()-e)*(1+t)+e,(this.getCurrentMin()-e)*(1+t)+e),this.graph.draw()}set zoomLock(e){this._zoomLocked=e}get zoomLock(){return this._zoomLocked||!1}zoom(e,t,i){return!i&&this.zoomLock?void 0:this._doZoomVal(e,t,!0)}_doZoomVal(e,t,i){return this._doZoom(this.getPx(e),this.getPx(t),e,t,i)}_doZoom(e,t,i,r,a){var i=void 0===i?this.getVal(e):i,r=void 0===r?this.getVal(t):r;return this.setCurrentMin(g(i,r)),this.setCurrentMax(d(i,r)),this.cacheCurrentMin(),this.cacheCurrentMax(),this.cacheInterval(),this._zoomed=!0,this.adapt(),this._hasChanged=!0,a||this.emit('zoom',[this.currentAxisMin,this.currentAxisMax,this]),this}getSerieShift(){return this._serieShift}getSerieScale(){return this._serieScale}getMouseVal(){return this.mouseVal}getUnitPerTick(e,r,a){var s=e/x;r=r?g(r,e/10):e/10;var o=a/r;switch(this.options.unitModification){case'time':case'time:min.sec':{let e=!1,t,i,r,a;for(t=0,i=this.unitModificationTimeTicks.length;tthis.getForcedMax()||e===void 0))&&(e=this.getMaxValue()),this.currentAxisMax=e,this.options.logScale&&(this.currentAxisMax=d(1e-50,e)),this.cacheCurrentMax(),this.cacheInterval(),this.graph._axisHasChanged(this)}flip(e){return this.options.flipped=e,this.setMinMaxFlipped(),this}isFlipped(){return this.options.flipped}_draw(){var e=this;(void 0===this.currentAxisMin||void 0===this.currentAxisMax)&&this.setMinMaxToFitSeries(!0);var t=p(this.getMaxPx()-this.getMinPx()),r=this.getCurrentInterval();if(!this.isShown())return this.line.setAttribute('display','none'),0;this.line.setAttribute('display','block'),this.scientificExponent=!0==this.options.scientificScale?this.options.scientificScaleExponent?this.options.scientificScaleExponent:n(i(d(p(this.getCurrentMax()),p(this.getCurrentMin())))/2.302585092994046):0,this.gridLinePath.primary='',this.gridLinePath.secondary='';let a;if(!this.options.useKatexForLabel||!this.graph.hasKatexRenderer())this.options.unitDecade&&this.options.unit&&0!==this.scientificExponent&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent))&&(a=this.getExponentGreekLetter(this.scientificExponent))?(this.preunit=a,this.unitTspan.setAttribute('dx',0)):0===this.scientificExponent||isNaN(this.scientificExponent)?(!this.options.unit&&this.unitTspan.setAttribute('display','none'),this.preunit='',this.expTspan.setAttribute('display','none'),this.expTspanExp.setAttribute('display','none')):(this.options.engineeringScale&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent)),this.preunit='',this.expTspan.setAttribute('display','visible'),this.expTspanExp.setAttribute('display','visible'),this.expTspan.textContent='x10',this.expTspanExp.textContent=this.scientificExponent),this.writeUnit();else{let e=this.getLabel();this.options.unitDecade&&this.options.unit&&0!==this.scientificExponent&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent))&&(a=this.getExponentGreekLetter(this.scientificExponent))?(e+=a,this.preunitTspan.innerHTML=a,this.preunitTspan.setAttribute('display','visible'),this.unitTspan.setAttribute('dx',0),e+=' '+a+' '+this.options.unit):0!==this.scientificExponent&&!isNaN(this.scientificExponent)&&(this.options.engineeringScale&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent)),e+=' \\cdot 10^'+this.scientificExponent+' '+this.options.unit),this.katexElement=this.graph.renderWithKatex(e,this.katexElement)}if(!!this.options.hideTicks)var s=0;else if(this.resetTicksLength(),this.linkedToAxis){this.linkedToAxis.deltaPx=10;var s=this.drawLinkedToAxisTicksWrapper(t,r)}else if(!this.options.logScale)var s=this.drawLinearTicksWrapper(t,r);else var s=this.drawLogTicks();this.removeUselessTicks(),this.removeUselessTickLabels(),this.gridPrimary.setAttribute('d',this.gridLinePath.primary),this.gridSecondary.setAttribute('d',this.gridLinePath.secondary);var o=this.graph.findAxesLinkedTo(this);return o.forEach(function(t){t.linkedToAxis&&(t.setMinPx(e.getMinPx()),t.setMaxPx(e.getMaxPx()),t.draw())}),s}drawLines(){this.options.lineAt&&Array.isArray(this.options.lineAt)&&this.options.lineAt.forEach((e,t)=>{!isNaN(e)&&this.getCurrentMin()<=e&&this.getCurrentMax()>=e?this._lines[t]=this._drawLine(e,this._lines[t]):this._hideLine(this._lines[t])})}writeUnit(){this.options.unit?(this.unitTspan.setAttribute('display','visible'),this.unitTspan.setAttribute('dx',5),this.expTspan.setAttribute('display','none'),this.expTspanExp.setAttribute('display','none'),this.unitTspan.innerHTML=(this.options.unitWrapperBefore+this.preunit+this.options.unit+this.options.unitWrapperAfter).replace(/\^([-+0-9]*)(.*)/g,'$1$2')):this.unitTspan.setAttribute('display','none')}getExponentGreekLetter(e){return 3===e?'k':6===e?'M':9===e?'G':12===e?'T':15===e?'E':-3===e?'m':-6===e?'μ':-9===e?'n':-12===e?'p':-15===e?'f':''}drawLinearTicksWrapper(e,t){let i;return this.options.primaryTickUnit?i=this.options.primaryTickUnit:(i=this.getUnitPerTick(e,this.getNbTicksPrimary(),t)[0],this.options.maxPrimaryTickUnit&&this.options.maxPrimaryTickUniti&&(i=this.options.minPrimaryTickUnit)),this.drawTicks(i,this.secondaryTicks())}forcePrimaryTickUnit(e){this.options.primaryTickUnit=e}forcePrimaryTickUnitMax(e){this.options.maxPrimaryTickUnit=e}forcePrimaryTickUnitMin(e){this.options.minPrimaryTickUnit=e}getPrimaryTickUnit(){return this.incrTick}setTickLabelRatio(e){this.options.ticklabelratio=e}doesHideWhenNoSeriesShown(){return this.options.hideWhenNoSeriesShown}draw(){this._widthLabels=0;var e=this._draw();return this._widthLabels+=e,e}drawTicks(e,t){var i=e,r=this.getCurrentMin(),s=this.getCurrentMax(),o=0,l,d,g;for(t&&(l=i/t),d=this.options.shiftToZero?this.dataMin-a((this.dataMin-r)/i)*i:n(r/i)*i,this.incrTick=e;d<=s&&(o++,!(200s){g+=l;continue}this.drawTickWrapper(g,!1,1e-4>p(g-d-i/2)?2:3),g+=l}}if(ds){d+=e;continue}this.drawTickWrapper(d,!0,1),d+=e}return this.widthHeightTick=this.getMaxSizeTick(),this.widthHeightTick}nextTick(e,t){if(this.ticks[e]=this.ticks[e]||[],this.lastCurrentTick[e]=this.lastCurrentTick[e]||0,this.currentTick[e]=this.currentTick[e]||0,this.currentTick[e]>=this.ticks[e].length){var i=document.createElementNS(this.graph.ns,'line');this.groupTicks.appendChild(i),this.ticks[e].push(i),t(i)}var i=this.ticks[e][this.currentTick[e]];return this.currentTick[e]>=this.lastCurrentTick[e]&&i.setAttribute('display','visible'),this.currentTick[e]++,i}nextTickLabel(e){if(this.ticksLabels=this.ticksLabels||[],this.lastCurrentTickLabel=this.lastCurrentTickLabel||0,this.currentTickLabel=this.currentTickLabel||0,this.currentTickLabel>=this.ticksLabels.length){var t=document.createElementNS(this.graph.ns,'text');this.groupTickLabels.appendChild(t),this.ticksLabels.push(t),e(t)}var t=this.ticksLabels[this.currentTickLabel];return this.currentTickLabel>=this.lastCurrentTickLabel&&t.setAttribute('display','visible'),this.currentTickLabel++,t}removeUselessTicks(){for(var e in this.currentTick){for(var t=this.currentTick[e];ta&&(a=1e-50),20a&&(a=0);for(var o=0==a?0:n(i(a)/2.302585092994046),a=1,l;(l=a*t(10,o))e&&this.drawTickWrapper(l,!0,1,s),10==a?(a=1,o++):(1!=a&&l>e&&this.drawTickWrapper(l,!1,2,{overwrite:'',fontSize:'0.6em'}),a++);return this.widthHeightTick=this.getMaxSizeTick(),this.widthHeightTick}drawTickWrapper(e,t,i,r){this.drawTick(e,i,r)}linkToAxis(e,t,i){this.linkedToAxis={axis:e,scalingFunction:t,decimals:i||1}}drawLinkedToAxisTicksWrapper(e,i){var r=this.linkedToAxis,a=0,s,o,n,l;r.deltaPx||(r.deltaPx=10);do{if(s=r.scalingFunction(r.axis.getVal(a+this.getMinPx())),r.decimals&&(this.decimals=r.decimals),o=this.drawTick(s,1,{},a+this.getMinPx()),!o)throw console.error(s,a,this.getMinPx()),new Error('Unable to draw tick. Please report the test-case');if(n=8*(o[1].textContent+'').length,l=5*u(n/5),l>r.deltaPx)return r.deltaPx=l,void this.drawLinkedToAxisTicksWrapper(e,i);a+=r.deltaPx}while(ae)){var e=(i(e)-i(this.getCurrentMin()))/(i(this.getCurrentMax())-i(this.getCurrentMin()))*(this.getMaxPx()-this.getMinPx())+this.getMinPx();return e}}getRoundedPx(e){return u(10*this.getPx(e))/10}getVal(t){return this.options.logScale?e((t-this.getMinPx())/(this.getMaxPx()-this.getMinPx())*(i(this.getCurrentMax())-i(this.getCurrentMin()))+i(this.getCurrentMin())):(t-this.getMinPx())/(this.getMaxPx()-this.getMinPx())*this.getCurrentInterval()+this.getCurrentMin()}getRelPx(e){return e/this.getCurrentInterval()*(this.getMaxPx()-this.getMinPx())}getRelVal(e){return e/(this.getMaxPx()-this.getMinPx())*this.getCurrentInterval()}valueToText(e){if(this.scientificExponent)return e/=t(10,this.scientificExponent),e.toFixed(1);if(e=e*t(10,this.getExponentialFactor())*t(10,this.getExponentialLabelFactor()),this.options.shiftToZero&&(e-=this.dataMin),this.options.ticklabelratio&&(e*=this.options.ticklabelratio),this.options.unitModification)return e=this.modifyUnit(e,this.options.unitModification),e;var i=this.decimals-this.getExponentialFactor()-this.getExponentialLabelFactor();return isNaN(e)?'':(e=0'+this.scientificExponent+''),this.options.unit&&!i&&(r+=this.options.unit.replace(/\^([-+0-9]*)/g,'$1')),r}getModifiedValue(e){return this.options.ticklabelratio&&(e*=this.options.ticklabelratio),this.options.shiftToZero&&(e-=this.getMinValue()*(this.options.ticklabelratio||1)),e}modifyUnit(e,t){var i='',r=this.incrTick,a;switch(t){case'time':var o=this.getModifiedValue(this.getMaxValue()),l=[[60,'min'],[3600,'h'],[86400,'d']];if(3600>o?a=0:86400>o?a=1:2592000>o&&(a=2),!l[a])return!1;e/=l[a][0];var d=n(e);for(i=d+l[a][1],a--;r<1*l[a+1][0]&&-1{t.setAttribute('fill',e)}),this}getTicksLabelColor(){return this.options.ticksLabelColor||'black'}setPrimaryGridColor(e){return this.options.primaryGridColor=e,this.setGridLinesStyle(),this}getPrimaryGridColor(){return this.options.primaryGridColor}setSecondaryGridColor(e){return this.options.secondaryGridColor=e,this.setGridLinesStyle(),this}getSecondaryGridColor(){return this.options.secondaryGridColor}setPrimaryGridWidth(e){return this.options.primaryGridWidth=e,this.setGridLinesStyle(),this}getPrimaryGridWidth(){return this.options.primaryGridWidth}setSecondaryGridWidth(e){return this.options.secondaryGridWidth=e,this.setGridLinesStyle(),this}getSecondaryGridWidth(){return this.options.secondaryGridWidth}setPrimaryGridOpacity(e){return this.options.primaryGridOpacity=e,this}getPrimaryGridOpacity(){return this.options.primaryGridOpacity}setSecondaryGridOpacity(e){return this.options.secondaryGridOpacity=e,this}getSecondaryGridOpacity(){return this.options.secondaryGridOpacity}setPrimaryGridDasharray(e){return this.options.primaryGridDasharray=e,this}getPrimaryGridDasharray(){return this.options.primaryGridDasharray}setSecondaryGridDasharray(e){return this.options.secondaryGridDasharray=e,this}getSecondaryGridDasharray(){return this.options.secondaryGridDasharray}setLabelColor(e){return this.options.labelColor=e,this}getLabelColor(){return this.options.labelColor}setTickContent(e,r,a){if(a||(a={}),a.overwrite||!a.exponential)e.textContent=a.overwrite||this.valueToText(r);else{var s=u(i(r)/2.302585092994046),o=n(r*t(10,-s));e.textContent=1==o?'10':o+'x10';var l=document.createElementNS(this.graph.ns,'tspan');l.textContent=s,l.setAttribute('font-size','0.7em'),l.setAttribute('dy',-5),e.appendChild(l)}a.fontSize&&e.setAttribute('font-size',a.fontSize)}isX(){return!1}isY(){return!1}setUnit(e){return this.options.unit=e,this}setUnitInTicks(e){return this.options.unitInTicks=e,this}setUnitWrapper(e,t){return this.options.unitWrapperBefore=e,this.options.unitWrapperAfter=t,this}setUnitDecade(e){return this.options.unitDecade=e,this}setScientific(e){return this.options.scientificScale=e,this}setScientificScaleExponent(e){return this.options.scientificScaleExponent=e,this}setEngineering(e){return this.options.scientificScale=e,this.options.engineeringScale=e,this}getEngineeringExponent(e){return e-=0{e.dom=document.createElementNS(this.graph.ns,'path'),e.dom.setAttribute('fill',e.fillColor||'none'),e.dom.setAttribute('stroke',e.strokeColor||'black'),e.dom.setAttribute('stroke-opacity',e.strokeOpacity||1),e.dom.setAttribute('fill-opacity',e.fillOpacity||1),e.dom.setAttribute('stroke-width',e.strokeWidth||1),this.groupMain.appendChild(e.dom)},t={};'string'==typeof e&&(e={});for(var s=0,o=i.length;s=n;n++)e[i[s][n]]&&(t[i[s][n]]=e[i[s][n]],a(t[i[s][n]]))}return t},errorDrawInit:function(){this.errorboxStyle&&(this.errorboxStyle.paths={top:'',bottom:'',left:'',right:''}),this.errorbarStyle&&(this.errorbarStyle.paths={top:'',bottom:'',left:'',right:''})},errorAddPoint:function(e,t,i,r,a){let s;(s=this.waveform.getErrorBarXBelow(e))&&(this.errorbarStyle.paths.left+=' M '+r+' '+a,this.errorbarStyle.paths.left+=this.makeBarX(this.getX(t-s),r,this.errorbarStyle.left)),(s=this.waveform.getErrorBarXAbove(e))&&(this.errorbarStyle.paths.right+=' M '+r+' '+a,this.errorbarStyle.paths.right+=this.makeBarX(this.getX(t+s),r,this.errorbarStyle.right)),(s=this.waveform.getErrorBarYBelow(e))&&(this.errorbarStyle.paths.bottom+=' M '+r+' '+a,this.errorbarStyle.paths.bottom+=this.makeBarY(this.getY(i-s),a,this.errorbarStyle.bottom)),(s=this.waveform.getErrorBarYAbove(e))&&(this.errorbarStyle.paths.top+=' M '+r+' '+a,this.errorbarStyle.paths.top+=this.makeBarY(this.getY(i+s),a,this.errorbarStyle.top)),(s=this.waveform.getErrorBoxXBelow(e))&&(this.errorboxStyle.paths.left+=' M '+r+' '+a,this.errorboxStyle.paths.left+=this.makeBoxX(this.getX(t-s),r,this.errorboxStyle.left)),(s=this.waveform.getErrorBoxXAbove(e))&&(this.errorboxStyle.paths.right+=' M '+r+' '+a,this.errorboxStyle.paths.right+=this.makeBoxX(this.getX(t+s),r,this.errorboxStyle.right)),(s=this.waveform.getErrorBoxYBelow(e))&&(this.errorboxStyle.paths.bottom+=' M '+r+' '+a,this.errorboxStyle.paths.bottom+=this.makeBoxY(this.getY(i-s),a,this.errorboxStyle.bottom)),(s=this.waveform.getErrorBoxYAbove(e))&&(this.errorboxStyle.paths.top+=' M '+r+' '+a,this.errorboxStyle.paths.top+=this.makeBoxY(this.getY(i+s),a,this.errorboxStyle.top))},errorAddPointBarChart:function(e,t,i,r){var a;this.error&&(a=this.error[e])&&this.doErrorDraw('y',a,t,r,i,r)},errorDraw:function(){if(this.errorbarStyle)for(var e in this.errorbarStyle.paths)this.errorbarStyle[e]&&this.errorbarStyle[e].dom&&this.errorbarStyle[e].dom.setAttribute('d',this.errorbarStyle.paths[e]);if(this.errorboxStyle)for(var e in this.errorboxStyle.paths)this.errorboxStyle[e]&&this.errorboxStyle[e].dom&&this.errorboxStyle[e].dom.setAttribute('d',this.errorboxStyle.paths[e])}};t.default=a,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(9)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{constructor(e,t,i={}){super(e,t,i),this.top='top'==t}getAxisPosition(){if(!this.options.display)return 0;let e;return 0==this.options.tickLabelOffset?(e=1==this.options.tickPosition?8:20,e+=1*this.graph.options.fontSize):e=1==this.options.tickPosition?0:12,this.getLabel()&&(e+=this.graph.options.fontSize),e}isX(){return!0}isY(){return!1}setShift(e){this.shift=e;void 0!==this.getShift()&&this.graph.getDrawingHeight()&&this.group.setAttribute('transform','translate(0 '+(this.floating?this.getShift():this.top?this.shift:this.graph.getDrawingHeight()-this.shift)+')')}getMaxSizeTick(){return(this.top?-1:1)*(1==this.options.tickPosition?10:10)}drawTick(e,t,i,r){var a=this,s;if(s=r||this.getPos(e),!(void 0==s||isNaN(s))){var o=this.nextTick(t,function(e){e.setAttribute('y1',(a.top?1:-1)*a.tickPx1*a.tickScaling[t]),e.setAttribute('y2',(a.top?1:-1)*a.tickPx2*a.tickScaling[t]),1==t?e.setAttribute('stroke',a.getPrimaryTicksColor()):e.setAttribute('stroke',a.getSecondaryTicksColor())});if(o.setAttribute('x1',s),o.setAttribute('x2',s),this.nextGridLine(1==t,s,s,0,this.graph.getDrawingHeight()),1==t){var n=this.nextTickLabel((e)=>{e.setAttribute('y',(a.top?-1:1)*((1==a.options.tickPosition?8:20)+(a.top?10:0))+this.options.tickLabelOffset),e.setAttribute('text-anchor','middle'),'black'!==a.getTicksLabelColor()&&e.setAttribute('fill',a.getTicksLabelColor()),e.style.dominantBaseline='hanging'});n.setAttribute('x',s),this.setTickContent(n,e,i)}return[o,n]}}drawLabel(){'black'!==this.getLabelColor()&&this.label.setAttribute('fill',this.getLabelColor()),this.options.labelFont&&this.label.setAttribute('font-family',this.options.labelFont),this.label.setAttribute('text-anchor','middle'),this.label.setAttribute('style','display: initial;'),this.label.setAttribute('x',p(this.getMaxPx()+this.getMinPx())/2),this.label.setAttribute('y',(this.top?-1:1)*((1==this.options.tickPosition?10:25)+this.graph.options.fontSize)),this.labelTspan.textContent=this.getLabel()}draw(){var e=super.draw(...arguments);return this.drawSpecifics(),e}drawSpecifics(){this.drawLabel(),this.line.setAttribute('x1',this.getMinPx()),this.line.setAttribute('x2',this.getMaxPx()),this.line.setAttribute('y1',0),this.line.setAttribute('y2',0),this.line.setAttribute('stroke',this.getAxisColor()),this.top||(this.labelTspan.style.dominantBaseline='hanging',this.expTspan.style.dominantBaseline='hanging',this.expTspanExp.style.dominantBaseline='hanging',this.unitTspan.style.dominantBaseline='hanging');var e=this.getSpan();this.line.setAttribute('marker-start',this.options.splitMarks&&0!=e[0]?'url(#horionzalsplit_'+this.graph.getId()+')':''),this.line.setAttribute('marker-end',this.options.splitMarks&&1!=e[1]?'url(#horionzalsplit_'+this.graph.getId()+')':'')}_drawLine(e,t){let i=this.getPx(e);return t?t.setAttribute('display','initial'):t=document.createElementNS(this.graph.ns,'line'),t.setAttribute('x1',i),t.setAttribute('x2',i),t.setAttribute('y1',0),t.setAttribute('y2',this.graph.drawingSpaceHeight),t.setAttribute('stroke','black'),this.group.appendChild(t),t}_hideLine(e){e&&e.setAttribute('display','none')}handleMouseMoveLocal(e){e-=this.graph.getPaddingLeft(),this.mouseVal=this.getVal(e)}setMinMaxFlipped(){var e=this.maxPx-this.minPx;if(!isNaN(e)){var t=e*this.options.span[1]+this.minPx-this.options.marginMax,i=e*this.options.span[0]+this.minPx+this.options.marginMin;this.minPxFlipped=this.isFlipped()?t:i,this.maxPxFlipped=this.isFlipped()?i:t}}getZProj(e){return e*this.graph.options.zAxis.shiftX}}t.default=a,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(1)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{constructor(e,t){super(e,t)}createDom(){this._dom=document.createElementNS(this.graph.ns,'line'),this.getStrokeColor()||this.setStrokeColor('black'),this.getStrokeWidth()||this.setStrokeWidth(1)}createHandles(){this._createHandles(2,'rect',{transform:'translate(-3 -3)',width:6,height:6,stroke:'black',fill:'white',cursor:'nwse-resize'})}applyPosition(){var e=this.calculatePosition(0),t=this.calculatePosition(1);if(e&&e.x&&e.y)return this.setDom('x2',e.x),this.setDom('y2',e.y),this.setDom('y1',t.y),this.setDom('x1',t.x),this.currentPos2x=t.x,this.currentPos2y=t.y,this.currentPos1x=e.x,this.currentPos1y=e.y,!0}handleMouseMoveImpl(t,e,i){if(!this.isLocked()){var r=this.getPosition(0),a=this.getPosition(1),s;if(1==this.handleSelected?s=r:2==this.handleSelected&&(s=a),s&&(!this._data.vertical&&s.deltaPosition('x',e,this.getXAxis()),!this._data.horizontal&&s.deltaPosition('y',i,this.getYAxis())),this.moving&&(r.x&&r.deltaPosition('x',e,this.getXAxis()),r.y&&r.deltaPosition('y',i,this.getYAxis()),a.x&&a.deltaPosition('x',e,this.getXAxis()),a.y&&a.deltaPosition('y',i,this.getYAxis())),this._data.forcedCoords){var o=this._data.forcedCoords;void 0!==o.y&&('function'==typeof o.y?a.y=r.y=o.y(this):(a.y=o.y,r.y=o.y)),void 0!==o.x&&('function'==typeof o.x?a.x=r.x=o.x(this):(a.x=o.x,r.x=o.x))}return this.rectEvent&&this.setEventReceptacle(),this.redraw(),this.changed(),this.setHandles(),!0}}setHandles(){!this.areHandlesInDom()||isNaN(this.currentPos1x)||(this.handles[1].setAttribute('x',this.currentPos1x),this.handles[1].setAttribute('y',this.currentPos1y),this.handles[2].setAttribute('x',this.currentPos2x),this.handles[2].setAttribute('y',this.currentPos2y))}setEventReceptacle(){this.currentPos1x&&(!this.rectEvent&&(this.rectEvent=document.createElementNS(this.graph.ns,'line'),this.rectEvent.setAttribute('pointer-events','stroke'),this.rectEvent.setAttribute('stroke','transparent'),this.rectEvent.jsGraphIsShape=this,this.group.appendChild(this.rectEvent)),this.rectEvent.setAttribute('x1',this.currentPos1x),this.rectEvent.setAttribute('y1',this.currentPos1y),this.rectEvent.setAttribute('x2',this.currentPos2x),this.rectEvent.setAttribute('y2',this.currentPos2y),this.rectEvent.setAttribute('stroke-width',this.getProp('strokeWidth')+2))}}t.default=a,e.exports=t['default']})},function(e,t){var i,r,a;(function(s,o){r=[e,t],i=o,a='function'==typeof i?i.apply(t,r):i,!(void 0!==a&&(e.exports=a))})(this,function(e,t){'use strict';Object.defineProperty(t,'__esModule',{value:!0});class i{constructor(e,t,i,r){this.LMITER=100,this.LMBOOST=2,this.LMSHRINK=0.1,this.LAMBDAZERO=1e-3,this.LAMBDAMAX=1E9,this.LMTOL=1e-12,this.BIGVAL=9e99,this.sos,this.sosprev,this.lambda,this.myH=null,this.nadj=0,this.npts=0,this.delta,this.beta,this.alpha,this.amatrix,this.myH=e,this.nadj=t,this.npts=i,this.delta=Array(this.nadj).fill(0),this.beta=Array(this.nadj).fill(0),this.alpha=Array(this.nadj).fill(0),this.amatrix=Array(this.nadj).fill(0),this.alpha=this.alpha.map(()=>Array(this.nadj)),this.amatrix=this.amatrix.map(()=>Array(this.nadj)),this.lambda=this.LAMBDAZERO;var a=0,s=!1;do s=this.bLMiter(),r&&r(this.myH.params),a++;while(!s&&a=r){this.lambda*=this.LMSHRINK;break}for(var a=0;a-this.LMTOL||this.lambda>this.LAMBDAMAX}gaussj(e,t){var r=1,a=Array(100),s=Array(100),o,n,l,i,d,g;for(d=0;dd)for(i=0;id)for(l=0;ld)for(l=0;ld)for(i=0;i'function'==typeof e?e(this.data,this.dataX):e),this.NPARMS=e.length}setSubset(e,t){e!==void 0&&t!==void 0&&(this._from=e,this._to=t)}hookIteration(e){this._hookIteration=(t)=>{let i=this.buildFit(t,200);e(i)}}setFunction(e){this._func=e}init(){if(void 0!==this._from&&void 0!==this._to){if(this._from>=this._to)throw'Impossible to fit negative subranges. The starting index must be lower than the ending index';if(this.NPTS=this._to-this._from+1,this.data&&this.data.getLength()<=this._to)throw'Wave Y has not enough point to be fitted to subrange ['+this._from+', '+this._to+']';if(0>this._from)throw'Impossible to fit a subrange with negative indices'}else this.NPTS=this.data.getLength(),this._from=0,this._to=this.data.getLength()-1;if(this.dataX&&this.dataX.getLength()<=this._to)throw'Wave X has not enough point to be fitted to subrange ['+this._from+', '+this._to+']';this.arrY=this.data.getDataY(),this.arrX=this.dataX?this.dataX.getDataY():this.data.getDataX(),this.resid=Array(this.NPTS).fill(0),this.jac=Array(this.NPTS).fill(0),this.jac=this.jac.map(()=>Array(this.NPARMS))}fit(){return this.log('Starting the fit with initial parameter list {'+this.parms.join()+'};'),new i(this,this.NPARMS,this.NPTS,this._hookIteration),this.log('Fit successful. Output parameters {'+this.parms.join()+'};'),this._result=this.buildFit(this.parms,200),this.options.done&&this.options.done(this.parms,this._result),this._result}func(e,t){return this._func(e,t)}computeResiduals(){for(var e=0,t=0;ta*(i-e)/(t-1)+e)}for(var a=Array(r.length),s=0,i=r.length;s{e.setAttribute('x1',(this.left?1:-1)*this.tickPx1*this.tickScaling[t]),e.setAttribute('x2',(this.left?1:-1)*this.tickPx2*this.tickScaling[t]),1==t?e.setAttribute('stroke',this.getPrimaryTicksColor()):e.setAttribute('stroke',this.getSecondaryTicksColor())}),s.setAttribute('y1',a),s.setAttribute('y2',a),this.nextGridLine(1==t,0,this.graph.getDrawingWidth(),a,a),1==t&&(o=this.nextTickLabel((e)=>{e.setAttribute('x',this.tickMargin+this.options.tickLabelOffset),'black'!==this.getTicksLabelColor()&&e.setAttribute('fill',this.getTicksLabelColor()),this.left?e.setAttribute('text-anchor','end'):e.setAttribute('text-anchor','start'),e.style.dominantBaseline='central'}),o.setAttribute('y',a),this.setTickContent(o,e,i),(o.textContent+'').length>=this.longestTick[1]&&(this.longestTick[0]=o,this.longestTick[1]=(o.textContent+'').length)))}drawLabel(){'black'!==this.getLabelColor()&&this.label.setAttribute('fill',this.getLabelColor()),this.label.setAttribute('dominant-baseline',this.left?'auto':'auto'),this.labelTspan.textContent=this.getLabel()}placeLabel(e){this.label.setAttribute('transform','translate('+e+', '+p(this.getMaxPx()+this.getMinPx())/2+') rotate(-90)')}drawSpecifics(){this.line.setAttribute('y1',this.getMinPx()),this.line.setAttribute('y2',this.getMaxPx()),this.line.setAttribute('x1',0),this.line.setAttribute('x2',0),this.line.setAttribute('stroke',this.getAxisColor());var e=this.getSpan();this.line.setAttribute('marker-start',this.options.splitMarks&&0!=e[0]?'url(#verticalsplit_'+this.graph.getId()+')':''),this.line.setAttribute('marker-end',this.options.splitMarks&&1!=e[1]?'url(#verticalsplit_'+this.graph.getId()+')':'')}setShift(e){if(this.shift=e,!this.shift||!this.graph.getWidth())return;let t=this.shift;t=this.floating?t:this.isLeft()?t:this.graph.getWidth()-this.graph.getPaddingRight()-this.graph.getPaddingLeft()-t,this.group.setAttribute('transform','translate( '+t+' 0 )'),this.drawLabel()}isLeft(){return this.left}isRight(){return!this.left}isFlipped(){return!this.options.flipped}_drawLine(e,t){let i=this.getPx(e);return t?t.setAttribute('display','initial'):t=document.createElementNS(this.graph.ns,'line'),t.setAttribute('y1',i),t.setAttribute('y2',i),t.setAttribute('x1',0),t.setAttribute('x2',this.graph.drawingSpaceWidth),t.setAttribute('stroke','black'),this.group.appendChild(t),t}_hideLine(e){e&&e.setAttribute('display','none')}handleMouseMoveLocal(e,t){t-=this.graph.getPaddingTop(),this.mouseVal=this.getVal(t)}scaleToFitAxis(e,t,r,a,s,o){e&&e.isX()||(e=this.graph.getXAxis()),isNaN(r)&&(r=e.getCurrentMin()),isNaN(a)&&(a=e.getCurrentMax()),s===void 0&&(s=!0),o===void 0&&(o=!0),'number'==typeof t&&(a=r,r=t,t=!1);for(var n=-Infinity,p=Infinity,u=0,c=0,i=this.graph.series.length;c{var e=parseInt(t.target.parentElement.getAttribute('data-shapeid'));this.emit('mouseover',e,this.waveform.getX(e),this.waveform.getY(e))}),this.groupPoints.addEventListener('mouseout',(t)=>{var e=parseInt(t.target.parentElement.getAttribute('data-shapeid'));this.emit('mouseout',e,this.waveform.getX(e),this.waveform.getY(e))}),this.minX=r,this.minY=r,this.maxX=e,this.maxY=e,this.groupMain.appendChild(this.groupPoints),this.currentAction=!1,this.initExtended1&&this.initExtended1(),this.styles={},this.styles.unselected={},this.styles.selected={},this.styles.unselected.default={shape:'circle',cx:0,cy:0,r:3,stroke:'transparent',fill:'black'},this.styles.selected.default={shape:'circle',cx:0,cy:0,r:4,stroke:'transparent',fill:'black'}}setDataCategory(e){let t=+Infinity,i=-Infinity;for(let t of e)this._checkY(t.y.getMaxY()),this._checkY(t.y.getMinY());return this.data=e,this.dataHasChanged(),this.graph.updateDataMinMaxAxes(),this}empty(){for(;this.groupPoints.firstChild;)this.groupPoints.removeChild(this.groupPoints.firstChild)}getSymbolForLegend(){if(this.symbol)return this.symbol;var e=document.createElementNS(this.graph.ns,'g');e.setAttribute('data-shapeid',-1);var t=this.doShape(e,this.styles.unselected.default),r=this.getStyle('unselected',-1,!0);for(var a in r[-1])'shape'!=a&&t.setAttribute(a,r[-1][a]);return e}setStyle(e,t,i='unselected'){return'string'==typeof t&&(i=t,t=!1),this.styles[i]=this.styles[i]||{},this.styles[i].all=e,this.styles[i].modifiers=t,this.styleHasChanged(i),this}draw(e){if(e||this.hasDataChanged()||this.hasStyleChanged('unselected')){var t=0,i='category'==this.getXAxis().getType(),r,a,s;this._drawn=!0,this.dataHasChanged(!1),this.styleHasChanged(!1),this.groupMain.removeChild(this.groupPoints);var o=[];if(t=0,s=0,this.hasErrors()&&this.errorDrawInit(),i){for(let e=0;tthis.getXAxis().getCurrentMax()||this.waveform.getY(t)this.getYAxis().getCurrentMax()){this.shapes[t]&&this.shapes[t].setAttribute('display','none');continue}this.shapes[t]&&this.shapes[t].setAttribute('display','initial'),r=this.getX(this.waveform.getX(t)),a=this.getY(this.waveform.getY(t)),this.hasErrors()&&this.errorAddPoint(t,this.waveform.getX(t),this.waveform.getY(t),r,a),this.shapesDetails[t]=this.shapesDetails[t]||[],this.shapesDetails[t][0]=r,this.shapesDetails[t][1]=a,o.push(t)}this.hasErrors()&&this.errorDraw(),this.applyStyle('unselected',o),this.groupMain.appendChild(this.groupPoints)}}_addPoint(e,t,i){let r=document.createElementNS(this.graph.ns,'g'),a;r.setAttribute('transform','translate('+e+', '+t+')'),r.setAttribute('data-shapeid',i),a=this.extraStyle&&this.extraStyle[i]?this.doShape(r,this.extraStyle[i]):this.stdStylePerso?this.doShape(r,this.stdStylePerso):this.doShape(r,this.stdStyle),this.shapes[i]=a,this.groupPoints.appendChild(r)}doShape(e,t){var i=document.createElementNS(this.graph.ns,t.shape);return e.appendChild(i),i}getStyle(e,t,r){var e=e||'unselected',a={},s;'number'==typeof t?s=[t]:Array.isArray(t)&&(s=t);var o,t,n,d,p;this.styles[e].all!==void 0&&(p=this.styles[e].all,'function'==typeof p?p=p():!1===p&&(p={}));for(var u=0,i=s.length;ue.x):[]}}l.mix(p,d.default),t.default=p,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(8),i(4),i(0)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r,a){'use strict';function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,'__esModule',{value:!0});var o=s(i),n=s(r);class l extends o.default{static default(){return{fillColor:'rgba( 0, 0, 0, 0.1 )',lineColor:'rgba( 0, 0, 0, 1 )',lineWidth:'1px'}}constructor(){super(...arguments),this.selectionType='unselected',this.id=(0,a.guid)(),this.groupZones=document.createElementNS(this.graph.ns,'g'),this.groupMain=document.createElementNS(this.graph.ns,'g'),this.lineZone=document.createElementNS(this.graph.ns,'path'),this.lineZone.setAttribute('stroke','black'),this.lineZone.setAttribute('stroke-width','1px'),this.groupMain.appendChild(this.groupZones),this.groupZones.appendChild(this.lineZone),this.applyLineStyle(this.lineZone),this.styleHasChanged(),this.clip=document.createElementNS(this.graph.ns,'clipPath'),this.clipId=(0,a.guid)(),this.clip.setAttribute('id',this.clipId),this.graph.defs.appendChild(this.clip)}setWaveform(...e){return this.waveforms=e,this.waveforms=this.waveforms.map((e)=>e instanceof n.default?e:new n.default(e)),this.minX=this.waveforms[0].getXMin(),this.maxX=this.waveforms[0].getXMax(),this.minY=this.waveforms[0].getMin(),this.maxY=this.waveforms[0].getMax(),this.waveforms.map((e)=>{this.minX=g(e.getXMin(),this.minX),this.maxX=d(e.getXMin(),this.maxX),this.minY=g(e.getMin(),this.minY),this.maxY=d(e.getMax(),this.maxY)}),this.graph.updateDataMinMaxAxes(),this.dataHasChanged(),this}setWaveforms(){return this.setWaveform(...arguments)}getWaveforms(){return this.waveforms}setMinMaxWaveforms(e,t){return this.waveforms=[e,t.reverse()],this}empty(){for(;this.group.firstChild;)this.group.removeChild(this.group.firstChild)}draw(e){if(e||this.hasDataChanged()){if(!this.waveforms)return;let e=0,t=0,i=0,r=0,a=0,s='',o=!1,n;const l=this.getXAxis().getMinPx(),d=this.getXAxis().getMaxPx(),p=this.getYAxis().getMinPx(),g=this.getYAxis().getMaxPx(),u=this.getXAxis().getCurrentMin(),c=this.getXAxis().getCurrentMax(),h=this.getYAxis().getCurrentMin(),x=this.getYAxis().getCurrentMax();this.groupMain.removeChild(this.groupZones);for(let l of this.waveforms)for(a=0;ax&&(r=this.getY(x)),e===e){if(t!==t){if(0==s.length)continue;s+='L '+i+', '+this.getY(l.getMinY()),o=!0;continue}if(r=this.getY(t),i=this.getX(e),ec){n=[e,t[a],i,r];continue}o&&(s+=' M '+i+', '+this.getY(l.getMinY())+' ',o=!1),0{};else{var r={},a;let e=function(){onmessage=function(t){const e=t.data.data,r=t.data.maxX,a=t.data.minX,s=t.data.maxY,o=t.data.minY,p=t.data.direction;let u=t.data.numPoints,c=e.length,l=0,i=-4,h=[],x=[],m=[],y=[],f,b,A,k,M,S,_;f=t.data.xdata?function(e){return t.data.xdata[e]}:function(e){return e*t.data.xScale+t.data.xOffset};let v={};if('x'==p)for(const t=u/(r-a);l{r[t]=e});return a.postMessage(e),i}}t.default=i,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(6),i(0)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r){'use strict';function a(e){try{return e.getBBox()}catch(t){return{height:0,width:0,x:0,y:0}}}Object.defineProperty(t,'__esModule',{value:!0});var s=function(e){return e&&e.__esModule?e:{default:e}}(i),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(r),n={backgroundColor:'rgba(255, 255, 255, 0.8)',frame:!0,frameWidth:1,frameColor:'black',paddingTop:10,paddingLeft:10,paddingBottom:10,paddingRight:10,color:'black',frameRounding:0,movable:!1,shapesToggleable:!0,isSerieHideable:!0,isSerieSelectable:!0};class l{constructor(e,t){this.options=o.extend({},n,t),this.graph=e,this.svg=document.createElementNS(this.graph.ns,'g'),this.subG=document.createElementNS(this.graph.ns,'g'),this.groups=[],this.rect=document.createElementNS(this.graph.ns,'rect'),this.rectBottom=document.createElementNS(this.graph.ns,'rect'),this.rect.setAttribute('x',0),this.rect.setAttribute('y',0),this.rectBottom.setAttribute('x',0),this.rectBottom.setAttribute('y',0),this.series=!1,this.svg.setAttribute('display','none'),this.pos={x:void 0,y:void 0,transformX:0,transformY:0},this.setEvents(),this.eyeId=o.guid(),this.eyeCrossedId=o.guid();var i=o.SVGParser(''),r=o.SVGParser('');this.svg.appendChild(document.adoptNode(r.documentElement.firstChild)),this.svg.appendChild(document.adoptNode(i.documentElement.firstChild)),this.svg.appendChild(this.subG),this.applyStyle()}setPosition(e,t,i){e&&(this.position=e,this.alignToX=t||'left',this.alignToY=i||'top')}setDraggable(e){this.options.movable=e}setAutoPosition(e){return-1<['bottom','left','top','right'].indexOf(e=e.toLowerCase())?(this.autoPosition=e,this):void(this.requireDelayedUpdate(),this.autoPosition=!1)}autoPosition(){return this.setAutoPosition(...arguments)}buildLegendBox(){var e=this.series||this.graph.getSeries(),t=0,r=this.options.paddingTop;this.autoPosition?this.graph.getDom().appendChild(this.getDom()):this.graph.graphingZone.appendChild(this.getDom());for(var s=0,i=e.length;sthis.graph.getDrawingWidth()-this.options.paddingRight&&(r+=16,t=0)}this.groups[s].setAttribute('transform','translate( '+t+', '+r+')'),'bottom'==this.autoPosition||'top'==this.autoPosition?(t+=o.width+10,r+=0):(t=0,r+=16)}var o=a(this.subG);switch(this.width=o.width+this.options.paddingRight+this.options.paddingLeft,this.height=o.height+this.options.paddingBottom+this.options.paddingTop,this.rect.setAttribute('width',this.width),this.rect.setAttribute('height',this.height),this.rect.setAttribute('fill','none'),this.rect.setAttribute('pointer-events','fill'),this.rect.setAttribute('display','none'),this.options.movable&&(this.rectBottom.style.cursor='move'),this.rectBottom.setAttribute('width',this.width),this.rectBottom.setAttribute('height',this.height),this.rectBottom.setAttribute('x',o.x-this.options.paddingLeft),this.rectBottom.setAttribute('y',o.y-this.options.paddingTop),this.position=this.position||{},this.autoPosition){case'bottom':this.position.y=this.graph.getHeight()+'px',this.position.x=(this.graph.drawingSpaceWidth-this.width)/2+this.graph.drawingSpaceMinX+'px',this.alignToY='bottom',this.alignToX=!1;break;case'left':this.position.x='6px',this.position.y=(this.graph.getHeight()-this.height)/2+'px',this.alignToX='left',this.alignToY=!1;break;case'right':this.position.x=this.graph.getWidth()+'px',this.position.y=(this.graph.getHeight()-this.height)/2+'px',this.alignToX='right',this.alignToY=!1;break;case'top':this.position.x=(this.graph.drawingSpaceWidth-this.width)/2+this.graph.drawingSpaceMinX+'px',this.position.y='10px',this.alignToY='top',this.alignToX=!1;}if(this.autoPosition){switch(this.autoPosition){case'bottom':this.graph.options.paddingBottom=this.height+10;break;case'left':this.graph.options.paddingLeft=this.width+5;break;case'right':this.graph.options.paddingRight=this.width+10;break;case'top':this.graph.options.paddingTop=this.height+14;}this.graph.updateGraphingZone(),this.graph.getDrawingHeight(),this.graph.getDrawingWidth()}this.bbox=o}calculatePosition(){var e=s.default.check(this.position);let t=e.compute(this.graph,this.graph.getXAxis(),this.graph.getYAxis());t&&('max'==e.y&&(t.y+=this.graph.getPaddingTop()),'max'==e.x&&(t.x-=this.graph.getPaddingRight()),'right'==this.alignToX&&(t.x-=this.width,t.x-=this.bbox.x),'bottom'==this.alignToY?(t.y-=this.height,t.y-=this.bbox.y):t.y-=this.bbox.y,this.pos.transformX=t.x,this.pos.transformY=t.y,this._setPosition())}update(e){if(!(this.graph.isDelayedUpdate()||!this._requiredUpdate&&e)){this._requiredUpdate=!1;var t=this;for(this.applyStyle();this.subG.hasChildNodes();)this.subG.removeChild(this.subG.lastChild);this.svg.insertBefore(this.rectBottom,this.svg.firstChild);var r=this.series||this.graph.getSeries();if(0{let r=i.getUsedCategories();for(let a of r)e.hasOwnProperty(a)||(e[a]=1,t+=1),e[a]++,t++});let r=0;for(let t in e){let i=e[t];e[t]=r,r+=i}let i={};Array.prototype.map.call(this.series,(r)=>{let a=r.getUsedCategories(),s={};a.forEach((r)=>{i[r]=i[r]||0.5,s[r]=(e[r]+i[r])/t,i[r]++}),r.setDataIndices(s,t)})}getType(){return'category'}}t.default=a,e.exports=t['default']})},function(e,t,i){var r,s,o;(function(a,n){s=[e,t,i(9),i(0)],r=n,o='function'==typeof r?r.apply(t,s):r,!(void 0!==o&&(e.exports=o))})(this,function(e,t,i,r){'use strict';function s(e,t){return u(e/t)*t}function o(e,t){switch(t.unit){case's':e.setSeconds(s(e.getSeconds(),t.increment)),e.setMilliseconds(0);break;case'i':e.setMinutes(s(e.getMinutes(),t.increment)),e.setSeconds(0),e.setMilliseconds(0);break;case'h':e.setHours(s(e.getHours(),t.increment)),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0);break;case'd':e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e.setHours(0),e.setDate(s(e.getDate(),t.increment));break;case'm':e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e.setHours(0),e.setDate(1),e.setMonth(s(e.getMonth(),t.increment));break;case'y':e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e.setHours(0),e.setDate(1),e.setMonth(0);break;default:throw new Error('Date format not recognized');}return e}function l(e,t){switch(t.unit){case's':e.setSeconds(e.getSeconds()+t.increment),e.setMilliseconds(0);break;case'i':e.setMinutes(e.getMinutes()+t.increment),e.setSeconds(0),e.setMilliseconds(0);break;case'h':e.setHours(e.getHours()+t.increment),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0);break;case'd':e.setDate(e.getDate()+t.increment),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e.setHours(0);break;case'm':e.setMonth(e.getMonth()+t.increment),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e.setHours(0),e.setDate(1);break;case'y':e.setFullYear(e.getFullYear()+t.increment),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e.setHours(0),e.setDate(1),e.setMonth(0);break;default:throw new Error('Date format not recognized');}return e}function c(e,t,i){if(e.groups[t][i])return e.groups[t][i].group.setAttribute('display','block'),e.groups[t][i];var r={group:document.createElementNS(e.graph.ns,'g'),text:document.createElementNS(e.graph.ns,'text')},a=document.createElementNS(e.graph.ns,'line');switch(a.setAttribute('stroke','black'),a.setAttribute('y1',0),t){case 2:a.setAttribute('y2',6),r.text.setAttribute('y',15),r.line=a,r.group.appendChild(r.line);break;default:case 1:a.setAttribute('y2',20),r.text.setAttribute('y',10),r.line1=a,r.line2=a.cloneNode(),r.group.appendChild(r.line1),r.group.appendChild(r.line2);}return r.text.setAttribute('text-anchor','middle'),r.text.setAttribute('dominant-baseline','middle'),r.group.appendChild(r.text),e.getWrapper(t).appendChild(r.group),e.groups[t][i]=r}function h(e,t,i){for(;ia)return void x(t);t.line.setAttribute('x1',s),t.line.setAttribute('x2',s),t.text.setAttribute('x',s),t.text.textContent=i;break;default:case 1:var n=d(r,g(a,s)),l=d(r,g(a,o));if(isNaN(l)||isNaN(n))return;for(t.line1.setAttribute('x1',n),t.line2.setAttribute('x1',l),t.line1.setAttribute('x2',n),t.line2.setAttribute('x2',l),t.text.setAttribute('x',(n+l)/2);8*i.length>l-n;)if(i=i.substr(0,i.length-2)+'.',1==i.length){i='';break}t.text.textContent=i;}}Object.defineProperty(t,'__esModule',{value:!0});var f=function(e){return e&&e.__esModule?e:{default:e}}(i),b=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(r),A=[{threshold:20,increments:{1:{increment:1,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:1,unit:'s',format:'MM:ss"s"'}}},{threshold:50,increments:{1:{increment:1,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:2,unit:'s',format:'MM:ss"s"'}}},{threshold:100,increments:{1:{increment:1,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:5,unit:'s',format:'MM:ss"s"'}}},{threshold:600,increments:{1:{increment:10,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:30,unit:'s',format:'MM:ss"s"'}}},{threshold:1e3,increments:{1:{increment:1,unit:'h',format:'HH"h"MM (dd/mm/yy)'},2:{increment:10,unit:'i',format:'MM"min"'}}},{threshold:1500,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:1,unit:'i',format:'H"h"MM'}}},{threshold:3e3,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:2,unit:'i',format:'H"h"MM'}}},{threshold:8e3,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:10,unit:'i',format:'H"h"MM'}}},{threshold:26400,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:20,unit:'i',format:'H"h"MM'}}},{threshold:86400,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:1,unit:'h',format:'H"h"MM'}}},{threshold:2e5,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:2,unit:'h',format:'H"h"MM'}}},{threshold:4e5,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:6,unit:'h',format:'H"h"MM'}}},{threshold:1.4e6,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:12,unit:'h',format:'HH"h"MM'}}},{threshold:6.4e6,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:1,unit:'d',format:'dd'}}},{threshold:1.24e7,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:2,unit:'d',format:'dd'}}},{threshold:43200000,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:7,unit:'d',format:'dd'}}},{threshold:69120000,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:15,unit:'d',format:'dd'}}},{threshold:86400000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:3,unit:'m',format:'mm/yyyy'}}},{threshold:172800000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:4,unit:'m',format:'mm/yyyy'}}},{threshold:864000000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:6,unit:'m',format:'mm/yyyy'}}},{threshold:1036800000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:1,unit:'y',format:'yyyy'}}}],k=function(){var e=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[WLloSZ]|"[^"]*"|'[^']*'/g,t=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,i=/[^-+\dA-Z]/g,r=function(e,t){for(e+='',t=t||2;e.lengthS?'a':'p',tt:12>S?'am':'pm',T:12>S?'A':'P',TT:12>S?'AM':'PM',Z:c?'UTC':((a+'').match(t)||['']).pop().replace(i,''),o:(0t/e){s=A[k];break}s||(s=A[A.length-1]);var n=0,d,p,g,u,x,f,k;for(n=1;2>=n;n++){if(!b.isNumeric(a)){h(this,n,0);break}g=new Date(a),u=o(g,s.increments[n]),k=0;do if(x=m(u,s.increments[n].format),f=c(this,n,k),d=this.getPx(u.getTime()),u=l(u,s.increments[n]),p=this.getPx(u.getTime()),y(n,f,x,this.getMinPx(),this.getMaxPx(),d,p),k++,100n(e)):this.data[d].outliers=[];return this.dataHasChanged(),this.graph.updateDataMinMaxAxes(),this}_style(e,t,i='unselected',r=!1){return this.styles[i]=this.styles[i]||{},this.styles[i][e]=t,r&&this._set(e,t,'selected'),this.styleHasChanged(i),this}_gstyle(e,t){return this.getStyle(t)[e]}getStyle(e='unselected'){return this.styles[e]||{}}setMeanLineColor(){return this._style('meanLineColor',...arguments)}getMeanLineColor(){return this._gstyle('meanLineColor',...arguments)}setStyle(e,t='unselected'){this.styles[t]=(0,r.extend)({},this.default().defaultStyle,this.styles.unselected,e),this.styleHasChanged(t)}setMeanLineWidth(){return this._style('meanLineWidth',...arguments)}getMeanLineWidth(){return this._gstyle('meanLineWidth',...arguments)}setBoxAboveLineColor(){return this._style('boxAboveLineColor',...arguments)}getBoxAboveLineColor(){return this._gstyle('boxAboveLineColor',...arguments)}setBoxBelowLineColor(){return this._style('boxBelowLineColor',...arguments)}getBoxBelowLineColor(){return this._gstyle('boxBelowLineColor',...arguments)}setBoxAboveLineWidth(){return this._style('boxAboveLineWidth',...arguments)}getBoxAboveLineWidth(){return this._gstyle('boxAboveLineWidth',...arguments)}setBoxBelowLineWidth(){return this._style('boxBelowLineWidth',...arguments)}getBoxBelowLineWidth(){return this._gstyle('boxBelowLineWidth',...arguments)}setBoxAboveFillColor(){return this._style('boxAboveFillColor',...arguments)}getBoxAboveFillColor(){return this._gstyle('boxAboveFillColor',...arguments)}setBoxBelowFillColor(){return this._style('boxBelowFillColor',...arguments)}getBoxBelowFillColor(){return this._gstyle('boxBelowFillColor',...arguments)}setBoxAboveFillOpacity(){return this._style('boxAboveFillOpacity',...arguments)}getBoxAboveFillOpacity(){return this._gstyle('boxAboveFillOpacity',...arguments)}setBoxBelowFillOpacity(){return this._style('boxBelowFillOpacity',...arguments)}getBoxBelowFillOpacity(){return this._gstyle('boxBelowFillOpacity',...arguments)}setBarAboveLineColor(){return this._style('barAboveLineColor',...arguments)}getBarAboveLineColor(){return this._gstyle('barAboveLineColor',...arguments)}setBarBelowLineColor(){return this._style('barBelowLineColor',...arguments)}getBarBelowLineColor(){return this._gstyle('barBelowLineColor',...arguments)}setBarAboveLineWidth(){return this._style('barAboveLineWidth',...arguments)}getBarAboveLineWidth(){return this._gstyle('barAboveLineWidth',...arguments)}setBarBelowLineWidth(){return this._style('barBelowLineWidth',...arguments)}getBarBelowLineWidth(){return this._gstyle('barBelowLineWidth',...arguments)}setOutlierLineColor(){return this._style('outlierLineColor',...arguments)}getOutlierLineColor(){return this._gstyle('outlierLineColor',...arguments)}setOutlierLineWidth(){return this._style('outlierLineWidth',...arguments)}getOutlierLineWidth(){return this._gstyle('outlierLineWidth',...arguments)}setOutlierFillColor(){return this._style('outlierFillColor',...arguments)}getOutlierFillColor(){return this._gstyle('outlierFillColor',...arguments)}setOutlierFillOpacity(){return this._style('outlierFillOpacity',...arguments)}getOutlierFillOpacity(){return this._gstyle('outlierFillOpacity',...arguments)}applyLineStyles(){this.applyLineStyle(this.pathDom)}applyLineStyle(e){e.setAttribute('stroke',this.getLineColor()),e.setAttribute('stroke-width',this.getLineWidth()),e.removeAttribute('stroke-dasharray'),e.setAttribute('fill',this.getFillColor()),e.setAttribute('fill-opacity',this.getFillOpacity()||1)}draw(){if(!this.data)return;let e='y'==this.options.orientation?this.getYAxis():this.getXAxis(),t='y'==this.options.orientation?this.getXAxis():this.getYAxis(),a=!1,s,o,n,d,u,c,h,x;if((0,r.emptyDom)(this.groupMain),'category'==t.getType())o=t.getRelPx(0.8/this.nbCategories),a=!0;else{o=this.options.maxBoxWidth;for(var m=0,i=this.data.length;m{te.getPos(t));var l=document.createElementNS(this.graph.ns,'line');this.applyMeanStyle(l);var y=document.createElementNS(this.graph.ns,'rect'),f=document.createElementNS(this.graph.ns,'rect');'y'==this.options.orientation?(y.setAttribute('width',o),y.setAttribute('x',s[0]-o/2),f.setAttribute('width',o),f.setAttribute('x',s[0]-o/2),l.setAttribute('x1',s[0]-o/2),l.setAttribute('x2',s[0]+o/2),l.setAttribute('y1',n),l.setAttribute('y2',n)):(y.setAttribute('height',o),y.setAttribute('y',s[0]-o/2),f.setAttribute('height',o),f.setAttribute('y',s[0]-o/2),l.setAttribute('y1',s[0]-o/2),l.setAttribute('y2',s[0]+o/2),l.setAttribute('x1',n),l.setAttribute('x2',n)),this.boxPos(y,n,d,'x'==this.options.orientation),this.boxPos(f,n,u,'x'==this.options.orientation),this.applyBoxStyle(y,f);var b=document.createElementNS(this.graph.ns,'line'),A=document.createElementNS(this.graph.ns,'line');'y'==this.options.orientation?(void 0!==c&&(b.setAttribute('y1',d),b.setAttribute('y2',c),b.setAttribute('x1',s[0]),b.setAttribute('x2',s[0])),void 0!==h&&(A.setAttribute('y1',u),A.setAttribute('y2',h),A.setAttribute('x1',s[0]),A.setAttribute('x2',s[0]))):(void 0!==c&&(b.setAttribute('x1',d),b.setAttribute('x2',c),b.setAttribute('y1',s[0]),b.setAttribute('y2',s[0])),void 0!==h&&(A.setAttribute('x1',u),A.setAttribute('x2',h),A.setAttribute('y1',s[0]),A.setAttribute('y2',s[0]))),x.map((e)=>{let t=document.createElementNS(this.graph.ns,'circle');t.setAttribute('r',2),'y'==this.options.orientation?(t.setAttribute('cx',s[0]),t.setAttribute('cy',e)):(t.setAttribute('cy',s[0]),t.setAttribute('cx',e)),this.setOutlierStyle(t),this.groupMain.appendChild(t)}),void 0!==c&&this.groupMain.appendChild(b),void 0!==h&&this.groupMain.appendChild(A),void 0!==d&&this.groupMain.appendChild(y),void 0!==u&&this.groupMain.appendChild(f),this.groupMain.appendChild(l),this.applyWhiskerStyle(b,A)}}applyBoxStyle(e,t){e.setAttribute('stroke',this.getBoxAboveLineColor()),e.setAttribute('stroke-width',this.getBoxAboveLineWidth()),this.getBoxAboveFillColor()!==void 0&&e.setAttribute('fill',this.getBoxAboveFillColor()),this.getBoxAboveFillOpacity()!==void 0&&e.setAttribute('fill-opacity',this.getBoxAboveFillOpacity()),t.setAttribute('stroke',this.getBoxBelowLineColor()),t.setAttribute('stroke-width',this.getBoxBelowLineWidth()),this.getBoxBelowFillColor()!==void 0&&t.setAttribute('fill',this.getBoxBelowFillColor()),this.getBoxAboveFillOpacity()!==void 0&&t.setAttribute('fill-opacity',this.getBoxBelowFillOpacity())}applyWhiskerStyle(e,t){e.setAttribute('stroke',this.getBarAboveLineColor()),e.setAttribute('stroke-width',this.getBarAboveLineWidth()),t.setAttribute('stroke',this.getBarBelowLineColor()),t.setAttribute('stroke-width',this.getBarBelowLineWidth())}applyMeanStyle(e){e.setAttribute('stroke',this.getMeanLineColor()),e.setAttribute('stroke-width',this.getMeanLineWidth())}setOutlierStyle(e){e.setAttribute('stroke',this.getOutlierLineColor()),e.setAttribute('stroke-width',this.getOutlierLineWidth()),this.getBoxBelowFillColor()!==void 0&&e.setAttribute('fill',this.getOutlierFillColor()),this.getBoxAboveFillOpacity()!==void 0&&e.setAttribute('fill-opacity',this.getOutlierFillOpacity())}getCategoryIndex(e){if(!this.categories)throw new Error('No categories were defined. Probably axis.setSeries was not called');for(var t=0;ti?(e.setAttribute(r?'x':'y',i),e.setAttribute(r?'width':'height',t-i)):(e.setAttribute(r?'x':'y',t),e.setAttribute(r?'width':'height',i-t))}getUsedCategories(){let e='y'==this.options.orientation?'x':'y',t=this.data.map((t)=>t[e]);return Array.isArray(this._linkedToScatterSeries)&&this._linkedToScatterSeries.map((e)=>{e.getUsedCategories().map((e)=>{let i;-1<(i=t.indexOf(e))&&t.splice(i,1)})}),t}linkToScatterSerie(...e){this._linkedToScatterSeries=e}}t.default=s,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(5),i(0),i(10)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r,a){'use strict';function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,'__esModule',{value:!0});var o=s(i),n=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(r),l=s(a);class d extends o.default{constructor(){super(...arguments),this.lines=this.lines||{}}setColors(e){this.colors=e}_draw(){var t=this,e=this._dataToUse,r=0,i=!1,a=!1,s=this.getXAxis(),o=this.getYAxis(),n=s.getCurrentMin(),d=o.getCurrentMin(),p=s.getCurrentMax(),g=o.getCurrentMax(),u=0,c=1,h=!1,f=!1,b,A,k,m,x,A,y,M,S,_;for(this.eraseLines(),this.isFlipped()&&(u=1,c=0),this.currentLine='',k=this.waveform.getLength(),b=0;bp&&i>p||(xg&&a>g)&&!this.options.lineToZero){i=m,a=x,f=!0;continue}if(this.counter2=b,this.markersShown()&&this.getMarkerCurrentFamily(this.counter2),S=this.getX(m),_=this.getY(x),S!=y||_!=M){if(h=mp||x>g,isNaN(S)||isNaN(_)){0r||h>d||0>i||0>h))&&(p[i]=p[i]||[],p[i][h]=p[i][h]+1||1,l=p[i][h]u?p[i][h]:u);return this.maxIndexX=r,this.maxIndexY=d,this.binMin=l,this.binMax=u,this.deltaX=t,this.deltaY=n,this.fromX=e,this.fromY=a,this.numX=r,this.numY=d,this.densitymap=p,p}setDensityMap(e,t,r,a,n,d){var p=this.data.length,l=s,g=o,u,i;for(u=0;ug?e[u][i]:g;return this.maxIndexX=e.length,this.maxIndexY=e[0].length,this.binMin=l,this.binMax=g,this.deltaX=r,this.deltaY=d,this.fromX=t,this.fromY=n,this.numX=this.maxIndexX,this.numY=this.maxIndexY,this.densitymap=e,e}calculateDensityWeighted(e,t,r,a,d,p){var g=[],u=this.data.length,l=s,c=o,h,i,x,m,y,f,b,A,k,M,S;for(h=0;hr||x>p||0>i||0>x))&&(g[A]=g[A]||[],g[k]=g[k]||[],g[A][M]=g[A][M]||0,g[k][M]=g[k][M]||0,g[A][S]=g[A][S]||0,g[k][S]=g[k][S]||0,g[A][M]+=m*y,g[k][M]+=(1-m)*y,g[A][S]+=m*(1-y),g[k][S]+=(1-m)*(1-y),l=g[A][M]c?g[A][M]:c,l=g[k][M]c?g[k][M]:c,l=g[A][S]c?g[A][S]:c,l=g[k][S]c?g[k][S]:c);return this.maxIndexX=r,this.maxIndexY=p,this.binMin=l,this.binMax=c,this.deltaX=t,this.deltaY=d,this.fromX=e,this.fromY=a,this.numX=r,this.numY=p,this.densitymap=g,g}autoBins(e,t){return this.numX=e||400,this.numY=t||this.numX,this.calculateDensity(this.minX,(this.maxX-this.minX)/e,e,this.minY,(this.maxY-this.minY)/t,t),this.recalculateBinsOnDraw=!1,this}setPxPerBin(e,t,i){return e&&this.calculationDensityMap({from:'min',to:'max',pxPerBin:e,weighted:i}),t&&this.calculationDensityMap(!1,{from:'min',to:'max',pxPerBin:t,weighted:i}),this}setBinsFromTo(e,t,i,r){return this.densityMapCalculation=this.densityMapCalculation||{},this.densityMapCalculation[e]={from:t,to:i,numBins:r},this.calculationDensityMap(),this}calculationDensityMap(e,t){this.method=this.calculateDensityAdvanced,this.densityMapCalculation=this.densityMapCalculation||{},e&&(this.densityMapCalculation.x=e),t&&(this.densityMapCalculation.y=t)}calculateDensityAdvanced(){var e={x:{from:0,num:0,delta:0,weighing:!1},y:{from:0,num:0,delta:0,weighing:!1}},t={x:this.graph.drawingSpaceWidth,y:this.graph.drawingSpaceHeight},r={x:this.getXAxis,y:this.getYAxis},s=!1;for(var o in this.densityMapCalculation)if(this.densityMapCalculation[o].weighted&&(s=!0,e[o].weighing=!0),this.densityMapCalculation[o].pxPerBin){var i='min'==this.densityMapCalculation[o].from?r[o].call(this).getCurrentMin():this.densityMapCalculation[o].from,n='max'==this.densityMapCalculation[o].to?r[o].call(this).getCurrentMax():this.densityMapCalculation[o].to,l=p(r[o].call(this).getRelPx(n-i));e[o].num=a(t[o]/this.densityMapCalculation[o].pxPerBin),e[o].from=i-p(r[o].call(this).getRelVal((e[o].num*this.densityMapCalculation[o].pxPerBin-l)/2)),e[o].delta=p(r[o].call(this).getRelVal(this.densityMapCalculation[o].pxPerBin))}else e[o].num=this.densityMapCalculation[o].numBins||400,e[o].from='min'==this.densityMapCalculation[o].from?r[o].call(this).getCurrentMin():this.densityMapCalculation[o].from,e[o].delta=this.densityMapCalculation[o].to?(('max'==this.densityMapCalculation[o].to?r[o].call(this).getCurrentMax():this.densityMapCalculation[o].to)-e[o].from)/e[o].num:this.densityMapCalculate[o].delta;(s?this.calculateDensityWeighted:this.calculateDensity).call(this,e.x.from,e.x.delta,e.x.num,e.y.from,e.y.delta,e.y.num)}setColorMapBinBoundaries(e,t){return this.colorMapMin=e,this.colorMapMax=t,this}autoColorMapBinBoundaries(){return this.colorMapMin=this.binMin,this.colorMapMax=this.binMax,this}onRedrawColorMapBinBoundaries(e){return this.callbackColorMapMinMax=e,this}colorMapHSL(t,r,a){a=a||'linear';for(var s={exp:function(t){return(e(1*(t/r))-1)/(2.718281828459045-1)},log:function(e){return(i(e+1)-0)/(i(r+1)-0)},linear:function(e){return(e-0)/(r-0)}},o=0,l=[],d=[],p={h:null,s:null,l:null,a:null},g=t.length-1,c=0,h,x;c<=r;c++){for(var m in h=s[a](c),x=n(h*g),x==t.length-1&&(x=g-1),h=(h-x/g)/(1/g),p)p[m]=(t[x+1][m]-t[x][m])*h+t[x][m];l[o]='hsl('+p.h+', '+u(100*p.s)+'%, '+u(100*p.l)+'%)',d[o]=p.a,o++}return this.opacities=d,this.colorMap=l,this.colorMapNum=r,this}autoColorMapHSL(e,t='linear'){return this.colorMapHSV(e,100,t),this}getColorIndex(e){return d(0,g(this.colorMapNum,n((e-this.colorMapMin)/(this.colorMapMax-this.colorMapMin)*this.colorMapNum)))}draw(){var e;if(this.method&&this.method(),!this.callbackColorMapMinMax||void 0==this.colorMapMin||void 0==this.colorMapMax||'auto'==this.callbackColorMapMinMax)this.autoColorMapBinBoundaries();else{var t=this.callbackColorMapMinMax(this.binMin,this.binMax);this.setColorMapBinBoundaries(t[0],t[1])}for(var r=this.getXAxis().getRelPx(this.deltaX),a=this.getYAxis().getRelPx(this.deltaY),s=0;sA&&c[r+2+m]>A||c[r+x]>b&&c[r+2+x]>b||(o=this.getX(c[r+x]),n=this.getY(c[r+m]),a=this.getX(c[r+2+x]),s=this.getY(c[r+2+m]),a!=o||s!=n)&&(this.currentLine+='M ',this.currentLine+=o,this.currentLine+=' ',this.currentLine+=n,this.currentLine+='L ',this.currentLine+=a,this.currentLine+=' ',this.currentLine+=s,this.counter++,k=a,M=s,l++)}this.currentLine+=' z',u=this._createLine(),u.setAttribute('data-zvalue',this.data[t].zValue),this.zValues[this.data[t].zValue]={dom:u},this.minZ=g(this.minZ,this.data[t].zValue),this.maxZ=d(this.maxZ,this.data[t].zValue)}for(t++,t=this.currentLine+1;t=this.positiveThreshold||0>=o&&o<=this.negativeThreshold?'block':'none');this._shapeZoom&&(this.options.hasNegative?(this._shapeZoom.setHandleNeg(-t(this.negativeDelta,3),this.minZ),this._shapeZoom.showHandleNeg()):this._shapeZoom.hideHandleNeg(),this._shapeZoom.setHandlePos(t(this.positiveDelta,3),this.maxZ))}setDynamicColor(e){this.lineColors=e,this.styleHasChanged()}setNegative(e){this.options.hasNegative=e,e&&(this.negativeThreshold=0)}setColorTo(e,t,r,a){if(this.lineColors){var s={h:0,s:0,l:0};for(var n in s)s[n]=0a||0>s+a||s>this.graph.getDrawingWidth())return this.setDom('d',''),!1;var o=this.serie.searchClosestValue(this.getPosition(0).x),n=this.serie.searchClosestValue(this.getPosition(1).x),l=0,u=r,c,h,i,x,m,f,s,b;if(!o||!n)return!1;for(o.xBeforeIndex>n.xBeforeIndex&&(c=o,o=n,n=c),this.counter=0,h=o.dataIndex;h<=n.dataIndex;h++){for(this.currentLine='',x=h==o.dataIndex?o.xBeforeIndexArr:0,m=h==n.dataIndex?n.xBeforeIndexArr:this.serie.data[h].length,f=0,x==m&&m++,i=x;i<=m;i+=2)s=this.serie.getX(this.serie.data[h][i+0]),b=this.serie.getY(this.serie.data[h][i+1]),l=d(this.serie.data[h][i+1],l),u=g(this.serie.data[h][i+1],u),i==x&&(this.firstX=s,this.firstY=b),this.currentLine+=0this.serie.getXAxis().getCurrentMax()&&u.x>this.serie.getXAxis().getCurrentMax())return this.setDom('d',''),this._domShadow.setAttribute('d',''),this.hideLabel(0),!1;this.showLabel(0);let c=0,h=this.serie.getWaveform(),x;if(!h)return;let m=h.getIndexFromX(g[e],!0,Math.floor),y=h.getIndexFromX(u[e],!0,Math.ceil),f=!1,b;m==y&&('aggregate'==h.getReductionType()?y+=4:y++),y=m:x<=y;x+=X){if(n=h.getX(x,!0),d=h.getY(x,!0),s=this.serie.getX(n),o=this.serie.getY(d),c+=h.getY(x,!0),M||(M=s,S=o,_=h.getX(x),v=h.getY(x)),void 0==C){C=s,w=o,P=h.getX(x),L=h.getY(x);continue}s!=C||o!=w,C=s,w=o,t.push([s,o,c]),P=n}P=!1,L=!1,C=!1,w=!1,0==c&&(c=1),this._sumVal=h.integrate(g.x,u.x),p=this.ratio?this.ratio*(this.sumVal/c):200/c;let T;if(0!=t.length){for(var Y=0,i=t.length;Yc/2&&t[Y][2]<=c/2||t[Y-1][2]=c/2)){let e=a-(t[Y-1][2]+t[Y][2])/2*p;this.setPosition({x:t[Y][0]+'px',y:e+'px'},3),this.setLabelPosition(this.getPosition(3),0)}r+=' L '+t[Y][0]+', '+T+' ',this.lastPointX=t[Y][0],this.lastPointY=T}return this.points=t,this._sum=c,r=this.serie.isFlipped()?' M '+a+', '+M+' '+r:' M '+M+', '+a+' '+r,this.firstPointX=M,this.firstPointY=a,this.setDom('d',r),this._domShadow.setAttribute('d',r),this.firstX=M,this.firstY=S,this.ratioLabel&&this.updateIntegralValue(this.ratioLabel)||this.updateLabels(),this.changed(),this.handleCondition=!this.xor(-1==X,f),this.setHandles(),this.updateIntegralValue(),!0}}updateIntegralValue(e=this.ratioLabel,t){return e&&(this.ratioLabel=e),void 0!==t&&(this.ratioLabel=t/this.sumVal),this.setLabelText(e?(u(100*this.sumVal*e)/100).toPrecision(3):'N/A',0),this.updateLabels(),this.ratioLabel}getAxis(){return this._data.axis||'x'}set ratio(e){this._ratio=e}get ratio(){return this._ratio}get sum(){return this._sum}get sumVal(){return this._sumVal}selectStyle(){this.setDom('stroke-width','2px')}selectHandles(){}setHandles(){void 0!=this.points&&this.isSelected()&&(this.addHandles(),this.handleCondition?(this.handles[1].setAttribute('x',this.firstPointX),this.handles[1].setAttribute('y',this.firstPointY),this.handles[2].setAttribute('x',this.lastPointX),this.handles[2].setAttribute('y',this.lastPointY)):(this.handles[2].setAttribute('x',this.firstPointX),this.handles[2].setAttribute('y',this.firstPointY),this.handles[1].setAttribute('x',this.lastPointX),this.handles[1].setAttribute('y',this.lastPointY)))}handleMouseMoveImpl(t,e){if(!this.isLocked()){var i=this.getPosition(0),r=this.getPosition(1),a;return 1==this.handleSelected?a=i:2==this.handleSelected&&(a=r),a&&!this._data.vertical&&a.deltaPosition('x',e,this.getXAxis()),this.moving&&(i.x&&i.deltaPosition('x',e,this.getXAxis()),r.x&&r.deltaPosition('x',e,this.getXAxis())),this.rectEvent&&this.setEventReceptacle(),this.redraw(),this.changed(),!0}}}t.default=n,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(18)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{constructor(e,t){super(e,t),this.nbHandles=4}createDom(){this._dom=document.createElementNS(this.graph.ns,'rect'),this._dom.element=this,this.createHandles(this.nbHandles,'rect',{transform:'translate(-3 -3)',width:6,height:6,stroke:'black',fill:'white',cursor:'nwse-resize'})}redrawImpl(){this.setPosition(),this.setHandles(),this.setBindableToDom(this._dom)}}t.default=a,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(1)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{constructor(e,t){super(e,t),this.nbHandles=1}get width(){return this.options.width||10}set width(e){this.options.width=e}createDom(){this._dom=document.createElementNS(this.graph.ns,'path'),this._dom.setAttribute('d','M -'+this.width/2+' 0 h '+this.width+' m -'+this.width/2+' -'+this.width/2+' v '+this.width+'')}createHandles(){this._createHandles(this.nbHandles,'rect',{transform:'translate(-3 -3)',width:6,height:6,stroke:'black',fill:'white',cursor:'nwse-resize'})}applyPosition(){var e=this.calculatePosition(0);if(e&&e.x&&e.y)return this.setDom('transform','translate( '+e.x+', '+e.y+')'),this.currentPos1x=e.x,this.currentPos1y=e.y,!0}redrawImpl(){this.setHandles()}handleCreateImpl(){}handleMouseDownImpl(){return this.moving=!0,!0}handleMouseUpImpl(){return this.triggerChange(),!0}handleMouseMoveImpl(t,e,i){if(!this.isLocked()){var r=this.getFromData('pos');return this.moving&&(r.x=this.graph.deltaPosition(r.x,e,this.getXAxis()),r.y=this.graph.deltaPosition(r.y,i,this.getYAxis())),this.redrawImpl(),!0}}setHandles(){!this.areHandlesInDom()||isNaN(this.currentPos1x)||(this.handles[1].setAttribute('x',this.currentPos1x),this.handles[1].setAttribute('y',this.currentPos1y))}selectStyle(){this.setDom('stroke','red'),this.setDom('stroke-width','2')}}t.default=a,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(12)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{constructor(e){super(e),this.lineHeight=6}createDom(){this._dom=document.createElementNS(this.graph.ns,'line'),this.line1=document.createElementNS(this.graph.ns,'line'),this.line2=document.createElementNS(this.graph.ns,'line'),this.line3=document.createElementNS(this.graph.ns,'line'),this.rectBoundary=document.createElementNS(this.graph.ns,'path'),this.rectBoundary.setAttribute('fill','transparent'),this.rectBoundary.setAttribute('stroke','none'),this.rectBoundary.setAttribute('pointer-events','fill'),this.rectBoundary.jsGraphIsShape=!0,this.group.appendChild(this.rectBoundary),this.group.appendChild(this.line1),this.group.appendChild(this.line2),this.group.appendChild(this.line3),this._dom.element=this}createHandles(){this._createHandles(3,'rect',{transform:'translate(-3 -3)',width:6,height:6,stroke:'black',fill:'white',cursor:'nwse-resize'})}redrawImpl(){this.line1.setAttribute('stroke',this.getStrokeColor()),this.line2.setAttribute('stroke',this.getStrokeColor()),this.line3.setAttribute('stroke',this.getStrokeColor()),this.line1.setAttribute('stroke-width',this.getStrokeWidth()),this.line2.setAttribute('stroke-width',this.getStrokeWidth()),this.line3.setAttribute('stroke-width',this.getStrokeWidth()),this.setHandles(),this.redrawLines()}redrawLines(){var e=this.computePosition(0),t=this.computePosition(1),i=this.computePosition(2);if(e.x&&t.x&&i.x&&this.posYPx){var r=this.lineHeight;this.rectBoundary.setAttribute('d','M '+e.x+' '+(this.posYPx-r)+' v '+2*r+' H '+t.x+' v '+-2*r+'z'),this.line1.setAttribute('x1',e.x),this.line1.setAttribute('x2',e.x),this.line2.setAttribute('x1',t.x),this.line2.setAttribute('x2',t.x),this.line3.setAttribute('x1',i.x),this.line3.setAttribute('x2',i.x),this._dom.setAttribute('x1',e.x),this._dom.setAttribute('x2',t.x),this.redrawY(r)}return this}redrawY(){if(!this.posYPx)return this;var e=this.lineHeight;return this.line1.setAttribute('y1',this.posYPx-e),this.line1.setAttribute('y2',this.posYPx+e),this.line2.setAttribute('y1',this.posYPx-e),this.line2.setAttribute('y2',this.posYPx+e),this.line3.setAttribute('y1',this.posYPx-e),this.line3.setAttribute('y2',this.posYPx+e),this._dom.setAttribute('y1',this.posYPx),this._dom.setAttribute('y2',this.posYPx),this}setHandles(){if(this.posYPx){var e=this.computePosition(0),t=this.computePosition(1),i=this.computePosition(2);e.x&&t.x&&i.x&&(this.handles[1].setAttribute('x',e.x),this.handles[1].setAttribute('y',this.posYPx),this.handles[2].setAttribute('x',t.x),this.handles[2].setAttribute('y',this.posYPx),this.handles[3].setAttribute('x',i.x),this.handles[3].setAttribute('y',this.posYPx))}}setY(e){return this.posYPx=e,this}setLineHeight(e){this.lineHeihgt=e}handleMouseMoveImpl(t,e){if(!this.isLocked()){var i=this.getPosition(0),r=this.getPosition(1),a=this.getPosition(2);switch(this.handleSelected){case 1:i.deltaPosition('x',e,this.getXAxis()),(p(a.x-r.x)>p(r.x-i.x)||p(a.x-i.x)>p(r.x-i.x))&&(a.x=i.x+0.1*(r.x-i.x));break;case 2:r.deltaPosition('x',e,this.getXAxis()),(p(a.x-r.x)>p(r.x-i.x)||p(a.x-i.x)>p(r.x-i.x))&&(a.x=r.x+0.1*(i.x-r.x));break;case 3:if(a.deltaPosition('x',e,this.getXAxis()),p(a.x-r.x)>p(r.x-i.x)||p(a.x-i.x)>p(r.x-i.x))return;}this.setLabelPosition({y:this.getLabelPosition(0).y,x:a.x}),this.updateLabels(),this.redrawLines(),this.setHandles()}}applyPosition(){return this.redrawLines(),!0}}t.default=a,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(0),i(1)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var a=function(e){return e&&e.__esModule?e:{default:e}}(r);class s extends a.default{constructor(e,t){super(e,t)}createDom(){this._dom=document.createElement('div'),this._dom.setAttribute('style','position: absolute');let e=document.createElement('div');this._dom.appendChild(e),this.div=e}createHandles(){}setHeight(e){this.setProp('height',e)}setWidth(e){this.setProp('width',e)}setContent(e){this.setProp('content',e)}setRenderer(e){this._renderer=e}redraw(){this._renderer?this._renderer(this.div):this.div.innerHTML=this.getProp('content'),super.redraw(...arguments)}applyPosition(){var e=this.calculatePosition(0);if(e&&(0,i.isNumeric)(e.x)&&(0,i.isNumeric)(e.y))return this._dom.style.left=e.x+'px',this._dom.style.top=e.y+'px',this.currentPosX=e.x,this.currentPosY=e.y,!0}handleMouseMoveImpl(){return!0}setHandles(){}isHTML(){return!0}}t.default=s,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(2)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{static default(){return{dragX:!0,dragY:!0,persistanceX:!1,persistanceY:!1}}init(e){this.graph=e,this.time=null,this.totaltime=2e3}onMouseDown(e,t,i){return this._draggingX=t,this._draggingY=i,this._lastDraggingX=this._draggingX,this._lastDraggingY=this._draggingY,this.stopAnimation=!0,this.moved=!1,!0}onMouseMove(e,t,i){var r=t-this._draggingX,a=i-this._draggingY;this.options.dragX&&e._applyToAxes(function(e){e.setCurrentMin(e.getVal(e.getMinPx()-r)),e.setCurrentMax(e.getVal(e.getMaxPx()-r))},!1,!0,!1),this.options.dragY&&e._applyToAxes(function(e){e.setCurrentMin(e.getVal(e.getMinPx()-a)),e.setCurrentMax(e.getVal(e.getMaxPx()-a))},!1,!1,!0),this._lastDraggingX=this._draggingX,this._lastDraggingY=this._draggingY,this._draggingX=t,this._draggingY=i,this.moved=!0,this.time=Date.now(),this.emit('dragging'),e.draw(!0)}onMouseUp(e,t,i){var r=Date.now()-this.time;return t==this._lastDraggingX||i==this._lastDraggingY?void(this.moved&&this.emit('dragged')):(this.speedX=(t-this._lastDraggingX)/r,this.speedY=(i-this._lastDraggingY)/r,isNaN(this.speedX)||isNaN(this.speedY)?void this.emit('dragged'):void(e._applyToAxes(function(e){e._pluginDragMin=e.getCurrentMin(),e._pluginDragMax=e.getCurrentMax()},!1,!0,!0),this.stopAnimation=!1,this.accelerationX=-this.speedX/this.totaltime,this.accelerationY=-this.speedY/this.totaltime,this.options.persistanceX||this.options.persistanceY?this._persistanceMove(e):this.emit('dragged')))}_persistanceMove(e){var t=this;return t.stopAnimation?void t.emit('dragged'):void window.requestAnimationFrame(function(){var i=Date.now()-t.time,r=(0.5*t.accelerationX*i+t.speedX)*i,a=(0.5*t.accelerationY*i+t.speedY)*i;t.options.persistanceX&&e._applyToAxes(function(e){e.setCurrentMin(-e.getRelVal(r)+e._pluginDragMin),e.setCurrentMax(-e.getRelVal(r)+e._pluginDragMax),e.cacheCurrentMin(),e.cacheCurrentMax(),e.cacheInterval()},!1,!0,!1),t.options.persistanceY&&e._applyToAxes(function(e){e.setCurrentMin(-e.getRelVal(a)+e._pluginDragMin),e.setCurrentMax(-e.getRelVal(a)+e._pluginDragMax),e.cacheCurrentMin(),e.cacheCurrentMax(),e.cacheInterval()},!1,!1,!0),e.draw(),i{console.log(this.currentShape),this.currentShape||e.emit('newShape',a,p)})}}}onMouseMove(t,i,r,a){if(this.currentShape){console.log('mv'),this.count++;var e=this.currentShape;this.currentShape=!1,t.selectedSerie&&!e.serie&&e.setSerie(t.selectedSerie),e.resizing=!0,e.options&&e.options.onCreate&&e.options.onCreate.call(e),e.draw(),t.selectShape(e),e.handleMouseDown(this.currentShapeEvent,!0),e.handleSelected=this.options.handleSelected||1,e.handleMouseMove(a,!0)}}onMouseUp(){this.currentShape&&(this.currentShape.kill(),this.currentShape=!1)}}t.default=o,e.exports=t['default']})},function(e,i,r){var a,s,o;(function(t,n){s=[e,i,r(0),r(2)],a=n,o='function'==typeof a?a.apply(i,s):a,!(void 0!==o&&(e.exports=o))})(this,function(e,i,r,a){'use strict';Object.defineProperty(i,'__esModule',{value:!0});var s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(r),o=function(e){return e&&e.__esModule?e:{default:e}}(a);class n extends o.default{constructor(){super(...arguments)}static default(){return{}}init(e){this._path=document.createElementNS(e.ns,'path'),s.setAttributeTo(this._path,{display:'none',fill:'rgba(0,0,0,0.1)',stroke:'rgba(0,0,0,1)',"shape-rendering":'crispEdges',x:0,y:0,height:0,width:0,d:''}),this.graph=e,e.dom.appendChild(this._path)}setSerie(e){this.serie=e}onMouseDown(e,t,i){this.serie&&(this.path='M '+t+' '+i+' ',this.currentX=t,this.currentY=i,this.xs=[this.serie.getXAxis().getVal(t-e.getPaddingLeft())],this.ys=[this.serie.getYAxis().getVal(i-e.getPaddingTop())],this._path.setAttribute('d',''),this._path.setAttribute('display','block'))}onMouseMove(e,i,r){25e.getY(a)||this.ys[o]>e.getY(a)&&this.ys[s](e.getY(a)-this.ys[o])/(this.ys[s]-this.ys[o])*(this.xs[s]-this.xs[o])+this.xs[o]&&r++;1==r%2?(t.push(a),this.serie.selectPoint(a,!0,'selected')):this.serie.unselectPoint(a)}this.selected=t,this.emit('selectionProcess',t)}onMouseUp(){this._path.setAttribute('display','none'),this.emit('selectionEnd',this.selected)}}i.default=n,e.exports=i['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(0),i(2)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(i),s=function(e){return e&&e.__esModule?e:{default:e}}(r);class o extends s.default{constructor(){super(...arguments)}static default(){return{axes:'all'}}init(e){this._zoomingGroup=document.createElementNS(e.ns,'g'),this._zoomingSquare=document.createElementNS(e.ns,'rect'),this._zoomingSquare.setAttribute('display','none'),a.setAttributeTo(this._zoomingSquare,{display:'none',fill:'rgba(171,12,12,0.2)',stroke:'rgba(171,12,12,1)',"shape-rendering":'crispEdges',x:0,y:0,height:0,width:0,"pointer-events":'none'}),this.graph=e,e.groupEvent.appendChild(this._zoomingGroup),this._zoomingGroup.appendChild(this._zoomingSquare)}onMouseDown(t,i,r,a,e){var s=this.options.zoomMode;if(s){switch(this._zoomingMode=s,void 0===i&&(this._backedUpZoomMode=this._zoomingMode,this._zoomingMode='y',i=0),void 0===r&&(this._backedUpZoomMode=this._zoomingMode,this._zoomingMode='x',r=0),this._zoomingXStart=i,this._zoomingYStart=r,this.x1=i-t.getPaddingLeft(),this.y1=r-t.getPaddingTop(),this._zoomingSquare.setAttribute('width',0),this._zoomingSquare.setAttribute('height',0),this._zoomingSquare.setAttribute('display','block'),this._zoomingMode){case'x':this._zoomingSquare.setAttribute('y',t.options.paddingTop),this._zoomingSquare.setAttribute('height',t.getDrawingHeight()-t.shift.bottom);break;case'y':this._zoomingSquare.setAttribute('x',t.options.paddingLeft),this._zoomingSquare.setAttribute('width',t.getDrawingWidth());break;case'forceY2':this.y2=t.getYAxis().getPx(this.options.forcedY)+t.options.paddingTop;}this.options.onZoomStart&&!e&&this.options.onZoomStart(t,i,r,a,e)}}onMouseMove(t,i,r,a,e){switch(this._zoomingMode){case'xy':this._zoomingSquare.setAttribute('x',g(this._zoomingXStart,i)),this._zoomingSquare.setAttribute('y',g(this._zoomingYStart,r)),this._zoomingSquare.setAttribute('width',p(this._zoomingXStart-i)),this._zoomingSquare.setAttribute('height',p(this._zoomingYStart-r));break;case'forceY2':this._zoomingSquare.setAttribute('y',g(this._zoomingYStart,this.y2)),this._zoomingSquare.setAttribute('height',p(this._zoomingYStart-this.y2)),this._zoomingSquare.setAttribute('x',g(this._zoomingXStart,i)),this._zoomingSquare.setAttribute('width',p(this._zoomingXStart-i));break;case'x':this._zoomingSquare.setAttribute('x',g(this._zoomingXStart,i)),this._zoomingSquare.setAttribute('width',p(this._zoomingXStart-i));break;case'y':this._zoomingSquare.setAttribute('y',g(this._zoomingYStart,r)),this._zoomingSquare.setAttribute('height',p(this._zoomingYStart-r));}this.options.onZoomMove&&!e&&this.options.onZoomMove(t,i,r,a,e)}onMouseUp(t,i,r,a,s){var o=this;this.removeZone();var n=i-t.options.paddingLeft,l=r-t.options.paddingTop;if((this.emit('beforeZoom',{graph:t,x:i,y:r,e:a,mute:s}),!t.prevent(!1))&&(0!=i-this._zoomingXStart||'y'==this._zoomingMode)&&(0!=r-this._zoomingYStart||'x'==this._zoomingMode))if(this.options.transition||this.options.smooth){let e=!1,t=!1;('x'==this._zoomingMode||'xy'==this._zoomingMode||'forceY2'==this._zoomingMode)&&(this.fullX=!1,this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=g(e.getVal(n),e.getVal(o.x1)),e._pluginZoomMaxFinal=d(e.getVal(n),e.getVal(o.x1))},!1,!0,!1),e=!0),('y'==this._zoomingMode||'xy'==this._zoomingMode)&&(this.fullY=!1,this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=g(e.getVal(l),e.getVal(o.y1)),e._pluginZoomMaxFinal=d(e.getVal(l),e.getVal(o.y1))},!1,!1,!0),t=!0),'forceY2'==this._zoomingMode&&(this.fullY=!1,this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=g(e.getVal(o.y2),e.getVal(o.y1)),e._pluginZoomMaxFinal=d(e.getVal(o.y2),e.getVal(o.y1))},!1,!1,!0),t=!0),this.transition(e,t,'zoomEnd')}else{switch(this._zoomingMode){case'x':this.fullX=!1,this.toAxes('_doZoom',[n,this.x1],!0,!1);break;case'y':this.fullY=!1,this.toAxes('_doZoom',[l,this.y1],!1,!0);break;case'xy':this.fullX=!1,this.fullY=!1,this.toAxes('_doZoom',[n,this.x1],!0,!1),this.toAxes('_doZoom',[l,this.y1],!1,!0);break;case'forceY2':this.fullX=!1,this.fullY=!1,this.toAxes('_doZoom',[n,this.x1],!0,!1),this.toAxes('_doZoom',[this.y1,this.y2],!1,!0);}t.draw(),this._backedUpZoomMode&&(this._zoomingMode=this._backedUpZoomMode),this.emit('zoomed'),t.pluginYieldActiveState()}}removeZone(){this._zoomingSquare.setAttribute('display','none')}onMouseWheel(t,i,e,r,a){a||(a={}),a.baseline||(a.baseline=0);let s=a.baseline;'mousePosition'==a.baseline&&(s=this.graph.getYAxis().getVal(r),console.log(s));var o='x'==a.direction,n='y'===a.direction;this.toAxes('handleMouseWheel',[t,i,s],o,n),this.graph.drawSeries()}onDblClick(t,i,r,a,s){var o=this.graph;if(this.emit('beforeDblClick',{graph:o,x:t,y:i,pref:a,e:r,mute:s}),!o.prevent(!1)){if(this.options.transition||this.options.smooth){var n=!1,l=!1;('xtotal'==a.mode||'total'==a.mode)&&(this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=e.getMinValue()-e.options.axisDataSpacing.min*e.getInterval(),e._pluginZoomMaxFinal=e.getMaxValue()+e.options.axisDataSpacing.max*e.getInterval()},!1,!0,!1),n=!0),('ytotal'==a.mode||'total'==a.mode)&&(this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=e.getMinValue()-e.options.axisDataSpacing.min*e.getInterval(),e._pluginZoomMaxFinal=e.getMaxValue()+e.options.axisDataSpacing.max*e.getInterval()},!1,!1,!0),l=!0);let e,t;return('gradualX'==a.mode||'gradualY'==a.mode||'gradual'==a.mode||'gradualXY'==a.mode)&&(e=!1,t=!1,('gradualX'==a.mode||'gradual'==a.mode||'gradualXY'==a.mode)&&(e=!0,n=!0),('gradualY'==a.mode||'gradual'==a.mode||'gradualXY'==a.mode)&&(t=!0,l=!0),this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=e.getCurrentMin()-(e.getCurrentMax()-e.getCurrentMin()),e._pluginZoomMaxFinal=e.getCurrentMax()+(e.getCurrentMax()-e.getCurrentMin())},!1,e,t)),void this.transition(n,l,'dblClick')}var p=this.graph.getXAxis(),u=this.graph.getYAxis();if('xtotal'==a.mode)this.toAxes('setMinMaxToFitSeries',null,!0,!1),this.fullX=!0,this.fullY=!1;else if('ytotal'==a.mode)this.toAxes('setMinMaxToFitSeries',null,!1,!0),this.fullX=!1,this.fullY=!0;else if('total'==a.mode)this.toAxes('setMinMaxToFitSeries',null,!0,!0),this.fullX=!0,this.fullY=!0;else{t-=this.graph.options.paddingLeft,i-=this.graph.options.paddingTop;var c=p.getCurrentMin(),h=p.getCurrentMax(),m=p.getVal(t),f=h-c,b=u.getCurrentMin(),A=u.getCurrentMax(),k=u.getVal(i),M=A-b;if('gradualXY'==a.mode||'gradualX'==a.mode){var S=(m-c)/(h-c);c=d(p.getMinValue()-p.getInterval()*p.options.axisDataSpacing.min,c-f*S),h=g(p.getMaxValue()+p.getInterval()*p.options.axisDataSpacing.max,h+f*(1-S)),p.setCurrentMin(c),p.setCurrentMax(h),p.options.onZoom&&p.options.onZoom(c,h),p.cacheCurrentMin(),p.cacheCurrentMax(),p.cacheInterval()}if('gradualXY'==a.mode||'gradualY'==a.mode){var S=(k-b)/(A-b);b=d(u.getMinValue()-u.getInterval()*u.options.axisDataSpacing.min,b-M*S),A=g(u.getMaxValue()+u.getInterval()*u.options.axisDataSpacing.max,A+M*(1-S)),u.setCurrentMin(b),u.setCurrentMax(A),u.options.onZoom&&u.options.onZoom(b,A),u.cacheCurrentMin(),u.cacheCurrentMax(),u.cacheInterval()}}o.pluginYieldActiveState(),this.graph.draw()}}transition(e,t,i){var r=this,a=500;r.gradualUnzoomStart||(r.gradualUnzoomStart=Date.now()),window.requestAnimationFrame(function(){var s=Date.now()-r.gradualUnzoomStart;s>a&&(s=a);var o=Math.sin(s/a*Math.PI/2);r.toAxes(function(e){e.setCurrentMin(e._pluginZoomMin+(e._pluginZoomMinFinal-e._pluginZoomMin)*o),e.setCurrentMax(e._pluginZoomMax+(e._pluginZoomMaxFinal-e._pluginZoomMax)*o),e.cacheCurrentMin(),e.cacheCurrentMax(),e.cacheInterval()},!1,e,t),r.graph.draw(),s{this.series.forEach(function(t){this.updateSerie(t,e)}),e||this.recalculateSeries(t)}}static default(){return{LRUName:'PluginTimeSerieManager',intervals:[1000,15000,60000,900000,3600000,8640000],maxParallelRequests:3,optimalPxPerPoint:2,nbPoints:1e3,url:''}}init(e){this.graph=e,d.default.create(this.options.LRUName,200),this.requestsRunning=0}setURL(e){return this.options.url=e,this}setAvailableIntervals(){this.options.intervals=arguments}newSerie(e,t,i,r,a){var o=this.graph.newSerie(e,t,i);return this.currentSlots[e]={min:0,max:0,interval:0},o.on('hide',function(){o._zoneSerie&&o._zoneSerie.hide()}),o.on('show',function(){o._zoneSerie&&o._zoneSerie.show()}),o.setInfo('timeSerieManagerDBElements',r),a||(o._zoneSerie=this.graph.newSerie(e+'_zone',{},l.default.SERIE_ZONE)),this.series.push(o),o}registerPlugin(e){var t;if(-1<(t=this.plugins.indexOf(e)))for(var r=1;rDate.now());)r.register(e,d,l,l==o?a[1]:a[2],!0,t),d++})}this.processRequests()}cleanRegister(e){this.requestLevels&&this.requestLevels.forEach((t)=>{t.forEach((i,r)=>{i[4]Date.now()&&n.timeout=this.options.maxParallelRequests)){for(var e=this,t=1,r;;){for(var a in this.requestLevels[t])if(1!=this.requestLevels[t][a][0]){r=this.requestLevels[t][a];break}if(r)break;if(t++,10',e[2]).replace('',this.computeTimeMin(e[3],e[4])).replace('',this.computeTimeMax(e[3],e[4])).replace('',e[4]),r=e[6]||{};for(var a in r)t=t.replace('<'+a+'>',r[a]);return t}getOptimalInterval(e){var t=(this.options.optimalPxPerPoint||1)*e/this.graph.getDrawingWidth(),i=Infinity,r;return this.options.intervals.forEach(function(e){var a=g(i,p(e-t));i!==a&&(r=e,i=a)}),r||1e3}computeUniqueID(e,t,r){var a='',s=e.getInfo('timeSerieManagerDBElements');for(var o in s)a+=';'+o+':'+s[o];return e.getName()+';'+t+';'+r+a}computeSlotID(e,t){return n(e/(t*this.options.nbPoints))}computeSlotTime(e,t){return e*(t*this.options.nbPoints)}getZoneSerie(e){return e._zoneSerie}updateZoneSerie(e){var t=this.graph.getSerie(e);t&&t._zoneSerie&&(t._zoneSerie.setXAxis(t.getXAxis()),t._zoneSerie.setYAxis(t.getYAxis()),t._zoneSerie.setFillColor(t.getLineColor()),t._zoneSerie.setLineColor(t.getLineColor()),t._zoneSerie.setFillOpacity(0.2),t._zoneSerie.setLineOpacity(0.3))}recalculateSeries(e){var t=this;this.locked||(this.changed=!1,this.series.map(function(i){t.recalculateSerie(i,e)}),this.changed=!1,t.graph.draw())}recalculateSerie(e,t){var i=e.getXAxis().getCurrentMin(),r=e.getXAxis().getCurrentMax(),a=this.getOptimalInterval(r-i),s=this.computeSlotID(i,a),o=this.computeSlotID(r,a),n=[],l=[];if(!(!t&&a==this.currentSlots[e.getName()].interval&&this.currentSlots[e.getName()].min<=s&&this.currentSlots[e.getName()].max>=o)){s-=2,o+=2,this.currentSlots[e.getName()].min=s,this.currentSlots[e.getName()].max=o,this.currentSlots[e.getName()].interval=a;for(var p=s;p<=o;){const t=d.default.get(this.options.LRUName,this.computeUniqueID(e,p,a));t?(n=n.concat(t.data.mean),l=l.concat(t.data.minmax)):this.recalculateSerieUpwards(e,p,a,n,l),p++}this.changed=!0,e.setData(n),e._zoneSerie&&e._zoneSerie.setData(l)}}setIntervalCheck(e){this.interval&&clearInterval(this.interval),this.update(!0,!0),this.interval=setInterval(()=>{this.update(!0,!1)},e)}recalculateSerieUpwards(e,t,r,a,s){var o=this.options.intervals.slice(0);o.sort();var n=o[o.indexOf(r)+1]||-1;if(0>n)return[];var p=this.computeSlotTime(t,r),g=this.computeSlotTime(t+1,r),u=this.computeSlotID(p,n),c=!1;const h=d.default.get(this.options.LRUName,this.computeUniqueID(e,u,n));if(h)for(var x=0,i=h.data.mean.length;x=g)return a=a.concat(h.data.mean.slice(c,x)),void(s=a.concat(h.data.minmax.slice(c,x)))}return this.recalculateSerieUpwards(e,u,n,a,s)}lockRedraw(){this.locked=!0}unlockRedraw(){this.locked=!1}isRedrawLocked(){return!!this.locked}}t.default=h,e.exports=t['default']})},function(e,t){var i,r,a;(function(s,o){r=[t],i=o,a='function'==typeof i?i.apply(t,r):i,!(void 0!==a&&(e.exports=a))})(this,function(e){'use strict';function t(e){n[e]={},d[e]=0}function i(e,t){t=t||50,n[e]||(n[e]={},d[e]=0),p[e]=t}function r(e,t){var i,r;if(n[e]&&n[e][t])return r=l[e],i=n[e][t],i.prev=r,i.next=r.next,r.next.prev=i,r.next=i,l[e]=i,i.data}function a(e,t,i){var a,s,o;if(n[e]&&void 0!==d[e]&&p[e])return o=l[e],n[e][t]?(r(e,t),n[e][t].data.data=i,n[e][t].data.timeout=Date.now()):(a={data:{data:i,timeout:Date.now()}},'undefined'==typeof o?(a.prev=a,a.next=a):(a.prev=o.prev,a.next=o.next,o.next.prev=a,o.next=a),l[e]=a,n[e][t]=a,d[e]++),d[e]>p[e]&&o&&(s=o.next,o.next.next.prev=o,o.next=o.next.next,s.next.next=void 0,s.next.prev=void 0,d[e]--),i}function s(e,t){var i;if((i=r(e,t))!=void 0)return i}function o(e,t,i){return a(e,t,i),i}Object.defineProperty(e,'__esModule',{value:!0}),e.create=function(e,t){i(e,t)},e.get=s,e.store=o,e.empty=function(e){t(e)},e.exist=function(e){return n[e]};var n={},l={},d={},p={};e.default=s})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(2)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{constructor(){super(...arguments)}static default(){return{positiveStyle:{fillColor:'green',fillOpacity:0.2,strokeWidth:0},negativeStyle:{fillColor:'red',fillOpacity:0.2,strokeWidth:0},from:0,to:0}}init(e){this.graph=e,this.pathsPositive=[],this.pathsNegative=[],this.positivePolyline=this.graph.newShape('polyline').draw(),this.positivePolyline.setFillColor(this.options.positiveStyle.fillColor).setFillOpacity(this.options.positiveStyle.fillOpacity).setStrokeWidth(this.options.positiveStyle.strokeWidth).applyStyle(),this.negativePolyline=this.graph.newShape('polyline').draw(),this.negativePolyline.setFillColor(this.options.negativeStyle.fillColor).setFillOpacity(this.options.negativeStyle.fillOpacity).setStrokeWidth(this.options.negativeStyle.strokeWidth).applyStyle()}setSeries(e,t){this.serie1=e,this.serie2=t}setBoundaries(e,t){this.options.from=e,this.options.to=t}getFrom(){return this.options.from}getTo(){return this.options.to}draw(){function e(){!0===y?r.pathsPositive.push([a,s]):!1===y&&r.pathsNegative.push([a,s]),a=[],s=[],y=void 0}function t(e,t){for(var a=0;athis.getTo()){g=this.interpolate(this.serie1,this.getTo()),c=this.interpolate(this.serie2,this.getTo()),h=this.computeCrossing(a[a.length-2],a[a.length-1],this.getTo(),g,s[s.length-2],s[s.length-1],this.getTo(),c),h&&(a.push(h.x),a.push(h.y),s.push(h.x),s.push(h.y),e(),a.push(h.x),a.push(h.y),s.push(h.x),s.push(h.y),y=this.serie1.data[o][n+1]>this.serie2.data[l][p+1]),a.push(this.getTo()),a.push(g),s.push(this.getTo()),s.push(c),f=!0;break}if(!m)if(m=this.serie2.searchClosestValue(this.serie1.data[o][n]),m)l=m.dataIndex,p=2*m.xBeforeIndex,g=this.interpolate(this.serie2,this.serie1.data[o][n]),a.push(this.serie1.data[o][n]),a.push(this.serie1.data[o][n+1]),s.push(this.serie1.data[o][n]),s.push(g),y=this.serie1.data[o][n+1]>g;else continue;for(x=!1,h=this.computeCrossing(a[a.length-2],a[a.length-1],this.serie1.data[o][n],this.serie1.data[o][n+1],s[s.length-2],s[s.length-1],this.serie2.data[l][p],this.serie2.data[l][p+1]),h&&(a.push(h.x),a.push(h.y),s.push(h.x),s.push(h.y),e(),a.push(h.x),a.push(h.y),s.push(h.x),s.push(h.y),y=this.serie1.data[o][n+1]>this.serie2.data[l][p+1]);this.serie2.data[l][p]this.serie2.data[l][p+1])}!1===x?(a.push(this.serie1.data[o][n]),a.push(this.serie1.data[o][n+1])):(a.push(x),a.push(this.interpolate(this.serie1,x)),m=!1,n-=2,e())}if(f){e();break}g=this.interpolate(this.serie2,a[a.length-2]),g&&(s.push(a[a.length-2]),s.push(g)),e(),n=0,m=!1}var b=this.pathsPositive.reduce(t,'');this.positivePolyline.setPointsPx(b).redraw();var b=this.pathsNegative.reduce(t,'');this.negativePolyline.setPointsPx(b).redraw()}interpolate(e,t){var i=e.searchClosestValue(t);if(!i)return!1;if(void 0==i.xMax)return i.yMin;if(void 0==i.xMin)return i.yMax;var r=(t-i.xMin)/(i.xMax-i.xMin);return(1-r)*i.yMin+r*i.yMax}computeCrossing(e,t,i,r,a,s,o,n){var l=(r-t)/(i-e),d=(n-s)/(o-a),p=r-l*i;if(e==i||a==o)return!1;if(l==d)return{x:e,y1:t,y2:t};var g=(p-(n-d*o))/(d-l);return g>i||go?!1:{x:g,y:l*g+p}}getPositivePolyline(){return this.positivePolyline}getNegativePolyline(){return this.negativePolyline}}t.default=a,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(3),i(11),i(14),i(0),i(5),i(16),i(2),i(9)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r,a,s,o,l,p,g){'use strict';function u(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,'__esModule',{value:!0});var c=u(i),h=u(r),x=u(a),m=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(s),y=u(o),f=u(l),b=u(p),A=u(g);class k extends y.default{constructor(){super(...arguments),this.subSeries=[]}setData(){return super.setData(...arguments),this.subSeries.map((e)=>{e.data=this.data}),this}draw(){return this.eraseMarkers(),this}getSymbolForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getSymbolForLegend()}getMarkerForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getMarkerForLegend()}}class M extends f.default{constructor(){super(...arguments),this.subSeries=[]}setData(){return super.setData(...arguments),this.subSeries.map((e)=>{e.data=this.data}),this}draw(){return this}getSymbolForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getSymbolForLegend()}getMarkerForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getMarkerForLegend()}}var S=['constructor','init','draw','setLineColor','setLineWidth','setLineStyle','getLineColor','getLineWidth','getLineStyle','setMarkers','showMarkers','hideMarkers','getMarkerDom','getMarkerDomIndependant','getMarkerPath','eraseMarkers','_recalculateMarkerPoints'];Object.getOwnPropertyNames(y.default.prototype).concat([]).map(function(e){-1{i[e](...t)})}}(e))});class _ extends b.default{constructor(){super(...arguments),this.series=new Map}static defaults(){return{axes:{margins:{high:5,low:5}}}}init(e){this.graph=e}newXAxis(e){return this.newBottomAxis(e)}newYAxis(e){return this.newLeftAxis(e)}newTopAxis(e){return e=this.getOptions(e),new P(this.graph,'top',e)}newBottomAxis(e){return e=this.getOptions(e),new P(this.graph,'bottom',e)}newLeftAxis(e){return e=this.getOptions(e),new w(this.graph,'left',e)}newRightAxis(e){return e=this.getOptions(e),new w(this.graph,'right',e)}getOptions(e){var t={marginMin:this.options.axes.margins.low,marginMax:this.options.axes.margins.high};return m.extend(!0,t,e)}preDraw(){var e,t;this.series.forEach(({serie:i})=>{e=i.getXAxis(),t=i.getYAxis();let r=1;for(e.splitNumber&&(r*=e.splitNumber),t.splitNumber&&(r*=t.splitNumber);i.subSeries.lengthr;){let e=this.graph.getSerie(i.getName()+'_'+(i.subSeries.length-1));e&&e.kill&&e.kill(),i.subSeries.pop()}!i.getXAxis().splitNumber&&i.getXAxis().splitAxis&&i.getXAxis().splitAxis(),!i.getYAxis().splitNumber&&i.getYAxis().splitAxis&&i.getYAxis().splitAxis(),i.subSeries.map((t,r)=>{var a,s;if(i.getXAxis().getSubAxis){let t=r%(e.splitNumber||1);a=i.getXAxis().getSubAxis(t)}else a=i.getXAxis();if(t.setXAxis(a),i.getYAxis().getSubAxis){let t=n(r/(e.splitNumber||1));s=i.getYAxis().getSubAxis(t)}else s=i.getYAxis();t.setYAxis(s),t.draw(!0)})})}newSerie(e,t={},i){switch(i){case'line':return this.newLineSerie(e,t);break;case'scatter':return this.newScatterSerie(e,t);}throw'Cannot create a split serie of type '+i}newLineSerie(e,t){var i={type:'lineSerie',serie:new k(e,t,'line')};return this.series.set(e,i),i.serie.init(this.graph,e,t),this.graph.series.push(i.serie),i.serie}newScatterSerie(e,t){var i={type:'scatterSerie',serie:new M(e,t,'scatter')};return this.series.set(e,i),i.serie.init(this.graph,t),this.graph.series.push(i.serie),i.serie}}var v={splitMarks:!0},C=function(e){var t=class extends e{constructor(e,t,i={}){super(e,t,i),this.axes=[],this.position=t,this.constructorOptions=m.extend(!0,{},v,i),this._splitVal=[]}all(e){if('function'==typeof e)return this.axes.map(e),this}splitAxis(...e){e.push(1);let t=e.length;for(;this.axes.length>t;)this.axes.pop().kill(!0,!0);for(;this.axes.lengththis._splitVal.length)&&(super.setMinMaxToFitSeries(...arguments),this._splitVal[0]=this._splitVal[0]||[],this._splitVal[this._splitVal.length-1]=this._splitVal[this._splitVal.length-1]||[],this._splitVal[0][0]=this.getCurrentMin(),this._splitVal[this._splitVal.length-1][1]=this.getCurrentMax(),this.setChunkBoundaries(this._splitVal))}draw(){this.autoSpread&&this._splitSpread();let e=0,t,i,r;if(0<=this._baseWidthIndex&&(i=this.getSubAxis(this._baseWidthIndex))&&(r=i.getSpan()),i=void 0,0<=this.fixGridFor&&(i=this.getSubAxis(this.fixGridFor))){if(void 0!==i._mean){let e=(i.getSpan()[1]-i.getSpan()[0])/(r[1]-r[0])*this._baseWidthVal;i.forceMin(i._mean-e/2),i.forceMax(i._mean+e/2)}e=i.draw(),t=i.getPrimaryTickUnit()}return this.axes.map((a)=>{if(i!==a){if(void 0!==a._mean){let e=(a.getSpan()[1]-a.getSpan()[0])/(r[1]-r[0])*this._baseWidthVal;a.forceMin(a._mean-e/2),a.forceMax(a._mean+e/2)}t&&a.forcePrimaryTickUnit(t),e=d(e,a.draw())}}),this.writeUnit(),e}setMinPx(e){super.setMinPx(e);for(let t of this.axes)t.setMinPx(e)}setMaxPx(e){super.setMaxPx(e);for(let t of this.axes)t.setMaxPx(e)}setShift(){super.setShift(...arguments);for(let e of this.axes)e.setShift(...arguments)}init(){super.init(...arguments),this.splitAxis()}getAxisPosition(){var e=0;return this.axes.map((t)=>{e=d(e,t.getAxisPosition())}),e}getSubAxis(e){if(this.axes.length<=e)throw'Impossible to reach axis. Index '+e+' is out of range';return this.axes[e]}get splitNumber(){return this._splits.length}};return['turnGridsOff','turnGridsOn','gridsOff','gridsOn','setEngineering','setScientificScaleExponent','setScientific','setLabelColor','setSecondaryGridDasharray','setPrimaryGridDasharray','setSecondaryGridsOpacity','setPrimaryGridOpacity','setSecondaryGridWidth','setPrimaryGridWidth','setSecondaryGridColor','setPrimaryGridColor','setTicksLabelColor','setSecondaryTicksColor','setPrimaryTicksColor','setAxisColor','secondaryGridOn','secondaryGridOff','primaryGridOff','primaryGridOn','setSecondaryGrid','setPrimaryGrid','setGrids','setTickPosition','setExponentialFactor','setExponentialLabelFactor','setGridLinesStyle','forcePrimaryTickUnitMin','forcePrimaryTickUnitMax','forcePrimaryTickUnit','flip','show','hide','setDisplay'].map((e)=>{t.prototype[e]=function(e){return function(){return this.axes.map((t)=>{t[e](...arguments)}),this}}(e)}),t};class P extends C(h.default){constructor(e,t){super(...arguments),this.topbottom=t}getConstructor(){return h.default}getAxisPosition(){var e=super.getAxisPosition(...arguments);return this.labelPosY=e,this.getLabel()&&(e+=this.graph.options.fontSize),e}drawLabel(){super.drawLabel(),this.label.setAttribute('y',(this.top?-1:1)*(this.graph.options.fontSize+this.labelPosY))}draw(){var e=super.draw(...arguments);return this.drawLabel(),e}}class w extends C(x.default){constructor(){super(...arguments)}getConstructor(){return x.default}drawLabel(){super.drawLabel()}equalizePosition(e){var t=e;if(this.getLabel()&&this.axes.map((i)=>{t=d(i.equalizePosition(e),t)}),this.getLabel())return this.placeLabel(this.left?-t:t),t+this.graph.options.fontSize}}m.mix(P,new h.default),m.mix(w,new x.default),t.default=_,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(0),i(2)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(i),s=function(e){return e&&e.__esModule?e:{default:e}}(r);class o extends s.default{constructor(){super(...arguments)}init(e,t){super.init(e,t)}static default(){return{}}checkHSL(e){let t={},i,r,a;return(i=e.h||e.hue)?(1>i&&(i=u(360*i)),t.hue=i):t.h=0,(r=e.s||e.saturation)?(1{if(!t.setLineColor)throw'The serie '+t.getName()+' does not implement the method `startingColor`';const a=this.buildHSLString({h:e.startingColorHSL.h+r/(i-1)*(e.endingColorHSL.h-e.startingColorHSL.h),s:e.startingColorHSL.s+r/(i-1)*(e.endingColorHSL.s-e.startingColorHSL.s),l:e.startingColorHSL.l+r/(i-1)*(e.endingColorHSL.l-e.startingColorHSL.l)});return t.setLineColor(a),a})}}t.default=o,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(o,n){a=[e,t,i(0),i(2)],r=n,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(i),s=function(e){return e&&e.__esModule?e:{default:e}}(r);class o extends s.default{constructor(){super(...arguments)}static default(){return{autoPeakPicking:!1,autoPeakPickingNb:4,autoPeakPickingMinDistance:10,autoPeakPickingFormat:!1,autoPeakPickingAllowAllY:!1}}init(e,t){super.init(e,t),this.picks=[];for(var i=0,r=this.options.autoPeakPickingNb,a;i{e.kill()})}preDraw(){this.serie&&(this.detectedPeaks=[],this.lastYPeakPicking=!1)}postDraw(){if(!this.serie)return;let e=!0,t=!1,r=[],a=this.serie.getWaveform(),s;if(!a)throw'The serie must have a waveform for the peak picking to work';let o=a.getLength(),n=0,i;for(;n=s[1]&&e||i<=s[1]&&t?s=[a.getX(n),i]:(is[1]&&t)&&(t?(t=!1,e=!0):(t=!0,e=!1,r.push(s),s=!1),s=[a.getX(n),i])}var d=r,g=[],c=d.length,l,h,h,y,f,m;n=0;var b=this.graph.selectedShapes.map(function(e){return e.getProp('xval')});for(d.sort(function(e,t){return t[1]-e[1]}),f=0;nthis.serie.getXAxis().getMaxPx()))&&!(!this.options.autoPeakPickingAllowAllY&&(i>this.serie.getYAxis().getMinPx()||ithis.serie.getYAxis().getPx(d[n][1])-20?(this.picks[f].setLabelPosition({x:l,y:'5px'}),this.picks[f].setLabelBaseline('hanging')):(this.picks[f].setLabelBaseline('no-change'),this.picks[f].setLabelPosition({x:l,y:d[n][1],dy:'-15px'})),this.picks[f].setProp('xval',l),this.options.autoPeakPickingFormat?this.picks[f].setLabelText(this.options.autoPeakPickingFormat.call(this.picks[f],l,f)):this.picks[f].setLabelText(u(1e3*l)/1e3+''),this.picks[f].makeLabels(),f++;this.picks[f]&&this.picks[f].isSelected();)f++;if(g.length==this.options.autoPeakPickingNb)break}}}hidePeakPicking(e){if(this._hidePeakPickingLocked||(this._hidePeakPickingLocked=e),!!this.graph.picks)for(var t=0;tr&&(r+=1),1a?a*(1+i):a+i-a*i,l=2*a-o;s=t(l,o,e+1/3),r=t(l,o,e),n=t(l,o,e-1/3)}return[u(255*s),u(255*r),u(255*n)]},e.saveDomAttributes=function(e,t,a){if(e)for(var s in e._savedAttributesIds=e._savedAttributesIds||[],-1{this.group.removeChild(e)}),this._labelsBackground.map((e)=>{this.group.removeChild(e)}),this._labels=[],this._labelsBackground[e]=[];for(var e=0;void 0!==this.getProp('labelText',e);)this._labels[e]||(this._labels[e]=document.createElementNS(this.graph.ns,'text'),this._labels[e].setAttribute('data-label-i',e),this._labels[e].jsGraphIsShape=this,this._labelsBackground[e]=document.createElementNS(this.graph.ns,'rect'),this._labelsBackground[e].setAttribute('data-label-i',e),this._labelsBackground[e].jsGraphIsShape=this,this.group.appendChild(this._labelsBackground[e]),this.group.appendChild(this._labels[e]),this._labels[e].addEventListener('dblclick',(t)=>{t.stopPropagation(),this.labelDblClickListener(t)}),this._labelsBackground[e].addEventListener('dblclick',(t)=>{t.stopPropagation(),this.labelDblClickListener(t)})),e++;return this.updateLabels(),this}isLabelEditable(e){return this.getProp('labelEditable',e||0)}updateLabels(){this;this._labels=this._labels||[];for(var e=0,t=this._labels.length;e{var s=this,e=document.createElementNS(s.graph.ns,t);if(e.jsGraphIsShape=!0,r)for(var n in r)e.setAttribute(n,r[n]);e.addEventListener('mousedown',(t)=>{s.isResizable()&&(t.preventDefault(),t.stopPropagation(),s.graph.emit('beforeShapeResize',s),this.emit('beforeShapeResize'),!s.graph.prevent(!1)&&(s.resizing=!0,s.handleSelected=i,s.handleMouseDown(t)))}),a&&a(s.handles[i]),s.handles[i]=e}).call(this,n);return this.handles}}createHandles(){this.hasStaticHandles()&&(this.addHandles(),this.setHandles())}handleMouseDownImpl(){}handleMouseMoveImpl(){}handleMouseUpImpl(){}handleCreateImpl(){}handleMouseDown(t){if(!this.isLocked())return(this.isMovable()||this.isResizable())&&this.graph.elementMoving(this),this.getProp('selectOnMouseDown')&&this.graph.selectShape(this),this.isMovable()&&!this.resizing&&(this.graph.emit('beforeShapeMove',self),!this.graph.prevent(!1)&&(this.moving=!0,this.moved=!1)),this._mouseCoords=this.graph._getXY(t),this.handleMouseDownImpl(t,this._mouseCoords)}handleClick(t){return this.graph.emit('shapeClicked',this),this.emit('shapeClicked'),!!this.isSelectable()&&void(!t.shiftKey&&this.graph.unselectShapes(),this.getProp('selectOnClick')&&this.graph.selectShape(this))}handleMouseMove(t){if((this.resizing||this.moving)&&!this.isSelected()&&this.graph.selectShape(this),this.graph.emit('beforeShapeMouseMove',this),this.emit('beforeShapeMouseMove'),this.graph.prevent(!1)||!this._mouseCoords)return!1;this.moved=!0;var e=this.graph._getXY(t),i=this.getXAxis().getRelVal(e.x-this._mouseCoords.x),r=this.getYAxis().getRelVal(e.y-this._mouseCoords.y);(0!=i||0!==r)&&(this.preventUnselect=!0),this._mouseCoords=e;var a=this.handleMouseMoveImpl(t,i,r,e.x-this._mouseCoords.x,e.y-this._mouseCoords.y);return a}handleMouseUp(t){return this.moving&&this.moved&&(this.graph.emit('shapeMoved',this),this.emit('shapeMoved')),(this.handleSelected||this.resize)&&(this.graph.emit('shapeResized',this),this.emit('shapeResized')),this.moving=!1,this.resizing=!1,this.handleSelected=!1,this.graph.elementMoving(!1),this.handleMouseUpImpl(t)}handleDblClick(){}handleMouseOver(){!this.getProp('highlightOnMouseOver')||this.moving||this.resizing||this.highlight(),this.graph.emit('shapeMouseOver',this)}handleMouseOut(){this.getProp('highlightOnMouseOver')&&this.unHighlight(),this.graph.emit('shapeMouseOut',this)}lock(){return this.setProp('locked',!0),this}unlock(){return this.setProp('locked',!1),this}isLocked(){return this.getProp('locked')||this.graph.shapesLocked}movable(){this.setProp('movable',!0)}unmovable(){return this.setProp('movable',!1),!1}isMovable(){return this.getProp('movable')}resizable(){this.setProp('resizable',!0)}unresizable(){this.setProp('resizable',!1)}isResizable(){return this.getProp('resizable')}selectable(){this.setProp('selectable',!0)}unselectable(){this.graph.unselectShape(this),this.setProp('selectable',!1)}isSelectable(){return this.getProp('selectable')}highlight(e,t){return e||(e=this.getHighlightAttributes()),t||(t='highlight'),o.saveDomAttributes(this._dom,e,t),this.highlightImpl(),this}unHighlight(e){return e||(e='highlight'),o.restoreDomAttributes(this._dom,e),this.unHighlightImpl(),this}highlightImpl(){}unHighlightImpl(){}getHighlightAttributes(){return this._highlightAttributes}setHighlightAttributes(e){return this._highlightAttributes=e,this}getMaskingID(){return this.maskingId}maskWith(e){const t=e.getMaskingID();t?this._dom.setAttribute('mask','url(#'+t+')'):this._dom.removeAttribute('mask')}updateMask(){}labelDblClickListener(t){var e=parseInt(t.target.getAttribute('data-label-i')),i=this;if(isNaN(e))return;if(!this.isLabelEditable(e))return;t.preventDefault(),t.stopPropagation();var r=document.createElement('input');r.setAttribute('type','text'),r.setAttribute('value',i.getProp('labelText',e)),i.graph.wrapper.prepend(r),r.select(),o.setCSS(r,{position:'absolute',marginTop:parseInt(t.target.getAttribute('y').replace('px',''))+this.graph.getPaddingTop()-10+'px',marginLeft:parseInt(t.target.getAttribute('x').replace('px',''))+this.graph.getPaddingLeft()-50+'px',textAlign:'center',width:'100px'});const a=i.getLabelText(e),s=function(){i.setLabelText(r.value,e),i._labels[e].textContent=r.value;const t=r.value;r.remove(),r.removeEventListener('blur',s),r=!1,i.changed('shapeLabelChanged',{previousValue:a,nextValue:t})};r.addEventListener('blur',s),r.addEventListener('keyup',function(t){13===t.keyCode&&s()}),r.addEventListener('keypress',function(t){t.stopPropagation()}),r.addEventListener('keydown',function(t){t.stopPropagation()}),r.focus()}appendToDom(){return this._forcedParentDom?this._forcedParentDom.appendChild(this.group):this.graph.appendShapeToDom(this),this}forceParentDom(e){return this._forcedParentDom=e,this}isHTML(){return!1}}d.prototype.computePosition=d.prototype.calculatePosition,d.prototype.showLabel=d.prototype.displayLabel,d.prototype.remove=d.prototype.kill,t.default=d,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(7)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{static default(){return{}}constructor(e){super(...arguments),this.options=Object.assign({},a.default(),this.constructor.default(),e)}init(e){this.graph=e}onMouseDown(){}onMouseUp(){}onMouseMove(){}}t.default=a,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(6),i(0),i(7),i(4)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r,a,s){'use strict';function n(e){return e&&e.__esModule?e:{default:e}}function l(e,t,i,r){var a=e.getConstructor(r,!0);if(a||'string'!=typeof r||(a=e.getConstructor('graph.serie.'+r,!0)),a){var s=new a(e,t,i);e.appendSerieToDom(s)}else return E.throwError('No constructor exists for the serie type provided. Use Graph.registerConstructor( name, constructor ) first is you use your own series');return s}function d(e,t){for(var r=0,i=t.length,a;rt[r][s][1]&&e[1]>t[r][s][1]||(a=!1);if(a)return t[r].push(e),r}return t.push([e]),t.length-1}function p(e){var t={top:[],bottom:[],left:[],right:[]},i={top:[],bottom:[],left:[],right:[]};e._painted=!0,e._applyToAxes(function(e,r){if(!e.isShown())return void e.hideGroup();if(e.showGroup(),!e.floating){var a=d(e.getSpan(),i[r]);e.setLevel(a),t[r][a]=o(e.getAxisPosition(),t[r][a]||0)}},!1,!0,!1);var r=t.top.reduce(function(e,t){return e+t},0),a=t.bottom.reduce(function(e,t){return e+t},0);e.drawingSpaceHeight=e.getDrawingHeight()-r-a,[t.top,t.bottom].map(function(e){e.reduce(function(t,i,r){return e[r]=t+i,t+i},0)}),e._applyToAxes(function(e,i){!e.isShown()||e.floating||e.setShift(t[i][e.getLevel()])},!1,!0,!1),e._applyToAxes(function(s,n){if(s.isShown()?s.showGroup():s.hideGroup(),s.setMinPx(r),s.setMaxPx(e.getDrawingHeight(!0)-a),!s.floating){let e=s.linkedToAxis?0:s.draw();if(s.isShown()){var l=d(s.getSpan(),i[n]);s.setLevel(l),t[n][l]=o(e,t[n][l]||0)}}},!1,!1,!0);var s=E.extend(!0,{},t);e._applyToAxes(function(e,i){!e.isShown()||e.floating||(s[i][e.getLevel()]=o(t[i][e.getLevel()],e.equalizePosition(t[i][e.getLevel()])))},!1,!1,!0),t=s;var n=t.left.reduce(function(e,t){return e+t},0),l=t.right.reduce(function(e,t){return e+t},0);e.drawingSpaceWidth=e.getDrawingWidth()-n-l,[t.left,t.right].map(function(e){e.reduce(function(t,i,r){return e[r]=t+i,t+i},0)}),e._applyToAxes((e,i)=>{!e.isShown()||e.floating||e.setShift(t[i][e.getLevel()])},!1,!1,!0),e._applyToAxes(function(t){!t.isShown(),t.setMinPx(n),t.setMaxPx(e.getDrawingWidth(!0)-l);t.floating||!t.linkedToAxis&&t.draw()},!1,!0,!1),e._applyToAxes(function(e){if(e.floating){var t=e.getFloatingAxis(),i=e.getFloatingValue(),r=t.getPx(i);e.setShift(r),e.linkedToAxis||e.draw()}},!1,!0,!0),_(e,'right',e.getDrawingWidth(!0),e.getDrawingWidth(!0),r,e.getDrawingHeight(!0)-a),_(e,'left',0,0,r,e.getDrawingHeight(!0)-a),_(e,'top',n,e.getDrawingWidth(!0)-l,0,0),_(e,'bottom',n,e.getDrawingWidth(!0)-l,e.getDrawingHeight(!0)-a,e.getDrawingHeight(!0)-a),e.clipRect.setAttribute('y',r),e.clipRect.setAttribute('x',n),e.clipRect.setAttribute('width',e.getDrawingWidth()-n-l),e.clipRect.setAttribute('height',e.getDrawingHeight()-r-a),e.rectEvent.setAttribute('y',r+e.getPaddingTop()),e.rectEvent.setAttribute('x',n+e.getPaddingLeft()),e.rectEvent.setAttribute('width',e.drawingSpaceWidth),e.rectEvent.setAttribute('height',e.drawingSpaceHeight),e.drawingSpaceMinX=n+e.getPaddingLeft(),e.drawingSpaceMinY=r+e.getPaddingTop(),e.drawingSpaceMaxX=e.getDrawingWidth()-l+e.getPaddingLeft(),e.drawingSpaceMaxY=e.getDrawingHeight()-a+e.getPaddingTop(),e._applyToAxes(function(e){e.isShown()&&e.drawLines()},!1,!0,!0),e.shift=t,e.redrawShapes()}function u(e,t,i){return console.log(t,i),e.forcedPlugin?(e.activePlugin=e.forcedPlugin,void e._pluginExecute(e.activePlugin,i,[e,t])):void c(e,t,[e,t],i)}function c(t,r,e,a){var s=t.options.keyActions,n,i;for(n=0,i=s.length;n{e.kill(s[n].keepInDom)}))}return!1}function h(){this.dom=document.createElementNS(N.ns,'svg'),this.dom.setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:xlink','http://www.w3.org/1999/xlink'),E.setAttributeTo(this.dom,{xmlns:N.ns,"font-family":this.options.fontFamily,"font-size":this.options.fontSize});try{E.setAttributeTo(this.dom,{"data-jsgraph-version":'v2.0.72'})}catch(t){}this.defs=document.createElementNS(N.ns,'defs'),this.dom.appendChild(this.defs),this.groupEvent=document.createElementNS(N.ns,'g'),this.rectEvent=document.createElementNS(N.ns,'rect'),E.setAttributeTo(this.rectEvent,{"pointer-events":'fill',fill:'transparent'}),this.groupEvent.appendChild(this.rectEvent),this.dom.appendChild(this.groupEvent),this.domTitle=document.createElementNS(N.ns,'text'),this.setTitle(this.options.title),E.setAttributeTo(this.domTitle,{"text-anchor":'middle',y:20}),this.groupEvent.appendChild(this.domTitle),this.graphingZone=document.createElementNS(N.ns,'g'),this.updateGraphingZone(),this.groupEvent.appendChild(this.graphingZone),this.axisGroup=document.createElementNS(N.ns,'g'),this.graphingZone.appendChild(this.axisGroup),this.groupGrids=document.createElementNS(N.ns,'g'),this.groupPrimaryGrids=document.createElementNS(N.ns,'g'),this.groupSecondaryGrids=document.createElementNS(N.ns,'g'),this.axisGroup.appendChild(this.groupGrids),this.groupGrids.appendChild(this.groupSecondaryGrids),this.groupGrids.appendChild(this.groupPrimaryGrids),this.plotGroup=document.createElementNS(N.ns,'g'),this.graphingZone.appendChild(this.plotGroup),this.layers=[],this._makeClosingLines(),this.clip=document.createElementNS(N.ns,'clipPath'),this.clip.setAttribute('id','_clipplot'+this._creation),this.defs.appendChild(this.clip),this.clipRect=document.createElementNS(N.ns,'rect'),this.clip.appendChild(this.clipRect),this.clip.setAttribute('clipPathUnits','userSpaceOnUse'),this.markerArrow=document.createElementNS(this.ns,'marker'),this.markerArrow.setAttribute('viewBox','0 0 10 10'),this.markerArrow.setAttribute('id','arrow'+this._creation),this.markerArrow.setAttribute('refX','6'),this.markerArrow.setAttribute('refY','5'),this.markerArrow.setAttribute('markerUnits','strokeWidth'),this.markerArrow.setAttribute('markerWidth','8'),this.markerArrow.setAttribute('markerHeight','6'),this.markerArrow.setAttribute('orient','auto');var e=document.createElementNS(N.ns,'path');e.setAttribute('d','M 0 0 L 10 5 L 0 10 z'),this.markerArrow.appendChild(e),this.defs.appendChild(this.markerArrow),this.markerHorizontalSplit=document.createElementNS(N.ns,'marker'),this.markerHorizontalSplit.setAttribute('viewBox','0 0 6 8'),this.markerHorizontalSplit.setAttribute('id','horionzalsplit_'+this.getId()),this.markerHorizontalSplit.setAttribute('refX','3'),this.markerHorizontalSplit.setAttribute('refY','4'),this.markerHorizontalSplit.setAttribute('markerUnits','strokeWidth'),this.markerHorizontalSplit.setAttribute('markerWidth','6'),this.markerHorizontalSplit.setAttribute('markerHeight','8');var t=document.createElementNS(N.ns,'line');t.setAttribute('x1','0'),t.setAttribute('y1','8'),t.setAttribute('x2','6'),t.setAttribute('y2','0'),t.setAttribute('stroke','black'),this.markerHorizontalSplit.appendChild(t),this.defs.appendChild(this.markerHorizontalSplit),this.markerVerticalSplit=document.createElementNS(N.ns,'marker'),this.markerVerticalSplit.setAttribute('viewBox','0 0 8 6'),this.markerVerticalSplit.setAttribute('id','verticalsplit_'+this.getId()),this.markerVerticalSplit.setAttribute('refX','4'),this.markerVerticalSplit.setAttribute('refY','3'),this.markerVerticalSplit.setAttribute('markerUnits','strokeWidth'),this.markerVerticalSplit.setAttribute('markerWidth','8'),this.markerVerticalSplit.setAttribute('markerHeight','6');var t=document.createElementNS(N.ns,'line');t.setAttribute('x1','0'),t.setAttribute('y1','0'),t.setAttribute('x2','8'),t.setAttribute('y2','6'),t.setAttribute('stroke','black'),this.markerVerticalSplit.appendChild(t),this.defs.appendChild(this.markerVerticalSplit),this.vertLineArrow=document.createElementNS(N.ns,'marker'),this.vertLineArrow.setAttribute('viewBox','0 0 10 10'),this.vertLineArrow.setAttribute('id','verticalline'+this._creation),this.vertLineArrow.setAttribute('refX','0'),this.vertLineArrow.setAttribute('refY','5'),this.vertLineArrow.setAttribute('markerUnits','strokeWidth'),this.vertLineArrow.setAttribute('markerWidth','20'),this.vertLineArrow.setAttribute('markerHeight','10'),this.vertLineArrow.setAttribute('orient','auto'),this.vertLineArrow.setAttribute('stroke-width','1px');var i=document.createElementNS(N.ns,'path');i.setAttribute('d','M 0 -10 L 0 10'),i.setAttribute('stroke','black'),this.vertLineArrow.appendChild(i),this.defs.appendChild(this.vertLineArrow),this.bypassHandleMouse=!1}function x(t){if(!t.wrapper)throw'No wrapper exists. Cannot register the events.';t.dom.setAttribute('tabindex',0),t.dom.addEventListener('keydown',(i)=>{u(t,i,'keydown')}),t.dom.addEventListener('keypress',(i)=>{u(t,i,'keypress')}),t.dom.addEventListener('keyup',(i)=>{u(t,i,'keyup')}),t.dom.addEventListener('mousemove',(i)=>{var e=t._getXY(i);y(t,e.x,e.y,i)}),t.dom.addEventListener('mouseleave',()=>{C(t)}),t.groupEvent.addEventListener('mousedown',(i)=>{if(t.focus(),!(3==i.which||i.ctrlKey)){var e=t._getXY(i);m(t,e.x,e.y,i)}}),t.dom.addEventListener('mouseup',(i)=>{t.emit('mouseUp',i);var e=t._getXY(i);k(t,e.x,e.y,i)}),t.wrapper.addEventListener('mouseup',(t)=>{t.stopPropagation()}),t.dom.addEventListener('dblclick',(i)=>{t.emit('dblClick',i);var e=t._getXY(i);A(t,e.x,e.y,i)}),t.groupEvent.addEventListener('click',(i)=>{if(!(3==i.which||i.ctrlKey)){var e=t._getXY(i);t.prevent(!1)||M(t,e.x,e.y,i)}}),t.groupEvent.addEventListener('mousewheel',(i)=>{var e=i.wheelDeltaY||i.wheelDelta||-i.deltaY,r=t._getXY(i);return v(t,e,r.x,r.y,i),!1}),t.groupEvent.addEventListener('wheel',(i)=>{var e=t._getXY(i),r=i.wheelDeltaY||i.wheelDelta||-i.deltaY;return v(t,r,e.x,e.y,i),!1})}function m(t,i,r,a){return t.forcedPlugin?(t.activePlugin=t.forcedPlugin,void t._pluginExecute(t.activePlugin,'onMouseDown',[t,i,r,a])):void(t.activePlugin&&(t.activePlugin=!1),f(t,a,[t,i,r,a],'onMouseDown'))}function y(t,r,a,s){if(t.bypassHandleMouse)return void t.bypassHandleMouse.handleMouseMove(s);if(!(t.activePlugin&&t._pluginExecute(t.activePlugin,'onMouseMove',[t,r,a,s]))){if(t._applyToAxes('handleMouseMove',[r-t.options.paddingLeft,s],!0,!1),t._applyToAxes('handleMouseMove',[a-t.options.paddingTop,s],!1,!0),!t.activePlugin){var e;if(t.options.trackingLine&&t.options.trackingLine.enable&&t.options.trackingLine.snapToSerie&&'common'==t.options.trackingLine.mode){var n=t.options.trackingLine.snapToSerie;if(e=n.handleMouseMove(!1,!0),this.trackingObject)if(!e)t.trackingObject.hide();else{t.trackingObject.show(),t.trackingObject.getPosition(0).x=e.xClosest,t.trackingObject.getPosition(1).x=e.xClosest,t.trackingObject.redraw();var r=n.getXAxis().getPx(e.xClosest)+t.options.paddingLeft}var o=t.options.trackingLine.series;o||(o=t.getSeries().map(function(e){return{serie:e,withinPx:20,withinVal:-1}})),t._trackingLegend=H(t,o,r,a,t._trackingLegend,t.options.trackingLine.textMethod,e.xClosest)}}if(t.options.onMouseMoveData){for(var l={},d=0;d{t.getXAxis()==e&&t.kill()})),e.isY()&&(-1<(r=this.axis.left.indexOf(e))&&this.axis.left.splice(r,1),-1<(r=this.axis.right.indexOf(e))&&this.axis.right.splice(r,1),!i&&this.series.forEach((t)=>{t.getYAxis()==e&&t.kill()})),this.axisGroup.removeChild(e.group),this.groupPrimaryGrids.removeChild(e.gridPrimary),this.groupSecondaryGrids.removeChild(e.gridSecondary),t||this.draw(!0)}hasXAxis(e){return this.hasTopAxis(e)||this.hasBottomAxis(e)}hasYAxis(e){return this.hasLeftAxis(e)||this.hasRightAxis(e)}hasTopAxis(e){return this.hasAxis(e,this.axis.top)}hasBottomAxis(e){return this.hasAxis(e,this.axis.bottom)}hasLeftAxis(e){return this.hasAxis(e,this.axis.left)}hasRightAxis(e){return this.hasAxis(e,this.axis.right)}hasAxis(e,t){for(var r=0,i=t.length;re.include(t.getType()))}drawSerie(e,t){if(!e.draw)throw new Error('Serie has no method draw');e.draw(t)}drawSeries(e){if(this.width&&this.height)for(var t=this.series.length-1;0<=t;t--)this.series[t].isShown()&&this.drawSerie(this.series[t],e)}resetSeries(){this.removeSeries()}killSeries(){this.resetSeries()}removeSeries(){for(;this.series[0];)this.series[0].kill(!0);this.series=[],this.legend&&this.legend.update()}selectSerie(e,t){'object'==typeof e||(e=this.getSerie(e));this.selectedSerie==e&&this.selectedSerie.selectionType==t||(this.selectedSerie!==e&&this.selectedSerie&&this.unselectSerie(this.selectedSerie),this.selectedSerie=e,this.triggerEvent('onSelectSerie',e),e.select(t||'selected'))}getSelectedSerie(){return this.selectedSerie}unselectSerie(e){e.unselect&&(e.unselect(),this.selectedSerie=!1,this.triggerEvent('onUnselectSerie',e))}getShapesOfSerie(e){for(var t=[],r=this.shapes.length-1;0<=r;r--)this.shapes[r].getSerie()==e&&t.push(this.shapes[r]);return t}makeToolbar(e){var t=this.getConstructor('graph.toolbar');return t?this.toolbar=new t(this,e):E.throwError('No constructor exists for toolbar')}getShapes(){return this.shapes||[]}newShape(e,t,r=!1,a){if(this.prevent(!1),!r&&(this.emit('beforeNewShape',t),this.prevent(!1)))return!1;'object'==typeof e&&(r=t,t=e,e=t.type),t=t||{},t._id=E.guid();var s;if(s='function'==typeof e?e:this.getConstructor('graph.shape.'+e),!s)return E.throwError('No constructor for this shape');var n=new s(this,t);if(!n)return E.throwError('Failed to construct shape.');if(n.type=e,n.graph=this,n._data=t,void 0!==t.properties&&n.setProperties(t.properties),n.init(this,a),void 0!==t.props)for(var o in t.props)n.setProp(o,t.props[o]);if(t.position)for(var o=0,i=t.position.length;o{n.addTransform(e,t)}),void 0!==t.highlightOnMouseOver&&n.setProp('highlightOnMouseOver',!0),t.labelEditable&&n.setProp('labelEditable',t.labelEditable),t.labels&&!t.label&&(t.label=t.labels),void 0!==t.label){Array.isArray(t.label)||(t.label=[t.label]);for(var o=0,i=t.label.length;o[e.getZPos(),e]);o.sort((e,t)=>t[0]-e[0]);let l=0;o.forEach((e)=>{e[1].setLayer(l),this.appendSerieToDom(e[1]),l++}),this.drawSeries(!0)}kill(){this.wrapper.removeChild(this.dom)}_removeSerie(e){this.series.splice(this.series.indexOf(e),1),this._pluginsExecute('serieRemoved',e)}contextListen(e,t,i){if(this.options.onContextMenuListen)return this.options.onContextMenuListen(e,t,i)}lockShapes(){this.shapesLocked=!0;for(var e=0,t=this.shapes.length;ethis.drawingSpaceWidth}getDrawingSpaceHeight(){return()=>this.drawingSpaceHeight}getDrawingSpaceMinX(){return()=>this.drawingSpaceMinX}getDrawingSpaceMinY(){return()=>this.drawingSpaceMinY}getDrawingSpaceMaxX(){return()=>this.drawingSpaceMaxX}getDrawingSpaceMaxY(){return()=>this.drawingSpaceMaxY}trackingLine(e){var t=this;return'boolean'==typeof e?void(this.options.trackingLine&&(this.options.trackingLine.enable=e)):(e&&(this.options.trackingLine=e),e.series=e.series||[],e.enable=void 0===e.enable||!!e.enable,'individual'==e.mode?e.series&&(!Array.isArray(e.series)&&('all'==e.series?e.series=this.series.map((e)=>({serie:e})):e.series=[e.series]),e.series.forEach((e)=>{if('object'!=typeof e.serie){if('object'!=typeof e)throw new Error('Misuse of the trackingLine() method. Each serie must be an object with the serie property: { series: [ { serie: jsGraphSerie, options: { ... someOptions } } ] }');e.serie=this.getSerie(e.serie)}e.serie&&t.addSerieToTrackingLine(e.serie,e)})):e.series.forEach((e)=>{e.serie.disableTracking()}),!e.noLine)?(this.trackingObject||(this.trackingObject=this.newShape('line',E.extend(!0,{position:[{y:'min'},{y:'max'}],stroke:'black',layer:-1},e.trackingLineShapeOptions))),this.trackingObject.draw(),this.trackingObject):void 0}addSerieToTrackingLine(e,t){this.options.trackingLine||this.trackingLine({mode:'individual'}),this.options.trackingLine.series.forEach((t,i)=>{t.serie==e&&this.options.trackingLine.series.splice(i,1)}),this.options.trackingLine.series.push(Object.assign({serie:e},t)),e.enableTracking((e,i,r,a)=>{this.options.trackingLine.enable&&i&&(this.trackingObject&&(this.trackingObject.show(),this.trackingObject.getPosition(0).x=i.trueX,this.trackingObject.getPosition(1).x=i.trueX,this.trackingObject.redraw()),e._trackingLegend=H(this,{serie:e},r,a,e._trackingLegend,t.textMethod?t.textMethod:(e)=>{for(var t in e)return e[t].serie.serie.getName()+': '+e[t].serie.serie.getYAxis().valueToHtml(e[t].yValue)},i.trueX),e._trackingLegend&&(e._trackingLegend.style.display='block'))},(e)=>{this.trackingObject&&this.trackingObject.hide(),e.trackingShape&&e.trackingShape.hide(),e._trackingLegend&&(e._trackingLegend.style.display='none'),e._trackingLegend=H(this,{serie:e},!1,!1,e._trackingLegend,!1,!1)})}setKatexRenderer(e){this._katexRenderer=e}hasKatexRenderer(){return!!this._katexRenderer}renderWithKatex(e,t){if(this._katexRenderer){t?t.removeChild(t.firstChild):t=document.createElementNS(N.ns,'foreignObject');let i=document.createElement('div');return t.appendChild(i),this._katexRenderer(e,i),t}return!1}static fromJSON(e,t){let i={},r={left:[],top:[],right:[],bottom:[]},a,s;return e.title&&(i.title=e.title),e.axis&&e.axis.forEach(function(e){e.type||E.throwError('Axis type is required (top, bottom, left or right)');var t={};e.label&&(t.labelValue=e.label),void 0!==e.unit&&(t.unit=e.unit),void 0!==e.unitWrapperAfter&&(t.unitWrapperAfter=e.unitWrapperAfter),void 0!==e.unitWrapperBefore&&(t.unitWrapperBefore=e.unitWrapperBefore),void 0!==e.min&&(t.forcedMin=e.min),void 0!==e.max&&(t.forcedMax=e.max),void 0!==e.flip&&(t.flipped=e.flip),r[e.type].push(t),e._jsGraphIndex=r[e.type].length-1}),a=new N(t,i,r),e.width&&a.setWidth(e.width),e.height&&a.setHeight(e.width),a._resize(),e.data&&e.data.forEach(function(t){var r=t.type,n={},o,d;let p;switch(t.type){case'bar':E.throwError('Bar charts not supported'),r=!1;break;case'color':r=N.SERIE_LINE_COLORED;break;case'scatter':r=N.SERIE_SCATTER;break;case'box':r=N.SERIE_BOX,('x'==t.orientation||'y'==t.orientation)&&(n.orientation=t.orientation);break;default:r=N.SERIE_LINE;}if(r!==N.SERIE_BOX&&(p=N.newWaveform()),!r)return void E.throwError('No valid serie type was found');if(o=a.newSerie(t.id||t.label||E.guid(),n,r),t.lineStyle){let e;Array.isArray(e)&&(e={unselected:e}),Object.entries(e).forEach(([e,t])=>{var i={};r===N.SERIE_LINE?(void 0!==t.lineWidth&&(i.lineWidth=t.lineWidth),void 0!==t.color&&(i.lineColor=t.color),t.lineStyle&&(i.lineStyle=t.lineStyle),o.setStyle(i,e)):void 0})}let g={},u={};if(t.defaultStyle&&(g=t.defaultStyle),t.defaultStyles&&(u=t.defaultStyles),t.styles){let e=Array.isArray(t.styles)?{unselected:t.styles}:t.styles;let i=new Set(Object.keys(u).concat(Object.keys(e)));i.forEach((t)=>{let i=[],a;e&&e[t]&&(i=e[t],!Array.isArray(i)&&(i=[i]),a=i.map(function(e){switch(r){case N.SERIE_LINE:return{type:e.shape,zoom:e.zoom,strokeWidth:e.lineWidth,strokeColor:e.lineColor,fillColor:e.color,points:e.points};break;case N.SERIE_BOX:return e;break;case N.SERIE_SCATTER:return e;}})),r===N.SERIE_LINE?o.setMarkers(a,t):r===N.SERIE_SCATTER?o.setStyle(Object.assign({},D,g,u[t]||{}),a,t):r===N.SERIE_BOX?o.setStyle(a[0],t||'unselected'):void 0})}if(t.color&&r==N.SERIE_LINE_COLORED&&o.setColors(t.color),r!==N.SERIE_BOX&&p.setData(t.y,t.x),!!o){let n=[],l=[],g=[],u=[],h=[],x=[],m=[],y=[];if(void 0!==p){if(t.errorX)for(var c=0,i=t.errorX.length;c{this.axis[e]&&(t=t.concat(this.axis[e].map((t)=>({type:e,label:t.options.label,unit:t.options.unit,min:t.options.forcedMin,max:t.options.forcedMax,flip:t.options.flipped}))),'top'==e||'bottom'==e?i.x=i.x.concat(this.axis[e]):i.y=i.y.concat(this.axis[e]))}),e.axis=t;let r=(e)=>{switch(e){case N.SERIE_LINE:return'line';break;case N.SERIE_BAR:return'bar';break;case N.SERIE_LINE_COLORED:return'color';break;case N.SERIE_SCATTER:return'scatter';}},a=(e,t)=>{let r=[];switch(e.getType()){case N.SERIE_LINE:for(var a=0;a{let t=[],s=[];if(e.getType()==N.SERIE_LINE)for(var n in e.styles){s.push({styleName:n,color:e.styles[n].lineColor,lineWidth:e.styles[n].lineWidth,lineStyle:e.styles[n].lineStyle});let i={styleName:n,styles:[]};t.push(i),i.styles=i.styles.concat((e.styles[n].markers||[]).map((e)=>({shape:e.type,zoom:e.zoom,lineWidth:e.strokeWidth,lineColor:e.strokeColor,color:e.fillColor,points:e.points})))}return{label:e.getLabel(),id:e.getName(),type:r(e.getType()),x:a(e,!0),y:a(e,!1),xAxis:i.x.indexOf(e.getXAxis()),yAxis:i.y.indexOf(e.getYAxis()),style:t,lineStyle:s}})),e}static registerConstructor(e,t){return I.has(e)?E.throwError('Constructor '+t+' already exists.'):void I.set(e,t)}static getConstructor(e,t=!1){return I.has(e)?I.get(e):!t&&E.throwError('Constructor "'+e+'" doesn\'t exist')}static newWaveform(){return new X.default(...arguments)}static waveform(){return new X.default(...arguments)}}N.prototype.getConstructor=N.getConstructor;var H=function(e,t,i,r,a,s,n){var o=!1;Array.isArray(t)||(t=[t]);var l=[];if(!a&&e.options.trackingLine.legend&&(o=!0,a=b(e)),t.map((t)=>{var r=t.serie.handleMouseMove(n,!1);if(!r||!s)return t.serie.trackingShape&&t.serie.trackingShape.hide(),a;if(0t.serie.getXAxis().getVal(i-e.options.paddingLeft)/1e5)t.serie.trackingShape&&t.serie.trackingShape.hide();else{l[t.serie.getName()]={yValue:r.xClosest,xValue:r.yClosest,serie:t,index:r};let i;if(i=e.options.trackingLine&&e.options.trackingLine.serieShape?e.options.trackingLine.serieShape:{shape:'ellipse',properties:{rx:[3*t.serie.getLineWidth()+'px'],ry:[3*t.serie.getLineWidth()+'px']}},t.serie.trackingShape||(t.serie.trackingShape=e.newShape(i.shape,{fillColor:t.serie.getLineColor(),strokeColor:'White',strokeWidth:t.serie.getLineWidth()},!0,i.properties).setSerie(t.serie).forceParentDom(t.serie.groupMain).draw(),i.onCreated&&i.onCreated(t.serie.trackingShape),t.serie.trackingShape.on('changed',()=>{i.onChanged&&i.onChanged(t.serie.trackingShape)})),t.serie.trackingShape.show(),t.serie.trackingShape.getPosition(0).x=r.xClosest,i.magnet){let e=i.magnet,a=e.within,s;e.withinPx&&(a=t.serie.getXAxis().getRelVal(e.withinPx)),(s=t.serie.findLocalMinMax(r.xClosest,a,e.mode))&&(t.serie.trackingShape.getPosition(0).x=s)}t.serie.trackingShape.redraw()}}),!!e.options.trackingLine.legend){if(0==Object.keys(l).length||!s)a.style.display='none';else{'none'==a.style.display||o?O(e,a,i,r,!0):B(e,a,i,r),a.style.display='block';var d=s(l,n,i,r);a.innerHTML=d}return a}},O=function(e,t,i,r,a){function s(){var e=(Date.now()-n)/200;1e&&window.requestAnimationFrame(s)}var n=Date.now(),o=t.offsetHeight,l=parseInt(t.style.marginLeft.replace('px','')||0),d=parseInt(t.style.marginTop.replace('px','')||0);return i=i>e.getWidth()/2?i-i%10-20-t.offsetWidth:i-i%10+30,r=r-r%10+o/2,a?(t.style.marginLeft=i+'px',void(t.style.marginTop=r+'px')):void window.requestAnimationFrame(s)},B=E.debounce(O,50);N.SERIE_LINE=Symbol(),N.SERIE_SCATTER=Symbol(),N.SERIE_CONTOUR=Symbol(),N.SERIE_BAR=Symbol(),N.SERIE_BOX=Symbol(),N.SERIE_ZONE=Symbol(),N.SERIE_LINE_COLORED=Symbol(),N.SERIE_ZONE=Symbol(),N.SERIE_DENSITYMAP=Symbol(),N.SERIE_LINE_3D=Symbol(),N.SERIE_ZONE_3D=Symbol(),N.TICKS_OUTSIDE=Symbol(),N.TICKS_INSIDE=Symbol(),N.TICKS_CENTERED=Symbol(),N.ns='http://www.w3.org/2000/svg',N.nsxlink='http://www.w3.org/1999/xlink',t.default=N,e.exports=t['default']})},function(e,t,r){var l,c,h;(function(i,a){c=[e,t,r(13),r(20)],l=a,h='function'==typeof l?l.apply(t,c):l,!(void 0!==h&&(e.exports=h))})(this,function(e,t,r,l){'use strict';function c(e){return e&&e.__esModule?e:{default:e}}function h(e){e--;for(var t=2;e>>=1;)t<<=1;return t}function x(e){for(var t=1;e>>=1;)t<<=1;return t}function m(e,t,i,r,a){return(e-t)/(i-t)*(a-r)+r}function y(e,t,r){let a=0,s=t.length,n=s-1,o=0,i=1,l;if(t[a]==e)return a;if(t[n]==e)return n;for(;;){if(o++,100=t.length-1)return t.length-1;if(0>=l)return 0;l+=i}if(l==a||t[l]==e||l==n)return l;if(t[l]<=e)r?n=l:a=l;else if(t[l]>e)r?a=l:n=l;else return!1;i*=-1}}Object.defineProperty(t,'__esModule',{value:!0});var f=c(r),b=c(l);class A{constructor(e=[],t=0,i=1){this.xOffset=t,this.xScale=i,this.setData(e)}setData(e,t=null){if(Array.isArray(e[0])){let t=[],i=[];e.forEach((e)=>{t.push(e[0]),i.push(e[1])}),this.setXWaveform(t),e=i}let i=this._makeArray(e.length),r=!1;const a=this.isNaNAllowed();return e.map((e,t)=>{a||e[0]===e[0]&&e[1]===e[1]||(r=!0),i[t]=e}),r&&this.warn('Trying to assign NaN values to a typed array that does not support NaNs. 0\'s will be used instead'),this._setData(i),t&&this.setXWaveform(t),this}getY(e,t){return t&&this.dataInUse?this.dataInUse.y[e]*this.getScale()+this.getShift():this.data[e]*this.getScale()+this.getShift()}setXWaveform(e){if(!(e instanceof A))if(Array.isArray(e))e=new A(e);else throw'Cannot set X waveform. Data is not a valid array.';return this.xdata=e,this.computeXMinMax(),this}hasXWaveform(){return!!this.xdata}getXWaveform(){if(this.xdata)return this.xdata;for(var e=new A,t=0;tthis.maxX||this.maxX===void 0)&&(this.maxX=e),(tthis.maxY||this.maxY===void 0)&&(this.maxY=t)}prepend(e,t){return'function'==typeof e&&(e=e(this)),'function'==typeof t&&(t=t(this)),this.xdata?this.xdata.prepend(null,e):null===e?this.xOffset-=this.xScale:(this.xdata=this.getXWaveform(),this.xdata.prepend(null,e)),this.data.unshift(t),this.recalculateMinMaxNewPoint(e,t),this}append(e,t){return'function'==typeof e&&(e=e(this)),'function'==typeof t&&(t=t(this)),this.xdata?this.xdata.append(null,e):null!==e&&(this.xdata=this.getXWaveform(),this.xdata.append(null,e)),this.monotoneous&&(t>this.data[this.data.y]&&!1===this.getMonotoneousAscending()?this.monotoneous=!1:tthis.data[0]),this.data.push(t),this.recalculateMinMaxNewPoint(e,t),this}_makeArray(e){const t=this.getTypedArrayClass();return t?new t(e):Array(e)}_setData(e){const t=e.length;let r=1,i=e[1]>e[0],a=e[0],s=e[0];for(this._monotoneous=!0;re[r-1]&&(this._monotoneous=!1),e[r]===e[r]&&(a=d(e[r],a),s=o(e[r],s));this._monotoneous&&(this._monotoneousAscending=e[1]>e[0]),this.minY=a,this.maxY=s,this.data=e,this.computeXMinMax()}computeXMinMax(){if(this.data)if(this.xdata)this.minX=this.xdata.getMin(),this.maxX=this.xdata.getMax();else{const e=this.xOffset+this.xScale*this.getLength(),t=this.xOffset;this.minX=d(e,t),this.maxX=o(e,t)}}getDataInUse(){return this.dataInUse||this.data}getIndexFromVal(e,t=!1,i=u){let r=t&&this.dataInUse?this.dataInUse.y:this.data;let a;return a=this.getIndexFromData(e,r,this.data.getMonotoneousAscending(),i),t&&this.dataInUse&&'aggregateY'==this.dataInUseType?a-a%4:a}getIndexFromX(e,t=!1,i=u){let r;t&&this.dataInUse?r=this.dataInUse.x:this.xdata&&(r=this.xdata.getData());let a;return a=this.hasXWaveform()?this.xdata.getIndexFromData(e,r,this.xdata.getMonotoneousAscending(),i):o(0,d(this.getLength()-1,i((e-this.xOffset)/this.xScale))),t&&this.dataInUse&&'aggregateX'==this.dataInUseType?a-a%4:a}getIndexFromData(e,t,i){if(!this.isMonotoneous())throw console.trace(),'Impossible to get the index from a non-monotoneous wave !';return e-=this.getShift(),e/=this.getScale(),y(e,t,!i)}getReductionType(){return this.dataInUseType}getXMin(){return this.minX*this.getXScale()+this.getXShift()}getXMax(){return this.maxX*this.getXScale()+this.getXShift()}getYMin(){return this.minY*this.getScale()+this.getShift()}getYMax(){return this.maxY*this.getScale()+this.getShift()}getMin(){return this.minY*this.getScale()+this.getShift()}getMax(){return this.maxY*this.getScale()+this.getShift()}getMinX(){return this.minX*this.getXScale()+this.getXShift()}getMaxX(){return this.maxX*this.getXScale()+this.getXShift()}getMinY(){return this.minY*this.getScale()+this.getShift()}getMaxY(){return this.maxY*this.getScale()+this.getShift()}getDataY(){return this.data}getData(e){return e&&this.dataInUse?this.dataInUse.y:this.data}setShift(e=0){return this.shift=e,this}getShift(){return this.shift||0}getScale(){return this.scale||1}setScale(e=1){return this.scale=e,this}setXShift(e=0){return this.hasXWaveform?(this.getXWaveform().setShift(e),this):this}getXShift(e=0){return this.hasXWaveform?this.getXWaveform().getShift():0}setXScale(e=1){return this.hasXWaveform?(this.getXWaveform().setScale(e),this):this}getXScale(){return this.hasXWaveform?this.getXWaveform().getScale():1}getLength(){return this.data.length}getDataToUseFlat(){let e=0,t,r;if(this.dataInUse){t=this.dataInUse.x.length,r=Array(2*t).fill(0);for(var a=0;at){let i=e;e=t,t=i}var i=t-e+1,r=0;let a=0,s;for(var n=this.getData();e<=t;e++)n.length-1>e&&(s=this.getX(e+1)-this.getX(e),a+=s,r+=n[e]*s);return[r,i,a]}integrateP(e,t){var i=this._integrateP(e,t);return i[0]}integrate(e,t){return this.integrateP(this.getIndexFromX(e),this.getIndexFromX(t))}average(e=0,t=this.getLength()-1){return this.getAverageP(e,t)}mean(){return this.average()}getAverageP(e,t){var i=this._integrateP(e,t);return i[0]/i[2]}getAverageX(e,t){var i=this._integrateX(e,t);return i[0]/i[2]}checkMonotonicity(){let e=1,t=this.getData();const i=this.data.length;for(let r=t[1]>t[0];et[e-1])return this._monotoneous=!1;return this._monotoneousAscending=t[1]>t[0],this._monotoneous=!0}requireXMonotonicity(){this.xdata&&this.xdata.requireMonotonicity()}requireMonotonicity(){if(!this.isMonotoneous())throw'The wave must be monotonic'}isMonotoneous(){return!!this._monotoneous}isXMonotoneous(){return!this.xdata||this.xdata.isMonotoneous()}invert(){let e=dataY||this.data;return e.reverse(),this.isMonotoneous()&&(this._monotoneousAscending=!this._monotoneousAscending),e}resampleForDisplay(e){let t=0;this.requireXMonotonicity();let i=!1,r=this.getDataY(),a={x:[],y:[]},s=[],n=!1,p=0,u,c,h,x,m,y,f,b;const A=this.getLength();if(!e.xPosition)throw'No position calculation method provided';if(!e.resampleToPx)throw'No "resampleToPx" method was provided. Unit: px per point';if(e.minX>e.maxX){let t=e.minX;e.minX=e.maxX,e.maxX=t}for((this.xdata&&!this.xdata.getMonotoneousAscending()||!this.xdata&&-0>this.xScale)&&(i=!0,t=A);i?0b){p=t;continue}if(f=e.xPosition(b),!n){for(p?(a.x.push(b),a.y.push(r[p])):p=t;isNaN(r[t]);)i?t--:t++;u=c=h=r[p],x=1,y=f,m=b,p=0,n=!0;continue}if(g(f-y)>e.resampleToPx||t==A||0==t||isNaN(r[t])){let t=(m+b)/2;if(a.x.push(t),a.y.push(u/x),s.push(t,c,h),void 0!==e.maxX&&b>e.maxX)break;n=!1;continue}u+=r[t],x++,c=d(c,r[t]),h=o(h,r[t])}return this.dataInUseType='resampled',this.dataInUse=a,s}interpolate(e){let t=this.getDataY(),i;if(this.xdata){let r=this.xdata.getData();return i=y(e,r,!this.xdata.getMonotoneousAscending()),r[i]==e?t[i]:(e-r[i])/(r[i+1]-r[i])*(t[i+1]-t[i])+t[i]}else{i=(e-this.xOffset)/this.xScale;let r=p(i);return(i-r)*(t[r+1]-t[r])+t[r]}}interpolateIndex_X(e){this.getDataY();if(this.xdata){let t=this.xdata.getData(),i=p(e);return(e-i)*(t[i+1]-t[i])+t[i]}}getMonotoneousAscending(){return this.isMonotoneous()?this._monotoneousAscending:'The waveform is not monotoneous'}getXMonotoneousAscending(){return this.xdata?this.xdata.getMonotoneousAscending():0i(e)/t)}add(e){return this._arithmetic(e,M)}addBy(){return this.add(...arguments)}subtract(e){return this._arithmetic(e,S)}subtractBy(){return this.subtract(...arguments)}math(e){for(var t=0;t{this._dataAggregated=e.aggregates,this._dataAggregating=!1})}hasAggregation(){return!!this._dataAggregated}selectAggregatedData(e){if(2>e)return!1;var t=h(e);return this._dataAggregated[t]?(this.dataInUseType='aggregate'+this._dataAggregationDirection,void(this.dataInUse=this._dataAggregated[t])):this._dataAggregating?this._dataAggregating:void(this.dataInUseType='none',this.dataInUse={y:this.data,x:this.getXWaveform().data})}duplicate(e){var t=new A;return t._setData(this.getDataY().slice()),t.rescaleX(this.xOffset,this.xShift),t.setShift(this.getShift()),t.setScale(this.getScale()),this.xdata?(e?t.setXWaveform(this.xdata.duplicate()):t.setXWaveform(this.xdata),t.setXShift(this.getXShift()),t.setXScale(this.getXScale())):(t.xOffset=this.xOffset,t.xScale=this.xScale),t}subrangeX(e,t){if(!this.xdata){let t=this.getIndexFromX(e),i=this.getIndexFromX(i);return new A().setData(this.data.slice(t,i)).rescaleX(this.xOffset,this.xScale)}for(var r=new A,a=0,i=this.data.length;a=e&&this.data[a]o&&(o=this.getY(d),l=d)}else{o=s;for(var d=e;d<=t;d++)this.getY(d)o)break;if(!(nt.rangeP[1]-(r-1)/2)break;if(a=this.getAverageP(n-(r-1)/2,n+(r-1)/2),void 0==s){s=a=e&&s){if(s=!1,'ascending'==t.edge||'both'==t.edge)for(i=n+(r-1)/2;i>=n-(r-1)/2;i--)if(this.data[i]>=e&&this.data[i-1]<=e)switch(t.rounding){case'before':return i-1;break;case'after':return i;break;case'interpolate':return m(e,this.data[i],this.data[i-1],i,i-1);}}else if(a<=e&&!s&&(s=!0,'descending'==t.edge||'both'==t.edge))for(i=n+(r-1)/2;i>=n-(r-1)/2;i--)if(this.data[i]<=e&&this.data[i-1]>=e)switch(t.rounding){case'before':return i-1;break;case'after':return i;break;case'interpolate':return m(e,this.data[i],this.data[i-1],i,i-1);}}}}normalize(e){let t,r,a,s,n,o;if('max1'==e||'max100'==e){for(t=1,'max100'==e&&(t=100),s=this.data[0],o=1;os&&(s=this.data[o]);for(o=0;os?s=this.data[o]:this.data[o]{this.options.selectableOnClick&&(this.isSelected()?this.graph.unselectSerie(this):this.graph.selectSerie(this))}),this.options.markers&&this.setMarkers(this.options.markers,'unselected')}setOptions(e){return this.options=h.extend(!0,{},y.prototype.defaults,e||{}),this.styles.unselected={lineColor:this.options.lineColor,lineStyle:this.options.lineStyle,markers:this.options.markers},this.applyLineStyles(),this}onMouseOverMarker(t,e){this.toggleMarker(e,!0,!0);this.options.onMouseOverMarker&&this.options.onMouseOverMarker(e,!!this.infos&&(this.infos[e]||!1),[this.waveform.getX(e),this.waveform.getY(e)])}onMouseOutMarker(t,e){this.markersOffHover(),this.options.onMouseOutMarker&&this.options.onMouseOutMarker(e,!!this.infos&&(this.infos[e]||!1),[this.waveform.getX(e),this.waveform.getY(e)])}toggleMarker(e,t,r){let a=e;var i;'undefined'==typeof t&&(i=r?!this.domMarkerHover[e]:!this.domMarkerSelect[e]);var s=this['domMarker'+(r?'Hover':'Select')];if(i||!0===t){if(!s[e]){var n=document.createElementNS(this.graph.ns,'path');this.setMarkerStyleTo(n,this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(a)]),this['domMarker'+(r?'Hover':'Select')][e]=n,this.groupMarkerSelected.appendChild(n)}else n=s[e];let t=this.getX(this.waveform.getX(a)),i=this.getY(this.waveform.getY(a));n.setAttribute('d','M '+t+' '+i+' '+this.getMarkerPath(this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(a)],1)),r&&this.markerHovered++}else if((!i||!1===t)&&(r&&this.domMarkerHover[e]&&!this.domMarkerSelect[e]||this.domMarkerSelect[e])){if(!s[e])return;this.groupMarkerSelected.removeChild(s[e]),delete s[e],r&&this.markerHovered--}return i}markersOffHover(){for(var e in this.domMarkerHover)this.toggleMarker(e.split(','),!1,!0);return this}markersOffSelect(){for(var e in this.domMarkerSelect)this.toggleMarker(e.split(','),!1,!1);return this}onClickOnMarker(t,e){var i=this.toggleMarker(e);i&&this.options.onSelectMarker&&this.options.onSelectMarker(e,!!this.infos&&(this.infos[e[0]]||!1)),!i&&this.options.onUnselectMarker&&this.options.onUnselectMarker(e,!!this.infos&&(this.infos[e[0]]||!1)),this.options.onToggleMarker&&this.options.onToggleMarker(e,!!this.infos&&(this.infos[e[0]]||!1),i)}_getMarkerIndexFromEvent(t){var e=this.graph._getXY(t);return this.searchIndexByPxXY(e.x-this.graph.getPaddingLeft(),e.y-this.graph.getPaddingTop())}onMouseWheel(){}empty(){for(var e=0,t=this.lines.length;e{this.draw(e)}),!1;if(!1===r)return!1;this._dataToUse=this.waveform.getDataToUseFlat()}return!0}removeLinesGroup(){this._afterLinesGroup=this.groupLines.nextSibling,this.groupMain.removeChild(this.groupLines)}insertLinesGroup(){if(!this._afterLinesGroup)throw'Could not find group after lines to insertion.';this.groupMain.insertBefore(this.groupLines,this._afterLinesGroup),this._afterLinesGroup=!1}removeExtraLines(){for(var e=this.currentLineId,t=this.lines.length;eu.length&&(i=u.length));vp&&r>p||(!this.options.overflowY&&hg&&a>g)&&!this.options.lineToZero){r=c,a=h,M=!0;continue}if(this.counter2=v,_&&this.getMarkerCurrentFamily(this.counter2),y=this.getX(c),f=this.getY(h),y!=x||f!=m){if(y!=y||f!=f){0g):!this.options.overflowX&&(cp)||!this.options.overflowY&&(hg),this.options.lineToZero){if(k=cp,k)continue;}else if(k||M){!1!==r&&!1!==a||M?(Y=[],l=(c-o)/(c-r),C=h-l*(h-a),P=(c-p)/(c-r),w=h-P*(h-a),L=(h-d)/(h-a),E=c-L*(c-r),T=(h-g)/(h-a),X=c-T*(c-r),1>l&&0d&&Y.push([o,C]),1>P&&0d&&Y.push([p,w]),1>L&&0o&&Y.push([E,d]),1>T&&0o&&Y.push([X,g]),0{var e=this.graph._getXY(t),i=this.handleMouseMove(!1,!1);this._trackingCallback(this,i,e.x,e.y)}),this.groupMain.addEventListener('mouseleave',()=>{this._trackingOutCallback(this)})}return this}kill(){super.kill()}getMarkerCurrentFamily(e){if(this.markerPoints&&this.markerPoints[this.selectionType]){for(var t=0,i;t=e&&(this.markerCurrentFamily=this.markerPoints[this.selectionType][t][2],i=this.markerFamilies[this.selectionType][this.markerCurrentFamily]);return!!i&&(this.getMarkerDom(i),this.markerCurrentFamily)}}setMarkerStyleTo(e,t){if(!e||!t)throw console.trace(),'Cannot set marker style. DOM does not exist.';e.setAttribute('fill',t.fillColor||'transparent'),e.setAttribute('stroke',t.strokeColor||this.getLineColor()),e.setAttribute('stroke-width',t.strokeWidth||1)}hideTrackingMarker(){this.marker.setAttribute('display','none'),this.markerLabel.setAttribute('display','none'),this.markerLabelSquare.setAttribute('display','none')}_addPoint(e,t,i,r,a,s,n){if(e===e&&t===t)return 0==this.counter?this.currentLine='M ':this.options.lineToZero||s?this.currentLine+='M ':this.currentLine+='L ',this.currentLine+=e,this.currentLine+=' ',this.currentLine+=t,this.currentLine+=' ',this.options.lineToZero&&void 0!==this.pos0&&(this.currentLine+='L ',this.currentLine+=e,this.currentLine+=' ',this.currentLine+=this.pos0,this.currentLine+=' '),this.hasErrors()&&this.errorAddPoint(a,i,r,e,t),this.markerPoints?void(this.markersShown()&&!1!==n&&this.markerFamily&&g(this,this.markerFamily[this.markerCurrentFamily],e,t,this.markersDom.get(this.markerFamily[this.markerCurrentFamily])),this.counter++):void this.counter++}_createLine(){var e=this.currentLineId++,t;return this.lines[e]?t=this.lines[e]:(t=document.createElementNS(this.graph.ns,'path'),this.applyLineStyle(t),this.groupLines.appendChild(t),this.lines[e]=t),0==this.counter?t.setAttribute('d',''):t.setAttribute('d',this.currentLine),this.currentLine='M ',this.counter=0,t}applyLineStyles(){for(var e=0;e{this.onMouseOverMarker(i,t)}),i.addEventListener('mouseout',(i)=>{this.onMouseOutMarker(i,t)}),i.addEventListener('click',(i)=>{this.onClickOnMarker(i,t)}),this.independantMarkers[t]=i}return this.groupMarkers.appendChild(this.independantMarkers[t]),this.independantMarkers[t]}searchIndexByPxXY(e,t){for(var i=!1,a=!1,s=this._xDataToUse,n=0,o=this.waveform.getLength(),l,d,p;nthis.waveform.getX(i)?0:1,Object.assign(r,{indexMin:i+a,indexMax:i+a+1,indexClosest:i,xMin:this.waveform.getX(i+a),xMax:this.waveform.getX(i+a+1),yMin:this.waveform.getY(i+a),yMax:this.waveform.getY(i+a+1),xClosest:this.waveform.getX(i),yClosest:this.waveform.getY(i),xExact:e}),r}}handleMouseMove(e,t,i){var r=e||this.getXAxis().getMouseVal(),a=i||this.getYAxis().getMouseVal(),s=this.searchClosestValue(r,a);if(s){var n;if(s.xMax==s.xMin&&(n=s.yMin),t&&this.options.trackMouse){if(void 0==s.xMin)return!1;if(!this.marker)return;var o=this.getX(this.getFlip()?s.yClosest:s.xClosest),l=this.getY(this.getFlip()?s.xClosest:s.yClosest);if(isNaN(o)||isNaN(l))return;switch(this.marker.setAttribute('display','block'),this.marker.setAttribute('cx',o),this.marker.setAttribute('cy',l),this.markerLabel.setAttribute('display','block'),this.markerLabelSquare.setAttribute('display','block'),this.options.trackMouseLabel){case!1:break;default:this.markerLabel.textContent=this.options.trackMouseLabel.replace('',r.toFixed(this.options.trackMouseLabelRouding)).replace('',n.toFixed(this.options.trackMouseLabelRouding));}this.markerLabel.setAttribute('x',o+5),this.markerLabel.setAttribute('y',l-5),this.markerLabelSquare.setAttribute('x',o+5),this.markerLabelSquare.setAttribute('y',l-5-this.graph.options.fontSize),this.markerLabelSquare.setAttribute('width',this.markerLabel.getComputedTextLength()+2),this.markerLabelSquare.setAttribute('height',this.graph.options.fontSize+2)}return{xBefore:s.xMin,xAfter:s.xMax,yBefore:s.yMin,yAfter:s.yMax,trueX:s.xExact,indexClosest:s.indexClosest,interpolatedY:n,xClosest:s.xClosest,yClosest:s.yClosest}}}getMax(e,t){var r=d(e,t),a=o(e,t),s=this.searchClosestValue(r),n=this.searchClosestValue(a),l=-Infinity,p,i,g,u;if(s||(r=this.minX,s=this.searchClosestValue(r)),n||(a=this.maxX,n=this.searchClosestValue(a)),!s||!n)return-Infinity;for(p=s.dataIndex;p<=n.dataIndex;p++)for(g=p==s.dataIndex?s.xBeforeIndexArr:0,u=p==n.dataIndex?n.xBeforeIndexArr:this.data[p].length,i=g;i<=u;i+=2)l=o(l,this.data[p][i+1]);return l}getMin(e,t){var r=d(e,t),a=o(e,t),s=this.searchClosestValue(r),n=this.searchClosestValue(a),l=Infinity,p,i,g,u;if(s||(r=this.minX,s=this.searchClosestValue(r)),n||(a=this.maxX,n=this.searchClosestValue(a)),!s||!n)return Infinity;for(p=s.dataIndex;p<=n.dataIndex;p++)for(g=p==s.dataIndex?s.xBeforeIndexArr:0,u=p==n.dataIndex?n.xBeforeIndexArr:this.data[p].length,i=g;i<=u;i+=2)l=d(l,this.data[p][i+1]);return l}setStyle(e,t='unselected'){this.styles[t]=e,this.styleHasChanged(t)}setLineStyle(e,t='unselected',i){return this.styles[t]=this.styles[t]||{},this.styles[t].lineStyle=e,i&&this.setLineStyle(e,'selected'),this.styleHasChanged(t),this}getLineStyle(e){return this.getStyle(e).lineStyle}getLineDashArray(e=this.selectionType||'unselected'){switch(this.getStyle(e).lineStyle){case 2:return'1, 1';break;case 3:return'2, 2';break;case 4:return'3, 3';break;case 5:return'4, 4';break;case 6:return'5, 5';break;case 7:return'5 2';break;case 8:return'2 5';break;case 9:return'4 2 4 4';break;case 10:return'1,3,1';break;case 11:return'9 2';break;case 12:return'2 9';break;case 1:case!1:return!1;break;default:return this.styles[e].lineStyle;}this.styleHasChanged(e)}getStyle(e=this.selectionType||'unselected'){return this.styles[e]}extendStyles(){for(var e in this.styles){var t=this.styles[e];t&&(this.styles[e]=h.extend(!0,{},this.styles.unselected,t))}}extendStyle(e,t){var i=this.styles[e];this.styles[e]=h.extend(!0,{},this.styles[t||'unselected'],i||{}),this.styles[e].markers.map(function(e){e.dom&&(e.dom='')}),this._recalculateMarkerPoints(e,this.styles[e].markers),this.styleHasChanged(e)}setLineWidth(e,t,i){return t=t||'unselected',this.styles[t]=this.styles[t]||{},this.styles[t].lineWidth=e,i&&this.setLineWidth(e,'selected'),this.styleHasChanged(t),this}getLineWidth(e){return this.getStyle(e).lineWidth||1}setLineColor(e,t,i){return t=t||'unselected',this.styles[t]=this.styles[t]||{},this.styles[t].lineColor=e,i&&this.setLineColor(e,'selected'),this.styleHasChanged(t),this}getLineColor(e){return this.getStyle(e).lineColor||'black'}showMarkers(e,t){return e=e||'unselected',this.styles[e]=this.styles[e]||{},this.styles[e].showMarkers=!0,t&&this._drawn?this.draw(!0):this.styleHasChanged(e),this}hideMarkers(e,t){return e=e||'unselected',this.styles[e].showMarkers=!1,t&&this._drawn?this.draw(!0):this.styleHasChanged(e),this}markersShown(e){return!1!==this.getStyle(e).showMarkers}areMarkersShown(){return this.markersShown.apply(this,arguments)}isMarkersShown(){return this.markersShown.apply(this,arguments)}setMarkers(e,t,i){return this.styles[t||'unselected']=this.styles[t||'unselected']||{},this.showMarkers(t,!1),Array.isArray(e)||'object'!=typeof e?!e&&(e=[{type:1,zoom:1,points:'all'}]):e=[e],this.styles[t||'unselected'].markers=e,i&&(this.styles.selected.markers=h.extend(!0,{},e)),this._recalculateMarkerPoints(t,e),this.styleHasChanged(t),this.dataHasChanged(!0),this}setMarkersPoints(e,t,i){this._extendMarkers('points',e,t,i,!0)}setMarkersColor(e,t,i){this._extendMarkers('color',e,t,i)}setMarkersType(e,t,i){this._extendMarkers('type',e,t,i)}setMarkersZoom(e,t,i){this._extendMarkers('zoom',e,t,i)}setMarkersStrokeColor(e,t,i){this._extendMarkers('strokeColor',e,t,i)}setMarkersStrokeWidth(e,t,i){this._extendMarkers('strokeWidth',e,t,i)}setMarkersFillColor(e,t,i){this._extendMarkers('fillColor',e,t,i)}_extendMarkers(e,t,i,r,a){(i=i||0,r=r||'unselected',this.styles[r]&&this.styles[r].markers)&&(this.styles[r].markers[i][e]=t,a&&this._recalculateMarkerPoints(r,this.styles[r].markers),this.markersDom[this.styles[r].markers[i]]&&this.setMarkerStyleTo(this.markersDom[this.styles[r].markers[i]].dom,this.styles[r].markers[i]))}_recalculateMarkerPoints(e,t){for(var r=[[0,Infinity,null]],a=0,i=t.length;a{e.redraw()}),this.emit('draw')}setData(e){if(e instanceof p.default)return this.setWaveform(e);throw'Setting data other than waveforms in not supported by default. You must implemented this method in the inherited class.'}_addData(){return[]}clearData(){return this.setData(new p.default),this}getData(){return this.data}setOptions(e){this.options=e||{}}setOption(e,t){this.options[e]=t}kill(e){return this.graph.removeSerieFromDom(this),this.graph._removeSerie(this),this.graph.legend&&!e&&this.graph.legend.update(),this.graph=void 0,this}hide(e,t=!1){if(this.hidden=!0,this.groupMain.setAttribute('display','none'),this.getSymbolForLegend().setAttribute('opacity',0.5),this.getTextForLegend().setAttribute('opacity',0.5),this.hideImpl(),e)for(var r=this.graph.getShapesOfSerie(this),a=0,i=r.length;ae;e++)arguments[e]&&this[arguments[e].isX()?'setXAxis':'setYAxis'](arguments[e]);return this.graph.updateDataMinMaxAxes(),this}getXAxis(){return this.xaxis}getYAxis(){return this.yaxis}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getWaveform(){return this.waveform}getWaveforms(){return[this.waveform]}setWaveform(e){if(!(e instanceof p.default))throw console.trace(),console.error(e),new Error('Cannot assign waveform to serie. Waveform is not of the proper Waveform instance');return this.waveform=e,this.minX=this.waveform.getXMin(),this.maxX=this.waveform.getXMax(),this.minY=this.waveform.getMin(),this.maxY=this.waveform.getMax(),this.graph.updateDataMinMaxAxes(),this.dataHasChanged(),this}getSymbolForLegend(){if(!this.lineForLegend){var e=document.createElementNS(this.graph.ns,'line');this.applyLineStyle(e),e.setAttribute('x1',5),e.setAttribute('x2',25),e.setAttribute('y1',0),e.setAttribute('y2',0),e.setAttribute('cursor','pointer'),this.lineForLegend=e}return this.lineForLegend}setLegendSymbolStyle(){this.applyLineStyle(this.getSymbolForLegend())}updateStyle(){this.setLegendSymbolStyle(),this.graph.updateLegend()}getTextForLegend(){if(!this.textForLegend){var e=document.createElementNS(this.graph.ns,'text');e.setAttribute('cursor','pointer'),e.textContent=this.getLabel(),this.textForLegend=e}return this.textForLegend}getIndex(){return this.graph.series.indexOf(this)}getLabel(){return this.options.label||this.name}setLabel(e){return this.options.label=e,this.textForLegend&&(this.textForLegend.textContent=e),this.graph.requireLegendUpdate(),this}setFlip(e){return this.options.flip=e,this}getFlip(){return this.options.flip}isFlipped(){return this.options.flip}setLayer(e){let t=parseInt(e)||1;return t!==this.options.layer&&(this.options.layer=t,this.graph.appendSerieToDom(this)),this}getLayer(){return this.options.layer||1}setStyle(e,t='unselected'){this.styles[t]=e,this.styleHasChanged(t)}styleHasChanged(e='unselected'){if(this._changedStyles=this._changedStyles||{},!1===e)for(var t in this._changedStyles)this._changedStyles[t]=!1;else this._changedStyles[e||'unselected']=!0;return this.graph.requireLegendUpdate(),this}hasStyleChanged(e){return this._changedStyles=this._changedStyles||{},this._changedStyles[e||'unselected']}dataHasChanged(e){return this._dataHasChanged=void 0===e||e,this}hasDataChanged(){return this._dataHasChanged}setInfo(e,t){return this.infos=this.infos||{},this.infos[e]=t,this}getInfo(e){return(this.infos||{})[e]}setAdditionalData(e){return this.additionalData=e,this}getAdditionalData(){return this.additionalData}select(){return this.selected=!0,this}unselect(){return this.selected=!1,this}enableTracking(e,t){return this._tracker=!0,this._trackingCallback=e,this._trackingOutCallback=t,this}disableTracking(){return this._trackerDom&&(this._trackerDom.remove(),this._trackerDom=null),this._tracker=!1,this._trackingCallback=null,this}allowTrackingLine(e){e=e||{},this.graph.addSerieToTrackingLine(this,e)}getMarkerForLegend(){return!1}get type(){return this._type}getType(){return this._type}set excludedFromLegend(e){this._excludedFromLegend=e}get excludedFromLegend(){return!!this._excludedFromLegend}setDataIndices(e,t){this.categoryIndices=e,this.nbCategories=t}hasErrors(){return!!this.waveform&&this.waveform.hasErrorBars()}}t.default=g,e.exports=t['default']})},function(e,s,n){var l,c,h;(function(t,i){c=[e,s,n(3),n(7),n(0)],l=i,h='function'==typeof l?l.apply(s,c):l,!(void 0!==h&&(e.exports=h))})(this,function(e,s,n,l,c){'use strict';function h(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(s,'__esModule',{value:!0});var x=h(n),m=h(l),y=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(c);const f={lineAt:!1,display:!0,flipped:!1,axisDataSpacing:{min:0.1,max:0.1},unitModification:!1,primaryGrid:!0,secondaryGrid:!0,primaryGridColor:'#f0f0f0',secondaryGridColor:'#f0f0f0',primaryGridWidth:1,secondaryGridWidth:1,hideWhenNoSeriesShown:!1,shiftToZero:!1,tickPosition:1,nbTicksPrimary:3,nbTicksSecondary:10,ticklabelratio:1,exponentialFactor:0,exponentialLabelFactor:0,logScale:!1,forcedMin:!1,forcedMax:!1,span:[0,1],marginMin:0,marginMax:0,scientificScale:!1,scientificScaleExponent:!1,engineeringScale:!1,unitInTicks:!1,unit:!1,unitWrapperBefore:'',unitWrapperAfter:'',splitMarks:!1,tickLabelOffset:0,useKatexForLabel:!1};class b extends m.default{constructor(){super()}init(e,t,i){this.unitModificationTimeTicks=[[1,[1,2,5,10,20,30]],[60,[1,2,5,10,20,30]],[3600,[1,2,6,12]],[86400,[1,2,3,4,5,10,20,40]]],this.graph=e,this.options=y.extend(!0,{},f,i,t),this.group=document.createElementNS(this.graph.ns,'g'),this.hasChanged=!0,this.rectEvent=document.createElementNS(this.graph.ns,'rect'),this.rectEvent.setAttribute('pointer-events','fill'),this.rectEvent.setAttribute('fill','transparent'),this.group.appendChild(this.rectEvent),this.graph.axisGroup.appendChild(this.group),this._lines=[],this.line=document.createElementNS(this.graph.ns,'line'),this.line.setAttribute('stroke','black'),this.line.setAttribute('shape-rendering','crispEdges'),this.line.setAttribute('stroke-linecap','square'),this.groupTicks=document.createElementNS(this.graph.ns,'g'),this.groupTickLabels=document.createElementNS(this.graph.ns,'g'),this.group.appendChild(this.groupTicks),this.group.appendChild(this.groupTickLabels),this.group.appendChild(this.line),this.label=document.createElementNS(this.graph.ns,'text'),this.labelTspan=document.createElementNS(this.graph.ns,'tspan'),this.preunit='',this.unitTspan=document.createElementNS(this.graph.ns,'tspan'),this.expTspan=document.createElementNS(this.graph.ns,'tspan'),this.expTspanExp=document.createElementNS(this.graph.ns,'tspan'),this.label.appendChild(this.labelTspan),this.label.appendChild(this.unitTspan),this.label.appendChild(this.expTspan),this.label.appendChild(this.expTspanExp),this.expTspan.setAttribute('dx',6),this.expTspanExp.setAttribute('dy',-5),this.expTspanExp.setAttribute('font-size','0.8em'),this.label.setAttribute('text-anchor','middle'),this.setTickPosition(this.options.tickPosition),this.gridLinePath={primary:'',secondary:''},this.gridPrimary=document.createElementNS(this.graph.ns,'path'),this.gridSecondary=document.createElementNS(this.graph.ns,'path'),this.graph.groupPrimaryGrids.appendChild(this.gridPrimary),this.graph.groupSecondaryGrids.appendChild(this.gridSecondary),this.setGridLinesStyle(),this.group.appendChild(this.label),this.groupSeries=document.createElementNS(this.graph.ns,'g'),this.group.appendChild(this.groupSeries),this.widthHeightTick=0,this.ticks={},this.ticksLabels=[],this.tickScaling={1:3,2:2,3:1,4:0.5},this.currentTick={},this.lastCurrentTick={},this.series=[],this.totalDelta=0,this.currentAction=!1,this.group.addEventListener('mousemove',(t)=>{t.preventDefault();var e=this.graph._getXY(t);this.handleMouseMoveLocal(e.x,e.y,t);for(var r=0,i=this.series.length;r{t.preventDefault();var e=this.graph._getXY(t);this.addLabel(this.getVal(e.x-this.graph.getPaddingLeft()))}),this.gridPrimary.setAttribute('clip-path','url(#_clipplot'+this.graph._creation+')'),this.gridSecondary.setAttribute('clip-path','url(#_clipplot'+this.graph._creation+')'),this.graph._axisHasChanged(this)}handleMouseMoveLocal(){}hide(){return this.options.display=!1,this}show(){return this.options.display=!0,this}setDisplay(e){return this.options.display=!!e,this}isDisplayed(){return this.options.hideWhenNoSeriesShown?this.graph.getSeriesFromAxis(this).reduce((e,t)=>e||t.isShown(),!1):this.options.display}isShown(){return this.isDisplayed(...arguments)}hideGroup(){this._hidden||(this._hidden=!0,this.group.setAttribute('display','none'))}showGroup(){this._hidden&&(this._hidden=!1,this.group.setAttribute('display','initial'))}kill(e,t){this.graph.killAxis(this,e,t)}setLineAt(e){return this.options.lineAt=e,this}adaptTo(e,t,i,r){return e?(this.options.adaptTo={axis:e,thisValue:t,foreignValue:i,preference:r},this.adapt(),this):(this.options.adaptTo=!1,this)}adapt(){if(this.options.adaptTo){var e=this.options.adaptTo.axis,t=this.options.adaptTo.thisValue,i=this.options.adaptTo.foreignValue;if((void 0===e.currentAxisMin||void 0===e.currentAxisMax)&&e.setMinMaxToFitSeries(),!1!==this.options.forcedMin&&!1==this.options.forcedMax||'max'!==this.options.adaptTo.preference){this.currentAxisMin=!1===this.options.forcedMin?this._zoomed?this.getCurrentMin():this.getMinValue()-(t-this.getMinValue())*(this.options.axisDataSpacing.min*(e.getCurrentMax()-e.getCurrentMin())/(i-e.getCurrentMin())):this.options.forcedMin,this.currentAxisMin==t&&(this.currentAxisMin-=this.options.axisDataSpacing.min*this.getInterval());var r=!1===this.options.forcedMin?this.currentAxisMin:this.options.forcedMin;this.currentAxisMax=(t-r)*(e.getCurrentMax()-e.getCurrentMin())/(i-e.getCurrentMin())+r}else{this.currentAxisMax=!1===this.options.forcedMax?this._zoomed?this.getCurrentMax():this.getMaxValue()+(this.getMaxValue()-t)*(this.options.axisDataSpacing.max*(e.getCurrentMax()-e.getCurrentMin())/(e.getCurrentMax()-i)):this.options.forcedMax,this.currentAxisMax==t&&(this.currentAxisMax+=this.options.axisDataSpacing.max*this.getInterval());var r=!1===this.options.forcedMax?this.currentAxisMax:this.options.forcedMax;this.currentAxisMin=(t-r)*(e.getCurrentMin()-e.getCurrentMax())/(i-e.getCurrentMax())+r}this.graph._axisHasChanged(this)}}setFloating(e,t){return this.floating=!0,this.floatingAxis=e,this.floatingValue=t,this}getFloatingAxis(){return this.floatingAxis}getFloatingValue(){return this.floatingValue}setAxisDataSpacing(e,t){return this.options.axisDataSpacing.min=e,this.options.axisDataSpacing.max=t||e,this}dataSpacing(){return this.setAxisDataSpacing(...arguments)}setAxisDataSpacingMin(e){this.options.axisDataSpacing.min=e}setAxisDataSpacingMax(e){this.options.axisDataSpacing.max=e}setMinPx(e){this.minPx=e,this.setMinMaxFlipped()}setMaxPx(e){this.maxPx=e,this.setMinMaxFlipped()}getMinPx(){return this.minPxFlipped}getMaxPx(){return this.maxPxFlipped}getMathMaxPx(){return this.maxPx}getMathMinPx(){return this.minPx}getMinValue(){return!1===this.options.forcedMin?this.dataMin:this.options.forcedMin}getMaxValue(){return!1===this.options.forcedMax?this.dataMax:this.options.forcedMax}setMinValueData(e){this.dataMin=e,isNaN(this.getCurrentMin())}setMaxValueData(e){this.dataMax=e,isNaN(this.getCurrentMax())}getDataMax(){return this.dataMax}getDataMin(){return this.dataMin}forceMin(e,t=!1){return this.options.forcedMin=e,this.setCurrentMin(t?this.getCurrentMin():void 0),this.graph._axisHasChanged(this),this}forceMax(e,t=!1){return this.options.forcedMax=e,this.setCurrentMax(t?this.getCurrentMax():void 0),this.graph._axisHasChanged(this),this}getForcedMin(){return this.options.forcedMin}getForcedMax(){return this.options.forcedMax}forceToAxis(e){return e.getMaxValue&&e.getMinValue&&(this.options.forcedMin=e.getMinValue(),this.options.forcedMax=e.getMaxValue()),this}getNbTicksPrimary(){return this.options.nbTicksPrimary}setNbTicksPrimary(e){this.options.nbTicksPrimary=e}getNbTicksSecondary(){return this.options.nbTicksSecondary}setNbTicksSecondary(e){return this.options.nbTicksSecondary=e,this}handleMouseMove(e){this.mouseVal=this.getVal(e)}handleMouseWheel(t,i,e){t=d(0.2,o(-0.2,t)),'min'==e?e=this.getMinValue():'max'==e?e=this.getMaxValue():!e&&(e=0),this._doZoomVal((this.getCurrentMax()-e)*(1+t)+e,(this.getCurrentMin()-e)*(1+t)+e),this.graph.draw()}set zoomLock(e){this._zoomLocked=e}get zoomLock(){return this._zoomLocked||!1}zoom(e,t,i){return!i&&this.zoomLock?void 0:this._doZoomVal(e,t,!0)}_doZoomVal(e,t,i){return this._doZoom(this.getPx(e),this.getPx(t),e,t,i)}_doZoom(e,t,i,r,a){var i=void 0===i?this.getVal(e):i,r=void 0===r?this.getVal(t):r;return this.setCurrentMin(d(i,r)),this.setCurrentMax(o(i,r)),this.cacheCurrentMin(),this.cacheCurrentMax(),this.cacheInterval(),this._zoomed=!0,this.adapt(),this._hasChanged=!0,a||this.emit('zoom',[this.currentAxisMin,this.currentAxisMax,this]),this}getSerieShift(){return this._serieShift}getSerieScale(){return this._serieScale}getMouseVal(){return this.mouseVal}getUnitPerTick(e,t,a){var s=e/x;t=t?d(t,e/10):e/10;var n=a/t;switch(this.options.unitModification){case'time':case'time:min.sec':{let e=!1,t,i,r,a;for(t=0,i=this.unitModificationTimeTicks.length;tthis.getForcedMax()||e===void 0))&&(e=this.getMaxValue()),this.currentAxisMax=e,this.options.logScale&&(this.currentAxisMax=o(1e-50,e)),this.cacheCurrentMax(),this.cacheInterval(),this.graph._axisHasChanged(this)}flip(e){return this.options.flipped=e,this.setMinMaxFlipped(),this}isFlipped(){return this.options.flipped}_draw(){var e=this;(void 0===this.currentAxisMin||void 0===this.currentAxisMax)&&this.setMinMaxToFitSeries(!0);var t=g(this.getMaxPx()-this.getMinPx()),r=this.getCurrentInterval();if(!this.isShown())return this.line.setAttribute('display','none'),0;this.line.setAttribute('display','block'),this.scientificExponent=!0==this.options.scientificScale?this.options.scientificScaleExponent?this.options.scientificScaleExponent:p(i(o(g(this.getCurrentMax()),g(this.getCurrentMin())))/2.302585092994046):0,this.gridLinePath.primary='',this.gridLinePath.secondary='';let a;if(!this.options.useKatexForLabel||!this.graph.hasKatexRenderer())this.options.unitDecade&&this.options.unit&&0!==this.scientificExponent&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent))&&(a=this.getExponentGreekLetter(this.scientificExponent))?(this.preunit=a,this.unitTspan.setAttribute('dx',0)):0===this.scientificExponent||isNaN(this.scientificExponent)?(!this.options.unit&&this.unitTspan.setAttribute('display','none'),this.preunit='',this.expTspan.setAttribute('display','none'),this.expTspanExp.setAttribute('display','none')):(this.options.engineeringScale&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent)),this.preunit='',this.expTspan.setAttribute('display','visible'),this.expTspanExp.setAttribute('display','visible'),this.expTspan.textContent='x10',this.expTspanExp.textContent=this.scientificExponent),this.writeUnit();else{let e=this.getLabel();this.options.unitDecade&&this.options.unit&&0!==this.scientificExponent&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent))&&(a=this.getExponentGreekLetter(this.scientificExponent))?(e+=a,this.preunitTspan.innerHTML=a,this.preunitTspan.setAttribute('display','visible'),this.unitTspan.setAttribute('dx',0),e+=' '+a+' '+this.options.unit):0!==this.scientificExponent&&!isNaN(this.scientificExponent)&&(this.options.engineeringScale&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent)),e+=' \\cdot 10^'+this.scientificExponent+' '+this.options.unit),this.katexElement=this.graph.renderWithKatex(e,this.katexElement)}if(!!this.options.hideTicks)var s=0;else if(this.resetTicksLength(),this.linkedToAxis){this.linkedToAxis.deltaPx=10;var s=this.drawLinkedToAxisTicksWrapper(t,r)}else if(!this.options.logScale)var s=this.drawLinearTicksWrapper(t,r);else var s=this.drawLogTicks();this.removeUselessTicks(),this.removeUselessTickLabels(),this.gridPrimary.setAttribute('d',this.gridLinePath.primary),this.gridSecondary.setAttribute('d',this.gridLinePath.secondary);var n=this.graph.findAxesLinkedTo(this);return n.forEach(function(t){t.linkedToAxis&&(t.setMinPx(e.getMinPx()),t.setMaxPx(e.getMaxPx()),t.draw())}),s}drawLines(){this.options.lineAt&&Array.isArray(this.options.lineAt)&&this.options.lineAt.forEach((e,t)=>{!isNaN(e)&&this.getCurrentMin()<=e&&this.getCurrentMax()>=e?this._lines[t]=this._drawLine(e,this._lines[t]):this._hideLine(this._lines[t])})}writeUnit(){this.options.unit?(this.unitTspan.setAttribute('display','visible'),this.unitTspan.setAttribute('dx',5),this.expTspan.setAttribute('display','none'),this.expTspanExp.setAttribute('display','none'),this.unitTspan.innerHTML=(this.options.unitWrapperBefore+this.preunit+this.options.unit+this.options.unitWrapperAfter).replace(/\^([-+0-9]*)(.*)/g,'$1$2')):this.unitTspan.setAttribute('display','none')}getExponentGreekLetter(e){return 3===e?'k':6===e?'M':9===e?'G':12===e?'T':15===e?'E':-3===e?'m':-6===e?'μ':-9===e?'n':-12===e?'p':-15===e?'f':''}drawLinearTicksWrapper(e,t){let i;return this.options.primaryTickUnit?i=this.options.primaryTickUnit:(i=this.getUnitPerTick(e,this.getNbTicksPrimary(),t)[0],this.options.maxPrimaryTickUnit&&this.options.maxPrimaryTickUniti&&(i=this.options.minPrimaryTickUnit)),this.drawTicks(i,this.secondaryTicks())}forcePrimaryTickUnit(e){this.options.primaryTickUnit=e}forcePrimaryTickUnitMax(e){this.options.maxPrimaryTickUnit=e}forcePrimaryTickUnitMin(e){this.options.minPrimaryTickUnit=e}getPrimaryTickUnit(){return this.incrTick}setTickLabelRatio(e){this.options.ticklabelratio=e}doesHideWhenNoSeriesShown(){return this.options.hideWhenNoSeriesShown}draw(){this._widthLabels=0;var e=this._draw();return this._widthLabels+=e,e}drawTicks(e,t){var i=e,r=this.getCurrentMin(),s=this.getCurrentMax(),n=0,o,l,d;for(t&&(o=i/t),l=this.options.shiftToZero?this.dataMin-a((this.dataMin-r)/i)*i:p(r/i)*i,this.incrTick=e;l<=s&&(n++,!(200s){d+=o;continue}this.drawTickWrapper(d,!1,1e-4>g(d-l-i/2)?2:3),d+=o}}if(ls){l+=e;continue}this.drawTickWrapper(l,!0,1),l+=e}return this.widthHeightTick=this.getMaxSizeTick(),this.widthHeightTick}nextTick(e,t){if(this.ticks[e]=this.ticks[e]||[],this.lastCurrentTick[e]=this.lastCurrentTick[e]||0,this.currentTick[e]=this.currentTick[e]||0,this.currentTick[e]>=this.ticks[e].length){var i=document.createElementNS(this.graph.ns,'line');this.groupTicks.appendChild(i),this.ticks[e].push(i),t(i)}var i=this.ticks[e][this.currentTick[e]];return this.currentTick[e]>=this.lastCurrentTick[e]&&i.setAttribute('display','visible'),this.currentTick[e]++,i}nextTickLabel(e){if(this.ticksLabels=this.ticksLabels||[],this.lastCurrentTickLabel=this.lastCurrentTickLabel||0,this.currentTickLabel=this.currentTickLabel||0,this.currentTickLabel>=this.ticksLabels.length){var t=document.createElementNS(this.graph.ns,'text');this.groupTickLabels.appendChild(t),this.ticksLabels.push(t),e(t)}var t=this.ticksLabels[this.currentTickLabel];return this.currentTickLabel>=this.lastCurrentTickLabel&&t.setAttribute('display','visible'),this.currentTickLabel++,t}removeUselessTicks(){for(var e in this.currentTick){for(var t=this.currentTick[e];ta&&(a=1e-50),20a&&(a=0);for(var n=0==a?0:p(i(a)/2.302585092994046),a=1,l;(l=a*r(10,n))e&&this.drawTickWrapper(l,!0,1,s),10==a?(a=1,n++):(1!=a&&l>e&&this.drawTickWrapper(l,!1,2,{overwrite:'',fontSize:'0.6em'}),a++);return this.widthHeightTick=this.getMaxSizeTick(),this.widthHeightTick}drawTickWrapper(e,t,i,r){this.drawTick(e,i,r)}linkToAxis(e,t,i){this.linkedToAxis={axis:e,scalingFunction:t,decimals:i||1}}drawLinkedToAxisTicksWrapper(e,i){var r=this.linkedToAxis,a=0,s,n,o,l;r.deltaPx||(r.deltaPx=10);do{if(s=r.scalingFunction(r.axis.getVal(a+this.getMinPx())),r.decimals&&(this.decimals=r.decimals),n=this.drawTick(s,1,{},a+this.getMinPx()),!n)throw console.error(s,a,this.getMinPx()),new Error('Unable to draw tick. Please report the test-case');if(o=8*(n[1].textContent+'').length,l=5*u(o/5),l>r.deltaPx)return r.deltaPx=l,void this.drawLinkedToAxisTicksWrapper(e,i);a+=r.deltaPx}while(ae)){var e=(i(e)-i(this.getCurrentMin()))/(i(this.getCurrentMax())-i(this.getCurrentMin()))*(this.getMaxPx()-this.getMinPx())+this.getMinPx();return e}}getRoundedPx(e){return u(10*this.getPx(e))/10}getVal(e){return this.options.logScale?t((e-this.getMinPx())/(this.getMaxPx()-this.getMinPx())*(i(this.getCurrentMax())-i(this.getCurrentMin()))+i(this.getCurrentMin())):(e-this.getMinPx())/(this.getMaxPx()-this.getMinPx())*this.getCurrentInterval()+this.getCurrentMin()}getRelPx(e){return e/this.getCurrentInterval()*(this.getMaxPx()-this.getMinPx())}getRelVal(e){return e/(this.getMaxPx()-this.getMinPx())*this.getCurrentInterval()}valueToText(e){if(this.scientificExponent)return e/=r(10,this.scientificExponent),e.toFixed(1);if(e=e*r(10,this.getExponentialFactor())*r(10,this.getExponentialLabelFactor()),this.options.shiftToZero&&(e-=this.dataMin),this.options.ticklabelratio&&(e*=this.options.ticklabelratio),this.options.unitModification)return e=this.modifyUnit(e,this.options.unitModification),e;var t=this.decimals-this.getExponentialFactor()-this.getExponentialLabelFactor();return isNaN(e)?'':(e=0'+this.scientificExponent+''),this.options.unit&&!i&&(r+=this.options.unit.replace(/\^([-+0-9]*)/g,'$1')),r}getModifiedValue(e){return this.options.ticklabelratio&&(e*=this.options.ticklabelratio),this.options.shiftToZero&&(e-=this.getMinValue()*(this.options.ticklabelratio||1)),e}modifyUnit(e,t){var i='',r=this.incrTick,a;switch(t){case'time':var n=this.getModifiedValue(this.getMaxValue()),o=[[60,'min'],[3600,'h'],[86400,'d']];if(3600>n?a=0:86400>n?a=1:2592000>n&&(a=2),!o[a])return!1;e/=o[a][0];var l=p(e);for(i=l+o[a][1],a--;r<1*o[a+1][0]&&-1{t.setAttribute('fill',e)}),this}getTicksLabelColor(){return this.options.ticksLabelColor||'black'}setPrimaryGridColor(e){return this.options.primaryGridColor=e,this.setGridLinesStyle(),this}getPrimaryGridColor(){return this.options.primaryGridColor}setSecondaryGridColor(e){return this.options.secondaryGridColor=e,this.setGridLinesStyle(),this}getSecondaryGridColor(){return this.options.secondaryGridColor}setPrimaryGridWidth(e){return this.options.primaryGridWidth=e,this.setGridLinesStyle(),this}getPrimaryGridWidth(){return this.options.primaryGridWidth}setSecondaryGridWidth(e){return this.options.secondaryGridWidth=e,this.setGridLinesStyle(),this}getSecondaryGridWidth(){return this.options.secondaryGridWidth}setPrimaryGridOpacity(e){return this.options.primaryGridOpacity=e,this}getPrimaryGridOpacity(){return this.options.primaryGridOpacity}setSecondaryGridOpacity(e){return this.options.secondaryGridOpacity=e,this}getSecondaryGridOpacity(){return this.options.secondaryGridOpacity}setPrimaryGridDasharray(e){return this.options.primaryGridDasharray=e,this}getPrimaryGridDasharray(){return this.options.primaryGridDasharray}setSecondaryGridDasharray(e){return this.options.secondaryGridDasharray=e,this}getSecondaryGridDasharray(){return this.options.secondaryGridDasharray}setLabelColor(e){return this.options.labelColor=e,this}getLabelColor(){return this.options.labelColor}setTickContent(e,t,a){if(a||(a={}),a.overwrite||!a.exponential)e.textContent=a.overwrite||this.valueToText(t);else{var s=u(i(t)/2.302585092994046),n=p(t*r(10,-s));e.textContent=1==n?'10':n+'x10';var o=document.createElementNS(this.graph.ns,'tspan');o.textContent=s,o.setAttribute('font-size','0.7em'),o.setAttribute('dy',-5),e.appendChild(o)}a.fontSize&&e.setAttribute('font-size',a.fontSize)}isX(){return!1}isY(){return!1}setUnit(e){return this.options.unit=e,this}setUnitInTicks(e){return this.options.unitInTicks=e,this}setUnitWrapper(e,t){return this.options.unitWrapperBefore=e,this.options.unitWrapperAfter=t,this}setUnitDecade(e){return this.options.unitDecade=e,this}setScientific(e){return this.options.scientificScale=e,this}setScientificScaleExponent(e){return this.options.scientificScaleExponent=e,this}setEngineering(e){return this.options.scientificScale=e,this.options.engineeringScale=e,this}getEngineeringExponent(e){return e-=0{e.dom=document.createElementNS(this.graph.ns,'path'),e.dom.setAttribute('fill',e.fillColor||'none'),e.dom.setAttribute('stroke',e.strokeColor||'black'),e.dom.setAttribute('stroke-opacity',e.strokeOpacity||1),e.dom.setAttribute('fill-opacity',e.fillOpacity||1),e.dom.setAttribute('stroke-width',e.strokeWidth||1),this.groupMain.appendChild(e.dom)},t={};'string'==typeof e&&(e={});for(var s=0,n=i.length;s=o;o++)e[i[s][o]]&&(t[i[s][o]]=e[i[s][o]],a(t[i[s][o]]))}return t},errorDrawInit:function(){this.errorboxStyle&&(this.errorboxStyle.paths={top:'',bottom:'',left:'',right:''}),this.errorbarStyle&&(this.errorbarStyle.paths={top:'',bottom:'',left:'',right:''})},errorAddPoint:function(e,t,i,r,a){let s;(s=this.waveform.getErrorBarXBelow(e))&&(this.errorbarStyle.paths.left+=' M '+r+' '+a,this.errorbarStyle.paths.left+=this.makeBarX(this.getX(t-s),r,this.errorbarStyle.left)),(s=this.waveform.getErrorBarXAbove(e))&&(this.errorbarStyle.paths.right+=' M '+r+' '+a,this.errorbarStyle.paths.right+=this.makeBarX(this.getX(t+s),r,this.errorbarStyle.right)),(s=this.waveform.getErrorBarYBelow(e))&&(this.errorbarStyle.paths.bottom+=' M '+r+' '+a,this.errorbarStyle.paths.bottom+=this.makeBarY(this.getY(i-s),a,this.errorbarStyle.bottom)),(s=this.waveform.getErrorBarYAbove(e))&&(this.errorbarStyle.paths.top+=' M '+r+' '+a,this.errorbarStyle.paths.top+=this.makeBarY(this.getY(i+s),a,this.errorbarStyle.top)),(s=this.waveform.getErrorBoxXBelow(e))&&(this.errorboxStyle.paths.left+=' M '+r+' '+a,this.errorboxStyle.paths.left+=this.makeBoxX(this.getX(t-s),r,this.errorboxStyle.left)),(s=this.waveform.getErrorBoxXAbove(e))&&(this.errorboxStyle.paths.right+=' M '+r+' '+a,this.errorboxStyle.paths.right+=this.makeBoxX(this.getX(t+s),r,this.errorboxStyle.right)),(s=this.waveform.getErrorBoxYBelow(e))&&(this.errorboxStyle.paths.bottom+=' M '+r+' '+a,this.errorboxStyle.paths.bottom+=this.makeBoxY(this.getY(i-s),a,this.errorboxStyle.bottom)),(s=this.waveform.getErrorBoxYAbove(e))&&(this.errorboxStyle.paths.top+=' M '+r+' '+a,this.errorboxStyle.paths.top+=this.makeBoxY(this.getY(i+s),a,this.errorboxStyle.top))},errorAddPointBarChart:function(e,t,i,r){var a;this.error&&(a=this.error[e])&&this.doErrorDraw('y',a,t,r,i,r)},errorDraw:function(){if(this.errorbarStyle)for(var e in this.errorbarStyle.paths)this.errorbarStyle[e]&&this.errorbarStyle[e].dom&&this.errorbarStyle[e].dom.setAttribute('d',this.errorbarStyle.paths[e]);if(this.errorboxStyle)for(var e in this.errorboxStyle.paths)this.errorboxStyle[e]&&this.errorboxStyle[e].dom&&this.errorboxStyle[e].dom.setAttribute('d',this.errorboxStyle.paths[e])}};t.default=a,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(9)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{constructor(e,t,i={}){super(e,t,i),this.top='top'==t}getAxisPosition(){if(!this.options.display)return 0;let e;return 0==this.options.tickLabelOffset?(e=1==this.options.tickPosition?8:20,e+=1*this.graph.options.fontSize):e=1==this.options.tickPosition?0:12,this.getLabel()&&(e+=this.graph.options.fontSize),e}isX(){return!0}isY(){return!1}setShift(e){this.shift=e;void 0!==this.getShift()&&this.graph.getDrawingHeight()&&this.group.setAttribute('transform','translate(0 '+(this.floating?this.getShift():this.top?this.shift:this.graph.getDrawingHeight()-this.shift)+')')}getMaxSizeTick(){return(this.top?-1:1)*(1==this.options.tickPosition?10:10)}drawTick(e,t,i,r){var a=this,s;if(s=r||this.getPos(e),!(void 0==s||isNaN(s))){var n=this.nextTick(t,function(e){e.setAttribute('y1',(a.top?1:-1)*a.tickPx1*a.tickScaling[t]),e.setAttribute('y2',(a.top?1:-1)*a.tickPx2*a.tickScaling[t]),1==t?e.setAttribute('stroke',a.getPrimaryTicksColor()):e.setAttribute('stroke',a.getSecondaryTicksColor())});if(n.setAttribute('x1',s),n.setAttribute('x2',s),this.nextGridLine(1==t,s,s,0,this.graph.getDrawingHeight()),1==t){var o=this.nextTickLabel((e)=>{e.setAttribute('y',(a.top?-1:1)*((1==a.options.tickPosition?8:20)+(a.top?10:0))+this.options.tickLabelOffset),e.setAttribute('text-anchor','middle'),'black'!==a.getTicksLabelColor()&&e.setAttribute('fill',a.getTicksLabelColor()),e.style.dominantBaseline='hanging'});o.setAttribute('x',s),this.setTickContent(o,e,i)}return[n,o]}}drawLabel(){'black'!==this.getLabelColor()&&this.label.setAttribute('fill',this.getLabelColor()),this.options.labelFont&&this.label.setAttribute('font-family',this.options.labelFont),this.label.setAttribute('text-anchor','middle'),this.label.setAttribute('style','display: initial;'),this.label.setAttribute('x',g(this.getMaxPx()+this.getMinPx())/2),this.label.setAttribute('y',(this.top?-1:1)*((1==this.options.tickPosition?10:25)+this.graph.options.fontSize)),this.labelTspan.textContent=this.getLabel()}draw(){var e=super.draw(...arguments);return this.drawSpecifics(),e}drawSpecifics(){this.drawLabel(),this.line.setAttribute('x1',this.getMinPx()),this.line.setAttribute('x2',this.getMaxPx()),this.line.setAttribute('y1',0),this.line.setAttribute('y2',0),this.line.setAttribute('stroke',this.getAxisColor()),this.top||(this.labelTspan.style.dominantBaseline='hanging',this.expTspan.style.dominantBaseline='hanging',this.expTspanExp.style.dominantBaseline='hanging',this.unitTspan.style.dominantBaseline='hanging');var e=this.getSpan();this.line.setAttribute('marker-start',this.options.splitMarks&&0!=e[0]?'url(#horionzalsplit_'+this.graph.getId()+')':''),this.line.setAttribute('marker-end',this.options.splitMarks&&1!=e[1]?'url(#horionzalsplit_'+this.graph.getId()+')':'')}_drawLine(e,t){let i=this.getPx(e);return t?t.setAttribute('display','initial'):t=document.createElementNS(this.graph.ns,'line'),t.setAttribute('x1',i),t.setAttribute('x2',i),t.setAttribute('y1',0),t.setAttribute('y2',this.graph.drawingSpaceHeight),t.setAttribute('stroke','black'),this.group.appendChild(t),t}_hideLine(e){e&&e.setAttribute('display','none')}handleMouseMoveLocal(e){e-=this.graph.getPaddingLeft(),this.mouseVal=this.getVal(e)}setMinMaxFlipped(){var e=this.maxPx-this.minPx;if(!isNaN(e)){var t=e*this.options.span[1]+this.minPx-this.options.marginMax,i=e*this.options.span[0]+this.minPx+this.options.marginMin;this.minPxFlipped=this.isFlipped()?t:i,this.maxPxFlipped=this.isFlipped()?i:t}}getZProj(e){return e*this.graph.options.zAxis.shiftX}}t.default=a,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(1)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{constructor(e,t){super(e,t)}createDom(){this._dom=document.createElementNS(this.graph.ns,'line'),this.getStrokeColor()||this.setStrokeColor('black'),this.getStrokeWidth()||this.setStrokeWidth(1)}createHandles(){this._createHandles(2,'rect',{transform:'translate(-3 -3)',width:6,height:6,stroke:'black',fill:'white',cursor:'nwse-resize'})}applyPosition(){var e=this.calculatePosition(0),t=this.calculatePosition(1);if(e&&e.x&&e.y)return this.setDom('x2',e.x),this.setDom('y2',e.y),this.setDom('y1',t.y),this.setDom('x1',t.x),this.currentPos2x=t.x,this.currentPos2y=t.y,this.currentPos1x=e.x,this.currentPos1y=e.y,!0}handleMouseMoveImpl(t,e,i){if(!this.isLocked()){var r=this.getPosition(0),a=this.getPosition(1),s;if(1==this.handleSelected?s=r:2==this.handleSelected&&(s=a),s&&(!this._data.vertical&&s.deltaPosition('x',e,this.getXAxis()),!this._data.horizontal&&s.deltaPosition('y',i,this.getYAxis())),this.moving&&(console.log(this._data),r.x&&!this._data.noX&&r.deltaPosition('x',e,this.getXAxis()),r.y&&!this._data.noY&&r.deltaPosition('y',i,this.getYAxis()),a.x&&!this._data.noX&&a.deltaPosition('x',e,this.getXAxis()),a.y&&!this._data.noY&&a.deltaPosition('y',i,this.getYAxis())),this._data.forcedCoords){var n=this._data.forcedCoords;void 0!==n.y&&('function'==typeof n.y?a.y=r.y=n.y(this):(a.y=n.y,r.y=n.y)),void 0!==n.x&&('function'==typeof n.x?a.x=r.x=n.x(this):(a.x=n.x,r.x=n.x))}return this.rectEvent&&this.setEventReceptacle(),this.redraw(),this.changed(),this.setHandles(),!0}}setHandles(){!this.areHandlesInDom()||isNaN(this.currentPos1x)||(this.handles[1].setAttribute('x',this.currentPos1x),this.handles[1].setAttribute('y',this.currentPos1y),this.handles[2].setAttribute('x',this.currentPos2x),this.handles[2].setAttribute('y',this.currentPos2y))}setEventReceptacle(){this.currentPos1x&&(!this.rectEvent&&(this.rectEvent=document.createElementNS(this.graph.ns,'line'),this.rectEvent.setAttribute('pointer-events','stroke'),this.rectEvent.setAttribute('stroke','transparent'),this.rectEvent.jsGraphIsShape=this,this.group.appendChild(this.rectEvent)),this.rectEvent.setAttribute('x1',this.currentPos1x),this.rectEvent.setAttribute('y1',this.currentPos1y),this.rectEvent.setAttribute('x2',this.currentPos2x),this.rectEvent.setAttribute('y2',this.currentPos2y),this.rectEvent.setAttribute('stroke-width',this.getProp('strokeWidth')+2))}}t.default=a,e.exports=t['default']})},function(e,t){var i,r,a;(function(s,n){r=[e,t],i=n,a='function'==typeof i?i.apply(t,r):i,!(void 0!==a&&(e.exports=a))})(this,function(e,t){'use strict';Object.defineProperty(t,'__esModule',{value:!0});class i{constructor(e,t,i,r){this.LMITER=100,this.LMBOOST=2,this.LMSHRINK=0.1,this.LAMBDAZERO=1e-3,this.LAMBDAMAX=1E9,this.LMTOL=1e-12,this.BIGVAL=9e99,this.sos,this.sosprev,this.lambda,this.myH=null,this.nadj=0,this.npts=0,this.delta,this.beta,this.alpha,this.amatrix,this.myH=e,this.nadj=t,this.npts=i,this.delta=Array(this.nadj).fill(0),this.beta=Array(this.nadj).fill(0),this.alpha=Array(this.nadj).fill(0),this.amatrix=Array(this.nadj).fill(0),this.alpha=this.alpha.map(()=>Array(this.nadj)),this.amatrix=this.amatrix.map(()=>Array(this.nadj)),this.lambda=this.LAMBDAZERO;var a=0,s=!1;do s=this.bLMiter(),r&&r(this.myH.params),a++;while(!s&&a=r){this.lambda*=this.LMSHRINK;break}for(var a=0;a-this.LMTOL||this.lambda>this.LAMBDAMAX}gaussj(e,t){var r=1,a=Array(100),s=Array(100),n,o,l,i,d,p;for(d=0;dd)for(i=0;id)for(l=0;ld)for(l=0;ld)for(i=0;i'function'==typeof e?e(this.data,this.dataX):e),this.NPARMS=e.length}setSubset(e,t){e!==void 0&&t!==void 0&&(this._from=e,this._to=t)}hookIteration(e){this._hookIteration=(t)=>{let i=this.buildFit(t,200);e(i)}}setFunction(e){this._func=e}init(){if(void 0!==this._from&&void 0!==this._to){if(this._from>=this._to)throw'Impossible to fit negative subranges. The starting index must be lower than the ending index';if(this.NPTS=this._to-this._from+1,this.data&&this.data.getLength()<=this._to)throw'Wave Y has not enough point to be fitted to subrange ['+this._from+', '+this._to+']';if(0>this._from)throw'Impossible to fit a subrange with negative indices'}else this.NPTS=this.data.getLength(),this._from=0,this._to=this.data.getLength()-1;if(this.dataX&&this.dataX.getLength()<=this._to)throw'Wave X has not enough point to be fitted to subrange ['+this._from+', '+this._to+']';this.arrY=this.data.getDataY(),this.arrX=this.dataX?this.dataX.getDataY():this.data.getDataX(),this.resid=Array(this.NPTS).fill(0),this.jac=Array(this.NPTS).fill(0),this.jac=this.jac.map(()=>Array(this.NPARMS))}fit(){return this.log('Starting the fit with initial parameter list {'+this.parms.join()+'};'),new i(this,this.NPARMS,this.NPTS,this._hookIteration),this.log('Fit successful. Output parameters {'+this.parms.join()+'};'),this._result=this.buildFit(this.parms,200),this.options.done&&this.options.done(this.parms,this._result),this._result}func(e,t){return this._func(e,t)}computeResiduals(){for(var e=0,t=0;ta*(i-e)/(t-1)+e)}for(var a=Array(r.length),s=0,i=r.length;s{e.setAttribute('x1',(this.left?1:-1)*this.tickPx1*this.tickScaling[t]),e.setAttribute('x2',(this.left?1:-1)*this.tickPx2*this.tickScaling[t]),1==t?e.setAttribute('stroke',this.getPrimaryTicksColor()):e.setAttribute('stroke',this.getSecondaryTicksColor())}),s.setAttribute('y1',a),s.setAttribute('y2',a),this.nextGridLine(1==t,0,this.graph.getDrawingWidth(),a,a),1==t&&(n=this.nextTickLabel((e)=>{e.setAttribute('x',this.tickMargin+this.options.tickLabelOffset),'black'!==this.getTicksLabelColor()&&e.setAttribute('fill',this.getTicksLabelColor()),this.left?e.setAttribute('text-anchor','end'):e.setAttribute('text-anchor','start'),e.style.dominantBaseline='central'}),n.setAttribute('y',a),this.setTickContent(n,e,i),(n.textContent+'').length>=this.longestTick[1]&&(this.longestTick[0]=n,this.longestTick[1]=(n.textContent+'').length)))}drawLabel(){'black'!==this.getLabelColor()&&this.label.setAttribute('fill',this.getLabelColor()),this.label.setAttribute('dominant-baseline',this.left?'auto':'auto'),this.labelTspan.textContent=this.getLabel()}placeLabel(e){this.label.setAttribute('transform','translate('+e+', '+g(this.getMaxPx()+this.getMinPx())/2+') rotate(-90)')}drawSpecifics(){this.line.setAttribute('y1',this.getMinPx()),this.line.setAttribute('y2',this.getMaxPx()),this.line.setAttribute('x1',0),this.line.setAttribute('x2',0),this.line.setAttribute('stroke',this.getAxisColor());var e=this.getSpan();this.line.setAttribute('marker-start',this.options.splitMarks&&0!=e[0]?'url(#verticalsplit_'+this.graph.getId()+')':''),this.line.setAttribute('marker-end',this.options.splitMarks&&1!=e[1]?'url(#verticalsplit_'+this.graph.getId()+')':'')}setShift(e){if(this.shift=e,!this.shift||!this.graph.getWidth())return;let t=this.shift;t=this.floating?t:this.isLeft()?t:this.graph.getWidth()-this.graph.getPaddingRight()-this.graph.getPaddingLeft()-t,this.group.setAttribute('transform','translate( '+t+' 0 )'),this.drawLabel()}isLeft(){return this.left}isRight(){return!this.left}isFlipped(){return!this.options.flipped}_drawLine(e,t){let i=this.getPx(e);return t?t.setAttribute('display','initial'):t=document.createElementNS(this.graph.ns,'line'),t.setAttribute('y1',i),t.setAttribute('y2',i),t.setAttribute('x1',0),t.setAttribute('x2',this.graph.drawingSpaceWidth),t.setAttribute('stroke','black'),this.group.appendChild(t),t}_hideLine(e){e&&e.setAttribute('display','none')}handleMouseMoveLocal(e,t){t-=this.graph.getPaddingTop(),this.mouseVal=this.getVal(t)}scaleToFitAxis(e,t,r,a,s,n){e&&e.isX()||(e=this.graph.getXAxis()),isNaN(r)&&(r=e.getCurrentMin()),isNaN(a)&&(a=e.getCurrentMax()),s===void 0&&(s=!0),n===void 0&&(n=!0),'number'==typeof t&&(a=r,r=t,t=!1);for(var p=-Infinity,g=Infinity,u=0,c=0,i=this.graph.series.length;c{var e=parseInt(t.target.parentElement.getAttribute('data-shapeid'));this.emit('mouseover',e,this.waveform.getX(e),this.waveform.getY(e))}),this.groupPoints.addEventListener('mouseout',(t)=>{var e=parseInt(t.target.parentElement.getAttribute('data-shapeid'));this.emit('mouseout',e,this.waveform.getX(e),this.waveform.getY(e))}),this.minX=e,this.minY=e,this.maxX=t,this.maxY=t,this.groupMain.appendChild(this.groupPoints),this.currentAction=!1,this.initExtended1&&this.initExtended1(),this.styles={},this.styles.unselected={},this.styles.selected={},this.styles.unselected.default={shape:'circle',cx:0,cy:0,r:3,stroke:'transparent',fill:'black'},this.styles.selected.default={shape:'circle',cx:0,cy:0,r:4,stroke:'transparent',fill:'black'}}setDataCategory(e){let t=+Infinity,i=-Infinity;for(let t of e)this._checkY(t.y.getMaxY()),this._checkY(t.y.getMinY());return this.data=e,this.dataHasChanged(),this.graph.updateDataMinMaxAxes(),this}empty(){for(;this.groupPoints.firstChild;)this.groupPoints.removeChild(this.groupPoints.firstChild)}getSymbolForLegend(){if(this.symbol)return this.symbol;var e=document.createElementNS(this.graph.ns,'g');e.setAttribute('data-shapeid',-1);var t=this.doShape(e,this.styles.unselected.default),r=this.getStyle('unselected',-1,!0);for(var a in r[-1])'shape'!=a&&t.setAttribute(a,r[-1][a]);return e}setStyle(e,t,i='unselected'){return'string'==typeof t&&(i=t,t=!1),this.styles[i]=this.styles[i]||{},this.styles[i].all=e,this.styles[i].modifiers=t,this.styleHasChanged(i),this}draw(e){if(e||this.hasDataChanged()||this.hasStyleChanged('unselected')){var t=0,i='category'==this.getXAxis().getType(),r,a,s;this._drawn=!0,this.dataHasChanged(!1),this.styleHasChanged(!1),this.groupMain.removeChild(this.groupPoints);var o=[];if(t=0,s=0,this.hasErrors()&&this.errorDrawInit(),i){for(let e=0;tthis.getXAxis().getCurrentMax()||this.waveform.getY(t)this.getYAxis().getCurrentMax()){this.shapes[t]&&this.shapes[t].setAttribute('display','none');continue}this.shapes[t]&&this.shapes[t].setAttribute('display','initial'),r=this.getX(this.waveform.getX(t)),a=this.getY(this.waveform.getY(t)),this.hasErrors()&&this.errorAddPoint(t,this.waveform.getX(t),this.waveform.getY(t),r,a),this.shapesDetails[t]=this.shapesDetails[t]||[],this.shapesDetails[t][0]=r,this.shapesDetails[t][1]=a,o.push(t)}this.hasErrors()&&this.errorDraw(),this.applyStyle('unselected',o),this.groupMain.appendChild(this.groupPoints)}}_addPoint(e,t,i){let r=document.createElementNS(this.graph.ns,'g'),a;r.setAttribute('transform','translate('+e+', '+t+')'),r.setAttribute('data-shapeid',i),a=this.extraStyle&&this.extraStyle[i]?this.doShape(r,this.extraStyle[i]):this.stdStylePerso?this.doShape(r,this.stdStylePerso):this.doShape(r,this.stdStyle),this.shapes[i]=a,this.groupPoints.appendChild(r)}doShape(e,t){var i=document.createElementNS(this.graph.ns,t.shape);return e.appendChild(i),i}getStyle(e,t,r){var e=e||'unselected',a={},s;'number'==typeof t?s=[t]:Array.isArray(t)&&(s=t);var n,t,o,d,p;this.styles[e].all!==void 0&&(p=this.styles[e].all,'function'==typeof p?p=p():!1===p&&(p={}));for(var u=0,i=s.length;ue.x):[]}}l.mix(p,d.default),i.default=p,t.exports=i['default']})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(8),i(4),i(0)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r,a){'use strict';function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,'__esModule',{value:!0});var n=s(i),l=s(r);class p extends n.default{static default(){return{fillColor:'rgba( 0, 0, 0, 0.1 )',lineColor:'rgba( 0, 0, 0, 1 )',lineWidth:'1px'}}constructor(){super(...arguments),this.selectionType='unselected',this.id=(0,a.guid)(),this.groupZones=document.createElementNS(this.graph.ns,'g'),this.groupMain=document.createElementNS(this.graph.ns,'g'),this.lineZone=document.createElementNS(this.graph.ns,'path'),this.lineZone.setAttribute('stroke','black'),this.lineZone.setAttribute('stroke-width','1px'),this.groupMain.appendChild(this.groupZones),this.groupZones.appendChild(this.lineZone),this.applyLineStyle(this.lineZone),this.styleHasChanged(),this.clip=document.createElementNS(this.graph.ns,'clipPath'),this.clipId=(0,a.guid)(),this.clip.setAttribute('id',this.clipId),this.graph.defs.appendChild(this.clip)}setWaveform(...e){return this.waveforms=e,this.waveforms=this.waveforms.map((e)=>e instanceof l.default?e:new l.default(e)),this.minX=this.waveforms[0].getXMin(),this.maxX=this.waveforms[0].getXMax(),this.minY=this.waveforms[0].getMin(),this.maxY=this.waveforms[0].getMax(),this.waveforms.map((e)=>{this.minX=d(e.getXMin(),this.minX),this.maxX=o(e.getXMin(),this.maxX),this.minY=d(e.getMin(),this.minY),this.maxY=o(e.getMax(),this.maxY)}),this.graph.updateDataMinMaxAxes(),this.dataHasChanged(),this}setWaveforms(){return this.setWaveform(...arguments)}getWaveforms(){return this.waveforms}setMinMaxWaveforms(e,t){return this.waveforms=[e,t.reverse()],this}empty(){for(;this.group.firstChild;)this.group.removeChild(this.group.firstChild)}draw(e){if(e||this.hasDataChanged()){if(!this.waveforms)return;let e=0,t=0,i=0,r=0,a=0,s='',n=!1,o;const l=this.getXAxis().getMinPx(),d=this.getXAxis().getMaxPx(),p=this.getYAxis().getMinPx(),g=this.getYAxis().getMaxPx(),u=this.getXAxis().getCurrentMin(),c=this.getXAxis().getCurrentMax(),h=this.getYAxis().getCurrentMin(),x=this.getYAxis().getCurrentMax();this.groupMain.removeChild(this.groupZones);for(let l of this.waveforms)for(a=0;ax&&(r=this.getY(x)),e===e){if(t!==t){if(0==s.length)continue;s+='L '+i+', '+this.getY(l.getMinY()),n=!0;continue}if(r=this.getY(t),i=this.getX(e),ec){o=[e,t[a],i,r];continue}n&&(s+=' M '+i+', '+this.getY(l.getMinY())+' ',n=!1),0'),r=n.SVGParser('');this.svg.appendChild(document.adoptNode(r.documentElement.firstChild)),this.svg.appendChild(document.adoptNode(i.documentElement.firstChild)),this.svg.appendChild(this.subG),this.applyStyle()}setPosition(e,t,i){e&&(this.position=e,this.alignToX=t||'left',this.alignToY=i||'top')}setDraggable(e){this.options.movable=e}setAutoPosition(e){return-1<['bottom','left','top','right'].indexOf(e=e.toLowerCase())?(this.autoPosition=e,this):void(this.requireDelayedUpdate(),this.autoPosition=!1)}autoPosition(){return this.setAutoPosition(...arguments)}buildLegendBox(){var e=this.series||this.graph.getSeries(),t=0,r=this.options.paddingTop;this.autoPosition?this.graph.getDom().appendChild(this.getDom()):this.graph.graphingZone.appendChild(this.getDom());for(var s=0,i=e.length;sthis.graph.getDrawingWidth()-this.options.paddingRight&&(r+=16,t=0)}this.groups[s].setAttribute('transform','translate( '+t+', '+r+')'),'bottom'==this.autoPosition||'top'==this.autoPosition?(t+=n.width+10,r+=0):(t=0,r+=16)}var n=a(this.subG);switch(this.width=n.width+this.options.paddingRight+this.options.paddingLeft,this.height=n.height+this.options.paddingBottom+this.options.paddingTop,this.rect.setAttribute('width',this.width),this.rect.setAttribute('height',this.height),this.rect.setAttribute('fill','none'),this.rect.setAttribute('pointer-events','fill'),this.rect.setAttribute('display','none'),this.options.movable&&(this.rectBottom.style.cursor='move'),this.rectBottom.setAttribute('width',this.width),this.rectBottom.setAttribute('height',this.height),this.rectBottom.setAttribute('x',n.x-this.options.paddingLeft),this.rectBottom.setAttribute('y',n.y-this.options.paddingTop),this.position=this.position||{},this.autoPosition){case'bottom':this.position.y=this.graph.getHeight()+'px',this.position.x=(this.graph.drawingSpaceWidth-this.width)/2+this.graph.drawingSpaceMinX+'px',this.alignToY='bottom',this.alignToX=!1;break;case'left':this.position.x='6px',this.position.y=(this.graph.getHeight()-this.height)/2+'px',this.alignToX='left',this.alignToY=!1;break;case'right':this.position.x=this.graph.getWidth()+'px',this.position.y=(this.graph.getHeight()-this.height)/2+'px',this.alignToX='right',this.alignToY=!1;break;case'top':this.position.x=(this.graph.drawingSpaceWidth-this.width)/2+this.graph.drawingSpaceMinX+'px',this.position.y='10px',this.alignToY='top',this.alignToX=!1;}if(this.autoPosition){switch(this.autoPosition){case'bottom':this.graph.options.paddingBottom=this.height+10;break;case'left':this.graph.options.paddingLeft=this.width+5;break;case'right':this.graph.options.paddingRight=this.width+10;break;case'top':this.graph.options.paddingTop=this.height+14;}this.graph.updateGraphingZone(),this.graph.getDrawingHeight(),this.graph.getDrawingWidth()}this.bbox=n}calculatePosition(){var e=s.default.check(this.position);let t=e.compute(this.graph,this.graph.getXAxis(),this.graph.getYAxis());t&&('max'==e.y&&(t.y+=this.graph.getPaddingTop()),'max'==e.x&&(t.x-=this.graph.getPaddingRight()),'right'==this.alignToX&&(t.x-=this.width,t.x-=this.bbox.x),'bottom'==this.alignToY?(t.y-=this.height,t.y-=this.bbox.y):t.y-=this.bbox.y,this.pos.transformX=t.x,this.pos.transformY=t.y,this._setPosition())}update(e){if(!(this.graph.isDelayedUpdate()||!this._requiredUpdate&&e)){this._requiredUpdate=!1;var t=this;for(this.applyStyle();this.subG.hasChildNodes();)this.subG.removeChild(this.subG.lastChild);this.svg.insertBefore(this.rectBottom,this.svg.firstChild);var r=this.series||this.graph.getSeries();if(0{let r=i.getUsedCategories();for(let a of r)e.hasOwnProperty(a)||(e[a]=1,t+=1),e[a]++,t++});let r=0;for(let t in e){let i=e[t];e[t]=r,r+=i}let i={};Array.prototype.map.call(this.series,(r)=>{let a=r.getUsedCategories(),s={};a.forEach((r)=>{i[r]=i[r]||0.5,s[r]=(e[r]+i[r])/t,i[r]++}),r.setDataIndices(s,t)})}getType(){return'category'}}t.default=a,e.exports=t['default']})},function(e,t,i){var r,s,n;(function(a,o){s=[e,t,i(9),i(0)],r=o,n='function'==typeof r?r.apply(t,s):r,!(void 0!==n&&(e.exports=n))})(this,function(e,t,i,r){'use strict';function s(e,t){return u(e/t)*t}function n(e,t){switch(t.unit){case's':e.setSeconds(s(e.getSeconds(),t.increment)),e.setMilliseconds(0);break;case'i':e.setMinutes(s(e.getMinutes(),t.increment)),e.setSeconds(0),e.setMilliseconds(0);break;case'h':e.setHours(s(e.getHours(),t.increment)),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0);break;case'd':e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e.setHours(0),e.setDate(s(e.getDate(),t.increment));break;case'm':e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e.setHours(0),e.setDate(1),e.setMonth(s(e.getMonth(),t.increment));break;case'y':e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e.setHours(0),e.setDate(1),e.setMonth(0);break;default:throw new Error('Date format not recognized');}return e}function l(e,t){switch(t.unit){case's':e.setSeconds(e.getSeconds()+t.increment),e.setMilliseconds(0);break;case'i':e.setMinutes(e.getMinutes()+t.increment),e.setSeconds(0),e.setMilliseconds(0);break;case'h':e.setHours(e.getHours()+t.increment),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0);break;case'd':e.setDate(e.getDate()+t.increment),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e.setHours(0);break;case'm':e.setMonth(e.getMonth()+t.increment),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e.setHours(0),e.setDate(1);break;case'y':e.setFullYear(e.getFullYear()+t.increment),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e.setHours(0),e.setDate(1),e.setMonth(0);break;default:throw new Error('Date format not recognized');}return e}function c(e,t,i){if(e.groups[t][i])return e.groups[t][i].group.setAttribute('display','block'),e.groups[t][i];var r={group:document.createElementNS(e.graph.ns,'g'),text:document.createElementNS(e.graph.ns,'text')},a=document.createElementNS(e.graph.ns,'line');switch(a.setAttribute('stroke','black'),a.setAttribute('y1',0),t){case 2:a.setAttribute('y2',6),r.text.setAttribute('y',15),r.line=a,r.group.appendChild(r.line);break;default:case 1:a.setAttribute('y2',20),r.text.setAttribute('y',10),r.line1=a,r.line2=a.cloneNode(),r.group.appendChild(r.line1),r.group.appendChild(r.line2);}return r.text.setAttribute('text-anchor','middle'),r.text.setAttribute('dominant-baseline','middle'),r.group.appendChild(r.text),e.getWrapper(t).appendChild(r.group),e.groups[t][i]=r}function h(e,t,i){for(;ia)return void x(t);t.line.setAttribute('x1',s),t.line.setAttribute('x2',s),t.text.setAttribute('x',s),t.text.textContent=i;break;default:case 1:var l=o(r,d(a,s)),p=o(r,d(a,n));if(isNaN(p)||isNaN(l))return;for(t.line1.setAttribute('x1',l),t.line2.setAttribute('x1',p),t.line1.setAttribute('x2',l),t.line2.setAttribute('x2',p),t.text.setAttribute('x',(l+p)/2);8*i.length>p-l;)if(i=i.substr(0,i.length-2)+'.',1==i.length){i='';break}t.text.textContent=i;}}Object.defineProperty(t,'__esModule',{value:!0});var f=function(e){return e&&e.__esModule?e:{default:e}}(i),b=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(r),A=[{threshold:20,increments:{1:{increment:1,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:1,unit:'s',format:'MM:ss"s"'}}},{threshold:50,increments:{1:{increment:1,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:2,unit:'s',format:'MM:ss"s"'}}},{threshold:100,increments:{1:{increment:1,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:5,unit:'s',format:'MM:ss"s"'}}},{threshold:600,increments:{1:{increment:10,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:30,unit:'s',format:'MM:ss"s"'}}},{threshold:1e3,increments:{1:{increment:1,unit:'h',format:'HH"h"MM (dd/mm/yy)'},2:{increment:10,unit:'i',format:'MM"min"'}}},{threshold:1500,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:1,unit:'i',format:'H"h"MM'}}},{threshold:3e3,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:2,unit:'i',format:'H"h"MM'}}},{threshold:8e3,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:10,unit:'i',format:'H"h"MM'}}},{threshold:26400,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:20,unit:'i',format:'H"h"MM'}}},{threshold:86400,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:1,unit:'h',format:'H"h"MM'}}},{threshold:2e5,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:2,unit:'h',format:'H"h"MM'}}},{threshold:4e5,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:6,unit:'h',format:'H"h"MM'}}},{threshold:1.4e6,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:12,unit:'h',format:'HH"h"MM'}}},{threshold:6.4e6,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:1,unit:'d',format:'dd'}}},{threshold:1.24e7,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:2,unit:'d',format:'dd'}}},{threshold:43200000,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:7,unit:'d',format:'dd'}}},{threshold:69120000,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:15,unit:'d',format:'dd'}}},{threshold:86400000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:3,unit:'m',format:'mm/yyyy'}}},{threshold:172800000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:4,unit:'m',format:'mm/yyyy'}}},{threshold:864000000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:6,unit:'m',format:'mm/yyyy'}}},{threshold:1036800000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:1,unit:'y',format:'yyyy'}}}],k=function(){var e=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[WLloSZ]|"[^"]*"|'[^']*'/g,t=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,i=/[^-+\dA-Z]/g,r=function(e,t){for(e+='',t=t||2;e.lengthS?'a':'p',tt:12>S?'am':'pm',T:12>S?'A':'P',TT:12>S?'AM':'PM',Z:c?'UTC':((a+'').match(t)||['']).pop().replace(i,''),o:(0t/e){s=A[k];break}s||(s=A[A.length-1]);var o=0,d,p,g,u,x,f,k;for(o=1;2>=o;o++){if(!b.isNumeric(a)){h(this,o,0);break}g=new Date(a),u=n(g,s.increments[o]),k=0;do if(x=m(u,s.increments[o].format),f=c(this,o,k),d=this.getPx(u.getTime()),u=l(u,s.increments[o]),p=this.getPx(u.getTime()),y(o,f,x,this.getMinPx(),this.getMaxPx(),d,p),k++,100o(e)):this.data[d].outliers=[];return this.dataHasChanged(),this.graph.updateDataMinMaxAxes(),this}_style(e,t,i='unselected',r=!1){return this.styles[i]=this.styles[i]||{},this.styles[i][e]=t,r&&this._set(e,t,'selected'),this.styleHasChanged(i),this}_gstyle(e,t){return this.getStyle(t)[e]}getStyle(e='unselected'){return this.styles[e]||{}}setMeanLineColor(){return this._style('meanLineColor',...arguments)}getMeanLineColor(){return this._gstyle('meanLineColor',...arguments)}setStyle(e,t='unselected'){this.styles[t]=(0,r.extend)({},this.default().defaultStyle,this.styles.unselected,e),this.styleHasChanged(t)}setMeanLineWidth(){return this._style('meanLineWidth',...arguments)}getMeanLineWidth(){return this._gstyle('meanLineWidth',...arguments)}setBoxAboveLineColor(){return this._style('boxAboveLineColor',...arguments)}getBoxAboveLineColor(){return this._gstyle('boxAboveLineColor',...arguments)}setBoxBelowLineColor(){return this._style('boxBelowLineColor',...arguments)}getBoxBelowLineColor(){return this._gstyle('boxBelowLineColor',...arguments)}setBoxAboveLineWidth(){return this._style('boxAboveLineWidth',...arguments)}getBoxAboveLineWidth(){return this._gstyle('boxAboveLineWidth',...arguments)}setBoxBelowLineWidth(){return this._style('boxBelowLineWidth',...arguments)}getBoxBelowLineWidth(){return this._gstyle('boxBelowLineWidth',...arguments)}setBoxAboveFillColor(){return this._style('boxAboveFillColor',...arguments)}getBoxAboveFillColor(){return this._gstyle('boxAboveFillColor',...arguments)}setBoxBelowFillColor(){return this._style('boxBelowFillColor',...arguments)}getBoxBelowFillColor(){return this._gstyle('boxBelowFillColor',...arguments)}setBoxAboveFillOpacity(){return this._style('boxAboveFillOpacity',...arguments)}getBoxAboveFillOpacity(){return this._gstyle('boxAboveFillOpacity',...arguments)}setBoxBelowFillOpacity(){return this._style('boxBelowFillOpacity',...arguments)}getBoxBelowFillOpacity(){return this._gstyle('boxBelowFillOpacity',...arguments)}setBarAboveLineColor(){return this._style('barAboveLineColor',...arguments)}getBarAboveLineColor(){return this._gstyle('barAboveLineColor',...arguments)}setBarBelowLineColor(){return this._style('barBelowLineColor',...arguments)}getBarBelowLineColor(){return this._gstyle('barBelowLineColor',...arguments)}setBarAboveLineWidth(){return this._style('barAboveLineWidth',...arguments)}getBarAboveLineWidth(){return this._gstyle('barAboveLineWidth',...arguments)}setBarBelowLineWidth(){return this._style('barBelowLineWidth',...arguments)}getBarBelowLineWidth(){return this._gstyle('barBelowLineWidth',...arguments)}setOutlierLineColor(){return this._style('outlierLineColor',...arguments)}getOutlierLineColor(){return this._gstyle('outlierLineColor',...arguments)}setOutlierLineWidth(){return this._style('outlierLineWidth',...arguments)}getOutlierLineWidth(){return this._gstyle('outlierLineWidth',...arguments)}setOutlierFillColor(){return this._style('outlierFillColor',...arguments)}getOutlierFillColor(){return this._gstyle('outlierFillColor',...arguments)}setOutlierFillOpacity(){return this._style('outlierFillOpacity',...arguments)}getOutlierFillOpacity(){return this._gstyle('outlierFillOpacity',...arguments)}applyLineStyles(){this.applyLineStyle(this.pathDom)}applyLineStyle(e){e.setAttribute('stroke',this.getLineColor()),e.setAttribute('stroke-width',this.getLineWidth()),e.removeAttribute('stroke-dasharray'),e.setAttribute('fill',this.getFillColor()),e.setAttribute('fill-opacity',this.getFillOpacity()||1)}draw(){if(!this.data)return;let e='y'==this.options.orientation?this.getYAxis():this.getXAxis(),t='y'==this.options.orientation?this.getXAxis():this.getYAxis(),a=!1,s,n,o,p,u,c,h,x;if((0,r.emptyDom)(this.groupMain),'category'==t.getType())n=t.getRelPx(0.8/this.nbCategories),a=!0;else{n=this.options.maxBoxWidth;for(var m=0,i=this.data.length;m{te.getPos(t));var l=document.createElementNS(this.graph.ns,'line');this.applyMeanStyle(l);var y=document.createElementNS(this.graph.ns,'rect'),f=document.createElementNS(this.graph.ns,'rect');'y'==this.options.orientation?(y.setAttribute('width',n),y.setAttribute('x',s[0]-n/2),f.setAttribute('width',n),f.setAttribute('x',s[0]-n/2),l.setAttribute('x1',s[0]-n/2),l.setAttribute('x2',s[0]+n/2),l.setAttribute('y1',o),l.setAttribute('y2',o)):(y.setAttribute('height',n),y.setAttribute('y',s[0]-n/2),f.setAttribute('height',n),f.setAttribute('y',s[0]-n/2),l.setAttribute('y1',s[0]-n/2),l.setAttribute('y2',s[0]+n/2),l.setAttribute('x1',o),l.setAttribute('x2',o)),this.boxPos(y,o,p,'x'==this.options.orientation),this.boxPos(f,o,u,'x'==this.options.orientation),this.applyBoxStyle(y,f);var b=document.createElementNS(this.graph.ns,'line'),A=document.createElementNS(this.graph.ns,'line');'y'==this.options.orientation?(void 0!==c&&(b.setAttribute('y1',p),b.setAttribute('y2',c),b.setAttribute('x1',s[0]),b.setAttribute('x2',s[0])),void 0!==h&&(A.setAttribute('y1',u),A.setAttribute('y2',h),A.setAttribute('x1',s[0]),A.setAttribute('x2',s[0]))):(void 0!==c&&(b.setAttribute('x1',p),b.setAttribute('x2',c),b.setAttribute('y1',s[0]),b.setAttribute('y2',s[0])),void 0!==h&&(A.setAttribute('x1',u),A.setAttribute('x2',h),A.setAttribute('y1',s[0]),A.setAttribute('y2',s[0]))),x.map((e)=>{let t=document.createElementNS(this.graph.ns,'circle');t.setAttribute('r',2),'y'==this.options.orientation?(t.setAttribute('cx',s[0]),t.setAttribute('cy',e)):(t.setAttribute('cy',s[0]),t.setAttribute('cx',e)),this.setOutlierStyle(t),this.groupMain.appendChild(t)}),void 0!==c&&this.groupMain.appendChild(b),void 0!==h&&this.groupMain.appendChild(A),void 0!==p&&this.groupMain.appendChild(y),void 0!==u&&this.groupMain.appendChild(f),this.groupMain.appendChild(l),this.applyWhiskerStyle(b,A)}}applyBoxStyle(e,t){e.setAttribute('stroke',this.getBoxAboveLineColor()),e.setAttribute('stroke-width',this.getBoxAboveLineWidth()),this.getBoxAboveFillColor()!==void 0&&e.setAttribute('fill',this.getBoxAboveFillColor()),this.getBoxAboveFillOpacity()!==void 0&&e.setAttribute('fill-opacity',this.getBoxAboveFillOpacity()),t.setAttribute('stroke',this.getBoxBelowLineColor()),t.setAttribute('stroke-width',this.getBoxBelowLineWidth()),this.getBoxBelowFillColor()!==void 0&&t.setAttribute('fill',this.getBoxBelowFillColor()),this.getBoxAboveFillOpacity()!==void 0&&t.setAttribute('fill-opacity',this.getBoxBelowFillOpacity())}applyWhiskerStyle(e,t){e.setAttribute('stroke',this.getBarAboveLineColor()),e.setAttribute('stroke-width',this.getBarAboveLineWidth()),t.setAttribute('stroke',this.getBarBelowLineColor()),t.setAttribute('stroke-width',this.getBarBelowLineWidth())}applyMeanStyle(e){e.setAttribute('stroke',this.getMeanLineColor()),e.setAttribute('stroke-width',this.getMeanLineWidth())}setOutlierStyle(e){e.setAttribute('stroke',this.getOutlierLineColor()),e.setAttribute('stroke-width',this.getOutlierLineWidth()),this.getBoxBelowFillColor()!==void 0&&e.setAttribute('fill',this.getOutlierFillColor()),this.getBoxAboveFillOpacity()!==void 0&&e.setAttribute('fill-opacity',this.getOutlierFillOpacity())}getCategoryIndex(e){if(!this.categories)throw new Error('No categories were defined. Probably axis.setSeries was not called');for(var t=0;ti?(e.setAttribute(r?'x':'y',i),e.setAttribute(r?'width':'height',t-i)):(e.setAttribute(r?'x':'y',t),e.setAttribute(r?'width':'height',i-t))}getUsedCategories(){let e='y'==this.options.orientation?'x':'y',t=this.data.map((t)=>t[e]);return Array.isArray(this._linkedToScatterSeries)&&this._linkedToScatterSeries.map((e)=>{e.getUsedCategories().map((e)=>{let i;-1<(i=t.indexOf(e))&&t.splice(i,1)})}),t}linkToScatterSerie(...e){this._linkedToScatterSeries=e}}t.default=s,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(5),i(0),i(10)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r,a){'use strict';function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,'__esModule',{value:!0});var n=s(i),o=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(r),l=s(a);class d extends n.default{constructor(){super(...arguments),this.lines=this.lines||{}}setColors(e){this.colors=e}_draw(){var t=this,e=this._dataToUse,r=0,i=!1,a=!1,s=this.getXAxis(),n=this.getYAxis(),o=s.getCurrentMin(),d=n.getCurrentMin(),p=s.getCurrentMax(),g=n.getCurrentMax(),u=0,c=1,h=!1,f=!1,b,A,k,m,x,A,y,M,S,_;for(this.eraseLines(),this.isFlipped()&&(u=1,c=0),this.currentLine='',k=this.waveform.getLength(),b=0;bp&&i>p||(xg&&a>g)&&!this.options.lineToZero){i=m,a=x,f=!0;continue}if(this.counter2=b,this.markersShown()&&this.getMarkerCurrentFamily(this.counter2),S=this.getX(m),_=this.getY(x),S!=y||_!=M){if(h=mp||x>g,isNaN(S)||isNaN(_)){0r||h>d||0>i||0>h))&&(p[i]=p[i]||[],p[i][h]=p[i][h]+1||1,l=p[i][h]u?p[i][h]:u);return this.maxIndexX=r,this.maxIndexY=d,this.binMin=l,this.binMax=u,this.deltaX=t,this.deltaY=o,this.fromX=e,this.fromY=a,this.numX=r,this.numY=d,this.densitymap=p,p}setDensityMap(e,t,r,a,o,d){var p=this.data.length,l=s,g=n,u,i;for(u=0;ug?e[u][i]:g;return this.maxIndexX=e.length,this.maxIndexY=e[0].length,this.binMin=l,this.binMax=g,this.deltaX=r,this.deltaY=d,this.fromX=t,this.fromY=o,this.numX=this.maxIndexX,this.numY=this.maxIndexY,this.densitymap=e,e}calculateDensityWeighted(e,t,r,a,o,d){var g=[],u=this.data.length,l=s,c=n,h,i,x,m,y,f,b,A,k,M,S;for(h=0;hr||x>d||0>i||0>x))&&(g[A]=g[A]||[],g[k]=g[k]||[],g[A][M]=g[A][M]||0,g[k][M]=g[k][M]||0,g[A][S]=g[A][S]||0,g[k][S]=g[k][S]||0,g[A][M]+=m*y,g[k][M]+=(1-m)*y,g[A][S]+=m*(1-y),g[k][S]+=(1-m)*(1-y),l=g[A][M]c?g[A][M]:c,l=g[k][M]c?g[k][M]:c,l=g[A][S]c?g[A][S]:c,l=g[k][S]c?g[k][S]:c);return this.maxIndexX=r,this.maxIndexY=d,this.binMin=l,this.binMax=c,this.deltaX=t,this.deltaY=o,this.fromX=e,this.fromY=a,this.numX=r,this.numY=d,this.densitymap=g,g}autoBins(e,t){return this.numX=e||400,this.numY=t||this.numX,this.calculateDensity(this.minX,(this.maxX-this.minX)/e,e,this.minY,(this.maxY-this.minY)/t,t),this.recalculateBinsOnDraw=!1,this}setPxPerBin(e,t,i){return e&&this.calculationDensityMap({from:'min',to:'max',pxPerBin:e,weighted:i}),t&&this.calculationDensityMap(!1,{from:'min',to:'max',pxPerBin:t,weighted:i}),this}setBinsFromTo(e,t,i,r){return this.densityMapCalculation=this.densityMapCalculation||{},this.densityMapCalculation[e]={from:t,to:i,numBins:r},this.calculationDensityMap(),this}calculationDensityMap(e,t){this.method=this.calculateDensityAdvanced,this.densityMapCalculation=this.densityMapCalculation||{},e&&(this.densityMapCalculation.x=e),t&&(this.densityMapCalculation.y=t)}calculateDensityAdvanced(){var e={x:{from:0,num:0,delta:0,weighing:!1},y:{from:0,num:0,delta:0,weighing:!1}},t={x:this.graph.drawingSpaceWidth,y:this.graph.drawingSpaceHeight},r={x:this.getXAxis,y:this.getYAxis},s=!1;for(var n in this.densityMapCalculation)if(this.densityMapCalculation[n].weighted&&(s=!0,e[n].weighing=!0),this.densityMapCalculation[n].pxPerBin){var i='min'==this.densityMapCalculation[n].from?r[n].call(this).getCurrentMin():this.densityMapCalculation[n].from,o='max'==this.densityMapCalculation[n].to?r[n].call(this).getCurrentMax():this.densityMapCalculation[n].to,l=g(r[n].call(this).getRelPx(o-i));e[n].num=a(t[n]/this.densityMapCalculation[n].pxPerBin),e[n].from=i-g(r[n].call(this).getRelVal((e[n].num*this.densityMapCalculation[n].pxPerBin-l)/2)),e[n].delta=g(r[n].call(this).getRelVal(this.densityMapCalculation[n].pxPerBin))}else e[n].num=this.densityMapCalculation[n].numBins||400,e[n].from='min'==this.densityMapCalculation[n].from?r[n].call(this).getCurrentMin():this.densityMapCalculation[n].from,e[n].delta=this.densityMapCalculation[n].to?(('max'==this.densityMapCalculation[n].to?r[n].call(this).getCurrentMax():this.densityMapCalculation[n].to)-e[n].from)/e[n].num:this.densityMapCalculate[n].delta;(s?this.calculateDensityWeighted:this.calculateDensity).call(this,e.x.from,e.x.delta,e.x.num,e.y.from,e.y.delta,e.y.num)}setColorMapBinBoundaries(e,t){return this.colorMapMin=e,this.colorMapMax=t,this}autoColorMapBinBoundaries(){return this.colorMapMin=this.binMin,this.colorMapMax=this.binMax,this}onRedrawColorMapBinBoundaries(e){return this.callbackColorMapMinMax=e,this}colorMapHSL(e,r,a){a=a||'linear';for(var s={exp:function(e){return(t(1*(e/r))-1)/(2.718281828459045-1)},log:function(e){return(i(e+1)-0)/(i(r+1)-0)},linear:function(e){return(e-0)/(r-0)}},n=0,o=[],l=[],d={h:null,s:null,l:null,a:null},g=e.length-1,c=0,h,x;c<=r;c++){for(var m in h=s[a](c),x=p(h*g),x==e.length-1&&(x=g-1),h=(h-x/g)/(1/g),d)d[m]=(e[x+1][m]-e[x][m])*h+e[x][m];o[n]='hsl('+d.h+', '+u(100*d.s)+'%, '+u(100*d.l)+'%)',l[n]=d.a,n++}return this.opacities=l,this.colorMap=o,this.colorMapNum=r,this}autoColorMapHSL(e,t='linear'){return this.colorMapHSV(e,100,t),this}getColorIndex(e){return o(0,d(this.colorMapNum,p((e-this.colorMapMin)/(this.colorMapMax-this.colorMapMin)*this.colorMapNum)))}draw(){var e;if(this.method&&this.method(),!this.callbackColorMapMinMax||void 0==this.colorMapMin||void 0==this.colorMapMax||'auto'==this.callbackColorMapMinMax)this.autoColorMapBinBoundaries();else{var t=this.callbackColorMapMinMax(this.binMin,this.binMax);this.setColorMapBinBoundaries(t[0],t[1])}for(var r=this.getXAxis().getRelPx(this.deltaX),a=this.getYAxis().getRelPx(this.deltaY),s=0;sA&&c[r+2+m]>A||c[r+x]>b&&c[r+2+x]>b||(n=this.getX(c[r+x]),l=this.getY(c[r+m]),a=this.getX(c[r+2+x]),s=this.getY(c[r+2+m]),a!=n||s!=l)&&(this.currentLine+='M ',this.currentLine+=n,this.currentLine+=' ',this.currentLine+=l,this.currentLine+='L ',this.currentLine+=a,this.currentLine+=' ',this.currentLine+=s,this.counter++,k=a,M=s,p++)}this.currentLine+=' z',u=this._createLine(),u.setAttribute('data-zvalue',this.data[t].zValue),this.zValues[this.data[t].zValue]={dom:u},this.minZ=d(this.minZ,this.data[t].zValue),this.maxZ=o(this.maxZ,this.data[t].zValue)}for(t++,t=this.currentLine+1;t=this.positiveThreshold||0>=n&&n<=this.negativeThreshold?'block':'none');this._shapeZoom&&(this.options.hasNegative?(this._shapeZoom.setHandleNeg(-r(this.negativeDelta,3),this.minZ),this._shapeZoom.showHandleNeg()):this._shapeZoom.hideHandleNeg(),this._shapeZoom.setHandlePos(r(this.positiveDelta,3),this.maxZ))}setDynamicColor(e){this.lineColors=e,this.styleHasChanged()}setNegative(e){this.options.hasNegative=e,e&&(this.negativeThreshold=0)}setColorTo(e,t,r,a){if(this.lineColors){var s={h:0,s:0,l:0};for(var o in s)s[o]=0a||0>s+a||s>this.graph.getDrawingWidth())return this.setDom('d',''),!1;var n=this.serie.searchClosestValue(this.getPosition(0).x),l=this.serie.searchClosestValue(this.getPosition(1).x),p=0,u=e,c,h,i,x,m,f,s,b;if(!n||!l)return!1;for(n.xBeforeIndex>l.xBeforeIndex&&(c=n,n=l,l=c),this.counter=0,h=n.dataIndex;h<=l.dataIndex;h++){for(this.currentLine='',x=h==n.dataIndex?n.xBeforeIndexArr:0,m=h==l.dataIndex?l.xBeforeIndexArr:this.serie.data[h].length,f=0,x==m&&m++,i=x;i<=m;i+=2)s=this.serie.getX(this.serie.data[h][i+0]),b=this.serie.getY(this.serie.data[h][i+1]),p=o(this.serie.data[h][i+1],p),u=d(this.serie.data[h][i+1],u),i==x&&(this.firstX=s,this.firstY=b),this.currentLine+=0this.serie.getXAxis().getCurrentMax()&&u.x>this.serie.getXAxis().getCurrentMax())return this.setDom('d',''),this._domShadow.setAttribute('d',''),this.hideLabel(0),!1;this.showLabel(0);let c=0,h=this.serie.getWaveform(),x;if(!h)return;let m=h.getIndexFromX(g[e],!0,Math.floor),y=h.getIndexFromX(u[e],!0,Math.ceil),f=!1,b;m==y&&('aggregate'==h.getReductionType()?y+=4:y++),y=m:x<=y;x+=T){if(o=h.getX(x,!0),d=h.getY(x,!0),s=this.serie.getX(o),n=this.serie.getY(d),c+=h.getY(x,!0),M||(M=s,S=n,_=h.getX(x),v=h.getY(x)),void 0==C){C=s,w=n,P=h.getX(x),L=h.getY(x);continue}s!=C||n!=w,C=s,w=n,t.push([s,n,c]),P=o}P=!1,L=!1,C=!1,w=!1,0==c&&(c=1),this._sumVal=h.integrate(g.x,u.x),p=this.ratio?this.ratio*(this.sumVal/c):200/c;let X;if(0!=t.length){for(var Y=0,i=t.length;Yc/2&&t[Y][2]<=c/2||t[Y-1][2]=c/2)){let e=a-(t[Y-1][2]+t[Y][2])/2*p;this.setPosition({x:t[Y][0]+'px',y:e+'px'},3),this.setLabelPosition(this.getPosition(3),0)}r+=' L '+t[Y][0]+', '+X+' ',this.lastPointX=t[Y][0],this.lastPointY=X}return this.points=t,this._sum=c,r=this.serie.isFlipped()?' M '+a+', '+M+' '+r:' M '+M+', '+a+' '+r,this.firstPointX=M,this.firstPointY=a,this.setDom('d',r),this._domShadow.setAttribute('d',r),this.firstX=M,this.firstY=S,this.serie.ratioLabel&&this.updateIntegralValue(this.serie.ratioLabel)||this.updateLabels(),this.changed(),this.handleCondition=!this.xor(-1==T,f),this.setHandles(),this.updateIntegralValue(),!0}}updateIntegralValue(e=this.serie.ratioLabel,t){return console.log(e),e&&(this.serie.ratioLabel=e),isNaN(t)||isNaN(this.sumVal)||!this.sumVal||(this.serie.ratioLabel=t/this.sumVal),this.setLabelText(e?(u(100*this.sumVal*e)/100).toPrecision(3):'N/A',0),this.updateLabels(),this.serie.ratioLabel}getAxis(){return this._data.axis||'x'}set ratio(e){this._ratio=e}get ratio(){return this._ratio}get sum(){return this._sum}get sumVal(){return this._sumVal}selectStyle(){this.setDom('stroke-width','2px')}selectHandles(){}setHandles(){void 0!=this.points&&this.isSelected()&&(this.addHandles(),this.handleCondition?(this.handles[1].setAttribute('x',this.firstPointX),this.handles[1].setAttribute('y',this.firstPointY),this.handles[2].setAttribute('x',this.lastPointX),this.handles[2].setAttribute('y',this.lastPointY)):(this.handles[2].setAttribute('x',this.firstPointX),this.handles[2].setAttribute('y',this.firstPointY),this.handles[1].setAttribute('x',this.lastPointX),this.handles[1].setAttribute('y',this.lastPointY)))}handleMouseMoveImpl(t,e){if(!this.isLocked()){var i=this.getPosition(0),r=this.getPosition(1),a;return 1==this.handleSelected?a=i:2==this.handleSelected&&(a=r),a&&!this._data.vertical&&a.deltaPosition('x',e,this.getXAxis()),this.moving&&(i.x&&i.deltaPosition('x',e,this.getXAxis()),r.x&&r.deltaPosition('x',e,this.getXAxis())),this.rectEvent&&this.setEventReceptacle(),this.redraw(),this.changed(),!0}}}t.default=o,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(18)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{constructor(e,t){super(e,t),this.nbHandles=4}createDom(){this._dom=document.createElementNS(this.graph.ns,'rect'),this._dom.element=this,this.createHandles(this.nbHandles,'rect',{transform:'translate(-3 -3)',width:6,height:6,stroke:'black',fill:'white',cursor:'nwse-resize'})}redrawImpl(){this.setPosition(),this.setHandles(),this.setBindableToDom(this._dom)}}t.default=a,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(1)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{constructor(e,t){super(e,t),this.nbHandles=1}get width(){return this.options.width||10}set width(e){this.options.width=e}createDom(){this._dom=document.createElementNS(this.graph.ns,'path'),this._dom.setAttribute('d','M -'+this.width/2+' 0 h '+this.width+' m -'+this.width/2+' -'+this.width/2+' v '+this.width+'')}createHandles(){this._createHandles(this.nbHandles,'rect',{transform:'translate(-3 -3)',width:6,height:6,stroke:'black',fill:'white',cursor:'nwse-resize'})}applyPosition(){var e=this.calculatePosition(0);if(e&&e.x&&e.y)return this.setDom('transform','translate( '+e.x+', '+e.y+')'),this.currentPos1x=e.x,this.currentPos1y=e.y,!0}redrawImpl(){this.setHandles()}handleCreateImpl(){}handleMouseDownImpl(){return this.moving=!0,!0}handleMouseUpImpl(){return this.triggerChange(),!0}handleMouseMoveImpl(t,e,i){if(!this.isLocked()){var r=this.getFromData('pos');return this.moving&&(r.x=this.graph.deltaPosition(r.x,e,this.getXAxis()),r.y=this.graph.deltaPosition(r.y,i,this.getYAxis())),this.redrawImpl(),!0}}setHandles(){!this.areHandlesInDom()||isNaN(this.currentPos1x)||(this.handles[1].setAttribute('x',this.currentPos1x),this.handles[1].setAttribute('y',this.currentPos1y))}selectStyle(){this.setDom('stroke','red'),this.setDom('stroke-width','2')}}t.default=a,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(12)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{constructor(e){super(e),this.lineHeight=6}createDom(){this._dom=document.createElementNS(this.graph.ns,'line'),this.line1=document.createElementNS(this.graph.ns,'line'),this.line2=document.createElementNS(this.graph.ns,'line'),this.line3=document.createElementNS(this.graph.ns,'line'),this.rectBoundary=document.createElementNS(this.graph.ns,'path'),this.rectBoundary.setAttribute('fill','transparent'),this.rectBoundary.setAttribute('stroke','none'),this.rectBoundary.setAttribute('pointer-events','fill'),this.rectBoundary.jsGraphIsShape=!0,this.group.appendChild(this.rectBoundary),this.group.appendChild(this.line1),this.group.appendChild(this.line2),this.group.appendChild(this.line3),this._dom.element=this}createHandles(){this._createHandles(3,'rect',{transform:'translate(-3 -3)',width:6,height:6,stroke:'black',fill:'white',cursor:'nwse-resize'})}redrawImpl(){this.line1.setAttribute('stroke',this.getStrokeColor()),this.line2.setAttribute('stroke',this.getStrokeColor()),this.line3.setAttribute('stroke',this.getStrokeColor()),this.line1.setAttribute('stroke-width',this.getStrokeWidth()),this.line2.setAttribute('stroke-width',this.getStrokeWidth()),this.line3.setAttribute('stroke-width',this.getStrokeWidth()),this.setHandles(),this.redrawLines()}redrawLines(){var e=this.computePosition(0),t=this.computePosition(1),i=this.computePosition(2);if(e.x&&t.x&&i.x&&this.posYPx){var r=this.lineHeight;this.rectBoundary.setAttribute('d','M '+e.x+' '+(this.posYPx-r)+' v '+2*r+' H '+t.x+' v '+-2*r+'z'),this.line1.setAttribute('x1',e.x),this.line1.setAttribute('x2',e.x),this.line2.setAttribute('x1',t.x),this.line2.setAttribute('x2',t.x),this.line3.setAttribute('x1',i.x),this.line3.setAttribute('x2',i.x),this._dom.setAttribute('x1',e.x),this._dom.setAttribute('x2',t.x),this.redrawY(r)}return this}redrawY(){if(!this.posYPx)return this;var e=this.lineHeight;return this.line1.setAttribute('y1',this.posYPx-e),this.line1.setAttribute('y2',this.posYPx+e),this.line2.setAttribute('y1',this.posYPx-e),this.line2.setAttribute('y2',this.posYPx+e),this.line3.setAttribute('y1',this.posYPx-e),this.line3.setAttribute('y2',this.posYPx+e),this._dom.setAttribute('y1',this.posYPx),this._dom.setAttribute('y2',this.posYPx),this}setHandles(){if(this.posYPx){var e=this.computePosition(0),t=this.computePosition(1),i=this.computePosition(2);e.x&&t.x&&i.x&&(this.handles[1].setAttribute('x',e.x),this.handles[1].setAttribute('y',this.posYPx),this.handles[2].setAttribute('x',t.x),this.handles[2].setAttribute('y',this.posYPx),this.handles[3].setAttribute('x',i.x),this.handles[3].setAttribute('y',this.posYPx))}}setY(e){return this.posYPx=e,this}setLineHeight(e){this.lineHeihgt=e}handleMouseMoveImpl(t,e){if(!this.isLocked()){var i=this.getPosition(0),r=this.getPosition(1),a=this.getPosition(2);switch(this.handleSelected){case 1:i.deltaPosition('x',e,this.getXAxis()),(g(a.x-r.x)>g(r.x-i.x)||g(a.x-i.x)>g(r.x-i.x))&&(a.x=i.x+0.1*(r.x-i.x));break;case 2:r.deltaPosition('x',e,this.getXAxis()),(g(a.x-r.x)>g(r.x-i.x)||g(a.x-i.x)>g(r.x-i.x))&&(a.x=r.x+0.1*(i.x-r.x));break;case 3:if(a.deltaPosition('x',e,this.getXAxis()),g(a.x-r.x)>g(r.x-i.x)||g(a.x-i.x)>g(r.x-i.x))return;}this.setLabelPosition({y:this.getLabelPosition(0).y,x:a.x}),this.updateLabels(),this.redrawLines(),this.setHandles()}}applyPosition(){return this.redrawLines(),!0}}t.default=a,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(0),i(1)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var a=function(e){return e&&e.__esModule?e:{default:e}}(r);class s extends a.default{constructor(e,t){super(e,t)}createDom(){this._dom=document.createElement('div'),this._dom.setAttribute('style','position: absolute');let e=document.createElement('div');this._dom.appendChild(e),this.div=e}createHandles(){}setHeight(e){this.setProp('height',e)}setWidth(e){this.setProp('width',e)}setContent(e){this.setProp('content',e)}setRenderer(e){this._renderer=e}redraw(){this._renderer?this._renderer(this.div):this.div.innerHTML=this.getProp('content'),super.redraw(...arguments)}applyPosition(){var e=this.calculatePosition(0);if(e&&(0,i.isNumeric)(e.x)&&(0,i.isNumeric)(e.y))return this._dom.style.left=e.x+'px',this._dom.style.top=e.y+'px',this.currentPosX=e.x,this.currentPosY=e.y,!0}handleMouseMoveImpl(){return!0}setHandles(){}isHTML(){return!0}}t.default=s,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(2)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{static default(){return{dragX:!0,dragY:!0,persistanceX:!1,persistanceY:!1}}init(e){this.graph=e,this.time=null,this.totaltime=2e3}onMouseDown(e,t,i){return this._draggingX=t,this._draggingY=i,this._lastDraggingX=this._draggingX,this._lastDraggingY=this._draggingY,this.stopAnimation=!0,this.moved=!1,!0}onMouseMove(e,t,i){var r=t-this._draggingX,a=i-this._draggingY;this.options.dragX&&e._applyToAxes(function(e){e.setCurrentMin(e.getVal(e.getMinPx()-r)),e.setCurrentMax(e.getVal(e.getMaxPx()-r))},!1,!0,!1),this.options.dragY&&e._applyToAxes(function(e){e.setCurrentMin(e.getVal(e.getMinPx()-a)),e.setCurrentMax(e.getVal(e.getMaxPx()-a))},!1,!1,!0),this._lastDraggingX=this._draggingX,this._lastDraggingY=this._draggingY,this._draggingX=t,this._draggingY=i,this.moved=!0,this.time=Date.now(),this.emit('dragging'),e.draw(!0)}onMouseUp(e,t,i){var r=Date.now()-this.time;return t==this._lastDraggingX||i==this._lastDraggingY?void(this.moved&&this.emit('dragged')):(this.speedX=(t-this._lastDraggingX)/r,this.speedY=(i-this._lastDraggingY)/r,isNaN(this.speedX)||isNaN(this.speedY)?void this.emit('dragged'):void(e._applyToAxes(function(e){e._pluginDragMin=e.getCurrentMin(),e._pluginDragMax=e.getCurrentMax()},!1,!0,!0),this.stopAnimation=!1,this.accelerationX=-this.speedX/this.totaltime,this.accelerationY=-this.speedY/this.totaltime,this.options.persistanceX||this.options.persistanceY?this._persistanceMove(e):this.emit('dragged')))}_persistanceMove(e){var t=this;return t.stopAnimation?void t.emit('dragged'):void window.requestAnimationFrame(function(){var i=Date.now()-t.time,r=(0.5*t.accelerationX*i+t.speedX)*i,a=(0.5*t.accelerationY*i+t.speedY)*i;t.options.persistanceX&&e._applyToAxes(function(e){e.setCurrentMin(-e.getRelVal(r)+e._pluginDragMin),e.setCurrentMax(-e.getRelVal(r)+e._pluginDragMax),e.cacheCurrentMin(),e.cacheCurrentMax(),e.cacheInterval()},!1,!0,!1),t.options.persistanceY&&e._applyToAxes(function(e){e.setCurrentMin(-e.getRelVal(a)+e._pluginDragMin),e.setCurrentMax(-e.getRelVal(a)+e._pluginDragMax),e.cacheCurrentMin(),e.cacheCurrentMax(),e.cacheInterval()},!1,!1,!0),e.draw(),i{console.log(this.currentShape),this.currentShape||e.emit('newShape',a,p)})}}}onMouseMove(t,i,r,a){if(this.currentShape){console.log('mv'),this.count++;var e=this.currentShape;this.currentShape=!1,t.selectedSerie&&!e.serie&&e.setSerie(t.selectedSerie),e.resizing=!0,e.options&&e.options.onCreate&&e.options.onCreate.call(e),e.draw(),t.selectShape(e),e.handleMouseDown(this.currentShapeEvent,!0),e.handleSelected=this.options.handleSelected||1,e.handleMouseMove(a,!0)}}onMouseUp(){this.currentShape&&(this.currentShape.kill(),this.currentShape=!1)}}t.default=n,e.exports=t['default']})},function(e,t,i){var a,s,n;(function(r,o){s=[e,t,i(0),i(2)],a=o,n='function'==typeof a?a.apply(t,s):a,!(void 0!==n&&(e.exports=n))})(this,function(e,t,i,a){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var s=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(i),n=function(e){return e&&e.__esModule?e:{default:e}}(a);class o extends n.default{constructor(){super(...arguments)}static default(){return{}}init(e){this._path=document.createElementNS(e.ns,'path'),s.setAttributeTo(this._path,{display:'none',fill:'rgba(0,0,0,0.1)',stroke:'rgba(0,0,0,1)',"shape-rendering":'crispEdges',x:0,y:0,height:0,width:0,d:''}),this.graph=e,e.dom.appendChild(this._path)}setSerie(e){this.serie=e}onMouseDown(e,t,i){this.serie&&(this.path='M '+t+' '+i+' ',this.currentX=t,this.currentY=i,this.xs=[this.serie.getXAxis().getVal(t-e.getPaddingLeft())],this.ys=[this.serie.getYAxis().getVal(i-e.getPaddingTop())],this._path.setAttribute('d',''),this._path.setAttribute('display','block'))}onMouseMove(e,t,i){25e.getY(a)||this.ys[n]>e.getY(a)&&this.ys[s](e.getY(a)-this.ys[n])/(this.ys[s]-this.ys[n])*(this.xs[s]-this.xs[n])+this.xs[n]&&r++;1==r%2?(t.push(a),this.serie.selectPoint(a,!0,'selected')):this.serie.unselectPoint(a)}this.selected=t,this.emit('selectionProcess',t)}onMouseUp(){this._path.setAttribute('display','none'),this.emit('selectionEnd',this.selected)}}t.default=o,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(0),i(2)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(i),s=function(e){return e&&e.__esModule?e:{default:e}}(r);class n extends s.default{constructor(){super(...arguments)}static default(){return{axes:'all'}}init(e){this._zoomingGroup=document.createElementNS(e.ns,'g'),this._zoomingSquare=document.createElementNS(e.ns,'rect'),this._zoomingSquare.setAttribute('display','none'),a.setAttributeTo(this._zoomingSquare,{display:'none',fill:'rgba(171,12,12,0.2)',stroke:'rgba(171,12,12,1)',"shape-rendering":'crispEdges',x:0,y:0,height:0,width:0,"pointer-events":'none'}),this.graph=e,e.groupEvent.appendChild(this._zoomingGroup),this._zoomingGroup.appendChild(this._zoomingSquare)}onMouseDown(t,i,r,a,e){var s=this.options.zoomMode;if(s){switch(this._zoomingMode=s,void 0===i&&(this._backedUpZoomMode=this._zoomingMode,this._zoomingMode='y',i=0),void 0===r&&(this._backedUpZoomMode=this._zoomingMode,this._zoomingMode='x',r=0),this._zoomingXStart=i,this._zoomingYStart=r,this.x1=i-t.getPaddingLeft(),this.y1=r-t.getPaddingTop(),this._zoomingSquare.setAttribute('width',0),this._zoomingSquare.setAttribute('height',0),this._zoomingSquare.setAttribute('display','block'),this._zoomingMode){case'x':this._zoomingSquare.setAttribute('y',t.options.paddingTop),this._zoomingSquare.setAttribute('height',t.getDrawingHeight()-t.shift.bottom);break;case'y':this._zoomingSquare.setAttribute('x',t.options.paddingLeft),this._zoomingSquare.setAttribute('width',t.getDrawingWidth());break;case'forceY2':this.y2=t.getYAxis().getPx(this.options.forcedY)+t.options.paddingTop;}this.options.onZoomStart&&!e&&this.options.onZoomStart(t,i,r,a,e)}}onMouseMove(t,i,r,a,e){switch(this._zoomingMode){case'xy':this._zoomingSquare.setAttribute('x',d(this._zoomingXStart,i)),this._zoomingSquare.setAttribute('y',d(this._zoomingYStart,r)),this._zoomingSquare.setAttribute('width',g(this._zoomingXStart-i)),this._zoomingSquare.setAttribute('height',g(this._zoomingYStart-r));break;case'forceY2':this._zoomingSquare.setAttribute('y',d(this._zoomingYStart,this.y2)),this._zoomingSquare.setAttribute('height',g(this._zoomingYStart-this.y2)),this._zoomingSquare.setAttribute('x',d(this._zoomingXStart,i)),this._zoomingSquare.setAttribute('width',g(this._zoomingXStart-i));break;case'x':this._zoomingSquare.setAttribute('x',d(this._zoomingXStart,i)),this._zoomingSquare.setAttribute('width',g(this._zoomingXStart-i));break;case'y':this._zoomingSquare.setAttribute('y',d(this._zoomingYStart,r)),this._zoomingSquare.setAttribute('height',g(this._zoomingYStart-r));}this.options.onZoomMove&&!e&&this.options.onZoomMove(t,i,r,a,e)}onMouseUp(t,i,r,a,s){var n=this;this.removeZone();var l=i-t.options.paddingLeft,p=r-t.options.paddingTop;if((this.emit('beforeZoom',{graph:t,x:i,y:r,e:a,mute:s}),!t.prevent(!1))&&(0!=i-this._zoomingXStart||'y'==this._zoomingMode)&&(0!=r-this._zoomingYStart||'x'==this._zoomingMode))if(this.options.transition||this.options.smooth){let e=!1,t=!1;('x'==this._zoomingMode||'xy'==this._zoomingMode||'forceY2'==this._zoomingMode)&&(this.fullX=!1,this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=d(e.getVal(l),e.getVal(n.x1)),e._pluginZoomMaxFinal=o(e.getVal(l),e.getVal(n.x1))},!1,!0,!1),e=!0),('y'==this._zoomingMode||'xy'==this._zoomingMode)&&(this.fullY=!1,this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=d(e.getVal(p),e.getVal(n.y1)),e._pluginZoomMaxFinal=o(e.getVal(p),e.getVal(n.y1))},!1,!1,!0),t=!0),'forceY2'==this._zoomingMode&&(this.fullY=!1,this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=d(e.getVal(n.y2),e.getVal(n.y1)),e._pluginZoomMaxFinal=o(e.getVal(n.y2),e.getVal(n.y1))},!1,!1,!0),t=!0),this.transition(e,t,'zoomEnd')}else{switch(this._zoomingMode){case'x':this.fullX=!1,this.toAxes('_doZoom',[l,this.x1],!0,!1);break;case'y':this.fullY=!1,this.toAxes('_doZoom',[p,this.y1],!1,!0);break;case'xy':this.fullX=!1,this.fullY=!1,this.toAxes('_doZoom',[l,this.x1],!0,!1),this.toAxes('_doZoom',[p,this.y1],!1,!0);break;case'forceY2':this.fullX=!1,this.fullY=!1,this.toAxes('_doZoom',[l,this.x1],!0,!1),this.toAxes('_doZoom',[this.y1,this.y2],!1,!0);}t.draw(),this._backedUpZoomMode&&(this._zoomingMode=this._backedUpZoomMode),this.emit('zoomed'),t.pluginYieldActiveState()}}removeZone(){this._zoomingSquare.setAttribute('display','none')}onMouseWheel(t,i,e,r,a){a||(a={}),a.baseline||(a.baseline=0);let s=a.baseline;'mousePosition'==a.baseline&&(s=this.graph.getYAxis().getVal(r),console.log(s));var n='x'==a.direction,o='y'===a.direction;this.toAxes('handleMouseWheel',[t,i,s],n,o),this.graph.drawSeries()}onDblClick(t,i,r,a,s){var n=this.graph;if(this.emit('beforeDblClick',{graph:n,x:t,y:i,pref:a,e:r,mute:s}),!n.prevent(!1)){if(this.options.transition||this.options.smooth){var l=!1,p=!1;('xtotal'==a.mode||'total'==a.mode)&&(this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=e.getMinValue()-e.options.axisDataSpacing.min*e.getInterval(),e._pluginZoomMaxFinal=e.getMaxValue()+e.options.axisDataSpacing.max*e.getInterval()},!1,!0,!1),l=!0),('ytotal'==a.mode||'total'==a.mode)&&(this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=e.getMinValue()-e.options.axisDataSpacing.min*e.getInterval(),e._pluginZoomMaxFinal=e.getMaxValue()+e.options.axisDataSpacing.max*e.getInterval()},!1,!1,!0),p=!0);let e,t;return('gradualX'==a.mode||'gradualY'==a.mode||'gradual'==a.mode||'gradualXY'==a.mode)&&(e=!1,t=!1,('gradualX'==a.mode||'gradual'==a.mode||'gradualXY'==a.mode)&&(e=!0,l=!0),('gradualY'==a.mode||'gradual'==a.mode||'gradualXY'==a.mode)&&(t=!0,p=!0),this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=e.getCurrentMin()-(e.getCurrentMax()-e.getCurrentMin()),e._pluginZoomMaxFinal=e.getCurrentMax()+(e.getCurrentMax()-e.getCurrentMin())},!1,e,t)),void this.transition(l,p,'dblClick')}var g=this.graph.getXAxis(),u=this.graph.getYAxis();if('xtotal'==a.mode)this.toAxes('setMinMaxToFitSeries',null,!0,!1),this.fullX=!0,this.fullY=!1;else if('ytotal'==a.mode)this.toAxes('setMinMaxToFitSeries',null,!1,!0),this.fullX=!1,this.fullY=!0;else if('total'==a.mode)this.toAxes('setMinMaxToFitSeries',null,!0,!0),this.fullX=!0,this.fullY=!0;else{t-=this.graph.options.paddingLeft,i-=this.graph.options.paddingTop;var c=g.getCurrentMin(),h=g.getCurrentMax(),m=g.getVal(t),f=h-c,b=u.getCurrentMin(),A=u.getCurrentMax(),k=u.getVal(i),M=A-b;if('gradualXY'==a.mode||'gradualX'==a.mode){var S=(m-c)/(h-c);c=o(g.getMinValue()-g.getInterval()*g.options.axisDataSpacing.min,c-f*S),h=d(g.getMaxValue()+g.getInterval()*g.options.axisDataSpacing.max,h+f*(1-S)),g.setCurrentMin(c),g.setCurrentMax(h),g.options.onZoom&&g.options.onZoom(c,h),g.cacheCurrentMin(),g.cacheCurrentMax(),g.cacheInterval()}if('gradualXY'==a.mode||'gradualY'==a.mode){var S=(k-b)/(A-b);b=o(u.getMinValue()-u.getInterval()*u.options.axisDataSpacing.min,b-M*S),A=d(u.getMaxValue()+u.getInterval()*u.options.axisDataSpacing.max,A+M*(1-S)),u.setCurrentMin(b),u.setCurrentMax(A),u.options.onZoom&&u.options.onZoom(b,A),u.cacheCurrentMin(),u.cacheCurrentMax(),u.cacheInterval()}}n.pluginYieldActiveState(),this.graph.draw()}}transition(e,t,i){var r=this,a=500;r.gradualUnzoomStart||(r.gradualUnzoomStart=Date.now()),window.requestAnimationFrame(function(){var s=Date.now()-r.gradualUnzoomStart;s>a&&(s=a);var n=Math.sin(s/a*Math.PI/2);r.toAxes(function(e){e.setCurrentMin(e._pluginZoomMin+(e._pluginZoomMinFinal-e._pluginZoomMin)*n),e.setCurrentMax(e._pluginZoomMax+(e._pluginZoomMaxFinal-e._pluginZoomMax)*n),e.cacheCurrentMin(),e.cacheCurrentMax(),e.cacheInterval()},!1,e,t),r.graph.draw(),s{this.series.forEach(function(t){this.updateSerie(t,e)}),e||this.recalculateSeries(t)}}static default(){return{LRUName:'PluginTimeSerieManager',intervals:[1000,15000,60000,900000,3600000,8640000],maxParallelRequests:3,optimalPxPerPoint:2,nbPoints:1e3,url:''}}init(e){this.graph=e,u.default.create(this.options.LRUName,200),this.requestsRunning=0}setURL(e){return this.options.url=e,this}setAvailableIntervals(){this.options.intervals=arguments}newSerie(e,t,i,r,a){var n=this.graph.newSerie(e,t,i);return this.currentSlots[e]={min:0,max:0,interval:0},n.on('hide',function(){n._zoneSerie&&n._zoneSerie.hide()}),n.on('show',function(){n._zoneSerie&&n._zoneSerie.show()}),n.setInfo('timeSerieManagerDBElements',r),a||(n._zoneSerie=this.graph.newSerie(e+'_zone',{},o.default.SERIE_ZONE)),this.series.push(n),n}registerPlugin(e){var t;if(-1<(t=this.plugins.indexOf(e)))for(var r=1;rDate.now());)r.register(e,d,l,l==n?a[1]:a[2],!0,t),d++})}this.processRequests()}cleanRegister(e){this.requestLevels&&this.requestLevels.forEach((t)=>{t.forEach((i,r)=>{i[4]Date.now()&&o.timeout=this.options.maxParallelRequests)){for(var e=this,t=1,r;;){for(var a in this.requestLevels[t])if(1!=this.requestLevels[t][a][0]){r=this.requestLevels[t][a];break}if(r)break;if(t++,10',e[2]).replace('',this.computeTimeMin(e[3],e[4])).replace('',this.computeTimeMax(e[3],e[4])).replace('',e[4]),r=e[6]||{};for(var a in r)t=t.replace('<'+a+'>',r[a]);return t}getOptimalInterval(e){var t=(this.options.optimalPxPerPoint||1)*e/this.graph.getDrawingWidth(),i=Infinity,r;return this.options.intervals.forEach(function(e){var a=d(i,g(e-t));i!==a&&(r=e,i=a)}),r||1e3}computeUniqueID(e,t,r){var a='',s=e.getInfo('timeSerieManagerDBElements');for(var n in s)a+=';'+n+':'+s[n];return e.getName()+';'+t+';'+r+a}computeSlotID(e,t){return p(e/(t*this.options.nbPoints))}computeSlotTime(e,t){return e*(t*this.options.nbPoints)}getZoneSerie(e){return e._zoneSerie}updateZoneSerie(e){var t=this.graph.getSerie(e);t&&t._zoneSerie&&(t._zoneSerie.setXAxis(t.getXAxis()),t._zoneSerie.setYAxis(t.getYAxis()),t._zoneSerie.setFillColor(t.getLineColor()),t._zoneSerie.setLineColor(t.getLineColor()),t._zoneSerie.setFillOpacity(0.2),t._zoneSerie.setLineOpacity(0.3))}recalculateSeries(e){var t=this;this.locked||(this.changed=!1,this.series.map(function(i){t.recalculateSerie(i,e)}),this.changed=!1,t.graph.draw())}recalculateSerie(e,t){var i=e.getXAxis().getCurrentMin(),r=e.getXAxis().getCurrentMax(),a=this.getOptimalInterval(r-i),s=this.computeSlotID(i,a),n=this.computeSlotID(r,a),o=[],l=[];if(!(!t&&a==this.currentSlots[e.getName()].interval&&this.currentSlots[e.getName()].min<=s&&this.currentSlots[e.getName()].max>=n)){s-=2,n+=2,this.currentSlots[e.getName()].min=s,this.currentSlots[e.getName()].max=n,this.currentSlots[e.getName()].interval=a;for(var d=s;d<=n;){const t=u.default.get(this.options.LRUName,this.computeUniqueID(e,d,a));t?(o=o.concat(t.data.mean),l=l.concat(t.data.minmax)):this.recalculateSerieUpwards(e,d,a,o,l),d++}this.changed=!0,e.setData(o),e._zoneSerie&&e._zoneSerie.setData(l)}}setIntervalCheck(e){this.interval&&clearInterval(this.interval),this.update(!0,!0),this.interval=setInterval(()=>{this.update(!0,!1)},e)}recalculateSerieUpwards(e,t,r,a,s){var n=this.options.intervals.slice(0);n.sort();var o=n[n.indexOf(r)+1]||-1;if(0>o)return[];var d=this.computeSlotTime(t,r),p=this.computeSlotTime(t+1,r),g=this.computeSlotID(d,o),c=!1;const h=u.default.get(this.options.LRUName,this.computeUniqueID(e,g,o));if(h)for(var x=0,i=h.data.mean.length;x=p)return a=a.concat(h.data.mean.slice(c,x)),void(s=a.concat(h.data.minmax.slice(c,x)))}return this.recalculateSerieUpwards(e,g,o,a,s)}lockRedraw(){this.locked=!0}unlockRedraw(){this.locked=!1}isRedrawLocked(){return!!this.locked}}t.default=h,e.exports=t['default']})},function(e,t){var i,r,a;(function(s,n){r=[t],i=n,a='function'==typeof i?i.apply(t,r):i,!(void 0!==a&&(e.exports=a))})(this,function(e){'use strict';function t(e){o[e]={},d[e]=0}function i(e,t){t=t||50,o[e]||(o[e]={},d[e]=0),p[e]=t}function r(e,t){var i,r;if(o[e]&&o[e][t])return r=l[e],i=o[e][t],i.prev=r,i.next=r.next,r.next.prev=i,r.next=i,l[e]=i,i.data}function a(e,t,i){var a,s,n;if(o[e]&&void 0!==d[e]&&p[e])return n=l[e],o[e][t]?(r(e,t),o[e][t].data.data=i,o[e][t].data.timeout=Date.now()):(a={data:{data:i,timeout:Date.now()}},'undefined'==typeof n?(a.prev=a,a.next=a):(a.prev=n.prev,a.next=n.next,n.next.prev=a,n.next=a),l[e]=a,o[e][t]=a,d[e]++),d[e]>p[e]&&n&&(s=n.next,n.next.next.prev=n,n.next=n.next.next,s.next.next=void 0,s.next.prev=void 0,d[e]--),i}function s(e,t){var i;if((i=r(e,t))!=void 0)return i}function n(e,t,i){return a(e,t,i),i}Object.defineProperty(e,'__esModule',{value:!0}),e.create=function(e,t){i(e,t)},e.get=s,e.store=n,e.empty=function(e){t(e)},e.exist=function(e){return o[e]};var o={},l={},d={},p={};e.default=s})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(2)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(i);class a extends r.default{constructor(){super(...arguments)}static default(){return{positiveStyle:{fillColor:'green',fillOpacity:0.2,strokeWidth:0},negativeStyle:{fillColor:'red',fillOpacity:0.2,strokeWidth:0},from:0,to:0}}init(e){this.graph=e,this.pathsPositive=[],this.pathsNegative=[],this.positivePolyline=this.graph.newShape('polyline').draw(),this.positivePolyline.setFillColor(this.options.positiveStyle.fillColor).setFillOpacity(this.options.positiveStyle.fillOpacity).setStrokeWidth(this.options.positiveStyle.strokeWidth).applyStyle(),this.negativePolyline=this.graph.newShape('polyline').draw(),this.negativePolyline.setFillColor(this.options.negativeStyle.fillColor).setFillOpacity(this.options.negativeStyle.fillOpacity).setStrokeWidth(this.options.negativeStyle.strokeWidth).applyStyle()}setSeries(e,t){this.serie1=e,this.serie2=t}setBoundaries(e,t){this.options.from=e,this.options.to=t}getFrom(){return this.options.from}getTo(){return this.options.to}draw(){function e(){!0===y?r.pathsPositive.push([a,s]):!1===y&&r.pathsNegative.push([a,s]),a=[],s=[],y=void 0}function t(e,t){for(var a=0;athis.getTo()){g=this.interpolate(this.serie1,this.getTo()),c=this.interpolate(this.serie2,this.getTo()),h=this.computeCrossing(a[a.length-2],a[a.length-1],this.getTo(),g,s[s.length-2],s[s.length-1],this.getTo(),c),h&&(a.push(h.x),a.push(h.y),s.push(h.x),s.push(h.y),e(),a.push(h.x),a.push(h.y),s.push(h.x),s.push(h.y),y=this.serie1.data[n][o+1]>this.serie2.data[l][p+1]),a.push(this.getTo()),a.push(g),s.push(this.getTo()),s.push(c),f=!0;break}if(!m)if(m=this.serie2.searchClosestValue(this.serie1.data[n][o]),m)l=m.dataIndex,p=2*m.xBeforeIndex,g=this.interpolate(this.serie2,this.serie1.data[n][o]),a.push(this.serie1.data[n][o]),a.push(this.serie1.data[n][o+1]),s.push(this.serie1.data[n][o]),s.push(g),y=this.serie1.data[n][o+1]>g;else continue;for(x=!1,h=this.computeCrossing(a[a.length-2],a[a.length-1],this.serie1.data[n][o],this.serie1.data[n][o+1],s[s.length-2],s[s.length-1],this.serie2.data[l][p],this.serie2.data[l][p+1]),h&&(a.push(h.x),a.push(h.y),s.push(h.x),s.push(h.y),e(),a.push(h.x),a.push(h.y),s.push(h.x),s.push(h.y),y=this.serie1.data[n][o+1]>this.serie2.data[l][p+1]);this.serie2.data[l][p]this.serie2.data[l][p+1])}!1===x?(a.push(this.serie1.data[n][o]),a.push(this.serie1.data[n][o+1])):(a.push(x),a.push(this.interpolate(this.serie1,x)),m=!1,o-=2,e())}if(f){e();break}g=this.interpolate(this.serie2,a[a.length-2]),g&&(s.push(a[a.length-2]),s.push(g)),e(),o=0,m=!1}var b=this.pathsPositive.reduce(t,'');this.positivePolyline.setPointsPx(b).redraw();var b=this.pathsNegative.reduce(t,'');this.negativePolyline.setPointsPx(b).redraw()}interpolate(e,t){var i=e.searchClosestValue(t);if(!i)return!1;if(void 0==i.xMax)return i.yMin;if(void 0==i.xMin)return i.yMax;var r=(t-i.xMin)/(i.xMax-i.xMin);return(1-r)*i.yMin+r*i.yMax}computeCrossing(e,t,i,r,a,s,n,o){var l=(r-t)/(i-e),d=(o-s)/(n-a),p=r-l*i;if(e==i||a==n)return!1;if(l==d)return{x:e,y1:t,y2:t};var g=(p-(o-d*n))/(d-l);return g>i||gn?!1:{x:g,y:l*g+p}}getPositivePolyline(){return this.positivePolyline}getNegativePolyline(){return this.negativePolyline}}t.default=a,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(3),i(11),i(14),i(0),i(5),i(16),i(2),i(9)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r,a,s,n,l,d,g){'use strict';function u(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,'__esModule',{value:!0});var c=u(i),h=u(r),x=u(a),m=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(s),y=u(n),f=u(l),b=u(d),A=u(g);class k extends y.default{constructor(){super(...arguments),this.subSeries=[]}setData(){return super.setData(...arguments),this.subSeries.map((e)=>{e.data=this.data}),this}draw(){return this.eraseMarkers(),this}getSymbolForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getSymbolForLegend()}getMarkerForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getMarkerForLegend()}}class M extends f.default{constructor(){super(...arguments),this.subSeries=[]}setData(){return super.setData(...arguments),this.subSeries.map((e)=>{e.data=this.data}),this}draw(){return this}getSymbolForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getSymbolForLegend()}getMarkerForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getMarkerForLegend()}}var S=['constructor','init','draw','setLineColor','setLineWidth','setLineStyle','getLineColor','getLineWidth','getLineStyle','setMarkers','showMarkers','hideMarkers','getMarkerDom','getMarkerDomIndependant','getMarkerPath','eraseMarkers','_recalculateMarkerPoints'];Object.getOwnPropertyNames(y.default.prototype).concat([]).map(function(e){-1{i[e](...t)})}}(e))});class _ extends b.default{constructor(){super(...arguments),this.series=new Map}static defaults(){return{axes:{margins:{high:5,low:5}}}}init(e){this.graph=e}newXAxis(e){return this.newBottomAxis(e)}newYAxis(e){return this.newLeftAxis(e)}newTopAxis(e){return e=this.getOptions(e),new P(this.graph,'top',e)}newBottomAxis(e){return e=this.getOptions(e),new P(this.graph,'bottom',e)}newLeftAxis(e){return e=this.getOptions(e),new w(this.graph,'left',e)}newRightAxis(e){return e=this.getOptions(e),new w(this.graph,'right',e)}getOptions(e){var t={marginMin:this.options.axes.margins.low,marginMax:this.options.axes.margins.high};return m.extend(!0,t,e)}preDraw(){var e,t;this.series.forEach(({serie:i})=>{e=i.getXAxis(),t=i.getYAxis();let r=1;for(e.splitNumber&&(r*=e.splitNumber),t.splitNumber&&(r*=t.splitNumber);i.subSeries.lengthr;){let e=this.graph.getSerie(i.getName()+'_'+(i.subSeries.length-1));e&&e.kill&&e.kill(),i.subSeries.pop()}!i.getXAxis().splitNumber&&i.getXAxis().splitAxis&&i.getXAxis().splitAxis(),!i.getYAxis().splitNumber&&i.getYAxis().splitAxis&&i.getYAxis().splitAxis(),i.subSeries.map((t,r)=>{var a,s;if(i.getXAxis().getSubAxis){let t=r%(e.splitNumber||1);a=i.getXAxis().getSubAxis(t)}else a=i.getXAxis();if(t.setXAxis(a),i.getYAxis().getSubAxis){let t=p(r/(e.splitNumber||1));s=i.getYAxis().getSubAxis(t)}else s=i.getYAxis();t.setYAxis(s),t.draw(!0)})})}newSerie(e,t={},i){switch(i){case'line':return this.newLineSerie(e,t);break;case'scatter':return this.newScatterSerie(e,t);}throw'Cannot create a split serie of type '+i}newLineSerie(e,t){var i={type:'lineSerie',serie:new k(e,t,'line')};return this.series.set(e,i),i.serie.init(this.graph,e,t),this.graph.series.push(i.serie),i.serie}newScatterSerie(e,t){var i={type:'scatterSerie',serie:new M(e,t,'scatter')};return this.series.set(e,i),i.serie.init(this.graph,t),this.graph.series.push(i.serie),i.serie}}var v={splitMarks:!0},C=function(e){var t=class extends e{constructor(e,t,i={}){super(e,t,i),this.axes=[],this.position=t,this.constructorOptions=m.extend(!0,{},v,i),this._splitVal=[]}all(e){if('function'==typeof e)return this.axes.map(e),this}splitAxis(...e){e.push(1);let t=e.length;for(;this.axes.length>t;)this.axes.pop().kill(!0,!0);for(;this.axes.lengththis._splitVal.length)&&(super.setMinMaxToFitSeries(...arguments),this._splitVal[0]=this._splitVal[0]||[],this._splitVal[this._splitVal.length-1]=this._splitVal[this._splitVal.length-1]||[],this._splitVal[0][0]=this.getCurrentMin(),this._splitVal[this._splitVal.length-1][1]=this.getCurrentMax(),this.setChunkBoundaries(this._splitVal))}draw(){this.autoSpread&&this._splitSpread();let e=0,t,i,r;if(0<=this._baseWidthIndex&&(i=this.getSubAxis(this._baseWidthIndex))&&(r=i.getSpan()),i=void 0,0<=this.fixGridFor&&(i=this.getSubAxis(this.fixGridFor))){if(void 0!==i._mean){let e=(i.getSpan()[1]-i.getSpan()[0])/(r[1]-r[0])*this._baseWidthVal;i.forceMin(i._mean-e/2),i.forceMax(i._mean+e/2)}e=i.draw(),t=i.getPrimaryTickUnit()}return this.axes.map((a)=>{if(i!==a){if(void 0!==a._mean){let e=(a.getSpan()[1]-a.getSpan()[0])/(r[1]-r[0])*this._baseWidthVal;a.forceMin(a._mean-e/2),a.forceMax(a._mean+e/2)}t&&a.forcePrimaryTickUnit(t),e=o(e,a.draw())}}),this.writeUnit(),e}setMinPx(e){super.setMinPx(e);for(let t of this.axes)t.setMinPx(e)}setMaxPx(e){super.setMaxPx(e);for(let t of this.axes)t.setMaxPx(e)}setShift(){super.setShift(...arguments);for(let e of this.axes)e.setShift(...arguments)}init(){super.init(...arguments),this.splitAxis()}getAxisPosition(){var e=0;return this.axes.map((t)=>{e=o(e,t.getAxisPosition())}),e}getSubAxis(e){if(this.axes.length<=e)throw'Impossible to reach axis. Index '+e+' is out of range';return this.axes[e]}get splitNumber(){return this._splits.length}};return['turnGridsOff','turnGridsOn','gridsOff','gridsOn','setEngineering','setScientificScaleExponent','setScientific','setLabelColor','setSecondaryGridDasharray','setPrimaryGridDasharray','setSecondaryGridsOpacity','setPrimaryGridOpacity','setSecondaryGridWidth','setPrimaryGridWidth','setSecondaryGridColor','setPrimaryGridColor','setTicksLabelColor','setSecondaryTicksColor','setPrimaryTicksColor','setAxisColor','secondaryGridOn','secondaryGridOff','primaryGridOff','primaryGridOn','setSecondaryGrid','setPrimaryGrid','setGrids','setTickPosition','setExponentialFactor','setExponentialLabelFactor','setGridLinesStyle','forcePrimaryTickUnitMin','forcePrimaryTickUnitMax','forcePrimaryTickUnit','flip','show','hide','setDisplay'].map((e)=>{t.prototype[e]=function(e){return function(){return this.axes.map((t)=>{t[e](...arguments)}),this}}(e)}),t};class P extends C(h.default){constructor(e,t){super(...arguments),this.topbottom=t}getConstructor(){return h.default}getAxisPosition(){var e=super.getAxisPosition(...arguments);return this.labelPosY=e,this.getLabel()&&(e+=this.graph.options.fontSize),e}drawLabel(){super.drawLabel(),this.label.setAttribute('y',(this.top?-1:1)*(this.graph.options.fontSize+this.labelPosY))}draw(){var e=super.draw(...arguments);return this.drawLabel(),e}}class w extends C(x.default){constructor(){super(...arguments)}getConstructor(){return x.default}drawLabel(){super.drawLabel()}equalizePosition(e){var t=e;if(this.getLabel()&&this.axes.map((i)=>{t=o(i.equalizePosition(e),t)}),this.getLabel())return this.placeLabel(this.left?-t:t),t+this.graph.options.fontSize}}m.mix(P,new h.default),m.mix(w,new x.default),t.default=_,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(0),i(2)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(i),s=function(e){return e&&e.__esModule?e:{default:e}}(r);class n extends s.default{constructor(){super(...arguments)}init(e,t){super.init(e,t)}static default(){return{}}checkHSL(e){let t={},i,r,a;return(i=e.h||e.hue)?(1>i&&(i=u(360*i)),t.hue=i):t.h=0,(r=e.s||e.saturation)?(1{if(!t.setLineColor)throw'The serie '+t.getName()+' does not implement the method `startingColor`';const a=this.buildHSLString({h:e.startingColorHSL.h+r/(i-1)*(e.endingColorHSL.h-e.startingColorHSL.h),s:e.startingColorHSL.s+r/(i-1)*(e.endingColorHSL.s-e.startingColorHSL.s),l:e.startingColorHSL.l+r/(i-1)*(e.endingColorHSL.l-e.startingColorHSL.l)});return t.setLineColor(a),a})}}t.default=n,e.exports=t['default']})},function(e,t,i){var r,a,s;(function(n,o){a=[e,t,i(0),i(2)],r=o,s='function'==typeof r?r.apply(t,a):r,!(void 0!==s&&(e.exports=s))})(this,function(e,t,i,r){'use strict';Object.defineProperty(t,'__esModule',{value:!0});var a=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t.default=e,t}(i),s=function(e){return e&&e.__esModule?e:{default:e}}(r);class n extends s.default{constructor(){super(...arguments)}static default(){return{autoPeakPicking:!1,autoPeakPickingNb:4,autoPeakPickingMinDistance:10,autoPeakPickingFormat:!1,autoPeakPickingAllowAllY:!1}}init(e,t){super.init(e,t),this.picks=[];for(var i=0,r=this.options.autoPeakPickingNb,a;i{e.kill()})}preDraw(){this.serie&&(this.detectedPeaks=[],this.lastYPeakPicking=!1)}postDraw(){if(!this.serie)return;let e=!0,t=!1,r=[],a=this.serie.getWaveform(),s;if(!a)throw'The serie must have a waveform for the peak picking to work';let n=a.getLength(),o=0,i;for(;o=s[1]&&e||i<=s[1]&&t?s=[a.getX(o),i]:(is[1]&&t)&&(t?(t=!1,e=!0):(t=!0,e=!1,r.push(s),s=!1),s=[a.getX(o),i])}var d=r,p=[],c=d.length,l,h,h,y,f,m;o=0;var b=this.graph.selectedShapes.map(function(e){return e.getProp('xval')});for(d.sort(function(e,t){return t[1]-e[1]}),f=0;othis.serie.getXAxis().getMaxPx()))&&!(!this.options.autoPeakPickingAllowAllY&&(i>this.serie.getYAxis().getMinPx()||ithis.serie.getYAxis().getPx(d[o][1])-20?(this.picks[f].setLabelPosition({x:l,y:'5px'}),this.picks[f].setLabelBaseline('hanging')):(this.picks[f].setLabelBaseline('no-change'),this.picks[f].setLabelPosition({x:l,y:d[o][1],dy:'-15px'})),this.picks[f].setProp('xval',l),this.options.autoPeakPickingFormat?this.picks[f].setLabelText(this.options.autoPeakPickingFormat.call(this.picks[f],l,f)):this.picks[f].setLabelText(u(1e3*l)/1e3+''),this.picks[f].makeLabels(),f++;this.picks[f]&&this.picks[f].isSelected();)f++;if(p.length==this.options.autoPeakPickingNb)break}}}hidePeakPicking(e){if(this._hidePeakPickingLocked||(this._hidePeakPickingLocked=e),!!this.graph.picks)for(var t=0;t} attr - A key/value hashmap of attributes\n * @param {String} [ ns = undefined ] - The namespace to use (with setAttributeNS). Default if without namespacing\n */\n function setAttributeTo(to, params, ns) {\n var i;\n\n if (ns) {\n for (i in params) {\n to.setAttributeNS(ns, i, params[i]);\n }\n } else {\n for (i in params) {\n to.setAttribute(i, params[i]);\n }\n }\n }\n\n /**\n * Maps old-style events defined within the creation (i.e. { onMouseOver: function() }) to modern event listening .on(\"mouseover\")\n * The function will read any object and select the ones starting with \"on\"\n * @params {Object} options - An option object to read the events from\n * @param {Object} source - The source object to which the options belong\n * @example util.mapEventEmission( this.options, this );\n */\n function mapEventEmission(options, source) {\n\n if (!source) {\n source = this;\n }\n\n var eventName;\n\n for (var i in options) {\n\n // Starts with onXXX\n if (i.indexOf('on') == 0 && typeof options[i] == 'function') {\n eventName = i.substring(2);\n eventName = eventName.substring(0, 1).toLowerCase() + eventName.substring(1);\n\n if (source.on) {\n\n (function (j) {\n\n source.on(eventName, function () {\n options[j].apply(source, arguments);\n });\n })(i);\n }\n }\n }\n }\n\n /**\n * @link http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript\n * @return {String} a random id\n */\n function guid() {\n //\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0,\n v = c == 'x' ? r : r & 0x3 | 0x8;\n return v.toString(16);\n });\n }\n\n function throwError(message) {\n console.error(message);\n }\n\n function warn(message) {\n console.warn(message);\n }\n\n /**\n * Checks if a variable is a numeric or not\n * @return {Boolean} true for a numeric value, false otherwise\n */\n function isNumeric(obj) {\n return !Array.isArray(obj) && obj - parseFloat(obj) + 1 >= 0;\n }\n\n /**\n * @see http://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion\n * Converts an HSL color value to RGB. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSL_color_space.\n * Assumes h, s, and l are contained in the set [0, 1] and\n * returns r, g, and b in the set [0, 255].\n *\n * @param Number h The hue\n * @param Number s The saturation\n * @param Number l The lightness\n * @return Array The RGB representation\n */\n function hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n }\n\n function hslToRgb(h, s, l) {\n var r, g, b;\n\n if (s == 0) {\n r = g = b = l; // achromatic\n } else {\n\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n\n return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];\n }\n\n function saveDomAttributes(to, attributes, identification) {\n\n if (!to) return;\n\n to._savedAttributesIds = to._savedAttributesIds || [];\n\n if (to._savedAttributesIds.indexOf(identification) > -1) {\n restoreDomAttributes(to, identification);\n }\n\n to._savedAttributes = to._savedAttributes || {};\n to._attributes = to._attributes || {};\n to._attributes[identification] = attributes;\n\n to._savedAttributesIds.push(identification);\n\n for (var i in attributes) {\n\n if (!to._savedAttributes[i]) {\n to._savedAttributes[i] = to.getAttribute(i);\n }\n\n to.setAttribute(i, attributes[i]);\n }\n }\n\n function hasSavedAttribute(dom, attr) {\n return dom._savedAttributes && dom._savedAttributes[attr] !== undefined;\n }\n\n function overwriteDomAttribute(dom, attribute, newValue) {\n if (hasSavedAttribute(dom, attribute)) {\n dom._savedAttributes[attribute] = newValue;\n }\n }\n\n function restoreDomAttributes(to, identification) {\n\n if (!to || !to._savedAttributesIds) {\n return;\n }\n\n to._savedAttributesIds.splice(to._savedAttributesIds.indexOf(identification), 1);\n delete to._attributes[identification];\n\n var attrs = {};\n\n for (var i in to._savedAttributes) {\n attrs[i] = to._savedAttributes[i];\n }\n\n for (var i = 0, l = to._savedAttributesIds.length; i < l; i++) {\n\n for (var j in to._attributes[to._savedAttributesIds[i]]) {\n attrs[j] = to._attributes[to._savedAttributesIds[i]][j];\n }\n }\n\n for (var j in attrs) {\n to.setAttribute(j, attrs[j]);\n }\n }\n\n // https://davidwalsh.name/function-debounce\n function debounce(func, wait, immediate) {\n var timeout;\n return function () {\n var context = this,\n args = arguments;\n var later = function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }\n\n function SVGParser(svgString) {\n\n var parser = new DOMParser();\n var doc = parser.parseFromString(svgString, 'image/svg+xml');\n // returns a SVGDocument, which also is a Document.\n\n return doc;\n }\n\n // http://stackoverflow.com/questions/5276953/what-is-the-most-efficient-way-to-reverse-an-array-in-javascript\n function reverseArray(array) {\n var left = null;\n var right = null;\n var length = array.length;\n for (left = 0, right = length - 1; left < right; left += 1, right -= 1) {\n var temporary = array[left];\n array[left] = array[right];\n array[right] = temporary;\n }\n return array;\n }\n\n // jQuery.fn.offset\n function getOffset(el) {\n var rect = el.getBoundingClientRect();\n return {\n top: rect.top,\n left: rect.left\n };\n }\n\n // jQuery.fn.css\n function setCSS(element, values) {\n var style = element.style;\n for (var i in values) {\n style[i] = values[i];\n }\n }\n\n function ajaxGet(options) {\n return new Promise(function (resolve, reject) {\n var request = new XMLHttpRequest();\n request.open(options.type || 'GET', options.url, true);\n if (options.json) request.setRequestHeader('Accept', 'application/json');\n request.onload = function () {\n if (request.status === 200) {\n var response = request.responseText;\n if (options.json) response = JSON.parse(response);\n resolve(response);\n } else {\n reject(new Error('Request error: ' + request.status));\n }\n };\n request.onerror = function () {\n reject(new Error('Network error: ' + request.status));\n };\n request.send();\n });\n }\n\n // https://raw.githubusercontent.com/justmoon/node-extend/888f153645115d1c6aa9a7e346e8e9cd9a83de9b/index.js\n // Copyright (c) 2014 Stefan Thomas\n var hasOwn = Object.prototype.hasOwnProperty;\n var toStr = Object.prototype.toString;\n\n var isArray = function isArray(arr) {\n if (typeof Array.isArray === 'function') {\n return Array.isArray(arr);\n }\n\n return toStr.call(arr) === '[object Array]';\n };\n\n var isPlainObject = function isPlainObject(obj) {\n if (!obj || toStr.call(obj) !== '[object Object]') {\n return false;\n }\n\n var hasOwnConstructor = hasOwn.call(obj, 'constructor');\n var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n // Not own constructor property must be Object\n if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n return false;\n }\n\n // Own properties are enumerated firstly, so to speed up,\n // if last one is own, then all properties are own.\n var key;\n for (key in obj) {/**/}\n\n return typeof key === 'undefined' || hasOwn.call(obj, key);\n };\n\n function extend() {\n var options, name, src, copy, copyIsArray, clone;\n var target = arguments[0];\n var i = 1;\n var length = arguments.length;\n var deep = false;\n\n // Handle a deep copy situation\n if (typeof target === 'boolean') {\n deep = target;\n target = arguments[1] || {};\n // skip the boolean and the target\n i = 2;\n } else if (typeof target !== 'object' && typeof target !== 'function' || target == null) {\n target = {};\n }\n\n for (; i < length; ++i) {\n options = arguments[i];\n // Only deal with non-null/undefined values\n if (options != null) {\n // Extend the base object\n for (name in options) {\n src = target[name];\n copy = options[name];\n\n // Prevent never-ending loop\n if (target !== copy) {\n // Recurse if we're merging plain objects or arrays\n if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n if (copyIsArray) {\n copyIsArray = false;\n clone = src && isArray(src) ? src : [];\n } else {\n clone = src && isPlainObject(src) ? src : {};\n }\n\n // Never move original objects, clone them\n target[name] = extend(deep, clone, copy);\n\n // Don't bring in undefined values\n } else if (typeof copy !== 'undefined') {\n target[name] = copy;\n }\n }\n }\n }\n }\n\n // Return the modified object\n return target;\n }\n\n exports.default = {};\n exports.isArray = isArray;\n exports.isPlainObject = isPlainObject;\n function mix(baseClass, mixin) {\n\n for (let prop in mixin) {\n\n if (mixin.hasOwnProperty(prop)) {\n baseClass.prototype[prop] = mixin[prop];\n }\n }\n }\n\n function emptyDom(dom) {\n while (dom.firstChild) {\n dom.removeChild(dom.firstChild);\n }\n }\n});\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(6), __webpack_require__(0), __webpack_require__(7)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.position.js'), require('../graph.util.js'), require('../dependencies/eventEmitter/EventEmitter.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphPosition, global.graphUtil, global.EventEmitter);\n global.graphShape = mod.exports;\n }\n})(this, function (module, exports, _graphPosition, _graphUtil, _EventEmitter) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphPosition2 = _interopRequireDefault(_graphPosition);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _EventEmitter2 = _interopRequireDefault(_EventEmitter);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Shape class that should be extended\n * @class Shape\n * @static\n */\n class Shape extends _EventEmitter2.default {\n\n constructor() {\n super();\n }\n\n /**\n * Initializes the shape\n * @param {Graph} graph - The graph containing the shape\n * @param {Object} properties - The properties object (not copied)\n * @return {Shape} The current shape\n */\n init(graph, properties) {\n\n var self = this;\n\n this.graph = graph;\n this.properties = properties || {};\n this.handles = [];\n this.options = this.options || {};\n\n this.group = document.createElementNS(this.graph.ns, 'g');\n\n this.group.setAttribute('clip-path', 'url(#_clipplot' + graph._creation + ')');\n\n this._selected = false;\n this.createDom();\n\n if (this._dom) {\n this._dom.jsGraphIsShape = this;\n }\n\n this.group.jsGraphIsShape = this;\n\n this.classes = [];\n this.transforms = [];\n\n if (this._data.masker) {\n\n var maskPath = document.createElementNS(this.graph.ns, 'mask');\n this.maskingId = Math.random();\n maskPath.setAttribute('id', this.maskingId);\n\n this.maskDomWrapper = document.createElementNS(this.graph.ns, 'rect');\n this.maskDomWrapper.setAttribute('fill', 'white');\n maskPath.appendChild(this.maskDomWrapper);\n\n var maskDom = this._dom.cloneNode();\n maskPath.appendChild(maskDom);\n\n this.maskDom = maskDom;\n\n this.graph.defs.appendChild(maskPath);\n }\n\n if (this.group) {\n\n if (this._dom && !this.isHTML()) {\n this.group.appendChild(this._dom);\n }\n\n this.group.addEventListener('mouseover', function (e) {\n\n self.handleMouseOver(e);\n });\n\n this.group.addEventListener('mouseout', function (e) {\n\n self.handleMouseOut(e);\n });\n\n this.group.addEventListener('mousedown', function (e) {\n\n self.graph.focus();\n\n self.handleMouseDown(e);\n });\n\n this.group.addEventListener('click', this.handleClick.bind(this));\n\n this.group.addEventListener('dblclick', function (e) {\n\n //e.preventDefault();\n // e.stopPropagation();\n\n self.handleDblClick(e);\n });\n }\n\n //\t\t\tthis.group.appendChild(this.rectEvent);\n\n this.initImpl();\n\n this.graph.emit('shapeNew', this);\n\n return this;\n }\n\n /**\n * Implentation of the init method. To be extended if necessary on extended Shape classes\n */\n initImpl() {}\n\n /**\n * @return {Object} The shape's underlying data object\n */\n getData() {\n return this._data;\n }\n\n /**\n * @returns {String} The type of the shape\n */\n getType() {\n return this.type;\n }\n\n /**\n * Removes the shape from the DOM and unlinks it from the graph\n */\n kill(keepDom) {\n\n if (this._inDom && !keepDom) {\n this.graph.removeShapeFromDom(this);\n }\n\n if (!keepDom) {\n this.graph._removeShape(this);\n }\n\n this.graph.stopElementMoving(this);\n this.graph.emit('shapeRemoved', this);\n this.emit('removed', this);\n\n this._inDom = false;\n }\n\n /**\n * Hides the shape\n * @return {Shape} The current shape\n */\n hide() {\n\n if (this.hidden) {\n return this;\n }\n\n this.hidden = true;\n if (!this.isHTML()) {\n this.group.style.display = 'none';\n } else {\n this._dom.style.display = 'none';\n }\n return this;\n }\n\n /**\n * Returns whether the shape is hidden or not\n * @return {Boolean} true if the shape is hidden, false otherwise\n */\n isHidden() {\n return this.hidden;\n }\n\n /**\n * Returns whether the shape is visible or not\n * @return {Boolean} true if the shape is visible, false if it is hidden\n */\n isVisible() {\n return !this.hidden;\n }\n\n /**\n * Shows the shape\n * @return {Shape} The current shape\n */\n show() {\n\n if (!this.hidden) {\n return this;\n }\n\n this.hidden = false;\n if (!this.isHTML()) {\n this.group.style.display = 'initial';\n } else {\n this._dom.style.display = 'initial';\n }\n\n this.redraw();\n return this;\n }\n\n /**\n * Adds a class to the shape DOM\n * @param {String} className - The class to add\n * @return {Shape} The current shape\n */\n addClass(className) {\n this.classes = this.classes || [];\n if (this.classes.indexOf(className) == -1) {\n this.classes.push(className);\n }\n this.makeClasses();\n return this;\n }\n\n /**\n * Removes a class from the shape DOM\n * @param {String} className - The class to remove\n * @return {Shape} The current shape\n */\n removeClass(className) {\n this.classes.splice(this.classes.indexOf(className), 1);\n this.makeClasses();\n return this;\n }\n\n /**\n * Builds the classes\n * @private\n * @return {Shape} The current shape\n */\n makeClasses() {\n\n if (this._dom) {\n this._dom.setAttribute('class', this.classes.join(' '));\n }\n\n return this;\n }\n\n /**\n * Triggers a ```shapeChanged``` event on the graph and a ```changed``` event on the shape\n * @return {Shape} The current shape\n */\n changed(event, parameters) {\n\n if (event) {\n this.graph.emit(event, this, parameters);\n this.emit(event, this, parameters);\n }\n\n this.emit('changed', this, parameters);\n this.graph.emit('shapeChanged', this, parameters);\n return this;\n }\n\n /**\n * Creates an event receptacle with the coordinates of the shape bounding box\n * @return {Shape} The current shape\n */\n setEventReceptacle() {\n\n if (!this.rectEvent) {\n this.rectEvent = document.createElementNS(this.graph.ns, 'rect');\n this.rectEvent.setAttribute('pointer-events', 'fill');\n this.rectEvent.setAttribute('fill', 'transparent');\n this.group.appendChild(this.rectEvent);\n this.rectEvent.jsGraphIsShape = this;\n }\n\n var box = this.group.getBBox();\n this.rectEvent.setAttribute('x', box.x);\n this.rectEvent.setAttribute('y', box.y - 10);\n this.rectEvent.setAttribute('width', box.width);\n this.rectEvent.setAttribute('height', box.height + 20);\n }\n\n /**\n * Assigns a serie to the shape\n * @param {Serie} The serie that owns the shape\n * @return {Shape} The current shape\n */\n setSerie(serie) {\n\n if (!serie) {\n return;\n }\n\n this.serie = serie;\n\n if (!serie.getXAxis || !serie.getYAxis) {\n console.error(serie);\n throw 'Serie does not implement the getXAxis or getYAxis method';\n }\n this.xAxis = serie.getXAxis();\n this.yAxis = serie.getYAxis();\n return this;\n }\n\n /**\n * @return {Serie} The serie associated to the shape\n */\n getSerie() {\n return this.serie;\n }\n\n /**\n * Assigns the shape to the default x and y axes of the graph, only if they don't exist yet\n * @return {Shape} The current shape\n * @see Graph#getXAxis\n * @see Graph#getYAxis\n */\n autoAxes() {\n\n if (!this.xAxis) {\n this.xAxis = this.graph.getXAxis();\n }\n\n if (!this.yAxis) {\n this.yAxis = this.graph.getYAxis();\n }\n\n return this;\n }\n\n /**\n * Assigns the shape to an x axis\n * @param {XAxis} The X axis related to the shape\n * @return {Shape} The current shape\n */\n setXAxis(axis) {\n this.xAxis = axis;\n return this;\n }\n\n /**\n * Assigns the shape to an y axis\n * @param {YAxis} The Y axis related to the shape\n * @return {Shape} The current shape\n */\n setYAxis(axis) {\n this.yAxis = axis;\n }\n\n /**\n * Returns the x axis associated to the shape. If non-existent, assigns it automatically\n * @return {XAxis} The x axis associated to the shape.\n */\n getXAxis() {\n\n if (!this.xAxis) {\n this.autoAxes();\n }\n\n return this.xAxis;\n }\n\n /**\n * Returns the y axis associated to the shape. If non-existent, assigns it automatically\n * @return {YAxis} The y axis associated to the shape.\n */\n getYAxis() {\n\n if (!this.yAxis) {\n this.autoAxes();\n }\n\n return this.yAxis;\n }\n\n /**\n * Sets the layer of the shape\n * @param {Number} layer - The layer number (1 being the lowest)\n * @return {Shape} The current shape\n * @see Shape#getLayer\n */\n setLayer(layer) {\n this.setProp('layer', layer);\n return this;\n }\n\n /**\n * Returns the layer on which the shape is placed\n * @return {Number} The layer number (1 being the lowest layer)\n */\n getLayer() {\n var layer = this.getProp('layer');\n\n if (layer !== undefined) {\n return layer;\n }\n\n return 1;\n }\n\n /**\n * Initial drawing of the shape. Adds it to the DOM and creates the labels. If the shape was already in the DOM, the method simply recreates the labels and reapplies the shape style, unless ```force``` is set to ```true```\n * @param {Boolean} force - Forces adding the shape to the DOM (useful if the shape has changed layer)\n * @param {Boolean} preventRedraw - Prevents the redraw method\n * @return {Shape} The current shape\n */\n draw(force, preventRedraw) {\n\n if (!this._inDom || force) {\n\n this.appendToDom();\n this._inDom = true;\n }\n\n this.makeLabels();\n\n if (!preventRedraw) {\n this.redraw();\n }\n\n this.applyStyle();\n\n return this;\n }\n\n /**\n * Redraws the shape. Repositions it, applies the style and updates the labels\n * @return {Shape} The current shape\n */\n redraw() {\n\n if (this.hidden) {\n return this;\n }\n\n this.position = this.applyPosition();\n\n this.redrawImpl();\n if (!this.position) {\n this.updateLabels();\n return this;\n }\n\n this.updateLabels();\n this._applyTransforms();\n return this;\n }\n\n /**\n * Implementation of the redraw method. Extended Shape classes should override this method\n */\n redrawImpl() {}\n\n /**\n * Sets all dumpable properties of the shape\n * @param {Object} properties - The properties object\n * @return {Shape} The current shape\n */\n setProperties(properties) {\n this.properties = properties;\n\n if (!Array.isArray(this.properties.position)) {\n this.properties.position = [this.properties.position];\n }\n var self = this;\n for (var i = 0, l = this.properties.position.length; i < l; i++) {\n\n var pos = _graphPosition2.default.check(this.properties.position[i], function (relativeTo) {\n return self.getRelativePosition(relativeTo);\n });\n\n this.properties.position[i] = pos;\n }\n\n this.emit('propertiesChanged');\n return this;\n }\n\n getRelativePosition(relativePosition) {\n\n var result;\n if ((result = /position([0-9]*)/.exec(relativePosition)) !== null) {\n return this.getPosition(result[1]);\n } else if ((result = /labelPosition([0-9]*)/.exec(relativePosition)) !== null) {\n return this.getLabelPosition(result[1]);\n }\n }\n\n /**\n * Gets all dumpable properties of the shape\n * @return {Object} properties - The properties object\n */\n getProperties(properties) {\n return this.properties;\n }\n\n /**\n * Sets a property to the shape that is remembered and can be later reexported (or maybe reimported)\n * @param {String} prop - The property to save\n * @param val - The value to save\n * @param [ index = 0 ] - The index of the property array to save the property\n * @return {Shape} The current shape\n */\n setProp(prop, val, index) {\n this.properties = this.properties || {};\n this.properties[prop] = this.properties[prop] || [];\n this.properties[prop][index || 0] = val;\n this.emit('propertyChanged', prop);\n return this;\n }\n\n /**\n * Returns a property of the shape\n * @param {String} prop - The property to retrieve\n * @param [ index = 0 ] - The index of the property array\n */\n getProp(prop, index) {\n return (this.properties[prop] || [])[index || 0];\n }\n\n /**\n * Returns all the properties of the shape\n * @param {String} prop - The property to retrieve\n */\n getProps(prop, index) {\n return this.properties[prop] || [];\n }\n\n /**\n * Adds a property to the property array\n * @param {String} prop - The property to add\n * @param val - The value to save\n */\n addProp(prop, value) {\n this.properties[prop] = this.properties[prop] || [];\n this.properties[prop].push(value);\n }\n\n /**\n * Resets the property array\n * @param {String} prop - The property to reset\n */\n resetProp(prop) {\n this.properties[prop] = [];\n }\n\n /**\n * Sets a DOM property to the shape\n */\n setDom(prop, val, noForce) {\n if (this._dom) {\n\n if (!noForce || !util.hasSavedAttribute(this._dom, prop)) {\n this._dom.setAttribute(prop, val);\n }\n }\n }\n\n /**\n * Sets a DOM property to the shape group\n */\n setDomGroup(prop, val) {\n if (this.group) {\n this.group.setAttribute(prop, val);\n }\n }\n\n /**\n * Saves the stroke color\n * @return {Shape} The current shape\n */\n setStrokeColor(color) {\n this.setProp('strokeColor', color);\n this.overwriteSavedProp('stroke', color);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the stroke color\n * @return {String} The stroke color of the shape\n */\n getStrokeColor() {\n return this.getProp('strokeColor');\n }\n\n /**\n * Saves the fill color\n * @param {String} color - The filling color\n * @return {Shape} The current shape\n */\n setFillColor(color) {\n\n this.setProp('fillColor', color);\n this.overwriteSavedProp('fill', color);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the fill color\n * @return {String} The fill color of the shape\n */\n getFillColor() {\n return this.getProp('fillColor');\n }\n\n /**\n * Saves the opacity of the filling color of the shape\n * @param {Number} opacity - The filling opacity (0 to 1)\n * @return {Shape} The current shape\n */\n setFillOpacity(opacity) {\n this.setProp('fillOpacity', opacity);\n this.overwriteSavedProp('fill-opacity', opacity);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Saves the stroke width\n * @param {String} width - The stroke width\n * @return {Shape} The current shape\n */\n setStrokeWidth(width) {\n this.setProp('strokeWidth', width);\n this.overwriteSavedProp('stroke-width', width);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the stroke width\n * @return {String} The stroke width of the shape\n */\n getStrokeWidth() {\n return this.getProp('strokeWidth');\n }\n\n /**\n * Saves the stroke dash array\n * @param {String} dasharray - The dasharray string\n * @example shape.setStrokeDasharray(\"5,5,1,4\");\n * shape.applyStyle();\n * @return {Shape} The current shape\n */\n setStrokeDasharray(dasharray) {\n this.setProp('strokeDasharray', dasharray);\n this.overwriteSavedProp('stroke-dasharray', dasharray);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Sets any extra attributes to the DOM element of the shape\n * @param {Object} attributes - An extra attribute array to apply to the shape DOM\n * @example shape.setAttributes( { \"data-bindable\" : true } );\n * shape.applyStyle();\n * @return {Shape} The current shape\n */\n setAttributes(attributes) {\n this.setProp('attributes', attributes);\n return this;\n }\n\n overwriteSavedProp(prop, newValue) {\n util.overwriteDomAttribute(this._dom, prop, newValue);\n }\n\n /**\n * Adds an extra attribute to the shape\n * @param {String} attributeName - The name of the attribute\n * @param {String} attributeValue - The value of the attribute\n * @return {Shape} The current shape\n */\n addAttribute(attributeName, attributeValue) {\n var added = {};\n added[attributeName] = attributeValue;\n this.addProp('attributes', added);\n return this;\n }\n\n /**\n * Adds a transform property to the shape.\n * @param {String} type - The transform type (\"rotate\", \"transform\" or \"scale\")\n * @param {String} args - The arguments following the transform\n * @return {Shape} The current shape\n */\n addTransform(type, args) {\n this.addProp('transforms', {\n type: type,\n arguments: Array.isArray(args) ? args : [args]\n });\n return this;\n }\n\n /**\n * Resets the transforms\n * @see Shape#addTransform\n * @return {Shape} The current shape\n */\n resetTransforms() {\n this.resetProp('transforms');\n return this;\n }\n\n /**\n * Sets the text of the label\n * @param {String} text - The text of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelText(text, index = 0) {\n this.setProp('labelText', text, index);\n return this;\n }\n\n /**\n * Sets the text of the label\n * @param {String} data - Some additional HTML tags that will be set to the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelData(data, text, index = 0) {\n this.setProp('labelData', text, index);\n return this;\n }\n\n /**\n * Returns the text of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {String} The text of the label\n */\n getLabelText(text, index = 0) {\n return this.getProp('labelText', index);\n }\n\n /**\n * Displays a hidden label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n displayLabel(index = 0) {\n this.setProp('labelVisible', true, index);\n return this;\n }\n\n /**\n * Hides a displayed label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n hideLabel(index = 0) {\n this.setProp('labelVisible', false, index);\n return this;\n }\n\n /**\n * Sets the color of the label\n * @param {String} color - The color of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelColor(color, index = 0) {\n this.setProp('labelColor', color, index);\n return this;\n }\n\n /**\n * Sets the font size of the label\n * @param {String} size - The font size (in px) of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelFontSize(size, index = 0) {\n this.setProp('labelFontSize', size, index);\n return this;\n }\n\n /**\n * Returns the position of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Position} The current position of the label\n */\n getLabelPosition(index = 0) {\n return this.getProp('labelPosition', index);\n }\n\n /**\n * Sets the position of the label\n * @param {Position} position - The position of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelPosition(position, index) {\n\n var self;\n var pos = _graphPosition2.default.check(position, function (relativeTo) {\n return self.getRelativePosition(relativeTo);\n });\n\n this.setProp('labelPosition', pos, index || 0);\n return this;\n }\n\n /**\n * Sets the angle of the label\n * @param {Number} angle - The angle of the label in degrees (0 to 360°)\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelAngle(angle, index) {\n this.setProp('labelAngle', angle, index || 0);\n return this;\n }\n\n /**\n * Sets the baseline of the label, which affects its y position with respect to the text direction. For text along the x direction, different baselines will reference differently the text to the ```y``` coordinate.\n * @param {String} baseline - The baseline of the label. Most common baselines are ```no-change```, ```central```, ```middle``` and ```hanging```. You will find an explanation of those significations on the [corresponding MDN article]{@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/dominant-baseline}\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBaseline(baseline, index) {\n this.setProp('labelBaseline', baseline, index || 0);\n return this;\n }\n\n /**\n * Sets the anchoring of the label.\n * @param {String} anchor - The anchor of the label. Values can be ```start```, ```middle```, ```end``` or ```inherit```.\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelAnchor(anchor, index) {\n this.setProp('labelAnchor', anchor, index || 0);\n return this;\n }\n\n /**\n * Sets the anchoring of the label.\n * @param {String} size - The font size in px\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelSize(size, index) {\n this.setProp('labelSize', size, index || 0);\n return this;\n }\n\n /**\n * Sets the color of the stroke of the label.\n * @param {String} color - The color of the stroke\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelStrokeColor(color, index) {\n this.setProp('labelStrokeColor', color, index || 0);\n return this;\n }\n\n /**\n * Sets the width of the stroke of the label.\n * @param {Number} width - The width of the stroke\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelStrokeWidth(width, index) {\n this.setProp('labelStrokeWidth', width, index || 0);\n return this;\n }\n\n /**\n * Sets the color of the background of the label.\n * @param {String} color - The color of the background\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBackgroundColor(color, index) {\n this.setProp('labelBackgroundColor', color, index || 0);\n return this;\n }\n\n /**\n * Sets the opacity of the background of the label.\n * @param {Number} opacity - The opacity of the background, between 0 and 1\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBackgroundOpacity(opacity, index) {\n this.setProp('labelBackgroundOpacity', opacity, index || 0);\n return this;\n }\n\n /**\n * Applies the generic style to the shape. This is a method that applies to most shapes, hence should not be overridden. However if you create a bundle of shapes that extend another one, you may use it to set common style properties to all your shapes.\n * @return {Shape} The current shape\n */\n applyGenericStyle() {\n\n this.setDom('fill', this.getProp('fillColor'), true);\n this.setDom('fill-opacity', this.getProp('fillOpacity'), true);\n this.setDom('stroke', this.getProp('strokeColor'), true);\n this.setDom('stroke-width', this.getProp('strokeWidth'), true);\n this.setDom('stroke-dasharray', this.getProp('strokeDasharray'), true);\n\n var attributes = this.getProps('attributes');\n for (var j = 0, l = attributes.length; j < l; j++) {\n\n for (var i in attributes[j]) {\n this.setDom(i, typeof attributes[j][i] == 'function' ? attributes[j][i].call(this, i) : attributes[j][i], true);\n }\n }\n\n this._applyTransforms();\n\n return this;\n }\n\n /**\n * Applies the style to the shape. This method can be extended to apply specific style to the shapes\n * @return {Shape} The current shape\n */\n applyStyle() {\n\n return this.applyGenericStyle();\n }\n\n /**\n * Returns a computed position object\n * @param {(Number|Position)} [ index = 0 ] - The index of the position to compute\n * @param {Position} relToPosition - A base position from which to compute the position (useful for dx values)\n * @return {Object} The computed position object in the format { x: x_in_px, y: y_in_px }\n */\n calculatePosition(index) {\n\n var position;\n\n position = index instanceof _graphPosition2.default ? index : this.getPosition(index);\n\n if (!position) {\n return;\n }\n\n if (position && position.compute) {\n return position.compute(this.graph, this.getXAxis(), this.getYAxis(), this.getSerie());\n }\n\n this.graph.throw();\n }\n\n /**\n * Returns a stored position object\n * @param {Number} [ index = 0 ] - The index of the position to compute\n * @return {Position} The position at the proper index, or undefined\n */\n getPosition(index) {\n\n var pos = this.getProp('position', index || 0);\n this.setProp('position', pos = _graphPosition2.default.check(pos), index);\n return pos;\n }\n\n /**\n * Sets a position object\n * @param {Position} position - The position object to store\n * @param {Number} [ index = 0 ] - The index of the position to store\n * @return {Shape} The current shape\n */\n setPosition(position, index) {\n\n var self = this;\n var pos = _graphPosition2.default.check(position, function (relativeTo) {\n return self.getRelativePosition(relativeTo);\n });\n\n return this.setProp('position', pos, index || 0);\n }\n\n /**\n * Sorts the positions\n * @param {Function} sortFunction - Function passed into the ```Array.sort``` method\n * @return {Position} The current shape\n */\n sortPositions(sortFunction) {\n this.getProps('position').sort(sortFunction);\n return this;\n }\n\n /**\n * Applies the style to the shape. This method can be extended to apply specific style to the shapes\n * @private\n * @return {Shape} The current shape\n */\n _applyTransforms() {\n\n var transforms = this.getProp('transforms'),\n transformString = '';\n\n if (!transforms) {\n return;\n }\n transforms = Array.isArray(transforms) ? transforms : [transforms];\n\n if (transforms.length == 0) {\n return;\n }\n\n for (var i = 0; i < transforms.length; i++) {\n\n transformString += transforms[i].type + '(';\n\n switch (transforms[i].type) {\n\n case 'translate':\n\n let transform = transforms[i].arguments[0].compute(this.graph, this.getXAxis(), this.getYAxis(), this.getSerie());\n\n transformString += transform.x;\n transformString += ', ';\n transformString += transform.y;\n break;\n\n case 'rotate':\n\n transformString += transforms[i].arguments[0];\n transformString += ', ';\n\n if (transforms[i].arguments.length == 1) {\n var p = this.computePosition(0);\n transformString += p.x + ', ' + p.y;\n } else {\n\n transformString += _graphPosition2.default.getDeltaPx(transforms[i].arguments[1], this.getXAxis()).replace('px', '');\n transformString += ', ';\n transformString += _graphPosition2.default.getDeltaPx(transforms[i].arguments[2], this.getYAxis()).replace('px', '');\n }\n\n break;\n }\n\n transformString += ') ';\n }\n\n this.setDomGroup('transform', transformString);\n return this;\n }\n\n /**\n * Creates all the labels\n * @private\n * @returns {Shape} The current shape\n */\n makeLabels() {\n\n this._labels = this._labels || [];\n this._labelsBackground = this._labelsBackground || [];\n\n this._labels.map(label => {\n this.group.removeChild(label);\n });\n\n this._labelsBackground.map(bg => {\n this.group.removeChild(bg);\n });\n\n this._labels = [];\n this._labelsBackground[i] = [];\n\n var i = 0;\n\n while (this.getProp('labelText', i) !== undefined) {\n\n if (!this._labels[i]) {\n\n this._labels[i] = document.createElementNS(this.graph.ns, 'text');\n this._labels[i].setAttribute('data-label-i', i);\n this._labels[i].jsGraphIsShape = this;\n\n this._labelsBackground[i] = document.createElementNS(this.graph.ns, 'rect');\n this._labelsBackground[i].setAttribute('data-label-i', i);\n this._labelsBackground[i].jsGraphIsShape = this;\n\n this.group.appendChild(this._labelsBackground[i]);\n this.group.appendChild(this._labels[i]);\n\n this._labels[i].addEventListener('dblclick', e => {\n e.stopPropagation();\n\n this.labelDblClickListener(e);\n });\n\n this._labelsBackground[i].addEventListener('dblclick', e => {\n e.stopPropagation();\n\n this.labelDblClickListener(e);\n });\n }\n\n i++;\n }\n\n this.updateLabels();\n\n return this;\n }\n\n /**\n * Determines if the label is editable\n * @param {Number} labelIndex - The index of the label\n * @return {Boolean} ```true``` if the label is editable, ```false``` otherwise\n */\n isLabelEditable(labelIndex) {\n return this.getProp('labelEditable', labelIndex || 0);\n }\n\n /**\n * Applies the label data to the dom object\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {Shape} The current shape\n */\n updateLabels() {\n\n var self = this;\n this._labels = this._labels || [];\n\n for (var i = 0, l = this._labels.length; i < l; i++) {\n this._applyLabelData(i);\n }\n }\n\n /**\n * Applies the label data to the dom object\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {Shape} The current shape\n */\n _applyLabelData(labelIndex) {\n\n labelIndex = labelIndex || 0;\n\n /** Sets the position */\n\n var visible = this.getProp('labelVisible', labelIndex);\n\n if (visible === false) {\n this._labels[labelIndex].setAttribute('display', 'none');\n this._labelsBackground[labelIndex].setAttribute('display', 'none');\n return;\n } else {\n this._labels[labelIndex].setAttribute('display', 'initial');\n this._labelsBackground[labelIndex].setAttribute('display', 'initial');\n }\n\n var position = this.calculatePosition(_graphPosition2.default.check(this.getProp('labelPosition', labelIndex)));\n\n if (isNaN(position.x) || isNaN(position.y) || position.y === false || position.x === false) {\n /*console.warn( \"Cannot compute positioning for labelIndex \" + labelIndex + \" with text \" + this.getProp( \"labelText\", labelIndex ) );\n console.log( this, this._labels );\n console.trace();*/\n return;\n }\n\n if (position.x != 'NaNpx' && !isNaN(position.x) && position.x !== 'NaN' && position.x !== false) {\n\n this._labels[labelIndex].setAttribute('x', position.x);\n this._labels[labelIndex].setAttribute('y', position.y);\n }\n\n /** Sets the angle */\n var currAngle = this.getProp('labelAngle', labelIndex) || 0;\n if (currAngle != 0) {\n\n var x = this._labels[labelIndex].getAttribute('x'),\n y = this._labels[labelIndex].getAttribute('y');\n\n this._labels[labelIndex].setAttribute('transform', 'rotate(' + currAngle + ' ' + x + ' ' + y + ')');\n // this._labelsBackground[ labelIndex ].setAttribute( 'transform', 'rotate(' + currAngle + ' ' + x + ' ' + y + ')' );\n }\n\n let labelData = this.getProp('labelHTMLData', labelIndex) || {};\n\n for (var i in labelData) {\n\n this._labels[labelIndex].setAttribute(i, labelData[i]);\n this._labelsBackground[labelIndex].setAttribute(i, labelData[i]);\n }\n\n /** Sets the baseline */\n this._labels[labelIndex].setAttribute('dominant-baseline', this.getProp('labelBaseline', labelIndex) || 'no-change');\n\n /** Sets the text */\n this._labels[labelIndex].textContent = this.getProp('labelText', labelIndex);\n\n /** Sets the color */\n this._labels[labelIndex].setAttribute('fill', this.getProp('labelColor', labelIndex) || 'black');\n\n /** Sets the size */\n this._labels[labelIndex].setAttribute('font-size', this.getProp('labelSize', labelIndex) + 'px' || '12px');\n\n /** Sets the anchor */\n this._labels[labelIndex].setAttribute('text-anchor', this._getLabelAnchor(labelIndex));\n\n /** Sets the stroke */\n this._labels[labelIndex].setAttribute('stroke', this.getProp('labelStrokeColor', labelIndex) || 'black');\n\n /** Sets the stroke */\n this._labels[labelIndex].setAttribute('stroke-width', this.getProp('labelStrokeWidth', labelIndex) || 0 + 'px');\n\n this._labels[labelIndex].setAttribute('stroke-location', 'outside');\n\n let rect = this._labels[labelIndex].getBBox();\n\n this._labelsBackground[labelIndex].setAttribute('x', rect.x);\n this._labelsBackground[labelIndex].setAttribute('y', rect.y);\n this._labelsBackground[labelIndex].setAttribute('width', rect.width);\n this._labelsBackground[labelIndex].setAttribute('height', rect.height);\n\n this._labelsBackground[labelIndex].setAttribute('fill', this.getProp('labelBackgroundColor') || 'transparent');\n this._labelsBackground[labelIndex].setAttribute('fill-opacity', this.getProp('labelBackgroundOpacity') || 1);\n\n return this;\n }\n\n /**\n * Temporarily empties the labels, until the next rendering.\n * This is used when the shape should not be displayed\n * @returns {Shape} The current shape instance\n */\n emptyLabels() {\n\n for (var i = 0, l = this._labels.length; i < l; i++) {\n /** Sets the baseline */\n this._labels[i].textContent = '';\n }\n\n return this;\n }\n\n /**\n * Returns the anchor of the label\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {String} The anchor in SVG string\n */\n _getLabelAnchor(labelIndex) {\n var anchor = this.getProp('labelAnchor', labelIndex);\n switch (anchor) {\n case 'middle':\n case 'start':\n case 'end':\n return anchor;\n break;\n\n case 'right':\n return 'end';\n break;\n\n case 'left':\n return 'start';\n break;\n\n default:\n return 'start';\n break;\n }\n }\n\n /**\n * Returns the shape selection status\n * @returns {Boolean} true is the shape is selected, false otherwise\n */\n isSelected() {\n return this._selectStatus || false;\n }\n\n /**\n * Sets or queries whether the shape can have handles. Even if the property is set to false, the getter can return true if the property ```statichandles``` is true (used when handles never disappear)\n * @param {Boolean} setter - If used, defined if the shape has handles or not\n * @returns {Boolean} true is the shape has handles, false otherwise\n * @example Shape.hasHandles( true ); // Sets that the shape has handles\n * @example Shape.hasHandles( false ); // Sets that the shape has no handles\n * @example Shape.hasHandles( ); // Queries the shape to determine if it has handles or not. Also returns true if handles are static\n */\n hasHandles(setter) {\n\n if (setter !== undefined) {\n this.setProp('handles', setter);\n }\n\n return !!this.getProp('handles') || !!this.getProp('staticHandles');\n }\n\n /**\n * Adds shape handles\n * @private\n * @return {Shape} The current shape\n */\n addHandles() {\n\n if (this.isLocked()) {\n return;\n }\n\n if (!this.handlesInDom) {\n\n this.handlesInDom = true;\n\n for (var i = 1; i < this.handles.length; i++) {\n\n if (this.handles[i]) {\n this.group.appendChild(this.handles[i]);\n }\n }\n }\n\n return this;\n }\n\n /**\n * Remove shape handles\n * @private\n * @return {Shape} The current shape\n */\n removeHandles() {\n\n this.hideHandles();\n this.handles = [];\n }\n\n /**\n * Hide shape handles\n * @private\n * @return {Shape} The current shape\n */\n hideHandles() {\n\n if (!this.handlesInDom) {\n return this;\n }\n\n for (var i = 1; i < this.handles.length; i++) {\n this.group.removeChild(this.handles[i]);\n }\n\n this.handlesInDom = false;\n return this;\n }\n\n /**\n * @protected\n * @return {Boolean} ```true``` if the handles are in the DOM\n */\n areHandlesInDom() {\n\n return this.handlesInDom;\n }\n\n /**\n * Selects the shape. Should only be called from jsGraph main instance\n * @private\n * @param {Boolean} [ mute = false ] - Mutes the method (no event emission)\n * @returns {Shape} the current shape\n */\n _select(mute) {\n\n if (!this.isSelectable()) {\n return false;\n }\n\n // Put on the stack\n this.appendToDom();\n //this.graph.appendShapeToDom( this ); // Put the shape on top of the stack !\n\n this._selectStatus = true;\n\n this.applySelectedStyle();\n\n if (this.hasHandles() && !this.hasStaticHandles()) {\n\n this.addHandles();\n this.setHandles();\n }\n\n if (!mute) {\n this.graph.emit('shapeSelected', this);\n }\n }\n\n applySelectedStyle() {\n\n if (!this._selectStatus) {\n return;\n }\n\n var style = this.getSelectStyle();\n var style2 = {};\n for (var i in style) {\n if (typeof style[i] == 'function') {\n style2[i] = style[i].call(this);\n } else {\n style2[i] = style[i];\n }\n }\n\n util.saveDomAttributes(this._dom, style2, 'select');\n }\n\n /**\n * Unselects the shape. Should only be called from jsGraph main instance\n * @private\n * @param {Boolean} [ mute = false ] - Mutes the method (no event emission)\n * @returns {Shape} the current shape\n */\n _unselect(mute) {\n\n this._selectStatus = false;\n\n util.restoreDomAttributes(this._dom, 'select');\n\n if (this.hasHandles() && !this.hasStaticHandles()) {\n this.hideHandles();\n }\n\n if (!mute) {\n this.graph.emit('shapeUnselected', this);\n }\n }\n\n /**\n * Returns the special style of the shape when it is selected.\n * @see Shape#setSelectStyle\n * @param {Object} The SVG attributes to apply to the shape\n */\n getSelectStyle() {\n return this.selectStyle;\n }\n\n /**\n * Defines the style that is applied to the shape when it is selected. The style extends the default style of the shape\n * @param {Object} [ attr = {} ] - The SVG attributes to apply to the shape\n * @example rectangle.setSelectStyle( { fill: 'red' } );\n * @returns {Shape} the current shape\n */\n setSelectStyle(attr) {\n this.selectStyle = attr;\n this.applySelectedStyle(); // Maybe the shape is already selected\n return this;\n }\n\n /**\n * Assigns static handles to the shape. In this mode, handles will not disappear\n * @param {Boolean} staticHandles - true to enable static handles, false to disable them.\n * @returns {Shape} the current shape\n */\n setStaticHandles(staticHandles) {\n this.setProp('staticHandles', staticHandles);\n }\n\n /**\n * @returns {Boolean} ```true``` if the shape has static handles, ```false``` otherwise\n */\n hasStaticHandles(staticHandles) {\n return !!this.getProp('staticHandles');\n }\n\n /**\n * Creates the handles for the shape\n * @param {Number} nb - The number of handles\n * @param {String} type - The type of SVG shape to use\n * @param {Object} [ attr = {} ] - The SVG attributes to apply to the handles\n * @param {Function} [ callbackEach ] - An additional callback the user can provide to further personalize the handles\n * @returns {Shape} the current shape\n * @private\n */\n _createHandles(nb, type, attr, callbackEach) {\n\n if (this.handles && this.handles.length > 0) {\n return;\n }\n\n var self = this;\n\n for (var i = 1, l = nb; i <= l; i++) {\n\n (j => {\n\n var self = this;\n\n var handle = document.createElementNS(self.graph.ns, type);\n handle.jsGraphIsShape = true;\n\n if (attr) {\n for (var k in attr) {\n handle.setAttribute(k, attr[k]);\n }\n }\n\n handle.addEventListener('mousedown', e => {\n\n if (self.isResizable()) {\n\n e.preventDefault();\n e.stopPropagation();\n\n self.graph.emit('beforeShapeResize', self);\n this.emit('beforeShapeResize');\n\n if (!self.graph.prevent(false)) {\n\n self.resizing = true;\n self.handleSelected = j;\n self.handleMouseDown(e);\n }\n }\n });\n\n if (callbackEach) {\n callbackEach(self.handles[j]);\n }\n\n self.handles[j] = handle;\n }).call(this, i);\n }\n\n return this.handles;\n }\n\n /**\n * Creates the handles for the shape. Should be implemented by the children shapes classes.\n */\n createHandles() {\n\n if (this.hasStaticHandles()) {\n this.addHandles();\n this.setHandles();\n }\n }\n\n /**\n * Handles mouse down event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseDownImpl() {}\n\n /**\n * Handles the mouse move event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseMoveImpl() {}\n\n /**\n * Handles mouse up event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseUpImpl() {}\n\n /**\n * Called when the shape is created\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleCreateImpl() {}\n\n /**\n * Handles mouse down events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDownImpl} method.prototype\n */\n handleMouseDown(e) {\n\n //this.handleSelected = false;\n\n if (this.isLocked()) {\n return;\n }\n\n if (this.isMovable() || this.isResizable()) {\n\n this.graph.elementMoving(this);\n }\n\n if (this.getProp('selectOnMouseDown')) {\n this.graph.selectShape(this);\n }\n\n if (this.isMovable()) {\n if (!this.resizing) {\n\n this.graph.emit('beforeShapeMove', self);\n\n if (!this.graph.prevent(false)) {\n\n this.moving = true;\n this.moved = false;\n }\n }\n }\n\n this._mouseCoords = this.graph._getXY(e);\n return this.handleMouseDownImpl(e, this._mouseCoords);\n }\n\n /**\n * Handles mouse click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDownClick} method\n * @private\n */\n handleClick(e) {\n\n this.graph.emit('shapeClicked', this);\n this.emit('shapeClicked');\n\n if (!this.isSelectable()) {\n return false;\n }\n\n if (!e.shiftKey) {\n this.graph.unselectShapes();\n }\n\n if (this.getProp('selectOnClick')) {\n\n this.graph.selectShape(this);\n }\n }\n\n /**\n * Handles mouse click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseUpImpl} method\n * @private\n */\n handleMouseMove(e) {\n //console.log( this.resizinh, this.moving, this.isSelected(), this._mouseCoords );\n if ((this.resizing || this.moving) && !this.isSelected()) {\n this.graph.selectShape(this);\n }\n\n this.graph.emit('beforeShapeMouseMove', this);\n this.emit('beforeShapeMouseMove');\n\n if (this.graph.prevent(false) || !this._mouseCoords) {\n return false;\n }\n\n this.moved = true;\n var coords = this.graph._getXY(e);\n var deltaX = this.getXAxis().getRelVal(coords.x - this._mouseCoords.x),\n deltaY = this.getYAxis().getRelVal(coords.y - this._mouseCoords.y);\n\n if (deltaX != 0 || deltaY !== 0) {\n this.preventUnselect = true;\n }\n\n this._mouseCoords = coords;\n\n var ret = this.handleMouseMoveImpl(e, deltaX, deltaY, coords.x - this._mouseCoords.x, coords.y - this._mouseCoords.y);\n\n return ret;\n }\n\n /**\n * Handles mouse up events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseUpImpl} method\n * @private\n */\n handleMouseUp(e) {\n\n if (this.moving && this.moved) {\n\n this.graph.emit('shapeMoved', this);\n this.emit('shapeMoved');\n }\n\n if (this.handleSelected || this.resize) {\n\n this.graph.emit('shapeResized', this);\n this.emit('shapeResized');\n }\n\n this.moving = false;\n this.resizing = false;\n this.handleSelected = false;\n this.graph.elementMoving(false);\n\n return this.handleMouseUpImpl(e);\n }\n\n /**\n * Handles double click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDblClickImpl} method\n * @private\n */\n handleDblClick(e) {}\n\n /**\n * Handles mouse over events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseOverImpl} method\n * @private\n */\n handleMouseOver() {\n\n if (this.getProp('highlightOnMouseOver')) {\n\n if (!this.moving && !this.resizing) {\n this.highlight();\n }\n }\n\n this.graph.emit('shapeMouseOver', this);\n }\n\n /**\n * Handles mouse out events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseOutImpl} method\n * @private\n */\n handleMouseOut() {\n\n if (this.getProp('highlightOnMouseOver')) {\n this.unHighlight();\n }\n\n this.graph.emit('shapeMouseOut', this);\n }\n\n /*\n * Updated July 1st, 2015\n */\n\n /**\n * Locks the shape (prevents selection, resizing and moving)\n * @return {Shape} The current shape\n */\n lock() {\n this.setProp('locked', true);\n return this;\n }\n\n /**\n * Unlocks the shape (prevents selection, resizing and moving)\n * @return {Shape} The current shape\n */\n unlock() {\n this.setProp('locked', false);\n return this;\n }\n\n /**\n * @return {Boolean} True if the shape is locked, false otherwise\n */\n isLocked() {\n return this.getProp('locked') || this.graph.shapesLocked;\n }\n\n /**\n * Makes the shape moveable\n * @return {Shape} The current shape\n */\n movable(bln) {\n this.setProp('movable', true);\n }\n\n /**\n * Makes the shape non-moveable\n * @return {Shape} The current shape\n */\n unmovable() {\n this.setProp('movable', false);\n return false;\n }\n\n /**\n * @return {Boolean} True if the shape is movable, false otherwise\n */\n isMovable() {\n return this.getProp('movable');\n }\n\n /**\n * Makes the shape resizable\n * @return {Shape} The current shape\n */\n resizable() {\n this.setProp('resizable', true);\n }\n\n /**\n * Makes the shape non-resizable\n * @return {Shape} The current shape\n */\n unresizable() {\n this.setProp('resizable', false);\n }\n\n /**\n * @return {Boolean} True if the shape is resizable, false otherwise\n */\n isResizable() {\n return this.getProp('resizable');\n }\n\n /**\n * Makes the shape selectable\n * @return {Shape} The current shape\n */\n selectable() {\n this.setProp('selectable', true);\n }\n\n /**\n * Makes the shape non-selectable\n * @return {Shape} The current shape\n */\n unselectable() {\n this.graph.unselectShape(this);\n this.setProp('selectable', false);\n }\n\n /**\n * @return {Boolean} True if the shape is selectable, false otherwise\n */\n isSelectable() {\n return this.getProp('selectable');\n }\n\n /**\n * Highlights the shape with attributes\n * @returns {Shape} The current shape\n * @param {Object} [ attributes ] - A hashmap of attributes to apply. If omitted, {@link Shape#getHighlightAttributes} will be called\n * @param {String} [ saveDomName=highlight ] - The name to which the current shape attributes will be saved to be recovered later with the {@link Shape#unHighlight} method\n * @example shape.highlight( { fill: 'red', 'fill-opacity': 0.5 } );\n * @see Shape#unHighlight\n */\n highlight(attributes, saveDomName) {\n\n if (!attributes) {\n attributes = this.getHighlightAttributes();\n }\n\n if (!saveDomName) {\n saveDomName = 'highlight';\n }\n\n util.saveDomAttributes(this._dom, attributes, saveDomName);\n this.highlightImpl();\n return this;\n }\n\n /**\n * Removes the highlight properties from the same\n * @returns {Shape} The current shape\n * @param {String} [ saveDomName=highlight ] - The name to which the current shape attributes will be saved to be recovered later with the {@link Shape#unHighlight} method\n * @see Shape#highlight\n */\n unHighlight(saveDomName) {\n\n if (!saveDomName) {\n saveDomName = 'highlight';\n }\n\n util.restoreDomAttributes(this._dom, saveDomName);\n this.unHighlightImpl();\n return this;\n }\n\n highlightImpl() {}\n unHighlightImpl() {}\n\n /**\n * @returns {Object} The attributes taken by the shape when highlighted\n * @see Shape#highlight\n */\n getHighlightAttributes() {\n return this._highlightAttributes;\n }\n\n /**\n * Sets the attributes the shape will take when highlighted\n * @param {Object} [ attributes ] - A hashmap of attributes to apply when the shape is highlighted\n * @returns {Shape} The current shape\n * @see Shape#highlight\n */\n setHighlightAttributes(attributes) {\n this._highlightAttributes = attributes;\n return this;\n }\n\n /**\n * Returns the masking id of the shape. Returns null if the shape does not behave as a mask\n * @returns {String} The ```id``` attribute of the shape\n */\n getMaskingID() {\n return this.maskingId;\n }\n\n /**\n * Masks the current shape with another shape passed as the first parameter of the method\n * @param {Shape} maskingShape - The shape used to mask the current shape\n * @return {Shape} The current shape\n */\n maskWith(maskingShape) {\n\n const maskingId = maskingShape.getMaskingID();\n\n if (maskingId) {\n\n this._dom.setAttribute('mask', 'url(#' + maskingId + ')');\n } else {\n\n this._dom.removeAttribute('mask');\n }\n }\n\n /**\n * Manually updates the mask of the shape. This is needed because the shape needs to be surrounded by a white rectangle (because transparent is treated as black and will not render the shape)\n * This method will work well for rectangles but should be overridden for other shapes\n * @return {Shape} The current shape\n * @todo Explore a way to make it compatible for all kinds of shapes. Maybe the masker position should span the whole graph...\n */\n updateMask() {\n return;\n if (!this.maskDom) {\n return; // eslint-disable-line no-useless-return\n }\n\n var position = {\n x: 'min',\n y: 'min'\n };\n var position2 = {\n x: 'max',\n y: 'max'\n };\n\n position = this._getPosition(position);\n position2 = this._getPosition(position2);\n\n this.maskDomWrapper.setAttribute('x', Math.min(position.x, position2.x));\n this.maskDomWrapper.setAttribute('y', Math.min(position.y, position2.y));\n\n this.maskDomWrapper.setAttribute('width', Math.abs(position2.x - position.x));\n this.maskDomWrapper.setAttribute('height', Math.abs(position2.y - position.y));\n\n for (var i = 0; i < this._dom.attributes.length; i++) {\n this.maskDom.setAttribute(this._dom.attributes[i].name, this._dom.attributes[i].value);\n }\n\n this.maskDom.setAttribute('fill', 'black');\n\n return this;\n }\n\n labelDblClickListener(e) {\n\n var i = parseInt(e.target.getAttribute('data-label-i'));\n\n var self = this;\n\n if (isNaN(i)) {\n return;\n }\n\n if (!this.isLabelEditable(i)) {\n return;\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n var shapeLabel = document.createElement('input');\n shapeLabel.setAttribute('type', 'text');\n shapeLabel.setAttribute('value', self.getProp('labelText', i));\n\n self.graph.wrapper.prepend(shapeLabel);\n shapeLabel.select();\n\n util.setCSS(shapeLabel, {\n position: 'absolute',\n marginTop: parseInt(e.target.getAttribute('y').replace('px', '')) + this.graph.getPaddingTop() - 10 + 'px',\n marginLeft: parseInt(e.target.getAttribute('x').replace('px', '')) + this.graph.getPaddingLeft() - 50 + 'px',\n textAlign: 'center',\n width: '100px'\n });\n\n const previousValue = self.getLabelText(i);\n\n const blurEvent = function () {\n\n self.setLabelText(shapeLabel.value, i);\n self._labels[i].textContent = shapeLabel.value;\n\n const nextValue = shapeLabel.value;\n\n shapeLabel.remove();\n shapeLabel.removeEventListener('blur', blurEvent);\n shapeLabel = false;\n\n self.changed('shapeLabelChanged', {\n previousValue: previousValue,\n nextValue: nextValue\n });\n };\n\n shapeLabel.addEventListener('blur', blurEvent);\n\n shapeLabel.addEventListener('keyup', function (e) {\n\n if (e.keyCode === 13) {\n blurEvent();\n }\n });\n shapeLabel.addEventListener('keypress', function (e) {\n e.stopPropagation();\n });\n shapeLabel.addEventListener('keydown', function (e) {\n e.stopPropagation();\n });\n shapeLabel.focus();\n }\n\n /**\n * Appends the shape DOM to its parent\n * @private\n * @return {Shape} The current shape\n */\n appendToDom() {\n\n if (this._forcedParentDom) {\n\n this._forcedParentDom.appendChild(this.group);\n } else {\n this.graph.appendShapeToDom(this);\n }\n return this;\n }\n\n /**\n * Forces the DOM parent (instead of the normal layer)\n * @return {Shape} The current shape\n */\n forceParentDom(dom) {\n\n this._forcedParentDom = dom;\n\n return this;\n }\n\n isHTML() {\n return false;\n }\n }\n\n /**\n * @alias Shape#calculatePosition\n */\n Shape.prototype.computePosition = Shape.prototype.calculatePosition;\n\n /**\n * @alias Shape#displayLabel\n */\n Shape.prototype.showLabel = Shape.prototype.displayLabel;\n\n /**\n * @alias Shape#kill\n */\n Shape.prototype.remove = Shape.prototype.kill;\n\n exports.default = Shape;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(7)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../dependencies/eventEmitter/EventEmitter.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.EventEmitter);\n global.graphPlugin = mod.exports;\n }\n})(this, function (module, exports, _EventEmitter) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _EventEmitter2 = _interopRequireDefault(_EventEmitter);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Represents a plugin\n * @interface\n */\n class Plugin extends _EventEmitter2.default {\n\n static default() {\n return {};\n }\n\n constructor(options) {\n super(...arguments);\n\n this.options = Object.assign({}, Plugin.default(), this.constructor.default(), options);\n }\n\n /**\n * Init function called by jsGraph on load\n */\n init(graph) {\n this.graph = graph;\n }\n\n /**\n * Handles the mousedown event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseDown() {}\n\n /**\n * Handles the mouseup event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseUp() {}\n\n /**\n * Handles the mousemove event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseMove() {}\n }\n\n exports.default = Plugin;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(6), __webpack_require__(0), __webpack_require__(7), __webpack_require__(4)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.position.js'), require('./graph.util.js'), require('./dependencies/eventEmitter/EventEmitter.js'), require('./util/waveform.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphPosition, global.graphUtil, global.EventEmitter, global.waveform);\n global.graphCore = mod.exports;\n }\n})(this, function (module, exports, _graphPosition, _graphUtil, _EventEmitter, _waveform) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphPosition2 = _interopRequireDefault(_graphPosition);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _EventEmitter2 = _interopRequireDefault(_EventEmitter);\n\n var _waveform2 = _interopRequireDefault(_waveform);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Default graph parameters\n * @name Graph~GraphOptionsDefault\n * @name GraphOptions\n * @object\n * @static\n * @memberof Graph\n * @prop {String} title - Title of the graph\n * @prop {Number} paddingTop - The top padding\n * @prop {Number} paddingLeft - The left padding\n * @prop {Number} paddingRight - The right padding\n * @prop {Number} paddingBottom - The bottom padding\n * @prop {(Number|Boolean)} padding - A common padding value for top, bottom, left and right\n * @prop {Number} fontSize - The basic text size of the graphs\n * @prop {Number} fontFamily - The basic font family. Should be installed on the computer of the user\n * @prop {Object.} plugins - A list of plugins to import with their options\n * @prop {Object.} pluginAction - The default key combination to access those actions\n * @prop {Object.} mouseActions - Alias of pluginActions\n * @prop {Object.} keyActions - Defines what happens when keys are pressed\n * @prop {Object} wheel - Define the mouse wheel action\n * @prop {Object} dblclick - Define the double click action\n * @prop {Boolean} shapesUniqueSelection - true to allow only one shape to be selected at the time\n * @prop {Boolean} shapesUnselectOnClick - true to unselect all shapes on click\n */\n const GraphOptionsDefault = {\n\n title: '',\n\n paddingTop: 30,\n paddingBottom: 5,\n paddingLeft: 20,\n paddingRight: 20,\n\n close: {\n left: true,\n right: true,\n top: true,\n bottom: true\n },\n\n closeColor: 'black',\n\n fontSize: 12,\n fontFamily: 'Myriad Pro, Helvetica, Arial',\n\n plugins: {},\n pluginAction: {},\n mouseActions: [],\n keyActions: [],\n wheel: {},\n dblclick: {},\n\n shapesUnselectOnClick: true,\n shapesUniqueSelection: true\n };\n\n const defaultScatterStyle = {\n shape: 'circle',\n r: 4\n };\n\n var _constructors = new Map();\n\n /**\n * Entry class of jsGraph that creates a new graph.\n * @extends EventEmitter\n * @tutorial basic\n */\n class Graph extends _EventEmitter2.default {\n\n /**\n * Graph constructor\n * @param {(HTMLElement|String)} [wrapper ] - The DOM Wrapper element its ```id``` property. If you do not use the wrapper during the graph creation, use it with the @link{Graph.setWrapper} method\n * @param {GraphOptions} [ options ] - The options of the graph\n * @param {Object} [ axis ] - The list of axes\n * @param {Array} axis.left - The list of left axes\n * @param {Array} axis.bottom - The list of bottom axes\n * @param {Array} axis.top - The list of top axes\n * @param {Array} axis.right - The list of right axes\n * @example var graph = new Graph(\"someDomID\");\n * @example var graph = new Graph(\"someOtherDomID\", { title: 'Graph title', paddingRight: 100 } );\n */\n constructor(wrapper, options, axis) {\n\n super();\n\n /*\n The unique ID of the graph\n @name Graph#uniqueid\n @type String\n */\n this._creation = util.guid();\n this._drawn = false;\n\n if (wrapper === Object(wrapper) && !(wrapper instanceof HTMLElement)) {\n // Wrapper is options\n axis = options;\n options = wrapper;\n wrapper = null;\n } else if (typeof wrapper == 'string') {\n wrapper = document.getElementById(wrapper);\n } else if (typeof wrapper.length == 'number') {\n wrapper = wrapper[0];\n }\n\n /**\n * @object\n * @memberof Graph\n * @name Graph#options\n * @type GraphOptions\n * @default {@link GraphOptionsDefault}\n * Access directly the options of the graph using this public object.\n * @example graph.options.mouseActions.push( { } );\n */\n this.options = util.extend({}, GraphOptionsDefault, options);\n // Options declaration must be placed before the doDom operation\n\n // doDom is a private method. We bind it to this thanks to ES6 features\n doDom.bind(this)();\n\n if (wrapper) {\n this.setWrapper(wrapper);\n }\n\n this.prevented = false;\n\n this.axis = {\n left: [],\n top: [],\n bottom: [],\n right: []\n };\n\n this.shapes = [];\n this.shapesLocked = false;\n this.plugins = {};\n\n for (var i in this.options.pluginAction) {\n this.options.pluginAction.plugin = i;\n this.options.mouseActions.push(this.options.pluginAction);\n }\n\n this.selectedShapes = [];\n\n this.series = [];\n //this._dom = wrapper;\n this._axesHaveChanged = true;\n\n if (this.options.hasOwnProperty('padding') && util.isNumeric(this.options.padding)) {\n this.options.paddingTop = this.options.paddingBottom = this.options.paddingLeft = this.options.paddingRight = this.options.padding;\n }\n\n this.currentAction = false;\n\n this.ns = Graph.ns;\n this.nsxlink = Graph.nsxlink;\n\n // Load all axes\n if (axis) {\n for (var i in axis) {\n for (var j = 0, l = axis[i].length; j < l; j++) {\n\n switch (i) {\n\n case 'top':\n this.getTopAxis(j, axis[i][j]);\n break;\n case 'left':\n this.getLeftAxis(j, axis[i][j]);\n break;\n case 'right':\n this.getRightAxis(j, axis[i][j]);\n break;\n case 'bottom':\n this.getBottomAxis(j, axis[i][j]);\n break;\n\n default:\n // Do not do anything\n break;\n }\n }\n }\n }\n\n this._pluginsInit();\n }\n\n setWrapper(wrapper) {\n\n if (!wrapper) {\n throw new Error('The wrapper DOM element was not found.');\n }\n\n if (!wrapper.appendChild) {\n throw new Error('The wrapper appears to be an invalid HTMLElement');\n }\n\n wrapper.style['-webkit-user-select'] = 'none';\n wrapper.style['-moz-user-select'] = 'none';\n wrapper.style['-o-user-select'] = 'none';\n wrapper.style['-ms-user-select'] = 'none';\n wrapper.style['user-select'] = 'none';\n\n wrapper.style.position = 'relative';\n wrapper.style.outline = 'none';\n\n // Why would that be necessary ?\n // wrapper.setAttribute( 'tabindex', 1 );\n\n this.wrapper = wrapper;\n\n // DOM\n\n if (!this.height || !this.width) {\n var wrapperStyle = getComputedStyle(wrapper);\n var w = parseInt(wrapperStyle.width, 10);\n var h = parseInt(wrapperStyle.height, 10);\n this.setSize(w, h);\n this._resize();\n }\n\n wrapper.appendChild(this.dom);\n\n _registerEvents(this);\n }\n /**\n * Returns the graph SVG wrapper element\n * @public\n * @return {SVGElement} The DOM element wrapping the graph\n */\n getDom() {\n return this.dom;\n }\n\n /**\n * Returns the unique id representing the graph\n * @public\n * @return {String} The unique ID of the graph\n */\n getId() {\n return this._creation;\n }\n\n /**\n * Returns the graph wrapper element passed during the graph creation\n * @public\n * @return {HTMLElement} The DOM element wrapping the graph\n */\n getWrapper() {\n return this.wrapper;\n }\n\n /**\n * Sets an option of the graph\n * @param {String} name - Option name\n * @param value - New option value\n * @returns {Graph} - Graph instance\n */\n setOption(name, val) {\n this.options[name] = val;\n return this;\n }\n\n /**\n * Sets the title of the graph\n */\n setTitle(title) {\n this.options.title = title;\n this.domTitle.textContent = title;\n }\n\n /**\n * Shows the title of the graph\n */\n displayTitle() {\n this.domTitle.setAttribute('display', 'inline');\n }\n\n /**\n * Hides the title of the graph\n */\n hideTitle() {\n this.domTitle.setAttribute('display', 'none');\n }\n\n hide() {\n if (this.dom.style.display !== 'none') {\n this.dom.style.display = 'none';\n }\n }\n\n show() {\n if (this.dom.style.display == 'none') {\n this.dom.style.display = 'initial';\n }\n }\n\n /**\n * Calls a repaint of the container. Used internally when zooming on the graph, or when .autoscaleAxes() is called (see {@link Graph#autoscaleAxes}).
\n * To be called after axes min/max are expected to have changed (e.g. after an axis.zoom( from, to )) has been called\n * @param {Boolean} onlyIfAxesHaveChanged - Triggers a redraw only if min/max values of the axes have changed.\n * @return {Boolean} if the redraw has been successful\n */\n redraw(onlyIfAxesHaveChanged, force) {\n\n if (!this.width || !this.height) {\n return;\n }\n\n if (!this.sizeSet) {\n this._resize();\n this.executeRedrawSlaves();\n return true;\n } else {\n\n if (!onlyIfAxesHaveChanged || force || haveAxesChanged(this) || hasSizeChanged(this)) {\n this.executeRedrawSlaves();\n refreshDrawingZone(this);\n return true;\n }\n }\n\n this.executeRedrawSlaves(true);\n return false;\n }\n\n executeRedrawSlaves() {\n this._pluginsExecute('preDraw');\n }\n\n /**\n * Draw the graph and the series. This method will only redraw what is necessary. You may trust its use when you have set new data to series, changed serie styles or called for a zoom on an axis.\n */\n draw(force) {\n\n this.drawn = true;\n this.updateLegend(true);\n this.drawSeries(this.redraw(true, force));\n\n this._pluginsExecute('postDraw');\n }\n\n /**\n * Prevents the graph, the series and the legend from redrawing automatically. Valid until {@link Graph#resumeUpdate} is called\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#resumeUpdate}\n * @see {@link Graph#doUpdate}\n * @since 1.16.19\n */\n delayUpdate() {\n this._lockUpdate = true;\n return this;\n }\n\n /**\n * Forces legend and graph update, even is {@link Graph#delayUpdate} has been called before.\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#delayUpdate}\n * @see {@link Graph#resumeUpdate}\n * @since 1.16.19\n */\n doUpdate() {\n if (this.legend) {\n this.legend.update();\n }\n this.draw();\n if (this.legend) {\n this.legend.update();\n }\n return this;\n }\n\n /**\n * Cancels the effect of {@link Graph#delayUpdate}, but does not redraw the graph automatically\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#delayUpdate}\n * @see {@link Graph#doUpdate}\n * @since 1.16.19\n */\n resumeUpdate() {\n this._lockUpdate = false;\n return this;\n }\n\n isDelayedUpdate() {\n return this._lockUpdate;\n }\n\n /**\n * Sets the total width of the graph\n * @param {Number} width - The new width of the graph\n * @param {Boolean} skipResize - true to defer graph repaint. Use {@link Graph#resize} to force repain later on. (Useful if many graph sizing operations are done successively)\n * @see Graph#setHeight\n * @see Graph#resize\n */\n setWidth(width, skipResize) {\n this.width = width;\n if (!skipResize) {\n this._resize();\n }\n }\n\n /**\n * Sets the total height of the graph\n * @param {Number} height - The new height of the graph\n * @param {Boolean} skipResize - true to defer graph repaint. Use {@link Graph#resize} to force repain later on. (Useful if many graph sizing operations are done successively)\n * @see Graph#setWidth\n * @see Graph#resize\n */\n setHeight(height, skipResize) {\n this.height = height;\n if (!skipResize) {\n this._resize();\n }\n }\n\n /**\n * Sets the new dimension of the graph and repaints it. If width and height are omitted, a simple refresh is done.\n * @param {Number} [ width ] - The new width of the graph\n * @param {Number} [ height ] - The new height of the graph\n * @see Graph#setWidth\n * @see Graph#setHeight\n * @return {Graph} The current graph\n */\n resize(w, h) {\n if (w && h) {\n this.setSize(w, h);\n }\n\n this._resize();\n return this;\n }\n\n /**\n * Sets the new dimension of the graph without repainting it. Use {@link Graph#resize} to perform the actual resizing of the graph.\n * @param {Number} [ width ] - The new width of the graph\n * @param {Number} [ height ] - The new height of the graph\n * @see Graph#setWidth\n * @see Graph#setHeight\n * @see Graph#resize\n */\n setSize(w, h) {\n this.setWidth(w, true);\n this.setHeight(h, true);\n this.getDrawingHeight();\n this.getDrawingWidth();\n }\n\n /**\n * Returns the width of the graph (set by setSize, setWidth or resize methods)\n * @return {Number} Width of the graph\n */\n getWidth() {\n return this.width;\n }\n\n /**\n * Returns the height of the graph (set by setSize, setHeight or resize methods)\n * @return {Number} Height of the graph\n */\n getHeight() {\n return this.height;\n }\n\n /**\n * Returns the top padding of the graph (space between the top of the svg container and the topmost axis)\n * @return {Number} paddingTop\n */\n getPaddingTop() {\n return this.options.paddingTop;\n }\n\n /**\n * Returns the left padding of the graph (space between the left of the svg container and the leftmost axis)\n * @return {Number} paddingTop\n */\n getPaddingLeft() {\n return this.options.paddingLeft;\n }\n\n /**\n * Returns the bottom padding of the graph (space between the bottom of the svg container and the bottommost axis)\n * @return {Number} paddingTop\n */\n getPaddingBottom() {\n return this.options.paddingBottom;\n }\n\n /**\n * Returns the right padding of the graph (space between the right of the svg container and the rightmost axis)\n * @return {Number} paddingRight\n */\n getPaddingRight() {\n return this.options.paddingRight;\n }\n\n /**\n * Returns the height of the drawable zone, including the space used by the axes\n * @param {Boolean} useCache - Use cached value. Useful if one is sure the graph hasn't changed dimension. Automatically called after a Graph.resize();\n * @returns {Number} Height of the graph\n */\n getDrawingHeight(useCache) {\n if (useCache && this.innerHeight) {\n return this.innerHeight;\n }\n return this.innerHeight = this.height - this.options.paddingTop - this.options.paddingBottom;\n }\n\n /**\n * Returns the width of the drawable zone, including the space used by the axes\n * @param {Boolean} useCache - Use cached value. Useful if one is sure the graph hasn't changed dimension. Automatically called after a Graph.resize();\n * @returns {Number} Width of the graph\n */\n getDrawingWidth(useCache) {\n if (useCache && this.innerWidth) {\n return this.innerWidth;\n }\n return this.innerWidth = this.width - this.options.paddingLeft - this.options.paddingRight;\n }\n\n /**\n * Caches the wrapper offset in the page.
\n * The position of the wrapper is used when processing most of mouse events and it is fetched via the jQuery function .offset().\n * If performance becomes a critical issue in your application, cacheOffset() should be used to store the offset position. It should be ensured that the graph doesn't move in the page. If one can know when the graph has moved, cacheOffset() should be called again to update the offset position.\n * @see Graph#uncacheOffset\n */\n cacheOffset() {\n this.offsetCached = util.getOffset(this.wrapper);\n }\n\n /**\n * Un-caches the wrapper offset value\n * @see Graph#cacheOffset\n */\n uncacheOffset() {\n this.offsetCached = false;\n }\n\n /**\n * Returns the x axis at a certain index. If any top axis exists and no bottom axis exists, returns or creates a top axis. Otherwise, creates or returns a bottom axis\n * Caution ! The options parameter will only be effective if an axis is created\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getXAxis(index, options) {\n if (this.axis.top.length > 0 && this.axis.bottom.length == 0) {\n return this.getTopAxis(index, options);\n }\n\n return this.getBottomAxis(index, options);\n }\n\n /**\n * Returns the y axis at a certain index. If any right axis exists and no left axis exists, returns or creates a right axis. Otherwise, creates or returns a left axis\n * Caution ! The options parameter will only be effective if an axis is created\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getYAxis(index, options) {\n\n if (this.axis.right.length > 0 && this.axis.left.length == 0) {\n return this.getRightAxis(index, options);\n }\n\n return this.getLeftAxis(index, options);\n }\n\n /**\n * Returns the top axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getTopAxis(index, options) {\n return _getAxis(this, index, options, 'top');\n }\n\n /**\n * Returns the bottom axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getBottomAxis(index, options) {\n return _getAxis(this, index, options, 'bottom');\n }\n\n /**\n * Returns the left axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getLeftAxis(index, options) {\n return _getAxis(this, index, options, 'left');\n }\n\n /**\n * Returns the right axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getRightAxis(index, options) {\n return _getAxis(this, index, options, 'right');\n }\n\n /**\n * Sets a bottom axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n */\n setXAxis(axis, index) {\n this.setBottomAxis(axis, index);\n }\n\n /**\n * Sets a left axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n */\n setYAxis(axis, index) {\n this.setLeftAxis(axis, index);\n }\n\n /**\n * Sets a left axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setTopAxis\n * @see Graph#setRightAxis\n * @see Graph#getLeftAxis\n * @see Graph#getYAxis\n */\n setLeftAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.left[index]) {\n this.axis.left[index].kill();\n }\n this.axis.left[index] = axis;\n }\n\n /**\n * Sets a right axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setLeftAxis\n * @see Graph#setTopAxis\n * @see Graph#getRightAxis\n * @see Graph#getYAxis\n */\n setRightAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.right[index]) {\n this.axis.right[index].kill();\n }\n this.axis.right[index] = axis;\n }\n\n /**\n * Sets a top axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setLeftAxis\n * @see Graph#setRightAxis\n * @see Graph#getBottomAxis\n * @see Graph#getXAxis\n */\n setTopAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.top[index]) {\n this.axis.top[index].kill();\n }\n this.axis.top[index] = axis;\n }\n\n /**\n * Sets a bottom axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setTopAxis\n * @see Graph#setLeftAxis\n * @see Graph#setRightAxis\n * @see Graph#getTopAxis\n * @see Graph#getXAxis\n */\n setBottomAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.bottom[index]) {\n this.axis.bottom[index].kill();\n }\n this.axis.bottom[index] = axis;\n }\n\n killAxis(axis, noRedraw = false, noSerieKill = false) {\n\n var index;\n\n if (axis.isX()) {\n\n if ((index = this.axis.bottom.indexOf(axis)) > -1) {\n this.axis.bottom.splice(index, 1);\n }\n\n if ((index = this.axis.top.indexOf(axis)) > -1) {\n this.axis.top.splice(index, 1);\n }\n\n if (!noSerieKill) {\n this.series.forEach(serie => {\n\n if (serie.getXAxis() == axis) {\n serie.kill();\n }\n });\n }\n }\n\n if (axis.isY()) {\n\n if ((index = this.axis.left.indexOf(axis)) > -1) {\n this.axis.left.splice(index, 1);\n }\n\n if ((index = this.axis.right.indexOf(axis)) > -1) {\n this.axis.right.splice(index, 1);\n }\n\n if (!noSerieKill) {\n this.series.forEach(serie => {\n\n if (serie.getYAxis() == axis) {\n serie.kill();\n }\n });\n }\n }\n\n this.axisGroup.removeChild(axis.group); // Removes all DOM\n this.groupPrimaryGrids.removeChild(axis.gridPrimary);\n this.groupSecondaryGrids.removeChild(axis.gridSecondary);\n\n if (!noRedraw) {\n this.draw(true);\n }\n }\n\n /**\n * Determines if an x axis belongs to the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasXAxis(axis) {\n return this.hasTopAxis(axis) || this.hasBottomAxis(axis);\n }\n\n /**\n * Determines if an x axis belongs to the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasYAxis(axis) {\n return this.hasLeftAxis(axis) || this.hasRightAxis(axis);\n }\n\n /**\n * Determines if an x axis belongs to top axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasTopAxis(axis) {\n return this.hasAxis(axis, this.axis.top);\n }\n\n /**\n * Determines if an x axis belongs to bottom axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasBottomAxis(axis) {\n return this.hasAxis(axis, this.axis.bottom);\n }\n\n /**\n * Determines if a y axis belongs to left axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasLeftAxis(axis) {\n return this.hasAxis(axis, this.axis.left);\n }\n\n /**\n * Determines if a y axis belongs to right axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasRightAxis(axis) {\n return this.hasAxis(axis, this.axis.right);\n }\n\n /**\n * Determines if an axis belongs to a list of axes\n * @param {Axis} axis - The axis instance to check\n * @param {Array} axisList - The list of axes to check\n * @private\n */\n hasAxis(axis, axisList) {\n for (var i = 0, l = axisList.length; i < l; i++) {\n if (axisList[i] == axis) {\n return true;\n }\n\n if (axisList[i].hasAxis(axis)) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Autoscales the x and y axes of the graph.\n * Does not repaint the canvas\n * @return {Graph} The current graph instance\n */\n autoscaleAxes() {\n\n this._applyToAxes('setMinMaxToFitSeries', null, true, true);\n\n //this._applyToAxes( \"scaleToFitAxis\", [ this.getYAxis() ], false, true )\n // X is not always ascending...\n return this;\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoscale() {\n return this.autoscaleAxes(...arguments);\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoScale() {\n return this.autoscaleAxes(...arguments);\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoScaleAxes() {\n return this.autoscaleAxes(...arguments);\n }\n\n // See #138\n /**\n * Autoscales a particular axis\n * @param {Axis} The axis to rescale\n * @return {Graph} The current graph instance\n */\n autoScaleAxis(axis) {\n if (!axis) {\n return this;\n }\n\n axis.setMinMaxToFitSeries();\n return this;\n }\n\n /**\n * Sets the background color\n * @param {String} color - An SVG accepted color for the background\n * @return {Graph} The current graph instance\n */\n setBackgroundColor(color) {\n\n this.rectEvent.setAttribute('fill', color);\n return this;\n }\n\n getAxisState() {\n\n var state = {};\n for (var i in this.axis) {\n state[i] = this.axis[i].map(function (axis) {\n return [axis.getCurrentMin(), axis.getCurrentMax()];\n });\n }\n return state;\n }\n\n setAxisState(state) {\n\n var j, l;\n for (var i in state) {\n\n if (!this.axis[i]) {\n continue;\n }\n\n for (j = 0, l = state[i].length; j < l; j++) {\n\n if (!this.axis[i][j]) {\n continue;\n }\n\n this.axis[i][j].setCurrentMin(state[i][j][0]);\n this.axis[i][j].setCurrentMax(state[i][j][1]);\n }\n }\n\n this.draw();\n }\n\n saveAxisState(savedName) {\n this.savedAxisState = this.savedAxisState || {};\n this.savedAxisState[savedName] = this.getAxisState();\n return this;\n }\n\n recallAxisState(savedName) {\n if (this.savedAxisState[savedName]) {\n this.recallAxisState(this.savedAxisState[savedName]);\n }\n return this;\n }\n\n _applyToAxis(type) {\n\n switch (type) {\n\n case 'string':\n return function (type, func, params) {\n // params.splice(1, 0, type);\n\n for (var i = 0; i < this.axis[type].length; i++) {\n this.axis[type][i][func].apply(this.axis[type][i], params);\n }\n };\n\n case 'function':\n return function (type, func, params) {\n for (var i = 0; i < this.axis[type].length; i++) {\n func.call(this, this.axis[type][i], type, params);\n }\n };\n\n default:\n throw new Error('You must either execute a function or provide a string that registers a function');\n }\n }\n\n /**\n * Calculates the minimal or maximal value of the axis. Currently, alias of getBoudaryAxisFromSeries\n */\n getBoundaryAxis(axis, minmax, usingZValues) {\n\n var valSeries = this.getBoundaryAxisFromSeries(axis, minmax, usingZValues);\n // var valShapes = this.getBoundaryAxisFromShapes( axis, xy, minmax );\n return valSeries;\n //return Math[ minmax ]( valSeries, valShapes );\n }\n\n /**\n * Calculates the minimal or maximal value of the axis, based on the series that belong to it. The value is computed so that all series just fit in the value.\n * @memberof Graph.prototype\n * @param {Axis} axis - The axis for which the value should be computed\n * @param {minmax} minmax - The minimum or maximum to look for. \"min\" for the minimum, anything else for the maximum\n * @returns {Number} The minimimum or maximum of the axis based on its series\n */\n getBoundaryAxisFromSeries(axis, minmax, usingZValues) {\n\n var min = minmax == 'min',\n val,\n func = axis.isX() ? ['getMinX', 'getMaxX'] : ['getMinY', 'getMaxY'],\n func2use = func[min ? 0 : 1],\n infinity2use = min ? +Infinity : -Infinity,\n serie,\n series,\n serieValue,\n i,\n l;\n\n val = infinity2use;\n series = this.getSeriesFromAxis(axis);\n\n for (i = 0, l = series.length; i < l; i++) {\n\n serie = series[i];\n\n if (!serie.isShown()) {\n continue;\n }\n\n serieValue = serie[func2use](usingZValues);\n val = Math[minmax](isNaN(val) ? infinity2use : val, isNaN(serieValue) ? infinity2use : serieValue);\n }\n\n return val;\n }\n\n /**\n * Returns all the series associated to an axis\n * @param {Axis} axis - The axis to which the series belong\n * @returns {Serie[]} An array containing the list of series that belong to the axis\n */\n getSeriesFromAxis(axis) {\n var series = [],\n i = this.series.length - 1;\n\n for (; i >= 0; i--) {\n if (this.series[i].getXAxis() == axis || this.series[i].getYAxis() == axis) {\n series.push(this.series[i]);\n }\n }\n\n return series;\n }\n\n /**\n * Determines the maximum and minimum of each axes, based on {@link Graph#getBoundaryAxis}. It is usually called internally, but if the data of series has changed, called this function to make sure that minimum / maximum of the axes are properly updated.\n * @see Graph#getBoundaryAxis\n */\n updateDataMinMaxAxes(usingZValues) {\n\n var axisvars = ['bottom', 'top', 'left', 'right'],\n axis,\n j,\n l,\n i;\n\n for (j = 0, l = axisvars.length; j < l; j++) {\n\n for (i = this.axis[axisvars[j]].length - 1; i >= 0; i--) {\n\n axis = this.axis[axisvars[j]][i];\n\n // 25.10.2017. Wait a second, this cannot be real. Even hidden axes must have min max values.\n // The data can be displayed while the axis is hidden\n // I assume this was added to cover another bug, but another approach must be chosen\n if (!axis.isShown()) {}\n // continue;\n\n\n //console.log( axisvars[ j ], this.getBoundaryAxisFromSeries( this.axis[ axisvars[ j ] ][ i ], xy, 'min'), this.getBoundaryAxisFromSeries( this.axis[ axisvars[ j ] ][ i ], xy, 'max') );\n\n let min = this.getBoundaryAxis(this.axis[axisvars[j]][i], 'min', usingZValues);\n let max = this.getBoundaryAxis(this.axis[axisvars[j]][i], 'max', usingZValues);\n\n if (isFinite(min)) {\n axis.setMinValueData(min);\n }\n\n if (isFinite(max)) {\n axis.setMaxValueData(max);\n }\n }\n }\n }\n\n /**\n * Function that is called from {@link Graph#_applyToAxes}\n * @function\n * @name AxisCallbackFunction\n * @param {Axis} axis - The axis of the function\n * @param {String} type - The type of the axis (left,right,top,bottom)\n * @param params - The params passed in the _applyToAxis function.\n * @see Graph#_applyToAxes\n */\n\n /**\n * Applies a function to axes. The function will be executed once for every axis.\n * If func is a string, the internal function belonging to the axis will be called, with the params array flattened out (in this case, params must be an array).\n * If func is a function, the function will be called with the axis, its type and params as parameters. See {@link AxisCallbackFunction} for more details.\n * @param {(AxisCallbackFunction|String)} func - The function or function name to execute\n * @param params - Extra parameters to pass to the function\n * @param {Boolean} topbottom=false - True to apply to function to top and bottom axes\n * @param {Boolean} leftright=false - True to apply to function to left and right axes\n */\n _applyToAxes(func, params, tb, lr) {\n\n var ax = [],\n i = 0,\n l;\n\n if (tb || tb == undefined) {\n ax.push('top');\n ax.push('bottom');\n }\n if (lr || lr == undefined) {\n ax.push('left');\n ax.push('right');\n }\n\n for (l = ax.length; i < l; i++) {\n this._applyToAxis(typeof func).call(this, ax[i], func, params);\n }\n }\n\n /**\n * Axes can be dependant of one another (for instance for unit conversions)\n * Finds and returns all the axes that are linked to a specific axis. Mostly used internally.\n * @param {Axis} axis - The axis that links one or multiple other dependant axes\n * @returns {Axis[]} The list of axes linked to the axis passed as parameter\n */\n findAxesLinkedTo(axis) {\n\n var axes = [];\n this._applyToAxes(function (a) {\n\n if (a.linkedToAxis && a.linkedToAxis.axis == axis) {\n axes.push(a);\n }\n }, {}, axis instanceof this.getConstructor('graph.axis.x'), axis instanceof this.getConstructor('graph.axis.y'));\n\n return axes;\n }\n\n _axisHasChanged() {\n this._axesHaveChanged = true;\n }\n\n /**\n * Creates a new serie.\n * If the a serie with the same name exists, returns this serie with update options.\n * The type of the serie is used to fetch the corresponding registered constructor registered with the name \"graph.serie.\", e.g \"line\" will fetch the \"graph.serie.line\" prototype (built-in)
\n * Built-in series types are \"line\", \"contour\", \"zone\" and \"scatter\".\n * @param {String} name - The name of the serie (unique)\n * @param {Object} options - The serie options\n * @param {Type} type - The type of the serie.\n * @returns {Serie} The newly created serie\n */\n newSerie(name, options, type) {\n\n let serie;\n\n if (typeof options !== 'object' && !type) {\n type = options;\n options = {};\n }\n\n if (!type) {\n type = Graph.SERIE_LINE;\n }\n\n if (serie = this.getSerie(name)) {\n return serie;\n }\n\n if (!(serie = makeSerie(this, name, options, type))) {\n return;\n }\n\n this.series.push(serie);\n this.emit('newSerie', serie);\n return serie;\n }\n\n /**\n * Looks for an existing serie by name or by index and returns it.\n * The index of the serie follows the creation sequence (0 for the first one, 1 for the second one, ...)\n * @param {(String|Number)} name - The name or the index of the serie\n * @returns {Serie}\n */\n getSerie(name) {\n\n if (typeof name == 'number') {\n return this.series[name] || false;\n }\n\n if (typeof name == 'function') {\n name = name();\n }\n\n var i = 0,\n l = this.series.length;\n\n for (; i < l; i++) {\n\n if (this.series[i].getName() == name || this.series[i] == name) {\n\n return this.series[i];\n }\n }\n\n return false;\n }\n\n /**\n * Returns all the series\n * @returns {Serie[]} An array of all the series\n */\n getSeries() {\n return this.series;\n }\n\n /**\n * Returns all the series that correspond to one or multiple types\n * @param {...Symbol} type - The serie types to select\n * @returns {Serie[]} An array of all the series\n * @example graph.allSeries( Graph.SERIE_LINE, Graph.SERIE_ZONE );\n */\n allSeries(...types) {\n\n return this.series.filter(serie => {\n return types.include(serie.getType());\n });\n }\n\n /**\n * Draws a specific serie\n * @param {Serie} serie - The serie to redraw\n * @param {Boolean} force - Forces redraw even if no data has changed\n */\n drawSerie(serie, force) {\n\n if (!serie.draw) {\n throw new Error('Serie has no method draw');\n }\n\n serie.draw(force);\n }\n\n /**\n * Redraws all visible series\n * @param {Boolean} force - Forces redraw even if no data has changed\n */\n drawSeries(force) {\n\n if (!this.width || !this.height) {\n return;\n }\n\n var i = this.series.length - 1;\n for (; i >= 0; i--) {\n if (this.series[i].isShown()) {\n this.drawSerie(this.series[i], force);\n }\n }\n }\n\n /**\n * @alias Graph#removeSeries\n */\n resetSeries() {\n this.removeSeries();\n }\n\n /**\n * @alias Graph#removeSeries\n */\n\n killSeries() {\n this.resetSeries();\n }\n\n /**\n * Removes all series from the graph\n */\n removeSeries() {\n while (this.series[0]) {\n this.series[0].kill(true);\n }\n this.series = [];\n\n if (this.legend) {\n this.legend.update();\n }\n }\n\n /**\n * Selects a serie. Only one serie per graph can be selected.\n * @param {Serie} serie - The serie to select\n * @param {String} selectName=\"selected\" - The name of the selection\n */\n selectSerie(serie, selectName) {\n\n if (!(typeof serie == 'object')) {\n serie = this.getSerie(serie);\n }\n\n if (this.selectedSerie == serie && this.selectedSerie.selectionType == selectName) {\n return;\n }\n\n if (this.selectedSerie !== serie && this.selectedSerie) {\n this.unselectSerie(this.selectedSerie);\n }\n\n this.selectedSerie = serie;\n this.triggerEvent('onSelectSerie', serie);\n\n serie.select(selectName || 'selected');\n }\n\n /**\n * Returns the selected serie\n * @returns {(Serie|undefined)} The selected serie\n */\n getSelectedSerie() {\n return this.selectedSerie;\n }\n\n /**\n * Unselects a serie\n * @param {Serie} serie - The serie to unselect\n */\n unselectSerie(serie) {\n\n if (!serie.unselect) {\n return;\n }\n\n serie.unselect();\n this.selectedSerie = false;\n this.triggerEvent('onUnselectSerie', serie);\n }\n\n /**\n * Returns all the shapes associated to a serie. Shapes can (but don't have to) be associated to a serie. The position of the shape can then be relative to the same axes as the serie.\n * @param {Serie} serie - The serie containing the shapes\n * @returns {Shape[]} An array containing a list of shapes associated to the serie\n */\n getShapesOfSerie(serie) {\n\n var shapes = [];\n var i = this.shapes.length - 1;\n\n for (; i >= 0; i--) {\n\n if (this.shapes[i].getSerie() == serie) {\n shapes.push(this.shapes[i]);\n }\n }\n\n return shapes;\n }\n makeToolbar(toolbarData) {\n\n var constructor = this.getConstructor('graph.toolbar');\n if (constructor) {\n return this.toolbar = new constructor(this, toolbarData);\n } else {\n return util.throwError('No constructor exists for toolbar');\n }\n }\n\n /**\n * Returns all shapes from the graph\n */\n getShapes() {\n return this.shapes || [];\n }\n\n /**\n * Creates a new shape. jsGraph will look for the registered constructor \"graph.shape.\".\n * @param {String} shapeType - The type of the shape\n * @param {Object} [shapeData] - The options passed to the shape creator\n * @param {Boolean} [mute=false] - true to create the shape quietly\n * @param {Object} [shapeProperties] - The native object containing the shape properties in the jsGraph format (caution when using it)\n * @returns {Shape} The created shape\n * @see Graph#getConstructor\n */\n newShape(shapeType, shapeData, mute = false, shapeProperties) {\n\n this.prevent(false);\n\n if (!mute) {\n\n this.emit('beforeNewShape', shapeData);\n\n if (this.prevent(false)) {\n return false;\n }\n }\n\n // Backward compatibility\n if (typeof shapeType == 'object') {\n mute = shapeData;\n shapeData = shapeType;\n shapeType = shapeData.type;\n }\n\n shapeData = shapeData || {};\n shapeData._id = util.guid();\n\n var constructor;\n if (typeof shapeType == 'function') {\n constructor = shapeType;\n } else {\n constructor = this.getConstructor('graph.shape.' + shapeType);\n }\n\n if (!constructor) {\n return util.throwError('No constructor for this shape');\n }\n\n var shape = new constructor(this, shapeData);\n\n if (!shape) {\n return util.throwError('Failed to construct shape.');\n }\n\n shape.type = shapeType;\n shape.graph = this;\n shape._data = shapeData;\n\n if (shapeData.properties !== undefined) {\n shape.setProperties(shapeData.properties);\n }\n\n shape.init(this, shapeProperties);\n\n if (shapeData.props !== undefined) {\n for (var i in shapeData.props) {\n shape.setProp(i, shapeData.props[i]);\n }\n }\n\n if (shapeData.position) {\n\n for (var i = 0, l = shapeData.position.length; i < l; i++) {\n shape.setPosition(new _graphPosition2.default(shapeData.position[i]), i);\n }\n }\n\n /* Setting shape properties */\n if (shapeData.fillColor !== undefined) {\n shape.setFillColor(shapeData.fillColor);\n }\n\n if (shapeData.fillOpacity !== undefined) {\n shape.setFillOpacity(shapeData.fillOpacity);\n }\n\n if (shapeData.strokeColor !== undefined) {\n shape.setStrokeColor(shapeData.strokeColor);\n }\n\n if (shapeData.strokeWidth !== undefined) {\n shape.setStrokeWidth(shapeData.strokeWidth);\n }\n\n if (shapeData.layer !== undefined) {\n shape.setLayer(shapeData.layer);\n }\n\n if (shapeData.locked == true) {\n shape.lock();\n }\n\n if (shapeData.movable == true) {\n shape.movable();\n }\n\n if (shapeData.selectable == true) {\n shape.selectable();\n }\n\n if (shapeData.resizable == true) {\n shape.resizable();\n }\n\n if (shapeData.attributes !== undefined) {\n shape.setProp('attributes', shapeData.attributes);\n }\n\n if (shapeData.handles !== undefined) {\n shape.setProp('handles', shapeData.handles);\n }\n\n if (shapeData.selectOnMouseDown !== undefined) {\n shape.setProp('selectOnMouseDown', true);\n }\n\n if (shapeData.selectOnClick !== undefined) {\n shape.setProp('selectOnClick', true);\n }\n\n if (shapeData.transforms !== undefined && Array.isArray(shapeData.transforms)) {\n\n shapeData.transforms.forEach(({\n\n type,\n value\n\n }) => {\n\n shape.addTransform(type, value);\n });\n }\n\n if (shapeData.highlightOnMouseOver !== undefined) {\n shape.setProp('highlightOnMouseOver', true);\n }\n\n if (shapeData.labelEditable) {\n shape.setProp('labelEditable', shapeData.labelEditable);\n }\n\n if (shapeData.labels && !shapeData.label) {\n shapeData.label = shapeData.labels;\n }\n\n if (shapeData.label !== undefined) {\n\n if (!Array.isArray(shapeData.label)) {\n shapeData.label = [shapeData.label];\n }\n\n for (var i = 0, l = shapeData.label.length; i < l; i++) {\n\n shape.showLabel(i);\n shape.setLabelText(shapeData.label[i].text, i);\n shape.setLabelPosition(shapeData.label[i].position, i);\n shape.setLabelColor(shapeData.label[i].color || 'black', i);\n shape.setLabelSize(shapeData.label[i].size, i);\n shape.setLabelAngle(shapeData.label[i].angle || 0, i);\n shape.setLabelBaseline(shapeData.label[i].baseline || 'no-change', i);\n shape.setLabelAnchor(shapeData.label[i].anchor || 'start', i);\n shape.setLabelBackgroundColor(shapeData.label[i].backgroundColor || 'transparent', i);\n shape.setLabelBackgroundOpacity(shapeData.label[i].backgroundOpacity || 1, i);\n }\n }\n\n if (shapeData.serie) {\n shape.setSerie(this.getSerie(shapeData.serie));\n }\n shape.createHandles();\n shape.applyStyle();\n\n this.shapes.push(shape);\n\n if (!mute) {\n this.emit('newShape', shape, shapeData);\n }\n\n return shape;\n }\n\n /**\n * Creates a new position. Arguments are passed to the position constructor\n * @param {...*} varArgs\n * @see Position\n */\n newPosition(varArgs) {\n\n return new _graphPosition2.default(...arguments);\n\n // 18 September 2016 Norman: What is that ?\n //Array.prototype.unshift.call( arguments, null );\n //return new( Function.prototype.bind.apply( GraphPosition, arguments ) )();\n }\n\n /**\n * Redraws all shapes. To be called if their definitions have changed\n */\n redrawShapes() {\n\n //this.graphingZone.removeChild(this.shapeZone);\n for (var i = 0, l = this.shapes.length; i < l; i++) {\n this.shapes[i].redraw();\n }\n //this.graphingZone.insertBefore(this.shapeZone, this.axisGroup);\n }\n\n /**\n * Removes all shapes from the graph\n */\n removeShapes() {\n for (var i = 0, l = this.shapes.length; i < l; i++) {\n if (this.shapes[i] && this.shapes[i].kill) {\n this.shapes[i].kill(true);\n }\n }\n this.shapes = [];\n }\n\n /**\n * Selects a shape\n * @param {Shape} shape - The shape to select\n * @param {Boolean} mute - Select the shape quietly\n */\n selectShape(shape, mute) {\n\n // Already selected. Returns false\n\n if (!shape) {\n return;\n }\n\n if (this.selectedShapes.indexOf(shape) > -1) {\n return false;\n }\n\n if (!shape.isSelectable()) {\n return false;\n }\n\n if (!mute) {\n this.emit('beforeShapeSelect', shape);\n }\n\n if (this.prevent(false)) {\n return;\n }\n\n if (this.selectedShapes.length > 0 && this.options.shapesUniqueSelection) {\n // Only one selected shape at the time\n\n this.unselectShapes(mute);\n }\n\n shape._select(mute);\n this.selectedShapes.push(shape);\n\n if (!mute) {\n this.emit('shapeSelect', shape);\n }\n }\n\n getSelectedShapes() {\n return this.selectedShapes;\n }\n\n /**\n * Unselects a shape\n * @param {Shape} shape - The shape to unselect\n * @param {Boolean} mute - Unselect the shape quietly\n */\n unselectShape(shape, mute) {\n\n if (this.selectedShapes.indexOf(shape) == -1) {\n return;\n }\n\n if (!mute) {\n this.emit('beforeShapeUnselect', shape);\n }\n\n if (this.cancelUnselectShape) {\n this.cancelUnselectShape = false;\n return;\n }\n\n shape._unselect();\n\n this.selectedShapes.splice(this.selectedShapes.indexOf(shape), 1);\n\n if (!mute) {\n this.emit('shapeUnselect', shape);\n }\n }\n\n /**\n * Unselects all shapes\n * @param {Boolean} [ mute = false ] - Mutes all unselection events\n * @return {Graph} The current graph instance\n */\n unselectShapes(mute) {\n\n while (this.selectedShapes[0]) {\n this.unselectShape(this.selectedShapes[0], mute);\n }\n\n return this;\n }\n\n _removeShape(shape) {\n this.shapes.splice(this.shapes.indexOf(shape), 1);\n }\n\n appendShapeToDom(shape) {\n\n if (shape.isHTML()) {\n this.wrapper.insertBefore(shape._dom, this.dom);\n }\n\n this.getLayer(shape.getLayer(), 'shape').appendChild(shape.group);\n }\n\n removeShapeFromDom(shape) {\n\n if (shape.isHTML()) {\n this.wrapper.removeChild(shape._dom);\n }\n\n this.getLayer(shape.getLayer(), 'shape').removeChild(shape.group);\n }\n\n appendSerieToDom(serie) {\n this.getLayer(serie.getLayer(), 'serie').appendChild(serie.groupMain);\n }\n\n removeSerieFromDom(serie) {\n this.getLayer(serie.getLayer(), 'serie').removeChild(serie.groupMain);\n }\n\n getLayer(layer, mode) {\n\n if (!this.layers[layer]) {\n\n this.layers[layer] = [];\n\n this.layers[layer][0] = document.createElementNS(Graph.ns, 'g');\n this.layers[layer][0].setAttribute('data-layer', layer);\n this.layers[layer][1] = document.createElementNS(Graph.ns, 'g');\n this.layers[layer][2] = document.createElementNS(Graph.ns, 'g');\n\n this.layers[layer][0].appendChild(this.layers[layer][1]);\n this.layers[layer][0].appendChild(this.layers[layer][2]);\n\n var i = 1,\n prevLayer;\n\n while (!(prevLayer = this.layers[layer - i]) && layer - i >= 0) {\n i++;\n }\n\n if (!prevLayer) {\n\n this.plotGroup.insertBefore(this.layers[layer][0], this.plotGroup.firstChild);\n } else if (prevLayer.nextSibling) {\n\n this.plotGroup.insertBefore(this.layers[layer][0], prevLayer.nextSibling);\n } else {\n\n this.plotGroup.appendChild(this.layers[layer][0]);\n }\n }\n\n return this.layers[layer][mode == 'shape' ? 2 : 1];\n }\n\n focus() {\n this.wrapper.focus();\n }\n\n elementMoving(movingElement) {\n this.bypassHandleMouse = movingElement;\n }\n\n stopElementMoving(element) {\n\n if (element && element == this.bypassHandleMouse) {\n this.bypassHandleMouse = false;\n } else if (!element) {\n this.bypassHandleMouse = false;\n }\n }\n\n _makeClosingLines() {\n\n this.closingLines = {};\n var els = ['top', 'bottom', 'left', 'right'],\n i = 0,\n l = 4;\n for (; i < l; i++) {\n var line = document.createElementNS(Graph.ns, 'line');\n line.setAttribute('stroke', this.options.closeColor);\n line.setAttribute('shape-rendering', 'crispEdges');\n line.setAttribute('stroke-linecap', 'square');\n line.setAttribute('display', 'none');\n this.closingLines[els[i]] = line;\n this.graphingZone.appendChild(line);\n }\n }\n\n isActionAllowed(e, action) {\n\n if (action.type !== e.type && (action.type !== undefined || e.type !== 'mousedown') && !((e.type === 'wheel' || e.type === 'mousewheel') && action.type == 'mousewheel')) {\n return;\n }\n\n if (action.enabled && (typeof action.enabled == 'function' ? !action.enabled(this) : !action.enabled)) {\n return;\n }\n\n if (action.key) {\n\n if (action.key !== e.keyCode) {\n\n let keyCheck = {\n 'backspace': 8,\n 'enter': 13,\n 'tab': 9,\n 'shift': 16,\n 'ctrl': 17,\n 'alt': 18,\n 'pause': 19,\n 'escape': 27,\n 'up': 33,\n 'down': 34,\n 'left': 37,\n 'right': 39\n };\n\n if (keyCheck[action.key] !== e.keyCode) {\n return;\n }\n }\n }\n\n if (action.shift === undefined) {\n action.shift = false;\n }\n\n if (action.ctrl === undefined) {\n action.ctrl = false;\n }\n\n if (action.meta === undefined) {\n action.meta = false;\n }\n\n if (action.alt === undefined) {\n action.alt = false;\n }\n\n return e.shiftKey == action.shift && e.ctrlKey == action.ctrl && e.metaKey == action.meta && e.altKey == action.alt;\n }\n\n forcePlugin(plugin) {\n this.forcedPlugin = plugin;\n }\n\n unforcePlugin() {\n this.forcedPlugin = false;\n }\n\n _pluginsExecute(funcName, ...args) {\n\n //\t\t\tArray.prototype.splice.apply(args, [0, 0, this]);\n\n for (var i in this.plugins) {\n\n if (this.plugins[i] && this.plugins[i][funcName]) {\n\n this.plugins[i][funcName].apply(this.plugins[i], args);\n }\n }\n }\n\n _pluginExecute(which, func, args) {\n\n //Array.prototype.splice.apply( args, [ 0, 0, this ] );\n if (!which) {\n return;\n }\n\n if (this.plugins[which] && this.plugins[which][func]) {\n\n this.plugins[which][func].apply(this.plugins[which], args);\n return true;\n }\n }\n\n pluginYieldActiveState() {\n this.activePlugin = false;\n }\n\n _serieExecute(serie, func, args) {\n\n if (typeof serie !== 'object') {\n serie = this.getSerie(serie);\n }\n\n if (typeof serie[func] == 'function') {\n serie.apply(serie, args);\n }\n }\n _pluginsInit() {\n\n var constructor, pluginName, pluginOptions;\n\n for (var i in this.options.plugins) {\n\n pluginName = i;\n pluginOptions = this.options.plugins[i];\n\n constructor = this.getConstructor('graph.plugin.' + pluginName);\n\n if (constructor) {\n\n //var options = util.extend( true, {}, constructor.defaults(), pluginOptions );\n this.plugins[pluginName] = new constructor(pluginOptions);\n\n util.mapEventEmission(this.plugins[pluginName].options, this.plugins[pluginName]);\n this.plugins[pluginName].init(this, pluginOptions);\n } else {\n util.throwError('Plugin \"' + pluginName + '\" has not been registered');\n }\n }\n }\n\n /**\n * Returns an initialized plugin\n * @param {String} pluginName\n * @returns {Plugin} The plugin which name is \n */\n getPlugin(pluginName) {\n var plugin = this.plugins[pluginName];\n\n if (!plugin) {\n return util.throwError('Plugin \"' + pluginName + '\" has not been loaded or properly registered');\n }\n\n return plugin;\n }\n triggerEvent() {\n var func = arguments[0];\n /*,\n args = Array.prototype.splice.apply( arguments, [ 0, 1 ] );\n */\n if (typeof this.options[func] == 'function') {\n return this.options[func].apply(this, arguments);\n }\n }\n\n /**\n * Creates a legend. Only one legend is allowed per graph\n * @param {Object} options - The legend options\n */\n makeLegend(options) {\n\n if (this.legend) {\n return this.legend;\n }\n\n var constructor = this.getConstructor('graph.legend');\n if (constructor) {\n this.legend = new constructor(this, options);\n } else {\n return util.throwError('Graph legend is not available as it has not been registered');\n }\n\n return this.legend;\n }\n\n /**\n * Redraws the legend if it exists\n * @param {Boolean} [ onlyIfRequired = false ] ```true``` to redraw the legend only when it actually needs to be updated\n * @return {Graph} The graph instance\n */\n updateLegend(onlyIfRequired = false) {\n\n if (!this.legend) {\n return;\n }\n\n this.legend.update(onlyIfRequired);\n return this;\n }\n\n /**\n * @returns {Legend} The legend item\n */\n getLegend() {\n if (!this.legend) {\n return;\n }\n\n return this.legend;\n }\n\n requireLegendUpdate() {\n\n if (!this.legend) {\n return;\n }\n\n this.legend.requireDelayedUpdate();\n }\n\n orthogonalProjectionSetup() {\n\n this.options.zAxis = util.extend(true, {\n maxZ: 10,\n minZ: 0,\n shiftX: -25,\n shiftY: -15,\n xAxis: this.getXAxis(),\n yAxis: this.getYAxis()\n });\n }\n\n orthogonalProjectionUpdate() {\n\n if (!this.zAxis) {\n this.zAxis = {\n g: document.createElementNS(Graph.ns, 'g'),\n l: document.createElementNS(Graph.ns, 'line')\n };\n\n this.zAxis.g.appendChild(this.zAxis.l);\n this.groupGrids.appendChild(this.zAxis.g);\n }\n\n let refAxisX = this.options.zAxis.xAxis;\n let refAxisY = this.options.zAxis.yAxis;\n\n var x0 = refAxisX.getMinPx();\n var y0 = refAxisY.getMinPx();\n\n var dx = refAxisX.getZProj(this.options.zAxis.maxZ);\n var dy = refAxisY.getZProj(this.options.zAxis.maxZ);\n\n this.zAxis.l.setAttribute('stroke', 'black');\n this.zAxis.l.setAttribute('x1', x0);\n this.zAxis.l.setAttribute('x2', x0 + dx);\n this.zAxis.l.setAttribute('y1', y0);\n this.zAxis.l.setAttribute('y2', y0 + dy);\n\n this.updateDataMinMaxAxes(true);\n\n var sort = this.series.map(serie => {\n return [serie.getZPos(), serie];\n });\n\n sort.sort((sa, sb) => {\n return sb[0] - sa[0];\n });\n\n let i = 0;\n sort.forEach(s => {\n s[1].setLayer(i);\n this.appendSerieToDom(s[1]);\n i++;\n });\n\n this.drawSeries(true);\n }\n\n /**\n * Kills the graph\n **/\n kill() {\n this.wrapper.removeChild(this.dom);\n }\n _removeSerie(serie) {\n this.series.splice(this.series.indexOf(serie), 1);\n this._pluginsExecute('serieRemoved', serie);\n }\n contextListen(target, menuElements, callback) {\n\n if (this.options.onContextMenuListen) {\n return this.options.onContextMenuListen(target, menuElements, callback);\n }\n }\n lockShapes() {\n this.shapesLocked = true;\n\n // Removes the current actions of the shapes\n for (var i = 0, l = this.shapes.length; i < l; i++) {\n this.shapes[i].moving = false;\n this.shapes[i].resizing = false;\n }\n }\n unlockShapes() {\n //\t\tconsole.log('unlock');\n this.shapesLocked = false;\n }\n prevent(arg) {\n var curr = this.prevented;\n if (arg != -1) {\n this.prevented = arg == undefined || arg;\n }\n return curr;\n }\n _getXY(e) {\n\n var x = e.clientX,\n y = e.clientY;\n\n var pos = this.offsetCached || util.getOffset(this.wrapper);\n\n x -= pos.left;\n y -= pos.top;\n\n return {\n x: x,\n y: y\n };\n }\n _resize() {\n\n if (!this.width || !this.height) {\n return;\n }\n\n this.getDrawingWidth();\n this.getDrawingHeight();\n\n this.sizeSet = true;\n this.dom.setAttribute('width', this.width);\n this.dom.setAttribute('height', this.height);\n this.domTitle.setAttribute('x', this.width / 2);\n\n this._sizeChanged = true;\n\n if (this.drawn) {\n this.requireLegendUpdate();\n this.draw(true);\n }\n }\n\n updateGraphingZone() {\n util.setAttributeTo(this.graphingZone, {\n 'transform': 'translate(' + this.options.paddingLeft + ', ' + this.options.paddingTop + ')'\n });\n\n this._sizeChanged = true;\n }\n\n // We have to proxy the methods in case they are called anonymously\n getDrawingSpaceWidth() {\n return () => this.drawingSpaceWidth;\n }\n\n getDrawingSpaceHeight() {\n return () => this.drawingSpaceHeight;\n }\n\n getDrawingSpaceMinX() {\n return () => this.drawingSpaceMinX;\n }\n\n getDrawingSpaceMinY() {\n return () => this.drawingSpaceMinY;\n }\n\n getDrawingSpaceMaxX() {\n return () => this.drawingSpaceMaxX;\n }\n\n getDrawingSpaceMaxY() {\n return () => this.drawingSpaceMaxY;\n }\n\n /**\n * Enables the line tracking\n * @param {Object|Boolean} options - Defines the tracking behavior. If a boolean, simply enables or disables the existing tracking.\n */\n trackingLine(options) {\n\n var self = this;\n\n if (typeof options === 'boolean') {\n\n if (this.options.trackingLine) {\n this.options.trackingLine.enable = options;\n }\n return;\n }\n\n if (options) {\n this.options.trackingLine = options;\n }\n\n options.series = options.series || [];\n options.enable = options.enable === undefined ? true : !!options.enable;\n\n // Individual tracking\n if (options.mode == 'individual') {\n\n if (options.series) {\n\n if (!Array.isArray(options.series)) {\n\n if (options.series == 'all') {\n\n options.series = this.series.map(serie => ({\n serie: serie\n }));\n } else {\n\n options.series = [options.series];\n }\n }\n\n options.series.forEach(sOptions => {\n\n if (typeof sOptions.serie !== 'object') {\n\n if (typeof sOptions !== 'object') {\n throw new Error('Misuse of the trackingLine() method. Each serie must be an object with the serie property: { series: [ { serie: jsGraphSerie, options: { ... someOptions } } ] }');\n }\n\n sOptions.serie = this.getSerie(sOptions.serie);\n }\n\n if (!sOptions.serie) {\n return;\n }\n\n self.addSerieToTrackingLine(sOptions.serie, sOptions);\n });\n }\n } else {\n\n options.series.forEach(serie => {\n serie.serie.disableTracking();\n });\n }\n\n if (options.noLine) {\n return;\n }\n\n if (!this.trackingObject) {\n // Avoid multiple creation of tracking lines\n\n // Creates a new shape called trackingLine, in the first layer (below everything)\n this.trackingObject = this.newShape('line', util.extend(true, {\n position: [{\n y: 'min'\n }, {\n y: 'max'\n }],\n stroke: 'black',\n layer: -1\n }, options.trackingLineShapeOptions));\n }\n\n this.trackingObject.draw();\n\n return this.trackingObject;\n }\n\n addSerieToTrackingLine(serie, options) {\n\n if (!this.options.trackingLine) {\n\n this.trackingLine({\n mode: 'individual'\n });\n }\n\n this.options.trackingLine.series.forEach((serieO, index) => {\n if (serieO.serie == serie) {\n this.options.trackingLine.series.splice(index, 1);\n }\n });\n\n this.options.trackingLine.series.push(Object.assign({\n serie: serie\n }, options));\n\n serie.enableTracking((serie, index, x, y) => {\n\n if (this.options.trackingLine.enable) {\n\n if (index) {\n\n if (this.trackingObject) {\n\n this.trackingObject.show();\n this.trackingObject.getPosition(0).x = index.trueX; //serie.getData()[ 0 ][ index.closestIndex * 2 ];\n this.trackingObject.getPosition(1).x = index.trueX; //serie.getData()[ 0 ][ index.closestIndex * 2 ];\n this.trackingObject.redraw();\n }\n\n serie._trackingLegend = _trackingLegendSerie(this, {\n serie: serie\n }, x, y, serie._trackingLegend, options.textMethod ? options.textMethod : output => {\n\n for (var i in output) {\n return output[i].serie.serie.getName() + ': ' + output[i].serie.serie.getYAxis().valueToHtml(output[i].yValue);\n }\n }, index.trueX);\n\n if (serie._trackingLegend) {\n serie._trackingLegend.style.display = 'block';\n }\n }\n }\n }, serie => {\n\n if (this.trackingObject) {\n this.trackingObject.hide();\n }\n\n if (serie.trackingShape) {\n serie.trackingShape.hide();\n }\n\n if (serie._trackingLegend) {\n serie._trackingLegend.style.display = 'none';\n }\n\n serie._trackingLegend = _trackingLegendSerie(this, {\n\n serie: serie\n\n }, false, false, serie._trackingLegend, false, false);\n });\n }\n\n /**\n * Pass here the katex.render method to be used later\n * @param {Function} renderer - katexRendered - renderer\n * @return {Graph} The current graph instance\n */\n setKatexRenderer(renderer) {\n this._katexRenderer = renderer;\n }\n\n hasKatexRenderer() {\n return !!this._katexRenderer;\n }\n\n renderWithKatex(katexValue, katexElement) {\n\n if (this._katexRenderer) {\n\n if (katexElement) {\n katexElement.removeChild(katexElement.firstChild);\n } else {\n katexElement = document.createElementNS(Graph.ns, 'foreignObject');\n }\n\n let div = document.createElement('div');\n\n katexElement.appendChild(div);\n this._katexRenderer(katexValue, div);\n\n return katexElement;\n }\n\n return false;\n }\n\n /**\n * Returns a graph created from a schema\n * @param {Object} schema - The schema (see https://github.com/cheminfo/json-chart/blob/master/chart-schema.json)\n * @param {HTMLElement} wrapper - The wrapping element\n * @returns {Graph} Newly created graph\n */\n static fromJSON(schema, wrapper) {\n\n let graph,\n options = {},\n axes = {\n left: [],\n top: [],\n right: [],\n bottom: []\n },\n style;\n\n if (schema.title) {\n options.title = schema.title;\n }\n\n if (schema.axis) {\n\n schema.axis.forEach(function (schemaAxis) {\n\n if (!schemaAxis.type) {\n util.throwError('Axis type is required (top, bottom, left or right)');\n }\n\n var axisOptions = {};\n if (schemaAxis.label) {\n axisOptions.labelValue = schemaAxis.label;\n }\n\n if (schemaAxis.unit !== undefined) {\n axisOptions.unit = schemaAxis.unit;\n }\n\n if (schemaAxis.unitWrapperAfter !== undefined) {\n axisOptions.unitWrapperAfter = schemaAxis.unitWrapperAfter;\n }\n\n if (schemaAxis.unitWrapperBefore !== undefined) {\n axisOptions.unitWrapperBefore = schemaAxis.unitWrapperBefore;\n }\n\n if (schemaAxis.min !== undefined) {\n axisOptions.forcedMin = schemaAxis.min;\n }\n\n if (schemaAxis.max !== undefined) {\n axisOptions.forcedMax = schemaAxis.max;\n }\n\n if (schemaAxis.flip !== undefined) {\n axisOptions.flipped = schemaAxis.flip;\n }\n\n axes[schemaAxis.type].push(axisOptions);\n schemaAxis._jsGraphIndex = axes[schemaAxis.type].length - 1;\n });\n }\n\n graph = new Graph(wrapper, options, axes);\n\n if (schema.width) {\n graph.setWidth(schema.width);\n }\n\n if (schema.height) {\n graph.setHeight(schema.width);\n }\n\n graph._resize();\n\n if (schema.data) {\n\n schema.data.forEach(function (schemaSerie) {\n\n var serieType = schemaSerie.type,\n serie,\n serieOptions = {},\n serieAxis;\n\n let waveform;\n\n switch (schemaSerie.type) {\n\n case 'bar':\n util.throwError('Bar charts not supported');\n serieType = false;\n break;\n\n case 'color':\n serieType = Graph.SERIE_LINE_COLORED;\n break;\n\n case 'scatter':\n serieType = Graph.SERIE_SCATTER;\n break;\n\n case 'box':\n serieType = Graph.SERIE_BOX;\n\n if (schemaSerie.orientation == 'x' || schemaSerie.orientation == 'y') {\n serieOptions.orientation = schemaSerie.orientation;\n }\n break;\n\n default:\n serieType = Graph.SERIE_LINE;\n break;\n }\n\n if (serieType !== Graph.SERIE_BOX) {\n waveform = Graph.newWaveform();\n }\n\n if (!serieType) {\n util.throwError('No valid serie type was found');\n return;\n }\n\n serie = graph.newSerie(schemaSerie.id || schemaSerie.label || util.guid(), serieOptions, serieType);\n\n if (schemaSerie.lineStyle) {\n\n let lineStyle;\n\n if (Array.isArray(lineStyle)) {\n lineStyle = {\n unselected: lineStyle\n };\n }\n\n Object.entries(lineStyle).forEach(([styleName, style]) => {\n\n var styleSerie = {};\n\n switch (serieType) {\n\n case Graph.SERIE_LINE:\n if (style.lineWidth !== undefined) {\n styleSerie.lineWidth = style.lineWidth;\n }\n\n if (style.color !== undefined) {\n styleSerie.lineColor = style.color;\n }\n\n if (style.lineStyle) {\n styleSerie.lineStyle = style.lineStyle;\n }\n\n serie.setStyle(styleSerie, styleName);\n break;\n }\n });\n }\n\n let defaultStyle = {};\n let defaultStyles = {};\n\n if (schemaSerie.defaultStyle) {\n defaultStyle = schemaSerie.defaultStyle;\n }\n\n if (schemaSerie.defaultStyles) {\n defaultStyles = schemaSerie.defaultStyles;\n }\n\n if (schemaSerie.styles) {\n\n let individualStyles;\n\n if (Array.isArray(schemaSerie.styles)) {\n individualStyles = {\n unselected: schemaSerie.styles\n };\n } else {\n individualStyles = schemaSerie.styles;\n }\n\n let styleNames = new Set(Object.keys(defaultStyles).concat(Object.keys(individualStyles)));\n\n styleNames.forEach(styleName => {\n\n var styleSerie = {};\n let style = [],\n styles;\n\n if (individualStyles && individualStyles[styleName]) {\n\n style = individualStyles[styleName];\n\n if (!Array.isArray(style)) {\n style = [style];\n }\n\n styles = style.map(function (eachStyleElement) {\n\n switch (serieType) {\n\n case Graph.SERIE_LINE:\n\n return {\n type: eachStyleElement.shape,\n zoom: eachStyleElement.zoom,\n strokeWidth: eachStyleElement.lineWidth,\n strokeColor: eachStyleElement.lineColor,\n fillColor: eachStyleElement.color,\n points: eachStyleElement.points\n };\n\n break;\n\n case Graph.SERIE_BOX:\n\n return eachStyleElement;\n\n break;\n\n case Graph.SERIE_SCATTER:\n return eachStyleElement;\n\n break;\n }\n });\n }\n\n switch (serieType) {\n\n case Graph.SERIE_LINE:\n\n serie.setMarkers(styles, styleName);\n break;\n\n case Graph.SERIE_SCATTER:\n serie.setStyle(Object.assign({}, defaultScatterStyle, defaultStyle, defaultStyles[styleName] || {}), styles, styleName);\n break;\n\n case Graph.SERIE_BOX:\n\n serie.setStyle(styles[0], styleName || 'unselected');\n break;\n }\n });\n }\n\n if (schemaSerie.color && serieType == Graph.SERIE_LINE_COLORED) {\n serie.setColors(schemaSerie.color);\n }\n\n if (serieType !== Graph.SERIE_BOX) {\n waveform.setData(schemaSerie.y, schemaSerie.x);\n }\n\n if (!serie) {\n return;\n }\n\n let errorBarsXAbove = [],\n errorBarsXBelow = [],\n errorBarsYAbove = [],\n errorBarsYBelow = [],\n errorBoxesXAbove = [],\n errorBoxesXBelow = [],\n errorBoxesYAbove = [],\n errorBoxesYBelow = [];\n\n if (waveform !== undefined) {\n var errors = [];\n if (schemaSerie.errorX) {\n\n for (var i = 0, l = schemaSerie.errorX.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorX[i])) {\n\n errorBarsXAbove.push(schemaSerie.errorX[i][0]);\n errorBarsXBelow.push(schemaSerie.errorX[i][1]);\n } else {\n errorBarsXAbove.push(schemaSerie.errorX[i]);\n errorBarsXBelow.push(schemaSerie.errorX[i]);\n }\n }\n } else if (schemaSerie.errorBarX || schemaSerie.errorBoxX) {\n\n if (schemaSerie.errorBarX) {\n\n for (var i = 0, l = schemaSerie.errorBarX.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBarX[i])) {\n\n errorBarsXAbove.push(schemaSerie.errorBarX[i][0]);\n errorBarsXBelow.push(schemaSerie.errorBarX[i][1]);\n } else {\n errorBarsXAbove.push(schemaSerie.errorBarX[i]);\n errorBarsXBelow.push(schemaSerie.errorBarX[i]);\n }\n }\n }\n\n if (schemaSerie.errorBoxX) {\n\n for (var i = 0, l = schemaSerie.errorBoxX.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBoxX[i])) {\n\n errorBoxesXAbove.push(schemaSerie.errorBoxX[i][0]);\n errorBoxesXBelow.push(schemaSerie.errorBoxX[i][1]);\n } else {\n errorBoxesXAbove.push(schemaSerie.errorBoxX[i]);\n errorBoxesXBelow.push(schemaSerie.errorBoxX[i]);\n }\n }\n }\n }\n\n if (schemaSerie.errorY) {\n\n for (var i = 0, l = schemaSerie.errorY.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorY[i])) {\n\n errorBarsYAbove.push(schemaSerie.errorY[i][0]);\n errorBarsYBelow.push(schemaSerie.errorY[i][1]);\n } else {\n errorBarsYAbove.push(schemaSerie.errorY[i]);\n errorBarsYBelow.push(schemaSerie.errorY[i]);\n }\n }\n } else if (schemaSerie.errorBarY || schemaSerie.errorBoxY) {\n\n if (schemaSerie.errorBarY) {\n\n for (var i = 0, l = schemaSerie.errorBarY.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBarY[i])) {\n\n errorBarsYAbove.push(schemaSerie.errorBarY[i][0]);\n errorBarsYBelow.push(schemaSerie.errorBarY[i][1]);\n } else {\n errorBarsYAbove.push(schemaSerie.errorBarY[i]);\n errorBarsYBelow.push(schemaSerie.errorBarY[i]);\n }\n }\n }\n\n if (schemaSerie.errorBoxY) {\n\n for (var i = 0, l = schemaSerie.errorBoxY.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBoxY[i])) {\n\n errorBoxesYAbove.push(schemaSerie.errorBoxY[i][0]);\n errorBoxesYBelow.push(schemaSerie.errorBoxY[i][1]);\n } else {\n errorBoxesYAbove.push(schemaSerie.errorBoxY[i]);\n errorBoxesYBelow.push(schemaSerie.errorBoxY[i]);\n }\n }\n }\n }\n\n style = {};\n if (errorBarsXAbove.length > 0) {\n waveform.setErrorBarXAbove(Graph.newWaveform(errorBarsXAbove));\n style.right = {};\n }\n if (errorBarsXBelow.length > 0) {\n waveform.setErrorBarXAbove(Graph.newWaveform(errorBarsXAbove));\n style.left = {};\n }\n if (errorBarsYAbove.length > 0) {\n waveform.setErrorBarXAbove(Graph.newWaveform(errorBarsYAbove));\n style.top = {};\n }\n if (errorBarsYBelow.length > 0) {\n waveform.setErrorBarXAbove(Graph.newWaveform(errorBarsYAbove));\n style.bottom = {};\n }\n\n serie.setErrorBarStyle(style);\n\n style = {};\n if (errorBoxesXAbove.length > 0) {\n waveform.setErrorBoxXAbove(Graph.newWaveform(errorBoxesXAbove));\n style.right = {};\n }\n if (errorBoxesXBelow.length > 0) {\n waveform.setErrorBoxXBelow(Graph.newWaveform(errorBoxesXBelow));\n style.left = {};\n }\n if (errorBoxesYAbove.length > 0) {\n waveform.setErrorBoxAbove(Graph.newWaveform(errorBoxesYAbove));\n style.top = {};\n }\n if (errorBoxesYBelow.length > 0) {\n waveform.setErrorBoxBelow(Graph.newWaveform(errorBoxesYBelow));\n style.bottom = {};\n }\n serie.setErrorBoxStyle(style);\n }\n\n if (schema.axis) {\n serieAxis = schema.axis[schemaSerie.xAxis];\n\n if (!serieAxis || serieAxis.type !== 'top' && serieAxis.type !== 'bottom') {\n util.warn('No x axis found. Setting automatically');\n serie.setXAxis(graph.getXAxis(0));\n } else {\n if (serieAxis.type == 'top') {\n serie.setXAxis(graph.getTopAxis(serieAxis._jsGraphIndex));\n } else if (serieAxis.type == 'bottom') {\n serie.setXAxis(graph.getBottomAxis(serieAxis._jsGraphIndex));\n }\n }\n\n serieAxis = schema.axis[schemaSerie.yAxis];\n\n if (!serieAxis || serieAxis.type !== 'left' && serieAxis.type !== 'right') {\n util.warn('No y axis found. Setting automatically');\n serie.setYAxis(graph.getYAxis(0));\n } else {\n if (serieAxis.type == 'left') {\n serie.setYAxis(graph.getLeftAxis(serieAxis._jsGraphIndex));\n } else if (serieAxis.type == 'right') {\n serie.setYAxis(graph.getRightAxis(serieAxis._jsGraphIndex));\n }\n }\n } else {\n util.warn('No axes found. Setting automatically');\n serie.autoAxis();\n }\n\n switch (serieType) {\n\n case Graph.SERIE_BOX:\n\n serie.setData(schemaSerie.boxes);\n\n break;\n\n default:\n case Graph.SERIE_SCATTER:\n case Graph.SERIE_LINE_COLORED:\n case Graph.SERIE_LINE:\n\n serie.setWaveform(waveform);\n\n break;\n }\n });\n }\n\n graph.autoscaleAxes();\n graph.draw();\n\n return graph;\n }\n\n exportToSchema() {\n\n let schema = {};\n\n schema.title = this.options.title;\n\n schema.width = this.getWidth();\n schema.height = this.getHeight();\n\n let axesPositions = ['top', 'bottom', 'left', 'right'];\n let axesExport = [];\n let allaxes = {\n x: [],\n y: []\n };\n\n axesPositions.map(axisPosition => {\n\n if (!this.axis[axisPosition]) {\n return;\n }\n\n axesExport = axesExport.concat(this.axis[axisPosition].map(axis => {\n return {\n\n type: axisPosition,\n label: axis.options.label,\n unit: axis.options.unit,\n min: axis.options.forcedMin,\n max: axis.options.forcedMax,\n flip: axis.options.flipped\n\n };\n }));\n\n if (axisPosition == 'top' || axisPosition == 'bottom') {\n allaxes.x = allaxes.x.concat(this.axis[axisPosition]);\n } else {\n allaxes.y = allaxes.y.concat(this.axis[axisPosition]);\n }\n });\n\n schema.axis = axesExport;\n\n let seriesExport = [];\n\n let toType = type => {\n switch (type) {\n\n case Graph.SERIE_LINE:\n return 'line';\n break;\n\n case Graph.SERIE_BAR:\n return 'bar';\n break;\n\n case Graph.SERIE_LINE_COLORED:\n return 'color';\n break;\n\n case Graph.SERIE_SCATTER:\n return 'scatter';\n break;\n }\n };\n\n let exportData = (serie, x) => {\n\n let data = [];\n\n switch (serie.getType()) {\n\n case Graph.SERIE_LINE:\n\n for (var i = 0; i < serie.data.length; i++) {\n\n for (var j = 0; j < serie.data[i].length - 1; j += 2) {\n\n data.push(serie.data[i][j + (x && serie.isFlipped() || !x && !serie.isFlipped() ? 1 : 0)]);\n }\n }\n break;\n\n case Graph.SERIE_SCATTER:\n\n for (var j = 0; j < serie.data.length - 1; j += 2) {\n\n data.push(serie.data[i + (x && serie.isFlipped() || !x && !serie.isFlipped() ? 1 : 0)]);\n }\n\n break;\n }\n\n return data;\n };\n\n schema.data = seriesExport.concat(this.series.map(serie => {\n\n let style = [];\n let linestyle = [];\n\n if (serie.getType() == Graph.SERIE_LINE) {\n\n for (var stylename in serie.styles) {\n linestyle.push({\n styleName: stylename,\n color: serie.styles[stylename].lineColor,\n lineWidth: serie.styles[stylename].lineWidth,\n lineStyle: serie.styles[stylename].lineStyle\n });\n\n let styleObj = {\n styleName: stylename,\n styles: []\n };\n style.push(styleObj);\n\n styleObj.styles = styleObj.styles.concat((serie.styles[stylename].markers || []).map(markers => {\n return {\n shape: markers.type,\n zoom: markers.zoom,\n lineWidth: markers.strokeWidth,\n lineColor: markers.strokeColor,\n color: markers.fillColor,\n points: markers.points\n };\n }));\n }\n }\n\n return {\n label: serie.getLabel(),\n id: serie.getName(),\n type: toType(serie.getType()),\n x: exportData(serie, true),\n y: exportData(serie, false),\n xAxis: allaxes.x.indexOf(serie.getXAxis()),\n yAxis: allaxes.y.indexOf(serie.getYAxis()),\n style: style,\n lineStyle: linestyle\n };\n }));\n\n return schema;\n }\n\n /**\n * Registers a constructor to jsGraph. Constructors are used on a later basis by jsGraph to create series, shapes or plugins\n * @param {String} constructorName - The name of the constructor\n * @param {Function} constructor - The constructor method\n * @see Graph.getConstructor\n * @static\n */\n static registerConstructor(constructorName, constructor) {\n\n if (_constructors.has(constructorName)) {\n return util.throwError('Constructor ' + constructor + ' already exists.');\n }\n\n _constructors.set(constructorName, constructor);\n }\n\n /**\n * Returns a registered constructor\n * @param {String} constructorName - The constructor name to look for\n * @param {Boolean} [softFail = false ] - Fails silently if the constructor doesn't exist, and returns false\n * @returns {Function} The registered constructor\n * @throws Error\n * @see Graph.registerConstructor\n * @static\n */\n static getConstructor(constructorName, softFail = false) {\n\n if (!_constructors.has(constructorName)) {\n\n if (softFail) {\n return false;\n }\n\n return util.throwError('Constructor \"' + constructorName + \"\\\" doesn't exist\");\n }\n\n return _constructors.get(constructorName);\n }\n\n static newWaveform() {\n return new _waveform2.default(...arguments);\n }\n\n static waveform() {\n return new _waveform2.default(...arguments);\n }\n }\n\n // Adds getConstructor to the prototype. Cannot do that in ES6 classes\n Graph.prototype.getConstructor = Graph.getConstructor;\n\n function makeSerie(graph, name, options, type) {\n\n var constructor = graph.getConstructor(type, true);\n if (!constructor && typeof type == 'string') {\n constructor = graph.getConstructor('graph.serie.' + type, true);\n }\n\n if (constructor) {\n\n var serie = new constructor(graph, name, options);\n //serie.init( graph, name, options );\n graph.appendSerieToDom(serie);\n } else {\n\n return util.throwError('No constructor exists for the serie type provided. Use Graph.registerConstructor( name, constructor ) first is you use your own series');\n }\n\n return serie;\n }\n\n function getAxisLevelFromSpan(span, level) {\n\n for (var i = 0, l = level.length; i < l; i++) {\n\n var possible = true;\n for (var k = 0, m = level[i].length; k < m; k++) {\n\n if (!(span[0] < level[i][k][0] && span[1] < level[i][k][0] || span[0] > level[i][k][1] && span[1] > level[i][k][1])) {\n possible = false;\n }\n }\n\n if (possible) {\n\n level[i].push(span);\n return i;\n }\n }\n\n level.push([span]);\n return level.length - 1;\n }\n\n function refreshDrawingZone(graph) {\n\n var i, j, l, xy, min, max, axis;\n var shift = {\n top: [],\n bottom: [],\n left: [],\n right: []\n };\n\n var levels = {\n top: [],\n bottom: [],\n left: [],\n right: []\n };\n\n graph._painted = true;\n // Apply to top and bottom\n\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n axis.hideGroup();\n return;\n } else {\n axis.showGroup();\n }\n\n if (axis.floating) {\n return;\n }\n\n var level = getAxisLevelFromSpan(axis.getSpan(), levels[position]);\n axis.setLevel(level);\n\n shift[position][level] = Math.max(axis.getAxisPosition(), shift[position][level] || 0);\n }, false, true, false);\n\n var shiftTop = shift.top.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n var shiftBottom = shift.bottom.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n graph.drawingSpaceHeight = graph.getDrawingHeight() - shiftTop - shiftBottom;\n\n [shift.top, shift.bottom].map(function (arr) {\n arr.reduce(function (prev, current, index) {\n arr[index] = prev + current;\n return prev + current;\n }, 0);\n });\n\n // Apply to top and bottom\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown() || axis.floating) {\n return;\n }\n\n axis.setShift(shift[position][axis.getLevel()]);\n }, false, true, false);\n\n // Applied to left and right\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n axis.hideGroup();\n // Don't return here. We need to go through the draw method as the axis must be assigned minPx and maxPx values.\n // This is because some series can still be visible although the axis isn't.\n } else {\n axis.showGroup();\n }\n\n axis.setMinPx(shiftTop);\n axis.setMaxPx(graph.getDrawingHeight(true) - shiftBottom);\n\n if (axis.floating) {\n return;\n }\n\n // First we need to draw it in order to determine the width to allocate\n // graph is done to accomodate 0 and 100000 without overlapping any element in the DOM (label, ...)\n\n // Let's not draw dependant axes yet\n let drawn = !axis.linkedToAxis ? axis.draw() : 0;\n\n if (!axis.isShown()) {\n return;\n }\n // Get axis position gives the extra shift that is common\n var level = getAxisLevelFromSpan(axis.getSpan(), levels[position]);\n axis.setLevel(level);\n shift[position][level] = Math.max(drawn, shift[position][level] || 0);\n }, false, false, true);\n\n var shift2 = util.extend(true, {}, shift);\n\n // Applied to left and right\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown() || axis.floating) {\n return;\n }\n\n shift2[position][axis.getLevel()] = Math.max(shift[position][axis.getLevel()], axis.equalizePosition(shift[position][axis.getLevel()]));\n }, false, false, true);\n\n shift = shift2;\n\n var shiftLeft = shift.left.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n var shiftRight = shift.right.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n graph.drawingSpaceWidth = graph.getDrawingWidth() - shiftLeft - shiftRight;\n\n [shift.left, shift.right].map(function (arr) {\n arr.reduce(function (prev, current, index) {\n arr[index] = prev + current;\n return prev + current;\n }, 0);\n });\n\n // Apply to left and right\n graph._applyToAxes((axis, position) => {\n\n if (!axis.isShown() || axis.floating) {\n return;\n }\n axis.setShift(shift[position][axis.getLevel()]);\n }, false, false, true);\n\n // Apply to top and bottom\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n // return;\n }\n\n axis.setMinPx(shiftLeft);\n axis.setMaxPx(graph.getDrawingWidth(true) - shiftRight);\n\n if (axis.floating) {\n return;\n }\n\n if (!axis.linkedToAxis) {\n axis.draw();\n }\n }, false, true, false);\n\n // Floating axes\n graph._applyToAxes(function (axis) {\n\n if (!axis.floating) {\n return;\n }\n\n var floatingAxis = axis.getFloatingAxis();\n var floatingValue = axis.getFloatingValue();\n var floatingPx = floatingAxis.getPx(floatingValue);\n\n axis.setShift(floatingPx);\n\n if (!axis.linkedToAxis) {\n axis.draw();\n }\n }, false, true, true);\n\n _closeLine(graph, 'right', graph.getDrawingWidth(true), graph.getDrawingWidth(true), shiftTop, graph.getDrawingHeight(true) - shiftBottom);\n _closeLine(graph, 'left', 0, 0, shiftTop, graph.getDrawingHeight(true) - shiftBottom);\n _closeLine(graph, 'top', shiftLeft, graph.getDrawingWidth(true) - shiftRight, 0, 0);\n _closeLine(graph, 'bottom', shiftLeft, graph.getDrawingWidth(true) - shiftRight, graph.getDrawingHeight(true) - shiftBottom, graph.getDrawingHeight(true) - shiftBottom);\n\n graph.clipRect.setAttribute('y', shiftTop);\n graph.clipRect.setAttribute('x', shiftLeft);\n graph.clipRect.setAttribute('width', graph.getDrawingWidth() - shiftLeft - shiftRight);\n graph.clipRect.setAttribute('height', graph.getDrawingHeight() - shiftTop - shiftBottom);\n\n graph.rectEvent.setAttribute('y', shiftTop + graph.getPaddingTop());\n graph.rectEvent.setAttribute('x', shiftLeft + graph.getPaddingLeft());\n\n graph.rectEvent.setAttribute('width', graph.drawingSpaceWidth);\n graph.rectEvent.setAttribute('height', graph.drawingSpaceHeight);\n\n graph.drawingSpaceMinX = shiftLeft + graph.getPaddingLeft(); // + \"px\";\n graph.drawingSpaceMinY = shiftTop + graph.getPaddingTop(); // + \"px\";\n graph.drawingSpaceMaxX = graph.getDrawingWidth() - shiftRight + graph.getPaddingLeft(); // + \"px\";\n graph.drawingSpaceMaxY = graph.getDrawingHeight() - shiftBottom + graph.getPaddingTop(); // + \"px\";\n\n // Apply to top and bottom\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n return;\n }\n\n axis.drawLines();\n }, false, true, true);\n\n /*\n graph.shapeZoneRect.setAttribute('x', shift[1]);\n graph.shapeZoneRect.setAttribute('y', shift[2]);\n graph.shapeZoneRect.setAttribute('width', graph.getDrawingWidth() - shift[2] - shift[3]);\n graph.shapeZoneRect.setAttribute('height', graph.getDrawingHeight() - shift[1] - shift[0]);\n */\n graph.shift = shift;\n graph.redrawShapes(); // Not sure this should be automatic here. The user should be clever.\n }\n\n function _handleKey(graph, event, type) {\n\n var self = graph;\n console.log(event, type);\n if (graph.forcedPlugin) {\n\n graph.activePlugin = graph.forcedPlugin;\n graph._pluginExecute(graph.activePlugin, type, [graph, event]);\n return;\n }\n\n checkKeyActions(graph, event, [graph, event], type);\n }\n\n // Similar to checkMouseActions\n function checkKeyActions(graph, e, parameters, methodName) {\n\n var keyComb = graph.options.keyActions,\n i,\n l;\n\n for (i = 0, l = keyComb.length; i < l; i++) {\n\n if (keyComb[i].plugin) {\n // Is it a plugin ?\n\n if (graph.forcedPlugin == keyComb[i].plugin || graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n graph.activePlugin = keyComb[i].plugin; // Lease the mouse action to the current action\n graph._pluginExecute(keyComb[i].plugin, methodName, parameters);\n\n e.preventDefault();\n e.stopPropagation();\n\n return true;\n }\n } else if (keyComb[i].callback && graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n keyComb[i].callback.apply(graph, parameters);\n return true;\n }\n\n if (keyComb[i].removeSelectedShape && graph.isActionAllowed(e, keyComb[i])) {\n\n e.preventDefault();\n e.stopPropagation();\n\n graph.selectedShapes.map(shape => {\n\n shape.kill(keyComb[i].keepInDom);\n });\n }\n\n /* else if ( keyComb[ i ].series ) {\n var series;\n if ( keyComb[ i ].series === 'all' ) {\n series = graph.series;\n }\n if ( !Array.isArray( keyComb[ i ].series ) ) {\n series = [ series ];\n }\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n for ( var j = 0; j < series.length; i++ ) {\n graph._serieExecute( series[ i ], methodName, parameters );\n }\n return true;\n }*/\n }\n\n return false;\n }\n\n function doDom() {\n\n // Create SVG element, set the NS\n this.dom = document.createElementNS(Graph.ns, 'svg');\n this.dom.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xlink', 'http://www.w3.org/1999/xlink');\n //this.dom.setAttributeNS(this.ns, 'xmlns:xlink', this.nsxml);\n util.setAttributeTo(this.dom, {\n 'xmlns': Graph.ns,\n 'font-family': this.options.fontFamily,\n 'font-size': this.options.fontSize\n });\n\n try {\n util.setAttributeTo(this.dom, {\n 'data-jsgraph-version': 'v2.0.71'\n });\n } catch (e) {\n // ignore\n }\n\n this.defs = document.createElementNS(Graph.ns, 'defs');\n this.dom.appendChild(this.defs);\n\n this.groupEvent = document.createElementNS(Graph.ns, 'g');\n\n this.rectEvent = document.createElementNS(Graph.ns, 'rect');\n util.setAttributeTo(this.rectEvent, {\n 'pointer-events': 'fill',\n 'fill': 'transparent'\n });\n this.groupEvent.appendChild(this.rectEvent);\n\n this.dom.appendChild(this.groupEvent);\n\n // Handling graph title\n this.domTitle = document.createElementNS(Graph.ns, 'text');\n this.setTitle(this.options.title);\n util.setAttributeTo(this.domTitle, {\n 'text-anchor': 'middle',\n 'y': 20\n });\n this.groupEvent.appendChild(this.domTitle);\n //\n\n this.graphingZone = document.createElementNS(Graph.ns, 'g');\n this.updateGraphingZone();\n\n this.groupEvent.appendChild(this.graphingZone);\n\n /* this.shapeZoneRect = document.createElementNS(this.ns, 'rect');\n //this.shapeZoneRect.setAttribute('pointer-events', 'fill');\n this.shapeZoneRect.setAttribute('fill', 'transparent');\n this.shapeZone.appendChild(this.shapeZoneRect);\n */\n this.axisGroup = document.createElementNS(Graph.ns, 'g');\n this.graphingZone.appendChild(this.axisGroup);\n\n this.groupGrids = document.createElementNS(Graph.ns, 'g');\n\n // With the z stacking, this should probably be removed\n //this.groupGrids.setAttribute( 'clip-path', 'url(#_clipplot' + this._creation + ')' );\n\n this.groupPrimaryGrids = document.createElementNS(Graph.ns, 'g');\n this.groupSecondaryGrids = document.createElementNS(Graph.ns, 'g');\n\n this.axisGroup.appendChild(this.groupGrids);\n\n this.groupGrids.appendChild(this.groupSecondaryGrids);\n this.groupGrids.appendChild(this.groupPrimaryGrids);\n\n this.plotGroup = document.createElementNS(Graph.ns, 'g');\n this.graphingZone.appendChild(this.plotGroup);\n\n // 5 September 2014. I encountered a case here shapeZone must be above plotGroup\n /*this.shapeZone = document.createElementNS( this.ns, 'g' );\n this.graphingZone.appendChild( this.shapeZone );\n */\n\n this.layers = [];\n\n this._makeClosingLines();\n\n this.clip = document.createElementNS(Graph.ns, 'clipPath');\n this.clip.setAttribute('id', '_clipplot' + this._creation);\n this.defs.appendChild(this.clip);\n\n this.clipRect = document.createElementNS(Graph.ns, 'rect');\n this.clip.appendChild(this.clipRect);\n this.clip.setAttribute('clipPathUnits', 'userSpaceOnUse');\n\n this.markerArrow = document.createElementNS(this.ns, 'marker');\n this.markerArrow.setAttribute('viewBox', '0 0 10 10');\n this.markerArrow.setAttribute('id', 'arrow' + this._creation);\n this.markerArrow.setAttribute('refX', '6');\n this.markerArrow.setAttribute('refY', '5');\n this.markerArrow.setAttribute('markerUnits', 'strokeWidth');\n this.markerArrow.setAttribute('markerWidth', '8');\n this.markerArrow.setAttribute('markerHeight', '6');\n this.markerArrow.setAttribute('orient', 'auto');\n //this.markerArrow.setAttribute('fill', 'context-stroke');\n //this.markerArrow.setAttribute('stroke', 'context-stroke');\n\n var pathArrow = document.createElementNS(Graph.ns, 'path');\n pathArrow.setAttribute('d', 'M 0 0 L 10 5 L 0 10 z');\n //pathArrow.setAttribute( 'fill', 'context-stroke' );\n this.markerArrow.appendChild(pathArrow);\n\n this.defs.appendChild(this.markerArrow);\n\n // Horionzal split marker for axis\n this.markerHorizontalSplit = document.createElementNS(Graph.ns, 'marker');\n this.markerHorizontalSplit.setAttribute('viewBox', '0 0 6 8');\n this.markerHorizontalSplit.setAttribute('id', 'horionzalsplit_' + this.getId());\n this.markerHorizontalSplit.setAttribute('refX', '3');\n this.markerHorizontalSplit.setAttribute('refY', '4');\n this.markerHorizontalSplit.setAttribute('markerUnits', 'strokeWidth');\n this.markerHorizontalSplit.setAttribute('markerWidth', '6');\n this.markerHorizontalSplit.setAttribute('markerHeight', '8');\n\n var path = document.createElementNS(Graph.ns, 'line');\n path.setAttribute('x1', '0');\n path.setAttribute('y1', '8');\n\n path.setAttribute('x2', '6');\n path.setAttribute('y2', '0');\n\n path.setAttribute('stroke', 'black');\n this.markerHorizontalSplit.appendChild(path);\n\n this.defs.appendChild(this.markerHorizontalSplit);\n\n // Vertical split marker for axis\n this.markerVerticalSplit = document.createElementNS(Graph.ns, 'marker');\n this.markerVerticalSplit.setAttribute('viewBox', '0 0 8 6');\n this.markerVerticalSplit.setAttribute('id', 'verticalsplit_' + this.getId());\n this.markerVerticalSplit.setAttribute('refX', '4');\n this.markerVerticalSplit.setAttribute('refY', '3');\n this.markerVerticalSplit.setAttribute('markerUnits', 'strokeWidth');\n this.markerVerticalSplit.setAttribute('markerWidth', '8');\n this.markerVerticalSplit.setAttribute('markerHeight', '6');\n\n var path = document.createElementNS(Graph.ns, 'line');\n\n path.setAttribute('x1', '0');\n path.setAttribute('y1', '0');\n\n path.setAttribute('x2', '8');\n path.setAttribute('y2', '6');\n\n path.setAttribute('stroke', 'black');\n this.markerVerticalSplit.appendChild(path);\n this.defs.appendChild(this.markerVerticalSplit);\n\n this.vertLineArrow = document.createElementNS(Graph.ns, 'marker');\n this.vertLineArrow.setAttribute('viewBox', '0 0 10 10');\n this.vertLineArrow.setAttribute('id', 'verticalline' + this._creation);\n this.vertLineArrow.setAttribute('refX', '0');\n this.vertLineArrow.setAttribute('refY', '5');\n this.vertLineArrow.setAttribute('markerUnits', 'strokeWidth');\n this.vertLineArrow.setAttribute('markerWidth', '20');\n this.vertLineArrow.setAttribute('markerHeight', '10');\n this.vertLineArrow.setAttribute('orient', 'auto');\n //this.vertLineArrow.setAttribute('fill', 'context-stroke');\n //this.vertLineArrow.setAttribute('stroke', 'context-stroke');\n this.vertLineArrow.setAttribute('stroke-width', '1px');\n\n var pathVertLine = document.createElementNS(Graph.ns, 'path');\n pathVertLine.setAttribute('d', 'M 0 -10 L 0 10');\n pathVertLine.setAttribute('stroke', 'black');\n\n this.vertLineArrow.appendChild(pathVertLine);\n\n this.defs.appendChild(this.vertLineArrow);\n\n // Removed with z stacking ?\n // this.plotGroup.setAttribute( 'clip-path', 'url(#_clipplot' + this._creation + ')' );\n\n this.bypassHandleMouse = false;\n }\n\n function _registerEvents(graph) {\n var self = graph;\n\n if (!graph.wrapper) {\n throw 'No wrapper exists. Cannot register the events.';\n }\n\n graph.dom.setAttribute('tabindex', 0);\n\n graph.dom.addEventListener('keydown', e => {\n _handleKey(graph, e, 'keydown');\n });\n\n graph.dom.addEventListener('keypress', e => {\n _handleKey(graph, e, 'keypress');\n });\n\n graph.dom.addEventListener('keyup', e => {\n _handleKey(graph, e, 'keyup');\n });\n // Not sure this has to be prevented\n\n // August 17th, 2017: I extended the graph.groupEvent to the more general graph.dom to make the zoom plugin more\n // intuitive. Let us see if it breaks another example...\n graph.dom.addEventListener('mousemove', e => {\n //e.preventDefault();\n var coords = graph._getXY(e);\n _handleMouseMove(graph, coords.x, coords.y, e);\n });\n\n graph.dom.addEventListener('mouseleave', e => {\n\n _handleMouseLeave(graph);\n });\n\n graph.groupEvent.addEventListener('mousedown', e => {\n\n graph.focus();\n\n // e.preventDefault();\n if (e.which == 3 || e.ctrlKey) {\n return;\n }\n\n var coords = graph._getXY(e);\n _handleMouseDown(graph, coords.x, coords.y, e);\n });\n\n graph.dom.addEventListener('mouseup', e => {\n\n graph.emit('mouseUp', e);\n var coords = graph._getXY(e);\n\n _handleMouseUp(graph, coords.x, coords.y, e);\n });\n\n graph.wrapper.addEventListener('mouseup', e => {\n e.stopPropagation();\n });\n\n graph.dom.addEventListener('dblclick', e => {\n\n graph.emit('dblClick', e);\n var coords = graph._getXY(e);\n\n _handleDblClick(graph, coords.x, coords.y, e);\n });\n\n graph.groupEvent.addEventListener('click', e => {\n\n // Cancel right click or Command+Click\n if (e.which == 3 || e.ctrlKey) {\n return;\n }\n\n // e.preventDefault();\n var coords = graph._getXY(e);\n\n if (!graph.prevent(false)) {\n _handleClick(graph, coords.x, coords.y, e);\n }\n\n //}, 200 );\n });\n\n graph.groupEvent.addEventListener('mousewheel', e => {\n\n var deltaY = e.wheelDeltaY || e.wheelDelta || -e.deltaY;\n var coords = graph._getXY(e);\n _handleMouseWheel(graph, deltaY, coords.x, coords.y, e);\n\n return false;\n });\n\n graph.groupEvent.addEventListener('wheel', e => {\n\n var coords = graph._getXY(e);\n var deltaY = e.wheelDeltaY || e.wheelDelta || -e.deltaY;\n _handleMouseWheel(graph, deltaY, coords.x, coords.y, e);\n\n return false;\n });\n }\n\n function _handleMouseDown(graph, x, y, e) {\n\n var self = graph;\n\n if (graph.forcedPlugin) {\n\n graph.activePlugin = graph.forcedPlugin;\n graph._pluginExecute(graph.activePlugin, 'onMouseDown', [graph, x, y, e]);\n return;\n }\n\n if (graph.activePlugin) {\n graph.activePlugin = false;\n }\n\n checkMouseActions(graph, e, [graph, x, y, e], 'onMouseDown');\n }\n\n function _handleMouseMove(graph, x, y, e) {\n\n if (graph.bypassHandleMouse) {\n graph.bypassHandleMouse.handleMouseMove(e);\n return;\n }\n\n if (graph.activePlugin && graph._pluginExecute(graph.activePlugin, 'onMouseMove', [graph, x, y, e])) {\n return;\n }\n\n //\t\t\treturn;\n\n graph._applyToAxes('handleMouseMove', [x - graph.options.paddingLeft, e], true, false);\n graph._applyToAxes('handleMouseMove', [y - graph.options.paddingTop, e], false, true);\n\n if (!graph.activePlugin) {\n var index;\n\n // Takes care of the tracking line\n if (graph.options.trackingLine && graph.options.trackingLine.enable && graph.options.trackingLine.snapToSerie) {\n\n if (graph.options.trackingLine.mode == 'common') {\n\n var snapToSerie = graph.options.trackingLine.snapToSerie;\n index = snapToSerie.handleMouseMove(false, true);\n\n if (this.trackingObject) {\n\n if (!index) {\n\n graph.trackingObject.hide();\n } else {\n\n graph.trackingObject.show();\n\n graph.trackingObject.getPosition(0).x = index.xClosest;\n graph.trackingObject.getPosition(1).x = index.xClosest;\n graph.trackingObject.redraw();\n\n var x = snapToSerie.getXAxis().getPx(index.xClosest) + graph.options.paddingLeft;\n }\n }\n\n var series = graph.options.trackingLine.series;\n\n // Gets a default value\n if (!series) {\n\n series = graph.getSeries().map(function (serie) {\n return {\n serie: serie,\n withinPx: 20,\n withinVal: -1\n };\n });\n }\n\n graph._trackingLegend = _trackingLegendSerie(graph, series, x, y, graph._trackingLegend, graph.options.trackingLine.textMethod, index.xClosest);\n }\n }\n }\n // End takes care of the tracking line\n\n if (graph.options.onMouseMoveData) {\n var results = {};\n\n for (var i = 0; i < graph.series.length; i++) {\n\n results[graph.series[i].getName()] = graph.series[i].handleMouseMove(false, true);\n }\n\n graph.options.onMouseMoveData.call(graph, e, results);\n }\n\n checkMouseActions(graph, e, [graph, x, y, e], 'onMouseMove');\n }\n\n function checkMouseActions(graph, e, parameters, methodName) {\n\n var keyComb = graph.options.mouseActions,\n i,\n l,\n executed = false;\n\n for (i = 0, l = keyComb.length; i < l; i++) {\n\n if (keyComb[i].plugin) {\n // Is it a plugin ?\n\n if (graph.forcedPlugin == keyComb[i].plugin || graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n // Lease the mouse action to the current action\n // 25.10.2017: Except for mousewheel. See #111\n if (e.type !== 'wheel' && e.type !== 'mousewheel') {\n graph.activePlugin = keyComb[i].plugin;\n }\n\n graph._pluginExecute(keyComb[i].plugin, methodName, parameters);\n executed = true;\n continue;\n }\n } else if (keyComb[i].callback && graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n keyComb[i].callback.apply(graph, parameters);\n executed = true;\n continue;\n } else if (keyComb[i].series) {\n\n var series;\n if (keyComb[i].series === 'all') {\n series = graph.series;\n }\n\n if (!Array.isArray(keyComb[i].series)) {\n series = [series];\n }\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n for (var j = 0; j < series.length; i++) {\n graph._serieExecute(series[i], methodName, parameters);\n }\n executed = true;\n continue;\n }\n }\n\n return executed;\n }\n\n var _trackingLegendSerie = function (graph, serie, x, y, legend, textMethod, xValue) {\n\n var justCreated = false;\n\n if (!Array.isArray(serie)) {\n serie = [serie];\n }\n\n var output = [];\n\n if (!legend && graph.options.trackingLine.legend) {\n justCreated = true;\n legend = _makeTrackingLegend(graph);\n }\n\n serie.map(serie => {\n\n var index = serie.serie.handleMouseMove(xValue, false);\n\n if (!index || !textMethod) {\n\n if (serie.serie.trackingShape) {\n serie.serie.trackingShape.hide();\n }\n\n return legend;\n }\n\n // Should we display the dot ?\n if (serie.withinPx > 0 && Math.abs(x - graph.options.paddingLeft - serie.serie.getXAxis().getPx(index.xClosest)) - serie.withinPx > 1e-14 || serie.withinVal > 0 && Math.abs(serie.serie.getXAxis().getVal(x - graph.options.paddingLeft) - index.xClosest) - serie.withinVal > serie.serie.getXAxis().getVal(x - graph.options.paddingLeft) / 100000) {\n\n if (serie.serie.trackingShape) {\n serie.serie.trackingShape.hide();\n }\n } else {\n\n output[serie.serie.getName()] = {\n\n yValue: index.xClosest,\n xValue: index.yClosest,\n serie: serie,\n index: index\n\n };\n\n let serieShape;\n if (graph.options.trackingLine && graph.options.trackingLine.serieShape) {\n serieShape = graph.options.trackingLine.serieShape;\n } else {\n serieShape = {\n shape: 'ellipse',\n properties: {\n rx: [serie.serie.getLineWidth() * 3 + 'px'],\n ry: [serie.serie.getLineWidth() * 3 + 'px']\n }\n };\n }\n\n if (!serie.serie.trackingShape) {\n\n serie.serie.trackingShape = graph.newShape(serieShape.shape, {\n fillColor: serie.serie.getLineColor(),\n strokeColor: 'White',\n strokeWidth: serie.serie.getLineWidth()\n }, true, serieShape.properties).setSerie(serie.serie).forceParentDom(serie.serie.groupMain).draw();\n\n serieShape.onCreated && serieShape.onCreated(serie.serie.trackingShape);\n\n serie.serie.trackingShape.on('changed', () => {\n\n serieShape.onChanged && serieShape.onChanged(serie.serie.trackingShape);\n });\n }\n\n serie.serie.trackingShape.show();\n serie.serie.trackingShape.getPosition(0).x = index.xClosest;\n\n if (serieShape.magnet) {\n\n let magnetOptions = serieShape.magnet,\n val = magnetOptions.within,\n minmaxpos;\n\n if (magnetOptions.withinPx) {\n val = serie.serie.getXAxis().getRelVal(magnetOptions.withinPx);\n }\n\n if (minmaxpos = serie.serie.findLocalMinMax(index.xClosest, val, magnetOptions.mode)) {\n\n serie.serie.trackingShape.getPosition(0).x = minmaxpos;\n }\n }\n\n serie.serie.trackingShape.redraw();\n }\n }); // End map\n\n if (!graph.options.trackingLine.legend) {\n return;\n }\n\n if (Object.keys(output).length == 0 || !textMethod) {\n legend.style.display = 'none';\n } else {\n\n if (legend.style.display == 'none' || justCreated) {\n\n forceTrackingLegendMode(graph, legend, x, y, true);\n } else {\n _trackingLegendMove(graph, legend, x, y);\n }\n\n legend.style.display = 'block';\n var txt = textMethod(output, xValue, x, y);\n\n legend.innerHTML = txt;\n\n //legend.innerHTML = textMethod( output, xValue, x, y );\n }\n\n return legend;\n };\n\n var forceTrackingLegendMode = function (graph, legend, toX, toY, skip) {\n\n var ratio = 0,\n start = Date.now(),\n h = legend.offsetHeight,\n startX = parseInt(legend.style.marginLeft.replace('px', '') || 0),\n startY = parseInt(legend.style.marginTop.replace('px', '') || 0);\n\n toX = toX > graph.getWidth() / 2 ? toX - toX % 10 - 20 - legend.offsetWidth : toX - toX % 10 + 30;\n toY = toY - toY % 10 + h / 2;\n\n if (skip) {\n legend.style.marginLeft = toX + 'px';\n legend.style.marginTop = toY + 'px';\n return;\n }\n\n function next() {\n\n var progress = (Date.now() - start) / 200;\n if (progress > 1) {\n progress = 1;\n }\n\n legend.style.marginLeft = (toX - startX) * progress + startX + 'px';\n legend.style.marginTop = (toY - startY) * progress + startY + 'px';\n\n if (progress < 1) {\n window.requestAnimationFrame(next);\n }\n }\n\n window.requestAnimationFrame(next);\n };\n\n var _trackingLegendMove = util.debounce(forceTrackingLegendMode, 50);\n\n function _makeTrackingLegend(graph) {\n\n var group = document.createElement('div');\n group.setAttribute('class', 'trackingLegend');\n group.style.position = 'absolute';\n group.style.borderRadius = '4px';\n group.style.boxShadow = '1px 1px 3px 0px rgba(100,100,100,0.6)';\n group.style.border = '2px solid #333333';\n group.style.backgroundColor = 'rgba(255, 255, 255, 0.5 )';\n group.style.pointerEvents = 'none';\n group.style.paddingTop = '5px';\n group.style.paddingBottom = '5px';\n group.style.paddingLeft = '10px';\n group.style.paddingRight = '10px';\n\n graph.getWrapper().insertBefore(group, graph.getDom());\n\n return group;\n }\n\n function _handleDblClick(graph, x, y, e) {\n //\tvar _x = x - graph.options.paddingLeft;\n //\tvar _y = y - graph.options.paddingTop;\n var pref = graph.options.dblclick;\n checkMouseActions(graph, e, [x, y, e], 'onDblClick');\n /*\n if ( !pref || !pref.type ) {\n return;\n }\n switch ( pref.type ) {\n case 'plugin':\n var plugin;\n if ( ( plugin = graph.plugins[ pref.plugin ] ) ) {\n plugin.onDblClick( graph, x, y, pref.options, e );\n }\n break;\n }*/\n }\n\n function _handleMouseUp(graph, x, y, e) {\n\n if (graph.bypassHandleMouse) {\n graph.bypassHandleMouse.handleMouseUp(e);\n graph.activePlugin = false;\n return;\n }\n\n graph._pluginExecute(graph.activePlugin, 'onMouseUp', [graph, x, y, e]);\n graph.activePlugin = false;\n }\n\n function _handleClick(graph, x, y, e) {\n\n graph.emit('click', [graph, x, y, e]);\n // Not on a shape\n checkMouseActions(graph, e, [x, y, e], 'onClick');\n\n if (!e.target.jsGraphIsShape && !graph.prevent(false) && graph.options.shapesUnselectOnClick) {\n\n graph.unselectShapes();\n }\n }\n\n function _getAxis(graph, num, options, pos) {\n\n var options = options || {};\n var inst;\n\n var _availableAxes = {\n\n def: {\n x: graph.getConstructor('graph.axis.x'),\n y: graph.getConstructor('graph.axis.y')\n },\n\n time: {\n x: graph.getConstructor('graph.axis.x.time')\n },\n\n bar: {\n x: graph.getConstructor('graph.axis.x.bar')\n }\n };\n\n switch (options.type) {\n\n case 'time':\n var axisInstance = _availableAxes.time;\n break;\n\n case 'bar':\n var axisInstance = _availableAxes.bar;\n break;\n\n case 'broken':\n var axisInstance = _availableAxes.broken;\n break;\n\n default:\n var axisInstance = _availableAxes.def;\n break;\n }\n\n switch (pos) {\n\n case 'top':\n case 'bottom':\n inst = axisInstance.x;\n break;\n\n case 'left':\n case 'right':\n inst = axisInstance.y;\n break;\n }\n\n num = num || 0;\n\n if (typeof num == 'object') {\n options = num;\n num = 0;\n }\n\n if (!graph.axis[pos][num]) {\n\n graph.axis[pos][num] = new inst(graph, pos, options);\n graph.axis[pos][num].init(graph, options);\n }\n\n return graph.axis[pos][num];\n }\n\n function _closeLine(graph, mode, x1, x2, y1, y2) {\n\n if (graph.options.close === false) {\n return;\n }\n\n var l = 0;\n\n graph.axis[mode].map(function (g) {\n\n if (g.isDisplayed() && !g.floating) {\n l++;\n }\n });\n\n if ((graph.options.close === true || graph.options.close[mode]) && l == 0) {\n\n graph.closingLines[mode].setAttribute('display', 'block');\n graph.closingLines[mode].setAttribute('x1', x1);\n graph.closingLines[mode].setAttribute('x2', x2);\n graph.closingLines[mode].setAttribute('y1', y1);\n graph.closingLines[mode].setAttribute('y2', y2);\n } else {\n\n graph.closingLines[mode].setAttribute('display', 'none');\n }\n }\n\n function _handleMouseWheel(graph, delta, coordX, coordY, e) {\n if (checkMouseActions(graph, e, [delta, e, coordX, coordY], 'onMouseWheel')) {\n e.preventDefault();\n e.stopPropagation();\n }\n }\n\n function _handleMouseLeave(graph) {\n if (graph.options.handleMouseLeave) {\n graph.options.handleMouseLeave.call(graph);\n }\n }\n\n function haveAxesChanged(graph) {\n var temp = graph._axesHaveChanged;\n graph._axesHaveChanged = false;\n return temp;\n }\n\n function hasSizeChanged(graph) {\n var temp = graph._sizeChanged;\n graph._sizeChanged = false;\n return temp;\n }\n\n // Constants\n Graph.SERIE_LINE = Symbol();\n Graph.SERIE_SCATTER = Symbol();\n Graph.SERIE_CONTOUR = Symbol();\n Graph.SERIE_BAR = Symbol();\n Graph.SERIE_BOX = Symbol();\n Graph.SERIE_ZONE = Symbol();\n Graph.SERIE_LINE_COLORED = Symbol();\n Graph.SERIE_ZONE = Symbol();\n Graph.SERIE_DENSITYMAP = Symbol();\n Graph.SERIE_LINE_3D = Symbol();\n Graph.SERIE_ZONE_3D = Symbol();\n\n Graph.TICKS_OUTSIDE = Symbol();\n Graph.TICKS_INSIDE = Symbol();\n Graph.TICKS_CENTERED = Symbol();\n\n Graph.ns = 'http://www.w3.org/2000/svg';\n Graph.nsxlink = 'http://www.w3.org/1999/xlink';\n\n exports.default = Graph;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(13), __webpack_require__(20)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./fit_lm.js'), require('./data_aggregator.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.fit_lm, global.data_aggregator);\n global.waveform = mod.exports;\n }\n})(this, function (module, exports, _fit_lm, _data_aggregator) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _fit_lm2 = _interopRequireDefault(_fit_lm);\n\n var _data_aggregator2 = _interopRequireDefault(_data_aggregator);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n class Waveform {\n\n constructor(data = [], xOffset = 0, xScale = 1) {\n\n this.xOffset = xOffset;\n this.xScale = xScale;\n\n // Error bar handling\n this.errors = {\n\n nb: 0,\n\n bars: {\n above: null,\n below: null\n },\n\n boxes: {\n above: null,\n below: null\n }\n };\n\n this.setData(data);\n\n this.BELOW = Waveform.BELOW;\n this.ABOVE = Waveform.ABOVE;\n this.BOX = Waveform.BOX;\n this.BAR = Waveform.BAR;\n }\n\n /** [ [ x1, y1 ], [ x2, y2 ] ] */\n\n /*\n setDataXY( data ) {\n let newData = [ this._makeArray( data.length ), this._makeArray( data.length ) ],\n warnNaN = false;\n const nanable = this.isNaNAllowed();\n data.map( ( el, index ) => {\n if ( !nanable && ( el[ 0 ] !== el[ 0 ] || el[ 1 ] !== el[ 1 ] ) ) {\n warnNaN = true;\n }\n newData[ 0 ][ index ] = el[ 0 ];\n newData[ 1 ][ index ] = el[ 1 ];\n } );\n if ( warnNaN ) {\n this.warn( \"Trying to assign NaN values to a typed array that does not support NaNs. 0's will be used instead\" );\n }\n this._setData( ...newData );\n return this;\n }\n */\n setData(data, dataX = null) {\n\n /* First, we must treat the case of the array of array for backward compatibility */\n if (Array.isArray(data[0])) {\n let x = [];\n let y = [];\n data.forEach(el => {\n x.push(el[0]);\n y.push(el[1]);\n });\n\n this.setXWaveform(x);\n data = y;\n }\n\n let newData = this._makeArray(data.length),\n warnNaN = false;\n\n const nanable = this.isNaNAllowed();\n\n data.map((el, index) => {\n\n if (!nanable && Number.isNaN(el[0]) || Number.isNaN(el[1])) {\n warnNaN = true;\n }\n\n newData[index] = el;\n });\n\n if (warnNaN) {\n this.warn(\"Trying to assign NaN values to a typed array that does not support NaNs. 0's will be used instead\");\n }\n\n this._setData(newData);\n\n if (dataX) {\n this.setXWaveform(dataX);\n }\n return this;\n }\n\n getY(index, optimized = false) {\n\n if (optimized && this.dataInUse) {\n return this.dataInUse.y[index] * this.getScale() + this.getShift();\n }\n\n return this.data[index] * this.getScale() + this.getShift();\n }\n\n /*\n flipXY() {\n let temp;\n temp = this.data.x;\n this.data.x = this.data.y;\n this.data.y = temp;\n this._setData( this.data.x, this.data.y );\n }*/\n\n setXWaveform(waveform) {\n\n if (!(waveform instanceof Waveform)) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n } else {\n throw 'Cannot set X waveform. Data is not a valid array.';\n }\n }\n\n this.xdata = waveform;\n this.computeXMinMax();\n return this;\n }\n\n hasXWaveform() {\n return !!this.xdata;\n }\n\n getXWaveform() {\n\n if (this.xdata) {\n return this.xdata;\n }\n\n let wave = new Waveform(),\n xs = [];\n for (var i = 0; i < this.getLength(); i += 1) {\n xs.push(this.getX(i));\n }\n\n wave.setData(xs);\n\n this.xdata = wave;\n return wave;\n }\n\n rescaleX(offset, scale) {\n this.xScale = scale;\n this.xOffset = offset;\n this.computeXMinMax();\n return this;\n }\n\n getTypedArrayClass() {\n return this._typedArrayClass || false;\n }\n\n setTypedArrayClass(constructor) {\n\n if (this.getTypedArrayClass() && this.isNaNAllowed() && !this.isNaNAllowed(constructor)) {\n this.warn('NaN values are not allowed by the new constructor (' + constructor.name + ') while it was allowed by the previous one (' + this._typedArrayClass.name + ')');\n }\n\n if (this.getTypedArrayClass() && this.isUnsigned() && !this.isUnsigned(constructor)) {\n this.warn('You are switching from signed values to unsigned values. You may experience data corruption if there were some negative values.');\n }\n\n this._typedArrayClass = constructor;\n\n if (this.data) {\n this._setData(constructor.from(this.data));\n }\n\n if (this.hasXWaveform()) {\n this.getXWaveform().setTypedArrayClass(constructor);\n }\n }\n\n isNaNAllowed(constructor = this._typedArrayClass) {\n\n // The following types accept NaNs\n return constructor == Array || constructor == Float32Array || constructor == Float64Array;\n }\n\n isUnsigned(constructor = this._typedArrayClass) {\n\n // The following types accept unsigned numbers\n return constructor == Uint8Array || constructor == Uint8ClampedArray || constructor == Uint16Array || constructor == Uint32Array;\n }\n\n recalculateMinMaxNewPoint(x, y) {\n if (x < this.minX || this.minX === undefined) {\n this.minX = x;\n }\n\n if (x > this.maxX || this.maxX === undefined) {\n this.maxX = x;\n }\n\n if (y < this.minY || this.minY === undefined) {\n this.minY = y;\n }\n\n if (y > this.maxY || this.maxY === undefined) {\n this.maxY = y;\n }\n }\n\n prepend(x, y) {\n\n if (typeof x == 'function') {\n x = x(this);\n }\n\n if (typeof y == 'function') {\n y = y(this);\n }\n\n if (this.xdata) {\n this.xdata.prepend(null, x);\n } else if (x !== null) {\n this.xdata = this.getXWaveform();\n this.xdata.prepend(null, x);\n } else {\n this.xOffset -= this.xScale;\n }\n\n this.data.unshift(y);\n this.recalculateMinMaxNewPoint(x, y);\n return this;\n }\n\n append(x, y) {\n\n if (!this.data) {\n this.data = [];\n }\n\n if (typeof x == 'function') {\n x = x(this);\n }\n\n if (typeof y == 'function') {\n y = y(this);\n }\n\n if (this.xdata) {\n this.xdata.append(null, x);\n } else if (x !== null) {\n this.xdata = this.getXWaveform();\n this.xdata.append(null, x);\n }\n\n if (this.monotoneous) {\n if (y >= this.data[this.data.y] && this.getMonotoneousAscending() === false) {\n this.monotoneous = false;\n } else if (y <= this.data[this.data.y] && this.getMonotoneousAscending() === true) {\n this.monotoneous = false;\n }\n }\n\n if (this.data.length == 1 || this._monotoneousAscending === undefined) {\n\n this.monotoneous = true;\n\n if (y == this.data[0]) {\n this._monotoneousAscending = undefined;\n } else {\n this._monotoneousAscending = y > this.data[0];\n }\n }\n\n this.data.push(y);\n this.recalculateMinMaxNewPoint(x, y);\n\n return this;\n }\n\n _makeArray(length) {\n\n const constructor = this.getTypedArrayClass();\n if (constructor) {\n return new constructor(length);\n }\n return new Array(length);\n }\n\n _setData(dataY = this.data) {\n\n const l = dataY.length;\n let i = 1,\n monoDir = dataY[1] > dataY[0],\n minY = dataY[0],\n maxY = dataY[0];\n\n this._monotoneous = true;\n\n for (; i < l; i++) {\n if (dataY[i] !== dataY[i - 1] && monoDir !== dataY[i] > dataY[i - 1]) {\n this._monotoneous = false;\n }\n\n if (dataY[i] === dataY[i]) {\n // NaN support\n minY = Math.min(dataY[i], minY);\n maxY = Math.max(dataY[i], maxY);\n }\n }\n\n if (this._monotoneous) {\n this._monotoneousAscending = dataY[1] > dataY[0];\n }\n\n if (this.hasErrorBars()) {\n // If prefer to loop again here\n\n for (i = 0; i < l; i++) {\n\n if (dataY[i] === dataY[i]) {\n // NaN support\n\n minY = Math.min(minY, dataY[i] - this.getMaxError(i, 'below'));\n maxY = Math.max(maxY, dataY[i] + this.getMaxError(i, 'above'));\n }\n }\n\n this.minY = minY;\n this.maxY = maxY;\n } else {\n this.minY = minY;\n this.maxY = maxY;\n }\n\n this.data = dataY;\n\n this.computeXMinMax();\n }\n\n computeXMinMax() {\n\n if (!this.data) {\n\n return;\n }\n\n if (!this.xdata) {\n\n const b1 = this.xOffset + this.xScale * this.getLength(),\n b2 = this.xOffset;\n\n this.minX = Math.min(b1, b2);\n this.maxX = Math.max(b1, b2);\n }\n }\n\n getDataInUse() {\n return this.dataInUse || this.data;\n }\n\n getIndexFromVal(val, useDataToUse = false, roundingMethod = Math.round) {\n\n let data;\n\n if (useDataToUse && this.dataInUse) {\n data = this.dataInUse.y;\n } else {\n data = this.data;\n }\n\n let position;\n\n position = this.getIndexFromData(val, data, this.data.getMonotoneousAscending(), roundingMethod);\n\n if (useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateY') {\n // In case of aggregation, round to the closest element of 4.\n return position - position % 4;\n }\n\n return position;\n }\n\n getIndexFromX(xval, useDataToUse = false, roundingMethod = Math.round) {\n\n let xdata;\n\n if (useDataToUse && this.dataInUse) {\n xdata = this.dataInUse.x;\n } else if (this.xdata) {\n xdata = this.xdata.data;\n }\n\n let position;\n\n if (this.hasXWaveform()) {\n // The x value HAS to be rescaled\n position = this.xdata.getIndexFromData(xval, xdata, this.xdata.getMonotoneousAscending(), roundingMethod);\n } else {\n position = Math.max(0, Math.min(this.getLength() - 1, roundingMethod((xval - this.xOffset) / this.xScale)));\n }\n\n if (useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateX') {\n // In case of aggregation, round to the closest element of 4.\n return position - position % 4;\n }\n\n return position;\n }\n\n getIndexFromXY(xval, yval, useDataToUse = false, roundingMethod = Math.round, scaleX, scaleY) {\n\n let xdata, ydata;\n\n if (useDataToUse && this.dataInUse) {\n\n xdata = this.dataInUse.x;\n ydata = this.dataInUse.y;\n } else if (this.xdata) {\n\n xdata = this.xdata.data;\n ydata = this.data;\n }\n\n let position;\n\n if (this.isXMonotoneous()) {\n // X lookup only\n\n if (this.hasXWaveform()) {\n // The x value HAS to be rescaled\n position = this.xdata.getIndexFromData(xval, xdata, this.xdata.getMonotoneousAscending(), roundingMethod);\n } else {\n position = Math.max(0, Math.min(this.getLength() - 1, roundingMethod((xval - this.xOffset) / this.xScale)));\n }\n } else if (!isNaN(yval)) {\n\n position = this.getIndexFromDataXY(xval, xdata, yval, ydata, scaleX, scaleY);\n } else {\n return;\n }\n\n if (useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateX') {\n // In case of aggregation, round to the closest element of 4.\n return position - position % 4;\n }\n\n return position;\n }\n\n getIndexFromData(val, valCollection, isAscending) {\n\n let data, position;\n\n val -= this.getShift();\n val /= this.getScale();\n\n if (!this.isMonotoneous()) {\n console.trace();\n throw 'Impossible to get the index from a non-monotoneous wave !';\n }\n\n return binarySearch(val, valCollection, !isAscending);\n }\n\n getIndexFromDataXY(valX, dataX, valY, dataY, scaleX = 1, scaleY = 1) {\n\n let data, position;\n\n valX -= this.getXShift();\n valX /= this.getXScale();\n\n valY -= this.getShift();\n valY /= this.getScale();\n\n return euclidianSearch(valX, valY, dataX, dataY, scaleX, scaleY);\n }\n\n getReductionType() {\n return this.dataInUseType;\n }\n\n getXMin() {\n return this.xdata ? this.xdata.getMin() : this.minX;\n }\n\n getXMax() {\n return this.xdata ? this.xdata.getMax() : this.maxX;\n }\n\n getYMin() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getYMax() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getMin() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getMax() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getMinX() {\n return this.getXMin();\n }\n\n getMaxX() {\n return this.getXMax();\n }\n\n getMinY() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getMaxY() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getDataY() {\n return this.data;\n }\n\n getData(optimized) {\n if (!optimized || !this.dataInUse) {\n return this.data;\n }\n return this.dataInUse.y;\n }\n\n setShift(shift = 0) {\n\n // We must update the min and the max of the y data\n //this.minY += ( shift - this.getShift() );\n //this.maxY += ( shift - this.getShift() );\n this.shift = shift;\n return this;\n }\n\n getShift() {\n return this.shift || 0;\n }\n\n getScale() {\n return this.scale || 1;\n }\n\n setScale(scale = 1) {\n\n // this.minY = ( this.minY - this.getShift() ) * scale;\n // this.maxY = ( this.maxY - this.getShift() ) * scale;\n this.scale = scale;\n }\n\n setXShift(shift = 0) {\n\n if (!this.hasXWaveform()) {\n return this;\n }\n\n // We must update the min and the max of the x data\n // That's important for when the data has already been set\n // this.minX += ( shift - this.getXShift() );\n // this.maxX += ( shift - this.getXShift() );\n this.getXWaveform().setShift(shift);\n return this;\n }\n\n getXShift(shift) {\n\n if (!this.hasXWaveform) {\n return 0;\n }\n\n return this.getXWaveform().getShift();\n }\n\n setXScale(scale = 1) {\n\n if (!this.hasXWaveform) {\n return this;\n }\n\n this.getXWaveform().setScale(scale);\n return this;\n }\n\n getXScale() {\n\n if (!this.hasXWaveform) {\n return 1;\n }\n\n return this.getXWaveform().getScale();\n }\n\n getLength() {\n if (!this.data) {\n return 0;\n }\n return this.data.length;\n }\n\n getDataToUseFlat() {\n\n let l;\n let j = 0;\n let arr;\n\n if (this.dataInUse) {\n\n l = this.dataInUse.x.length;\n arr = new Array(l * 2).fill(0);\n\n for (var i = 0; i < l; i += 1) {\n arr[j] = this.dataInUse.x[i];\n arr[j + 1] = this.dataInUse.y[i];\n j += 2;\n }\n } else {\n\n l = this.getLength();\n arr = new Array(l * 2).fill(0);\n for (var i = 0; i < l; i += 1) {\n arr[j + 1] = this.data[i];\n arr[j] = this.getX(i);\n j += 2;\n }\n }\n\n return arr;\n }\n\n fit(options) {\n\n var self = this;\n\n return new Promise(function (resolver, rejector) {\n\n var fit = new _fit_lm2.default(Object.assign({}, {\n\n dataY: self,\n dataX: self.getXWaveform(),\n done: function (results) {\n resolver(results);\n },\n waveform: new Waveform()\n\n }, options));\n\n fit.init();\n fit.fit();\n });\n }\n\n getX(index, optimized) {\n\n if (optimized && this.dataInUse) {\n return this.dataInUse.x[index] * this.getXScale() + this.getXShift();\n }\n\n if (this.xdata) {\n return this.xdata.data[index] * this.getXScale() + this.getXShift();\n } else {\n return this.xOffset + index * this.xScale;\n }\n }\n\n getXRaw(index, optimized) {\n\n if (optimized && this.dataInUse) {\n return this.dataInUse.x[index];\n }\n\n if (this.xdata) {\n return this.xdata.data[index];\n } else {\n return index;\n }\n }\n\n _integrateP(from = 0, to = this.getLength() - 1) {\n\n from = Math.round(from);\n to = Math.round(to);\n\n if (from > to) {\n let temp = from;\n from = to;\n to = temp;\n }\n\n var l = to - from + 1;\n var sum = 0,\n delta;\n\n let deltaTot = 0;\n let diff;\n var arrY = this.getData();\n\n for (; from <= to; from++) {\n\n if (arrY.length - 1 > from) {\n diff = this.getX(from + 1) - this.getX(from);\n deltaTot += diff;\n sum += arrY[from] * diff;\n }\n }\n\n return [sum, l, deltaTot];\n }\n\n integrateP(from, to) {\n var val = this._integrateP(from, to);\n return val[0];\n }\n\n integrate(fromX, toX) {\n return this.integrateP(this.getIndexFromX(fromX), this.getIndexFromX(toX));\n }\n\n average(p0 = 0, p1 = this.getLength() - 1) {\n return this.getAverageP(p0, p1);\n }\n\n mean() {\n return this.average();\n }\n\n getAverageP(from, to) {\n var sum = this._integrateP(from, to);\n return sum[0] / sum[2];\n }\n\n getAverageX(from, to) {\n var sum = this._integrateX(from, to);\n return sum[0] / sum[2];\n }\n\n checkMonotonicity() {\n\n let i = 1,\n data = this.getData();\n const l = this.data.length;\n let dir = data[1] > data[0];\n\n for (; i < l; i++) {\n if (data[i] !== data[i - 1] && dir !== data[i] > data[i - 1]) {\n return this._monotoneous = false;\n }\n }\n\n this._monotoneousAscending = data[1] > data[0];\n return this._monotoneous = true;\n }\n\n requireXMonotonicity() {\n if (this.xdata) {\n this.xdata.requireMonotonicity();\n }\n }\n\n requireMonotonicity() {\n if (!this.isMonotoneous()) {\n throw 'The wave must be monotonic';\n }\n }\n\n isMonotoneous() {\n return !!this._monotoneous;\n }\n\n isXMonotoneous() {\n if (this.xdata) {\n return this.xdata.isMonotoneous();\n }\n // Offset and scale is always monotoneous\n return true;\n }\n\n invert(data) {\n\n let d = data || this.data;\n d.reverse();\n\n if (this.isMonotoneous()) {\n this._monotoneousAscending = !this._monotoneousAscending;\n }\n\n return d;\n }\n\n resampleForDisplay(options) {\n // Serie redrawing\n\n let i = 0;\n\n this.requireXMonotonicity();\n\n let inverting = false,\n dataY = this.getDataY(),\n data = {\n x: [],\n y: []\n },\n dataMinMax = [],\n resampleSum,\n resampleMin,\n resampleMax,\n resampleNum,\n resample_x_start,\n resample_x_px_start,\n x_px,\n doing_mean = false,\n firstPointIndex = 0,\n xval;\n\n const l = this.getLength();\n\n if (!options.xPosition) {\n throw 'No position calculation method provided';\n }\n\n if (!options.resampleToPx) {\n throw 'No \"resampleToPx\" method was provided. Unit: px per point';\n }\n\n if (options.minX > options.maxX) {\n let temp = options.minX;\n options.minX = options.maxX;\n options.maxX = temp;\n }\n\n if (this.xdata && !this.xdata.getMonotoneousAscending() || !this.xdata && this.xScale < -0) {\n inverting = true;\n i = l;\n }\n\n for (; inverting ? i > 0 : i < l; inverting ? i-- : i++) {\n\n xval = this.getX(i);\n\n if (options.minX > xval) {\n\n firstPointIndex = i;\n continue;\n }\n\n x_px = options.xPosition(xval);\n\n if (!doing_mean) {\n\n if (!firstPointIndex) {\n\n firstPointIndex = i;\n } else {\n\n data.x.push(xval);\n data.y.push(dataY[firstPointIndex]);\n }\n\n while (isNaN(dataY[i])) {\n\n if (inverting) {\n i--;\n } else {\n i++;\n }\n }\n\n resampleSum = resampleMin = resampleMax = dataY[firstPointIndex];\n resampleNum = 1;\n resample_x_px_start = x_px;\n resample_x_start = xval;\n firstPointIndex = 0;\n\n doing_mean = true;\n\n continue;\n }\n\n if (Math.abs(x_px - resample_x_px_start) > options.resampleToPx || i == l || i == 0 || isNaN(dataY[i])) {\n\n let xpos = (resample_x_start + xval) / 2;\n\n data.x.push(xpos);\n data.y.push(resampleSum / resampleNum);\n\n dataMinMax.push(xpos, resampleMin, resampleMax);\n\n if (options.maxX !== undefined && xval > options.maxX) {\n\n break;\n }\n\n doing_mean = false;\n\n continue;\n }\n\n resampleSum += dataY[i];\n resampleNum++;\n\n resampleMin = Math.min(resampleMin, dataY[i]);\n resampleMax = Math.max(resampleMax, dataY[i]);\n }\n\n this.dataInUseType = 'resampled';\n this.dataInUse = data;\n return dataMinMax;\n }\n\n interpolate(x) {\n\n let xIndex;\n let yData = this.getDataY();\n\n x = (x - this.getXShift()) / this.getXScale();\n\n if (this.xdata) {\n let xData = this.xdata.getData(),\n xIndex = binarySearch(x, xData, !this.xdata.getMonotoneousAscending());\n\n if (xData[xIndex] == x) {\n return yData[xIndex];\n }\n return (x - xData[xIndex]) / (xData[xIndex + 1] - xData[xIndex]) * (yData[xIndex + 1] - yData[xIndex]) + yData[xIndex];\n } else {\n xIndex = (x - this.xOffset) / this.xScale;\n let xIndexF = Math.floor(xIndex);\n return (xIndex - xIndexF) * (yData[xIndexF + 1] - yData[xIndexF]) + yData[xIndexF];\n }\n }\n\n getMonotoneousAscending() {\n\n if (!this.isMonotoneous()) {\n return 'The waveform is not monotoneous';\n }\n\n return this._monotoneousAscending;\n }\n\n getXMonotoneousAscending() {\n if (this.xdata) {\n return this.xdata.getMonotoneousAscending();\n }\n\n return this.xScale > 0;\n }\n\n isXMonotoneousAscending() {\n return this.getXMonotoneousAscending(...arguments);\n }\n\n divide(numberOrWave) {\n return this._arithmetic(numberOrWave, DIVIDE);\n }\n\n divideBy() {\n return this.divide(...arguments);\n }\n\n multiply(numberOrWave) {\n return this._arithmetic(numberOrWave, MULTIPLY);\n }\n\n multiplyBy() {\n return this.multiply(...arguments);\n }\n\n log() {\n return this.logBase(10);\n }\n\n ln() {\n return this.logBase(Math.E);\n }\n\n logBase(base) {\n\n let logBase = Math.log(base);\n this.data.map(valY => {\n\n return Math.log(valY) / logBase;\n });\n }\n\n add(numberOrWave) {\n return this._arithmetic(numberOrWave, ADD);\n }\n\n addBy() {\n return this.add(...arguments);\n }\n\n subtract(numberOrWave) {\n return this._arithmetic(numberOrWave, SUBTRACT);\n }\n\n subtractBy() {\n return this.subtract(...arguments);\n }\n\n math(method) {\n\n for (var i = 0; i < this.getLength(); i++) {\n this.data[i] = method(this.getY(i), this.getX(i));\n }\n\n this._setData(this.data);\n return this;\n }\n\n _arithmetic(numberOrWave, operator) {\n\n if (numberOrWave instanceof Waveform) {\n return this._waveArithmetic(numberOrWave, operator);\n } else if (typeof numberOrWave == 'number') {\n\n return this._numberArithmetic(numberOrWave, operator);\n }\n }\n\n _numberArithmetic(num, operation) {\n\n let i = 0,\n l = this.getLength();\n\n if (operation == MULTIPLY) {\n\n for (; i < l; i++) {\n this.data[i] *= num;\n }\n\n this.minY *= num;\n this.maxY *= num;\n } else if (operation == DIVIDE) {\n\n for (; i < l; i++) {\n this.data[i] /= num;\n }\n\n this.minY /= num;\n this.maxY /= num;\n } else if (operation == ADD) {\n\n for (; i < l; i++) {\n this.data[i] += num;\n }\n\n this.minY += num;\n this.maxY += num;\n } else if (operation == SUBTRACT) {\n\n for (; i < l; i++) {\n this.data[i] -= num;\n }\n\n this.minY -= num;\n this.maxY -= num;\n }\n\n return this;\n }\n\n _waveArithmetic(wave, operation) {\n\n let yDataThis = this.getDataY(),\n i = 0;\n const l = this.getLength();\n this.requireXMonotonicity();\n wave.requireXMonotonicity();\n\n if (operation == MULTIPLY) {\n\n for (; i < l; i++) {\n yDataThis[i] *= wave.interpolate(this.getX(i));\n }\n } else if (operation == DIVIDE) {\n\n for (; i < l; i++) {\n yDataThis[i] /= wave.interpolate(this.getX(i));\n }\n } else if (operation == ADD) {\n\n for (; i < l; i++) {\n yDataThis[i] += wave.interpolate(this.getX(i));\n }\n } else if (operation == SUBTRACT) {\n\n for (; i < l; i++) {\n yDataThis[i] -= wave.interpolate(this.getX(i));\n }\n }\n\n this._setData(yDataThis);\n return this;\n }\n\n aggregate(direction = 'x') {\n\n this._dataAggregating = {};\n this._dataAggregated = {};\n this._dataAggregationDirection = direction.toUpperCase();\n\n var pow2 = pow2floor(this.getLength());\n\n this._dataAggregating = (0, _data_aggregator2.default)({\n\n minX: this.getMinX(),\n maxX: this.getMaxX(),\n minY: this.getMinY(),\n maxY: this.getMaxY(),\n data: this.data,\n xdata: this.xdata ? this.xdata.getData() : undefined,\n xScale: this.xScale,\n xOffset: this.xOffset,\n numPoints: pow2,\n direction: direction\n\n }).then(event => {\n\n this._dataAggregated = event.aggregates;\n console.log(this._dataAggregated);\n this._dataAggregating = false;\n });\n }\n\n hasAggregation() {\n return !!this._dataAggregated;\n }\n\n selectAggregatedData(pxWidth) {\n\n if (pxWidth < 2) {\n return false;\n }\n /*\n console.log( direction, this._dataAggregationDirection );\n if( direction !== this._dataAggregationDirection ) {\n throw \"The data is not aggregated in that direction\";\n }\n */\n\n if (pxWidth > 2147483647) {\n pxWidth = 2147483647;\n }\n var level = pow2ceil(pxWidth);\n\n if (this._dataAggregated[level]) {\n\n this.dataInUseType = 'aggregate' + this._dataAggregationDirection;\n this.dataInUse = this._dataAggregated[level];\n return;\n } else if (this._dataAggregating) {\n\n return this._dataAggregating;\n }\n\n this.dataInUseType = 'none';\n this.dataInUse = {\n y: this.data,\n x: this.getXWaveform().data\n };\n }\n\n duplicate(alsoDuplicateXWave) {\n var newWaveform = new Waveform();\n newWaveform._setData(this.getDataY().slice());\n newWaveform.rescaleX(this.xOffset, this.xShift);\n newWaveform.setShift(this.getShift());\n newWaveform.setScale(this.getScale());\n\n if (this.xdata) {\n if (alsoDuplicateXWave) {\n newWaveform.setXWaveform(this.xdata.duplicate());\n } else {\n newWaveform.setXWaveform(this.xdata);\n }\n\n newWaveform.setXShift(this.getXShift());\n newWaveform.setXScale(this.getXScale());\n } else {\n newWaveform.xOffset = this.xOffset;\n newWaveform.xScale = this.xScale;\n }\n\n return newWaveform;\n }\n\n subrangeX(fromX, toX) {\n\n if (!this.xdata) {\n // We can select the new range from there\n\n let fromP = this.getIndexFromX(fromX),\n toP = this.getIndexFromX(toP);\n\n return new Waveform().setData(this.data.slice(fromP, toP)).rescaleX(this.xOffset, this.xScale);\n } else {\n\n var waveform = new Waveform();\n\n for (var i = 0, l = this.data.length; i < l; i++) {\n\n if (this.data[i] >= fromX && this.data[i] < toX) {\n\n waveform.append(this.dataX[i], this.data[i]);\n }\n }\n\n return waveform;\n }\n }\n\n findLocalMinMax(xRef, xWithin, type) {\n\n let index = this.getIndexFromX(xRef),\n indexPlus = this.getIndexFromX(xRef + xWithin),\n indexMinus = this.getIndexFromX(xRef - xWithin);\n\n return this.findLocalMinMaxIndex(indexMinus, indexPlus, type);\n }\n\n findLocalMinMaxIndex(indexMinus, indexPlus, type) {\n\n let tmp;\n\n if (indexPlus < indexMinus) {\n tmp = indexPlus;\n indexPlus = indexMinus;\n indexMinus = tmp;\n }\n\n let curr, currI;\n\n if (type == 'max') {\n\n curr = Number.NEGATIVE_INFINITY;\n\n for (var i = indexMinus; i <= indexPlus; i++) {\n\n if (this.getY(i) > curr) {\n curr = this.getY(i);\n currI = i;\n }\n }\n } else {\n\n curr = Number.POSITIVE_INFINITY;\n\n for (var i = indexMinus; i <= indexPlus; i++) {\n\n if (this.getY(i) < curr) {\n curr = this.getY(i);\n currI = i;\n }\n }\n }\n\n if (currI == indexMinus || currI == indexPlus) {\n return false;\n }\n\n return this.getX(currI);\n }\n\n warn(text) {\n if (console) {\n console.warn(text);\n }\n }\n\n setUnit(unit) {\n this.unit = unit;\n return this;\n }\n\n setXUnit(unit) {\n if (this.hasXWaveform()) {\n this.xdata.setUnit(unit);\n }\n\n this.xunit = unit;\n return this;\n }\n\n getUnit() {\n return this.unit || '';\n }\n\n getXUnit() {\n if (this.hasXWaveform()) {\n return this.xdata.getUnit();\n }\n\n return this.xunit | '';\n }\n\n hasXUnit() {\n return this.getXUnit().length > 0;\n }\n\n hasUnit() {\n return this.getUnit().length > 0;\n }\n\n findLevels(level, options) {\n\n options = Object.assign({\n\n box: 1,\n edge: 'both',\n rounding: 'before',\n rangeP: [0, this.getLength()]\n\n }, options);\n\n var lastLvlIndex = options.rangeP[0];\n var lvlIndex;\n var indices = [];\n var i = 0;\n\n while (lvlIndex = this.findLevel(level, Object.assign({}, options, {\n rangeP: [lastLvlIndex, options.rangeP[1]]\n }))) {\n indices.push(lvlIndex);\n lastLvlIndex = Math.ceil(lvlIndex);\n\n i++;\n if (i > 1000) {\n return;\n }\n }\n\n return indices;\n }\n\n // Find the first level in the specified range\n findLevel(level, options) {\n\n options = Object.assign({\n\n box: 1,\n edge: 'both',\n direction: 'ascending',\n rounding: 'before',\n rangeP: [0, this.getLength()]\n\n }, options);\n\n if (options.rangeX) {\n options.rangeP = options.rangeX.map(this.getIndexFromX);\n }\n\n var value, below, i, j, l, increment;\n\n var box = options.box;\n\n if (box % 2 == 0) {\n box++;\n }\n\n if (options.direction == 'descending') {\n i = options.rangeP[1], l = options.rangeP[0], increment = -1;\n } else {\n i = options.rangeP[0], l = options.rangeP[1], increment = +1;\n }\n\n for (;; i += increment) {\n\n if (options.direction == 'descending') {\n if (i < l) {\n break;\n }\n } else {\n if (i > l) {\n break;\n }\n }\n\n if (i < options.rangeP[0] + (box - 1) / 2) {\n continue;\n }\n\n if (i > options.rangeP[1] - (box - 1) / 2) {\n break;\n }\n\n value = this.getAverageP(i - (box - 1) / 2, i + (box - 1) / 2);\n\n if (below === undefined) {\n below = value < level;\n continue;\n }\n // Crossing up\n if (value >= level && below) {\n\n below = false;\n\n if (options.edge == 'ascending' || options.edge == 'both') {\n // Found something\n\n for (j = i + (box - 1) / 2; j >= i - (box - 1) / 2; j--) {\n\n if (this.data[j] >= level && this.data[j - 1] < level) {\n // Find a crossing\n\n switch (options.rounding) {\n case 'before':\n return j - 1;\n break;\n\n case 'after':\n return j;\n break;\n\n case 'interpolate':\n return getIndexInterpolate(level, this.data[j], this.data[j - 1], j, j - 1);\n break;\n }\n }\n }\n }\n } else if (value <= level && !below) {\n\n below = true;\n\n if (options.edge == 'descending' || options.edge == 'both') {\n\n for (j = i + (box - 1) / 2; j >= i - (box - 1) / 2; j--) {\n\n if (this.data[j] <= level && this.data[j - 1] > level) {\n // Find a crossing\n\n switch (options.rounding) {\n case 'before':\n return j - 1;\n break;\n\n case 'after':\n return j;\n break;\n\n case 'interpolate':\n return getIndexInterpolate(level, this.data[j], this.data[j - 1], j, j - 1);\n break;\n }\n }\n }\n }\n }\n }\n }\n\n normalize(mode) {\n\n let factor, total, minValue, maxValue, ratio, i;\n\n if (mode == 'max1' || mode == 'max100') {\n\n factor = 1;\n\n if (mode == 'max100') {\n factor = 100;\n }\n\n maxValue = this.data[0];\n\n for (i = 1; i < this.getLength(); i++) {\n\n if (this.data[i] > maxValue) {\n\n maxValue = this.data[i];\n }\n }\n\n for (i = 0; i < this.getLength(); i++) {\n\n this.data[i] /= maxValue / factor;\n }\n } else if (mode == 'sum1') {\n\n total = 0;\n\n for (i = 0; i < this.getLength(); i++) {\n total += this.data[i];\n }\n\n for (i = 0; i < this.getLength(); i++) {\n\n this.data[i] /= total;\n }\n } else if (mode == 'max1min0') {\n\n maxValue = this.data[0], minValue = this.data[0];\n\n for (i = 1; i < this.getLength(); i++) {\n if (this.data[i] > maxValue) {\n\n maxValue = this.data[i];\n } else if (this.data[i] < minValue) {\n\n minValue = this.data[i];\n }\n }\n\n ratio = 1 / (maxValue - minValue);\n\n for (i = 0; i < this.getLength(); i++) {\n\n this.data[i] = (this.data[i] - minValue) * ratio;\n }\n }\n\n this.setData(this.data);\n }\n\n ////////////////////////////////////////////////////////////\n ///// HANDLING ERRORS ////////////////////////////////////\n ////////////////////////////////////////////////////////////\n\n setErrorBarX(waveform) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n var xWave = this.getXWaveform();\n xWave.setErrorBar(waveform);\n return this;\n }\n\n setErrorBarXBelow(waveform) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n var xWave = this.getXWaveform();\n xWave.setErrorBarBelow(waveform);\n return this;\n }\n\n setErrorBarXAbove(waveform) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n var xWave = this.getXWaveform();\n xWave.setErrorBarAbove(waveform);\n return this;\n }\n\n setErrorBoxX(waveform) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n var xWave = this.getXWaveform();\n xWave.setErrorBoxAbove(waveform);\n xWave.setErrorBoxBelow(waveform);\n return this;\n }\n\n setErrorBoxXBelow(waveform) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n var xWave = this.getXWaveform();\n\n xWave.setErrorBoxBelow(waveform);\n return this;\n }\n\n setErrorBoxXAbove(waveform) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n var xWave = this.getXWaveform();\n xWave.setErrorBoxAbove(waveform);\n return this;\n }\n\n setErrorBar(waveform, checkMinMax = true) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n this.errors.nb++;\n this.errors.nb++;\n this.errors.bars.bottom = waveform;\n this.errors.bars.top = waveform;\n\n if (checkMinMax) {\n this._setData();\n }\n }\n\n setErrorBarBelow(waveform, checkMinMax = true) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n this.errors.nb++;\n this.errors.bars.below = waveform;\n\n if (checkMinMax) {\n this._setData();\n }\n }\n\n setErrorBarAbove(waveform, checkMinMax = true) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n this.errors.nb++;\n this.errors.bars.above = waveform;\n\n if (checkMinMax) {\n this._setData();\n }\n }\n\n setErrorBox(waveform, checkMinMax = true) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n this.errors.nb++;\n this.errors.nb++;\n this.errors.boxes.above = waveform;\n this.errors.boxes.below = waveform;\n\n if (checkMinMax) {\n this._setData();\n }\n }\n\n setErrorBoxBelow(waveform, checkMinMax = true) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n this.errors.nb++;\n this.errors.boxes.below = waveform;\n\n if (checkMinMax) {\n this._setData();\n }\n }\n\n setErrorBoxAbove(waveform, checkMinMax = true) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n this.errors.boxes.above = waveform;\n if (checkMinMax) {\n this._setData();\n }\n }\n\n getMaxError(i, side = Waveform.ABOVE) {\n\n return Math.max(this.getMaxErrorType(i, side, Waveform.BOX), this.getMaxErrorType(i, side, Waveform.BAR));\n }\n\n getMaxErrorType(i, side = Waveform.ABOVE, type = Waveform.BOX) {\n\n let stack;\n if (type == Waveform.BOX) {\n stack = this.errors.boxes;\n } else if (type == Waveform.BAR) {\n stack = this.errors.bars;\n } else {\n throw 'Unknown type of error';\n }\n\n let waveform;\n if (!(waveform = stack[side])) {\n if (side == Waveform.ABOVE) {\n if (stack[side] == Waveform.BELOW) {\n waveform = stack.below;\n }\n } else {\n if (stack[side] == Waveform.ABOVE) {\n waveform = stack.above;\n }\n }\n }\n\n if (!waveform) {\n return 0;\n }\n\n return waveform.getY(i);\n }\n\n getErrorBarXBelow(index) {\n return this.getErrorX(index, Waveform.BELOW, Waveform.BAR);\n }\n getErrorBarXAbove(index) {\n return this.getErrorX(index, Waveform.ABOVE, Waveform.BAR);\n }\n getErrorBoxXBelow(index) {\n return this.getErrorX(index, Waveform.BELOW, Waveform.BOX);\n }\n getErrorBoxXAbove(index) {\n return this.getErrorX(index, Waveform.ABOVE, Waveform.BOX);\n }\n\n getErrorBarYBelow(index) {\n return this.getError(index, Waveform.BELOW, Waveform.BAR);\n }\n getErrorBarYAbove(index) {\n return this.getError(index, Waveform.ABOVE, Waveform.BAR);\n }\n getErrorBoxYBelow(index) {\n return this.getError(index, Waveform.BELOW, Waveform.BOX);\n }\n getErrorBoxYAbove(index) {\n return this.getError(index, Waveform.ABOVE, Waveform.BOX);\n }\n\n getErrorX(index, side = Waveform.ABOVE, type = Waveform.BAR) {\n\n if (!this.hasXWaveform()) {\n return false;\n }\n\n return this.xdata.getError(index, side, type);\n }\n\n getError(index, side = Waveform.ABOVE, type = Waveform.BAR) {\n\n let errors = type == Waveform.BAR ? this.errors.bars : this.errors.boxes;\n\n if (!errors) {\n return false;\n }\n\n let wave;\n if (wave = side == Waveform.ABOVE ? errors.above : errors.below) {\n\n if (wave == Waveform.ABOVE && side == Waveform.BELOW) {\n wave = errors.above;\n } else if (wave == Waveform.BELOW && side == Waveform.ABOVE) {\n wave = errors.below;\n }\n\n if (!wave) {\n return false;\n }\n\n return wave.getY(index);\n }\n }\n\n hasErrorBars() {\n\n return this.errors.nb > 0 || this.hasXWaveform() && this.xdata.errors.nb > 0;\n }\n\n }\n // http://stackoverflow.com/questions/26965171/fast-nearest-power-of-2-in-javascript\n function pow2ceil(v) {\n v--;\n var p = 2;\n while (v >>= 1) {\n p <<= 1;\n }\n return p;\n }\n\n function pow2floor(v) {\n\n var p = 1;\n\n while (v >>= 1) {\n p <<= 1;\n }\n return p;\n }\n\n function getIndexInterpolate(value, valueBefore, valueAfter, indexBefore, indexAfter) {\n return (value - valueBefore) / (valueAfter - valueBefore) * (indexAfter - indexBefore) + indexBefore;\n }\n\n function euclidianSearch(targetX, targetY, haystackX, haystackY, scaleX = 1, scaleY = 1) {\n\n let distance = Number.MAX_VALUE,\n distance_i;\n\n let index = -1;\n\n for (var i = 0, l = haystackX.length; i < l; i++) {\n\n distance_i = Math.pow((targetX - haystackX[i]) * scaleX, 2) + Math.pow((targetY - haystackY[i]) * scaleY, 2);\n\n if (distance_i < distance) {\n\n index = i;\n distance = distance_i;\n }\n }\n\n return index;\n }\n\n function binarySearch(target, haystack, reverse) {\n\n let seedA = 0,\n length = haystack.length,\n seedB = length - 1,\n seedInt,\n i = 0,\n nanDirection = 1;\n\n if (haystack[seedA] == target) {\n return seedA;\n }\n\n if (haystack[seedB] == target) {\n return seedB;\n }\n\n while (true) {\n i++;\n if (i > 100) {\n throw 'Error loop';\n }\n\n seedInt = Math.floor((seedA + seedB) / 2);\n\n // seedInt -= seedInt % 2; // Always looks for an x.\n\n while (isNaN(haystack[seedInt])) {\n\n if (seedInt >= haystack.length - 1) {\n\n return haystack.length - 1;\n } else if (seedInt <= 0) {\n\n return 0;\n }\n\n seedInt += nanDirection;\n }\n\n if (seedInt == seedA || haystack[seedInt] == target || seedInt == seedB) {\n return seedInt;\n }\n\n // console.log(seedA, seedB, seedInt, haystack[seedInt]);\n if (haystack[seedInt] <= target) {\n if (reverse) {\n seedB = seedInt;\n } else {\n seedA = seedInt;\n }\n } else if (haystack[seedInt] > target) {\n if (reverse) {\n seedA = seedInt;\n } else {\n seedB = seedInt;\n }\n } else {\n return false;\n }\n\n nanDirection *= -1;\n }\n }\n\n Waveform.BELOW = Symbol();\n Waveform.ABOVE = Symbol();\n\n Waveform.BOX = Symbol();\n Waveform.BAR = Symbol();\n\n const MULTIPLY = Symbol();\n const ADD = Symbol();\n const SUBTRACT = Symbol();\n const DIVIDE = Symbol();\n\n //module.exports = Waveform;\n\n exports.default = Waveform;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(3), __webpack_require__(8), __webpack_require__(0), __webpack_require__(10), __webpack_require__(4)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.core.js'), require('./graph.serie.js'), require('../graph.util.js'), require('../mixins/graph.mixin.errorbars.js'), require('../util/waveform.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphCore, global.graphSerie, global.graphUtil, global.graphMixinErrorbars, global.waveform);\n global.graphSerieLine = mod.exports;\n }\n})(this, function (module, exports, _graphCore, _graphSerie, _graphUtil, _graphMixinErrorbars, _waveform) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphCore2 = _interopRequireDefault(_graphCore);\n\n var _graphSerie2 = _interopRequireDefault(_graphSerie);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphMixinErrorbars2 = _interopRequireDefault(_graphMixinErrorbars);\n\n var _waveform2 = _interopRequireDefault(_waveform);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Serie line\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends Serie\n */\n class SerieLine extends _graphSerie2.default {\n\n static default() {\n /**\n * @name SerieLineDefaultOptions\n * @object\n * @static\n * @memberof SerieLine\n */\n return {\n\n lineColor: 'black',\n lineStyle: 1,\n flip: false,\n label: '',\n lineWidth: 1,\n markers: false,\n trackMouse: false,\n trackMouseLabel: false,\n trackMouseLabelRouding: 1,\n lineToZero: false,\n selectableOnClick: false,\n markersIndependant: false,\n overflowX: false,\n overflowY: false\n };\n }\n\n constructor(graph, name, options) {\n\n super(...arguments);\n\n this.selectionType = 'unselected';\n this.markerFamilies = {};\n\n util.mapEventEmission(this.options, this); // Register events\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n lineWidth: this.options.lineWidth,\n markers: this.options.markers\n };\n\n this.styles.selected = {\n lineWidth: 3\n };\n\n this.extendStyles();\n this.markersDom = new Map();\n\n this.shown = true;\n\n this.data = [];\n this._isMinOrMax = {\n x: {\n min: false,\n max: false\n },\n y: {\n min: false,\n max: false\n }\n };\n\n // Optimize is no markerPoints => save loops\n // this.markerPoints = {};\n\n this.groupLines = document.createElementNS(this.graph.ns, 'g');\n this.domMarker = document.createElementNS(this.graph.ns, 'path');\n this.domMarker.style.cursor = 'pointer';\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n this.additionalData = {};\n\n this.marker = document.createElementNS(this.graph.ns, 'circle');\n this.marker.setAttribute('fill', 'black');\n this.marker.setAttribute('r', 3);\n this.marker.setAttribute('display', 'none');\n\n this.markerLabel = document.createElementNS(this.graph.ns, 'text');\n this.markerLabelSquare = document.createElementNS(this.graph.ns, 'rect');\n this.markerLabelSquare.setAttribute('fill', 'white');\n this.domMarkerHover = {};\n this.domMarkerSelect = {};\n this.markerHovered = 0;\n this.groupMarkerSelected = document.createElementNS(this.graph.ns, 'g');\n\n this.markerPoints = {};\n\n //this.scale = 1;\n //this.shift = 0;\n this.lines = [];\n\n this.groupMain.appendChild(this.groupLines);\n\n this.groupMain.appendChild(this.marker);\n\n this.groupMain.appendChild(this.groupMarkerSelected);\n this.groupMain.appendChild(this.markerLabelSquare);\n this.groupMain.appendChild(this.markerLabel);\n\n this.groupMarkers = document.createElementNS(this.graph.ns, 'g');\n this.groupMain.appendChild(this.groupMarkers);\n\n this.independantMarkers = [];\n\n if (this.initExtended1) {\n this.initExtended1();\n }\n\n this.groupLines.addEventListener('click', e => {\n\n if (this.options.selectableOnClick) {\n\n if (this.isSelected()) {\n\n this.graph.unselectSerie(this);\n } else {\n this.graph.selectSerie(this);\n }\n }\n });\n\n if (this.options.markers) {\n this.setMarkers(this.options.markers, 'unselected');\n }\n }\n\n setWaveform(waveform) {\n\n if (!(waveform instanceof _waveform2.default)) {\n throw 'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance';\n }\n\n this.waveform = waveform;\n\n this.minX = this.waveform.getXMin();\n this.maxX = this.waveform.getXMax();\n this.minY = this.waveform.getMin();\n this.maxY = this.waveform.getMax();\n\n this.graph.updateDataMinMaxAxes();\n this.dataHasChanged();\n\n return this;\n }\n\n /**\n * Sets the options of the serie\n * @see SerieLineDefaultOptions\n * @param {Object} options - A object containing the options to set\n * @return {SerieLine} The current serie\n * @memberof SerieLine\n */\n setOptions(options) {\n this.options = util.extend(true, {}, SerieLine.prototype.defaults, options || {});\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n markers: this.options.markers\n };\n\n this.applyLineStyles();\n return this;\n }\n\n onMouseOverMarker(e, index) {\n\n var toggledOn = this.toggleMarker(index, true, true);\n\n if (this.options.onMouseOverMarker) {\n\n this.options.onMouseOverMarker(index, this.infos ? this.infos[index] || false : false, [this.waveform.getX(index), this.waveform.getY(index)]);\n }\n }\n\n onMouseOutMarker(e, index) {\n this.markersOffHover();\n\n if (this.options.onMouseOutMarker) {\n this.options.onMouseOutMarker(index, this.infos ? this.infos[index] || false : false, [this.waveform.getX(index), this.waveform.getY(index)]);\n }\n }\n\n /**\n * Selects one of the markers of the serie\n * @param {Number} index - The point index to select (starting at 0)\n * @param {Boolean} [force = undefined] - Forces state of the marker. true forces selection, false forces deselection. undefined toggles the state of the marker\n * @param {Boolean} [hover = false] - true to set the selection in mode \"hover\" (will disappear on mouse out of the marker). false to set the selection in mode \"select\" (will disappear when another marker is selected)\n * @returns {Boolean} The new state of the marker\n * @memberof SerieLine\n */\n toggleMarker(index, force, hover) {\n\n let i = index;\n\n var _on;\n if (typeof force === 'undefined') {\n _on = !hover ? !this.domMarkerSelect[index] : !this.domMarkerHover[index];\n }\n var el = this['domMarker' + (hover ? 'Hover' : 'Select')];\n\n if (_on || force === true) {\n\n if (!el[index]) {\n\n var dom = document.createElementNS(this.graph.ns, 'path');\n\n this.setMarkerStyleTo(dom, this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(i)]);\n this['domMarker' + (hover ? 'Hover' : 'Select')][index] = dom;\n this.groupMarkerSelected.appendChild(dom);\n } else {\n dom = el[index];\n }\n\n let x = this.getX(this.waveform.getX(i)),\n y = this.getY(this.waveform.getY(i));\n\n dom.setAttribute('d', 'M ' + x + ' ' + y + ' ' + this.getMarkerPath(this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(i)], 1));\n\n if (hover) {\n this.markerHovered++;\n }\n } else if (!_on || force === false) {\n\n if (hover && this.domMarkerHover[index] && !this.domMarkerSelect[index] || this.domMarkerSelect[index]) {\n\n if (!el[index]) {\n return;\n }\n\n this.groupMarkerSelected.removeChild(el[index]);\n\n delete el[index];\n\n if (hover) this.markerHovered--;\n }\n }\n\n return _on;\n }\n\n /**\n * Toggles off markers that have the hover mode \"on\"\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n markersOffHover() {\n\n for (var i in this.domMarkerHover) {\n this.toggleMarker(i.split(','), false, true);\n }\n return this;\n }\n\n /**\n * Toggles off markers that have the select mode \"on\"\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n markersOffSelect() {\n\n for (var i in this.domMarkerSelect) {\n this.toggleMarker(i.split(','), false, false);\n }\n return this;\n }\n\n onClickOnMarker(e, index) {\n\n var toggledOn = this.toggleMarker(index);\n\n if (toggledOn && this.options.onSelectMarker) {\n this.options.onSelectMarker(index, this.infos ? this.infos[index[0]] || false : false);\n }\n\n if (!toggledOn && this.options.onUnselectMarker) {\n this.options.onUnselectMarker(index, this.infos ? this.infos[index[0]] || false : false);\n }\n\n if (this.options.onToggleMarker) {\n this.options.onToggleMarker(index, this.infos ? this.infos[index[0]] || false : false, toggledOn);\n }\n }\n\n _getMarkerIndexFromEvent(e) {\n var px = this.graph._getXY(e);\n\n // return this.searchIndexByPxXY( ( px.x ), ( px.y ) );\n return this.searchIndexByPxXY(px.x - this.graph.getPaddingLeft(), px.y - this.graph.getPaddingTop());\n }\n\n onMouseWheel() {}\n\n /**\n * Cleans the DOM from the serie internal object (serie and markers). Mostly used internally when a new {@link Serie#setData} is called\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n empty() {\n\n for (var i = 0, l = this.lines.length; i < l; i++) {\n this.groupLines.removeChild(this.lines[i]);\n }\n this.lines = [];\n\n return this;\n }\n\n /**\n * Applies a selection to the serie\n * @param {String} [ selectionType = \"selected\" ] - The selection name\n * @returns {SerieLine} The current serie\n * @see SerieLine#unselect\n * @memberof SerieLine\n */\n select(selectionType) {\n\n selectionType = selectionType || 'selected';\n\n this.selected = selectionType !== 'unselected';\n\n if (this.areMarkersShown() || this.areMarkersShown(selectionType)) {\n this.selectionType = selectionType;\n\n this.draw(true); // Drawing is absolutely required here\n this.applyLineStyles();\n } else {\n this.selectionType = selectionType;\n this.applyLineStyles();\n }\n\n this.applyLineStyle(this.getSymbolForLegend());\n return this;\n }\n\n /**\n * Removes the selection to the serie. Effectively, calls {@link SerieLine#select}(\"unselected\").\n * @returns {SerieLine} The current serie\n * @see SerieLine#select\n * @memberof SerieLine\n */\n unselect() {\n\n this.selected = false;\n\n return this.select('unselected');\n }\n\n /**\n * Degrades the data of the serie. This option is used for big data sets that have monotoneously increasing (or decreasing) x values.\n * For example, a serie containing 1'000'000 points, displayed over 1'000px, will have 1'000 points per pixel. Often it does not make sense to display more than 2-3 points per pixel.\n * degrade( pxPerPoint ) allows a degradation of the serie, based on a a number of pixel per point. It computes the average of the data that would be displayed over each pixel range\n * Starting from jsGraph 2.0, it does not calculate the minimum and maximum and creates the zone serie anymore\n * @return {SerieLine} The current serie instance\n * @example serie.degrade( 0.5 ); // Will display 2 points per pixels\n * @memberof SerieLine\n */\n degrade(pxPerP) {\n\n this.degradationPx = pxPerP;\n return this;\n }\n\n drawInit(force) {\n\n var data, xData;\n\n try {\n this.axisCheck();\n } catch (e) {\n console.warn(e);\n return false;\n }\n\n this.currentLineId = 0;\n this.counter = 0;\n this._drawn = true;\n this.currentLine = '';\n\n // Degradation\n\n if (this.waveform) {\n\n if (this.degradationPx) {\n\n this.waveform.resampleForDisplay({\n\n resampleToPx: this.degradationPx,\n xPosition: this.getXAxis().getPx.bind(this.getXAxis()),\n minX: this.getXAxis().getCurrentMin(),\n maxX: this.getXAxis().getCurrentMax()\n\n });\n\n this._dataToUse = [this.waveform.getDataToUseFlat()];\n } else if (this.waveform.hasAggregation()) {\n\n let xaxis = this.getXAxis(),\n numberOfPointsInTotal = this.graph.getDrawingWidth() * (xaxis.getDataMax() - xaxis.getDataMin()) / (xaxis.getCurrentMax() - xaxis.getCurrentMin()),\n promise = this.waveform.selectAggregatedData(numberOfPointsInTotal);\n\n if (promise instanceof Promise) {\n\n promise.then(() => {\n\n this.draw(force);\n });\n\n return false;\n } else if (promise === false) {\n\n return false;\n } else {\n\n this._dataToUse = this.waveform.getDataToUseFlat();\n }\n }\n\n // this._dataToUse = this.waveform.getDataToUseFlat();\n } else {\n\n this._dataToUse = this.data;\n this._xDataToUse = this.xData;\n }\n\n return true;\n }\n\n removeLinesGroup() {\n this._afterLinesGroup = this.groupLines.nextSibling;\n this.groupMain.removeChild(this.groupLines);\n }\n\n insertLinesGroup() {\n\n if (!this._afterLinesGroup) {\n throw 'Could not find group after lines to insertion.';\n }\n\n this.groupMain.insertBefore(this.groupLines, this._afterLinesGroup);\n this._afterLinesGroup = false;\n }\n\n removeExtraLines() {\n\n var i = this.currentLineId,\n l = this.lines.length;\n\n for (; i < l; i++) {\n this.groupLines.removeChild(this.lines[i]);\n }\n\n this.lines.splice(this.currentLineId, l - this.currentLineId);\n this.currentLineId = 0;\n }\n\n /**\n * Draws the serie\n * @memberof SerieLine\n */\n draw(force) {\n // Serie redrawing\n\n super.draw(...arguments);\n\n if (!this.getXAxis() || !this.getYAxis()) {\n throw 'No axes were defined for this serie';\n }\n\n if (force || this.hasDataChanged()) {\n if (!this.drawInit(force)) {\n return;\n }\n\n var data = this._dataToUse,\n xData = this._xDataToUse,\n slotToUse = this._slotToUse;\n\n this.removeLinesGroup();\n this.eraseMarkers();\n\n this.lookForMaxima = true;\n this.lookForMinima = false;\n\n this.markerFamily = this.markerFamilies[this.selectionType || 'unselected'];\n\n this.pos0 = this.getYAxis().getPos(0);\n\n if (this.hasErrors()) {\n this.errorDrawInit();\n }\n\n this._draw();\n\n if (this.hasErrors()) {\n this.errorDraw();\n }\n\n this.removeExtraLines();\n this.insertMarkers();\n this.insertLinesGroup();\n }\n\n // Unhovers everything\n for (var i in this.domMarkerHover) {\n this.toggleMarker(i.split(','), false, true);\n }\n\n // Deselects everything\n for (var i in this.domMarkerSelect) {\n this.toggleMarker(i.split(','), false, false);\n }\n\n this.applyLineStyle(this.getSymbolForLegend());\n\n if (this.hasStyleChanged(this.selectionType)) {\n this.updateStyle();\n }\n\n this.dataHasChanged(false);\n super.afterDraw();\n }\n\n _draw() {\n\n let self = this,\n waveform = this.waveform,\n data,\n x,\n y,\n lastX = false,\n lastY = false,\n xpx,\n ypx,\n xpx2,\n ypx2,\n xAxis = this.getXAxis(),\n yAxis = this.getYAxis(),\n xMin = xAxis.getCurrentMin(),\n yMin = yAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n yMax = yAxis.getCurrentMax();\n\n if (!waveform) {\n return;\n }\n\n data = waveform.getData(true);\n\n // Y crossing\n let yLeftCrossingRatio,\n yLeftCrossing,\n yRightCrossingRatio,\n yRightCrossing,\n xTopCrossingRatio,\n xTopCrossing,\n xBottomCrossingRatio,\n xBottomCrossing,\n\n\n /*xshift = waveform.getXShift(),\n xscale = wave.getXScale(),*/\n yshift = waveform.getShift(),\n yscale = waveform.getScale();\n\n let pointOutside = false;\n let lastPointOutside = false;\n let pointOnAxis;\n\n let _monotoneous = this.isMonotoneous(),\n _markersShown = this.markersShown();\n\n let i = 0,\n l = waveform.getLength();\n\n this.currentLine = '';\n\n if (waveform.isXMonotoneous()) {\n\n if (waveform.isXMonotoneousAscending()) {\n\n i = waveform.getIndexFromX(xMin, true) || 0;\n l = waveform.getIndexFromX(xMax, true);\n\n if (l === false) {\n l = waveform.getLength();\n }\n } else {\n\n i = waveform.getIndexFromX(xMax, true) || 0;\n l = waveform.getIndexFromX(xMin, true);\n\n if (l === false) {\n l = waveform.getLength();\n }\n }\n\n l += 2;\n if (l > data.length) {\n l = data.length;\n }\n }\n\n for (; i < l; i += 1) {\n\n x = waveform.getX(i, true);\n y = data[i] * yscale + yshift;\n\n if (x != x || y != y) {\n // NaN checks\n this._createLine();\n continue;\n }\n\n if (!this.options.overflowX && x < xMin && lastX < xMin || !this.options.overflowX && x > xMax && lastX > xMax || (!this.options.overflowY && y < yMin && lastY < yMin || !this.options.overflowY && y > yMax && lastY > yMax) && !this.options.lineToZero) {\n lastX = x;\n lastY = y;\n lastPointOutside = true;\n continue;\n }\n\n this.counter2 = i;\n\n if (_markersShown) {\n this.getMarkerCurrentFamily(this.counter2);\n }\n\n xpx2 = this.getX(x);\n ypx2 = this.getY(y);\n //xpx2 = 0;\n //ypx2 = 0;\n\n if (xpx2 == xpx && ypx2 == ypx) {\n continue;\n }\n\n if (xpx2 != xpx2 || ypx2 != ypx2) {\n // NaN checks\n if (this.counter > 0) {\n\n this._createLine();\n }\n continue;\n }\n\n if (!_monotoneous) {\n\n pointOutside = !this.options.overflowX && (x < xMin || x > xMax) || !this.options.overflowY && (y < yMin || y > yMax);\n } else {\n pointOutside = !this.options.overflowY && (y < yMin || y > yMax);\n }\n\n if (this.options.lineToZero) {\n pointOutside = x < xMin || x > xMax;\n\n if (pointOutside) {\n continue;\n }\n } else {\n\n if (pointOutside || lastPointOutside) {\n\n if ((lastX === false || lastY === false) && !lastPointOutside) {\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n } else {\n\n pointOnAxis = [];\n // Y crossing\n yLeftCrossingRatio = (x - xMin) / (x - lastX);\n yLeftCrossing = y - yLeftCrossingRatio * (y - lastY);\n yRightCrossingRatio = (x - xMax) / (x - lastX);\n yRightCrossing = y - yRightCrossingRatio * (y - lastY);\n\n // X crossing\n xTopCrossingRatio = (y - yMin) / (y - lastY);\n xTopCrossing = x - xTopCrossingRatio * (x - lastX);\n xBottomCrossingRatio = (y - yMax) / (y - lastY);\n xBottomCrossing = x - xBottomCrossingRatio * (x - lastX);\n\n if (yLeftCrossingRatio < 1 && yLeftCrossingRatio > 0 && yLeftCrossing !== false && yLeftCrossing < yMax && yLeftCrossing > yMin) {\n pointOnAxis.push([xMin, yLeftCrossing]);\n }\n\n if (yRightCrossingRatio < 1 && yRightCrossingRatio > 0 && yRightCrossing !== false && yRightCrossing < yMax && yRightCrossing > yMin) {\n pointOnAxis.push([xMax, yRightCrossing]);\n }\n\n if (xTopCrossingRatio < 1 && xTopCrossingRatio > 0 && xTopCrossing !== false && xTopCrossing < xMax && xTopCrossing > xMin) {\n pointOnAxis.push([xTopCrossing, yMin]);\n }\n\n if (xBottomCrossingRatio < 1 && xBottomCrossingRatio > 0 && xBottomCrossing !== false && xBottomCrossing < xMax && xBottomCrossing > xMin) {\n pointOnAxis.push([xBottomCrossing, yMax]);\n }\n\n if (pointOnAxis.length > 0) {\n\n if (!pointOutside) {\n // We were outside and now go inside\n\n if (pointOnAxis.length > 1) {\n console.error('Programmation error. Please e-mail me.');\n console.log(pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY);\n }\n\n this._createLine();\n this._addPoint(this.getX(pointOnAxis[0][0]), this.getY(pointOnAxis[0][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n this._addPoint(xpx2, ypx2, lastX, lastY, false, false, true);\n } else if (!lastPointOutside) {\n // We were inside and now go outside\n\n if (pointOnAxis.length > 1) {\n console.error('Programmation error. Please e-mail me.');\n console.log(pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY);\n }\n\n this._addPoint(this.getX(pointOnAxis[0][0]), this.getY(pointOnAxis[0][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n } else {\n\n // No crossing: do nothing\n if (pointOnAxis.length == 2) {\n this._createLine();\n\n this._addPoint(this.getX(pointOnAxis[0][0]), this.getY(pointOnAxis[0][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n this._addPoint(this.getX(pointOnAxis[1][0]), this.getY(pointOnAxis[1][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n }\n }\n } else if (!pointOutside) {\n\n this._addPoint(xpx2, ypx2, lastX, lastY, i, false, false);\n } // else {\n // Norman:\n // This else case is not the sign of a bug. If yLeftCrossing == 0 or 1 for instance, pointOutside or lastPointOutside will be true\n // However, there's no need to draw anything because the point is on the axis and will already be covered.\n // 28 Aug 2015\n\n /*\n if ( lastPointOutside !== pointOutside ) {\n console.error( \"Programmation error. A crossing should have been found\" );\n console.log( yLeftCrossing, yLeftCrossingRatio, yMax, yMin );\n console.log( yRightCrossing, yRightCrossingRatio, yMax, yMin );\n console.log( xTopCrossing, xTopCrossingRatio, xMax, xMin );\n console.log( xBottomCrossing, xBottomCrossingRatio, xMax, xMin );\n console.log( pointOutside, lastPointOutside )\n }\n */\n // }\n }\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n\n lastPointOutside = pointOutside;\n\n continue;\n }\n }\n\n this._addPoint(xpx2, ypx2, x, y, i, false, true);\n\n //this.detectPeaks( x, y );\n\n xpx = xpx2;\n ypx = ypx2;\n\n lastX = x;\n lastY = y;\n }\n\n this._createLine();\n\n if (this._tracker) {\n\n if (this._trackerDom) {\n this._trackerDom.remove();\n }\n\n var cloned = this.groupLines.cloneNode(true);\n this.groupMain.appendChild(cloned);\n\n for (i = 0, l = cloned.children.length; i < l; i++) {\n\n cloned.children[i].setAttribute('stroke', 'transparent');\n cloned.children[i].setAttribute('stroke-width', '25px');\n cloned.children[i].setAttribute('pointer-events', 'stroke');\n }\n\n this._trackerDom = cloned;\n\n this.groupMain.addEventListener('mousemove', e => {\n var coords = this.graph._getXY(e),\n ret = this.handleMouseMove(false, false);\n\n this._trackingCallback(this, ret, coords.x, coords.y);\n });\n\n this.groupMain.addEventListener('mouseleave', e => {\n this._trackingOutCallback(this);\n });\n }\n\n return this;\n }\n\n kill() {\n super.kill();\n }\n\n /**\n * @param {Number} k - Index of the point for which we should get the family\n * @memberof SerieLine\n */\n getMarkerCurrentFamily(k) {\n\n if (!this.markerPoints || !this.markerPoints[this.selectionType]) {\n return;\n }\n\n var family;\n\n for (var z = 0; z < this.markerPoints[this.selectionType].length; z++) {\n if (this.markerPoints[this.selectionType][z][0] <= k) {\n // This one is a possibility !\n if (this.markerPoints[this.selectionType][z][1] >= k) {\n // Verify that it's in the boundary\n this.markerCurrentFamily = this.markerPoints[this.selectionType][z][2];\n family = this.markerFamilies[this.selectionType][this.markerCurrentFamily];\n }\n } else {\n break;\n }\n }\n\n if (!family) {\n return false;\n }\n this.getMarkerDom(family);\n return this.markerCurrentFamily;\n }\n\n setMarkerStyleTo(dom, family) {\n\n if (!dom || !family) {\n console.trace();\n throw 'Cannot set marker style. DOM does not exist.';\n }\n\n dom.setAttribute('fill', family.fillColor || 'transparent');\n dom.setAttribute('stroke', family.strokeColor || this.getLineColor());\n dom.setAttribute('stroke-width', family.strokeWidth || 1);\n }\n\n /**\n * Hides the tracking marker (see the trackMouse option)\n * @memberof SerieLine\n */\n hideTrackingMarker() {\n this.marker.setAttribute('display', 'none');\n this.markerLabel.setAttribute('display', 'none');\n this.markerLabelSquare.setAttribute('display', 'none');\n }\n\n _addPoint(xpx, ypx, x, y, j, move, allowMarker) {\n\n /*if( ! this.currentLineId ) {\n throw \"No current line\"\n }* @memberof SerieLine\n */\n\n if (xpx !== xpx || ypx !== ypx) {\n return;\n }\n\n if (this.counter == 0) {\n this.currentLine = 'M ';\n } else {\n\n if (this.options.lineToZero || move) {\n this.currentLine += 'M ';\n } else {\n this.currentLine += 'L ';\n }\n }\n\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += ypx;\n this.currentLine += ' ';\n\n if (this.options.lineToZero && this.pos0 !== undefined) {\n\n this.currentLine += 'L ';\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += this.pos0;\n this.currentLine += ' ';\n }\n\n if (this.hasErrors()) {\n this.errorAddPoint(j, x, y, xpx, ypx);\n }\n\n if (!this.markerPoints) {\n this.counter++;\n\n return;\n }\n\n if (this.markersShown() && allowMarker !== false && this.markerFamily) {\n drawMarkerXY(this, this.markerFamily[this.markerCurrentFamily], xpx, ypx, this.markersDom.get(this.markerFamily[this.markerCurrentFamily]));\n }\n\n this.counter++;\n }\n\n // Returns the DOM\n _createLine() {\n\n var i = this.currentLineId++,\n line;\n\n // Creates a line if needed\n if (this.lines[i]) {\n line = this.lines[i];\n } else {\n\n line = document.createElementNS(this.graph.ns, 'path');\n this.applyLineStyle(line);\n this.groupLines.appendChild(line);\n this.lines[i] = line;\n }\n\n if (this.counter == 0) {\n line.setAttribute('d', '');\n } else {\n line.setAttribute('d', this.currentLine);\n }\n\n this.currentLine = 'M ';\n this.counter = 0;\n\n return line;\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyles() {\n\n for (var i = 0; i < this.lines.length; i++) {\n this.applyLineStyle(this.lines[i]);\n }\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n } else {\n line.removeAttribute('stroke-dasharray');\n }\n line.setAttribute('fill', 'none');\n //\tline.setAttribute('shape-rendering', 'optimizeSpeed');\n }\n\n /**\n * Updates the current style (lines + legend) of the serie. Use this method if you have explicitely changed the options of the serie\n * @example var opts = { lineColor: 'red' };\n * var s = graph.newSerie( \"name\", opts ).setData( someData );\n * opts.lineColor = 'green';\n * s.updateStyle(); // Sets the lineColor to green\n * s.draw(); // Would also do the same thing, but recalculates the whole serie display (including (x,y) point pairs)\n * @memberof SerieLine\n */\n updateStyle() {\n this.applyLineStyles();\n this.setLegendSymbolStyle();\n\n this.styleHasChanged(false);\n }\n\n // Revised August 2014. Ok\n getMarkerPath(family, add) {\n\n var z = family.zoom || 1,\n add = add || 0,\n el = [];\n\n switch (family.type) {\n\n case 2:\n el = ['m', -2, -2, 'l', 4, 4, 'm', -4, 0, 'l', 4, -4];\n break;\n\n case 3:\n el = ['m', -2, 0, 'l', 4, 0, 'm', -2, -2, 'l', 0, 4];\n break;\n\n case 4:\n el = ['m', -1, -1, 'l', 2, 0, 'l', -1, 2, 'z'];\n break;\n\n default:\n case 1:\n el = ['m', -2, -2, 'l', 4, 0, 'l', 0, 4, 'l', -4, 0, 'z'];\n break;\n\n }\n\n if ((z == 1 || !z) && !add) {\n return el.join(' ');\n }\n\n var num = 'number';\n\n if (!el) {\n return;\n }\n\n for (var i = 0, l = el.length; i < l; i++) {\n\n if (typeof el[i] == num) {\n\n el[i] *= z + add;\n }\n }\n\n return el.join(' ');\n }\n\n // Revised August 2014. Ok\n getMarkerDom(family) {\n\n var self = this;\n\n if (!this.markersDom.has(family)) {\n\n var dom = document.createElementNS(this.graph.ns, 'path');\n this.setMarkerStyleTo(dom, family);\n this.markersDom.set(family, {\n dom: dom,\n path: ''\n });\n\n dom.addEventListener('mouseover', function (e) {\n var closest = self._getMarkerIndexFromEvent(e);\n self.onMouseOverMarker(e, closest);\n });\n\n dom.addEventListener('mouseout', function (e) {\n var closest = self._getMarkerIndexFromEvent(e);\n self.onMouseOutMarker(e, closest);\n });\n\n dom.addEventListener('click', function (e) {\n var closest = self._getMarkerIndexFromEvent(e);\n self.onClickOnMarker(e, closest);\n });\n }\n\n return family.dom;\n }\n\n // In case markers are not grouped in families but independant\n getMarkerDomIndependent(index, family) {\n\n if (!this.independantMarkers[index]) {\n\n var dom = document.createElementNS(this.graph.ns, 'path');\n this.setMarkerStyleTo(dom, family);\n\n dom.addEventListener('mouseover', e => {\n\n this.onMouseOverMarker(e, index);\n });\n\n dom.addEventListener('mouseout', e => {\n\n this.onMouseOutMarker(e, index);\n });\n\n dom.addEventListener('click', e => {\n\n this.onClickOnMarker(e, index);\n });\n\n this.independantMarkers[index] = dom;\n }\n\n this.groupMarkers.appendChild(this.independantMarkers[index]);\n\n return this.independantMarkers[index];\n }\n\n /**\n * Searches the closest point pair (x,y) to the a pair of pixel position\n * @param {Number} x - The x position in pixels (from the left)\n * @param {Number} y - The y position in pixels (from the left)\n * @returns {Number} Index in the data array of the closest (x,y) pair to the pixel position passed in parameters\n * @memberof SerieLine\n */\n searchIndexByPxXY(x, y) {\n\n var oldDist = false,\n xyindex = false,\n dist;\n\n var xData = this._xDataToUse,\n p_x,\n p_y;\n\n for (var k = 0, m = this.waveform.getLength(); k < m; k += 1) {\n\n p_x = this.waveform.getX(k);\n p_y = this.waveform.getY(k);\n\n dist = Math.pow(this.getX(p_x) - x, 2) + Math.pow(this.getY(p_y) - y, 2);\n //console.log(x, y, dist, this.data[i][k], this.data[i][k + 1]);\n\n if (!oldDist || dist < oldDist) {\n oldDist = dist;\n xyindex = k;\n }\n }\n\n return xyindex;\n }\n\n /**\n * Performs a binary search to find the closest point index to an x value. For the binary search to work, it is important that the x values are monotoneous.\n * @param {Number} valX - The x value to search for\n * @returns {Object} Index in the data array of the closest (x,y) pair to the pixel position passed in parameters\n * @memberof SerieLine\n */\n searchClosestValue(valX, valY) {\n\n if (this.waveform) {\n\n const indexX = this.waveform.getIndexFromXY(valX, valY, undefined, undefined, this.getXAxis().getRelPx(1), this.getYAxis().getRelPx(1));\n\n let returnObj = {};\n\n let direction;\n\n if (valX > this.waveform.getX(indexX)) {\n direction = 0;\n } else {\n direction = 1;\n }\n\n Object.assign(returnObj, {\n indexMin: indexX + direction,\n indexMax: indexX + direction + 1,\n indexClosest: indexX,\n xMin: this.waveform.getX(indexX + direction),\n xMax: this.waveform.getX(indexX + direction + 1),\n yMin: this.waveform.getY(indexX + direction),\n yMax: this.waveform.getY(indexX + direction + 1),\n xClosest: this.waveform.getX(indexX),\n yClosest: this.waveform.getY(indexX),\n xExact: valX\n });\n return returnObj;\n }\n }\n\n handleMouseMove(xValue, doMarker, yValue) {\n\n var valX = xValue || this.getXAxis().getMouseVal(),\n valY = yValue || this.getYAxis().getMouseVal(),\n xMinIndex,\n xMin,\n yMin,\n xMax,\n yMax;\n\n var value = this.searchClosestValue(valX, valY);\n\n if (!value) {\n return;\n }\n\n var ratio, intY;\n\n if (value.xMax == value.xMin) {\n intY = value.yMin;\n } else {\n\n //ratio = ( valX - value.xMin ) / ( value.xMax - value.xMin );\n //intY = ( ( 1 - ratio ) * value.yMin + ratio * value.yMax );\n }\n\n if (doMarker && this.options.trackMouse) {\n\n if (value.xMin == undefined) {\n\n return false;\n } else {\n\n if (!this.marker) {\n return;\n }\n\n var x = this.getX(this.getFlip() ? value.yClosest : value.xClosest);\n var y = this.getY(this.getFlip() ? value.xClosest : value.yClosest);\n\n if (isNaN(x) || isNaN(y)) {\n return;\n }\n\n this.marker.setAttribute('display', 'block');\n this.marker.setAttribute('cx', x);\n this.marker.setAttribute('cy', y);\n\n this.markerLabel.setAttribute('display', 'block');\n this.markerLabelSquare.setAttribute('display', 'block');\n\n switch (this.options.trackMouseLabel) {\n\n case false:\n\n break;\n\n default:\n this.markerLabel.textContent = this.options.trackMouseLabel.replace('', valX.toFixed(this.options.trackMouseLabelRouding)).replace('', intY.toFixed(this.options.trackMouseLabelRouding));\n break;\n }\n\n this.markerLabel.setAttribute('x', x + 5);\n this.markerLabel.setAttribute('y', y - 5);\n\n this.markerLabelSquare.setAttribute('x', x + 5);\n this.markerLabelSquare.setAttribute('y', y - 5 - this.graph.options.fontSize);\n this.markerLabelSquare.setAttribute('width', this.markerLabel.getComputedTextLength() + 2);\n this.markerLabelSquare.setAttribute('height', this.graph.options.fontSize + 2);\n }\n }\n\n return {\n xBefore: value.xMin,\n xAfter: value.xMax,\n yBefore: value.yMin,\n yAfter: value.yMax,\n trueX: value.xExact,\n indexClosest: value.indexClosest,\n interpolatedY: intY,\n\n xClosest: value.xClosest,\n yClosest: value.yClosest\n };\n }\n /**\n * Gets the maximum value of the y values between two x values. The x values must be monotoneously increasing\n * @param {Number} startX - The start of the x values\n * @param {Number} endX - The end of the x values\n * @returns {Number} Maximal y value in between startX and endX\n * @memberof SerieLine\n */\n getMax(start, end) {\n\n var start2 = Math.min(start, end),\n end2 = Math.max(start, end),\n v1 = this.searchClosestValue(start2),\n v2 = this.searchClosestValue(end2),\n i,\n j,\n max = -Infinity,\n initJ,\n maxJ;\n\n // console.log( start2, end2, v1, v2 );\n\n if (!v1) {\n start2 = this.minX;\n v1 = this.searchClosestValue(start2);\n }\n\n if (!v2) {\n end2 = this.maxX;\n v2 = this.searchClosestValue(end2);\n }\n\n if (!v1 || !v2) {\n return -Infinity;\n }\n\n for (i = v1.dataIndex; i <= v2.dataIndex; i++) {\n initJ = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n maxJ = i == v2.dataIndex ? v2.xBeforeIndexArr : this.data[i].length;\n\n for (j = initJ; j <= maxJ; j += 2) {\n max = Math.max(max, this.data[i][j + 1]);\n }\n }\n\n return max;\n }\n\n /**\n * Gets the minimum value of the y values between two x values. The x values must be monotoneously increasing\n * @param {Number} startX - The start of the x values\n * @param {Number} endX - The end of the x values\n * @returns {Number} Maximal y value in between startX and endX\n * @memberof SerieLine\n */\n getMin(start, end) {\n\n var start2 = Math.min(start, end),\n end2 = Math.max(start, end),\n v1 = this.searchClosestValue(start2),\n v2 = this.searchClosestValue(end2),\n i,\n j,\n min = Infinity,\n initJ,\n maxJ;\n\n if (!v1) {\n start2 = this.minX;\n v1 = this.searchClosestValue(start2);\n }\n\n if (!v2) {\n end2 = this.maxX;\n v2 = this.searchClosestValue(end2);\n }\n\n if (!v1 || !v2) {\n return Infinity;\n }\n\n for (i = v1.dataIndex; i <= v2.dataIndex; i++) {\n initJ = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n maxJ = i == v2.dataIndex ? v2.xBeforeIndexArr : this.data[i].length;\n\n for (j = initJ; j <= maxJ; j += 2) {\n min = Math.min(min, this.data[i][j + 1]);\n }\n }\n\n return min;\n }\n\n /* LINE STYLE * @memberof SerieLine\n */\n\n setStyle(style, selectionType = 'unselected') {\n\n this.styles[selectionType] = style;\n this.styleHasChanged(selectionType);\n }\n\n setLineStyle(number, selectionType = 'unselected', applyToSelected) {\n\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].lineStyle = number;\n\n if (applyToSelected) {\n this.setLineStyle(number, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getLineStyle(selectionType) {\n return this.getStyle(selectionType).lineStyle;\n }\n\n getLineDashArray(selectionType = this.selectionType || 'unselected') {\n\n switch (this.getStyle(selectionType).lineStyle) {\n\n case 2:\n return '1, 1';\n break;\n case 3:\n return '2, 2';\n break;\n case 4:\n return '3, 3';\n break;\n case 5:\n return '4, 4';\n break;\n case 6:\n return '5, 5';\n break;\n\n case 7:\n return '5 2';\n break;\n case 8:\n return '2 5';\n break;\n\n case 9:\n return '4 2 4 4';\n break;\n case 10:\n return '1,3,1';\n break;\n case 11:\n return '9 2';\n break;\n case 12:\n return '2 9';\n break;\n\n case 1:\n case false:\n return false;\n break;\n\n default:\n return this.styles[selectionType].lineStyle;\n break;\n }\n\n this.styleHasChanged(selectionType);\n }\n\n getStyle(selectionType = this.selectionType || 'unselected') {\n return this.styles[selectionType];\n }\n\n extendStyles() {\n for (var i in this.styles) {\n\n var s = this.styles[i];\n if (s) {\n this.styles[i] = util.extend(true, {}, this.styles.unselected, s);\n }\n }\n }\n\n extendStyle(styleTarget, styleOrigin) {\n var s = this.styles[styleTarget];\n\n this.styles[styleTarget] = util.extend(true, {}, this.styles[styleOrigin || 'unselected'], s || {});\n\n this.styles[styleTarget].markers.map(function (marker) {\n if (marker.dom) {\n marker.dom = '';\n }\n });\n\n this._recalculateMarkerPoints(styleTarget, this.styles[styleTarget].markers);\n this.styleHasChanged(styleTarget);\n }\n\n /* * @memberof SerieLine\n */\n\n setLineWidth(width, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].lineWidth = width;\n\n if (applyToSelected) {\n this.setLineWidth(width, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getLineWidth(selectionType) {\n\n return this.getStyle(selectionType).lineWidth || 1;\n }\n\n /* LINE COLOR * @memberof SerieLine\n */\n setLineColor(color, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].lineColor = color;\n\n if (applyToSelected) {\n this.setLineColor(color, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getLineColor(selectionType) {\n\n return this.getStyle(selectionType).lineColor || 'black';\n }\n\n /* * @memberof SerieLine\n */\n\n /* MARKERS * @memberof SerieLine\n */\n showMarkers(selectionType, redraw) {\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].showMarkers = true;\n\n if (redraw && this._drawn) {\n this.draw(true);\n } else {\n this.styleHasChanged(selectionType);\n }\n\n return this;\n }\n\n hideMarkers(selectionType, redraw) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType].showMarkers = false;\n\n if (redraw && this._drawn) {\n this.draw(true);\n } else {\n this.styleHasChanged(selectionType);\n }\n return this;\n }\n\n markersShown(selectionType) {\n return this.getStyle(selectionType).showMarkers !== false;\n }\n\n areMarkersShown() {\n return this.markersShown.apply(this, arguments);\n }\n\n isMarkersShown() {\n return this.markersShown.apply(this, arguments);\n }\n\n // Multiple markers\n setMarkers(families, selectionType, applyToSelected) {\n // Family has to be an object\n // Family looks like\n /*\n {\n \ttype: 1,\n \tzoom: 1,\n \tstrokeWidth: 1,\n \tstrokeColor: '',\n \tfillColor: '',\n points: []\n }\n * @memberof SerieLine\n */\n\n this.styles[selectionType || 'unselected'] = this.styles[selectionType || 'unselected'] || {};\n\n this.showMarkers(selectionType, false);\n\n if (!Array.isArray(families) && typeof families == 'object') {\n families = [families];\n } else if (!families) {\n\n families = [{\n type: 1,\n zoom: 1,\n points: 'all'\n }];\n }\n\n this.styles[selectionType || 'unselected'].markers = families;\n\n if (applyToSelected) {\n this.styles.selected.markers = util.extend(true, {}, families);\n }\n\n this._recalculateMarkerPoints(selectionType, families);\n this.styleHasChanged(selectionType);\n this.dataHasChanged(true); // Data has not really changed, but marker placing is performed during the draw method\n return this;\n }\n\n setMarkersPoints(points, family, selectionType) {\n this._extendMarkers('points', points, family, selectionType, true);\n }\n\n setMarkersColor(color, family, selectionType) {\n this._extendMarkers('color', color, family, selectionType);\n }\n\n setMarkersType(type, family, selectionType) {\n this._extendMarkers('type', type, family, selectionType);\n }\n\n setMarkersZoom(zoom, family, selectionType) {\n this._extendMarkers('zoom', zoom, family, selectionType);\n }\n\n setMarkersStrokeColor(strokeColor, family, selectionType) {\n this._extendMarkers('strokeColor', strokeColor, family, selectionType);\n }\n\n setMarkersStrokeWidth(strokeWidth, family, selectionType) {\n this._extendMarkers('strokeWidth', strokeWidth, family, selectionType);\n }\n\n setMarkersFillColor(fillColor, family, selectionType) {\n this._extendMarkers('fillColor', fillColor, family, selectionType);\n }\n\n _extendMarkers(type, value, family, selectionType, recalculatePoints) {\n\n family = family || 0;\n selectionType = selectionType || 'unselected';\n\n if (!this.styles[selectionType] || !this.styles[selectionType].markers) {\n return;\n }\n\n this.styles[selectionType].markers[family][type] = value;\n\n if (recalculatePoints) {\n this._recalculateMarkerPoints(selectionType, this.styles[selectionType].markers);\n }\n\n if (!this.markersDom[this.styles[selectionType].markers[family]]) {\n // DOM doesn't exist yet.\n return;\n }\n\n this.setMarkerStyleTo(this.markersDom[this.styles[selectionType].markers[family]].dom, this.styles[selectionType].markers[family]);\n }\n\n _recalculateMarkerPoints(selectionType, families) {\n\n var markerPoints = [];\n // Overwriting any other undefined families\n markerPoints.push([0, Infinity, null]);\n\n for (var i = 0, k = families.length; i < k; i++) {\n\n families[i].markerPath = this.getMarkerPath(families[i]);\n\n if (!families[i].points) {\n families[i].points = 'all';\n }\n\n if (!Array.isArray(families[i].points)) {\n families[i].points = [families[i].points];\n }\n\n for (var j = 0, l = families[i].points.length; j < l; j++) {\n\n if (families[i].points[j] == 'all') {\n\n markerPoints.push([0, Infinity, i]);\n } else if (!Array.isArray(families[i].points[j])) {\n\n markerPoints.push([families[i].points[j], families[i].points[j], i]);\n //markerPoints.push( [ family[ i ].points[ j ] + 1, null ] );\n } else {\n\n markerPoints.push([families[i].points[j][0], families[i].points[j][1], i]);\n }\n }\n }\n\n this.markerFamilies[selectionType || 'unselected'] = families;\n\n // Let's sort if by the first index.\n markerPoints.sort(function (a, b) {\n return a[0] - b[0] || (a[2] == null ? -1 : 1);\n });\n\n this.markerPoints[selectionType || 'unselected'] = markerPoints;\n }\n\n insertMarkers(selectionType) {\n\n if (!this.markerFamilies || !this.markerFamilies[selectionType || this.selectionType] || this.options.markersIndependant) {\n return;\n }\n\n for (var i = 0, l = this.markerFamilies[selectionType || this.selectionType].length; i < l; i++) {\n\n if (!this.markersDom.has(this.markerFamilies[selectionType || this.selectionType][i])) {\n continue;\n }\n\n let dom = this.markersDom.get(this.markerFamilies[selectionType || this.selectionType][i]);\n\n dom.dom.setAttribute('d', dom.path);\n\n this.groupMarkers.appendChild(dom.dom);\n this.currentMarkersSelectionType = this.selectionType;\n }\n }\n\n getMarkerForLegend() {\n\n if (!this.markerPoints || !this.markerPoints[this.selectionType]) {\n return;\n }\n\n if (!this.markerForLegend) {\n\n var marker = document.createElementNS(this.graph.ns, 'path');\n this.setMarkerStyleTo(marker, this.markerFamilies[this.selectionType][0]);\n\n marker.setAttribute('d', 'M 14 0 ' + this.getMarkerPath(this.markerFamilies[this.selectionType][0]));\n\n this.markerForLegend = marker;\n }\n\n return this.markerForLegend;\n }\n\n eraseMarkers() {\n\n var self = this;\n\n if (this.options.markersIndependant) {\n\n for (var i in this.independantMarkers) {\n self.groupMarkers.removeChild(this.independantMarkers[i]);\n }\n\n this.independantMarkers = {};\n } else if (this.currentMarkersSelectionType) {\n\n this.markersDom.forEach(function (el) {\n\n if (!el.dom) {\n return;\n }\n\n if (el.dom.parentNode !== self.groupMarkers) {\n return;\n }\n\n self.groupMarkers.removeChild(el.dom);\n el.path = '';\n });\n\n this.currentMarkersSelectionType = false;\n }\n }\n\n isMonotoneous() {\n if (this.waveform) {\n return this.waveform.isMonotoneous();\n }\n\n return !!this.xmonotoneous;\n }\n\n findLocalMinMax(xRef, xWithin, type) {\n\n if (!this.waveform) {\n return false;\n }\n\n return this.waveform.findLocalMinMax(xRef, xWithin, type);\n }\n\n }\n\n function drawMarkerXY(graph, family, x, y, markerDom) {\n\n if (!family) {\n return;\n }\n\n if (graph.options.markersIndependant) {\n var dom = graph.getMarkerDomIndependent(graph.counter2, family);\n var p = 'M ' + x + ' ' + y + ' ';\n p += family.markerPath + ' ';\n\n dom.setAttribute('d', p);\n }\n\n markerDom.path = markerDom.path || '';\n markerDom.path += 'M ' + x + ' ' + y + ' ';\n markerDom.path += family.markerPath + ' ';\n }\n\n util.mix(SerieLine, _graphMixinErrorbars2.default);\n\n exports.default = SerieLine;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports);\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports);\n global.graphPosition = mod.exports;\n }\n})(this, function (module, exports) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n function _parsePx(px) {\n if (px && px.indexOf && px.indexOf('px') > -1) {\n return parseInt(px.replace('px', ''));\n }\n return false;\n }\n\n function isNumeric(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n }\n\n /**\n * Utility class to compute positioning\n * @class\n */\n class Position {\n\n constructor(x, y, dx, dy) {\n\n if (typeof x == 'object') {\n this.x = x.x;\n this.y = x.y;\n this.dx = x.dx;\n this.dy = x.dy;\n } else {\n this.x = x;\n this.y = y;\n this.dx = dx;\n this.dy = dy;\n }\n }\n\n duplicate() {\n return new Position(this.x, this.y, this.dx, this.dy);\n }\n\n /**\n * Computes the position of the position\n * @param {Graph} graph - The graph for which the position has to be computed\n * @param {AxisX} xAxis - The x axis to consider (has to belong to the graph)\n * @param {AxisY} yAxis - The y axis to consider (has to belong to the graph)\n * @param {Serie} [serie] - For non-existing y value, use a serie to compute it automatically from the serie data\n * @return {Object} An object in the format ```{x: xPx, y: yPx}``` containing the position in pixels of the position\n */\n compute(graph, xAxis, yAxis, serie) {\n\n if (!graph || !xAxis || !yAxis || !graph.hasXAxis || !graph.hasYAxis) {\n graph.throw();\n }\n\n if (!graph.hasXAxis(xAxis)) {\n throw 'Graph does not contain the x axis that was used as a parameter';\n }\n\n if (!graph.hasYAxis(yAxis)) {\n throw 'Graph does not contain the x axis that was used as a parameter';\n }\n\n return this._compute(graph, xAxis, yAxis, serie);\n }\n\n _compute(graph, xAxis, yAxis, serie) {\n\n var relativeTo = this._relativeTo;\n if (relativeTo) {\n var relativeToComputed = relativeTo._compute(graph, xAxis, yAxis, serie);\n }\n\n var parsed,\n pos = {\n x: false,\n y: false\n };\n\n if (!xAxis) {\n xAxis = graph.getXAxis();\n }\n\n if (!yAxis) {\n yAxis = graph.getYAxis();\n }\n\n for (var i in pos) {\n\n var axis = i == 'x' ? xAxis : yAxis;\n var val = this[i];\n var dval = this['d' + i];\n\n if (val === undefined && (dval !== undefined && relativeTo === undefined || relativeTo === undefined)) {\n\n if (i == 'x') {\n\n if (dval === undefined) {\n continue;\n }\n\n pos[i] = relativeTo ? relativeTo[i] : 0;\n } else if (this.x !== undefined && serie) {\n\n if (_parsePx(this.x) !== false) {\n console.warn('You have defined x in px and not y. Makes no sense. Returning 0 for y');\n pos[i] = 0;\n } else {\n\n var closest = serie.searchClosestValue(this.x);\n\n if (!closest) {\n console.warn('Could not find y position for x = ' + this.x + ' on serie \"' + serie.getName() + '\". Returning 0 for y.');\n pos[i] = 0;\n } else {\n pos[i] = serie.getY(closest.yMin);\n }\n }\n }\n } else if (val !== undefined) {\n\n pos[i] = this.getPx(val, axis);\n }\n\n if (dval !== undefined) {\n\n var def = val !== undefined || relativeToComputed == undefined || relativeToComputed[i] == undefined ? pos[i] : relativeToComputed[i];\n\n if (i == 'y' && relativeToComputed && relativeToComputed.x !== undefined && relativeToComputed.y == undefined) {\n\n if (!serie) {\n throw 'Error. No serie exists. Cannot find y value';\n return;\n }\n\n var closest = serie.searchClosestValue(relativeTo.x);\n if (closest) {\n def = serie.getY(closest.yMin);\n }\n\n //console.log( relativeTo.x, closest, serie.getY( closest.yMin ), def );\n }\n\n if (!def) {\n def = 0;\n }\n\n if ((parsed = _parsePx(dval)) !== false) {\n // dx in px => val + 10px\n\n pos[i] = def + parsed; // return integer (will be interpreted as px)\n } else if ((parsed = this._parsePercent(dval)) !== false) {\n\n pos[i] = def + this._getPositionPx(parsed, true, axis, graph); // returns xx%\n } else if (axis) {\n\n pos[i] = def + axis.getRelPx(dval); // px + unittopx\n }\n }\n }\n\n return pos;\n }\n\n _getPositionPx(value, x, axis, graph) {\n\n var parsed;\n\n if ((parsed = _parsePx(value)) !== false) {\n return parsed; // return integer (will be interpreted as px)\n }\n\n if ((parsed = this._parsePercent(value)) !== false) {\n return parsed / 100 * (x ? graph.getDrawingWidth() : graph.getDrawingHeight());\n } else if (axis) {\n return axis.getPos(value);\n }\n }\n\n _parsePercent(percent) {\n if (percent && percent.indexOf && percent.indexOf('%') > -1) {\n return percent;\n }\n return false;\n }\n\n /**\n * Computes the value in pixels of an amplitude (or a distance) for a certain axis\n * @param {Number} value - The value in axis unit\n * @param {Axis} Axis - The x axis to consider (has to belong to the graph)\n * @return {String} The value in pixels, e.g. \"20px\"\n */\n getDeltaPx(value, axis) {\n var v;\n if ((v = _parsePx(value)) !== false) {\n return v + 'px';\n } else {\n\n return axis.getRelPx(value) + 'px';\n }\n }\n\n deltaPosition(mode, delta, axis) {\n\n mode = mode == 'y' ? 'y' : 'x';\n var ref = this[mode],\n refd = this['d' + mode],\n refPx,\n deltaPx;\n\n if (ref !== undefined) {\n if ((refPx = _parsePx(ref)) !== false) {\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this[mode] = refPx + deltaPx + 'px';\n } else {\n this[mode] = refPx + axis.getRelPx(delta) + 'px';\n }\n } else {\n\n ref = this.getValPosition(ref, axis);\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this[mode] = ref + axis.getRelVal(deltaPx);\n } else {\n this[mode] = ref + delta;\n }\n }\n } else if (refd !== undefined) {\n\n if (mode == 'y' && ref === undefined && !this._relativeTo) {\n // This means that the shape is placed by the x value. Therefore, the dy is only a stand-off.\n // Therefore, we do nothing\n return;\n }\n\n if ((refPx = _parsePx(refd)) !== false) {\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this['d' + mode] = refPx + deltaPx + 'px';\n } else {\n this['d' + mode] = refPx + axis.getRelPx(delta) + 'px';\n }\n } else {\n\n refd = this.getValPosition(refd, axis);\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this['d' + mode] = refd + axis.getRelVal(deltaPx);\n } else {\n this['d' + mode] = refd + delta;\n }\n }\n }\n }\n\n getValPosition(rel, axis) {\n\n if (rel == 'max') {\n return axis.getMaxValue();\n }\n\n if (rel == 'min') {\n return axis.getMinValue();\n }\n\n return rel;\n }\n\n /**\n * Computes a value in pixels\n * @param {Number} value - The value in axis unit\n * @param {Axis} axis - The x or y axis to consider (has to belong to the graph)\n * @param {Boolean} rel - Whether or not the value is a distance\n * @return {(Number|String)} The computed value\n */\n getPx(value, axis, rel) {\n\n var parsed;\n\n if (typeof value == 'function') {\n\n return value(axis, rel);\n } else if ((parsed = _parsePx(value)) !== false) {\n\n return parsed; // return integer (will be interpreted as px)\n } else if ((parsed = this._parsePercent(value)) !== false) {\n\n return parsed; // returns xx%\n } else if (axis) {\n\n if (value == 'min') {\n\n return axis.getMinPx();\n } else if (value == 'max') {\n\n return axis.getMaxPx();\n } else if (rel) {\n\n return axis.getRelPx(value);\n } else if (isNumeric(value)) {\n\n return axis.getPos(value);\n }\n }\n }\n\n getPxRel(value, axis) {\n return this.getPx(value, axis, true);\n }\n\n /**\n * Assigns the current position as relative to another. This is used when a position is used with \"dx\" or \"dy\" and not \"x\" or \"y\"\n * @param {Position} pos - The reference position\n * @return {Position} The current position\n */\n relativeTo(pos) {\n this._relativeTo = Position.check(pos);\n return this;\n }\n\n /**\n * Checks if an object is a position. If not, creates a new Position instance with the ```pos``` object. If a new position is created, ```callback``` is fired with the position as a unique parameter. The return of the function, if not false, should be a ```Position``` instance which serves as the reference position.\n * @example Position.check( { x: 1, y: 2 }, function() { return someOtherPosition; } );\n * @param {(Object|Position)} pos - The position object or the object fed into the constructor\n * @param {Function} callback - The callback fired if a new position is created\n * @return {Position} The resulting position object\n */\n static check(pos, callback) {\n if (pos instanceof Position) {\n return pos;\n }\n\n var posObject = new Position(pos);\n\n if (pos && pos.relativeTo) {\n const position = callback(pos.relativeTo);\n if (position) {\n posObject.relativeTo(position);\n }\n }\n\n return posObject;\n }\n }\n\n exports.default = Position;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports);\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports);\n global.EventEmitter = mod.exports;\n }\n})(this, function (module, exports) {\n /*!\n * EventEmitter v4.2.9 - git.io/ee\n * Oliver Caldwell\n * MIT license\n * @preserve\n */\n\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n } else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n } else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n } else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n } else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n } else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listeners = this.getListenersAsObject(evt);\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n i = listeners[key].length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[key][i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n } else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n exports.default = EventEmitter;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(7), __webpack_require__(0), __webpack_require__(4)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../dependencies/eventEmitter/EventEmitter.js'), require('../graph.util.js'), require('../util/waveform.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.EventEmitter, global.graphUtil, global.waveform);\n global.graphSerie = mod.exports;\n }\n})(this, function (module, exports, _EventEmitter, _graphUtil, _waveform) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _EventEmitter2 = _interopRequireDefault(_EventEmitter);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _waveform2 = _interopRequireDefault(_waveform);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Serie class to be extended\n * @static\n */\n class Serie extends _EventEmitter2.default {\n\n static default() {\n\n return {\n redrawShapesAfterDraw: false\n };\n }\n\n constructor(graph, name, options) {\n\n super(...arguments);\n this.graph = graph;\n this.name = name;\n this.options = Object.assign({}, Serie.default(), this.constructor.default(), options);\n\n //if( new.target.default ) {\n //console.log( new.target.default() );\n //}\n }\n\n draw() {}\n\n beforeDraw() {}\n\n afterDraw() {\n\n if (this.options.redrawShapesAfterDraw) {\n this.graph.getShapesOfSerie(this).forEach(shape => {\n shape.redraw();\n });\n }\n\n this.emit('draw');\n }\n\n /**\n * Sets data to the serie\n * @memberof Serie\n * @param {(Object|Array|Array[])} data - The data of the serie\n * @param {Boolean} [ oneDimensional=false ] - In some cases you may need to force the 1D type. This is required when one uses an array or array to define the data (see examples)\n * @param{String} [ type=float ] - Specify the type of the data. Use int to save memory (half the amount of bytes allocated to the data).\n * @example serie.setData( [ [ x1, y1 ], [ x2, y2 ], ... ] );\n * @example serie.setData( [ x1, y1, x2, y2, ... ] ); // Faster\n * @example serie.setData( [ [ x1, y1, x2, y2, ..., xn, yn ] , [ xm, ym, x(m + 1), y(m + 1), ...] ], true ) // 1D array with a gap in the middle\n * @example serie.setData( { x: x0, dx: spacing, y: [ y1, y2, y3, y4 ] } ); // Data with equal x separation. Fastest way\n */\n setData(data, oneDimensional, type) {\n\n if (data instanceof _waveform2.default) {\n return this.setWaveform(data);\n }\n\n throw 'Setting data other than waveforms in not supported by default. You must implemented this method in the inherited class.';\n }\n\n _addData(type, howmany) {\n return [];\n }\n\n /**\n * Removes all the data from the serie, without redrawing\n * @returns {Serie} The current serie\n */\n clearData() {\n this.setData(new _waveform2.default());\n return this;\n }\n\n /**\n * Returns the data in its current form\n * @returns {Array.<(Float64Array|Int32Array)>} An array containing the data chunks. Has only one member if the data has no gaps\n * @memberof Serie\n */\n getData() {\n return this.data;\n }\n\n /**\n * Sets the options of the serie (no extension of default options)\n * @param {Object} options - The options of the serie\n * @memberof Serie\n */\n setOptions(options) {\n this.options = options || {};\n }\n\n /**\n * Sets the options of the serie (no extension of default options)\n * @param {String} name - The option name\n * @param value - The option value\n * @memberof Serie\n * @example serie.setOption('selectableOnClick', true );\n */\n setOption(name, value) {\n this.options[name] = value;\n }\n\n /**\n * Removes the serie from the graph. The method doesn't perform any axis autoscaling or repaint of the graph. This should be done manually.\n * @return {Serie} The current serie instance\n * @memberof Serie\n */\n kill(noLegendUpdate) {\n\n this.graph.removeSerieFromDom(this);\n this.graph._removeSerie(this);\n\n if (this.graph.legend && !noLegendUpdate) {\n\n this.graph.legend.update();\n }\n\n this.graph = undefined;\n return this;\n }\n\n /**\n * Hides the serie\n * @memberof Serie\n * @param {Boolean} [ hideShapes = false ] - true to hide the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n hide(hideShapes, mute = false) {\n\n this.hidden = true;\n this.groupMain.setAttribute('display', 'none');\n\n this.getSymbolForLegend().setAttribute('opacity', 0.5);\n this.getTextForLegend().setAttribute('opacity', 0.5);\n\n this.hideImpl();\n\n if (hideShapes) {\n var shapes = this.graph.getShapesOfSerie(this);\n for (var i = 0, l = shapes.length; i < l; i++) {\n shapes[i].hide();\n }\n }\n\n if (!mute) {\n this.emit('hide');\n }\n\n if (this.getXAxis().doesHideWhenNoSeriesShown() || this.getYAxis().doesHideWhenNoSeriesShown()) {\n this.graph.draw(true);\n }\n\n return this;\n }\n\n /**\n * Shows the serie\n * @memberof Serie\n * @param {Boolean} [showShapes=false] - true to show the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n show(showShapes, mute = false) {\n\n this.hidden = false;\n this.groupMain.setAttribute('display', 'block');\n\n this.getSymbolForLegend().setAttribute('opacity', 1);\n this.getTextForLegend().setAttribute('opacity', 1);\n\n this.showImpl();\n\n this.draw(true);\n\n if (showShapes) {\n var shapes = this.graph.getShapesOfSerie(this);\n for (var i = 0, l = shapes.length; i < l; i++) {\n shapes[i].show();\n }\n }\n\n if (!mute) {\n this.emit('show');\n }\n\n if (this.getXAxis().doesHideWhenNoSeriesShown() || this.getYAxis().doesHideWhenNoSeriesShown()) {\n this.graph.draw(true);\n }\n return this;\n }\n\n hideImpl() {}\n showImpl() {}\n\n /**\n * Toggles the display of the serie (effectively, calls .show() and .hide() alternatively on each call)\n * @memberof Serie\n * @param {Boolean} [hideShapes=false] - true to hide the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n toggleDisplay() {\n\n if (!this.isShown()) {\n this.show();\n } else {\n this.hide();\n }\n\n return this;\n }\n\n /**\n * Determines if the serie is currently visible\n * @memberof Serie\n * @returns {Boolean} The current visibility status of the serie\n */\n isShown() {\n return !this.hidden;\n }\n\n /**\n * Checks that axes assigned to the serie have been defined and have proper values\n * @memberof Serie\n */\n axisCheck() {\n\n if (!this.getXAxis() || !this.getYAxis()) {\n throw 'No axis exist for this serie. Check that they were properly assigned';\n }\n\n if (isNaN(this.getXAxis().getCurrentMin()) || isNaN(this.getXAxis().getCurrentMax()) || isNaN(this.getYAxis().getCurrentMin()) || isNaN(this.getYAxis().getCurrentMax())) {\n throw 'Axis min and max values are not defined. Try autoscaling';\n }\n }\n /**\n * Returns the x position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The x position in px corresponding to the x value\n */\n getX(val) {\n return (val = this.getXAxis().getPx(val)) - val % 0.2;\n }\n\n /**\n * Returns the y position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The y position in px corresponding to the y value\n */\n getY(val) {\n return (val = this.getYAxis().getPx(val)) - val % 0.2;\n }\n\n /**\n * Returns the selection state of the serie. Generic for most serie types\n * @memberof Serie\n * @returns {Boolean} true if the serie is selected, false otherwise\n */\n isSelected() {\n return this.selected || this.selectionType !== 'unselected';\n }\n\n _checkX(val) {\n this.minX = Math.min(this.minX, val);\n this.maxX = Math.max(this.maxX, val);\n }\n\n _checkY(val) {\n this.minY = Math.min(this.minY, val);\n this.maxY = Math.max(this.maxY, val);\n }\n\n /**\n * Getter for the serie name\n * @memberof Serie\n * @returns {String} The serie name\n */\n getName() {\n return this.name;\n }\n\n /* AXIS */\n\n /**\n * Assigns axes automatically, based on {@link Graph#getXAxis} and {@link Graph#getYAxis}.\n * @memberof Serie\n * @returns {Serie} The current serie\n */\n autoAxis() {\n\n if (this.isFlipped()) {\n\n this.setXAxis(this.graph.getYAxis());\n this.setYAxis(this.graph.getXAxis());\n } else {\n\n this.setXAxis(this.graph.getXAxis());\n this.setYAxis(this.graph.getYAxis());\n }\n\n // After axes have been assigned, the graph axes should update their min/max\n this.graph.updateDataMinMaxAxes();\n return this;\n }\n\n autoAxes() {\n return this.autoAxis(...arguments);\n }\n\n /**\n * Assigns an x axis to the serie\n * @memberof Serie\n * @param {Axis|Number} axis - The axis to use as an x axis. If an integer, {@link Graph#getXAxis} or {@link Graph#getYAxis} will be used\n * @returns {Serie} The current serie\n * @example serie.setXAxis( graph.getTopAxis( 1 ) ); // Assigns the second top axis to the serie\n */\n setXAxis(axis) {\n\n if (typeof axis == 'number') {\n this.xaxis = this.isFlipped() ? this.graph.getYAxis(axis) : this.graph.getXAxis(axis);\n } else {\n this.xaxis = axis;\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Assigns an y axis to the serie\n * @memberof Serie\n * @param {Axis|Number} axis - The axis to use as an y axis. If an integer, {@link Graph#getXAxis} or {@link Graph#getYAxis} will be used\n * @returns {Serie} The current serie\n * @example serie.setYAxis( graph.getLeftAxis( 4 ) ); // Assigns the 5th left axis to the serie\n */\n setYAxis(axis) {\n if (typeof axis == 'number') {\n this.xaxis = this.isFlipped() ? this.graph.getXAxis(axis) : this.graph.getYAxis(axis);\n } else {\n this.yaxis = axis;\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Assigns two axes to the serie\n * @param {GraphAxis} axis1 - First axis to assign to the serie (x or y)\n * @param {GraphAxis} axis2 - Second axis to assign to the serie (y or x)\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setAxes() {\n\n for (var i = 0; i < 2; i++) {\n\n if (arguments[i]) {\n this[arguments[i].isX() ? 'setXAxis' : 'setYAxis'](arguments[i]);\n }\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * @returns {GraphAxis} The x axis assigned to the serie\n * @memberof Serie\n */\n getXAxis() {\n return this.xaxis;\n }\n\n /**\n * @returns {GraphAxis} The y axis assigned to the serie\n * @memberof Serie\n */\n getYAxis() {\n return this.yaxis;\n }\n\n /* */\n\n /* DATA MIN MAX */\n\n /**\n * @returns {Number} Lowest x value of the serie's data\n * @memberof Serie\n */\n getMinX() {\n return this.minX;\n }\n\n /**\n * @returns {Number} Highest x value of the serie's data\n * @memberof Serie\n */\n getMaxX() {\n return this.maxX;\n }\n\n /**\n * @returns {Number} Lowest y value of the serie's data\n * @memberof Serie\n */\n getMinY() {\n return this.minY;\n }\n\n /**\n * @returns {Number} Highest y value of the serie's data\n * @memberof Serie\n */\n getMaxY() {\n return this.maxY;\n }\n\n getWaveform() {\n return this.waveform;\n }\n\n getWaveforms() {\n return [this.waveform];\n }\n\n setWaveform(waveform) {\n\n if (!(waveform instanceof _waveform2.default)) {\n throw 'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance';\n }\n\n this.waveform = waveform;\n\n this.minX = this.waveform.getXMin();\n this.maxX = this.waveform.getXMax();\n this.minY = this.waveform.getMin();\n this.maxY = this.waveform.getMax();\n\n this.graph.updateDataMinMaxAxes();\n this.dataHasChanged();\n\n return this;\n }\n\n /**\n * Computes and returns a line SVG element with the same line style as the serie, or width 20px\n * @returns {SVGElement}\n * @memberof Serie\n */\n getSymbolForLegend() {\n\n if (!this.lineForLegend) {\n\n var line = document.createElementNS(this.graph.ns, 'line');\n this.applyLineStyle(line);\n\n line.setAttribute('x1', 5);\n line.setAttribute('x2', 25);\n line.setAttribute('y1', 0);\n line.setAttribute('y2', 0);\n\n line.setAttribute('cursor', 'pointer');\n\n this.lineForLegend = line;\n }\n\n return this.lineForLegend;\n }\n\n /**\n * Explicitely applies the line style to the SVG element returned by {@link Serie#getSymbolForLegend}\n * @see Serie#getSymbolForLegend\n * @returns {SVGElement}\n * @memberof Serie\n */\n setLegendSymbolStyle() {\n this.applyLineStyle(this.getSymbolForLegend());\n }\n\n /**\n * @alias Serie#setLegendSymbolStyle\n * @memberof Serie\n */\n updateStyle() {\n this.setLegendSymbolStyle();\n this.graph.updateLegend();\n }\n\n /**\n * Computes and returns a text SVG element with the label of the serie as a text, translated by 35px\n * @returns {SVGElement}\n * @memberof Serie\n * @see Serie#getLabel\n */\n getTextForLegend() {\n\n if (!this.textForLegend) {\n\n var text = document.createElementNS(this.graph.ns, 'text');\n text.setAttribute('cursor', 'pointer');\n text.textContent = this.getLabel();\n\n this.textForLegend = text;\n }\n\n return this.textForLegend;\n }\n\n /**\n * @returns {Number} The current index of the serie\n * @memberof Serie\n */\n getIndex() {\n return this.graph.series.indexOf(this);\n }\n\n /**\n * @returns {String} The label or, alternatively - the name of the serie\n * @memberof Serie\n */\n getLabel() {\n return this.options.label || this.name;\n }\n\n /**\n * Sets the label of the serie. Note that this does not automatically updates the legend\n * @param {String} label - The new label of the serie\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setLabel(label) {\n this.options.label = label;\n\n if (this.textForLegend) {\n this.textForLegend.textContent = label;\n }\n\n this.graph.requireLegendUpdate();\n return this;\n }\n\n /* FLIP */\n\n /**\n * Assigns the flipping value of the serie. A flipped serie will have inverted axes. However this method does not automatically re-assigns the axes of the serie. Call {@link Serie#autoAxis} to re-assign the axes automatically, or any other axis setting method.\n * @param {Boolean} [flipped=false] - true to flip the serie\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setFlip(flipped) {\n this.options.flip = flipped;\n return this;\n }\n\n /**\n * @returns {Boolean} true if the serie is flipped, false otherwise\n * @memberof Serie\n */\n getFlip() {\n return this.options.flip;\n }\n\n /**\n * @alias Serie#getFlip\n * @memberof Serie\n */\n isFlipped() {\n return this.options.flip;\n }\n\n /**\n * Sets the layer onto which the serie should be displayed. This method does not trigger a graph redraw.\n * @memberof Serie\n * @param {Number} layerIndex=1 - The index of the layer into which the serie will be drawn\n * @returns {Serie} The current serie\n */\n setLayer(layerIndex) {\n let newLayer = parseInt(layerIndex) || 1;\n\n if (newLayer !== this.options.layer) {\n this.options.layer = newLayer;\n this.graph.appendSerieToDom(this);\n }\n\n return this;\n }\n\n /**\n * Sets the layer onto which the serie should be displayed. This method does not trigger a graph redraw.\n * @memberof Serie\n * @returns {Nunber} The index of the layer into which the serie will be drawn\n */\n getLayer() {\n return this.options.layer || 1;\n }\n\n setStyle(style, selectionType = 'unselected') {\n this.styles[selectionType] = style;\n this.styleHasChanged(selectionType);\n }\n\n /**\n * Notifies jsGraph that the style of the serie has changed and needs to be redrawn on the next repaint\n * @param {String} selectionType - The selection for which the style may have changed\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n styleHasChanged(selectionType = 'unselected') {\n this._changedStyles = this._changedStyles || {};\n\n if (selectionType === false) {\n for (var i in this._changedStyles) {\n this._changedStyles[i] = false;\n }\n } else {\n this._changedStyles[selectionType || 'unselected'] = true;\n }\n\n this.graph.requireLegendUpdate();\n return this;\n }\n\n /**\n * Checks if the style has changed for a selection type\n * @param {String} selectionType - The selection for which the style may have changed\n * @returns {Boolean} true if the style has changed\n * @private\n * @memberof Serie\n */\n hasStyleChanged(selectionType) {\n this._changedStyles = this._changedStyles || {};\n return this._changedStyles[selectionType || 'unselected'];\n }\n\n /**\n * Notifies jsGraph that the data of the serie has changed\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n dataHasChanged(arg) {\n this._dataHasChanged = arg === undefined || arg;\n return this;\n }\n\n /**\n * Checks if the data has changed\n * @returns {Boolean} true if the data has changed\n * @private\n * @memberof Serie\n */\n hasDataChanged() {\n return this._dataHasChanged;\n }\n\n /**\n * Set a key/value arbitrary information to the serie. It is particularly useful if you have this serie has a reference through an event for instance, and you want to retrieve data associated to it\n * @param {String} prop - The property\n * @param value - The value\n * @returns {Serie} The current serie\n * @see Serie#getInfo\n * @memberof Serie\n */\n setInfo(prop, value) {\n this.infos = this.infos || {};\n this.infos[prop] = value;\n return this;\n }\n\n /**\n * Retrives an information value from its key\n * @param {String} prop - The property\n * @returns The value associated to the prop parameter\n * @see Serie#setInfo\n * @memberof Serie\n */\n getInfo(prop, value) {\n return (this.infos || {})[prop];\n }\n\n /**\n * @deprecated\n * @memberof Serie\n */\n setAdditionalData(data) {\n this.additionalData = data;\n return this;\n }\n\n /**\n * @deprecated\n * @memberof Serie\n */\n getAdditionalData() {\n return this.additionalData;\n }\n\n /**\n * Flags the serie as selected\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n select() {\n this.selected = true;\n return this;\n }\n\n /**\n * Flags the serie as unselected\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n unselect() {\n this.selected = false;\n return this;\n }\n\n /**\n * Allows mouse tracking of the serie\n * @memberof Serie\n * @returns {Serie} The current serie\n * @param {Function} hoverCallback - Function to be called when the mouse enters the serie area\n * @param {Function} outCallback - Function to be called when the mouse exits the serie area\n * @private\n */\n enableTracking(hoverCallback, outCallback) {\n this._tracker = true;\n this._trackingCallback = hoverCallback;\n this._trackingOutCallback = outCallback;\n\n return this;\n }\n\n /**\n * Disables mouse tracking of the serie\n * @memberof Serie\n * @returns {Serie} The current serie\n * @private\n */\n disableTracking() {\n\n if (this._trackerDom) {\n this._trackerDom.remove();\n this._trackerDom = null;\n }\n\n this._tracker = false;\n this._trackingCallback = null;\n return this;\n }\n\n /**\n * Allows mouse tracking of the serie\n * @memberof Serie\n * @param {Object} options - The tracking line options\n * @returns {Serie} The current serie\n */\n allowTrackingLine(options) {\n\n options = options || {};\n this.graph.addSerieToTrackingLine(this, options);\n }\n\n getMarkerForLegend() {\n return false;\n }\n\n get type() {\n return this._type;\n }\n\n getType() {\n return this._type;\n }\n\n set excludedFromLegend(bln) {\n this._excludedFromLegend = bln;\n }\n\n get excludedFromLegend() {\n return !!this._excludedFromLegend;\n }\n\n setDataIndices(categories, nb) {\n this.categoryIndices = categories;\n this.nbCategories = nb;\n }\n\n hasErrors() {\n if (!this.waveform) {\n return false;\n }\n\n return this.waveform.hasErrorBars();\n }\n }\n\n exports.default = Serie;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(3), __webpack_require__(7), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.core.js'), require('./dependencies/eventEmitter/EventEmitter.js'), require('./graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphCore, global.EventEmitter, global.graphUtil);\n global.graphAxis = mod.exports;\n }\n})(this, function (module, exports, _graphCore, _EventEmitter, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphCore2 = _interopRequireDefault(_graphCore);\n\n var _EventEmitter2 = _interopRequireDefault(_EventEmitter);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Default graph parameters\n * @name AxisOptionsDefault\n * @object\n * @static\n * @memberof Axis\n * @prop {Boolean} display - Whether to display or not the axis\n * @prop {Boolean} flipped - Flips the axis (maximum and minimum will be inverted)\n * @prop {Numner} axisDataSpacing.min - The spacing of the at the bottom of the axis. The value is multiplied by the (max - min) values given by the series (0.1 means 10% of the serie width / height).\n * @prop {Number} axisDataSpacing.max - The spacing of the at the top of the axis. The value is multiplied by the (max - min) values given by the series (0.1 means 10% of the serie width / height).\n * @prop {String} unitModification - Used to change the units of the axis in a defined way. Currently, \"time\" and \"time:min.sec\" are supported. They will display the value in days, hours, minutes and seconds and the data should be expressed in seconds.\n * @prop {Boolean} primaryGrid - Whether or not to display the primary grid (on the main ticks)\n * @prop {Boolean} secondaryGrid - Whether or not to display the secondary grid (on the secondary ticks)\n * @prop {Number} tickPosition - Sets the position of the ticks with regards to the axis ( 1 = inside, 2 = centered, 3 = outside ).\n * @prop {Number} nbTicksPrimary - The number of primary ticks to use (approximately)\n * @prop {Number} nbTicksSecondary - The number of secondary ticks to use (approximately)\n * @prop {Number} ticklabelratio - Scaling factor on the labels under each primary ticks\n * @prop {Number} exponentialFactor - Scales the labels under each primary ticks by 10^(exponentialFactor)\n * @prop {Number} exponentialLabelFactor - Scales the axis label by 10^(exponentialFactor)\n * @prop {Boolean} logScale - Display the axis in log scale (base 10)\n * @prop {(Number|Boolean)} forcedMin - Use a number to force the minimum value of the axis (becomes independant of its series)\n * @prop {(Number|Boolean)} forcedMax - Use a number to force the maximum value of the axis (becomes independant of its series)\n */\n const defaults = {\n lineAt: false,\n display: true,\n flipped: false,\n axisDataSpacing: {\n min: 0.1,\n max: 0.1\n },\n unitModification: false,\n primaryGrid: true,\n secondaryGrid: true,\n\n primaryGridColor: '#f0f0f0',\n secondaryGridColor: '#f0f0f0',\n\n primaryGridWidth: 1,\n secondaryGridWidth: 1,\n\n hideWhenNoSeriesShown: false,\n shiftToZero: false,\n tickPosition: 1,\n nbTicksPrimary: 3,\n nbTicksSecondary: 10,\n ticklabelratio: 1,\n exponentialFactor: 0,\n exponentialLabelFactor: 0,\n logScale: false,\n forcedMin: false,\n forcedMax: false,\n\n span: [0, 1],\n marginMin: 0,\n marginMax: 0,\n\n scientificScale: false,\n scientificScaleExponent: false,\n engineeringScale: false,\n\n unitInTicks: false,\n unit: false,\n unitWrapperBefore: '',\n unitWrapperAfter: '',\n\n splitMarks: false,\n\n tickLabelOffset: 0,\n\n useKatexForLabel: false\n };\n\n /**\n * Axis constructor. Usually not instanced directly, but for custom made axes, that's possible\n * @class Axis\n * @static\n * @augments EventEmitter\n * @example function myAxis() {};\n * myAxis.prototype = new Graph.getConstructor(\"axis\");\n * graph.setBottomAxis( new myAxis( { } ) );\n */\n class Axis extends _EventEmitter2.default {\n\n constructor() {\n\n super();\n }\n\n init(graph, options, overwriteoptions) {\n\n this.unitModificationTimeTicks = [[1, [1, 2, 5, 10, 20, 30]], [60, [1, 2, 5, 10, 20, 30]], [3600, [1, 2, 6, 12]], [3600 * 24, [1, 2, 3, 4, 5, 10, 20, 40]]];\n\n this.graph = graph;\n this.options = util.extend(true, {}, defaults, overwriteoptions, options);\n\n this.group = document.createElementNS(this.graph.ns, 'g');\n this.hasChanged = true;\n\n this.rectEvent = document.createElementNS(this.graph.ns, 'rect');\n this.rectEvent.setAttribute('pointer-events', 'fill');\n this.rectEvent.setAttribute('fill', 'transparent');\n this.group.appendChild(this.rectEvent);\n\n this.graph.axisGroup.appendChild(this.group); // Adds to the main axiszone\n\n // Lines at a certain value\n this._lines = [];\n\n this.line = document.createElementNS(this.graph.ns, 'line');\n this.line.setAttribute('stroke', 'black');\n this.line.setAttribute('shape-rendering', 'crispEdges');\n this.line.setAttribute('stroke-linecap', 'square');\n this.groupTicks = document.createElementNS(this.graph.ns, 'g');\n this.groupTickLabels = document.createElementNS(this.graph.ns, 'g');\n\n this.group.appendChild(this.groupTicks);\n this.group.appendChild(this.groupTickLabels);\n this.group.appendChild(this.line);\n\n this.label = document.createElementNS(this.graph.ns, 'text');\n\n this.labelTspan = document.createElementNS(this.graph.ns, 'tspan'); // Contains the main label\n this.preunit = ''; //document.createElementNS( this.graph.ns, 'tspan' ); // Contains the scaling unit\n this.unitTspan = document.createElementNS(this.graph.ns, 'tspan'); // Contains the unit\n this.expTspan = document.createElementNS(this.graph.ns, 'tspan'); // Contains the exponent (x10)\n this.expTspanExp = document.createElementNS(this.graph.ns, 'tspan'); // Contains the exponent value\n\n this.label.appendChild(this.labelTspan);\n //this.label.appendChild( this.preunitTspan );\n this.label.appendChild(this.unitTspan);\n this.label.appendChild(this.expTspan);\n this.label.appendChild(this.expTspanExp);\n\n this.expTspan.setAttribute('dx', 6);\n this.expTspanExp.setAttribute('dy', -5);\n this.expTspanExp.setAttribute('font-size', '0.8em');\n\n this.label.setAttribute('text-anchor', 'middle');\n\n this.setTickPosition(this.options.tickPosition);\n\n this.gridLinePath = {\n primary: '',\n secondary: ''\n };\n\n this.gridPrimary = document.createElementNS(this.graph.ns, 'path');\n this.gridSecondary = document.createElementNS(this.graph.ns, 'path');\n\n this.graph.groupPrimaryGrids.appendChild(this.gridPrimary);\n this.graph.groupSecondaryGrids.appendChild(this.gridSecondary);\n\n this.setGridLinesStyle();\n\n this.group.appendChild(this.label);\n\n this.groupSeries = document.createElementNS(this.graph.ns, 'g');\n this.group.appendChild(this.groupSeries);\n\n this.widthHeightTick = 0;\n\n this.ticks = {};\n this.ticksLabels = [];\n this.tickScaling = {\n 1: 3,\n 2: 2,\n 3: 1,\n 4: 0.5\n };\n\n this.currentTick = {};\n this.lastCurrentTick = {};\n\n this.series = [];\n this.totalDelta = 0;\n this.currentAction = false;\n\n this.group.addEventListener('mousemove', e => {\n e.preventDefault();\n var coords = this.graph._getXY(e);\n this.handleMouseMoveLocal(coords.x, coords.y, e);\n\n for (var i = 0, l = this.series.length; i < l; i++) {\n this.series[i].handleMouseMove(false, true);\n }\n });\n\n this.labels = [];\n this.group.addEventListener('click', e => {\n e.preventDefault();\n var coords = this.graph._getXY(e);\n this.addLabel(this.getVal(coords.x - this.graph.getPaddingLeft()));\n });\n\n //this.clip = document.createElementNS( this.graph.ns, 'clipPath' );\n //this.clip.setAttribute( 'id', '_clip' + this.axisRand );\n //this.graph.defs.appendChild( this.clip );\n /*\n this.clipRect = document.createElementNS( this.graph.ns, 'rect' );\n this.clip.appendChild( this.clipRect );\n this.clip.setAttribute( 'clipPathUnits', 'userSpaceOnUse' );\n */\n this.gridPrimary.setAttribute('clip-path', 'url(#_clipplot' + this.graph._creation + ')');\n this.gridSecondary.setAttribute('clip-path', 'url(#_clipplot' + this.graph._creation + ')');\n this.graph._axisHasChanged(this);\n }\n\n handleMouseMoveLocal() {}\n\n /**\n * Hides the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n hide() {\n this.options.display = false;\n return this;\n }\n\n /**\n * Shows the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n show() {\n this.options.display = true;\n return this;\n }\n\n /**\n * Shows or hides the axis\n * @memberof Axis\n * @param {Boolean} display - true to display the axis, false to hide it\n * @return {Axis} The current axis\n */\n setDisplay(bool) {\n this.options.display = !!bool;\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Boolean} A boolean indicating the displayed state of the axis\n */\n isDisplayed() {\n\n if (!this.options.hideWhenNoSeriesShown) {\n return this.options.display;\n }\n\n return this.graph.getSeriesFromAxis(this).reduce((accumulator, serie) => {\n return accumulator || serie.isShown();\n }, false);\n }\n\n isShown() {\n\n return this.isDisplayed(...arguments);\n }\n\n hideGroup() {\n if (this._hidden) {\n return;\n }\n this._hidden = true;\n this.group.setAttribute('display', 'none');\n }\n\n showGroup() {\n if (!this._hidden) {\n return;\n }\n this._hidden = false;\n this.group.setAttribute('display', 'initial');\n }\n\n kill(noRedraw, noSerieKill) {\n this.graph.killAxis(this, noRedraw, noSerieKill);\n }\n /**\n * Forces the appearence of a straight perpendicular line at value 0\n * @param {Array} atValues - An array of x or y values where the lines are displayed\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setLineAt(atValues) {\n this.options.lineAt = atValues;\n return this;\n }\n\n // Used to adapt the 0 of the axis to the zero of another axis that has the same direction\n\n /**\n * Aligns ```thisValue``` of the axis to ```foreignValue``` of another axis\n * @param {(Axis|Boolean)} axis - The axis with which the 0 should be aligned. Use \"false\" to deactivate the adapt to 0 mode.\n * @param {Number} thisValue - The value of the current axis that should be aligned\n * @param {Number} foreignValue - The value of the reference axis that should be aligned\n * @param {String} preference - \"min\" or \"max\". Defined the boundary that should behave the more normally\n * @memberof Axis\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n adaptTo(axis, thisValue, foreignValue, preference) {\n\n if (!axis) {\n this.options.adaptTo = false;\n return this;\n }\n\n this.options.adaptTo = {\n axis: axis,\n thisValue: thisValue,\n foreignValue: foreignValue,\n preference: preference\n };\n\n this.adapt();\n\n return this;\n }\n\n /**\n * Adapts maximum and minimum of the axis if options.adaptTo is defined\n * @memberof Axis\n * @returns {Axis} The current axis\n * @since 1.13.2\n */\n adapt() {\n\n if (!this.options.adaptTo) {\n return;\n }\n\n var axis = this.options.adaptTo.axis,\n current = this.options.adaptTo.thisValue,\n foreign = this.options.adaptTo.foreignValue;\n\n if (axis.currentAxisMin === undefined || axis.currentAxisMax === undefined) {\n axis.setMinMaxToFitSeries();\n }\n\n if (this.options.forcedMin !== false && this.options.forcedMax == false || this.options.adaptTo.preference !== 'max') {\n\n if (this.options.forcedMin !== false) {\n this.currentAxisMin = this.options.forcedMin;\n } else {\n this.currentAxisMin = this._zoomed ? this.getCurrentMin() : this.getMinValue() - (current - this.getMinValue()) * (this.options.axisDataSpacing.min * (axis.getCurrentMax() - axis.getCurrentMin()) / (foreign - axis.getCurrentMin()));\n }\n\n if (this.currentAxisMin == current) {\n this.currentAxisMin -= this.options.axisDataSpacing.min * this.getInterval();\n }\n\n var use = this.options.forcedMin !== false ? this.options.forcedMin : this.currentAxisMin;\n this.currentAxisMax = (current - use) * (axis.getCurrentMax() - axis.getCurrentMin()) / (foreign - axis.getCurrentMin()) + use;\n } else {\n\n if (this.options.forcedMax !== false) {\n this.currentAxisMax = this.options.forcedMax;\n } else {\n this.currentAxisMax = this._zoomed ? this.getCurrentMax() : this.getMaxValue() + (this.getMaxValue() - current) * (this.options.axisDataSpacing.max * (axis.getCurrentMax() - axis.getCurrentMin()) / (axis.getCurrentMax() - foreign));\n }\n\n if (this.currentAxisMax == current) {\n this.currentAxisMax += this.options.axisDataSpacing.max * this.getInterval();\n }\n\n var use = this.options.forcedMax !== false ? this.options.forcedMax : this.currentAxisMax;\n\n this.currentAxisMin = (current - use) * (axis.getCurrentMin() - axis.getCurrentMax()) / (foreign - axis.getCurrentMax()) + use;\n }\n\n this.graph._axisHasChanged(this);\n }\n\n // Floating axis. Adapts axis position orthogonally to another axis at a defined value. Not taken into account for margins\n\n /**\n * Makes the axis floating (not aligned to the right or the left anymore). You need to specify another axis (perpendicular) and a value at which this axis should be located\n * @param {Axis} axis - The axis on which the current axis should be aligned to\n * @param {Number} value - The value on which the current axis should be aligned\n * @memberof Axis\n * @return {Axis} The current axis\n * @example graph.getYAxis().setFloat( graph.getBottomAxis(), 0 ); // Alignes the y axis with the origin of the bottom axis\n */\n setFloating(axis, value) {\n\n this.floating = true;\n this.floatingAxis = axis;\n this.floatingValue = value;\n\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Axis} The axis referencing the floating value of the current axis\n */\n getFloatingAxis() {\n return this.floatingAxis;\n }\n\n /**\n * @memberof Axis\n * @return {Axis} The value to which the current axis is aligned to\n */\n getFloatingValue() {\n return this.floatingValue;\n }\n\n /**\n * Sets the axis data spacing\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} min - The spacing at the axis min value\n * @param {Number} [ max = min ] - The spacing at the axis max value. If omitted, will be equal to the \"min\" parameter\n * @return {Axis} The current axis\n */\n setAxisDataSpacing(val1, val2) {\n this.options.axisDataSpacing.min = val1;\n this.options.axisDataSpacing.max = val2 || val1;\n return this;\n }\n\n dataSpacing() {\n return this.setAxisDataSpacing(...arguments);\n }\n\n /**\n * Sets the axis data spacing at the minimum of the axis\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} min - The spacing at the axis min value\n * @return {Axis} The current axis\n */\n setAxisDataSpacingMin(val) {\n this.options.axisDataSpacing.min = val;\n }\n\n /**\n * Sets the axis data spacing at the maximum of the axis\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} max - The spacing at the axis max value\n * @return {Axis} The current axis\n */\n setAxisDataSpacingMax(val) {\n this.options.axisDataSpacing.max = val;\n }\n\n setMinPx(px) {\n\n this.minPx = px;\n this.setMinMaxFlipped();\n }\n\n setMaxPx(px) {\n\n this.maxPx = px;\n this.setMinMaxFlipped();\n }\n\n /**\n * @memberof Axis\n * @return {Number} The position in px of the bottom of the axis\n */\n getMinPx() {\n return this.minPxFlipped;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The position in px of the top of the axis\n */\n getMaxPx() {\n return this.maxPxFlipped;\n }\n\n getMathMaxPx() {\n return this.maxPx;\n }\n\n getMathMinPx() {\n return this.minPx;\n }\n\n // Returns the true minimum of the axis. Either forced in options or the one from the data\n\n /**\n * Retrieves the minimum possible value of the axis. Can be set by \"forcedMin\", \"adapt0ToAxis\" or by the values of the series the axis contains. Does not take into account any zooming.\n * @memberof Axis\n * @return {Number} The minimum possible value of the axis\n */\n getMinValue() {\n return this.options.forcedMin !== false ? this.options.forcedMin : this.dataMin;\n }\n\n /**\n * Retrieves the maximum possible value of the axis. Can be set by \"forcedMax\", \"adapt0ToAxis\" or by the values of the series the axis contains. Does not take into account any zooming.\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getMaxValue() {\n return this.options.forcedMax !== false ? this.options.forcedMax : this.dataMax;\n }\n\n setMinValueData(min) {\n this.dataMin = min;\n\n // 25.10.2017. This is to help in the case there's no autoscaling\n if (isNaN(this.getCurrentMin())) {\n this.setCurrentMin(this.getMinValue());\n this.cache();\n }\n }\n\n setMaxValueData(max) {\n this.dataMax = max;\n\n // 25.10.2017. This is to help in the case there's no autoscaling\n if (isNaN(this.getCurrentMax())) {\n this.setCurrentMax(this.getMaxValue());\n this.cache();\n }\n }\n\n /**\n * Retrieves the maximum possible value of the axis based only on the data. Does not take into account the possible axis forcing\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getDataMax() {\n return this.dataMax;\n }\n\n /**\n * Retrieves the minimum possible value of the axis based only on the data. Does not take into account the possible axis forcing\n * @memberof Axis\n * @return {Number} The minimum possible value of the axis\n */\n getDataMin() {\n return this.dataMin;\n }\n\n /**\n * Forces the minimum value of the axis (no more dependant on the serie values)\n * @memberof Axis\n * @param {Number} min - The minimum value of the axis\n * @param {Boolean} noRescale - ```true``` to prevent the axis to rescale to set this minimum. Rescales anyway if current min is lower than the value. Defaults to ```false```\n * @return {Axis} The current axis\n */\n forceMin(min, noRescale = false) {\n this.options.forcedMin = min;\n this.setCurrentMin(noRescale ? this.getCurrentMin() : undefined);\n this.graph._axisHasChanged(this);\n return this;\n }\n\n /**\n * Forces the maximum value of the axis (no more dependant on the serie values).\n * @memberof Axis\n * @param {Number} max - The maximum value of the axis\n * @param {Boolean} noRescale - ```true``` to prevent the axis to rescale to set this maximum. Rescales anyway if current max is higher than the value\n * @return {Axis} The current axis\n */\n forceMax(max, noRescale = false) {\n this.options.forcedMax = max;\n this.setCurrentMax(noRescale ? this.getCurrentMax() : undefined);\n this.graph._axisHasChanged(this);\n return this;\n }\n\n /**\n * Retrieves the forced minimum of the axis\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getForcedMin() {\n return this.options.forcedMin;\n }\n\n /**\n * Retrieves the forced minimum of the axis\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getForcedMax() {\n return this.options.forcedMax;\n }\n\n /**\n * Forces the min and max values of the axis to the min / max values of another axis\n * @param {Axis} axis - The axis from which the min / max values are retrieved.\n * @memberof Axis\n * @return {Axis} The current axis\n */\n forceToAxis(axis) {\n if (axis.getMaxValue && axis.getMinValue) {\n this.options.forcedMin = axis.getMinValue();\n this.options.forcedMax = axis.getMaxValue();\n }\n\n return this;\n }\n\n getNbTicksPrimary() {\n return this.options.nbTicksPrimary;\n }\n\n setNbTicksPrimary(nb) {\n this.options.nbTicksPrimary = nb;\n }\n\n getNbTicksSecondary() {\n return this.options.nbTicksSecondary;\n }\n\n setNbTicksSecondary(nb) {\n this.options.nbTicksSecondary = nb;\n return this;\n }\n\n handleMouseMove(px) {\n this.mouseVal = this.getVal(px);\n }\n\n handleMouseWheel(delta, e, baseline) {\n\n delta = Math.min(0.2, Math.max(-0.2, delta));\n\n if (baseline == 'min') {\n baseline = this.getMinValue();\n } else if (baseline == 'max') {\n baseline = this.getMaxValue();\n } else if (!baseline) {\n baseline = 0;\n }\n\n this._doZoomVal((this.getCurrentMax() - baseline) * (1 + delta) + baseline, (this.getCurrentMin() - baseline) * (1 + delta) + baseline);\n\n this.graph.draw();\n //\tthis.graph.drawSeries(true);\n }\n\n set zoomLock(bln) {\n this._zoomLocked = bln;\n }\n\n get zoomLock() {\n return this._zoomLocked || false;\n }\n\n /**\n * Performs a zoom on the axis, without redraw afterwards\n * @param {Number} val1 - The new axis minimum\n * @param {Number} val2 - The new axis maximum\n * @memberof Axis\n * @return {Axis} The current axis\n * @example\n * graph.getBottomAxis().zoom( 50, 70 ); // Axis boundaries will be 50 and 70 after next redraw\n * graph.redraw();\n * @example\n * graph.getBottomAxis().forceMin( 0 ).forceMax( 100 ).zoom( 50, 70 ); // Axis boundaries will be 50 and 70 after next redraw\n * graph.draw();\n * graph.autoscaleAxes(); // New bottom axis boundaries will be 0 and 100, not 50 and 70 !\n * graph.draw();\n */\n zoom(val1, val2, forceLock) {\n\n if (!forceLock && this.zoomLock) {\n return;\n }\n\n return this._doZoomVal(val1, val2, true);\n }\n\n _doZoomVal(val1, val2, mute) {\n\n return this._doZoom(this.getPx(val1), this.getPx(val2), val1, val2, mute);\n }\n\n _doZoom(px1, px2, val1, val2, mute) {\n\n //if(this.options.display || 1 == 1) {\n var val1 = val1 !== undefined ? val1 : this.getVal(px1);\n var val2 = val2 !== undefined ? val2 : this.getVal(px2);\n\n this.setCurrentMin(Math.min(val1, val2));\n this.setCurrentMax(Math.max(val1, val2));\n\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n\n this._zoomed = true;\n\n this.adapt();\n\n this._hasChanged = true;\n\n // New method\n if (!mute) {\n this.emit('zoom', [this.currentAxisMin, this.currentAxisMax, this]);\n }\n\n return this;\n }\n\n getSerieShift() {\n return this._serieShift;\n }\n\n getSerieScale() {\n return this._serieScale;\n }\n\n getMouseVal() {\n return this.mouseVal;\n }\n\n getUnitPerTick(px, nbTick, valrange) {\n\n var pxPerTick = px / nbTicks; // 1000 / 100 = 10 px per tick\n if (!nbTick) {\n nbTick = px / 10;\n } else {\n nbTick = Math.min(nbTick, px / 10);\n }\n\n // So now the question is, how many units per ticks ?\n // Say, we have 0.0004 unit per tick\n var unitPerTick = valrange / nbTick;\n\n switch (this.options.unitModification) {\n\n case 'time':\n case 'time:min.sec':\n {\n\n //const max = this.getModifiedValue( this.getMaxValue() );/*,\n /*units = [\n [ 60, 'min' ],\n [ 3600, 'h' ],\n [ 3600 * 24, 'd' ]\n ];*/\n\n let i, l, k, m;\n let breaked = false;\n for (i = 0, l = this.unitModificationTimeTicks.length; i < l; i++) {\n for (k = 0, m = this.unitModificationTimeTicks[i][1].length; k < m; k++) {\n if (unitPerTick < this.unitModificationTimeTicks[i][0] * this.unitModificationTimeTicks[i][1][k]) {\n breaked = true;\n break;\n }\n }\n if (breaked) {\n break;\n }\n }\n\n //i and k contain the good variable;\n if (i !== this.unitModificationTimeTicks.length) {\n unitPerTickCorrect = this.unitModificationTimeTicks[i][0] * this.unitModificationTimeTicks[i][1][k];\n } else {\n unitPerTickCorrect = 1;\n }\n\n break;\n }\n default:\n {\n\n // We take the log\n var decimals = Math.floor(Math.log(unitPerTick) / Math.log(10));\n /*\n Example:\n 13'453 => Math.log10() = 4.12 => 4\n 0.0000341 => Math.log10() = -4.46 => -5\n */\n\n var numberToNatural = unitPerTick * Math.pow(10, -decimals);\n\n /*\n Example:\n 13'453 (4) => 1.345\n 0.0000341 (-5) => 3.41\n */\n\n this.decimals = -decimals;\n\n var possibleTicks = [1, 2, 5, 10];\n var closest = false;\n for (let i = possibleTicks.length - 1; i >= 0; i--) {\n if (!closest || Math.abs(possibleTicks[i] - numberToNatural) < Math.abs(closest - numberToNatural)) {\n closest = possibleTicks[i];\n }\n }\n\n // Ok now closest is the number of unit per tick in the natural number\n /*\n Example:\n 13'453 (4) (1.345) => 1\n 0.0000341 (-5) (3.41) => 5\n */\n\n // Let's scale it back\n var unitPerTickCorrect = closest * Math.pow(10, decimals);\n\n /*\n Example:\n 13'453 (4) (1.345) (1) => 10'000\n 0.0000341 (-5) (3.41) (5) => 0.00005\n */\n break;\n }\n }\n\n var nbTicks = valrange / unitPerTickCorrect;\n\n var pxPerTick = px / nbTick;\n return [unitPerTickCorrect, nbTicks, pxPerTick];\n }\n\n /**\n * Resets the min and max of the serie to fit the series it contains\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setMinMaxToFitSeries(noNotify) {\n\n var interval = this.getInterval();\n\n if (this.options.logScale) {\n\n this.currentAxisMin = Math.max(1e-50, this.getMinValue() * 0.9);\n this.currentAxisMax = Math.max(1e-50, this.getMaxValue() * 1.1);\n } else {\n\n this.currentAxisMin = this.getMinValue();\n this.currentAxisMax = this.getMaxValue();\n\n if (this.getForcedMin() === false) {\n this.currentAxisMin -= this.options.axisDataSpacing.min * interval;\n }\n\n if (this.getForcedMax() === false) {\n this.currentAxisMax += this.options.axisDataSpacing.max * interval;\n }\n }\n\n if (isNaN(this.currentAxisMin) || isNaN(this.currentAxisMax)) {\n this.currentAxisMax = undefined;\n this.currentAxisMin = undefined;\n }\n\n this.cache();\n\n this._zoomed = false;\n\n this.adapt();\n\n if (!noNotify) {\n this.graph._axisHasChanged(this);\n }\n\n this.emit('zoomOutFull', [this.currentAxisMin, this.currentAxisMax, this]);\n\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Number} the maximum interval ( max - min ) of the axis ( not nessarily the current one )\n */\n getInterval() {\n return this.getMaxValue() - this.getMinValue();\n }\n\n /**\n * @memberof Axis\n * @return {Number} the maximum interval ( max - min ) of the axis ( not nessarily the current one )\n */\n getCurrentInterval() {\n return this.cachedInterval;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The current minimum value of the axis\n */\n getCurrentMin() {\n return this.cachedCurrentMin;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The current maximum value of the axis\n */\n getCurrentMax() {\n return this.cachedCurrentMax;\n }\n\n /**\n * Caches the current axis minimum\n * @memberof Axis\n */\n cacheCurrentMin() {\n this.cachedCurrentMin = this.currentAxisMin == this.currentAxisMax ? this.options.logScale ? this.currentAxisMin / 10 : this.currentAxisMin - 1 : this.currentAxisMin;\n }\n\n /**\n * Caches the current axis maximum\n * @memberof Axis\n */\n cacheCurrentMax() {\n this.cachedCurrentMax = this.currentAxisMax == this.currentAxisMin ? this.options.logScale ? this.currentAxisMax * 10 : this.currentAxisMax + 1 : this.currentAxisMax;\n }\n\n /**\n * Caches the current interval\n * @memberof Axis\n */\n cacheInterval() {\n this.cachedInterval = this.cachedCurrentMax - this.cachedCurrentMin;\n }\n\n cache() {\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n }\n\n /**\n * Sets the current minimum value of the axis. If lower that the forced value, the forced value is used\n * @memberof Axis\n * @param {Number} val - The new minimum value\n * @return {Axis} The current axis\n */\n setCurrentMin(val) {\n\n if (val === undefined || this.getForcedMin() !== false && (val < this.getForcedMin() || val === undefined)) {\n val = this.getMinValue();\n }\n\n this.currentAxisMin = val;\n if (this.options.logScale) {\n this.currentAxisMin = Math.max(1e-50, val);\n }\n\n this.cacheCurrentMin();\n this.cacheInterval();\n\n this.graph._axisHasChanged(this);\n return this;\n }\n\n /**\n * Sets the current maximum value of the axis. If higher that the forced value, the forced value is used\n * @memberof Axis\n * @param {Number} val - The new maximum value\n * @return {Axis} The current axis\n */\n setCurrentMax(val) {\n\n if (val === undefined || this.getForcedMax() !== false && (val > this.getForcedMax() || val === undefined)) {\n val = this.getMaxValue();\n }\n\n this.currentAxisMax = val;\n\n if (this.options.logScale) {\n this.currentAxisMax = Math.max(1e-50, val);\n }\n\n this.cacheCurrentMax();\n this.cacheInterval();\n\n this.graph._axisHasChanged(this);\n }\n\n /**\n * Sets the flipping state of the axis. If enabled, the axis is descending rather than ascending.\n * @memberof Axis\n * @param {Boolean} flip - The new flipping state of the axis\n * @return {Axis} The current axis\n */\n flip(flip) {\n this.options.flipped = flip;\n this.setMinMaxFlipped();\n return this;\n }\n /*\n setMinMaxFlipped() {\n var interval = this.maxPx - this.minPx;\n var maxPx = this.maxPx - interval * this.options.span[ 0 ];\n var minPx = this.maxPx - interval * this.options.span[ 1 ];\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n // this.minPx = minPx;\n //this.maxPx = maxPx;\n }\n */\n /**\n * @memberof Axis\n * @return {Boolean} The current flipping state of the axis\n */\n isFlipped() {\n return this.options.flipped;\n }\n\n _draw() {\n // Redrawing of the axis\n\n var self = this;\n // var visible;\n\n // this.drawInit();\n\n if (this.currentAxisMin === undefined || this.currentAxisMax === undefined) {\n this.setMinMaxToFitSeries(true); // We reset the min max as a function of the series\n }\n\n // this.cache();\n\n // this.setSlaveAxesBoundaries();\n\n // The data min max is stored in this.dataMin, this.dataMax\n\n //var widthPx = this.maxPx - this.minPx;\n var widthPx = Math.abs(this.getMaxPx() - this.getMinPx());\n var valrange = this.getCurrentInterval();\n\n /* Number of px per unit */\n /* Example: width: 1000px\n /* \t\t\t10 - 100 => 11.11\n /*\t\t\t0 - 2 => 500\n /*\t\t\t0 - 0.00005 => 20'000'000\n */\n\n if (!this.isShown()) {\n this.line.setAttribute('display', 'none');\n return 0;\n }\n\n this.line.setAttribute('display', 'block');\n\n if (this.options.scientificScale == true) {\n\n if (this.options.scientificScaleExponent) {\n\n this.scientificExponent = this.options.scientificScaleExponent;\n } else {\n this.scientificExponent = Math.floor(Math.log(Math.max(Math.abs(this.getCurrentMax()), Math.abs(this.getCurrentMin()))) / Math.log(10));\n }\n } else {\n this.scientificExponent = 0;\n }\n\n /************************************/\n /*** DRAWING LABEL ******************/\n /************************************/\n\n this.gridLinePath.primary = '';\n this.gridLinePath.secondary = '';\n\n /*\n var label;\n if ( label = this.getLabel() ) {\n // Sets the label\n this.labelTspan.textContent = label;\n }\n */\n let letter;\n if (!this.options.useKatexForLabel || !this.graph.hasKatexRenderer()) {\n\n if (this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && (this.scientificExponent = this.getEngineeringExponent(this.scientificExponent)) && (letter = this.getExponentGreekLetter(this.scientificExponent))) {\n\n this.preunit = letter;\n this.unitTspan.setAttribute('dx', 0);\n } else if (this.scientificExponent !== 0 && !isNaN(this.scientificExponent)) {\n\n if (this.options.engineeringScale) {\n this.scientificExponent = this.getEngineeringExponent(this.scientificExponent);\n }\n\n this.preunit = '';\n\n this.expTspan.setAttribute('display', 'visible');\n this.expTspanExp.setAttribute('display', 'visible');\n\n this.expTspan.textContent = 'x10';\n this.expTspanExp.textContent = this.scientificExponent;\n } else {\n\n if (!this.options.unit) {\n this.unitTspan.setAttribute('display', 'none');\n }\n\n this.preunit = '';\n this.expTspan.setAttribute('display', 'none');\n this.expTspanExp.setAttribute('display', 'none');\n }\n\n this.writeUnit();\n } else {\n\n let string = this.getLabel();\n /*,\n domEl;*/\n\n if (this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && (this.scientificExponent = this.getEngineeringExponent(this.scientificExponent)) && (letter = this.getExponentGreekLetter(this.scientificExponent))) {\n\n string += letter;\n this.preunitTspan.innerHTML = letter;\n this.preunitTspan.setAttribute('display', 'visible');\n this.unitTspan.setAttribute('dx', 0);\n\n string += ' ' + letter + ' ' + this.options.unit;\n } else if (this.scientificExponent !== 0 && !isNaN(this.scientificExponent)) {\n\n if (this.options.engineeringScale) {\n this.scientificExponent = this.getEngineeringExponent(this.scientificExponent);\n }\n string += ' \\\\cdot 10^' + this.scientificExponent + ' ' + this.options.unit;\n }\n\n this.katexElement = this.graph.renderWithKatex(string, this.katexElement);\n }\n\n if (!this.options.hideTicks) {\n\n this.resetTicksLength();\n\n if (this.linkedToAxis) {\n // px defined, linked to another axis\n\n this.linkedToAxis.deltaPx = 10;\n var widthHeight = this.drawLinkedToAxisTicksWrapper(widthPx, valrange);\n } else if (!this.options.logScale) {\n // So the setting is: How many ticks in total ? Then we have to separate it\n\n var widthHeight = this.drawLinearTicksWrapper(widthPx, valrange);\n } else {\n\n var widthHeight = this.drawLogTicks();\n }\n } else {\n var widthHeight = 0;\n }\n\n this.removeUselessTicks();\n this.removeUselessTickLabels();\n\n this.gridPrimary.setAttribute('d', this.gridLinePath.primary);\n this.gridSecondary.setAttribute('d', this.gridLinePath.secondary);\n\n // Looks for axes linked to this current axis\n var axes = this.graph.findAxesLinkedTo(this);\n axes.forEach(function (axis) {\n\n if (!axis.linkedToAxis) {\n return;\n }\n axis.setMinPx(self.getMinPx());\n axis.setMaxPx(self.getMaxPx());\n\n axis.draw();\n });\n\n /************************************/\n /*** DRAW CHILDREN IMPL SPECIFIC ****/\n /************************************/\n\n // this.drawSpecifics();\n\n return widthHeight;\n }\n\n drawLines() {\n\n if (this.options.lineAt && Array.isArray(this.options.lineAt)) {\n\n this.options.lineAt.forEach((val, index) => {\n\n if (!isNaN(val) && this.getCurrentMin() <= val && this.getCurrentMax() >= val) {\n\n this._lines[index] = this._drawLine(val, this._lines[index]);\n } else {\n this._hideLine(this._lines[index]);\n }\n });\n }\n }\n\n writeUnit() {\n if (this.options.unit) {\n\n this.unitTspan.setAttribute('display', 'visible');\n this.unitTspan.setAttribute('dx', 5);\n\n this.expTspan.setAttribute('display', 'none');\n this.expTspanExp.setAttribute('display', 'none');\n this.unitTspan.innerHTML = (this.options.unitWrapperBefore + this.preunit + this.options.unit + this.options.unitWrapperAfter).replace(/\\^([-+0-9]*)(.*)/g, \"$1$2\");\n } else {\n this.unitTspan.setAttribute('display', 'none');\n }\n }\n\n getExponentGreekLetter(val) {\n\n switch (val) {\n\n case 3:\n {\n return 'k';\n }\n\n case 6:\n {\n return 'M';\n }\n case 9:\n {\n return 'G';\n }\n case 12:\n {\n return 'T';\n }\n case 15:\n {\n return 'E';\n }\n case -3:\n {\n return 'm';\n }\n case -6:\n {\n return 'μ';\n }\n case -9:\n {\n return 'n';\n }\n case -12:\n {\n return 'p';\n }\n case -15:\n {\n return 'f';\n }\n default:\n {\n return '';\n }\n }\n }\n\n drawLinearTicksWrapper(widthPx, valrange) {\n\n let tickPrimaryUnit;\n\n if (this.options.primaryTickUnit) {\n\n tickPrimaryUnit = this.options.primaryTickUnit;\n } else {\n\n tickPrimaryUnit = this.getUnitPerTick(widthPx, this.getNbTicksPrimary(), valrange)[0];\n\n if (this.options.maxPrimaryTickUnit && this.options.maxPrimaryTickUnit < tickPrimaryUnit) {\n tickPrimaryUnit = this.options.maxPrimaryTickUnit;\n } else if (this.options.minPrimaryTickUnit && this.options.minPrimaryTickUnit > tickPrimaryUnit) {\n tickPrimaryUnit = this.options.minPrimaryTickUnit;\n }\n }\n\n // We need to get here the width of the ticks to display the axis properly, with the correct shift\n return this.drawTicks(tickPrimaryUnit, this.secondaryTicks());\n }\n\n forcePrimaryTickUnit(primaryInterval) {\n this.options.primaryTickUnit = primaryInterval;\n }\n\n forcePrimaryTickUnitMax(value) {\n this.options.maxPrimaryTickUnit = value;\n }\n\n forcePrimaryTickUnitMin(value) {\n this.options.minPrimaryTickUnit = value;\n }\n\n getPrimaryTickUnit() {\n return this.incrTick;\n }\n\n setTickLabelRatio(tickRatio) {\n this.options.ticklabelratio = tickRatio;\n }\n\n doesHideWhenNoSeriesShown() {\n return this.options.hideWhenNoSeriesShown;\n }\n\n draw() {\n\n this._widthLabels = 0;\n var drawn = this._draw();\n this._widthLabels += drawn;\n return drawn;\n }\n\n drawTicks(primary, secondary) {\n\n var unitPerTick = primary,\n min = this.getCurrentMin(),\n max = this.getCurrentMax(),\n secondaryIncr,\n incrTick,\n subIncrTick,\n loop = 0;\n\n if (secondary) {\n secondaryIncr = unitPerTick / secondary;\n }\n\n incrTick = this.options.shiftToZero ? this.dataMin - Math.ceil((this.dataMin - min) / unitPerTick) * unitPerTick : Math.floor(min / unitPerTick) * unitPerTick;\n this.incrTick = primary;\n\n while (incrTick <= max) {\n\n loop++;\n if (loop > 200) {\n break;\n }\n\n if (secondary) {\n\n subIncrTick = incrTick + secondaryIncr;\n this.subIncrTick = subIncrTick;\n //widthHeight = Math.max(widthHeight, this.drawTick(subIncrTick, 1));\n var loop2 = 0;\n\n while (subIncrTick < incrTick + unitPerTick) {\n loop2++;\n if (loop2 > 100) {\n break;\n }\n\n if (subIncrTick < min || subIncrTick > max) {\n subIncrTick += secondaryIncr;\n continue;\n }\n\n this.drawTickWrapper(subIncrTick, false, Math.abs(subIncrTick - incrTick - unitPerTick / 2) < 1e-4 ? 2 : 3);\n\n subIncrTick += secondaryIncr;\n }\n }\n\n if (incrTick < min || incrTick > max) {\n incrTick += primary;\n continue;\n }\n\n this.drawTickWrapper(incrTick, true, 1);\n incrTick += primary;\n }\n\n this.widthHeightTick = this.getMaxSizeTick();\n return this.widthHeightTick;\n }\n\n nextTick(level, callback) {\n\n this.ticks[level] = this.ticks[level] || [];\n this.lastCurrentTick[level] = this.lastCurrentTick[level] || 0;\n this.currentTick[level] = this.currentTick[level] || 0;\n\n if (this.currentTick[level] >= this.ticks[level].length) {\n var tick = document.createElementNS(this.graph.ns, 'line');\n this.groupTicks.appendChild(tick);\n this.ticks[level].push(tick);\n\n callback(tick);\n }\n\n var tick = this.ticks[level][this.currentTick[level]];\n\n if (this.currentTick[level] >= this.lastCurrentTick[level]) {\n tick.setAttribute('display', 'visible');\n }\n\n this.currentTick[level]++;\n\n return tick;\n }\n\n nextTickLabel(callback) {\n\n this.ticksLabels = this.ticksLabels || [];\n this.lastCurrentTickLabel = this.lastCurrentTickLabel || 0;\n this.currentTickLabel = this.currentTickLabel || 0;\n\n if (this.currentTickLabel >= this.ticksLabels.length) {\n\n var tickLabel = document.createElementNS(this.graph.ns, 'text');\n this.groupTickLabels.appendChild(tickLabel);\n this.ticksLabels.push(tickLabel);\n callback(tickLabel);\n }\n\n var tickLabel = this.ticksLabels[this.currentTickLabel];\n\n if (this.currentTickLabel >= this.lastCurrentTickLabel) {\n tickLabel.setAttribute('display', 'visible');\n }\n\n this.currentTickLabel++;\n\n return tickLabel;\n }\n\n removeUselessTicks() {\n\n for (var j in this.currentTick) {\n\n for (var i = this.currentTick[j]; i < this.ticks[j].length; i++) {\n this.ticks[j][i].setAttribute('display', 'none');\n }\n\n this.lastCurrentTick[j] = this.currentTick[j];\n this.currentTick[j] = 0;\n }\n }\n\n removeUselessTickLabels() {\n\n for (var i = this.currentTickLabel; i < this.ticksLabels.length; i++) {\n this.ticksLabels[i].setAttribute('display', 'none');\n }\n\n this.lastCurrentTickLabel = this.currentTickLabel;\n this.currentTickLabel = 0;\n }\n /*\n doGridLine() {\n var gridLine = document.createElementNS( this.graph.ns, 'line' );\n this.groupGrids.appendChild( gridLine );\n return gridLine;\n };*/\n\n nextGridLine(primary, x1, x2, y1, y2) {\n\n if (!(primary && this.options.primaryGrid || !primary && this.options.secondaryGrid)) {\n return;\n }\n\n this.gridLinePath[primary ? 'primary' : 'secondary'] += 'M ' + x1 + ' ' + y1 + ' L ' + x2 + ' ' + y2;\n }\n\n setGridLineStyle(gridLine, primary) {\n\n gridLine.setAttribute('shape-rendering', 'crispEdges');\n gridLine.setAttribute('stroke', primary ? this.getPrimaryGridColor() : this.getSecondaryGridColor());\n gridLine.setAttribute('stroke-width', primary ? this.getPrimaryGridWidth() : this.getSecondaryGridWidth());\n gridLine.setAttribute('stroke-opacity', primary ? this.getPrimaryGridOpacity() : this.getSecondaryGridOpacity());\n\n var dasharray;\n if (dasharray = primary ? this.getPrimaryGridDasharray() : this.getSecondaryGridDasharray()) {\n gridLine.setAttribute('stroke-dasharray', dasharray);\n }\n }\n\n setGridLinesStyle() {\n this.setGridLineStyle(this.gridPrimary, true);\n this.setGridLineStyle(this.gridSecondary, false);\n return this;\n }\n\n resetTicksLength() {}\n\n secondaryTicks() {\n return this.options.nbTicksSecondary;\n }\n\n drawLogTicks() {\n var min = this.getCurrentMin(),\n max = this.getCurrentMax();\n var incr = Math.min(min, max);\n var max = Math.max(min, max);\n\n if (incr < 1e-50) {\n incr = 1e-50;\n }\n\n if (Math.log(incr) - Math.log(max) > 20) {\n max = Math.pow(10, Math.log(incr) * 20);\n }\n\n var optsMain = {\n fontSize: '1.0em',\n exponential: true,\n overwrite: false\n };\n\n if (incr < 0) {\n incr = 0;\n }\n\n var pow = incr == 0 ? 0 : Math.floor(Math.log(incr) / Math.log(10));\n var incr = 1,\n val;\n while ((val = incr * Math.pow(10, pow)) < max) {\n if (incr == 1) {\n // Superior power\n if (val > min) this.drawTickWrapper(val, true, 1, optsMain);\n }\n if (incr == 10) {\n incr = 1;\n pow++;\n } else {\n\n if (incr != 1 && val > min) {\n\n this.drawTickWrapper(val, false, 2, {\n overwrite: '',\n fontSize: '0.6em'\n });\n }\n\n incr++;\n }\n }\n\n this.widthHeightTick = this.getMaxSizeTick();\n return this.widthHeightTick;\n }\n\n drawTickWrapper(value, label, level, options) {\n\n //var pos = this.getPos( value );\n\n this.drawTick(value, level, options);\n }\n\n /**\n * Used to scale the master axis into the slave axis\n * @function SlaveAxisScalingFunction\n * @param {Number} val - The master value to convert into a slave value\n * @returns undefined\n */\n\n /**\n * Makes this axis a slave. This can be used to show the same data with different units, specifically when a conversion function exists from axis -> slaveAxis but not in reverse. This axis should actually have no series.\n * @param {Axis} axis - The master axis\n * @param {SlaveAxisScalingFunction} scalingFunction - The scaling function used to map masterValue -> slaveValue\n * @param {Number} decimals - The number of decimals to round the value to\n * @memberof Axis\n * @return {Number} The width or height used by the axis (used internally)\n */\n linkToAxis(axis, scalingFunction, decimals) {\n\n this.linkedToAxis = {\n axis: axis,\n scalingFunction: scalingFunction,\n decimals: decimals || 1\n };\n }\n\n drawLinkedToAxisTicksWrapper(widthPx, valrange) {\n\n var opts = this.linkedToAxis,\n px = 0,\n val,\n t,\n l,\n delta2;\n\n // Redrawing the main axis ? Why ?\n //opts.axis.draw();\n\n if (!opts.deltaPx) {\n opts.deltaPx = 10;\n }\n\n do {\n\n val = opts.scalingFunction(opts.axis.getVal(px + this.getMinPx()));\n\n if (opts.decimals) {\n this.decimals = opts.decimals;\n }\n\n t = this.drawTick(val, 1, {}, px + this.getMinPx());\n\n if (!t) {\n console.error(val, px, this.getMinPx());\n throw new Error('Unable to draw tick. Please report the test-case');\n }\n\n l = String(t[1].textContent).length * 8;\n delta2 = Math.round(l / 5) * 5;\n\n if (delta2 > opts.deltaPx) {\n opts.deltaPx = delta2;\n // this.drawInit();\n this.drawLinkedToAxisTicksWrapper(widthPx, valrange);\n return;\n }\n\n px += opts.deltaPx;\n } while (px < widthPx);\n }\n\n /**\n * Transform a value into pixels, according to the axis scaling. The value is referenced to the drawing wrapper, not the the axis minimal value\n * @param {Number} value - The value to translate into pixels\n * @memberof Axis\n * @return {Number} The value transformed into pixels\n */\n getPos(value) {\n return this.getPx(value);\n }\n\n /**\n * @alias Axis~getPos\n */\n getPx(value) {\n // if(this.getMaxPx() == undefined)\n // console.log(this);\n //console.log(this.getMaxPx(), this.getMinPx(), this.getCurrentInterval());\n // Ex 50 / (100) * (1000 - 700) + 700\n\n //console.log( value, this.getCurrentMin(), this.getMaxPx(), this.getMinPx(), this.getCurrentInterval() );\n if (!this.options.logScale) {\n\n return (value - this.getCurrentMin()) / this.getCurrentInterval() * (this.getMaxPx() - this.getMinPx()) + this.getMinPx();\n } else {\n // 0 if value = min\n // 1 if value = max\n\n if (value < 0) return;\n\n var value = (Math.log(value) - Math.log(this.getCurrentMin())) / (Math.log(this.getCurrentMax()) - Math.log(this.getCurrentMin())) * (this.getMaxPx() - this.getMinPx()) + this.getMinPx();\n\n return value;\n }\n }\n\n /**\n * @alias Axis~getPos\n */\n getRoundedPx(value) {\n // if(this.getMaxPx() == undefined)\n // console.log(this);\n //console.log(this.getMaxPx(), this.getMinPx(), this.getCurrentInterval());\n // Ex 50 / (100) * (1000 - 700) + 700\n\n //console.log( value, this.getCurrentMin(), this.getMaxPx(), this.getMinPx(), this.getCurrentInterval() );\n return Math.round(this.getPx(value) * 10) / 10;\n }\n\n /**\n * Transform a pixel position (referenced to the graph zone, not to the axis minimum) into a value, according to the axis scaling.\n * @param {Number} pixels - The number of pixels to translate into a value\n * @memberof Axis\n * @return {Number} The axis value corresponding to the pixel position\n */\n getVal(px) {\n\n if (!this.options.logScale) {\n\n return (px - this.getMinPx()) / (this.getMaxPx() - this.getMinPx()) * this.getCurrentInterval() + this.getCurrentMin();\n } else {\n\n return Math.exp((px - this.getMinPx()) / (this.getMaxPx() - this.getMinPx()) * (Math.log(this.getCurrentMax()) - Math.log(this.getCurrentMin())) + Math.log(this.getCurrentMin()));\n }\n }\n\n /**\n * Transform a delta value into pixels\n * @param {Number} value - The value to translate into pixels\n * @return {Number} The value transformed into pixels\n * @example graph.getBottomAxis().forceMin( 20 ).forceMax( 50 ).getRelPx( 2 ); // Returns how many pixels will be covered by 2 units. Let's assume 600px of width, it's ( 2 / 30 ) * 600 = 40px\n */\n getRelPx(delta) {\n\n return delta / this.getCurrentInterval() * (this.getMaxPx() - this.getMinPx());\n }\n\n /**\n * Transform a delta pixels value into value\n * @param {Number} pixels - The pixel to convert into a value\n * @return {Number} The delta value corresponding to delta pixels\n * @see Axis~getRelPx\n * @example graph.getBottomAxis().forceMin( 20 ).forceMax( 50 ).getRelVal( 40 ); // Returns 2 (for 600px width)\n */\n getRelVal(px) {\n return px / (this.getMaxPx() - this.getMinPx()) * this.getCurrentInterval();\n }\n\n valueToText(value) {\n\n if (this.scientificExponent) {\n\n value /= Math.pow(10, this.scientificExponent);\n return value.toFixed(1);\n } else {\n\n value = value * Math.pow(10, this.getExponentialFactor()) * Math.pow(10, this.getExponentialLabelFactor());\n if (this.options.shiftToZero) {\n value -= this.dataMin;\n }\n if (this.options.ticklabelratio) {\n value *= this.options.ticklabelratio;\n }\n if (this.options.unitModification) {\n value = this.modifyUnit(value, this.options.unitModification);\n return value;\n }\n\n var dec = this.decimals - this.getExponentialFactor() - this.getExponentialLabelFactor();\n\n if (isNaN(value)) {\n return '';\n }\n\n if (dec > 0) {\n value = value.toFixed(dec);\n } else {\n value = value.toFixed(0);\n }\n\n if (this.options.unitInTicks && this.options.unit) {\n value += ' ' + this.options.unit;\n }\n\n return value;\n }\n }\n\n /**\n * Computes a value and returns it in HTML formatting\n * @memberof Axis\n * @param {Number} value - The value to compute\n * @param {Boolean} noScaling - Does not display scaling\n * @param {Boolean} noUnits - Does not display units\n * @return {String} An HTML string containing the computed value\n * @example graph.getXAxis().setUnit( \"m\" ).setUnitDecade( true ).setScientific( true );\n * graph.getXAxis().valueToHtml( 3500 ); // Returns \"3.5 km\"\n * @see Axis#valueToText\n */\n valueToHtml(value, noScaling, noUnits) {\n\n var text = this.valueToText(value);\n var letter;\n\n if (this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && (this.scientificExponent = this.getEngineeringExponent(this.scientificExponent)) && (letter = this.getExponentGreekLetter(this.scientificExponent))) {\n\n text += letter;\n } else if (this.scientificExponent !== 0 && !isNaN(this.scientificExponent) && !noScaling) {\n text += 'x10';\n text += '' + this.scientificExponent + '';\n }\n\n if (this.options.unit && !noUnits) {\n\n text += this.options.unit.replace(/\\^([-+0-9]*)/g, '$1');\n }\n\n return text;\n }\n\n getModifiedValue(value) {\n if (this.options.ticklabelratio) {\n value *= this.options.ticklabelratio;\n }\n\n if (this.options.shiftToZero) {\n value -= this.getMinValue() * (this.options.ticklabelratio || 1);\n }\n\n return value;\n }\n\n modifyUnit(value, mode) {\n\n var text = '';\n var incr = this.incrTick;\n var umin;\n\n switch (mode) {\n\n case 'time':\n // val must be in seconds => transform in hours / days / months\n var max = this.getModifiedValue(this.getMaxValue()),\n units = [[60, 'min'], [3600, 'h'], [3600 * 24, 'd']];\n\n if (max < 3600) {\n // to minutes\n umin = 0;\n } else if (max < 3600 * 24) {\n umin = 1;\n } else if (max < 3600 * 24 * 30) {\n umin = 2;\n }\n\n if (!units[umin]) {\n return false;\n }\n\n value = value / units[umin][0];\n var valueRounded = Math.floor(value);\n text = valueRounded + units[umin][1];\n\n // Addind lower unit for precision\n umin--;\n while (incr < 1 * units[umin + 1][0] && umin > -1) {\n\n value = (value - valueRounded) * units[umin + 1][0] / units[umin][0];\n valueRounded = Math.round(value);\n text += ' ' + valueRounded + units[umin][1];\n umin--;\n }\n\n break;\n\n case 'time:min.sec':\n value = value / 60;\n var valueRounded = Math.floor(value);\n var s = Math.round((value - valueRounded) * 60) + '';\n s = s.length == 1 ? '0' + s : s;\n text = valueRounded + '.' + s;\n break;\n\n default:\n break;\n }\n\n return text;\n }\n\n getExponentialFactor() {\n return this.options.exponentialFactor;\n }\n\n setExponentialFactor(value) {\n this.options.exponentialFactor = value;\n }\n\n setExponentialLabelFactor(value) {\n this.options.exponentialLabelFactor = value;\n }\n\n getExponentialLabelFactor() {\n return this.options.exponentialLabelFactor;\n }\n\n /**\n * Sets the label of the axis\n * @param {Number} label - The label to display under the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setLabel(label) {\n this.options.labelValue = label;\n return this;\n }\n\n setLabelFont(font) {\n this.options.labelFont = font;\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {String} The label value\n */\n getLabel() {\n return this.options.labelValue;\n }\n\n setSpan(_from, _to) {\n\n this.options.span = [_from, _to];\n return this;\n }\n\n getSpan() {\n return this.options.span;\n }\n\n setLevel(level) {\n this._level = level;\n return this;\n }\n\n getLevel() {\n return this._level;\n }\n\n setShift(shift) {\n this.shift = shift;\n }\n\n getShift() {\n return this.shift;\n }\n\n /**\n * Changes the tick position\n * @param {Number} pos - The new position ( \"outside\", \"centered\" or \"inside\" )\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setTickPosition(pos) {\n switch (pos) {\n case 3:\n case 'outside':\n case _graphCore2.default.TICKS_OUTSIDE:\n {\n pos = 3;\n break;\n }\n\n case 2:\n case 'centered':\n case _graphCore2.default.TICKS_CENTERED:\n {\n pos = 2;\n break;\n }\n\n case 1:\n case 'inside':\n case _graphCore2.default.TICKS_INSIDE:\n default:\n {\n pos = 1;\n break;\n }\n }\n\n this.options.tickPosition = pos;\n\n switch (this.options.tickPosition) {\n case 3:\n this.tickPx1 = -2;\n this.tickPx2 = 0;\n break;\n\n case 2:\n this.tickPx1 = -1;\n this.tickPx2 = 1;\n break;\n\n default:\n case 1:\n this.tickPx1 = 0;\n this.tickPx2 = 2;\n break;\n }\n\n return this;\n }\n\n /**\n * Displays or hides the axis grids\n * @param {Boolean} on - true to enable the grids, false to disable them\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setGrids(on) {\n this.options.primaryGrid = on;\n this.options.secondaryGrid = on;\n return this;\n }\n\n /**\n * Displays or hides the axis primary grid\n * @param {Boolean} on - true to enable the grids, false to disable it\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setPrimaryGrid(on) {\n this.options.primaryGrid = on;\n return this;\n }\n\n /**\n * Displays or hides the axis secondary grid\n * @param {Boolean} on - true to enable the grids, false to disable it\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setSecondaryGrid(on) {\n this.options.secondaryGrid = on;\n return this;\n }\n\n /**\n * Enables primary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n primaryGridOn() {\n return this.setPrimaryGrid(true);\n }\n\n /**\n * Disables primary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n primaryGridOff() {\n return this.setPrimaryGrid(false);\n }\n\n /**\n * Enables secondary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n secondaryGridOn() {\n return this.setSecondaryGrid(true);\n }\n\n /**\n * Disables secondary grid\n * @return {Axis} The current axis\n */\n secondaryGridOff() {\n return this.setSecondaryGrid(false);\n }\n\n /**\n * Enables all the grids\n * @return {Axis} The current axis\n */\n gridsOn() {\n return this.setGrids(true);\n }\n\n /**\n * Disables all the grids\n * @return {Axis} The current axis\n */\n gridsOff() {\n return this.setGrids(false);\n }\n\n /**\n * @alias Axis#gridsOff\n */\n turnGridsOff() {\n return this.gridsOff(...arguments);\n }\n\n /**\n * @alias Axis#gridsOn\n */\n turnGridsOn() {\n return this.gridsOn(...arguments);\n }\n\n /**\n * Sets the axis color\n * @memberof Axis\n * @param {String} color - The color to set the axis\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setAxisColor(color) {\n this.options.axisColor = color;\n return this;\n }\n\n /**\n * Gets the axis color\n * @memberof Axis\n * @return {String} The color of the axis\n * @since 1.13.2\n */\n getAxisColor() {\n return this.options.axisColor || 'black';\n }\n\n setTickLabelOffset(offsetValue) {\n this.options.tickLabelOffset = offsetValue;\n return this;\n }\n\n /**\n * Sets the color of the main ticks\n * @memberof Axis\n * @param {String} color - The new color of the primary ticks\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setPrimaryTicksColor(color) {\n this.options.primaryTicksColor = color;\n return this;\n }\n\n /**\n * Gets the color of the main ticks\n * @memberof Axis\n * @return {String} The color of the primary ticks\n * @since 1.13.2\n */\n getPrimaryTicksColor() {\n return this.options.primaryTicksColor || 'black';\n }\n\n /**\n * Sets the color of the secondary ticks\n * @memberof Axis\n * @param {String} color - The new color of the secondary ticks\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setSecondaryTicksColor(color) {\n this.options.secondaryTicksColor = color;\n return this;\n }\n\n /**\n * Gets the color of the secondary ticks\n * @memberof Axis\n * @return {String} The color of the secondary ticks\n * @since 1.13.2\n */\n getSecondaryTicksColor() {\n return this.options.secondaryTicksColor || 'black';\n }\n\n /**\n * Sets the color of the tick labels\n * @memberof Axis\n * @param {String} color - The new color of the tick labels\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setTicksLabelColor(color) {\n this.options.ticksLabelColor = color;\n if (Array.isArray(this.ticksLabels)) {\n this.ticksLabels.forEach(tick => {\n tick.setAttribute('fill', color);\n });\n }\n return this;\n }\n\n /**\n * Gets the color of the tick labels\n * @memberof Axis\n * @return {String} The color of the tick labels\n * @since 1.13.2\n */\n getTicksLabelColor() {\n return this.options.ticksLabelColor || 'black';\n }\n\n /**\n * Sets the color of the primary grid\n * @memberof Axis\n * @param {String} color - The primary grid color\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridColor(color) {\n this.options.primaryGridColor = color;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the color of the primary grid\n * @memberof Axis\n * @return {String} color - The primary grid color\n * @since 1.13.3\n */\n getPrimaryGridColor() {\n return this.options.primaryGridColor;\n }\n\n /**\n * Sets the color of the primary grid\n * @memberof Axis\n * @param {String} color - The primary grid color\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridColor(color) {\n this.options.secondaryGridColor = color;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the color of the secondary grid\n * @memberof Axis\n * @return {String} color - The secondary grid color\n * @since 1.13.3\n */\n getSecondaryGridColor() {\n return this.options.secondaryGridColor;\n }\n\n /**\n * Sets the width of the primary grid lines\n * @memberof Axis\n * @param {Number} width - The width of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridWidth(width) {\n this.options.primaryGridWidth = width;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the width of the primary grid lines\n * @memberof Axis\n * @return {Number} width - The width of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridWidth() {\n return this.options.primaryGridWidth;\n }\n\n /**\n * Sets the width of the secondary grid lines\n * @memberof Axis\n * @param {Number} width - The width of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridWidth(width) {\n this.options.secondaryGridWidth = width;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the width of the secondary grid lines\n * @memberof Axis\n * @return {Number} width - The width of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridWidth() {\n return this.options.secondaryGridWidth;\n }\n\n /**\n * Sets the opacity of the primary grid lines\n * @memberof Axis\n * @param {Number} opacity - The opacity of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridOpacity(opacity) {\n this.options.primaryGridOpacity = opacity;\n return this;\n }\n\n /**\n * Gets the opacity of the primary grid lines\n * @memberof Axis\n * @return {Number} opacity - The opacity of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridOpacity() {\n return this.options.primaryGridOpacity;\n }\n\n /**\n * Sets the opacity of the secondary grid lines\n * @memberof Axis\n * @param {Number} opacity - The opacity of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridOpacity(opacity) {\n this.options.secondaryGridOpacity = opacity;\n return this;\n }\n\n /**\n * Gets the opacity of the secondary grid lines\n * @memberof Axis\n * @return {Number} opacity - The opacity of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridOpacity() {\n return this.options.secondaryGridOpacity;\n }\n\n /**\n * Sets the dasharray of the primary grid lines\n * @memberof Axis\n * @param {String} dasharray - The dasharray of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridDasharray(dasharray) {\n this.options.primaryGridDasharray = dasharray;\n return this;\n }\n\n /**\n * Gets the dasharray of the primary grid lines\n * @memberof Axis\n * @return {String} dasharray - The dasharray of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridDasharray() {\n return this.options.primaryGridDasharray;\n }\n\n /**\n * Sets the dasharray of the secondary grid lines\n * @memberof Axis\n * @param {String} dasharray - The dasharray of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridDasharray(dasharray) {\n this.options.secondaryGridDasharray = dasharray;\n return this;\n }\n\n /**\n * Gets the dasharray of the secondary grid lines\n * @memberof Axis\n * @return {String} dasharray - The dasharray of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridDasharray() {\n return this.options.secondaryGridDasharray;\n }\n\n /**\n * Sets the color of the label\n * @memberof Axis\n * @param {String} color - The new color of the label\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setLabelColor(color) {\n this.options.labelColor = color;\n return this;\n }\n\n /**\n * Gets the color of the label\n * @memberof Axis\n * @return {String} The color of the label\n * @since 1.13.2\n */\n getLabelColor() {\n return this.options.labelColor;\n }\n\n setTickContent(dom, val, options) {\n if (!options) options = {};\n\n if (options.overwrite || !options.exponential) {\n\n dom.textContent = options.overwrite || this.valueToText(val);\n } else {\n var log = Math.round(Math.log(val) / Math.log(10));\n var unit = Math.floor(val * Math.pow(10, -log));\n\n dom.textContent = unit != 1 ? unit + 'x10' : '10';\n var tspan = document.createElementNS(this.graph.ns, 'tspan');\n tspan.textContent = log;\n tspan.setAttribute('font-size', '0.7em');\n tspan.setAttribute('dy', -5);\n dom.appendChild(tspan);\n }\n\n if (options.fontSize) {\n dom.setAttribute('font-size', options.fontSize);\n }\n }\n\n /**\n * @memberof Axis\n * @returns {Boolean} true if it is an x axis, false otherwise\n */\n isX() {\n return false;\n }\n\n /**\n * @memberof Axis\n * @returns {Boolean} true if it is an y axis, false otherwise\n */\n isY() {\n return false;\n }\n\n /**\n * Sets the unit of the axis\n * @param {String} unit - The unit of the axis\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setUnit(unit) {\n this.options.unit = unit;\n return this;\n }\n\n /**\n * Places the unit in every tick\n * @param {Boolean} bool - ```true``` to place the unit, ```false``` otherwise\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 2.0.44\n */\n setUnitInTicks(bool) {\n this.options.unitInTicks = bool;\n return this;\n }\n\n /**\n * Sets characters wrapping the unit\n * @param {String} before - The string to insert before\n * @param {String} after - The string to insert after\n * @return {Axis} The current axis\n * @memberof Axis\n * @example axis.setUnitWrapper(\"[\", \"]\").setUnit('m'); // Will display [m]\n * @since 1.13.3\n */\n setUnitWrapper(before, after) {\n this.options.unitWrapperBefore = before;\n this.options.unitWrapperAfter = after;\n return this;\n }\n\n /**\n * Allows the unit to scale with thousands\n * @param {Boolean} on - Enables this mode\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setUnitDecade(on) {\n this.options.unitDecade = on;\n return this;\n }\n\n /**\n * Enable the scientific mode for the axis values. This way, big numbers can be avoided, e.g. \"1000000000\" would be displayed 1 with 109 or \"G\" shown on near the axis unit.\n * @param {Boolean} on - Enables the scientific mode\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setScientific(on) {\n this.options.scientificScale = on;\n return this;\n }\n\n /**\n * In the scientific mode, forces the axis to take a specific power of ten. Useful if you want to show kilometers instead of meters for example. In this case you would use \"3\" as a value.\n * @param {Number} scientificScaleExponent - Forces the scientific scale to take a defined power of ten\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n * @see Axis#setScientific\n */\n setScientificScaleExponent(scientificScaleExponent) {\n this.options.scientificScaleExponent = scientificScaleExponent;\n return this;\n }\n\n /**\n * The engineer scaling is similar to the scientific scaling ({@link Axis#setScientificScale}) but allowing only mupltiples of 3 to be used to scale the axis (for instance, go from grams to kilograms while skipping decagrams and hexagrams)\n * @param {Boolean} engineeringScaling - true to turn on the engineering scaling\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n * @see Axis#setScientific\n */\n setEngineering(engineeringScaling) {\n //bool\n this.options.scientificScale = engineeringScaling;\n this.options.engineeringScale = engineeringScaling;\n return this;\n }\n\n /**\n * Calculates the closest engineering exponent from a scientific exponent\n * @param {Number} scientificExponent - The exponent of 10 based on which the axis will be scaled\n * @return {Number} The appropriate engineering exponent\n * @memberof Axis\n * @since 1.13.3\n * @private\n */\n getEngineeringExponent(scientificExponent) {\n\n if (scientificExponent > 0) {\n scientificExponent -= scientificExponent % 3;\n } else {\n scientificExponent -= (3 - -scientificExponent % 3) % 3;\n }\n\n return scientificExponent;\n }\n\n /**\n * Enables log scaling\n * @param {Boolean} logScale - ```true``` to enable the log scaling, ```false``` to disable it\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setLogScale(log) {\n this.options.logScale = log;\n return this;\n }\n\n isZoomed() {\n return !(this.currentAxisMin == this.getMinValue() || this.currentAxisMax == this.getMaxValue());\n }\n\n hasAxis() {\n return false;\n }\n\n getType() {\n return null;\n }\n\n useKatexForLabel(use = true) {\n this.options.useKatexForLabel = use;\n return this;\n }\n\n }\n\n /**\n * @alias Axis#getVal\n */\n Axis.prototype.getValue = Axis.prototype.getVal;\n\n /**\n * @alias Axis#getRelPx\n */\n Axis.prototype.getDeltaPx = Axis.prototype.getRelPx;\n\n exports.default = Axis;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil);\n global.graphMixinErrorbars = mod.exports;\n }\n})(this, function (module, exports, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n var ErrorBarMixin = {\n /*\n doErrorDraw: function( orientation, error, originVal, originPx, xpx, ypx ) {\n if ( !( error instanceof Array ) ) {\n error = [ error ];\n }\n var functionName = orientation == 'y' ? 'getY' : 'getX';\n var bars = orientation == 'y' ? [ 'top', 'bottom' ] : [ 'left', 'right' ];\n var j;\n if ( isNaN( xpx ) || isNaN( ypx ) ) {\n return;\n }\n for ( var i = 0, l = error.length; i < l; i++ ) {\n if ( error[ i ] instanceof Array ) { // TOP\n j = bars[ 0 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal + error[ i ][ 0 ] ), originPx, j );\n j = bars[ 1 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal - error[ i ][ 1 ] ), originPx, j );\n } else {\n j = bars[ 0 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal + error[ i ] ), originPx, j );\n j = bars[ 1 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal - error[ i ] ), originPx, j );\n }\n }\n },\n */\n\n /*\n makeError: function( orientation, type, coord, origin, quadOrientation ) {\n var method;\n switch ( this.errorstyles[ level ].type ) {\n case 'bar':\n method = \"makeBar\";\n break;\n case 'box':\n method = \"makeBox\";\n break;\n }\n return this[ method + orientation.toUpperCase() ]( coord, origin, this.errorstyles[ level ][ quadOrientation ] );\n },*/\n\n makeBarY: function (coordY, origin, style) {\n if (!coordY || style === undefined) {\n return;\n }\n var width = !util.isNumeric(style.width) ? 10 : style.width;\n return ' V ' + coordY + ' m -' + width / 2 + ' 0 h ' + width + ' m -' + width / 2 + ' 0 V ' + origin + ' ';\n },\n\n makeBoxY: function (coordY, origin, style) {\n if (!coordY || style === undefined) {\n return;\n }\n return ' m 5 0 V ' + coordY + ' h -10 V ' + origin + ' m 5 0 ';\n },\n\n makeBarX: function (coordX, origin, style) {\n if (!coordX || style === undefined) {\n return;\n }\n var height = !util.isNumeric(style.width) ? 10 : style.width;\n return ' H ' + coordX + ' m 0 -' + height / 2 + ' v ' + height + ' m 0 -' + height / 2 + ' H ' + origin + ' ';\n },\n\n makeBoxX: function (coordX, origin, style) {\n if (!coordX || style === undefined) {\n return;\n }\n return ' v 5 H ' + coordX + ' v -10 H ' + origin + ' v 5 ';\n },\n /*\n check: function( index, valY, valX ) {\n var dx, dy;\n if ( ( this.getType() == Graph.SERIE_LINE || this.getType() == Graph.SERIE_SCATTER ) ) {\n if ( !( dx = this.data[ index * 2 ] ) || !( dy = this.data[ index * 2 + 1 ] ) ) { //\n return;\n }\n }\n if ( dx === undefined ) {\n return;\n }\n for ( var i = 0, l = valY.length; i < l; i++ ) {\n if ( Array.isArray( valY[ i ] ) ) {\n if ( !isNaN( valY[ i ][ 0 ] ) ) {\n this._checkY( dy + valY[ i ][ 0 ] );\n }\n if ( !isNaN( valY[ i ][ 1 ] ) ) {\n this._checkY( dy - valY[ i ][ 1 ] );\n }\n } else {\n if ( !isNaN( valY[ i ] ) ) {\n this._checkY( dy + valY[ i ] );\n this._checkY( dy - valY[ i ] );\n }\n }\n }\n for ( var i = 0, l = valX.length; i < l; i++ ) {\n if ( Array.isArray( valX[ i ] ) ) {\n if ( !isNaN( valX[ i ][ 0 ] ) ) {\n this._checkX( dx - valX[ i ][ 0 ] );\n }\n if ( !isNaN( valX[ i ][ 1 ] ) ) {\n this._checkX( dx + valX[ i ][ 1 ] );\n }\n } else {\n if ( !isNaN( valY[ i ] ) ) {\n this._checkX( dx - valX[ i ] );\n this._checkX( dx + valX[ i ] );\n }\n }\n }\n },\n */\n\n /**\n *\n * @example serie.setErrorStyle( [ { type: 'bar', x: {} }, { type: 'box', top: { strokeColor: 'green', fillColor: 'olive' }, bottom: { strokeColor: 'red', fillColor: \"#800000\" } } ] );\n */\n setErrorBarStyle: function (errorstyle) {\n\n this.errorbarStyle = this._setErrorStyle(errorstyle);\n return this;\n },\n\n setErrorBoxStyle: function (errorstyle) {\n\n this.errorboxStyle = this._setErrorStyle(errorstyle);\n return this;\n },\n\n _setErrorStyle(errorstyles = {}) {\n\n var styles = [];\n var pairs = [['y', 'top', 'bottom'], ['x', 'left', 'right']];\n\n var makePath = style => {\n\n style.dom = document.createElementNS(this.graph.ns, 'path');\n style.dom.setAttribute('fill', style.fillColor || 'none');\n style.dom.setAttribute('stroke', style.strokeColor || 'black');\n style.dom.setAttribute('stroke-opacity', style.strokeOpacity || 1);\n style.dom.setAttribute('fill-opacity', style.fillOpacity || 1);\n style.dom.setAttribute('stroke-width', style.strokeWidth || 1);\n\n this.groupMain.appendChild(style.dom);\n };\n // i is bar or box\n\n var styles = {};\n\n if (typeof errorstyles == 'string') {\n errorstyles = {};\n }\n\n for (var j = 0, l = pairs.length; j < l; j++) {\n\n if (errorstyles.all) {\n\n errorstyles[pairs[j][1]] = util.extend(true, {}, errorstyles.all);\n errorstyles[pairs[j][2]] = util.extend(true, {}, errorstyles.all);\n }\n\n if (errorstyles[pairs[j][0]]) {\n //.x, .y\n\n errorstyles[pairs[j][1]] = util.extend(true, {}, errorstyles[pairs[j][0]]);\n errorstyles[pairs[j][2]] = util.extend(true, {}, errorstyles[pairs[j][0]]);\n }\n\n for (var k = 1; k <= 2; k++) {\n\n if (errorstyles[pairs[j][k]]) {\n\n styles[pairs[j][k]] = errorstyles[pairs[j][k]];\n makePath(styles[pairs[j][k]]);\n }\n }\n }\n\n return styles;\n },\n\n errorDrawInit: function () {\n var error;\n // var pathError = \"M 0 0 \";\n\n if (this.errorboxStyle) {\n\n this.errorboxStyle.paths = {\n top: '',\n bottom: '',\n left: '',\n right: ''\n };\n }\n\n if (this.errorbarStyle) {\n\n this.errorbarStyle.paths = {\n top: '',\n bottom: '',\n left: '',\n right: ''\n };\n }\n },\n\n errorAddPoint: function (index, dataX, dataY, xpx, ypx) {\n\n /* eslint-disable no-cond-assign */\n let error;\n if (error = this.waveform.getErrorBarXBelow(index)) {\n this.errorbarStyle.paths.left += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.left += this.makeBarX(this.getX(dataX - error), xpx, this.errorbarStyle.left);\n }\n\n if (error = this.waveform.getErrorBarXAbove(index)) {\n this.errorbarStyle.paths.right += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.right += this.makeBarX(this.getX(dataX + error), xpx, this.errorbarStyle.right);\n }\n\n if (error = this.waveform.getErrorBarYBelow(index)) {\n this.errorbarStyle.paths.bottom += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.bottom += this.makeBarY(this.getY(dataY - error), ypx, this.errorbarStyle.bottom);\n }\n\n if (error = this.waveform.getErrorBarYAbove(index)) {\n this.errorbarStyle.paths.top += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.top += this.makeBarY(this.getY(dataY + error), ypx, this.errorbarStyle.top);\n }\n\n if (error = this.waveform.getErrorBoxXBelow(index)) {\n this.errorboxStyle.paths.left += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.left += this.makeBoxX(this.getX(dataX - error), xpx, this.errorboxStyle.left);\n }\n\n if (error = this.waveform.getErrorBoxXAbove(index)) {\n this.errorboxStyle.paths.right += ' M ' + xpx + ' ' + ypx;\n\n this.errorboxStyle.paths.right += this.makeBoxX(this.getX(dataX + error), xpx, this.errorboxStyle.right);\n }\n\n if (error = this.waveform.getErrorBoxYBelow(index)) {\n this.errorboxStyle.paths.bottom += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.bottom += this.makeBoxY(this.getY(dataY - error), ypx, this.errorboxStyle.bottom);\n }\n\n if (error = this.waveform.getErrorBoxYAbove(index)) {\n this.errorboxStyle.paths.top += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.top += this.makeBoxY(this.getY(dataY + error), ypx, this.errorboxStyle.top);\n }\n /* eslint-enable */\n },\n\n errorAddPointBarChart: function (j, posY, xpx, ypx) {\n var error;\n if (this.error && (error = this.error[j])) {\n this.doErrorDraw('y', error, posY, ypx, xpx, ypx);\n }\n },\n\n errorDraw: function () {\n\n if (this.errorbarStyle) {\n\n for (var j in this.errorbarStyle.paths) {\n\n if (this.errorbarStyle[j] && this.errorbarStyle[j].dom) {\n this.errorbarStyle[j].dom.setAttribute('d', this.errorbarStyle.paths[j]);\n }\n }\n }\n\n if (this.errorboxStyle) {\n\n for (var j in this.errorboxStyle.paths) {\n\n if (this.errorboxStyle[j] && this.errorboxStyle[j].dom) {\n this.errorboxStyle[j].dom.setAttribute('d', this.errorboxStyle.paths[j]);\n }\n }\n }\n }\n };\n\n exports.default = ErrorBarMixin;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(9)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.axis.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphAxis);\n global.graphAxisX = mod.exports;\n }\n})(this, function (module, exports, _graphAxis) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphAxis2 = _interopRequireDefault(_graphAxis);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Generic constructor of a y axis\n * @augments Axis\n */\n class AxisX extends _graphAxis2.default {\n\n constructor(graph, topbottom, options = {}) {\n\n super(graph, topbottom, options);\n this.top = topbottom == 'top';\n }\n\n /**\n * @private\n * Returns the position of the axis, used by refreshDrawingZone in core module\n */\n getAxisPosition() {\n\n if (!this.options.display) {\n return 0;\n }\n\n let size;\n\n if (this.options.tickLabelOffset == 0) {\n // Normal mode, no offset\n size = this.options.tickPosition == 1 ? 8 : 20;\n size += this.graph.options.fontSize * 1;\n } else {\n // With an offset, and ticks inside, axis position is actually 0. Otherwise, it's the heights of the ticks\n size = this.options.tickPosition == 1 ? 0 : 12;\n }\n\n if (this.getLabel()) {\n size += this.graph.options.fontSize;\n }\n\n return size;\n }\n\n /**\n * @returns {Boolean} always ```true```\n */\n isX() {\n return true;\n }\n\n /**\n * @returns {Boolean} always ```false```\n */\n isY() {\n return false;\n }\n\n /**\n * @private\n * Used to set the x position of the axis\n */\n setShift(shift) {\n\n this.shift = shift;\n if (this.getShift() === undefined || !this.graph.getDrawingHeight()) {\n return;\n }\n\n this.group.setAttribute('transform', 'translate(0 ' + (this.floating ? this.getShift() : this.top ? this.shift : this.graph.getDrawingHeight() - this.shift) + ')');\n }\n\n /**\n * Caclulates the maximum tick height\n * @return {Number} The maximum tick height\n */\n getMaxSizeTick() {\n return (this.top ? -1 : 1) * (this.options.tickPosition == 1 ? 10 : 10);\n }\n\n /**\n * Draws a tick. Mostly used internally but it can be useful if you want to make your own axes\n * @param {Number} value - The value in axis unit to place the tick\n * @param {Number} level - The importance of the tick\n * @param {Object} options - Further options to be passed to ```setTickContent```\n * @param {Number} forcedPos - Forces the position of the tick (for axis dependency)\n */\n drawTick(value, level, options, forcedPos) {\n\n var self = this,\n val;\n\n val = forcedPos || this.getPos(value);\n\n if (val == undefined || isNaN(val)) {\n return;\n }\n\n var tick = this.nextTick(level, function (tick) {\n\n tick.setAttribute('y1', (self.top ? 1 : -1) * self.tickPx1 * self.tickScaling[level]);\n tick.setAttribute('y2', (self.top ? 1 : -1) * self.tickPx2 * self.tickScaling[level]);\n\n if (level == 1) {\n tick.setAttribute('stroke', self.getPrimaryTicksColor());\n } else {\n tick.setAttribute('stroke', self.getSecondaryTicksColor());\n }\n });\n\n // tick.setAttribute( 'shape-rendering', 'crispEdges' );\n tick.setAttribute('x1', val);\n tick.setAttribute('x2', val);\n\n this.nextGridLine(level == 1, val, val, 0, this.graph.getDrawingHeight());\n\n // this.groupTicks.appendChild( tick );\n if (level == 1) {\n var tickLabel = this.nextTickLabel(tickLabel => {\n\n tickLabel.setAttribute('y', (self.top ? -1 : 1) * ((self.options.tickPosition == 1 ? 8 : 20) + (self.top ? 10 : 0)) + this.options.tickLabelOffset);\n tickLabel.setAttribute('text-anchor', 'middle');\n if (self.getTicksLabelColor() !== 'black') {\n tickLabel.setAttribute('fill', self.getTicksLabelColor());\n }\n tickLabel.style.dominantBaseline = 'hanging';\n });\n\n tickLabel.setAttribute('x', val);\n this.setTickContent(tickLabel, value, options);\n }\n // this.ticks.push( tick );\n\n return [tick, tickLabel];\n }\n\n drawLabel() {\n // Place label correctly\n\n if (this.getLabelColor() !== 'black') {\n this.label.setAttribute('fill', this.getLabelColor());\n }\n\n if (this.options.labelFont) {\n this.label.setAttribute('font-family', this.options.labelFont);\n }\n\n this.label.setAttribute('text-anchor', 'middle');\n this.label.setAttribute('style', 'display: initial;');\n this.label.setAttribute('x', Math.abs(this.getMaxPx() + this.getMinPx()) / 2);\n this.label.setAttribute('y', (this.top ? -1 : 1) * ((this.options.tickPosition == 1 ? 10 : 25) + this.graph.options.fontSize));\n this.labelTspan.textContent = this.getLabel();\n }\n\n draw() {\n var tickWidth = super.draw(...arguments);\n this.drawSpecifics();\n\n return tickWidth;\n }\n /**\n * Paints the label, the axis line and anything else specific to x axes\n */\n drawSpecifics() {\n\n // Adjusts group shift\n //this.group.setAttribute('transform', 'translate(0 ' + this.getShift() + ')');\n\n this.drawLabel();\n\n this.line.setAttribute('x1', this.getMinPx());\n this.line.setAttribute('x2', this.getMaxPx());\n this.line.setAttribute('y1', 0);\n this.line.setAttribute('y2', 0);\n\n this.line.setAttribute('stroke', this.getAxisColor());\n\n if (!this.top) {\n\n this.labelTspan.style.dominantBaseline = 'hanging';\n this.expTspan.style.dominantBaseline = 'hanging';\n this.expTspanExp.style.dominantBaseline = 'hanging';\n\n this.unitTspan.style.dominantBaseline = 'hanging';\n // this.preunitTspan.style.dominantBaseline = 'hanging';\n }\n\n var span = this.getSpan();\n this.line.setAttribute('marker-start', !this.options.splitMarks || span[0] == 0 ? '' : 'url(#horionzalsplit_' + this.graph.getId() + ')');\n this.line.setAttribute('marker-end', !this.options.splitMarks || span[1] == 1 ? '' : 'url(#horionzalsplit_' + this.graph.getId() + ')');\n }\n\n /**\n * @private\n */\n _drawLine(pos, line) {\n\n let px = this.getPx(pos);\n\n if (!line) {\n line = document.createElementNS(this.graph.ns, 'line');\n } else {\n line.setAttribute('display', 'initial');\n }\n\n line.setAttribute('x1', px);\n line.setAttribute('x2', px);\n\n line.setAttribute('y1', 0);\n line.setAttribute('y2', this.graph.drawingSpaceHeight);\n\n line.setAttribute('stroke', 'black');\n this.group.appendChild(line);\n\n return line;\n }\n\n _hideLine(line) {\n if (!line) {\n return;\n }\n line.setAttribute('display', 'none');\n }\n\n /**\n * @private\n */\n handleMouseMoveLocal(x) {\n // handleMouseMoveLocal( x, y, e )\n x -= this.graph.getPaddingLeft();\n this.mouseVal = this.getVal(x);\n }\n\n /**\n * Caches the minimum px and maximum px position of the axis. Includes axis spans and flipping. Mostly used internally\n */\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n\n if (isNaN(interval)) {\n return;\n }\n\n var maxPx = interval * this.options.span[1] + this.minPx - this.options.marginMax;\n var minPx = interval * this.options.span[0] + this.minPx + this.options.marginMin;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n }\n\n getZProj(zValue) {\n return zValue * this.graph.options.zAxis.shiftX;\n }\n\n }\n\n exports.default = AxisX;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShape);\n global.graphShapeLine = mod.exports;\n }\n})(this, function (module, exports, _graphShape) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Represents a line\n * @extends Shape\n * @see Graph#newShape\n */\n class ShapeLine extends _graphShape2.default {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'line');\n\n if (!this.getStrokeColor()) {\n this.setStrokeColor('black');\n }\n\n if (!this.getStrokeWidth()) {\n this.setStrokeWidth(1);\n }\n }\n\n /**\n * Creates the handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {\n\n this._createHandles(2, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n var position = this.calculatePosition(0);\n var position2 = this.calculatePosition(1);\n\n if (!position || !position.x || !position.y) {\n return;\n }\n\n this.setDom('x2', position.x);\n this.setDom('y2', position.y);\n\n this.setDom('y1', position2.y);\n this.setDom('x1', position2.x);\n\n this.currentPos2x = position2.x;\n this.currentPos2y = position2.y;\n\n this.currentPos1x = position.x;\n this.currentPos1y = position.y;\n\n return true;\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n if (this.isLocked()) {\n return;\n }\n\n var pos = this.getPosition(0);\n var pos2 = this.getPosition(1);\n\n var posToChange;\n if (this.handleSelected == 1) {\n\n posToChange = pos;\n } else if (this.handleSelected == 2) {\n\n posToChange = pos2;\n }\n\n if (posToChange) {\n\n if (!this._data.vertical) {\n posToChange.deltaPosition('x', deltaX, this.getXAxis());\n }\n\n if (!this._data.horizontal) {\n posToChange.deltaPosition('y', deltaY, this.getYAxis());\n }\n }\n\n if (this.moving) {\n\n // If the pos2 is defined by a delta, no need to move them\n if (pos.x) {\n pos.deltaPosition('x', deltaX, this.getXAxis());\n }\n if (pos.y) {\n pos.deltaPosition('y', deltaY, this.getYAxis());\n }\n\n // If the pos2 is defined by a delta, no need to move them\n if (pos2.x) {\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n }\n if (pos2.y) {\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n }\n }\n\n if (this._data.forcedCoords) {\n\n var forced = this._data.forcedCoords;\n\n if (forced.y !== undefined) {\n\n if (typeof forced.y == 'function') {\n pos2.y = pos.y = forced.y(this);\n } else {\n pos2.y = forced.y;\n pos.y = forced.y;\n }\n }\n\n if (forced.x !== undefined) {\n\n if (typeof forced.x == 'function') {\n pos2.x = pos.x = forced.x(this);\n } else {\n pos2.x = forced.x;\n pos.x = forced.x;\n }\n }\n }\n\n if (this.rectEvent) {\n this.setEventReceptacle();\n }\n\n this.redraw();\n this.changed();\n this.setHandles();\n\n return true;\n }\n\n /**\n * Sets the handle position\n * @private\n */\n setHandles() {\n\n if (!this.areHandlesInDom()) {\n return;\n }\n\n if (isNaN(this.currentPos1x)) {\n return;\n }\n\n this.handles[1].setAttribute('x', this.currentPos1x);\n this.handles[1].setAttribute('y', this.currentPos1y);\n\n this.handles[2].setAttribute('x', this.currentPos2x);\n this.handles[2].setAttribute('y', this.currentPos2y);\n }\n\n /**\n * Creates an line receptacle with the coordinates of the line, but continuous and thicker\n * @return {Shape} The current shape\n */\n setEventReceptacle() {\n\n if (!this.currentPos1x) {\n return;\n }\n\n if (!this.rectEvent) {\n this.rectEvent = document.createElementNS(this.graph.ns, 'line');\n this.rectEvent.setAttribute('pointer-events', 'stroke');\n this.rectEvent.setAttribute('stroke', 'transparent');\n this.rectEvent.jsGraphIsShape = this;\n this.group.appendChild(this.rectEvent);\n }\n\n this.rectEvent.setAttribute('x1', this.currentPos1x);\n this.rectEvent.setAttribute('y1', this.currentPos1y);\n this.rectEvent.setAttribute('x2', this.currentPos2x);\n this.rectEvent.setAttribute('y2', this.currentPos2y);\n this.rectEvent.setAttribute('stroke-width', this.getProp('strokeWidth') + 2);\n }\n }\n\n exports.default = ShapeLine;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports);\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports);\n global.fit_lm = mod.exports;\n }\n})(this, function (module, exports) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n class FitHost {\n\n constructor(options) {\n\n this.DELTAP = 1e-6;\n this.BIGVAL = 9e99;\n this.WEIGHT = 1.0;\n\n this.setYData(options.dataY);\n this.setXData(options.dataX);\n this.setWeight(options.weight);\n this.setInitialParams(options.params);\n\n if (options.subsetIndex) {\n this.setSubset(...options.subsetIndex);\n }\n\n this.setFunction(options.function);\n\n if (options.progress) {\n this.hookIteration(options.progress);\n }\n\n this.options = options;\n }\n\n //[ [ x1, y1 ], [ x2, y2 ] ]\n setYData(data) {\n // Waveform instance\n this.data = data;\n }\n\n setXData(data) {\n // Waveform instance\n this.dataX = data;\n }\n\n setWeight(weight) {\n // Waveform instance\n this.weight = weight;\n }\n\n setInitialParams(params) {\n this.parms = params;\n\n this.parms = this.parms.map(el => {\n if (typeof el == 'function') {\n return el(this.data, this.dataX);\n } else {\n return el;\n }\n });\n this.NPARMS = params.length;\n }\n\n setSubset(fromIndex, toIndex) {\n if (fromIndex !== undefined && toIndex !== undefined) {\n this._from = fromIndex;\n this._to = toIndex;\n }\n }\n\n hookIteration(f) {\n this._hookIteration = params => {\n let data = this.buildFit(params, 200);\n f(data);\n };\n }\n\n setFunction(func) {\n this._func = func;\n }\n\n init() {\n\n // Get data length\n if (this._from !== undefined && this._to !== undefined) {\n\n if (this._from >= this._to) {\n throw 'Impossible to fit negative subranges. The starting index must be lower than the ending index';\n }\n\n this.NPTS = this._to - this._from + 1;\n\n if (this.data && this.data.getLength() <= this._to) {\n throw 'Wave Y has not enough point to be fitted to subrange [' + this._from + ', ' + this._to + ']';\n }\n\n if (this._from < 0) {\n throw 'Impossible to fit a subrange with negative indices';\n }\n } else {\n\n this.NPTS = this.data.getLength();\n this._from = 0;\n this._to = this.data.getLength() - 1;\n }\n\n if (this.dataX && this.dataX.getLength() <= this._to) {\n throw 'Wave X has not enough point to be fitted to subrange [' + this._from + ', ' + this._to + ']';\n }\n\n this.arrY = this.data.getDataY();\n\n if (this.dataX) {\n this.arrX = this.dataX.getDataY();\n } else {\n this.arrX = this.data.getDataX();\n }\n\n this.resid = new Array(this.NPTS).fill(0);\n this.jac = new Array(this.NPTS).fill(0);\n this.jac = this.jac.map(el => new Array(this.NPARMS));\n }\n\n fit() {\n\n this.log('Starting the fit with initial parameter list {' + this.parms.join() + '};');\n new LM(this, this.NPARMS, this.NPTS, this._hookIteration);\n this.log('Fit successful. Output parameters {' + this.parms.join() + '};');\n\n this._result = this.buildFit(this.parms, 200);\n\n if (this.options.done) {\n this.options.done(this.parms, this._result);\n }\n\n return this._result;\n }\n\n func(x, param) {\n return this._func(x, param);\n }\n\n computeResiduals() {\n var sumsq = 0;\n for (var i = 0; i < this.NPTS; i++) {\n this.resid[i] = (this.func(this.arrX[i + this._from], this.parms) - this.arrY[i + this._from]) * this.WEIGHT;\n sumsq += this.resid[i] * this.resid[i];\n }\n\n return sumsq;\n }\n\n log(message) {\n if (this.options.log) {\n console.log(message);\n }\n }\n\n //------the four mandated interface methods------------\n nudge(dp) {\n\n for (var j = 0; j < this.NPARMS; j++) {\n this.parms[j] += dp[j];\n }\n return this.computeResiduals();\n }\n\n buildJacobian() {\n // Allows LM to compute a new Jacobian.\n // Uses current parms[] and two-sided finite difference.\n // If current parms[] is bad, returns false.\n var delta = new Array(this.NPARMS);\n var FACTOR = 0.5 / this.DELTAP;\n var d = 0;\n\n for (var j = 0; j < this.NPARMS; j++) {\n for (var k = 0; k < this.NPARMS; k++) delta[k] = k == j ? this.DELTAP : 0.0;\n\n d = this.nudge(delta); // resid at pplus\n if (d == this.BIGVAL) {\n throw 'Bad dBuildJacobian() exit 2';\n }\n\n for (var i = 0; i < this.NPTS; i++) {\n this.jac[i][j] = this.getResidualElement(i);\n }\n\n for (var k = 0; k < this.NPARMS; k++) {\n delta[k] = k == j ? -2 * this.DELTAP : 0.0;\n }\n\n d = this.nudge(delta); // resid at pminus\n if (d == this.BIGVAL) {\n throw 'Bad dBuildJacobian(). exit 3';\n }\n\n for (var i = 0; i < this.NPTS; i++) this.jac[i][j] -= this.getResidualElement(i); // fetches resid[]\n\n for (var i = 0; i < this.NPTS; i++) this.jac[i][j] *= FACTOR;\n\n for (var k = 0; k < this.NPARMS; k++) delta[k] = k == j ? this.DELTAP : 0.0;\n\n d = this.nudge(delta);\n if (d == this.BIGVAL) {\n throw 'Bad dBuildJacobian(). exit 4';\n }\n }\n return true;\n }\n\n getResidualElement(i) {\n // Allows LM to see one element of the resid[] vector.\n return this.resid[i];\n }\n\n getJacobianElement(i, j) {\n // Allows LM to see one element of the Jacobian matrix.\n return this.jac[i][j];\n }\n\n buildFit(parms, length) {\n let x;\n\n if (!length) {\n x = this.arrX;\n } else {\n\n const xmin = this.dataX.getMin(this._from, this._to);\n const xmax = this.dataX.getMax(this._from, this._to);\n\n x = new Array(length).fill(0).map((el, index) => index * (xmax - xmin) / (length - 1) + xmin);\n }\n\n var fit = new Array(x.length);\n for (var i = 0, l = x.length; i < l; i++) {\n fit[i] = this.func(x[i], this.parms);\n }\n\n let waveformResult = this.options.waveform;\n waveformResult.setData(fit, x);\n //waveformResult.setXWaveform( x );\n\n return waveformResult;\n }\n }\n\n class LM {\n\n constructor(gH, gnadj, gnpnts, hook) {\n\n this.LMITER = 100; // max number of L-M iterations\n this.LMBOOST = 2.0; // damping increase per failed step\n this.LMSHRINK = 0.10; // damping decrease per successful step\n this.LAMBDAZERO = 0.001; // initial damping\n this.LAMBDAMAX = 1E9; // max damping\n this.LMTOL = 1E-12; // exit tolerance\n this.BIGVAL = 9e99; // trouble flag\n\n this.sos;\n this.sosprev;\n this.lambda;\n\n this.myH = null; // overwritten by constructor\n this.nadj = 0; // overwritten by constructor\n this.npts = 0; // overwritten by constructor\n\n this.delta; // local parm change\n this.beta;\n this.alpha;\n this.amatrix;\n\n // Constructor sets up fields and drives iterations.\n this.myH = gH;\n this.nadj = gnadj;\n this.npts = gnpnts;\n\n this.delta = new Array(this.nadj).fill(0);\n this.beta = new Array(this.nadj).fill(0);\n\n this.alpha = new Array(this.nadj).fill(0);\n this.amatrix = new Array(this.nadj).fill(0);\n\n this.alpha = this.alpha.map(() => new Array(this.nadj));\n this.amatrix = this.amatrix.map(() => new Array(this.nadj));\n\n this.lambda = this.LAMBDAZERO;\n\n var niter = 0;\n var done = false;\n do {\n done = this.bLMiter();\n\n if (hook) {\n hook(this.myH.params);\n }\n\n niter++;\n } while (!done && niter < this.LMITER);\n }\n\n bLMiter() {\n // Each call performs one LM iteration.\n // Returns true if done with iterations; false=wants more.\n // Global nadj, npts; needs nadj, myH to be preset.\n // Ref: M.Lampton, Computers in Physics v.11 pp.110-115 1997.\n for (var k = 0; k < this.nadj; k++) this.delta[k] = 0.0;\n this.sos = this.myH.nudge(this.delta);\n if (this.sos == this.BIGVAL) {\n console.error(' bLMiter finds faulty initial nudge()');\n return false;\n }\n this.sosprev = this.sos;\n\n this.myH.log(' bLMiter..SumOfSquares= ' + this.sos);\n if (!this.myH.buildJacobian()) {\n console.error(' bLMiter finds buildJacobian()=false');\n return false;\n }\n\n for (var k = 0; k < this.nadj; k++) // get downhill gradient beta\n {\n this.beta[k] = 0.0;\n for (var i = 0; i < this.npts; i++) {\n this.beta[k] -= this.myH.getResidualElement(i) * this.myH.getJacobianElement(i, k);\n }\n }\n\n for (var k = 0; k < this.nadj; k++) // get curvature matrix alpha\n for (var j = 0; j < this.nadj; j++) {\n this.alpha[j][k] = 0.0;\n for (var i = 0; i < this.npts; i++) {\n this.alpha[j][k] += this.myH.getJacobianElement(i, j) * this.myH.getJacobianElement(i, k);\n }\n }\n var rrise = 0;\n do // inner damping loop searches for one downhill step\n {\n for (var k = 0; k < this.nadj; k++) {\n // copy and damp it\n for (var j = 0; j < this.nadj; j++) {\n this.amatrix[j][k] = this.alpha[j][k] + (j == k ? this.lambda : 0.0);\n }\n }\n\n this.gaussj(this.amatrix, this.nadj); // invert\n\n for (var k = 0; k < this.nadj; k++) // compute delta[]\n {\n this.delta[k] = 0.0;\n for (var j = 0; j < this.nadj; j++) this.delta[k] += this.amatrix[j][k] * this.beta[j];\n }\n this.sos = this.myH.nudge(this.delta); // try it out.\n if (this.sos == this.BIGVAL) {\n console.error(' LMinner failed SOS step');\n return false;\n }\n rrise = (this.sos - this.sosprev) / (1 + this.sos);\n if (rrise <= 0.0) // good step!\n {\n this.lambda *= this.LMSHRINK; // shrink lambda\n break; // leave lmInner.\n }\n for (var q = 0; q < this.nadj; q++) {\n // reverse course!\n this.delta[q] *= -1.0;\n }\n this.myH.nudge(this.delta); // sosprev should still be OK\n if (rrise < this.LMTOL) {\n // finished but keep prev parms\n break; // leave inner loop\n }\n this.lambda *= this.LMBOOST; // else try more damping.\n } while (this.lambda < this.LAMBDAMAX);\n return rrise > -this.LMTOL || this.lambda > this.LAMBDAMAX;\n }\n\n gaussj(a, N) {\n // Inverts the double array a[N][N] by Gauss-Jordan method\n // M.Lampton UCB SSL (c)2003, 2005\n\n var det = 1.0,\n big,\n save;\n var i, j, k, L;\n var ik = new Array(100);\n var jk = new Array(100);\n\n for (k = 0; k < N; k++) {\n big = 0.0;\n for (i = k; i < N; i++) for (j = k; j < N; j++) // find biggest element\n if (Math.abs(big) <= Math.abs(a[i][j])) {\n big = a[i][j];\n ik[k] = i;\n jk[k] = j;\n }\n if (big == 0.0) return 0.0;\n i = ik[k];\n if (i > k) for (j = 0; j < N; j++) // exchange rows\n {\n save = a[k][j];\n a[k][j] = a[i][j];\n a[i][j] = -save;\n }\n j = jk[k];\n if (j > k) for (i = 0; i < N; i++) {\n save = a[i][k];\n a[i][k] = a[i][j];\n a[i][j] = -save;\n }\n for (i = 0; i < N; i++) // build the inverse\n if (i != k) a[i][k] = -a[i][k] / big;\n for (i = 0; i < N; i++) for (j = 0; j < N; j++) if (i != k && j != k) a[i][j] += a[i][k] * a[k][j];\n for (j = 0; j < N; j++) if (j != k) a[k][j] /= big;\n a[k][k] = 1.0 / big;\n det *= big; // bomb point\n } // end k loop\n for (L = 0; L < N; L++) {\n k = N - L - 1;\n j = ik[k];\n if (j > k) for (i = 0; i < N; i++) {\n save = a[i][k];\n a[i][k] = -a[i][j];\n a[i][j] = save;\n }\n i = jk[k];\n if (i > k) for (j = 0; j < N; j++) {\n save = a[k][j];\n a[k][j] = -a[i][j];\n a[i][j] = save;\n }\n }\n return det;\n }\n }\n\n exports.default = FitHost;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(9)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.axis.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphAxis);\n global.graphAxisY = mod.exports;\n }\n})(this, function (module, exports, _graphAxis) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphAxis2 = _interopRequireDefault(_graphAxis);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Generic constructor of a y axis\n * @extends Axis\n */\n class AxisY extends _graphAxis2.default {\n\n constructor(graph, leftright, options) {\n\n super(graph, leftright, options);\n this.leftright = leftright;\n this.left = leftright == 'left';\n }\n\n /**\n * @private\n */\n setAxisPosition(shift) {\n this.shiftPosition = shift;\n }\n\n getAxisPosition() {\n return this.shiftPosition || 0;\n }\n\n getAdditionalWidth() {\n let pos = 0;\n if (this.getLabel()) {\n pos += this.graph.options.fontSize;\n }\n\n if (this.isShown()) {\n pos += Math.abs(this.tickMargin);\n }\n return pos;\n }\n\n /**\n * @returns {Boolean} always ```false```\n */\n isX() {\n return false;\n }\n\n /**\n * @returns {Boolean} always ```true```\n */\n isY() {\n return true;\n }\n\n /**\n * @private\n */\n resetTicksLength() {\n this.longestTick = [false, 0];\n }\n\n /**\n * @private\n */\n getMaxSizeTick() {\n // Gives an extra margin of 5px\n return this.longestTick && this.longestTick[0] ? this.longestTick[0].getComputedTextLength() + 5 : 0; //(this.left ? 10 : 0);\n }\n\n draw() {\n\n this.tickMargin = this.left ? -5 - this.tickPx1 * this.tickScaling[1] : 2 - this.tickPx1 * this.tickScaling[1];\n var tickWidth = super.draw(...arguments);\n tickWidth += this.getAdditionalWidth();\n this.drawSpecifics(tickWidth);\n\n this.fullwidthlabel = tickWidth;\n\n return tickWidth;\n }\n\n equalizePosition(width) {\n\n this.placeLabel(this.left ? -width : width);\n\n if (this.getLabel()) {\n return width + this.graph.options.fontSize;\n }\n\n return 0;\n }\n\n /**\n * @private\n */\n drawTick(value, level, options, forcedPos) {\n let pos, tick, tickLabel;\n\n pos = forcedPos || this.getPos(value);\n\n if (pos == undefined || isNaN(pos)) {\n return;\n }\n\n tick = this.nextTick(level, tick => {\n\n tick.setAttribute('x1', (this.left ? 1 : -1) * this.tickPx1 * this.tickScaling[level]);\n tick.setAttribute('x2', (this.left ? 1 : -1) * this.tickPx2 * this.tickScaling[level]);\n\n if (level == 1) {\n tick.setAttribute('stroke', this.getPrimaryTicksColor());\n } else {\n tick.setAttribute('stroke', this.getSecondaryTicksColor());\n }\n });\n\n tick.setAttribute('y1', pos);\n tick.setAttribute('y2', pos);\n\n this.nextGridLine(level == 1, 0, this.graph.getDrawingWidth(), pos, pos);\n\n // this.groupTicks.appendChild( tick );\n if (level == 1) {\n tickLabel = this.nextTickLabel(tickLabel => {\n\n tickLabel.setAttribute('x', this.tickMargin + this.options.tickLabelOffset);\n if (this.getTicksLabelColor() !== 'black') {\n tickLabel.setAttribute('fill', this.getTicksLabelColor());\n }\n\n if (this.left) {\n tickLabel.setAttribute('text-anchor', 'end');\n } else {\n tickLabel.setAttribute('text-anchor', 'start');\n }\n tickLabel.style.dominantBaseline = 'central';\n });\n\n tickLabel.setAttribute('y', pos);\n this.setTickContent(tickLabel, value, options);\n\n if (String(tickLabel.textContent).length >= this.longestTick[1]) {\n this.longestTick[0] = tickLabel;\n this.longestTick[1] = String(tickLabel.textContent).length;\n }\n }\n }\n\n drawLabel() {\n\n if (this.getLabelColor() !== 'black') {\n this.label.setAttribute('fill', this.getLabelColor());\n }\n\n this.label.setAttribute('dominant-baseline', !this.left ? 'auto' : 'auto');\n this.labelTspan.textContent = this.getLabel();\n }\n\n placeLabel(y) {\n this.label.setAttribute('transform', 'translate(' + y + ', ' + Math.abs(this.getMaxPx() + this.getMinPx()) / 2 + ') rotate(-90)');\n }\n\n /**\n * @private\n */\n drawSpecifics() {\n // Place label correctly\n //this.label.setAttribute('x', (this.getMaxPx() - this.getMinPx()) / 2);\n /*\n if ( !this.left ) {\n this.labelTspan.style.dominantBaseline = 'hanging';\n this.expTspan.style.dominantBaseline = 'hanging';\n this.expTspanExp.style.dominantBaseline = 'hanging';\n this.unitTspan.style.dominantBaseline = 'hanging';\n this.preunitTspan.style.dominantBaseline = 'hanging';\n }\n */\n this.line.setAttribute('y1', this.getMinPx());\n this.line.setAttribute('y2', this.getMaxPx());\n this.line.setAttribute('x1', 0);\n this.line.setAttribute('x2', 0);\n\n this.line.setAttribute('stroke', this.getAxisColor());\n\n var span = this.getSpan();\n this.line.setAttribute('marker-start', !this.options.splitMarks || span[0] == 0 ? '' : 'url(#verticalsplit_' + this.graph.getId() + ')');\n this.line.setAttribute('marker-end', !this.options.splitMarks || span[1] == 1 ? '' : 'url(#verticalsplit_' + this.graph.getId() + ')');\n }\n\n /**\n * @private\n */\n setShift(shift) {\n\n this.shift = shift;\n\n if (!this.shift || !this.graph.getWidth()) {\n return;\n }\n\n let xshift = this.shift;\n xshift = this.floating ? xshift : this.isLeft() ? xshift : this.graph.getWidth() - this.graph.getPaddingRight() - this.graph.getPaddingLeft() - xshift;\n this.group.setAttribute('transform', 'translate( ' + xshift + ' 0 )');\n this.drawLabel();\n }\n\n /**\n * @private\n */\n isLeft() {\n return this.left;\n }\n\n /**\n * @private\n */\n isRight() {\n return !this.left;\n }\n\n /**\n * @private\n */\n isFlipped() {\n return !this.options.flipped;\n }\n\n /**\n * @private\n */\n _drawLine(pos, line) {\n\n let px = this.getPx(pos);\n\n if (!line) {\n line = document.createElementNS(this.graph.ns, 'line');\n } else {\n line.setAttribute('display', 'initial');\n }\n\n line.setAttribute('y1', px);\n line.setAttribute('y2', px);\n\n line.setAttribute('x1', 0);\n line.setAttribute('x2', this.graph.drawingSpaceWidth);\n\n line.setAttribute('stroke', 'black');\n this.group.appendChild(line);\n\n return line;\n }\n\n _hideLine(line) {\n if (!line) {\n return;\n }\n\n line.setAttribute('display', 'none');\n }\n\n /**\n * @private\n */\n handleMouseMoveLocal(x, y) {\n y -= this.graph.getPaddingTop();\n this.mouseVal = this.getVal(y);\n }\n\n /**\n * Scales the axis with respect to the series contained in an x axis\n * @param {Axis} [ axis = graph.getXAxis() ] - The X axis to use as a reference\n * @param {Serie} [ excludeSerie ] - A serie to exclude\n * @param {Number} [ start = xaxis.getCurrentMin() ] - The start of the boundary\n * @param {Number} [ end = xaxis.getCurrentMax() ] - The end of the boundary\n * @param {Boolean} [ min = true ] - Adapt the min\n * @param {Boolean} [ max = true ] - Adapt the max\n * @returns {Axis} The current axis\n */\n scaleToFitAxis(axis, excludeSerie, start, end, min, max) {\n //console.log( axis instanceof GraphAxis );\n if (!axis || !axis.isX()) {\n axis = this.graph.getXAxis();\n }\n\n if (isNaN(start)) {\n start = axis.getCurrentMin();\n }\n\n if (isNaN(end)) {\n end = axis.getCurrentMax();\n }\n\n if (min === undefined) {\n min = true;\n }\n\n if (max === undefined) {\n max = true;\n }\n\n if (typeof excludeSerie == 'number') {\n end = start;\n start = excludeSerie;\n excludeSerie = false;\n }\n\n var maxV = -Infinity,\n minV = Infinity,\n j = 0;\n\n for (var i = 0, l = this.graph.series.length; i < l; i++) {\n\n if (!this.graph.series[i].isShown()) {\n continue;\n }\n\n if (this.graph.series[i] == excludeSerie) {\n continue;\n }\n\n if (!(this.graph.series[i].getXAxis() == axis) || this.graph.series[i].getYAxis() !== this) {\n continue;\n }\n\n j++;\n\n maxV = max ? Math.max(maxV, this.graph.series[i].getMax(start, end)) : 0;\n minV = min ? Math.min(minV, this.graph.series[i].getMin(start, end)) : 0;\n }\n\n if (j == 0) {\n\n this.setMinMaxToFitSeries(); // No point was found\n } else {\n\n // If we wanted originally to resize min and max. Otherwise we use the current value\n minV = min ? minV : this.getCurrentMin();\n maxV = max ? maxV : this.getCurrentMax();\n\n var interval = maxV - minV;\n\n minV -= this.options.axisDataSpacing.min * interval;\n maxV += this.options.axisDataSpacing.max * interval;\n\n this._doZoomVal(minV, maxV);\n }\n\n return this;\n }\n\n /**\n * Caches the minimum px and maximum px position of the axis. Includes axis spans and flipping. Mostly used internally\n * @return {Axis} The current axis instance\n */\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n\n if (isNaN(interval)) {\n return;\n }\n\n var maxPx = this.maxPx - interval * this.options.span[0] - this.options.marginMin;\n var minPx = this.maxPx - interval * this.options.span[1] + this.options.marginMax;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n }\n\n getZProj(zValue) {\n return zValue * this.graph.options.zAxis.shiftY;\n }\n\n }\n\n exports.default = AxisY;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports);\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports);\n global.graphMixinSerie3d = mod.exports;\n }\n})(this, function (module, exports) {\n \"use strict\";\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n var Serie3DMixin = {\n\n /**\n * Returns the x position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The x position in px corresponding to the x value\n */\n getX: function (val) {\n return (val = this.getXAxis().getPx(val)) - val % 0.2 + this.getXAxis().getZProj(this.options.zpos);\n },\n\n /**\n * Returns the y position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie3DMixin\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The y position in px corresponding to the y value\n */\n getY: function (val) {\n return (val = this.getYAxis().getPx(val)) - val % 0.2 + this.getYAxis().getZProj(this.options.zpos);\n },\n\n getZPos: function () {\n return this.options.zpos;\n },\n\n /**\n * @returns {Number} Lowest x value of the serie's data\n * @memberof Serie\n */\n getMinX: function (useZValues) {\n if (!useZValues) {\n return this.minX;\n }\n\n return getZCorrectedValue(this, true, true);\n },\n\n /**\n * @returns {Number} Highest x value of the serie's data\n * @memberof Serie\n */\n getMaxX: function (useZValues) {\n\n if (!useZValues) {\n return this.maxX;\n }\n return getZCorrectedValue(this, true, false);\n },\n\n /**\n * @returns {Number} Lowest y value of the serie's data\n * @memberof Serie\n */\n getMinY: function (useZValues) {\n\n if (!useZValues) {\n return this.minY;\n }\n return getZCorrectedValue(this, false, true);\n },\n\n /**\n * @returns {Number} Highest y value of the serie's data\n * @memberof Serie\n */\n getMaxY: function (useZValues) {\n\n if (!useZValues) {\n return this.maxY;\n }\n return getZCorrectedValue(this, false, false);\n }\n\n };\n\n function getZCorrectedValue(serie, x, min) {\n\n let i, l, data, val, valFinal;\n let wf = serie.getWaveforms();\n\n for (let wave of wf) {\n\n i = 0;\n l = wave.getLength();\n data = wave.getData();\n\n for (; i < l; i += 1) {\n\n if (x) {\n val = serie.getXAxis().getVal(serie.getX(wave.getX(i, true)));\n } else {\n val = serie.getYAxis().getVal(serie.getY(data[i]));\n }\n\n if (i == 0) {\n valFinal = val;\n } else {\n\n if (min) {\n valFinal = Math.min(valFinal, val);\n } else {\n valFinal = Math.max(valFinal, val);\n }\n }\n }\n }\n return valFinal;\n }\n\n exports.default = Serie3DMixin;\n module.exports = exports[\"default\"];\n});\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(8), __webpack_require__(0), __webpack_require__(10)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.serie.js'), require('../graph.util.js'), require('../mixins/graph.mixin.errorbars.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphSerie, global.graphUtil, global.graphMixinErrorbars);\n global.graphSerieScatter = mod.exports;\n }\n})(this, function (module, exports, _graphSerie, _graphUtil, _graphMixinErrorbars) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphSerie2 = _interopRequireDefault(_graphSerie);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphMixinErrorbars2 = _interopRequireDefault(_graphMixinErrorbars);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n const defaults = {};\n\n var type = 'scatter';\n\n /**\n * @static\n * @augments Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\n class SerieScatter extends _graphSerie2.default {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n this.id = Math.random() + Date.now();\n this.shapes = []; // Stores all shapes\n this.shown = true;\n this.data = [];\n\n this.shapesDetails = [];\n this.shapes = [];\n\n this._type = type;\n\n util.mapEventEmission(this.options, this);\n\n this._isMinOrMax = {\n x: {\n min: false,\n max: false\n },\n y: {\n min: false,\n max: false\n }\n };\n\n this.groupPoints = document.createElementNS(this.graph.ns, 'g');\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.additionalData = {};\n\n this.selectedStyleGeneral = {};\n this.selectedStyleModifiers = {};\n\n this.groupPoints.addEventListener('mouseover', e => {\n var id = parseInt(e.target.parentElement.getAttribute('data-shapeid'));\n this.emit('mouseover', id, this.waveform.getX(id), this.waveform.getY(id));\n });\n\n this.groupPoints.addEventListener('mouseout', e => {\n var id = parseInt(e.target.parentElement.getAttribute('data-shapeid'));\n this.emit('mouseout', id, this.waveform.getX(id), this.waveform.getY(id));\n });\n\n this.minX = Number.MAX_VALUE;\n this.minY = Number.MAX_VALUE;\n this.maxX = Number.MIN_VALUE;\n this.maxY = Number.MIN_VALUE;\n\n this.groupMain.appendChild(this.groupPoints);\n this.currentAction = false;\n\n if (this.initExtended1) {\n this.initExtended1();\n }\n\n this.styles = {};\n this.styles.unselected = {};\n this.styles.selected = {};\n\n this.styles.unselected.default = {\n shape: 'circle',\n cx: 0,\n cy: 0,\n r: 3,\n stroke: 'transparent',\n fill: 'black'\n };\n\n this.styles.selected.default = {\n shape: 'circle',\n cx: 0,\n cy: 0,\n r: 4,\n stroke: 'transparent',\n fill: 'black'\n };\n }\n\n /**\n * Applies for x as the category axis\n * @example serie.setDataCategory( { x: \"someName\", y: Waveform } );\n */\n setDataCategory(data) {\n\n let minY = +Infinity;\n let maxY = -Infinity;\n\n for (let dataCategory of data) {\n\n this._checkY(dataCategory.y.getMaxY());\n this._checkY(dataCategory.y.getMinY());\n }\n\n this.data = data;\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n return this;\n }\n\n /**\n * Removes all DOM points\n * @private\n */\n empty() {\n\n while (this.groupPoints.firstChild) {\n this.groupPoints.removeChild(this.groupPoints.firstChild);\n }\n }\n\n getSymbolForLegend() {\n\n if (this.symbol) {\n return this.symbol;\n }\n\n var g = document.createElementNS(this.graph.ns, 'g');\n g.setAttribute('data-shapeid', -1);\n var shape = this.doShape(g, this.styles.unselected.default);\n\n var style = this.getStyle('unselected', -1, true);\n\n for (var i in style[-1]) {\n if (i == 'shape') {\n continue;\n }\n shape.setAttribute(i, style[-1][i]);\n }\n\n return g;\n }\n\n /**\n * Sets style to the scatter points\n * First argument is the style applied by default to all points\n * Second argument is an array of modifiers that allows customization of any point of the scatter plot. Data for each elements of the array will augment allStyles, so be sure to reset the style if needed.\n * All parameters - except shape - will be set as parameters to the DOM element of the shape\n *\n * @example\n * var modifiers = [];\n * modifiers[ 20 ] = { shape: 'circle', r: 12, fill: 'rgba(0, 100, 255, 0.3)', stroke: 'rgb(0, 150, 255)' };\n * serie.setStyle( { shape: 'circle', r: 2, fill: 'rgba(255, 0, 0, 0.3)', stroke: 'rgb(255, 100, 0)' }, modifiers ); // Will modify scatter point n°20\n *\n * @param {Object} allStyles - The general style for all markers\n * @param {Object} [ modifiers ] - The general style for all markers\n * @param {String} [ selectionMode=\"unselected\" ] - The selection mode to which this style corresponds. Default is unselected\n *\n */\n setStyle(all, modifiers, mode = 'unselected') {\n\n if (typeof modifiers == 'string') {\n mode = modifiers;\n modifiers = false;\n }\n\n /*\n if( ! this.styles[ mode ] ) {\n }\n if ( mode !== \"selected\" && mode !== \"unselected\" ) {\n throw \"Style mode is not correct. Should be selected or unselected\";\n }\n */\n\n this.styles[mode] = this.styles[mode] || {};\n this.styles[mode].all = all;\n this.styles[mode].modifiers = modifiers;\n\n this.styleHasChanged(mode);\n\n return this;\n }\n\n /**\n * Redraws the serie\n * @private\n * @param {force} Boolean - Forces redraw even if the data hasn't changed\n */\n draw(force) {\n // Serie redrawing\n\n if (!force && !this.hasDataChanged() && !this.hasStyleChanged('unselected')) {\n return;\n }\n\n var x,\n y,\n xpx,\n ypx,\n j = 0,\n k,\n m,\n currentLine,\n max;\n\n var isCategory = this.getXAxis().getType() == 'category';\n\n this._drawn = true;\n\n this.dataHasChanged(false);\n this.styleHasChanged(false);\n this.groupMain.removeChild(this.groupPoints);\n\n var keys = [];\n\n j = 0;\n k = 0;\n\n if (this.hasErrors()) {\n this.errorDrawInit();\n }\n\n if (isCategory) {\n\n let k = 0;\n\n for (; j < this.data.length; j++) {\n\n if (!this.categoryIndices.hasOwnProperty(this.data[j].x)) {\n continue;\n }\n\n if (this.error) {\n // this.errorAddPoint( j, position[ 0 ] + position[ 1 ] / 2, 0, this.getX( position[ 0 ] + position[ 1 ] / 2 ), ypx );\n }\n\n for (var n = 0, l = this.data[j].y.getLength(); n < l; n++) {\n\n //let xpos = i / ( l - 1 ) * ( position[ 1 ] ) + position[ 0 ];\n\n ypx = this.getY(this.data[j].y.getY(n));\n xpx = this.getX(n / (l - 1) * (0.8 / this.nbCategories) + this.categoryIndices[this.data[j].x] + 0.1 / this.nbCategories);\n n++;\n\n this.shapesDetails[k] = this.shapesDetails[k] || [];\n this.shapesDetails[k][0] = xpx;\n this.shapesDetails[k][1] = ypx;\n keys.push(k);\n k++;\n }\n }\n } else {\n\n for (; j < this.waveform.getLength(); j++) {\n\n if (this.waveform.getX(j) < this.getXAxis().getCurrentMin() || this.waveform.getX(j) > this.getXAxis().getCurrentMax() || this.waveform.getY(j) < this.getYAxis().getCurrentMin() || this.waveform.getY(j) > this.getYAxis().getCurrentMax()) {\n\n if (this.shapes[j]) {\n this.shapes[j].setAttribute('display', 'none');\n }\n continue;\n }\n\n if (this.shapes[j]) {\n this.shapes[j].setAttribute('display', 'initial');\n }\n\n xpx = this.getX(this.waveform.getX(j));\n ypx = this.getY(this.waveform.getY(j));\n\n if (this.hasErrors()) {\n this.errorAddPoint(j, this.waveform.getX(j), this.waveform.getY(j), xpx, ypx);\n }\n\n this.shapesDetails[j] = this.shapesDetails[j] || [];\n this.shapesDetails[j][0] = xpx;\n this.shapesDetails[j][1] = ypx;\n keys.push(j);\n\n //this.shapes[ j / 2 ] = this.shapes[ j / 2 ] || undefined;\n }\n }\n\n if (this.hasErrors()) {\n this.errorDraw();\n }\n\n // This will automatically create the shapes\n this.applyStyle('unselected', keys);\n\n this.groupMain.appendChild(this.groupPoints);\n }\n\n _addPoint(xpx, ypx, k) {\n\n let shape;\n let g = document.createElementNS(this.graph.ns, 'g');\n g.setAttribute('transform', 'translate(' + xpx + ', ' + ypx + ')');\n g.setAttribute('data-shapeid', k);\n\n if (this.extraStyle && this.extraStyle[k]) {\n\n shape = this.doShape(g, this.extraStyle[k]);\n } else if (this.stdStylePerso) {\n\n shape = this.doShape(g, this.stdStylePerso);\n } else {\n\n shape = this.doShape(g, this.stdStyle);\n }\n\n this.shapes[k] = shape;\n this.groupPoints.appendChild(g);\n }\n\n doShape(group, shape) {\n var el = document.createElementNS(this.graph.ns, shape.shape);\n group.appendChild(el);\n return el;\n }\n\n getStyle(selection, index, noSetPosition) {\n\n var selection = selection || 'unselected';\n var indices;\n\n var styles = {};\n\n if (typeof index == 'number') {\n indices = [index];\n } else if (Array.isArray(index)) {\n indices = index;\n }\n\n var shape, index, modifier, style, j; // loop variables\n var styleAll;\n\n if (this.styles[selection].all !== undefined) {\n\n styleAll = this.styles[selection].all;\n\n if (typeof styleAll == 'function') {\n\n styleAll = styleAll();\n } else if (styleAll === false) {\n\n styleAll = {};\n }\n }\n\n var i = 0,\n l = indices.length;\n\n for (; i < l; i++) {\n\n index = indices[i];\n shape = this.shapes[index];\n\n if ((modifier = this.styles[selection].modifiers) && (typeof modifier == 'function' || modifier[index])) {\n\n if (typeof modifier == 'function') {\n\n style = modifier(index, shape);\n } else if (modifier[index]) {\n\n style = modifier[index];\n }\n\n styles[index] = Object.assign({}, styleAll, style);\n } else if (styleAll !== undefined) {\n\n styles[index] = styleAll;\n } else {\n\n styles[index] = this.styles[selection].default;\n }\n\n if (!styles[index]) {\n styles[index] = styleAll;\n }\n\n if (!shape) {\n // Shape doesn't exist, let's create it\n\n if (!styles[index].shape) {\n console.error(style);\n throw 'No shape was defined with this style.';\n }\n\n var g = document.createElementNS(this.graph.ns, 'g');\n g.setAttribute('data-shapeid', index);\n this.shapes[index] = this.doShape(g, styles[index]);\n this.groupPoints.appendChild(g);\n shape = this.shapes[index];\n }\n\n if (!noSetPosition) {\n shape.parentNode.setAttribute('transform', 'translate(' + this.shapesDetails[index][0] + ', ' + this.shapesDetails[index][1] + ')');\n }\n }\n\n return styles;\n }\n\n applyStyle(selection, index, noSetPosition) {\n\n var i, j;\n var styles = this.getStyle(selection, index, noSetPosition);\n\n for (i in styles) {\n\n for (j in styles[i]) {\n\n if (j !== 'shape') {\n\n if (styles[i][j]) {\n\n this.shapes[i].setAttribute(j, styles[i][j]);\n } else {\n\n this.shapes[i].removeAttribute(j);\n }\n }\n }\n }\n }\n\n unselectPoint(index) {\n this.selectPoint(index, false);\n }\n\n selectPoint(index, setOn, selectionType) {\n\n if (this.shapesDetails[index][2] && this.shapesDetails[index][2] == selectionType) {\n return;\n }\n\n if (typeof setOn == 'string') {\n selectionType = setOn;\n setOn = undefined;\n }\n\n if (Array.isArray(index)) {\n return this.selectPoints(index);\n }\n\n if (this.shapes[index] && this.shapesDetails[index]) {\n\n if ((this.shapesDetails[index][2] || setOn === false) && setOn !== true) {\n\n var selectionStyle = this.shapesDetails[index][2];\n this.shapesDetails[index][2] = false;\n\n var allStyles = this.getStyle(selectionStyle, index, true);\n for (var i in allStyles[index]) {\n this.shapes[index].removeAttribute(i);\n }\n\n this.applyStyle('unselected', index, true);\n } else {\n\n selectionType = selectionType || 'selected';\n this.shapesDetails[index][2] = selectionType;\n\n this.applyStyle(selectionType, index, true);\n }\n }\n }\n\n getUsedCategories() {\n\n if (typeof this.data[0] == 'object') {\n return this.data.map(d => d.x);\n }\n\n return [];\n }\n\n }\n\n util.mix(SerieScatter, _graphMixinErrorbars2.default);\n\n exports.default = SerieScatter;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(8), __webpack_require__(4), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.serie.js'), require('../util/waveform.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphSerie, global.waveform, global.graphUtil);\n global.graphSerieZone = mod.exports;\n }\n})(this, function (module, exports, _graphSerie, _waveform, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphSerie2 = _interopRequireDefault(_graphSerie);\n\n var _waveform2 = _interopRequireDefault(_waveform);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * @static\n * @extends Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\n class SerieZone extends _graphSerie2.default {\n\n static default() {\n return {\n fillColor: 'rgba( 0, 0, 0, 0.1 )',\n lineColor: 'rgba( 0, 0, 0, 1 )',\n lineWidth: '1px'\n };\n }\n constructor(graph, name, options) {\n super(...arguments);\n\n this.selectionType = 'unselected';\n this.id = (0, _graphUtil.guid)();\n\n this.groupZones = document.createElementNS(this.graph.ns, 'g');\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n this.lineZone = document.createElementNS(this.graph.ns, 'path');\n this.lineZone.setAttribute('stroke', 'black');\n this.lineZone.setAttribute('stroke-width', '1px');\n\n this.groupMain.appendChild(this.groupZones);\n this.groupZones.appendChild(this.lineZone);\n\n this.applyLineStyle(this.lineZone);\n this.styleHasChanged();\n\n this.clip = document.createElementNS(this.graph.ns, 'clipPath');\n this.clipId = (0, _graphUtil.guid)();\n this.clip.setAttribute('id', this.clipId);\n\n this.graph.defs.appendChild(this.clip);\n }\n\n /**\n * Assigns a collection of waveforms that make up the zone\n * The waveforms will appended one after the other, without break\n * @param {...Waveform} waveforms - The collection of waveforms\n * @return {SerieZone} - The current serie zone instance\n * @memberof SerieZone\n */\n setWaveform(...waveforms) {\n this.waveforms = waveforms;\n\n this.waveforms = this.waveforms.map(wave => {\n\n if (!(wave instanceof _waveform2.default)) {\n return new _waveform2.default(wave);\n } else {\n return wave;\n }\n });\n\n this.minX = this.waveforms[0].getXMin();\n this.maxX = this.waveforms[0].getXMax();\n this.minY = this.waveforms[0].getMin();\n this.maxY = this.waveforms[0].getMax();\n\n this.waveforms.map(wave => {\n\n this.minX = Math.min(wave.getXMin(), this.minX);\n this.maxX = Math.max(wave.getXMin(), this.maxX);\n this.minY = Math.min(wave.getMin(), this.minY);\n this.maxY = Math.max(wave.getMax(), this.maxY);\n });\n\n this.graph.updateDataMinMaxAxes();\n this.dataHasChanged();\n return this;\n }\n\n setWaveforms() {\n return this.setWaveform(...arguments);\n }\n\n getWaveforms() {\n return this.waveforms;\n }\n\n setMinMaxWaveforms(min, max) {\n this.waveforms = [min, max.reverse()];\n return this;\n }\n\n /**\n * Removes all the dom concerning this serie from the drawing zone\n */\n empty() {\n\n while (this.group.firstChild) {\n this.group.removeChild(this.group.firstChild);\n }\n }\n\n /**\n * Redraws the serie\n * @private\n *\n * @param {force} Boolean - Forces redraw even if the data hasn't changed\n */\n draw(force) {\n // Serie redrawing\n\n if (force || this.hasDataChanged()) {\n\n if (!this.waveforms) {\n return;\n }\n\n let dataX = 0,\n dataY = 0,\n xpx = 0,\n ypx = 0,\n j = 0,\n line = '',\n buffer,\n move = false;\n\n const xminpx = this.getXAxis().getMinPx(),\n xmaxpx = this.getXAxis().getMaxPx(),\n yminpx = this.getYAxis().getMinPx(),\n ymaxpx = this.getYAxis().getMaxPx();\n\n const xmin = this.getXAxis().getCurrentMin(),\n xmax = this.getXAxis().getCurrentMax(),\n ymin = this.getYAxis().getCurrentMin(),\n ymax = this.getYAxis().getCurrentMax();\n\n //this.clipRect.setAttribute( \"x\", Math.min( xmin, xmax ) );\n //this.clipRect.setAttribute( \"y\", Math.min( ymin, ymax ) );\n //this.clipRect.setAttribute( \"width\", Math.abs( xmax - xmin ) );\n //this.clipRect.setAttribute( \"height\", Math.abs( ymax - ymin ) );\n\n this.groupMain.removeChild(this.groupZones);\n\n for (let waveform of this.waveforms) {\n\n for (j = 0; j < waveform.getLength(); j += 1) {\n dataX = waveform.getX(j, true);\n dataY = waveform.getY(j, true);\n\n // The y axis in screen coordinate is inverted vs cartesians\n if (dataY[j] < ymin) {\n ypx = this.getY(ymin);\n } else if (dataY[j] > ymax) {\n ypx = this.getY(ymax);\n }\n\n if (dataX !== dataX) {\n continue;\n }\n\n if (dataY !== dataY) {\n // Let's make a new line\n\n if (line.length == 0) {\n continue;\n }\n\n line += 'L ' + xpx + ', ' + this.getY(waveform.getMinY());\n move = true;\n continue;\n }\n\n ypx = this.getY(dataY);\n xpx = this.getX(dataX);\n\n if (dataX < xmin || dataX > xmax) {\n buffer = [dataX, dataY[j], xpx, ypx];\n continue;\n }\n\n if (move) {\n line += ' M ' + xpx + ', ' + this.getY(waveform.getMinY()) + ' ';\n move = false;\n }\n\n if (line.length > 0) {\n line += ' L ';\n }\n\n if (buffer) {\n line += buffer[2] + ',' + buffer[3] + ' ';\n buffer = false;\n } else {\n line += xpx + ',' + ypx + ' ';\n }\n }\n }\n\n if (line !== '') {\n this.lineZone.setAttribute('d', 'M ' + line + ' z');\n } else {\n this.lineZone.setAttribute('d', '');\n }\n this.groupMain.appendChild(this.groupZones);\n }\n\n if (this.hasStyleChanged(this.selectionType)) {\n this.applyLineStyle(this.lineZone);\n this.styleHasChanged(false);\n }\n }\n\n /**\n * Applies the computed style to the DOM element fed as a parameter\n * @private\n *\n * @param {SVGLineElement} line - The line to which the style has to be applied to\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n line.setAttribute('fill', this.getFillColor());\n line.setAttribute('fill-opacity', this.getFillOpacity());\n line.setAttribute('stroke-opacity', this.getLineOpacity());\n }\n\n /**\n * Sets the line width\n *\n * @param {Number} width - The line width\n * @returns {SerieZone} - The current serie\n */\n setLineWidth(width) {\n this.options.lineWidth = width;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line width\n *\n * @returns {Number} - The line width\n */\n getLineWidth() {\n return this.options.lineWidth;\n }\n\n /**\n * Sets the line opacity\n *\n * @param {Number} opacity - The line opacity\n * @returns {SerieZone} - The current serie\n */\n setLineOpacity(opacity) {\n this.options.lineOpacity = opacity;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line opacity\n *\n * @returns {Number} - The line opacity\n */\n getLineOpacity() {\n return this.options.lineOpacity;\n }\n\n /**\n * Sets the line color\n *\n * @param {String} color - The line color\n * @returns {SerieZone} - The current serie\n */\n setLineColor(color) {\n this.options.lineColor = color;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line width\n *\n * @returns {Number} - The line width\n */\n getLineColor() {\n return this.options.lineColor;\n }\n\n /**\n * Sets the fill opacity\n *\n * @param {Number} opacity - The fill opacity\n * @returns {SerieZone} - The current serie\n */\n setFillOpacity(opacity) {\n this.options.fillOpacity = opacity;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the fill opacity\n *\n * @returns {Number} - The fill opacity\n */\n getFillOpacity() {\n return this.options.fillOpacity;\n }\n\n /**\n * Sets the fill color\n *\n * @param {Number} width - The line width\n * @returns {Number} - The line width\n */\n setFillColor(color) {\n this.options.fillColor = color;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the fill color\n *\n * @returns {Number} - The fill color\n */\n getFillColor() {\n return this.options.fillColor;\n }\n\n }\n\n exports.default = SerieZone;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(1), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShape, global.graphUtil);\n global.graphShapeRect = mod.exports;\n }\n})(this, function (module, exports, _graphShape, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Represents a rectangle that extends the Shape class\n * @class ShapeRectangle\n * @augments Shape\n * @see Graph#newShape\n */\n class ShapeRectangle extends _graphShape2.default {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'rect');\n\n if (!this.getStrokeColor()) {\n this.setStrokeColor('black');\n }\n\n if (!this.getStrokeWidth()) {\n this.setStrokeWidth(1);\n }\n\n if (!this.getFillColor()) {\n this.setFillColor('transparent');\n }\n\n return this;\n }\n\n /**\n * Creates the Handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {\n if (!this.hasHandles()) {\n return;\n }\n\n /*\n this._data.handles = this._data.handles || {\n type: 'corners'\n };\n */\n\n var handles = this.getProp('handles');\n\n if (typeof handles != 'object') {\n handles = {};\n }\n\n if (!handles.type) {\n handles.type = 'corners';\n }\n\n switch (handles.type) {\n\n case 'sides':\n\n util.extend(handles, {\n sides: {\n top: true,\n bottom: true,\n left: true,\n right: true\n }\n });\n\n var j = 0;\n for (var i in handles.sides) {\n if (handles.sides[i]) {\n j++;\n }\n }\n\n this._createHandles(j, 'g').map(function (g) {\n\n var r = document.createElementNS(self.graph.ns, 'rect');\n r.setAttribute('x', '-3');\n r.setAttribute('width', '6');\n r.setAttribute('y', '-6');\n r.setAttribute('height', '12');\n r.setAttribute('stroke', 'black');\n r.setAttribute('fill', 'white');\n r.setAttribute('cursor', 'pointer');\n\n g.appendChild(r);\n });\n\n var j = 1;\n\n for (var i in handles.sides) {\n if (handles.sides[i]) {\n this.handles[i] = this['handle' + j];\n this.sides[j] = i;\n j++;\n }\n }\n\n break;\n\n case 'corners':\n this._createHandles(4, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white'\n });\n\n if (this.handles) {\n this.handles[2].setAttribute('cursor', 'nesw-resize');\n this.handles[4].setAttribute('cursor', 'nesw-resize');\n\n this.handles[1].setAttribute('cursor', 'nwse-resize');\n this.handles[3].setAttribute('cursor', 'nwse-resize');\n }\n\n break;\n\n case 'seamlessX':\n\n this._createHandles(2, 'rect', {\n transform: 'translate(-3 -3)',\n stroke: 'transparent',\n fill: 'transparent',\n width: '20px',\n cursor: 'ew-resize'\n });\n\n break;\n }\n\n super.createHandles();\n\n return this;\n }\n\n /**\n * Updates the position\n * @memberof ShapeRectangle\n * @private\n * @return {Shape} The current shape\n */\n applyPosition() {\n\n var pos = this.computePosition(0),\n pos2 = this.computePosition(1),\n x,\n y,\n width,\n height;\n\n if (pos.x < pos2.x) {\n x = pos.x;\n width = pos2.x - pos.x;\n } else {\n x = pos2.x;\n width = pos.x - pos2.x;\n }\n\n if (pos.y < pos2.y) {\n y = pos.y;\n height = pos2.y - pos.y;\n } else {\n y = pos2.y;\n height = pos.y - pos2.y;\n }\n\n this.currentX = x;\n this.currentY = y;\n this.currentW = width;\n this.currentH = height;\n\n if (!isNaN(x) && !isNaN(y) && x !== false && y !== false) {\n\n this.setDom('width', width);\n this.setDom('height', height);\n this.setDom('x', x);\n this.setDom('y', y);\n\n this.setHandles();\n this.updateMask();\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Implements mouse move event\n * @private\n * @return {Shape} The current shape\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n var handles = this.getProp('handles');\n\n if (!this.moving && !this.handleSelected) {\n return;\n }\n\n var pos = this.getPosition(0);\n var pos2 = this.getPosition(1);\n\n var invX = this.getXAxis().isFlipped(),\n invY = this.getYAxis().isFlipped(),\n posX = pos.x,\n posY = pos.y,\n pos2X = pos2.x,\n pos2Y = pos2.y;\n\n if (this.moving) {\n\n pos.deltaPosition('x', deltaX, this.getXAxis());\n pos.deltaPosition('y', deltaY, this.getYAxis());\n\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n } else {\n\n switch (handles.type) {\n\n case 'seamlessX':\n // Do nothing for now\n\n switch (this.handleSelected) {\n\n case 1:\n pos.deltaPosition('x', deltaX, this.getXAxis());\n break;\n\n case 2:\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n break;\n }\n\n break;\n\n case 'sides':\n // Do nothing for now\n\n switch (this.sides[this.handleSelected]) {\n\n case 'left':\n pos.deltaPosition('x', deltaX, this.getXAxis());\n break;\n\n case 'right':\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n break;\n\n case 'top':\n pos.deltaPosition('y', deltaY, this.getYAxis());\n break;\n\n case 'bottom':\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n break;\n\n }\n\n break;\n\n case 'corners':\n default:\n\n if (this.handleSelected == 1) {\n\n pos.deltaPosition('x', deltaX, this.getXAxis());\n pos.deltaPosition('y', deltaY, this.getYAxis());\n } else if (this.handleSelected == 2) {\n\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n pos.deltaPosition('y', deltaY, this.getYAxis());\n } else if (this.handleSelected == 3) {\n\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n } else if (this.handleSelected == 4) {\n\n pos.deltaPosition('x', deltaX, this.getXAxis());\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n }\n\n break;\n\n }\n }\n\n this.redraw();\n this.changed();\n this.setHandles();\n\n return true;\n }\n\n /**\n * Places handles properly\n * @private\n * @return {Shape} The current shape\n */\n setHandles() {\n\n if (this.isLocked() || !this.isSelectable() && !this._staticHandles) {\n return;\n }\n\n if (!this.handlesInDom) {\n return;\n }\n\n var pos = this.computePosition(0);\n var pos2 = this.computePosition(1);\n\n var handles = this.getProp('handles');\n\n switch (handles.type) {\n\n case 'seamlessX':\n\n if (this.handles[1]) {\n this.handles[1].setAttribute('transform', 'translate(-10) translate(' + pos.x + ')');\n this.handles[1].setAttribute('height', Math.abs(pos2.y - pos.y));\n this.handles[1].setAttribute('y', Math.min(pos2.y, pos.y));\n }\n\n if (this.handles[2]) {\n this.handles[2].setAttribute('transform', 'translate(-10) translate(' + pos2.x + ')');\n this.handles[2].setAttribute('height', Math.abs(pos2.y - pos.y));\n this.handles[2].setAttribute('y', Math.min(pos2.y, pos.y));\n }\n\n break;\n\n case 'sides':\n\n if (this.handles.left) {\n this.handles.left.setAttribute('transform', 'translate(' + this.currentX + ' ' + (this.currentY + this.currentH / 2) + ')');\n }\n\n if (this.handles.right) {\n this.handles.right.setAttribute('transform', 'translate( ' + (this.currentX + this.currentW) + ' ' + (this.currentY + this.currentH / 2) + ')');\n }\n\n if (this.handles.top) {\n this.handles.top.setAttribute('transform', 'translate( ' + (this.currentX + this.currentW / 2) + ' ' + this.currentY + ')');\n }\n\n if (this.handles.bottom) {\n this.handles.bottom.setAttribute('transform', 'translate( ' + (this.currentX + this.currentW / 2) + ' ' + (this.currentY + this.currentH) + ')');\n }\n\n break;\n\n case 'corners':\n default:\n\n this.handles[1].setAttribute('x', pos.x);\n this.handles[1].setAttribute('y', pos.y);\n\n this.handles[2].setAttribute('x', pos2.x);\n this.handles[2].setAttribute('y', pos.y);\n\n this.handles[3].setAttribute('x', pos2.x);\n this.handles[3].setAttribute('y', pos2.y);\n\n this.handles[4].setAttribute('x', pos.x);\n this.handles[4].setAttribute('y', pos2.y);\n\n break;\n\n }\n }\n\n }\n\n exports.default = ShapeRectangle;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(3), __webpack_require__(6), __webpack_require__(21), __webpack_require__(11), __webpack_require__(14), __webpack_require__(22), __webpack_require__(23), __webpack_require__(5), __webpack_require__(24), __webpack_require__(25), __webpack_require__(26), __webpack_require__(27), __webpack_require__(16), __webpack_require__(17), __webpack_require__(28), __webpack_require__(29), __webpack_require__(30), __webpack_require__(1), __webpack_require__(31), __webpack_require__(32), __webpack_require__(50), __webpack_require__(33), __webpack_require__(34), __webpack_require__(12), __webpack_require__(35), __webpack_require__(36), __webpack_require__(18), __webpack_require__(37), __webpack_require__(38), __webpack_require__(39), __webpack_require__(2), __webpack_require__(40), __webpack_require__(41), __webpack_require__(42), __webpack_require__(43), __webpack_require__(44), __webpack_require__(46), __webpack_require__(47), __webpack_require__(48), __webpack_require__(49), __webpack_require__(4), __webpack_require__(13)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.core.js'), require('./graph.position.js'), require('./graph.legend.js'), require('./graph.axis.x.js'), require('./graph.axis.y.js'), require('./graph.axis.x.bar.js'), require('./graph.axis.x.time.js'), require('./series/graph.serie.line.js'), require('./series/graph.serie.line.3d.js'), require('./series/graph.serie.bar.js'), require('./series/graph.serie.box.js'), require('./series/graph.serie.line.colored.js'), require('./series/graph.serie.scatter.js'), require('./series/graph.serie.zone.js'), require('./series/graph.serie.zone.3d.js'), require('./series/graph.serie.densitymap.js'), require('./series/graph.serie.contour.js'), require('./shapes/graph.shape.js'), require('./shapes/graph.shape.areaundercurve.js'), require('./shapes/graph.shape.arrow.js'), require('./shapes/graph.shape.ellipse.js'), require('./shapes/graph.shape.label.js'), require('./shapes/graph.shape.polyline.js'), require('./shapes/graph.shape.line.js'), require('./shapes/graph.shape.nmrintegral.js'), require('./shapes/graph.shape.peakintegration2d.js'), require('./shapes/graph.shape.rect.js'), require('./shapes/graph.shape.cross.js'), require('./shapes/graph.shape.peakboundariescenter.js'), require('./shapes/graph.shape.html.js'), require('./plugins/graph.plugin.js'), require('./plugins/graph.plugin.drag.js'), require('./plugins/graph.plugin.shape.js'), require('./plugins/graph.plugin.selectScatter.js'), require('./plugins/graph.plugin.zoom.js'), require('./plugins/graph.plugin.timeseriemanager.js'), require('./plugins/graph.plugin.serielinedifference.js'), require('./plugins/graph.plugin.axissplitting.js'), require('./plugins/graph.plugin.makeTracesDifferent.js'), require('./plugins/graph.plugin.peakpicking.js'), require('./util/waveform.js'), require('./util/fit_lm.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphCore, global.graphPosition, global.graphLegend, global.graphAxisX, global.graphAxisY, global.graphAxisXBar, global.graphAxisXTime, global.graphSerieLine, global.graphSerieLine3d, global.graphSerieBar, global.graphSerieBox, global.graphSerieLineColored, global.graphSerieScatter, global.graphSerieZone, global.graphSerieZone3d, global.graphSerieDensitymap, global.graphSerieContour, global.graphShape, global.graphShapeAreaundercurve, global.graphShapeArrow, global.graphShapeEllipse, global.graphShapeLabel, global.graphShapePolyline, global.graphShapeLine, global.graphShapeNmrintegral, global.graphShapePeakintegration2d, global.graphShapeRect, global.graphShapeCross, global.graphShapePeakboundariescenter, global.graphShapeHtml, global.graphPlugin, global.graphPluginDrag, global.graphPluginShape, global.graphPluginSelectScatter, global.graphPluginZoom, global.graphPluginTimeseriemanager, global.graphPluginSerielinedifference, global.graphPluginAxissplitting, global.graphPluginMakeTracesDifferent, global.graphPluginPeakpicking, global.waveform, global.fit_lm);\n global.graph = mod.exports;\n }\n})(this, function (module, exports, _graphCore, _graphPosition, _graphLegend, _graphAxisX, _graphAxisY, _graphAxisXBar, _graphAxisXTime, _graphSerieLine, _graphSerieLine3d, _graphSerieBar, _graphSerieBox, _graphSerieLineColored, _graphSerieScatter, _graphSerieZone, _graphSerieZone3d, _graphSerieDensitymap, _graphSerieContour, _graphShape, _graphShapeAreaundercurve, _graphShapeArrow, _graphShapeEllipse, _graphShapeLabel, _graphShapePolyline, _graphShapeLine, _graphShapeNmrintegral, _graphShapePeakintegration2d, _graphShapeRect, _graphShapeCross, _graphShapePeakboundariescenter, _graphShapeHtml, _graphPlugin, _graphPluginDrag, _graphPluginShape, _graphPluginSelectScatter, _graphPluginZoom, _graphPluginTimeseriemanager, _graphPluginSerielinedifference, _graphPluginAxissplitting, _graphPluginMakeTracesDifferent, _graphPluginPeakpicking, _waveform, _fit_lm) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphCore2 = _interopRequireDefault(_graphCore);\n\n var _graphPosition2 = _interopRequireDefault(_graphPosition);\n\n var _graphLegend2 = _interopRequireDefault(_graphLegend);\n\n var _graphAxisX2 = _interopRequireDefault(_graphAxisX);\n\n var _graphAxisY2 = _interopRequireDefault(_graphAxisY);\n\n var _graphAxisXBar2 = _interopRequireDefault(_graphAxisXBar);\n\n var _graphAxisXTime2 = _interopRequireDefault(_graphAxisXTime);\n\n var _graphSerieLine2 = _interopRequireDefault(_graphSerieLine);\n\n var _graphSerieLine3d2 = _interopRequireDefault(_graphSerieLine3d);\n\n var _graphSerieBar2 = _interopRequireDefault(_graphSerieBar);\n\n var _graphSerieBox2 = _interopRequireDefault(_graphSerieBox);\n\n var _graphSerieLineColored2 = _interopRequireDefault(_graphSerieLineColored);\n\n var _graphSerieScatter2 = _interopRequireDefault(_graphSerieScatter);\n\n var _graphSerieZone2 = _interopRequireDefault(_graphSerieZone);\n\n var _graphSerieZone3d2 = _interopRequireDefault(_graphSerieZone3d);\n\n var _graphSerieDensitymap2 = _interopRequireDefault(_graphSerieDensitymap);\n\n var _graphSerieContour2 = _interopRequireDefault(_graphSerieContour);\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n var _graphShapeAreaundercurve2 = _interopRequireDefault(_graphShapeAreaundercurve);\n\n var _graphShapeArrow2 = _interopRequireDefault(_graphShapeArrow);\n\n var _graphShapeEllipse2 = _interopRequireDefault(_graphShapeEllipse);\n\n var _graphShapeLabel2 = _interopRequireDefault(_graphShapeLabel);\n\n var _graphShapePolyline2 = _interopRequireDefault(_graphShapePolyline);\n\n var _graphShapeLine2 = _interopRequireDefault(_graphShapeLine);\n\n var _graphShapeNmrintegral2 = _interopRequireDefault(_graphShapeNmrintegral);\n\n var _graphShapePeakintegration2d2 = _interopRequireDefault(_graphShapePeakintegration2d);\n\n var _graphShapeRect2 = _interopRequireDefault(_graphShapeRect);\n\n var _graphShapeCross2 = _interopRequireDefault(_graphShapeCross);\n\n var _graphShapePeakboundariescenter2 = _interopRequireDefault(_graphShapePeakboundariescenter);\n\n var _graphShapeHtml2 = _interopRequireDefault(_graphShapeHtml);\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n var _graphPluginDrag2 = _interopRequireDefault(_graphPluginDrag);\n\n var _graphPluginShape2 = _interopRequireDefault(_graphPluginShape);\n\n var _graphPluginSelectScatter2 = _interopRequireDefault(_graphPluginSelectScatter);\n\n var _graphPluginZoom2 = _interopRequireDefault(_graphPluginZoom);\n\n var _graphPluginTimeseriemanager2 = _interopRequireDefault(_graphPluginTimeseriemanager);\n\n var _graphPluginSerielinedifference2 = _interopRequireDefault(_graphPluginSerielinedifference);\n\n var _graphPluginAxissplitting2 = _interopRequireDefault(_graphPluginAxissplitting);\n\n var _graphPluginMakeTracesDifferent2 = _interopRequireDefault(_graphPluginMakeTracesDifferent);\n\n var _graphPluginPeakpicking2 = _interopRequireDefault(_graphPluginPeakpicking);\n\n var _waveform2 = _interopRequireDefault(_waveform);\n\n var _fit_lm2 = _interopRequireDefault(_fit_lm);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n // Corrent naming is important here !\n\n _graphCore2.default.registerConstructor('graph.position', _graphPosition2.default);\n\n _graphCore2.default.registerConstructor('graph.axis.x', _graphAxisX2.default);\n _graphCore2.default.registerConstructor('graph.axis.y', _graphAxisY2.default);\n _graphCore2.default.registerConstructor('graph.axis.x.bar', _graphAxisXBar2.default);\n _graphCore2.default.registerConstructor('graph.axis.x.time', _graphAxisXTime2.default);\n\n _graphCore2.default.registerConstructor('graph.serie.line', _graphSerieLine2.default);\n _graphCore2.default.registerConstructor('graph.serie.line.3d', _graphSerieLine3d2.default);\n _graphCore2.default.registerConstructor('graph.serie.line.color', _graphSerieLineColored2.default);\n _graphCore2.default.registerConstructor('graph.serie.contour', _graphSerieContour2.default);\n _graphCore2.default.registerConstructor('graph.serie.bar', _graphSerieBar2.default);\n _graphCore2.default.registerConstructor('graph.serie.box', _graphSerieBox2.default);\n _graphCore2.default.registerConstructor('graph.serie.scatter', _graphSerieScatter2.default);\n _graphCore2.default.registerConstructor('graph.serie.zone', _graphSerieZone2.default);\n _graphCore2.default.registerConstructor('graph.serie.zone.3d', _graphSerieZone3d2.default);\n _graphCore2.default.registerConstructor('graph.serie.densitymap', _graphSerieDensitymap2.default);\n\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_LINE, _graphSerieLine2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_LINE_3D, _graphSerieLine3d2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_LINE_COLORED, _graphSerieLineColored2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_CONTOUR, _graphSerieContour2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_BAR, _graphSerieBar2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_BOX, _graphSerieBox2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_SCATTER, _graphSerieScatter2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_ZONE, _graphSerieZone2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_ZONE_3D, _graphSerieZone3d2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_DENSITYMAP, _graphSerieDensitymap2.default);\n\n //Graph.registerConstructor( \"graph.serie.line.broken\", GraphSerieLineBroken );\n\n _graphCore2.default.registerConstructor('graph.plugin.shape', _graphPluginShape2.default);\n _graphCore2.default.registerConstructor('graph.plugin.drag', _graphPluginDrag2.default);\n _graphCore2.default.registerConstructor('graph.plugin.zoom', _graphPluginZoom2.default);\n _graphCore2.default.registerConstructor('graph.plugin.selectScatter', _graphPluginSelectScatter2.default);\n _graphCore2.default.registerConstructor('graph.plugin.timeSerieManager', _graphPluginTimeseriemanager2.default);\n _graphCore2.default.registerConstructor('graph.plugin.serielinedifference', _graphPluginSerielinedifference2.default);\n _graphCore2.default.registerConstructor('graph.plugin.serieLineDifference', _graphPluginSerielinedifference2.default);\n _graphCore2.default.registerConstructor('graph.plugin.axissplitting', _graphPluginAxissplitting2.default);\n _graphCore2.default.registerConstructor('graph.plugin.makeTracesDifferent', _graphPluginMakeTracesDifferent2.default);\n _graphCore2.default.registerConstructor('graph.plugin.peakPicking', _graphPluginPeakpicking2.default);\n\n _graphCore2.default.registerConstructor('graph.shape', _graphShape2.default);\n _graphCore2.default.registerConstructor('graph.shape.areaundercurve', _graphShapeAreaundercurve2.default);\n _graphCore2.default.registerConstructor('graph.shape.arrow', _graphShapeArrow2.default);\n _graphCore2.default.registerConstructor('graph.shape.ellipse', _graphShapeEllipse2.default);\n _graphCore2.default.registerConstructor('graph.shape.label', _graphShapeLabel2.default);\n _graphCore2.default.registerConstructor('graph.shape.polyline', _graphShapePolyline2.default);\n _graphCore2.default.registerConstructor('graph.shape.line', _graphShapeLine2.default);\n _graphCore2.default.registerConstructor('graph.shape.nmrintegral', _graphShapeNmrintegral2.default);\n _graphCore2.default.registerConstructor('graph.shape.html', _graphShapeHtml2.default);\n _graphCore2.default.registerConstructor('graph.shape.peakintegration2d', _graphShapePeakintegration2d2.default);\n // Graph.registerConstructor( \"graph.shape.peakinterval\", GraphShapePeakInterval );\n // Graph.registerConstructor( \"graph.shape.peakinterval2\", GraphShapePeakInterval2 );\n // Graph.registerConstructor( \"graph.shape.rangex\", GraphShapeRangeX );\n _graphCore2.default.registerConstructor('graph.shape.rect', _graphShapeRect2.default);\n _graphCore2.default.registerConstructor('graph.shape.rectangle', _graphShapeRect2.default);\n _graphCore2.default.registerConstructor('graph.shape.cross', _graphShapeCross2.default);\n //Graph.registerConstructor( \"graph.shape.zoom2d\", GraphShapeZoom2D );\n _graphCore2.default.registerConstructor('graph.shape.peakboundariescenter', _graphShapePeakboundariescenter2.default);\n\n // Graph.registerConstructor( \"graph.toolbar\", GraphToolbar );\n _graphCore2.default.registerConstructor('graph.legend', _graphLegend2.default);\n _graphCore2.default.registerConstructor('graph.waveform', _waveform2.default);\n\n exports.default = _graphCore2.default;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports);\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports);\n global.data_aggregator = mod.exports;\n }\n})(this, function (module, exports) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n var dataAggregator;\n\n if (typeof URL === 'undefined' || typeof URL.createObjectURL === 'undefined' || typeof Blob === 'undefined' || typeof Worker === 'undefined') {\n dataAggregator = () => {};\n } else {\n var aggregatorWorker;\n var queue = {};\n\n let string = function () {\n\n onmessage = function (e) {\n\n const data = e.data.data,\n // The initial data\n maxX = e.data.maxX,\n minX = e.data.minX,\n maxY = e.data.maxY,\n minY = e.data.minY,\n direction = e.data.direction;\n\n let numPoints = e.data.numPoints; // Total number of points in the slot\n let l = data.length; // Number of data in the original buffer\n let i = 0;\n let k = -4;\n let slots = [];\n let dataAggregatedX = [];\n let dataAggregatedY = [];\n let aggregationSum = [];\n let getX;\n let slotNumber;\n let lastAggregationX;\n let lastAggregation;\n let lastAggregationSum;\n let newAggregation;\n let newAggregationX;\n\n if (e.data.xdata) {\n\n getX = function getX(index) {\n return e.data.xdata[index];\n };\n } else {\n getX = function getX(index) {\n return index * e.data.xScale + e.data.xOffset;\n };\n }\n\n let aggregations = {};\n\n // Direction x\n if (direction == 'x') {\n const dataPerSlot = numPoints / (maxX - minX); // Computed number of aggregation per slot\n\n for (; i < l; i++) {\n\n // dataPerSlot: 1 / 1000 ( compression by 1'000 )\n //console.log( dataPerSlot, getX( i ) );\n slotNumber = Math.floor((getX(i) - minX) * dataPerSlot);\n\n if (slots[k] !== slotNumber) {\n k += 4;\n slots[k] = slotNumber;\n\n let slotX = (slotNumber + 0.5) / dataPerSlot + minX;\n\n dataAggregatedX[k] = slotX;\n dataAggregatedX[k + 1] = slotX;\n dataAggregatedX[k + 2] = slotX;\n dataAggregatedX[k + 3] = slotX;\n\n dataAggregatedY[k] = data[i];\n dataAggregatedY[k + 1] = data[i];\n dataAggregatedY[k + 2] = data[i];\n dataAggregatedY[k + 3] = data[i];\n aggregationSum[k] = 0;\n }\n\n dataAggregatedY[k + 1] = Math.min(data[i], dataAggregatedY[k + 1]);\n dataAggregatedY[k + 2] = Math.max(data[i], dataAggregatedY[k + 2]);\n dataAggregatedY[k + 3] = data[i];\n aggregationSum[k] += data[i];\n }\n } else {\n // y\n\n const dataPerSlot = numPoints / (maxY - minY); // Computed number of aggregation per slot\n\n for (; i < l; i++) {\n\n // dataPerSlot: 1 / 1000 ( compression by 1'000 )\n //console.log( dataPerSlot, getX( i ) );\n slotNumber = Math.floor((data[i] - minY) * dataPerSlot);\n\n if (slots[k] !== slotNumber) {\n k += 4;\n slots[k] = slotNumber;\n\n let slotY = (slotNumber + 0.5) / dataPerSlot + minY;\n\n dataAggregatedY[k] = slotY;\n dataAggregatedY[k + 1] = slotY;\n dataAggregatedY[k + 2] = slotY;\n dataAggregatedY[k + 3] = slotY;\n\n dataAggregatedX[k] = data[i];\n dataAggregatedX[k + 1] = data[i];\n dataAggregatedX[k + 2] = data[i];\n dataAggregatedX[k + 3] = data[i];\n aggregationSum[k] = 0;\n }\n dataAggregatedX[k + 1] = Math.min(getX(i), dataAggregatedX[k + 1]);\n dataAggregatedX[k + 2] = Math.max(getX(i), dataAggregatedX[k + 2]);\n dataAggregatedX[k + 3] = getX(i);\n aggregationSum[k] += getX(i);\n }\n }\n\n aggregations[numPoints] = {\n x: dataAggregatedX,\n y: dataAggregatedY,\n sums: aggregationSum\n };\n\n lastAggregation = dataAggregatedY;\n lastAggregationX = dataAggregatedX;\n lastAggregationSum = aggregationSum;\n\n while (numPoints > 256) {\n\n numPoints /= 2;\n\n newAggregation = [];\n newAggregationX = [];\n\n k = 0;\n\n if (direction == 'x') {\n\n for (i = 0, l = lastAggregation.length - 8; i < l; i += 8) {\n\n newAggregationX[k] = (lastAggregationX[i] + lastAggregationX[i + 4]) / 2;\n newAggregationX[k + 1] = newAggregationX[k];\n newAggregationX[k + 2] = newAggregationX[k];\n newAggregationX[k + 3] = newAggregationX[k];\n\n newAggregation[k] = lastAggregation[i];\n newAggregation[k + 1] = Math.min(lastAggregation[i + 1], lastAggregation[i + 5]);\n newAggregation[k + 2] = Math.max(lastAggregation[i + 2], lastAggregation[i + 6]);\n newAggregation[k + 3] = lastAggregation[i + 7];\n\n aggregationSum[k] = (lastAggregationSum[i] + lastAggregationSum[i + 4]) / 2;\n\n k += 4;\n }\n } else {\n\n for (i = 0, l = lastAggregation.length - 8; i < l; i += 8) {\n\n newAggregation[k] = (lastAggregation[i] + lastAggregation[i + 4]) / 2;\n newAggregation[k + 1] = newAggregation[k];\n newAggregation[k + 2] = newAggregation[k];\n newAggregation[k + 3] = newAggregation[k];\n\n newAggregationX[k] = lastAggregationX[i];\n newAggregationX[k + 1] = Math.min(lastAggregationX[i + 1], lastAggregationX[i + 5]);\n newAggregationX[k + 2] = Math.max(lastAggregationX[i + 2], lastAggregationX[i + 6]);\n newAggregationX[k + 3] = lastAggregationX[i + 7];\n\n aggregationSum[k] = (lastAggregationSum[i] + lastAggregationSum[i + 4]) / 2;\n\n k += 4;\n }\n }\n\n aggregations[numPoints] = {\n x: newAggregationX,\n y: newAggregation,\n sums: aggregationSum\n };\n\n lastAggregation = newAggregation;\n lastAggregationX = newAggregationX;\n lastAggregationSum = aggregationSum;\n\n aggregationSum = [];\n }\n\n postMessage({\n aggregates: aggregations,\n _queueId: e.data._queueId\n });\n };\n }.toString();\n\n string = string.replace(/^\\s*function\\s*\\(\\s*\\)\\s*\\{/, '');\n string = string.replace(/}\\s*$/, '');\n /*\n if ( typeof URL == \"undefined\" ) {\n module.exports = function() {};\n } else {\n */\n\n var workerUrl = URL.createObjectURL(new Blob([string], {\n type: 'application/javascript'\n }));\n\n aggregatorWorker = new Worker(workerUrl);\n\n aggregatorWorker.onmessage = function (e) {\n\n var id = e.data._queueId;\n delete e.data._queueId;\n queue[id](e.data);\n delete queue[id];\n };\n\n dataAggregator = function (toOptimize) {\n\n var requestId = Date.now();\n toOptimize._queueId = requestId;\n\n var prom = new Promise(resolver => {\n queue[requestId] = resolver;\n });\n\n aggregatorWorker.postMessage(toOptimize);\n return prom;\n };\n }\n\n exports.default = dataAggregator;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(6), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.position.js'), require('./graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphPosition, global.graphUtil);\n global.graphLegend = mod.exports;\n }\n})(this, function (module, exports, _graphPosition, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphPosition2 = _interopRequireDefault(_graphPosition);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Default legend configuration\n * @name LegendOptionsDefault\n * @object\n * @static\n * @prop {Boolean} frame - true to display a frame around the legend\n * @prop {Number} frameWidth - The width of the frame stroke\n * @prop {String} frameColor - The stroke color of the frame\n * @prop {String} backgroundColor - The background color of the frame\n * @prop {Number} paddingLeft - The left padding\n * @prop {Number} paddingRight - The right padding\n * @prop {Number} paddingTop - The top padding\n * @prop {Number} paddingBottom - The bottom padding\n * @prop {Boolean} shapesToggleable - true to toggle the shapes linked to serie with its status (shown or hidden)\n * @prop {Boolean} isSerieHideable - true to allow series to be hidden through the legend\n * @prop {Boolean} isSerieSelectable - true to allow series to be selected through the legend\n */\n var legendDefaults = {\n\n backgroundColor: 'rgba(255, 255, 255, 0.8)',\n frame: true,\n frameWidth: 1,\n frameColor: 'black',\n paddingTop: 10,\n paddingLeft: 10,\n paddingBottom: 10,\n paddingRight: 10,\n color: 'black',\n frameRounding: 0,\n\n movable: false,\n\n shapesToggleable: true,\n isSerieHideable: true,\n isSerieSelectable: true\n\n };\n\n /**\n * Legend constructor. You should not call this method directly, but rather use {@link graph.makeLegend}\n * @example var legend = graph.makeLegend( { backgroundColor: 'rgba(255, 255, 255, 0.8)',\n * frame: true,\n * frameWidth: 1,\n * frameColor: 'black',\n * paddingTop: 10,\n * paddingLeft: 10,\n * paddingBottom: 10,\n * paddingRight: 10,\n * frameRounding: 3,\n *\n * movable: false,\n *\n * shapesToggleable: true,\n * isSerieHideable: true,\n * isSerieSelectable: true\n * } );\n */\n class Legend {\n\n constructor(graph, options) {\n\n this.options = util.extend({}, legendDefaults, options);\n\n this.graph = graph;\n this.svg = document.createElementNS(this.graph.ns, 'g');\n this.subG = document.createElementNS(this.graph.ns, 'g');\n\n this.groups = [];\n this.rect = document.createElementNS(this.graph.ns, 'rect');\n this.rectBottom = document.createElementNS(this.graph.ns, 'rect');\n\n this.rect.setAttribute('x', 0);\n this.rect.setAttribute('y', 0);\n\n this.rectBottom.setAttribute('x', 0);\n this.rectBottom.setAttribute('y', 0);\n\n this.series = false;\n\n this.svg.setAttribute('display', 'none');\n this.pos = {\n x: undefined,\n y: undefined,\n transformX: 0,\n transformY: 0\n };\n\n this.setEvents();\n\n this.eyeId = util.guid();\n this.eyeCrossedId = util.guid();\n\n var eyeClosed = util.SVGParser('');\n // var eyeClosed = util.SVGParser('');\n\n /* var eyeClosed = document.createElementNS( this.graph.ns, \"symbol\");\n eyeClosed.setAttribute('id', this.eyeId );\n eyeClosed.setAttribute(\"viewBox\", '0 0 100 100');\n var rect = document.createElementNS( this.graph.ns, \"rect\" );\n rect.setAttribute('width', 100 );\n rect.setAttribute('height', 100 );\n rect.setAttribute('x', 0 );\n rect.setAttribute('y', 0 );\n rect.setAttribute('fill', 'black');\n eyeClosed.appendChild( rect );\n */\n var eye = util.SVGParser('');\n\n this.svg.appendChild(document.adoptNode(eye.documentElement.firstChild));\n this.svg.appendChild(document.adoptNode(eyeClosed.documentElement.firstChild));\n\n this.svg.appendChild(this.subG);\n\n this.applyStyle();\n }\n\n /**\n * Sets the position of the legend\n * @param {Position} position - the position to set the legend to versus the graph main axes ({@link Graph#getXAxis} and {@link Graph#getYAxis})\n * @param {String} alignToX - \"right\" or \"left\". References the legend right or left boundary using the position parameter\n * @param {String} alignToY - \"top\" or \"bottom\". References the legend top or bottom boundary using the position parameter\n * @example legend.setPosition( { x: 'max', y: '0px' }, 'right', 'top' ); // The rightmost side of the legend will at the maximum value of the axis, and will be positioned at the top\n */\n setPosition(position, alignToX, alignToY) {\n\n if (!position) {\n return;\n }\n\n this.position = position;\n this.alignToX = alignToX || 'left';\n this.alignToY = alignToY || 'top';\n }\n\n setDraggable(bln) {\n this.options.movable = bln;\n }\n\n setAutoPosition(position) {\n\n if (['bottom', 'left', 'top', 'right'].indexOf(position = position.toLowerCase()) > -1) {\n this.autoPosition = position;\n return this;\n }\n\n this.requireDelayedUpdate();\n this.autoPosition = false;\n }\n\n autoPosition() {\n return this.setAutoPosition(...arguments);\n }\n\n buildLegendBox() {\n\n var series = this.series || this.graph.getSeries(),\n posX = 0,\n posY = this.options.paddingTop;\n\n if (!this.autoPosition) {\n this.graph.graphingZone.appendChild(this.getDom());\n } else {\n this.graph.getDom().appendChild(this.getDom());\n }\n\n for (var i = 0, l = series.length; i < l; i++) {\n\n if (series[i].excludedFromLegend && !this.series) {\n continue;\n }\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n\n var bbox = getBBox(this.groups[i]);\n\n if (posX + bbox.width > this.graph.getDrawingWidth() - this.options.paddingRight) {\n posY += 16;\n posX = 0;\n }\n }\n\n this.groups[i].setAttribute('transform', 'translate( ' + posX + ', ' + posY + ')');\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n\n posX += bbox.width + 10;\n posY += 0;\n } else {\n\n posX = 0;\n posY += 16;\n }\n }\n\n var bbox = getBBox(this.subG);\n\n /* Independant on box position */\n this.width = bbox.width + this.options.paddingRight + this.options.paddingLeft;\n this.height = bbox.height + this.options.paddingBottom + this.options.paddingTop;\n\n this.rect.setAttribute('width', this.width);\n this.rect.setAttribute('height', this.height);\n this.rect.setAttribute('fill', 'none');\n this.rect.setAttribute('pointer-events', 'fill');\n\n this.rect.setAttribute('display', 'none');\n\n if (this.options.movable) {\n this.rectBottom.style.cursor = 'move';\n }\n\n this.rectBottom.setAttribute('width', this.width);\n this.rectBottom.setAttribute('height', this.height);\n\n this.rectBottom.setAttribute('x', bbox.x - this.options.paddingLeft);\n this.rectBottom.setAttribute('y', bbox.y - this.options.paddingTop);\n /* End independant on box position */\n\n this.position = this.position || {};\n\n switch (this.autoPosition) {\n\n case 'bottom':\n this.position.y = this.graph.getHeight() + 'px';\n // Try to center with respect to the drawing space, not the full graph. It's useful when the graph is fairly asymmetric (i.e. multiple axes on 1 side)\n this.position.x = (this.graph.drawingSpaceWidth - this.width) / 2 + this.graph.drawingSpaceMinX + 'px';\n this.alignToY = 'bottom';\n this.alignToX = false;\n break;\n\n case 'left':\n this.position.x = '6px';\n this.position.y = (this.graph.getHeight() - this.height) / 2 + 'px';\n this.alignToX = 'left';\n this.alignToY = false;\n break;\n\n case 'right':\n this.position.x = this.graph.getWidth() + 'px';\n this.position.y = (this.graph.getHeight() - this.height) / 2 + 'px';\n this.alignToX = 'right';\n this.alignToY = false;\n break;\n\n case 'top':\n this.position.x = (this.graph.drawingSpaceWidth - this.width) / 2 + this.graph.drawingSpaceMinX + 'px';\n this.position.y = '10px';\n this.alignToY = 'top';\n this.alignToX = false;\n break;\n }\n\n if (this.autoPosition) {\n switch (this.autoPosition) {\n\n case 'bottom':\n this.graph.options.paddingBottom = this.height + 10;\n break;\n\n case 'left':\n this.graph.options.paddingLeft = this.width + 5;\n break;\n\n case 'right':\n this.graph.options.paddingRight = this.width + 10;\n break;\n\n case 'top':\n this.graph.options.paddingTop = this.height + 14;\n break;\n }\n\n this.graph.updateGraphingZone();\n this.graph.getDrawingHeight();\n this.graph.getDrawingWidth();\n // this.graph.redraw( false );\n }\n\n this.bbox = bbox;\n }\n\n calculatePosition() {\n\n var pos = _graphPosition2.default.check(this.position);\n let poscoords = pos.compute(this.graph, this.graph.getXAxis(), this.graph.getYAxis());\n\n if (!poscoords) {\n return;\n }\n\n if (pos.y == 'max') {\n poscoords.y += this.graph.getPaddingTop();\n }\n\n if (pos.x == 'max') {\n poscoords.x -= this.graph.getPaddingRight();\n }\n\n if (this.alignToX == 'right') {\n poscoords.x -= this.width;\n poscoords.x -= this.bbox.x;\n } else {\n //poscoords.x -= this.bbox.x;\n }\n\n if (this.alignToY == 'bottom') {\n poscoords.y -= this.height;\n poscoords.y -= this.bbox.y;\n } else {\n\n poscoords.y -= this.bbox.y;\n }\n\n this.pos.transformX = poscoords.x;\n this.pos.transformY = poscoords.y;\n\n this._setPosition();\n }\n\n /**\n * Updates the legend position and content\n */\n update(onlyIfRequired) {\n\n if (this.graph.isDelayedUpdate() || !this._requiredUpdate && onlyIfRequired) {\n return;\n }\n\n this._requiredUpdate = false;\n\n var self = this;\n\n this.applyStyle();\n\n while (this.subG.hasChildNodes()) {\n this.subG.removeChild(this.subG.lastChild);\n }\n\n this.svg.insertBefore(this.rectBottom, this.svg.firstChild);\n\n var series = this.series || this.graph.getSeries(),\n line,\n text,\n g;\n\n if (series.length > 0) {\n this.svg.setAttribute('display', 'block');\n } else {\n return;\n }\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n var fullWidth = this.graph.getDrawingWidth();\n }\n\n var posX, posY;\n\n for (var i = 0, l = series.length; i < l; i++) {\n\n if (series[i].excludedFromLegend && !this.series) {\n continue;\n }\n\n (function (j) {\n\n var g,\n line,\n text,\n xPadding = 0;\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n var fullWidth = this.graph.getDrawingWidth();\n }\n\n g = document.createElementNS(self.graph.ns, 'g');\n var rect = document.createElementNS(self.graph.ns, 'rect');\n\n self.subG.appendChild(g);\n\n g.appendChild(rect);\n\n var line = series[j].getSymbolForLegend();\n var marker = series[j].getMarkerForLegend();\n var text = series[j].getTextForLegend();\n\n var dx = 35;\n\n if (this.isHideable()) {\n dx += 20;\n\n var eyeUse = document.createElementNS(self.graph.ns, 'use');\n eyeUse.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', '#' + (series[i].isShown() ? this.eyeId : this.eyeCrossedId));\n eyeUse.setAttribute('width', 15);\n eyeUse.setAttribute('height', 15);\n eyeUse.setAttribute('x', 35);\n eyeUse.setAttribute('y', -8);\n\n eyeUse.addEventListener('click', function (e) {\n e.stopPropagation();\n\n var id;\n if (series[j].isShown()) {\n series[j].hide(self.options.hideShapesOnHideSerie);\n id = self.eyeCrossedId;\n } else {\n series[j].show(self.options.hideShapesOnHideSerie);\n id = self.eyeId;\n }\n\n eyeUse.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', '#' + id);\n });\n }\n\n text.setAttribute('transform', 'translate(' + dx + ', 3)');\n\n text.setAttribute('color', this.options.color);\n\n if (line) {\n g.appendChild(line);\n }\n\n if (series[j].getType() == 'scatter') {\n line.setAttribute('transform', 'translate( 20, 0 )');\n }\n\n if (marker) {\n g.appendChild(marker);\n }\n\n if (eyeUse) {\n g.appendChild(eyeUse);\n }\n\n g.appendChild(text);\n\n var bbox = getBBox(g);\n\n rect.setAttribute('x', bbox.x);\n rect.setAttribute('y', bbox.y);\n rect.setAttribute('width', bbox.width);\n rect.setAttribute('height', bbox.height);\n rect.setAttribute('fill', 'none');\n rect.setAttribute('pointer-events', 'fill');\n\n self.groups[j] = g;\n\n g.addEventListener('click', function (e) {\n\n var serie = series[j];\n\n if (!serie.isShown()) {\n return;\n }\n\n if (self.isSelectable() && !serie.isSelected()) {\n\n self.graph.selectSerie(serie);\n } else {\n\n self.graph.unselectSerie(serie);\n }\n\n e.preventDefault();\n e.stopPropagation();\n });\n }).call(this, i);\n }\n\n this.svg.appendChild(this.rect);\n this.buildLegendBox();\n this.calculatePosition();\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be hidden or not\n */\n isHideable() {\n return this.options.isSerieHideable;\n }\n\n notHideable() {\n this.options.isSerieHideable = false;\n return this;\n }\n\n hideable() {\n this.options.isSerieHideable = true;\n return this;\n }\n\n set seriesHideable(hideable) {\n this.options.isSerieHideable = !!hideable;\n }\n\n /**\n * @type {Boolean}\n */\n get seriesHideable() {\n return this.options.isSerieHideable;\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be selected or not\n */\n isSelectable() {\n return this.options.isSerieSelectable;\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be t or not\n */\n isToggleShapes() {\n return this.options.shapesToggleable;\n }\n\n /**\n * @return {SVGGroupElement} The SVG group element wrapping the legend\n */\n getDom() {\n return this.svg;\n }\n\n setEvents() {\n\n var self = this;\n var pos = this.pos;\n\n var mousedown = function (e) {\n\n e.stopPropagation();\n console.log('down');\n if (self.options.movable) {\n pos.x = e.clientX;\n pos.y = e.clientY;\n\n e.preventDefault();\n self.mousedown = true;\n self.graph.elementMoving(self);\n\n self.rect.setAttribute('display', 'block');\n }\n };\n\n var mousemove = function (e) {\n self.handleMouseMove(e);\n };\n\n this.svg.addEventListener('mousedown', mousedown);\n this.svg.addEventListener('click', function (e) {\n e.stopPropagation();\n });\n this.svg.addEventListener('dblclick', function (e) {\n e.stopPropagation();\n });\n this.svg.addEventListener('mousemove', mousemove);\n //this.rect.addEventListener( 'mousemove', mousemove );\n }\n\n handleMouseUp(e) {\n\n e.stopPropagation();\n e.preventDefault();\n this.mousedown = false;\n this.rect.setAttribute('display', 'none');\n this.graph.elementMoving(false);\n }\n\n handleMouseMove(e) {\n\n if (!this.mousedown) {\n return;\n }\n\n var pos = this.pos;\n\n var deltaX = e.clientX - pos.x;\n var deltaY = e.clientY - pos.y;\n\n pos.transformX += deltaX;\n pos.transformY += deltaY;\n\n pos.x = e.clientX;\n pos.y = e.clientY;\n\n e.stopPropagation();\n e.preventDefault();\n\n this._setPosition();\n }\n\n _setPosition() {\n\n var pos = this.pos;\n if (!isNaN(pos.transformX) && !isNaN(pos.transformY) && pos.transformX !== false && pos.transformY !== false) {\n this.svg.setAttribute('transform', 'translate(' + pos.transformX + ', ' + pos.transformY + ')');\n }\n }\n\n /**\n * Re-applies the legend style\n */\n applyStyle() {\n\n if (this.options.frame) {\n this.rectBottom.setAttribute('stroke', this.options.frameColor);\n this.rectBottom.setAttribute('stroke-width', this.options.frameWidth + 'px');\n this.rectBottom.setAttribute('rx', this.options.frameRounding);\n this.rectBottom.setAttribute('ry', this.options.frameRounding);\n }\n\n this.rectBottom.setAttribute('fill', this.options.backgroundColor);\n }\n\n /**\n * Re-applies the legend style\n * @param {...(GraphSerie|GraphSerie[])} a serie or an array of series\n */\n fixSeries() {\n var series = [];\n\n if (arguments[0] === false) {\n this.series = false;\n this.update();\n return;\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n if (Array.isArray(arguments[i])) {\n series = series.concat(arguments[i]);\n } else {\n series.push(arguments[i]);\n }\n }\n\n this.update();\n this.series = series;\n }\n\n fixSeriesAdd(serie) {\n this.series = this.series || [];\n this.series.push(serie);\n }\n\n requireDelayedUpdate() {\n this._requiredUpdate = true;\n }\n\n }\n\n function getBBox(svgElement) {\n // Firefox throws when trying to call getBBox() on elements\n // that are not yet rendered.\n try {\n return svgElement.getBBox();\n } catch (e) {\n return {\n height: 0,\n width: 0,\n x: 0,\n y: 0\n };\n }\n }\n\n exports.default = Legend;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(11)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.axis.x.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphAxisX);\n global.graphAxisXBar = mod.exports;\n }\n})(this, function (module, exports, _graphAxisX) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphAxisX2 = _interopRequireDefault(_graphAxisX);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Generic constructor of a y axis\n * @class AxisXBar\n * @augments Axis\n */\n class AxisXBar extends _graphAxisX2.default {\n\n constructor(graph, topbottom, options = {}) {\n super(graph, topbottom, options);\n }\n\n /**\n * @param {Object[]} categories - Categories array\n * @param {(String|Number)} categories[].title - The title of the category (to be dispalyed)\n * @param {(String|Number)} categories[].name - The name of the category (to indentify series)\n * @returns {AxisBar} The current axis instance\n */\n set categories(categories) {\n this._barCategories = categories;\n return this;\n }\n\n draw() {\n\n var self = this,\n tickLabel,\n elements = this._barCategories;\n\n this.forceMin(0);\n this.forceMax(1);\n\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n\n if (!elements) {\n return;\n }\n\n if (!Array.isArray(elements)) {\n elements = [elements];\n }\n\n // this.drawInit();\n\n //var widthPerElement = width / elements.length;\n for (var i = 0; i <= elements.length; i++) {\n this.drawTick(i / elements.length, 2);\n\n if (i < elements.length) {\n tickLabel = this.nextTickLabel(function (tickLabel) {\n\n tickLabel.setAttribute('y', (self.top ? -1 : 1) * ((self.options.tickPosition == 1 ? 8 : 20) + (self.top ? 10 : 0)));\n tickLabel.setAttribute('text-anchor', 'middle');\n if (self.getTicksLabelColor() !== 'black') {\n tickLabel.setAttribute('fill', self.getTicksLabelColor());\n }\n tickLabel.style.dominantBaseline = 'hanging';\n });\n\n tickLabel.setAttribute('x', this.getPos((i + 0.5) / elements.length));\n tickLabel.textContent = elements[i].title;\n }\n }\n\n this.drawSpecifics();\n return this;\n }\n\n /**\n * Sets the series automatically\n * @returns {AxisBar} The current axis instance\n */\n autoSeries() {\n\n let series = [];\n for (let serie of this.graph.series) {\n if (serie.getXAxis() == this) {\n series.push(serie);\n }\n }\n\n this.setSeries(...series);\n return this;\n }\n\n /**\n * Sets the series that should belong to the axis\n * @param {...(Series|Number|String)} series - List of series identified either by their instance, or their index (string or number)\n * @returns {AxisBar} The current axis instance\n */\n setSeries() {\n\n var self = this;\n this.series = arguments;\n\n Array.prototype.map.call(this.series, function (serie, index) {\n\n if (!(typeof serie == 'object')) {\n serie = self.graph.getSerie(serie);\n }\n\n if (serie.setCategoryConfig) {\n serie.setCategoryConfig(index, self._barCategories, self.series.length);\n }\n });\n\n this._getUsedCategories();\n\n return this;\n }\n\n _getUsedCategories() {\n\n let categories = {},\n total = 0;\n\n Array.prototype.map.call(this.series, serie => {\n let usedCategories = serie.getUsedCategories();\n for (let cat of usedCategories) {\n\n if (!categories.hasOwnProperty(cat)) {\n categories[cat] = 1;\n total += 1;\n }\n\n categories[cat]++;\n total++;\n }\n });\n\n let accumulator = 0;\n for (let i in categories) {\n let temp = categories[i];\n categories[i] = accumulator;\n accumulator += temp;\n }\n\n let dispatchedCategories = {};\n\n Array.prototype.map.call(this.series, serie => {\n\n let scategories = serie.getUsedCategories(),\n indices = {};\n\n scategories.forEach(cat => {\n\n dispatchedCategories[cat] = dispatchedCategories[cat] || 0.5;\n indices[cat] = (categories[cat] + dispatchedCategories[cat]) / total;\n dispatchedCategories[cat]++;\n });\n\n serie.setDataIndices(indices, total);\n });\n }\n\n getType() {\n return 'category';\n }\n }\n\n exports.default = AxisXBar;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(9), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.axis.js'), require('./graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphAxis, global.graphUtil);\n global.graphAxisXTime = mod.exports;\n }\n})(this, function (module, exports, _graphAxis, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphAxis2 = _interopRequireDefault(_graphAxis);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n var axisFormat = [{\n\n threshold: 20,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 seconds\n increment: 1,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n }, {\n\n threshold: 50,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 2 seconds\n increment: 2,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n }, {\n\n threshold: 100,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 5 seconds\n increment: 5,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n }, {\n\n threshold: 600,\n increments: {\n\n 1: {\n increment: 10, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 seconds\n increment: 30,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n }, { // One day\n\n threshold: 1000,\n increments: {\n\n 1: { // 1h\n increment: 1,\n unit: 'h',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 minutes\n increment: 10,\n unit: 'i',\n format: 'MM\"min\"'\n }\n }\n }, { // One day\n\n threshold: 1500,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 1,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 3000,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 2,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 8000,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 10,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 26400,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 20,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 86400,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 1,\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 200000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 2, // One day on the first axis\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 6, // One day on the first axis\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 1400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 12, // One day on the first axis\n unit: 'h',\n format: 'HH\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 6400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n }, { // One day\n\n threshold: 12400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 2, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n }, { // One day\n\n threshold: 86400000 * 0.5,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 7, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n }, { // One day\n\n threshold: 86400000 * 0.8,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 15, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n }, { // One month\n\n threshold: 86400000 * 1,\n increments: {\n\n 1: {\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 3, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n }, { // One month\n\n threshold: 86400000 * 2,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 4, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n }, { // One month\n\n threshold: 86400000 * 10,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 6, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n }, { // One month\n\n threshold: 86400000 * 12,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 1, // One day on the first axis\n unit: 'y',\n format: 'yyyy'\n }\n }\n }];\n\n /*\n * Date Format 1.2.3\n * (c) 2007-2009 Steven Levithan \n * MIT license\n *\n * Includes enhancements by Scott Trenda \n * and Kris Kowal \n *\n * Accepts a date, a mask, or a date and a mask.\n * Returns a formatted version of the given date.\n * The date defaults to the current date/time.\n * The mask defaults to dateFormat.masks.default.\n */\n\n var dateFormat = function () {\n var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\\1?|[WLloSZ]|\"[^\"]*\"|'[^']*'/g,\n timezone = /\\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\\d{4})?)\\b/g,\n timezoneClip = /[^-+\\dA-Z]/g,\n pad = function (val, len) {\n val = String(val);\n len = len || 2;\n while (val.length < len) val = '0' + val;\n return val;\n },\n getWeek = function (d, f) {\n var onejan = new Date(d[f + 'FullYear'](), 0, 1);\n return Math.ceil(((d - onejan) / 86400000 + onejan[f + 'Day']() + 1) / 7);\n };\n\n // Regexes and supporting functions are cached through closure\n return function (date, mask, utc) {\n var dF = dateFormat;\n\n // You can't provide utc if you skip other args (use the \"UTC:\" mask prefix)\n if (arguments.length == 1 && Object.prototype.toString.call(date) == '[object String]' && !/\\d/.test(date)) {\n mask = date;\n date = undefined;\n }\n\n // Passing date through Date applies Date.parse, if necessary\n date = date ? new Date(date) : new Date();\n if (isNaN(date)) throw SyntaxError('invalid date:' + date);\n\n mask = String(dF.masks[mask] || mask || dF.masks.default);\n\n // Allow setting the utc argument via the mask\n if (mask.slice(0, 4) == 'UTC:') {\n mask = mask.slice(4);\n utc = true;\n }\n\n var _ = utc ? 'getUTC' : 'get',\n d = date[_ + 'Date'](),\n D = date[_ + 'Day'](),\n m = date[_ + 'Month'](),\n y = date[_ + 'FullYear'](),\n H = date[_ + 'Hours'](),\n M = date[_ + 'Minutes'](),\n s = date[_ + 'Seconds'](),\n L = date[_ + 'Milliseconds'](),\n o = utc ? 0 : date.getTimezoneOffset(),\n flags = {\n d: d,\n dd: pad(d),\n ddd: dF.i18n.dayNames[D],\n dddd: dF.i18n.dayNames[D + 7],\n m: m + 1,\n mm: pad(m + 1),\n mmm: dF.i18n.monthNames[m],\n mmmm: dF.i18n.monthNames[m + 12],\n yy: String(y).slice(2),\n yyyy: y,\n h: H % 12 || 12,\n hh: pad(H % 12 || 12),\n H: H,\n HH: pad(H),\n M: M,\n MM: pad(M),\n s: s,\n ss: pad(s),\n l: pad(L, 3),\n L: pad(L > 99 ? Math.round(L / 10) : L),\n t: H < 12 ? 'a' : 'p',\n tt: H < 12 ? 'am' : 'pm',\n T: H < 12 ? 'A' : 'P',\n TT: H < 12 ? 'AM' : 'PM',\n Z: utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),\n o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),\n S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],\n W: getWeek(date, _)\n };\n\n return mask.replace(token, function ($0) {\n return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);\n });\n };\n }();\n\n // Some common format strings\n dateFormat.masks = {\n 'default': 'ddd mmm dd yyyy HH:MM:ss',\n shortDate: 'm/d/yy',\n mediumDate: 'mmm d, yyyy',\n longDate: 'mmmm d, yyyy',\n fullDate: 'dddd, mmmm d, yyyy',\n shortTime: 'h:MM TT',\n mediumTime: 'h:MM:ss TT',\n longTime: 'h:MM:ss TT Z',\n isoDate: 'yyyy-mm-dd',\n isoTime: 'HH:MM:ss',\n isoDateTime: \"yyyy-mm-dd'T'HH:MM:ss\",\n isoUtcDateTime: \"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'\"\n };\n\n // Internationalization strings\n dateFormat.i18n = {\n dayNames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n };\n\n /* END DATE FORMAT */\n\n function getClosestIncrement(value, basis) {\n return Math.round(value / basis) * basis;\n }\n\n function roundDate(date, format) {\n\n switch (format.unit) {\n\n case 's':\n // Round at n hour\n\n date.setSeconds(getClosestIncrement(date.getSeconds(), format.increment));\n date.setMilliseconds(0);\n\n break;\n\n case 'i':\n // Round at n hour\n\n date.setMinutes(getClosestIncrement(date.getMinutes(), format.increment));\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'h':\n // Round at n hour\n\n date.setHours(getClosestIncrement(date.getHours(), format.increment));\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'd':\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n\n date.setDate(getClosestIncrement(date.getDate(), format.increment));\n\n break;\n\n case 'm':\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n\n date.setMonth(getClosestIncrement(date.getMonth(), format.increment));\n\n break;\n\n case 'y':\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n date.setMonth(0);\n\n //date.setYear( getClosest( date.getDate(), format.increment ) );\n\n break;\n\n default:\n {\n throw new Error('Date format not recognized');\n }\n }\n\n return date;\n }\n\n function incrementDate(date, format) {\n\n switch (format.unit) {\n\n case 's':\n\n date.setSeconds(date.getSeconds() + format.increment);\n date.setMilliseconds(0);\n\n break;\n\n case 'i':\n\n date.setMinutes(date.getMinutes() + format.increment);\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'h':\n // Round at n hour\n\n date.setHours(date.getHours() + format.increment);\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'd':\n\n date.setDate(date.getDate() + format.increment);\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n\n break;\n\n case 'm':\n\n date.setMonth(date.getMonth() + format.increment);\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n\n break;\n\n case 'y':\n\n date.setFullYear(date.getFullYear() + format.increment);\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n date.setMonth(0);\n\n break;\n\n default:\n {\n throw new Error('Date format not recognized');\n }\n }\n\n return date;\n }\n\n function getGroup(axis, level, number) {\n\n if (axis.groups[level][number]) {\n axis.groups[level][number].group.setAttribute('display', 'block');\n return axis.groups[level][number];\n }\n\n var g = {\n\n group: document.createElementNS(axis.graph.ns, 'g'),\n text: document.createElementNS(axis.graph.ns, 'text')\n };\n\n var line = document.createElementNS(axis.graph.ns, 'line');\n\n line.setAttribute('stroke', 'black');\n line.setAttribute('y1', 0);\n switch (level) {\n\n case 2:\n\n line.setAttribute('y2', 6);\n g.text.setAttribute('y', 15);\n\n g.line = line;\n\n g.group.appendChild(g.line);\n break;\n\n default:\n case 1:\n\n line.setAttribute('y2', 20);\n g.text.setAttribute('y', 10);\n\n g.line1 = line;\n g.line2 = line.cloneNode();\n\n g.group.appendChild(g.line1);\n g.group.appendChild(g.line2);\n\n break;\n }\n\n g.text.setAttribute('text-anchor', 'middle');\n g.text.setAttribute('dominant-baseline', 'middle');\n\n g.group.appendChild(g.text);\n\n axis.getWrapper(level).appendChild(g.group);\n\n return axis.groups[level][number] = g;\n }\n\n function hideGroups(axis, level, from) {\n\n for (; from < axis.groups[level].length; from++) {\n\n hideGroup(axis.groups[level][from]);\n }\n }\n\n function hideGroup(group) {\n group.group.setAttribute('display', 'none');\n }\n\n function getDateText(date, format) {\n\n return dateFormat(date, format);\n }\n\n function renderGroup(level, group, text, minPx, maxPx, x1, x2) {\n\n switch (level) {\n\n case 2:\n\n if (x1 < minPx || x1 > maxPx) {\n\n hideGroup(group);\n return;\n }\n\n group.line.setAttribute('x1', x1);\n group.line.setAttribute('x2', x1);\n group.text.setAttribute('x', x1);\n group.text.textContent = text;\n\n break;\n\n default:\n case 1:\n\n var x1B = Math.max(minPx, Math.min(maxPx, x1)),\n x2B = Math.max(minPx, Math.min(maxPx, x2));\n\n if (isNaN(x2B) || isNaN(x1B)) {\n return;\n }\n\n group.line1.setAttribute('x1', x1B);\n group.line2.setAttribute('x1', x2B);\n\n group.line1.setAttribute('x2', x1B);\n group.line2.setAttribute('x2', x2B);\n\n group.text.setAttribute('x', (x1B + x2B) / 2);\n\n while (text.length * 8 > x2B - x1B) {\n\n text = text.substr(0, text.length - 2) + '.';\n\n if (text.length == 1) {\n text = '';\n break;\n }\n }\n\n group.text.textContent = text;\n break;\n }\n }\n\n class GraphTimeAxis extends _graphAxis2.default {\n\n constructor() {\n\n super(...arguments);\n }\n\n init(graph, options) {\n\n super.init(graph, options);\n\n this.wrapper = {\n 1: document.createElementNS(graph.ns, 'g'),\n 2: document.createElementNS(graph.ns, 'g')\n };\n this.groups = {\n 1: [],\n 2: []\n };\n\n var rect = document.createElementNS(graph.ns, 'rect');\n rect.setAttribute('fill', '#c0c0c0');\n rect.setAttribute('stroke', '#808080');\n rect.setAttribute('height', '20');\n rect.setAttribute('x', '0');\n rect.setAttribute('y', '0');\n\n this.rect = rect;\n\n this.wrapper[1].appendChild(this.rect);\n\n // this.init( graph, options );\n\n this.group.appendChild(this.wrapper[1]);\n this.group.appendChild(this.wrapper[2]);\n\n this.wrapper[1].setAttribute('transform', 'translate( 0, 25 )');\n this.wrapper[2].setAttribute('transform', 'translate( 0, 00 )');\n }\n\n draw() {\n // Redrawing of the axis\n\n //this.drawInit();\n\n this.cacheCurrentMax();\n this.cacheCurrentMin();\n\n if (this.currentAxisMin == undefined || this.currentAxisMax == undefined) {\n this.setMinMaxToFitSeries(true); // We reset the min max as a function of the series\n }\n\n this.line.setAttribute('x1', this.getMinPx());\n this.line.setAttribute('x2', this.getMaxPx());\n this.line.setAttribute('y1', 0);\n this.line.setAttribute('y2', 0);\n\n var widthPx = this.maxPx - this.minPx;\n var widthTime = this.getCurrentInterval();\n\n var timePerPx = widthTime / widthPx;\n\n var maxVal = this.getCurrentMax();\n var minVal = this.getCurrentMin();\n\n this.rect.setAttribute('width', widthPx);\n this.rect.setAttribute('x', this.minPx);\n\n if (!maxVal || !minVal) {\n return 0;\n }\n\n var currentFormat;\n\n for (i = 0; i < axisFormat.length; i++) {\n\n if (axisFormat[i].threshold > timePerPx) {\n currentFormat = axisFormat[i];\n\n break;\n }\n }\n\n if (!currentFormat) {\n currentFormat = axisFormat[axisFormat.length - 1];\n }\n\n var xVal1,\n xVal2,\n level = 0,\n dateFirst,\n currentDate,\n text,\n group,\n i;\n\n for (level = 1; level <= 2; level++) {\n\n if (!util.isNumeric(minVal)) {\n hideGroups(this, level, 0);\n break;\n }\n\n dateFirst = new Date(minVal);\n\n currentDate = roundDate(dateFirst, currentFormat.increments[level]);\n\n i = 0;\n\n do {\n /** @ignore */\n text = getDateText(currentDate, currentFormat.increments[level].format);\n group = getGroup(this, level, i);\n\n xVal1 = this.getPx(currentDate.getTime());\n currentDate = incrementDate(currentDate, currentFormat.increments[level]);\n xVal2 = this.getPx(currentDate.getTime());\n\n renderGroup(level, group, text, this.getMinPx(), this.getMaxPx(), xVal1, xVal2);\n\n i++;\n if (i > 100) {\n break;\n }\n } while (currentDate.getTime() < maxVal);\n\n hideGroups(this, level, i);\n }\n }\n\n isX() {\n return true;\n }\n\n getWrapper(level) {\n return this.wrapper[level];\n }\n\n setShift(shift) {\n this.shift = shift;\n this.group.setAttribute('transform', 'translate(0 ' + (this.top ? this.shift : this.graph.getDrawingHeight() - this.shift) + ')');\n }\n\n getAxisPosition() {\n return 60;\n }\n\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n var maxPx = interval * this.options.span[1] + this.minPx;\n var minPx = interval * this.options.span[0] + this.minPx;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n }\n\n }\n\n exports.default = GraphTimeAxis;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(3), __webpack_require__(5), __webpack_require__(4), __webpack_require__(15), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.core.js'), require('./graph.serie.line.js'), require('../util/waveform.js'), require('../mixins/graph.mixin.serie3d.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphCore, global.graphSerieLine, global.waveform, global.graphMixinSerie3d, global.graphUtil);\n global.graphSerieLine3d = mod.exports;\n }\n})(this, function (module, exports, _graphCore, _graphSerieLine, _waveform, _graphMixinSerie3d, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphCore2 = _interopRequireDefault(_graphCore);\n\n var _graphSerieLine2 = _interopRequireDefault(_graphSerieLine);\n\n var _waveform2 = _interopRequireDefault(_waveform);\n\n var _graphMixinSerie3d2 = _interopRequireDefault(_graphMixinSerie3d);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Serie line with 3D projection\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends SerieLine\n */\n class SerieLine3D extends _graphSerieLine2.default {\n\n static defaults() {\n return {\n zpos: 0\n };\n }\n constructor(graph, name, options) {\n super(...arguments);\n }\n\n /**\n * Sets the z-position\n * @memberof SerieLine3D\n * @param {Number} zPos - The position in the z axis\n */\n setZPos(zPos) {\n this.options.zpos = zPos;\n return this;\n }\n\n setz() {\n return this.setZPos(...arguments);\n }\n }\n\n util.mix(SerieLine3D, _graphMixinSerie3d2.default);\n exports.default = SerieLine3D;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0), __webpack_require__(5), __webpack_require__(10)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'), require('./graph.serie.line.js'), require('../mixins/graph.mixin.errorbars.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil, global.graphSerieLine, global.graphMixinErrorbars);\n global.graphSerieBar = mod.exports;\n }\n})(this, function (module, exports, _graphUtil, _graphSerieLine, _graphMixinErrorbars) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphSerieLine2 = _interopRequireDefault(_graphSerieLine);\n\n var _graphMixinErrorbars2 = _interopRequireDefault(_graphMixinErrorbars);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n /**\n * Represents a bar serie.\n Needs to be used exclusively with a bar axis ({@link AxisXBar}).\n Supports error bars, line color, line width, fill color, fill opacity.\n * @example graph.newSerie(\"serieName\", { fillColor: 'red', fillOpacity: 0.2 }, \"bar\" );\n * @extends Serie\n */\n class SerieBar extends _graphSerieLine2.default {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.pathDom = document.createElementNS(this.graph.ns, 'path');\n this.groupMain.appendChild(this.pathDom);\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n lineWidth: this.options.lineWidth,\n fillColor: this.options.fillColor,\n fillOpacity: this.options.fillOpacity,\n markers: this.options.markers\n };\n }\n\n /**\n * Sets the data of the bar serie\n * @param {Object} data\n * @example serie.setData( { \"cat1\": val1, \"cat2\": val2, \"cat4\": val4 } );\n * @return {SerieBar} The current serie instance\n */\n setData(data) {\n\n this.data = data;\n this.minY = Number.MAX_SAFE_INTEGER;\n this.maxY = Number.MIN_SAFE_INTEGER;\n\n for (var i in this.data) {\n this._checkY(this.data[i]);\n }\n\n return this;\n }\n\n /**\n * Sets the fill color\n */\n setFillColor(fillColor, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].fillColor = fillColor;\n\n if (applyToSelected) {\n this.setFillColor(fillColor, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n /**\n * Returns the fill color\n */\n getFillColor(selectionType) {\n return this.getStyle(selectionType).fillColor;\n }\n\n /*\n * @memberof SerieBar\n */\n setFillOpacity(opacity, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].fillOpacity = opacity;\n\n if (applyToSelected) {\n this.setLineWidth(opacity, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getFillOpacity(selectionType) {\n\n return this.getStyle(selectionType).fillOpacity || 1;\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n */\n applyLineStyles() {\n this.applyLineStyle(this.pathDom);\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieBar\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n } else {\n line.removeAttribute('stroke-dasharray');\n }\n line.setAttribute('fill', this.getFillColor());\n line.setAttribute('fill-opacity', this.getFillOpacity() || 1);\n }\n\n draw() {\n\n var path = '';\n var categoryNumber, position;\n\n if (this.error) {\n this.errorDrawInit();\n }\n\n for (var i in this.data) {\n\n if (!this.categoryIndices[i]) {\n continue;\n }\n\n path += 'M ' + this.getXAxis().getPos(this.categoryIndices[i]) + ' ' + this.getYAxis().getPos(0) + ' V ' + this.getYAxis().getPos(this.data[i]) + ' h ' + this.getXAxis().getDeltaPx(1 / this.nbCategories) + ' V ' + this.getYAxis().getPos(0);\n\n if (this.error) {\n this.errorAddPointBarChart(i, this.data[i], this.getXAxis().getPos(this.categoryIndices[i] + 0.5 / this.nbCategories), this.getYAxis().getPos(this.data[i]));\n }\n }\n\n if (this.error) {\n this.errorDraw();\n }\n\n this.pathDom.setAttribute('d', path);\n this.applyLineStyles();\n }\n\n // Markers now allowed\n setMarkers() {}\n\n getUsedCategories() {\n return Object.keys(this.data);\n }\n\n }\n\n exports.default = SerieBar;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(8), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.serie.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphSerie, global.graphUtil);\n global.graphSerieBox = mod.exports;\n }\n})(this, function (module, exports, _graphSerie, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphSerie2 = _interopRequireDefault(_graphSerie);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * @static\n * @extends Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\n class SerieBox extends _graphSerie2.default {\n\n static default() {\n return {\n orientation: 'y',\n maxBoxWidth: 20,\n\n defaultStyle: {\n\n meanLineColor: 'rgb( 100, 0, 0 )',\n meanLineWidth: 2,\n\n boxAboveLineWidth: 1,\n boxAboveLineColor: 'rgb( 0, 0, 0 )',\n boxAboveFillColor: 'transparent',\n boxAboveFillOpacity: 1,\n boxBelowLineWidth: 1,\n boxBelowLineColor: 'rgb( 0, 0, 0 )',\n boxBelowFillColor: 'transparent',\n boxBelowFillOpacity: 1,\n\n barAboveLineColor: 'rgba( 0, 0, 0, 1 )',\n barAboveLineWidth: 1,\n barBelowLineColor: 'rgba( 0, 0, 0, 1 )',\n barBelowLineWidth: 1,\n\n outlierLineWidth: 1,\n outlierLineColor: 'rgb( 255, 255, 255 )',\n outlierFillColor: 'rgb( 0, 0, 0 )',\n outlierFillOpacity: 1\n }\n };\n }\n\n constructor(graph, name, options) {\n\n super(...arguments);\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.pathDom = document.createElementNS(this.graph.ns, 'path');\n this.groupMain.appendChild(this.pathDom);\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = this.options.defaultStyle;\n }\n\n /**\n * Sets the data of the bar serie\n * @param {Object} data\n * @example serie.setData( [ { x: 'cat', Q2: valMean, Q1: valBoxMin, Q3: valBoxMax, whiskers: [ val1, val2 ], outliers: [ ...yList ] } ] );\n * @return {SerieBar} The current serie instance\n */\n setData(data, noRescale) {\n\n this.data = data;\n\n if (!Array.isArray(data)) {\n return;\n }\n\n let axisref, axisval, methodref, methodval, blnX;\n\n if (this.options.orientation == 'y') {\n axisref = this.getXAxis();\n axisval = this.getYAxis();\n methodref = this._checkX.bind(this);\n methodval = this._checkY.bind(this);\n blnX = true;\n\n this.minY = data[0].Q2;\n this.maxY = data[0].Q2;\n this.maxX = data[0].x;\n this.minX = data[0].x;\n } else {\n axisref = this.getYAxis();\n axisval = this.getXAxis();\n methodref = this._checkY.bind(this);\n methodval = this._checkX.bind(this);\n blnX = false;\n\n this.minX = data[0].Q2;\n this.maxX = data[0].Q2;\n this.maxY = data[0].y;\n this.minY = data[0].y;\n }\n\n if (noRescale) {\n methodref = function () {};\n methodval = function () {};\n }\n\n if (!axisref || !axisval) {\n (0, _graphUtil.throwError)('Error in setting data of the box serie. The X and Y axes must be set beforehand');\n }\n\n for (var i in this.data) {\n\n if (blnX) {\n methodref(this.data[i].x);\n this.data[i].pos = this.data[i].x;\n } else {\n methodref(this.data[i].y);\n this.data[i].pos = this.data[i].y;\n }\n\n if (this.data[i].Q3) {\n\n methodval(this.data[i].Q3);\n }\n\n if (this.data[i].Q1) {\n methodval(this.data[i].Q1);\n }\n\n if (this.data[i].whiskers) {\n\n if (Array.isArray(this.data[i].whiskers)) {\n\n if (this.data[i].whiskers.length > 0) {\n methodval(this.data[i].whiskers[0]);\n }\n\n if (this.data[i].whiskers.length > 1) {\n methodval(this.data[i].whiskers[1]);\n }\n } else {\n methodval(this.data[i].whiskers);\n this.data[i].whiskers = [this.data[i].whiskers];\n }\n } else {\n this.data[i].whiskers = [];\n }\n\n if (Array.isArray(this.data[i].outliers)) {\n this.data[i].outliers.map(val => methodval(val));\n } else {\n this.data[i].outliers = [];\n }\n }\n\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n _style(type, styleValue, selectionType = 'unselected', applyToSelected = false) {\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType][type] = styleValue;\n\n if (applyToSelected) {\n this._set(type, styleValue, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n return this;\n }\n\n _gstyle(type, selectionType) {\n return this.getStyle(selectionType)[type];\n }\n\n /**\n * Retrives a selection object\n * @param {String} [ selectionType = \"unselected\" ] - The selection type\n * @returns {Object} The selection object\n */\n getStyle(selectionType = 'unselected') {\n\n return this.styles[selectionType] || {};\n }\n\n /**\n * Sets the mean line color\n * @param {String} color - The mean line color\n * @returns {SerieBox} The current serie instance\n */\n setMeanLineColor() {\n return this._style('meanLineColor', ...arguments);\n }\n\n /**\n * Returns the mean line color\n * @return {String} The mean line color\n */\n getMeanLineColor() {\n return this._gstyle('meanLineColor', ...arguments);\n }\n\n setStyle(style, selectionType = 'unselected') {\n //console.log( style, selectionType );\n this.styles[selectionType] = (0, _graphUtil.extend)({}, this.default().defaultStyle, this.styles.unselected, style);\n this.styleHasChanged(selectionType);\n }\n\n /**\n * Sets the mean line width\n * @param {Number} width - The line width\n * @returns {SerieBox} The current serie instance\n */\n setMeanLineWidth() {\n return this._style('meanLineWidth', ...arguments);\n }\n\n /**\n * Returns the mean line width\n * @return {Number} The mean line width\n */\n getMeanLineWidth() {\n return this._gstyle('meanLineWidth', ...arguments);\n }\n\n /**\n * Sets the box line color\n * @param {Number} color - The color of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveLineColor() {\n return this._style('boxAboveLineColor', ...arguments);\n }\n\n /**\n * Returns the box line color\n * @return {String} The line color of the box above the median\n */\n getBoxAboveLineColor() {\n return this._gstyle('boxAboveLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} color - The color of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowLineColor() {\n return this._style('boxBelowLineColor', ...arguments);\n }\n\n /**\n * Returns the fill color\n * @return {String} The line color of the box below the median\n */\n getBoxBelowLineColor() {\n return this._gstyle('boxBelowLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The contour width of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveLineWidth() {\n return this._style('boxAboveLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the box above the median\n * @return {Number} The line width of the box above the median\n */\n getBoxAboveLineWidth() {\n return this._gstyle('boxAboveLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The contour width of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowLineWidth() {\n return this._style('boxBelowLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the box below the median\n * @return {Number} The line width of the box below the median\n */\n getBoxBelowLineWidth() {\n return this._gstyle('boxBelowLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The fill color of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveFillColor() {\n return this._style('boxAboveFillColor', ...arguments);\n }\n\n /**\n * Returns the fill color of the box above the median\n * @return {String} The fill color of the box above the median\n */\n getBoxAboveFillColor() {\n return this._gstyle('boxAboveFillColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The fill color of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowFillColor() {\n return this._style('boxBelowFillColor', ...arguments);\n }\n\n /**\n * Returns the fill color of the box below the median\n * @return {String} The fill color of the box below the median\n */\n getBoxBelowFillColor() {\n return this._gstyle('boxBelowFillColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} opacity - The fill opacity of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveFillOpacity() {\n return this._style('boxAboveFillOpacity', ...arguments);\n }\n\n /**\n * Returns the fill opacity of the box above the median\n * @return {Number} The fill opacity of the box above the median\n */\n getBoxAboveFillOpacity() {\n return this._gstyle('boxAboveFillOpacity', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} opacity - The fill opacity of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowFillOpacity() {\n return this._style('boxBelowFillOpacity', ...arguments);\n }\n\n /**\n * Returns the fill opacity of the box below the median\n * @return {Number} The fill opacity of the box below the median\n */\n getBoxBelowFillOpacity() {\n return this._gstyle('boxBelowFillOpacity', ...arguments);\n }\n\n /**\n * Sets the whisker color\n * @param {String} color - The line color of the whisker above the median\n * @returns {SerieBox} The current serie instance\n */\n setBarAboveLineColor() {\n return this._style('barAboveLineColor', ...arguments);\n }\n\n /**\n * Returns the line color of the whisker above the median\n * @return {String} The line color of the whisker above the median\n */\n getBarAboveLineColor() {\n return this._gstyle('barAboveLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The line color of the whisker below the median\n * @returns {SerieBox} The current serie instance\n */\n setBarBelowLineColor() {\n return this._style('barBelowLineColor', ...arguments);\n }\n\n /**\n * Returns the line color of the whisker below the median\n * @return {String} The line color of the whisker below the median\n */\n getBarBelowLineColor() {\n return this._gstyle('barBelowLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The line width of the whisker above the median\n * @returns {SerieBox} The current serie instance\n */\n setBarAboveLineWidth() {\n return this._style('barAboveLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the whisker above the median\n * @return {Number} The line width of the whisker above the median\n */\n getBarAboveLineWidth() {\n return this._gstyle('barAboveLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The line width of the whisker below the median\n * @returns {SerieBox} The current serie instance\n */\n setBarBelowLineWidth() {\n return this._style('barBelowLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the whisker below the median\n * @return {Number} The line width of the whisker below the median\n */\n getBarBelowLineWidth() {\n return this._gstyle('barBelowLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The outlier stroke color\n * @returns {SerieBox} The current serie instance\n */\n setOutlierLineColor() {\n return this._style('outlierLineColor', ...arguments);\n }\n\n /**\n * Returns the line color of the outliers\n * @return {String} The line color of the outliers\n */\n getOutlierLineColor() {\n return this._gstyle('outlierLineColor', ...arguments);\n }\n\n /**\n * Sets the stroke width\n * @param {Number} width - The outlier stroke width\n * @returns {SerieBox} The current serie instance\n */\n setOutlierLineWidth() {\n return this._style('outlierLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the outliers\n * @return {Number} The line width of the outliers\n */\n getOutlierLineWidth() {\n return this._gstyle('outlierLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The outlier fill color\n * @returns {SerieBox} The current serie instance\n */\n setOutlierFillColor() {\n return this._style('outlierFillColor', ...arguments);\n }\n\n /**\n * Returns the fill color of the outliers\n * @return {String} The fill color of the outliers\n */\n getOutlierFillColor() {\n return this._gstyle('outlierFillColor', ...arguments);\n }\n\n /**\n * Sets the outlier fill opacity\n * @param {Number} opacity - The outlier fill opacity\n * @returns {SerieBox} The current serie instance\n */\n setOutlierFillOpacity() {\n return this._style('outlierFillOpacity', ...arguments);\n }\n\n /**\n * Returns the fill opacity of the outliers\n * @return {Number} The fill opacity of the outliers\n */\n getOutlierFillOpacity() {\n return this._gstyle('outlierFillOpacity', ...arguments);\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n * @returns {SerieBox} The current serie instance\n */\n applyLineStyles() {\n this.applyLineStyle(this.pathDom);\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieBar\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n line.removeAttribute('stroke-dasharray');\n line.setAttribute('fill', this.getFillColor());\n line.setAttribute('fill-opacity', this.getFillOpacity() || 1);\n }\n\n draw() {\n\n if (!this.data) {\n return;\n }\n\n let position;\n let axis = this.options.orientation == 'y' ? this.getYAxis() : this.getXAxis();\n let axis2 = this.options.orientation == 'y' ? this.getXAxis() : this.getYAxis();\n let boxOtherDimension; // width or height of the box\n let useCategories = false;\n let mean, boxAbove, boxBelow, barAbove, barBelow, outliers, posAbove, posBelow;\n let categoryNumber;\n\n (0, _graphUtil.emptyDom)(this.groupMain);\n\n if (axis2.getType() == 'category') {\n\n boxOtherDimension = axis2.getRelPx(0.8 / this.nbCategories);\n useCategories = true;\n } else {\n // Get all the spacing and determine the smallest one\n boxOtherDimension = this.options.maxBoxWidth;\n // console.log( boxOtherDimension );\n for (var i = 0, l = this.data.length; i < l - 1; i++) {\n\n // console.log( Math.abs( axis.getPx( this.data[ i + 1 ].pos ) - axis.getPx( this.data[ i ].pos ) ), axis.getPx( this.data[ i + 1 ].pos ), axis.getPx( this.data[ i ].pos ) );\n boxOtherDimension = Math.min(boxOtherDimension, Math.abs(axis2.getPx(this.data[i + 1].pos) - axis2.getPx(this.data[i].pos)));\n }\n // console.log( boxOtherDimension );\n }\n\n for (var i = 0, l = this.data.length; i < l; i++) {\n\n if (axis2.getType() == 'category') {\n\n let cat = this.options.orientation == 'y' ? this.data[i].x : this.data[i].y;\n\n if (!this.categoryIndices.hasOwnProperty(cat)) {\n\n if (Array.isArray(this._linkedToScatterSeries)) {\n for (let scatter_serie of this._linkedToScatterSeries) {\n\n if (scatter_serie.categoryIndices.hasOwnProperty(cat)) {\n\n position = [axis2.getPos(scatter_serie.categoryIndices[cat]) + 1.2 * boxOtherDimension / 2];\n\n if (this.options.orientation == 'y') {\n axis = scatter_serie.getYAxis();\n } else {\n axis = scatter_serie.getXAxis();\n }\n\n break;\n }\n }\n }\n } else {\n\n position = [axis2.getPos(this.categoryIndices[cat]) + 1.2 * boxOtherDimension / 2];\n }\n } else {\n\n position = [axis2.getPos(this.options.orientation == 'y' ? this.data[i].x : this.data[i].y), boxOtherDimension];\n }\n\n mean = axis.getPos(this.data[i].Q2);\n boxAbove = axis.getPos(this.data[i].Q3);\n boxBelow = axis.getPos(this.data[i].Q1);\n\n this.data[i].whiskers.map(val => {\n\n if (val < this.data[i].Q1) {\n barBelow = axis.getPos(val);\n } else {\n barAbove = axis.getPos(val);\n }\n });\n\n outliers = this.data[i].outliers.map(val => axis.getPos(val));\n\n var lineMean = document.createElementNS(this.graph.ns, 'line');\n\n this.applyMeanStyle(lineMean);\n\n var rectAbove = document.createElementNS(this.graph.ns, 'rect');\n var rectBelow = document.createElementNS(this.graph.ns, 'rect');\n\n if (this.options.orientation == 'y') {\n\n rectAbove.setAttribute('width', boxOtherDimension);\n rectAbove.setAttribute('x', position[0] - boxOtherDimension / 2);\n\n rectBelow.setAttribute('width', boxOtherDimension);\n rectBelow.setAttribute('x', position[0] - boxOtherDimension / 2);\n\n lineMean.setAttribute('x1', position[0] - boxOtherDimension / 2);\n lineMean.setAttribute('x2', position[0] + boxOtherDimension / 2);\n lineMean.setAttribute('y1', mean);\n lineMean.setAttribute('y2', mean);\n } else {\n\n rectAbove.setAttribute('height', boxOtherDimension);\n rectAbove.setAttribute('y', position[0] - boxOtherDimension / 2);\n\n rectBelow.setAttribute('height', boxOtherDimension);\n rectBelow.setAttribute('y', position[0] - boxOtherDimension / 2);\n\n lineMean.setAttribute('y1', position[0] - boxOtherDimension / 2);\n lineMean.setAttribute('y2', position[0] + boxOtherDimension / 2);\n lineMean.setAttribute('x1', mean);\n lineMean.setAttribute('x2', mean);\n }\n\n this.boxPos(rectAbove, mean, boxAbove, this.options.orientation == 'x');\n this.boxPos(rectBelow, mean, boxBelow, this.options.orientation == 'x');\n\n this.applyBoxStyle(rectAbove, rectBelow);\n\n var whiskerAbove = document.createElementNS(this.graph.ns, 'line');\n var whiskerBelow = document.createElementNS(this.graph.ns, 'line');\n\n if (this.options.orientation == 'y') {\n\n if (barAbove !== undefined) {\n whiskerAbove.setAttribute('y1', boxAbove);\n whiskerAbove.setAttribute('y2', barAbove);\n whiskerAbove.setAttribute('x1', position[0]);\n whiskerAbove.setAttribute('x2', position[0]);\n }\n\n if (barBelow !== undefined) {\n whiskerBelow.setAttribute('y1', boxBelow);\n whiskerBelow.setAttribute('y2', barBelow);\n whiskerBelow.setAttribute('x1', position[0]);\n whiskerBelow.setAttribute('x2', position[0]);\n }\n } else {\n\n if (barAbove !== undefined) {\n whiskerAbove.setAttribute('x1', boxAbove);\n whiskerAbove.setAttribute('x2', barAbove);\n whiskerAbove.setAttribute('y1', position[0]);\n whiskerAbove.setAttribute('y2', position[0]);\n }\n\n if (barBelow !== undefined) {\n whiskerBelow.setAttribute('x1', boxBelow);\n whiskerBelow.setAttribute('x2', barBelow);\n whiskerBelow.setAttribute('y1', position[0]);\n whiskerBelow.setAttribute('y2', position[0]);\n }\n }\n\n outliers.map(outliervalue => {\n\n let outlier = document.createElementNS(this.graph.ns, 'circle');\n\n outlier.setAttribute('r', 2);\n\n if (this.options.orientation == 'y') {\n\n outlier.setAttribute('cx', position[0]);\n outlier.setAttribute('cy', outliervalue);\n } else {\n\n outlier.setAttribute('cy', position[0]);\n outlier.setAttribute('cx', outliervalue);\n }\n\n this.setOutlierStyle(outlier);\n\n this.groupMain.appendChild(outlier);\n });\n\n if (barAbove !== undefined) {\n this.groupMain.appendChild(whiskerAbove);\n }\n\n if (barBelow !== undefined) {\n this.groupMain.appendChild(whiskerBelow);\n }\n\n if (boxAbove !== undefined) {\n this.groupMain.appendChild(rectAbove);\n }\n\n if (boxBelow !== undefined) {\n this.groupMain.appendChild(rectBelow);\n }\n\n this.groupMain.appendChild(lineMean);\n\n this.applyWhiskerStyle(whiskerAbove, whiskerBelow);\n }\n }\n\n applyBoxStyle(above, below) {\n\n above.setAttribute('stroke', this.getBoxAboveLineColor());\n above.setAttribute('stroke-width', this.getBoxAboveLineWidth());\n\n if (this.getBoxAboveFillColor() !== undefined) {\n above.setAttribute('fill', this.getBoxAboveFillColor());\n }\n if (this.getBoxAboveFillOpacity() !== undefined) {\n above.setAttribute('fill-opacity', this.getBoxAboveFillOpacity());\n }\n\n below.setAttribute('stroke', this.getBoxBelowLineColor());\n below.setAttribute('stroke-width', this.getBoxBelowLineWidth());\n\n if (this.getBoxBelowFillColor() !== undefined) {\n below.setAttribute('fill', this.getBoxBelowFillColor());\n }\n if (this.getBoxAboveFillOpacity() !== undefined) {\n below.setAttribute('fill-opacity', this.getBoxBelowFillOpacity());\n }\n }\n\n applyWhiskerStyle(above, below) {\n\n above.setAttribute('stroke', this.getBarAboveLineColor());\n above.setAttribute('stroke-width', this.getBarAboveLineWidth());\n\n below.setAttribute('stroke', this.getBarBelowLineColor());\n below.setAttribute('stroke-width', this.getBarBelowLineWidth());\n }\n\n applyMeanStyle(line) {\n\n line.setAttribute('stroke', this.getMeanLineColor());\n line.setAttribute('stroke-width', this.getMeanLineWidth());\n }\n\n setOutlierStyle(outlier) {\n\n outlier.setAttribute('stroke', this.getOutlierLineColor());\n outlier.setAttribute('stroke-width', this.getOutlierLineWidth());\n\n if (this.getBoxBelowFillColor() !== undefined) {\n outlier.setAttribute('fill', this.getOutlierFillColor());\n }\n if (this.getBoxAboveFillOpacity() !== undefined) {\n outlier.setAttribute('fill-opacity', this.getOutlierFillOpacity());\n }\n }\n /**\n * Returns the index of a category based on its name\n * @param {String} name - The name of the category\n */\n getCategoryIndex(name) {\n\n if (!this.categories) {\n throw new Error('No categories were defined. Probably axis.setSeries was not called');\n }\n\n for (var i = 0; i < this.categories.length; i++) {\n\n if (this.categories[i].name == name) {\n return i;\n }\n }\n\n return false;\n }\n\n // Markers now allowed\n setMarkers() {}\n\n boxPos(box, mean, extremity, blnX) {\n\n if (mean > extremity) {\n\n box.setAttribute(blnX ? 'x' : 'y', extremity);\n box.setAttribute(blnX ? 'width' : 'height', mean - extremity);\n } else {\n\n box.setAttribute(blnX ? 'x' : 'y', mean);\n box.setAttribute(blnX ? 'width' : 'height', extremity - mean);\n }\n }\n\n getUsedCategories() {\n let xymode = this.options.orientation == 'y' ? 'x' : 'y';\n\n let categories = this.data.map(d => d[xymode]);\n\n if (Array.isArray(this._linkedToScatterSeries)) {\n this._linkedToScatterSeries.map(scatter_serie => {\n\n scatter_serie.getUsedCategories().map(scatter_serie_cat => {\n let index;\n if ((index = categories.indexOf(scatter_serie_cat)) > -1) {\n categories.splice(index, 1);\n }\n });\n });\n }\n\n return categories;\n }\n\n linkToScatterSerie(...series) {\n this._linkedToScatterSeries = series;\n }\n }\n\n exports.default = SerieBox;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(5), __webpack_require__(0), __webpack_require__(10)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.serie.line.js'), require('../graph.util.js'), require('../mixins/graph.mixin.errorbars.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphSerieLine, global.graphUtil, global.graphMixinErrorbars);\n global.graphSerieLineColored = mod.exports;\n }\n})(this, function (module, exports, _graphSerieLine, _graphUtil, _graphMixinErrorbars) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphSerieLine2 = _interopRequireDefault(_graphSerieLine);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphMixinErrorbars2 = _interopRequireDefault(_graphMixinErrorbars);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Colored serie line\n * @example graph.newSerie( name, options, \"color\" );\n * @see Graph#newSerie\n * @augments SerieLine\n */\n class SerieLineColor extends _graphSerieLine2.default {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n this.lines = this.lines || {};\n }\n\n setColors(colors) {\n this.colors = colors;\n }\n\n _draw() {\n\n var self = this,\n data = this._dataToUse,\n toBreak,\n i = 0,\n j,\n k,\n m,\n x,\n y,\n k,\n o,\n lastX = false,\n lastY = false,\n xpx,\n ypx,\n xpx2,\n ypx2,\n xAxis = this.getXAxis(),\n yAxis = this.getYAxis(),\n xMin = xAxis.getCurrentMin(),\n yMin = yAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n yMax = yAxis.getCurrentMax();\n\n // Y crossing\n var yLeftCrossingRatio, yLeftCrossing, yRightCrossingRatio, yRightCrossing, xTopCrossingRatio, xTopCrossing, xBottomCrossingRatio, xBottomCrossing;\n\n var incrXFlip = 0;\n var incrYFlip = 1;\n\n var pointOutside = false;\n var lastPointOutside = false;\n var pointOnAxis;\n\n this.eraseLines();\n\n if (this.isFlipped()) {\n incrXFlip = 1;\n incrYFlip = 0;\n }\n\n this.currentLine = '';\n m = this.waveform.getLength();\n\n for (j = 0; j < m; j += 2) {\n\n x = this.waveform.getX(j);\n y = this.waveform.getY(j);\n\n if (x < xMin && lastX < xMin || x > xMax && lastX > xMax || (y < yMin && lastY < yMin || y > yMax && lastY > yMax) && !this.options.lineToZero) {\n lastX = x;\n lastY = y;\n lastPointOutside = true;\n continue;\n }\n\n this.counter2 = j;\n\n if (this.markersShown()) {\n this.getMarkerCurrentFamily(this.counter2);\n }\n\n xpx2 = this.getX(x);\n ypx2 = this.getY(y);\n\n if (xpx2 == xpx && ypx2 == ypx) {\n continue;\n }\n\n pointOutside = x < xMin || y < yMin || x > xMax || y > yMax;\n /*\n if ( this.options.lineToZero ) {\n pointOutside = ( x < xMin || x > xMax );\n if ( pointOutside ) {\n continue;\n }\n } else {\n if ( pointOutside || lastPointOutside ) {\n if ( ( lastX === false || lastY === false ) && !lastPointOutside ) {\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n } else {\n pointOnAxis = [];\n // Y crossing\n yLeftCrossingRatio = ( x - xMin ) / ( x - lastX );\n yLeftCrossing = y - yLeftCrossingRatio * ( y - lastY );\n yRightCrossingRatio = ( x - xMax ) / ( x - lastX );\n yRightCrossing = y - yRightCrossingRatio * ( y - lastY );\n // X crossing\n xTopCrossingRatio = ( y - yMin ) / ( y - lastY );\n xTopCrossing = x - xTopCrossingRatio * ( x - lastX );\n xBottomCrossingRatio = ( y - yMax ) / ( y - lastY );\n xBottomCrossing = x - xBottomCrossingRatio * ( x - lastX );\n if ( yLeftCrossingRatio < 1 && yLeftCrossingRatio > 0 && yLeftCrossing !== false && yLeftCrossing < yMax && yLeftCrossing > yMin ) {\n pointOnAxis.push( [ xMin, yLeftCrossing ] );\n }\n if ( yRightCrossingRatio < 1 && yRightCrossingRatio > 0 && yRightCrossing !== false && yRightCrossing < yMax && yRightCrossing > yMin ) {\n pointOnAxis.push( [ xMax, yRightCrossing ] );\n }\n if ( xTopCrossingRatio < 1 && xTopCrossingRatio > 0 && xTopCrossing !== false && xTopCrossing < xMax && xTopCrossing > xMin ) {\n pointOnAxis.push( [ xTopCrossing, yMin ] );\n }\n if ( xBottomCrossingRatio < 1 && xBottomCrossingRatio > 0 && xBottomCrossing !== false && xBottomCrossing < xMax && xBottomCrossing > xMin ) {\n pointOnAxis.push( [ xBottomCrossing, yMax ] );\n }\n if ( pointOnAxis.length > 0 ) {\n if ( !pointOutside ) { // We were outside and now go inside\n if ( pointOnAxis.length > 1 ) {\n console.error( \"Programmation error. Please e-mail me.\" );\n console.log( pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY );\n }\n this._createLine();\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n this._addPoint( xpx2, ypx2, lastX, lastY, false, false, true );\n } else if ( !lastPointOutside ) { // We were inside and now go outside\n if ( pointOnAxis.length > 1 ) {\n console.error( \"Programmation error. Please e-mail me.\" );\n console.log( pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY );\n }\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n } else {\n // No crossing: do nothing\n if ( pointOnAxis.length == 2 ) {\n this._createLine();\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n this._addPoint( this.getX( pointOnAxis[ 1 ][ 0 ] ), this.getY( pointOnAxis[ 1 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n }\n }\n } else if ( !pointOutside ) {\n this._addPoint( xpx2, ypx2, lastX, lastY, j, false, false );\n }\n }\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n lastPointOutside = pointOutside;\n continue;\n }\n }*/\n\n if (isNaN(xpx2) || isNaN(ypx2)) {\n if (this.counter > 0) {\n\n // this._createLine();\n }\n continue;\n }\n\n var color = this.colors[j];\n\n this._addPoint(xpx2, ypx2, x, y, xpx, ypx, lastX, lastY, j, color, false, true);\n\n xpx = xpx2;\n ypx = ypx2;\n\n lastX = x;\n lastY = y;\n }\n\n this.latchLines();\n\n if (this._tracker) {\n\n if (this._trackerDom) {\n this._trackerDom.remove();\n }\n\n var cloned = this.groupLines.cloneNode(true);\n this.groupMain.appendChild(cloned);\n\n for (var i = 0, l = cloned.children.length; i < l; i++) {\n\n cloned.children[i].setAttribute('stroke', 'transparent');\n cloned.children[i].setAttribute('stroke-width', '25px');\n cloned.children[i].setAttribute('pointer-events', 'stroke');\n }\n\n self._trackerDom = cloned;\n\n self.groupMain.addEventListener('mousemove', function (e) {\n var coords = self.graph._getXY(e),\n ret = self.handleMouseMove(false, false);\n self._trackingCallback(self, ret, coords.x, coords.y);\n });\n\n self.groupMain.addEventListener('mouseleave', function (e) {\n self._trackingOutCallback(self);\n });\n }\n return this;\n }\n\n _addPoint(xpx, ypx, x, y, xpxbefore, ypxbefore, xbefore, ybefore, j, color, move, allowMarker) {\n\n if (xpxbefore === undefined || ypxbefore === undefined) {\n return;\n }\n\n if (isNaN(xpx) || isNaN(ypx)) {\n return;\n }\n\n if (color._rgb) {\n color = 'rgba(' + color._rgb[0] + ',' + color._rgb[1] + ',' + color._rgb[2] + ',' + (color._rgb[3] || 1) + ')';\n }\n\n var line = this.lines[color];\n if (!line) {\n line = this.lines[color] = {\n object: document.createElementNS(this.graph.ns, 'path'),\n path: '',\n color: color\n };\n line.object.setAttribute('stroke', color);\n line.color = color;\n // this.applyLineStyle( line );\n this.groupLines.appendChild(line.object);\n }\n\n line.path += 'M ' + xpxbefore + ' ' + ypxbefore + ' L ' + xpx + ' ' + ypx;\n\n if (this.hasErrors()) {\n this.errorAddPoint(j, x, y, xpx, ypx);\n }\n\n /*if ( this.markersShown() && allowMarker !== false ) {\n drawMarkerXY( this, this.markerFamilies[ this.selectionType ][ this.markerCurrentFamily ], xpx, ypx );\n }*/\n }\n\n removeExtraLines() {}\n\n // Returns the DOM\n latchLines() {\n\n for (var i in this.lines) {\n this.lines[i].object.setAttribute('d', this.lines[i].path);\n }\n }\n\n // Returns the DOM\n eraseLines() {\n\n for (var i in this.lines) {\n this.lines[i].path = '';\n this.lines[i].object.setAttribute('d', '');\n }\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyle(line) {\n\n //line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute('stroke-width', this.getLineWidth());\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n } else {\n line.removeAttribute('stroke-dasharray');\n }\n line.setAttribute('fill', 'none');\n //\tline.setAttribute('shape-rendering', 'optimizeSpeed');\n }\n }\n\n exports.default = SerieLineColor;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(3), __webpack_require__(17), __webpack_require__(4), __webpack_require__(15), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.core.js'), require('./graph.serie.zone.js'), require('../util/waveform.js'), require('../mixins/graph.mixin.serie3d.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphCore, global.graphSerieZone, global.waveform, global.graphMixinSerie3d, global.graphUtil);\n global.graphSerieZone3d = mod.exports;\n }\n})(this, function (module, exports, _graphCore, _graphSerieZone, _waveform, _graphMixinSerie3d, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphCore2 = _interopRequireDefault(_graphCore);\n\n var _graphSerieZone2 = _interopRequireDefault(_graphSerieZone);\n\n var _waveform2 = _interopRequireDefault(_waveform);\n\n var _graphMixinSerie3d2 = _interopRequireDefault(_graphMixinSerie3d);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Serie line with 3D projection\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends SerieLine\n */\n class SerieZone3D extends _graphSerieZone2.default {\n\n static default() {\n return {\n zpos: 0\n };\n }\n constructor(graph, name, options) {\n super(...arguments);\n }\n\n /**\n * Sets the z-position\n * @memberof SerieZone3D\n * @param {Number} zPos - The position in the z axis\n */\n setZPos(zPos) {\n this.options.zpos = zPos;\n return this;\n }\n\n setz() {\n return this.setZPos(...arguments);\n }\n }\n\n util.mix(SerieZone3D, _graphMixinSerie3d2.default);\n exports.default = SerieZone3D;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 29 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(8), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.serie.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphSerie, global.graphUtil);\n global.graphSerieDensitymap = mod.exports;\n }\n})(this, function (module, exports, _graphSerie, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphSerie2 = _interopRequireDefault(_graphSerie);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Density map serie\n * @example graph.newSerie( name, options, \"densitymap\" );\n * @see Graph#newSerie\n * @augments Serie\n */\n class SerieDensityMap extends _graphSerie2.default {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n util.mapEventEmission(this.options, this); // Register events\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.rects = [];\n this.paths = [];\n\n this.recalculateBinsOnDraw = false;\n }\n /**\n * Sets the data of the serie. Careful, only one format allowed for now.\n * @memberof SerieDensityMap\n * @param {Array} data - A vector containing 2-elements arrays\n * @return {SerieDensityMap} The current instance\n * @example serie.setData( [ [ x1, y1 ], [ x2, y2 ], ..., [ xn, yn ] ] );\n */\n setData(data) {\n\n this.minX = this.maxX = this.minY = this.maxY = 0;\n var i = 0,\n l = data.length;\n this.data = data;\n\n this.minX = Number.POSITIVE_INFINITY;\n this.minY = Number.POSITIVE_INFINITY;\n this.maxX = Number.NEGATIVE_INFINITY;\n this.maxY = Number.NEGATIVE_INFINITY;\n\n for (i = 0; i < l; i++) {\n this._checkX(data[i][0]);\n this._checkY(data[i][1]);\n }\n\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Calculates the bins from the (x,y) dataset\n * @memberof SerieDensityMap\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} numX - The number of x bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @param {Number} numY - The number of y bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n calculateDensity(fromX, deltaX, numX, fromY, deltaY, numY) {\n\n var densitymap = [],\n i,\n l = this.data.length,\n indexX,\n indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n for (i = 0; i < l; i++) {\n indexX = ~~((this.data[i][0] - fromX) / deltaX);\n indexY = ~~((this.data[i][1] - fromY) / deltaY);\n\n if (indexX > numX || indexY > numY || indexX < 0 || indexY < 0) {\n continue;\n }\n\n densitymap[indexX] = densitymap[indexX] || [];\n densitymap[indexX][indexY] = densitymap[indexX][indexY] + 1 || 1;\n\n binMin = densitymap[indexX][indexY] < binMin ? densitymap[indexX][indexY] : binMin;\n binMax = densitymap[indexX][indexY] > binMax ? densitymap[indexX][indexY] : binMax;\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = numX;\n this.maxIndexY = numY;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = numX;\n this.numY = numY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Sets the density map from a precalculated data set\n * @memberof SerieDensityMap\n * @param {Array} densitymap - A 2D-array containing the map\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n setDensityMap(densitymap, fromX, deltaX, numX, fromY, deltaY, numY) {\n\n var i,\n j,\n l = this.data.length,\n indexX,\n indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n for (i = 0; i < densitymap.length; i++) {\n\n for (j = 0; j < densitymap[i].length; j++) {\n binMin = densitymap[i][j] < binMin ? densitymap[i][j] : binMin;\n binMax = densitymap[i][j] > binMax ? densitymap[i][j] : binMax;\n }\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = densitymap.length;\n this.maxIndexY = densitymap[0].length;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = this.maxIndexX;\n this.numY = this.maxIndexY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Calculates the bins from the (x,y) dataset using bin weighing\n * Will assign a set of (x,y) to the 4 neighbouring bins according to its exact position\n * @memberof SerieDensityMap\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} numX - The number of x bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @param {Number} numY - The number of y bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n calculateDensityWeighted(fromX, deltaX, numX, fromY, deltaY, numY) {\n\n var densitymap = [],\n i,\n l = this.data.length,\n indexX,\n indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n var compX, compY;\n var exactX, exactY;\n var indexXLow, indexXHigh, indexYLow, indexYHigh;\n\n for (i = 0; i < l; i++) {\n exactX = (this.data[i][0] - fromX) / deltaX - 0.5;\n exactY = (this.data[i][1] - fromY) / deltaY - 0.5;\n\n indexX = Math.floor(exactX);\n indexY = Math.floor(exactY);\n\n indexXLow = indexX; //Math.floor( exactX );\n indexYLow = indexY; //Math.floor( exactY );\n\n indexXHigh = indexX + 1; //Math.ceil( exactX );\n indexYHigh = indexY + 1; //Math.ceil( exactY );\n\n compX = 1 - (exactX - indexX);\n compY = 1 - (exactY - indexY);\n\n //console.log( exactY, indexY );\n //console.log( compY, indexYLow, indexYHigh );\n if (indexX > numX || indexY > numY || indexX < 0 || indexY < 0) {\n continue;\n }\n\n densitymap[indexXLow] = densitymap[indexXLow] || [];\n densitymap[indexXHigh] = densitymap[indexXHigh] || [];\n\n densitymap[indexXLow][indexYLow] = densitymap[indexXLow][indexYLow] || 0;\n densitymap[indexXHigh][indexYLow] = densitymap[indexXHigh][indexYLow] || 0;\n densitymap[indexXLow][indexYHigh] = densitymap[indexXLow][indexYHigh] || 0;\n densitymap[indexXHigh][indexYHigh] = densitymap[indexXHigh][indexYHigh] || 0;\n\n densitymap[indexXLow][indexYLow] += compX * compY;\n densitymap[indexXHigh][indexYLow] += (1 - compX) * compY;\n densitymap[indexXLow][indexYHigh] += compX * (1 - compY);\n densitymap[indexXHigh][indexYHigh] += (1 - compX) * (1 - compY);\n\n // A loop would be nicer, but would it be faster ?\n binMin = densitymap[indexXLow][indexYLow] < binMin ? densitymap[indexXLow][indexYLow] : binMin;\n binMax = densitymap[indexXLow][indexYLow] > binMax ? densitymap[indexXLow][indexYLow] : binMax;\n binMin = densitymap[indexXHigh][indexYLow] < binMin ? densitymap[indexXHigh][indexYLow] : binMin;\n binMax = densitymap[indexXHigh][indexYLow] > binMax ? densitymap[indexXHigh][indexYLow] : binMax;\n binMin = densitymap[indexXLow][indexYHigh] < binMin ? densitymap[indexXLow][indexYHigh] : binMin;\n binMax = densitymap[indexXLow][indexYHigh] > binMax ? densitymap[indexXLow][indexYHigh] : binMax;\n binMin = densitymap[indexXHigh][indexYHigh] < binMin ? densitymap[indexXHigh][indexYHigh] : binMin;\n binMax = densitymap[indexXHigh][indexYHigh] > binMax ? densitymap[indexXHigh][indexYHigh] : binMax;\n\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = numX;\n this.maxIndexY = numY;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = numX;\n this.numY = numY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Calculates the density map based on the minimum and maximum values found in the data array\n * @memberof SerieDensityMap\n * @param {Number} [ numX = 400 ] - The number of x bins\n * @param {Number} [ numY = numX ] - The number of y bins\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n autoBins(numX, numY) {\n\n this.numX = numX || 400;\n this.numY = numY || this.numX;\n\n this.calculateDensity(this.minX, (this.maxX - this.minX) / numX, numX, this.minY, (this.maxY - this.minY) / numY, numY);\n\n this.recalculateBinsOnDraw = false;\n\n return this;\n }\n\n /**\n * Only calculates the density map upon redraw based on the current state of the graph. In this mode, a fixed number of pixels per bin is used to calculate the number of bins and fed into\n * the calculation of the density map. In this method, the color map spans on the full scale of the density map values (i.e. a subrange cannot be defined, like you would do using {@link SerieDensityMap#setColorMapBinBoundaries}).\n * @memberof SerieDensityMap\n * @param {Number} pxPerBinX - The number of x bins per pixels. Should be an integer, but technically it doesn't have to\n * @param {Number} pxPerBinY - The number of y bins per pixels. Should be an integer, but technically it doesn't have to\n * @param {Boolean} weightedDensityMap - Whether jsGraph should use weighted density mapping or not\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n setPxPerBin(pxPerBinX, pxPerBinY, weightedDensityMap) {\n\n if (pxPerBinX) {\n this.calculationDensityMap({\n from: 'min',\n to: 'max',\n pxPerBin: pxPerBinX,\n weighted: weightedDensityMap\n });\n }\n\n if (pxPerBinY) {\n this.calculationDensityMap(false, {\n from: 'min',\n to: 'max',\n pxPerBin: pxPerBinY,\n weighted: weightedDensityMap\n });\n }\n\n return this;\n }\n\n /**\n * Sets bins in the ```x``` or ```y``` direction based on a from value, a to value and a number of bins.\n * @memberof SerieDensityMap\n * @param {String} mode - ```x``` or ```y```\n * @param {Number} from - The from value of the bin for the calculation with ```calculateDensityMap```\n * @param {Number} to - The to value\n * @param {Number} num - The number of bins\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n setBinsFromTo(mode, from, to, num) {\n\n this.densityMapCalculation = this.densityMapCalculation || {};\n\n this.densityMapCalculation[mode] = {\n from: from,\n to: to,\n numBins: num\n };\n this.calculationDensityMap();\n return this;\n }\n\n calculationDensityMap(x, y) {\n\n this.method = this.calculateDensityAdvanced;\n this.densityMapCalculation = this.densityMapCalculation || {};\n\n if (x) {\n this.densityMapCalculation.x = x;\n }\n\n if (y) {\n this.densityMapCalculation.y = y;\n }\n }\n\n calculateDensityAdvanced() {\n\n var results = {\n x: {\n from: 0,\n num: 0,\n delta: 0,\n weighing: false\n },\n\n y: {\n from: 0,\n num: 0,\n delta: 0,\n weighing: false\n }\n };\n\n var widthValues = {\n x: this.graph.drawingSpaceWidth,\n y: this.graph.drawingSpaceHeight\n };\n var axisGetter = {\n x: this.getXAxis,\n y: this.getYAxis\n };\n\n var weighing = false;\n\n for (var i in this.densityMapCalculation) {\n\n if (this.densityMapCalculation[i].weighted) {\n weighing = true;\n results[i].weighing = true;\n }\n\n if (this.densityMapCalculation[i].pxPerBin) {\n\n // In value\n\n var from = this.densityMapCalculation[i].from == 'min' ? axisGetter[i].call(this).getCurrentMin() : this.densityMapCalculation[i].from;\n var to = this.densityMapCalculation[i].to == 'max' ? axisGetter[i].call(this).getCurrentMax() : this.densityMapCalculation[i].to;\n\n // In px\n var dimension = Math.abs(axisGetter[i].call(this).getRelPx(to - from));\n results[i].num = Math.ceil(widthValues[i] / this.densityMapCalculation[i].pxPerBin);\n\n //console.log( from, from - axisGetter[ i ].call( this ).getRelVal( ( results[i ].num * this.densityMapCalculation[ i ].pxPerBin - dimension ) / 2 ), ( results[i ].num * this.densityMapCalculation[ i ].pxPerBin - dimension ) / 2 );\n results[i].from = from - Math.abs(axisGetter[i].call(this).getRelVal((results[i].num * this.densityMapCalculation[i].pxPerBin - dimension) / 2));\n results[i].delta = Math.abs(axisGetter[i].call(this).getRelVal(this.densityMapCalculation[i].pxPerBin));\n } else {\n\n results[i].num = this.densityMapCalculation[i].numBins || 400;\n results[i].from = this.densityMapCalculation[i].from == 'min' ? axisGetter[i].call(this).getCurrentMin() : this.densityMapCalculation[i].from;\n results[i].delta = this.densityMapCalculation[i].to ? ((this.densityMapCalculation[i].to == 'max' ? axisGetter[i].call(this).getCurrentMax() : this.densityMapCalculation[i].to) - results[i].from) / results[i].num : this.densityMapCalculate[i].delta;\n }\n\n // console.log( axisGetter[ i ].call( this ).getCurrentMin(), axisGetter[ i ].call( this ).getCurrentMax(), )\n }\n //console.log( this.getYAxis().getCurrentMin(), this.getYAxis().getCurrentMax(), this.graph.drawingSpaceHeight );\n\n //console.log( this.densityMapCalculation );\n\n (weighing ? this.calculateDensityWeighted : this.calculateDensity).call(this, results.x.from, results.x.delta, results.x.num, results.y.from, results.y.delta, results.y.num);\n }\n\n /**\n * Selects a subrange of bins for the color mapping. There is no need to recalculate the color map after calling this method\n * @memberof SerieDensityMap\n * @param {Number} binMin - The minimum bin value\n * @param {Number} binMax - The maximum bin value\n * @return {SerieDensityMap} The current instance\n * @example // In this case, all bins with values below binMin * 2 (the middle scale) will be rendered with the first color of the color map\n * serie.setColorMapBinBoundaries( serie.binMin * 2, serie.binMax );\n */\n setColorMapBinBoundaries(min, max) {\n this.colorMapMin = min;\n this.colorMapMax = max;\n return this;\n }\n\n /**\n * Calls {@link SerieDensityMap#setColorMapBinBoundaries} using the minimum and maximum bin values calculated by {@link SerieDensityMap#calculateDensity}. This function must be called, since colorMinMap and colorMaxMap are not set automatically when the density map is calculated.\n * @memberof SerieDensityMap\n * @param {Number} binMin - The minimum bin value\n * @param {Number} binMax - The maximum bin value\n * @return {SerieDensityMap} The current instance\n */\n autoColorMapBinBoundaries() {\n this.colorMapMin = this.binMin;\n this.colorMapMax = this.binMax;\n return this;\n }\n\n /**\n * Allows the use of a callback to determine the color map min and max value just before the density map is redrawn. This is very useful when the density map is recalculate before redraw, such as in the case where bins per pixels are used\n * @memberof SerieDensityMap\n * @param {(String|Function)} callback - The callback function to call. Should return an array with two elements ```[ colorMapMin, colorMapMax ]```. This parameter can also take the value ```auto```, in which case ```autoColorMapBinBoundaries``` will be called before redraw\n * @return {SerieDensityMap} The current instance\n */\n onRedrawColorMapBinBoundaries(callback) {\n this.callbackColorMapMinMax = callback;\n return this;\n }\n\n /**\n * Generates a color map based on a serie of HSL(A) values.\n * @summary Colors can scale linearly, logarithmically (enhances short range differences) or exponentially (enhances long range differences).\n * One word of advice though. SVG being not canvas, jsGraph has to create a path for each color value of the color map. In other words, if you're asking for 16-bit coloring (65536 values), 65536 SVG paths will be created and your browser will start to suffer from it.\n * As of now, all the colors in colorStops will be places at equal distances from each other between colorMapMin and colorMapMax set by {@link autoColorMapBinBoundaries} or {@link setColorMapBinBoundaries}\n * @memberof SerieDensityMap\n * @param {Array} colorStops - An array of objects, each having the following format: { h: [ 0-360], s: 0-1, l: 0-1, a: 0-1}\n * @param {Number} numColors - The number of colors to compute.\n * @param {String} [ method = \"linear\" ] - The method to use to calculate the density map: linear, exp, or log\n * @return {SerieDensityMap} The current instance\n */\n colorMapHSL(colorStops, numColors, method) {\n\n method = method || 'linear';\n\n var methods = {\n 'exp': function (value) {\n return (Math.exp(value / numColors * 1) - Math.exp(0)) / (Math.exp(1) - Math.exp(0));\n },\n 'log': function (value) {\n return (Math.log(value + 1) - Math.log(1)) / (Math.log(numColors + 1) - Math.log(1));\n },\n 'linear': function (value) {\n return (value - 0) / (numColors - 0);\n }\n };\n\n var k = 0,\n colorMap = [],\n opacities = [];\n\n var color = {\n h: null,\n s: null,\n l: null,\n a: null\n };\n\n var ratio, first;\n\n var slices = colorStops.length - 1;\n\n for (var i = 0; i <= numColors; i++) {\n\n ratio = methods[method](i);\n\n first = Math.floor(ratio * slices);\n\n if (first == colorStops.length - 1) {\n // Handle 1\n first = slices - 1;\n }\n\n ratio = (ratio - first / slices) / (1 / slices);\n\n for (var j in color) {\n color[j] = (colorStops[first + 1][j] - colorStops[first][j]) * ratio + colorStops[first][j];\n }\n\n colorMap[k] = 'hsl(' + color.h + ', ' + Math.round(color.s * 100) + '%, ' + Math.round(color.l * 100) + '%)'; //this.HSVtoRGB( color.h, color.s, color.v );\n opacities[k] = color.a;\n k++;\n }\n\n this.opacities = opacities;\n this.colorMap = colorMap;\n this.colorMapNum = numColors;\n return this;\n }\n\n /**\n * Calls {@link SerieDensityMap#colorMapHSV} using 100 colors.\n * @memberof SerieDensityMap\n * @param {Array} colorStops - An array of objects, each having the following format: { h: [ 0-360], s: 0-1, l: 0-1, a: 0-1}\n * @param {String} [ method = \"linear\" ] - The method to use to calculate the density map: linear, exp or log\n * @return {SerieDensityMap} The current instance\n */\n autoColorMapHSL(colorStops, method = 'linear') {\n this.colorMapHSV(colorStops, 100, method);\n return this;\n }\n\n /* byteToHex( b ) {\n return hexChar[ ( b >> 4 ) & 0x0f ] + hexChar[ b & 0x0f ];\n }\n */\n /*\n HSVtoRGB( h, s, v ) {\n var r, g, b, i, f, p, q, t;\n if ( arguments.length === 1 ) {\n s = h.s, v = h.v, h = h.h;\n }\n i = Math.floor( h * 6 );\n f = h * 6 - i;\n p = v * ( 1 - s );\n q = v * ( 1 - f * s );\n t = v * ( 1 - ( 1 - f ) * s );\n switch ( i % 6 ) {\n case 0:\n r = v, g = t, b = p;\n break;\n case 1:\n r = q, g = v, b = p;\n break;\n case 2:\n r = p, g = v, b = t;\n break;\n case 3:\n r = p, g = q, b = v;\n break;\n case 4:\n r = t, g = p, b = v;\n break;\n case 5:\n r = v, g = p, b = q;\n break;\n }\n return \"#\" + this.byteToHex( Math.floor( r * 255 ) ) + this.byteToHex( Math.floor( g * 255 ) ) + this.byteToHex( Math.floor( b * 255 ) );\n }\n */\n\n /**\n * Returns the color index (```[ 0 - 1 ]```) for a certain value, based on colorMapMin and colorMapMax.\n * @memberof SerieDensityMap\n * @param {Number} binValue - The value of the bin\n * @return {Number} The color index\n */\n getColorIndex(binValue) {\n\n return Math.max(0, Math.min(this.colorMapNum, Math.floor((binValue - this.colorMapMin) / (this.colorMapMax - this.colorMapMin) * this.colorMapNum)));\n }\n\n /**\n * Draws the serie\n * @memberof SerieDensityMap\n * @private\n */\n draw() {\n\n var colorIndex;\n\n if (this.method) {\n this.method();\n }\n\n if (!this.callbackColorMapMinMax || this.colorMapMin == undefined || this.colorMapMax == undefined || this.callbackColorMapMinMax == 'auto') {\n\n this.autoColorMapBinBoundaries();\n } else {\n var val = this.callbackColorMapMinMax(this.binMin, this.binMax);\n\n this.setColorMapBinBoundaries(val[0], val[1]);\n }\n\n var deltaXPx = this.getXAxis().getRelPx(this.deltaX),\n deltaYPx = this.getYAxis().getRelPx(this.deltaY);\n\n for (var i = 0; i < this.paths.length; i++) {\n this.paths[i] = '';\n }\n\n for (var i = 0; i < this.maxIndexX; i++) {\n\n for (var j = 0; j < this.maxIndexY; j++) {\n\n if (this.densitymap[i] == undefined || this.densitymap[i][j] == undefined) {\n continue;\n }\n\n colorIndex = this.getColorIndex(this.densitymap[i][j]);\n if (!this.paths[colorIndex]) {\n this.paths[colorIndex] = '';\n }\n\n this.paths[colorIndex] += ' M ' + this.getXAxis().getPx(i * this.deltaX + this.fromX) + ' ' + this.getYAxis().getPx(j * this.deltaY + this.fromY) + ' h ' + deltaXPx + ' v ' + deltaYPx + ' h -' + deltaXPx + ' z';\n }\n }\n /*\n this.maxIndexX = indexX;\n this.maxIndexY = indexY;*/\n\n this.drawRects();\n }\n\n /**\n * Draws the rectangles\n * @memberof SerieDensityMap\n * @private\n */\n drawRects() {\n\n for (var i = 0; i < this.paths.length; i++) {\n\n if (!this.rects[i]) {\n this.rects[i] = document.createElementNS(this.graph.ns, 'path');\n this.rects[i].setAttribute('shape-rendering', 'crispEdges');\n }\n\n if (this.paths[i] !== undefined) {\n this.rects[i].setAttribute('d', this.paths[i]);\n this.rects[i].setAttribute('fill', this.colorMap[i]);\n this.rects[i].setAttribute('fill-opacity', this.opacities[i]);\n }\n this.groupMain.appendChild(this.rects[i]);\n }\n }\n\n /**\n * Sets the options of the serie\n * @see SerieDensityMapDefaultOptions\n * @param {Object} options - A object containing the options to set\n * @return {SerieDensityMap} The current serie\n * @memberof SerieDensityMap\n */\n setOptions(options) {\n this.options = util.extend(true, {}, this.defaults(), options || {});\n // Unselected style\n\n return this;\n }\n }\n\n exports.default = SerieDensityMap;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 30 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(5), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.serie.line.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphSerieLine, global.graphUtil);\n global.graphSerieContour = mod.exports;\n }\n})(this, function (module, exports, _graphSerieLine, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphSerieLine2 = _interopRequireDefault(_graphSerieLine);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Constructor for the contour serie. Do not use this constructor directly, but use the {@link Graph#newSerie} method\n * @private\n * @extends Serie\n * @example graph.newSerie( name, options, \"contour\" );\n * @see Graph#newSerie\n */\n class SerieContour extends _graphSerieLine2.default {\n\n constructor(graph, name, options) {\n super(...arguments);\n\n this.negativeDelta = 0;\n this.positiveDelta = 0;\n\n this.negativeThreshold = 0;\n this.positiveThreshold = 0;\n\n this.groupMain.setAttribute('clip-path', 'url(#_clipplot' + graph._creation + ')');\n }\n\n /**\n * Sets the contour lines\n * @memberof SerieContour.prototype\n * @param {Object} data - The object data\n * @param {Number} data.minX - The minimum x value\n * @param {Number} data.maxX - The maximum x value\n * @param {Number} data.minY - The minimum y value\n * @param {Number} data.maxY - The maximum y value\n * @param {Object[]} data.segments - The segments making up the contour lines\n * @param {Number[]} data.segments.lines - An array of alternating (x1,y1,x2,y2) quadruplet\n * @param {Number} data.segments.zValue - The corresponding z-value of this array\n * @return {Serie} The current serie\n */\n setData(data, arg, type) {\n\n var z = 0;\n var x,\n dx,\n arg = arg || '2D',\n type = type || 'float',\n i,\n l = data.length,\n j,\n k,\n arr,\n datas = [];\n\n if (!(data instanceof Array)) {\n\n if (typeof data == 'object') {\n // Def v2\n this.minX = data.minX;\n this.minY = data.minY;\n this.maxX = data.maxX;\n this.maxY = data.maxY;\n\n data = data.segments;\n l = data.length;\n }\n }\n\n for (i = 0; i < l; i++) {\n k = data[i].lines.length;\n arr = this._addData(type, k);\n\n for (j = 0; j < k; j += 2) {\n\n arr[j] = data[i].lines[j];\n this._checkX(arr[j]);\n arr[j + 1] = data[i].lines[j + 1];\n this._checkY(arr[j + 1]);\n }\n\n datas.push({\n lines: arr,\n zValue: data[i].zValue\n });\n }\n this.data = datas;\n this.graph.updateDataMinMaxAxes();\n\n this.dataHasChanged(true);\n\n return this;\n }\n\n /**\n * Draws the serie if the data has changed\n * @memberof SerieContour.prototype\n * @param {Boolean} force - Forces redraw even if the data hasn't changed\n * @return {Serie} The current serie\n */\n draw(force) {\n\n if (force || this.hasDataChanged()) {\n\n this.currentLine = 0;\n var x,\n y,\n xpx,\n ypx,\n xpx2,\n ypx2,\n i = 0,\n l = this.data.length,\n j = 0,\n k,\n m,\n currentLine,\n domLine,\n arr;\n this.minZ = Infinity;\n this.maxZ = -Infinity;\n\n var next = this.groupLines.nextSibling;\n this.groupMain.removeChild(this.groupLines);\n this.zValues = {};\n\n var incrXFlip = 0;\n var incrYFlip = 1;\n if (this.getFlip()) {\n incrXFlip = 0;\n incrYFlip = 1;\n }\n\n var minY = this.getYAxis().getCurrentMin();\n var minX = this.getXAxis().getCurrentMin();\n\n var maxX = this.getXAxis().getCurrentMax();\n var maxY = this.getYAxis().getCurrentMax();\n\n this.counter = 0;\n this.currentLineId = 0;\n\n for (; i < l; i++) {\n this.currentLine = '';\n j = 0;\n k = 0;\n\n for (arr = this.data[i].lines, m = arr.length; j < m; j += 4) {\n\n var lastxpx, lastypx;\n\n if (arr[j + incrXFlip] < minX && arr[j + 2 + incrXFlip] < minX || arr[j + incrYFlip] < minY && arr[j + 2 + incrYFlip] < minY || arr[j + incrYFlip] > maxY && arr[j + 2 + incrYFlip] > maxY || arr[j + incrXFlip] > maxX && arr[j + 2 + incrXFlip] > maxX) {\n continue;\n }\n\n xpx2 = this.getX(arr[j + incrXFlip]);\n ypx2 = this.getY(arr[j + incrYFlip]);\n\n xpx = this.getX(arr[j + 2 + incrXFlip]);\n ypx = this.getY(arr[j + 2 + incrYFlip]);\n\n if (xpx == xpx2 && ypx == ypx2) {\n continue;\n }\n\n /*\tif( j > 0 && ( lastxpx !== undefined && lastypx !== undefined && Math.abs( xpx2 - lastxpx ) <= 30 && Math.abs( ypx2 - lastypx ) <= 30 ) ) {\n currentLine += \"L\";\n } else {\n currentLine += \"M\";\n }\n */\n\n this.currentLine += 'M ';\n this.currentLine += xpx2;\n this.currentLine += ' ';\n this.currentLine += ypx2;\n\n this.currentLine += 'L ';\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += ypx;\n\n this.counter++;\n\n lastxpx = xpx;\n lastypx = ypx;\n\n k++;\n }\n\n this.currentLine += ' z';\n\n domLine = this._createLine();\n domLine.setAttribute('data-zvalue', this.data[i].zValue);\n\n this.zValues[this.data[i].zValue] = {\n dom: domLine\n };\n\n this.minZ = Math.min(this.minZ, this.data[i].zValue);\n this.maxZ = Math.max(this.maxZ, this.data[i].zValue);\n }\n\n i++;\n\n for (i = this.currentLine + 1; i < this.lines.length; i++) {\n this.groupLines.removeChild(this.lines[i]);\n this.lines.splice(i, 1);\n }\n\n i = 0;\n\n for (; i < l; i++) {\n this.setColorTo(this.lines[i], this.data[i].zValue, this.minZ, this.maxZ);\n }\n\n this.onMouseWheel(0, {\n shiftKey: false\n });\n this.groupMain.insertBefore(this.groupLines, next);\n } else if (this.hasStyleChanged(this.selectionType)) {\n\n for (; i < l; i++) {\n this.setColorTo(this.lines[i], this.data[i].zValue, this.minZ, this.maxZ);\n }\n }\n }\n\n onMouseWheel(delta, e, fixed, positive) {\n\n delta /= 250;\n\n if (fixed !== undefined) {\n\n if (!positive) {\n this.negativeThreshold = -fixed * this.minZ;\n this.negativeDelta = -Math.pow(Math.abs(this.negativeThreshold / -this.minZ), 1 / 3);\n }\n\n if (positive) {\n this.positiveThreshold = fixed * this.maxZ;\n this.positiveDelta = Math.pow(this.positiveThreshold / this.maxZ, 1 / 3);\n }\n } else {\n\n if (!e.shiftKey || !this.options.hasNegative) {\n\n this.positiveDelta = Math.min(1, Math.max(0, this.positiveDelta + Math.min(0.1, Math.max(-0.1, delta))));\n this.positiveThreshold = this.maxZ * Math.pow(this.positiveDelta, 3);\n } else {\n\n this.negativeDelta = Math.min(0, Math.max(-1, this.negativeDelta + Math.min(0.1, Math.max(-0.1, delta))));\n this.negativeThreshold = -this.minZ * Math.pow(this.negativeDelta, 3);\n }\n }\n\n if (isNaN(this.positiveDelta)) {\n this.positiveDelta = 0;\n }\n\n if (isNaN(this.negativeDelta)) {\n this.negativeDelta = 0;\n }\n\n for (var i in this.zValues) {\n\n this.zValues[i].dom.setAttribute('display', i >= 0 && i >= this.positiveThreshold || i <= 0 && i <= this.negativeThreshold ? 'block' : 'none');\n }\n\n if (this._shapeZoom) {\n\n if (!this.options.hasNegative) {\n this._shapeZoom.hideHandleNeg();\n } else {\n\n this._shapeZoom.setHandleNeg(-Math.pow(this.negativeDelta, 3), this.minZ);\n this._shapeZoom.showHandleNeg();\n }\n\n this._shapeZoom.setHandlePos(Math.pow(this.positiveDelta, 3), this.maxZ);\n }\n }\n\n /**\n * Sets rainbow colors based on hsl format\n * @memberof SerieContour.prototype\n * @param {Object} colors\n * @param {Object} colors.fromPositive\n * @param {Number} colors.fromPositive.h\n * @param {Number} colors.fromPositive.s\n * @param {Number} colors.fromPositive.l\n * @param {Object} colors.toPositive\n * @param {Number} colors.toPositive.h\n * @param {Number} colors.toPositive.s\n * @param {Number} colors.toPositive.l\n * @param {Object} colors.fromNegative\n * @param {Number} colors.fromNegative.h\n * @param {Number} colors.fromNegative.s\n * @param {Number} colors.fromNegative.l\n * @param {Object} colors.toNegative\n * @param {Number} colors.toNegative.h\n * @param {Number} colors.toNegative.s\n * @param {Number} colors.toNegative.l\n * @return {Serie} The current serie\n */\n setDynamicColor(colors) {\n this.lineColors = colors;\n\n this.styleHasChanged();\n }\n\n setNegative(bln) {\n this.options.hasNegative = bln;\n\n if (bln) {\n this.negativeThreshold = 0;\n }\n }\n\n setColorTo(line, zValue, min, max) {\n\n if (!this.lineColors) {\n return;\n }\n\n var hsl = {\n h: 0,\n s: 0,\n l: 0\n };\n\n for (var i in hsl) {\n\n if (zValue > 0) {\n hsl[i] = this.lineColors.fromPositive[i] + (this.lineColors.toPositive[i] - this.lineColors.fromPositive[i]) * (zValue / max);\n } else {\n hsl[i] = this.lineColors.fromNegative[i] + (this.lineColors.toNegative[i] - this.lineColors.fromNegative[i]) * (zValue / min);\n }\n }\n\n hsl.h /= 360;\n\n var rgb = util.hslToRgb(hsl.h, hsl.s, hsl.l);\n\n line.setAttribute('stroke', 'rgb(' + rgb.join() + ')');\n }\n\n getSymbolForLegend() {\n\n if (!this.lineForLegend) {\n\n var line = document.createElementNS(this.graph.ns, 'ellipse');\n\n line.setAttribute('cx', 7);\n line.setAttribute('cy', 0);\n line.setAttribute('rx', 8);\n line.setAttribute('ry', 3);\n\n line.setAttribute('cursor', 'pointer');\n this.lineForLegend = line;\n }\n\n this.applyLineStyle(this.lineForLegend, this.maxZ);\n\n return this.lineForLegend;\n }\n\n applyLineStyle(line, overwriteValue) {\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth() + (this.isSelected() ? 2 : 0));\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n }\n line.setAttribute('fill', 'none');\n\n this.setColorTo(line, overwriteValue !== undefined ? overwriteValue : line.getAttribute('data-zvalue'), this.minZ, this.maxZ);\n // line.setAttribute('shape-rendering', 'optimizeSpeed');\n\n this.hasStyleChanged(false);\n }\n\n setShapeZoom(shape) {\n this._shapeZoom = shape;\n }\n\n }\n\n exports.default = SerieContour;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 31 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShape);\n global.graphShapeAreaundercurve = mod.exports;\n }\n})(this, function (module, exports, _graphShape) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Displays a surface under a line serie\n * @extends GraphShape\n */\n class ShapeSurfaceUnderCurve extends _graphShape2.default {\n\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'path');\n }\n\n createHandles() {\n\n this._createHandles(2, 'line', {\n 'stroke-width': '3',\n 'stroke': 'transparent',\n 'pointer-events': 'stroke',\n 'cursor': 'ew-resize'\n });\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY) {\n\n if (this.isLocked()) {\n return;\n }\n\n if (this.moving) {\n\n this.getPosition(0).deltaPosition('x', deltaX, this.getXAxis());\n this.getPosition(1).deltaPosition('x', deltaX, this.getXAxis());\n } else if (this.serie && this.handleSelected) {\n\n this.resizingPosition = this.handleSelected == 1 ? this.getPosition(0) : this.getPosition(1);\n\n var value = this.serie.searchClosestValue(this.getXAxis().getVal(this.graph._getXY(e).x - this.graph.getPaddingLeft()));\n\n if (!value) {\n return;\n }\n\n if (this.resizingPosition.x != value.xMin) {\n this.preventUnselect = true;\n }\n\n this.resizingPosition.x = value.xMin;\n } else if (this.handleSelected) {\n\n this.resizingPosition = this.handleSelected == 1 ? this.getPosition(0) : this.getPosition(1);\n this.resizingPosition.deltaPosition('x', deltaX, this.getXAxis());\n }\n\n this.applyPosition();\n }\n /*\n redrawImpl: function() {\n //var doDraw = this.setPosition();\n //\tthis.setDom('fill', 'url(#' + 'patternFill' + this.graph._creation + ')')\n if ( this.position != this.doDraw ) {\n this.group.setAttribute( \"visibility\", this.position ? \"visible\" : 'hidden' );\n this.doDraw = this.position;\n }\n },\n */\n applyPosition() {\n\n if (!this.serie) {\n return;\n }\n\n var posXY = this.computePosition(0),\n posXY2 = this.computePosition(1),\n w = Math.abs(posXY.x - posXY2.x),\n x = Math.min(posXY.x, posXY2.x);\n\n // this.reversed = x == posXY2.x;\n\n if (w < 2 || x + w < 0 || x > this.graph.getDrawingWidth()) {\n this.setDom('d', '');\n return false;\n }\n\n var v1 = this.serie.searchClosestValue(this.getPosition(0).x),\n v2 = this.serie.searchClosestValue(this.getPosition(1).x),\n v3,\n i,\n j,\n init,\n max,\n k,\n x,\n y,\n firstX,\n firstY,\n currentLine,\n maxY = 0,\n minY = Number.MAX_VALUE;\n\n if (!v1 || !v2) {\n return false;\n }\n\n if (v1.xBeforeIndex > v2.xBeforeIndex) {\n v3 = v1;\n v1 = v2;\n v2 = v3;\n\n //this.handleSelected = ( this.handleSelected == 1 ) ? 2 : 1;\n }\n\n this.counter = 0;\n\n for (i = v1.dataIndex; i <= v2.dataIndex; i++) {\n this.currentLine = '';\n init = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n max = i == v2.dataIndex ? v2.xBeforeIndexArr : this.serie.data[i].length;\n k = 0;\n\n if (init == max) {\n max++;\n }\n\n for (j = init; j <= max; j += 2) {\n\n x = this.serie.getX(this.serie.data[i][j + 0]);\n y = this.serie.getY(this.serie.data[i][j + 1]);\n\n maxY = Math.max(this.serie.data[i][j + 1], maxY);\n minY = Math.min(this.serie.data[i][j + 1], minY);\n\n if (j == init) {\n this.firstX = x;\n this.firstY = y;\n }\n\n if (k > 0) {\n this.currentLine += ' L ' + x + ' ' + y + ' ';\n } else {\n this.currentLine += ' M ' + x + ' ' + y + ' ';\n }\n\n //this.serie._addPoint( x, y, false, this.currentLine );\n k++;\n }\n\n this.lastX = x;\n this.lastY = y;\n\n if (!this.firstX || !this.firstY || !this.lastX || !this.lastY) {\n return;\n }\n\n this.currentLine += ' V ' + this.getYAxis().getPx(0) + ' H ' + this.firstX + ' z';\n this.setDom('d', this.currentLine);\n }\n\n this.maxY = this.serie.getY(maxY);\n this.setHandles();\n\n this.changed();\n\n return true;\n }\n\n setHandles() {\n\n if (!this.firstX) {\n return;\n }\n\n var posXY = this.computePosition(0),\n posXY2 = this.computePosition(1);\n\n if (posXY.x < posXY2.x) {\n\n this.handles[1].setAttribute('x1', this.firstX);\n this.handles[1].setAttribute('x2', this.firstX);\n\n this.handles[2].setAttribute('x1', this.lastX);\n this.handles[2].setAttribute('x2', this.lastX);\n } else {\n\n this.handles[1].setAttribute('x1', this.lastX);\n this.handles[1].setAttribute('x2', this.lastX);\n\n this.handles[2].setAttribute('x1', this.firstX);\n this.handles[2].setAttribute('x2', this.firstX);\n }\n this.handles[1].setAttribute('y1', this.getYAxis().getMaxPx());\n this.handles[1].setAttribute('y2', this.serie.getY(0));\n\n this.handles[2].setAttribute('y1', this.getYAxis().getMaxPx());\n this.handles[2].setAttribute('y2', this.serie.getY(0));\n }\n }\n\n exports.default = ShapeSurfaceUnderCurve;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 32 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(12)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.line.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShapeLine);\n global.graphShapeArrow = mod.exports;\n }\n})(this, function (module, exports, _graphShapeLine) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShapeLine2 = _interopRequireDefault(_graphShapeLine);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Displays an arrow\n * @extends GraphShapeLine\n */\n class ShapeArrow extends _graphShapeLine2.default {\n\n constructor(graph) {\n\n super(graph);\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'line');\n this._dom.setAttribute('marker-end', 'url(#arrow' + this.graph._creation + ')');\n\n this.createHandles(this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n\n this.setStrokeColor('black');\n this.setStrokeWidth(1);\n }\n }\n\n exports.default = ShapeArrow;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 33 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShape);\n global.graphShapeLabel = mod.exports;\n }\n})(this, function (module, exports, _graphShape) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Blank shape used to display label\n * Use myShapelabel.setLabelText(); and associated methods\n * @extend GraphShape\n */\n class ShapeLabel extends _graphShape2.default {\n\n constructor(graph, options) {\n\n super(graph, options);\n }\n\n createDom() {\n return false;\n }\n\n applyPosition() {\n return true;\n }\n }\n\n exports.default = ShapeLabel;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 34 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShape);\n global.graphShapePolyline = mod.exports;\n }\n})(this, function (module, exports, _graphShape) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Represents a line that extends the Shape class. Used by the plugin {@link PluginSerieLineDifference}\n * @extends Shape\n * @see Graph#newShape\n */\n class ShapePolyline extends _graphShape2.default {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'path');\n\n if (!this.getStrokeColor()) {\n this.setStrokeColor('black');\n }\n\n if (this.getStrokeWidth() == undefined) {\n this.setStrokeWidth(1);\n }\n }\n\n /**\n * No handles for the polyline\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {}\n\n /**\n * Force the points of the polyline already computed in pixels\n * @param {String} a SVG string to be used in the ```d``` attribute of the path.\n * @return {ShapePolyline} The current polyline instance\n */\n setPointsPx(points) {\n this.setProp('pxPoints', points);\n return this;\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n let pxPoints;\n let pos = this.computePosition(0);\n\n if (pxPoints = this.getProp('pxPoints')) {\n\n pxPoints = ' M ' + pos.x + ' ' + pos.y + ' ' + pxPoints;\n this.setDom('d', pxPoints);\n } else if (this.points) {\n\n var xAxis, yAxis;\n\n if (this.serie) {\n\n xAxis = this.serie.getXAxis();\n yAxis = this.serie.getYAxis();\n } else if (this.xAxis && this.yAxis) {\n\n xAxis = this.xAxis;\n yAxis = this.yAxis;\n }\n\n this.setDom('d', 'M ' + this.points.map(function (p) {\n return xAxis.getPx(p[0]) + ', ' + yAxis.getPx(p[1]);\n }).join(' L '));\n }\n\n this.changed();\n return true;\n }\n }\n\n exports.default = ShapePolyline;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 35 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(1), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.js'), require('../graph.position.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShape, global.graphPosition);\n global.graphShapeNmrintegral = mod.exports;\n }\n})(this, function (module, exports, _graphShape, _graphPosition) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n var _graphPosition2 = _interopRequireDefault(_graphPosition);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Displays an integral with NMR style\n * @extends ShapeSurfaceUnderCurve\n */\n class ShapeNMRIntegral extends _graphShape2.default {\n\n constructor(graph, options) {\n\n super(graph, options);\n\n this.nbHandles = 2;\n }\n\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'path');\n this._domShadow = document.createElementNS(this.graph.ns, 'path');\n this._domShadow.jsGraphIsShape = this;\n this._dom.setAttribute('pointer-events', 'stroke');\n this._domShadow.setAttribute('pointer-events', 'stroke');\n this._domShadow.setAttribute('stroke-width', '12');\n this._domShadow.setAttribute('fill', 'transparent');\n this._domShadow.setAttribute('stroke', 'transparent');\n this.group.appendChild(this._domShadow);\n }\n\n initImpl() {\n this.setFillColor('transparent');\n this.setStrokeColor('black');\n }\n\n createHandles() {\n\n this._createHandles(2, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white'\n });\n\n this.handles[1].setAttribute('fill', 'red');\n }\n\n xor(a, b) {\n return a && !b || !a && b;\n }\n\n applyPosition() {\n\n let x,\n y,\n xVal,\n yVal,\n axis = this.getAxis(),\n points = [];\n\n let currentLine = '',\n baseLine = this.getProp('baseLine', 0) || 300,\n ratio;\n\n if (!this.serie) {\n throw 'No serie exists for this shape';\n }\n /*\n this.sortPositions( ( a, b ) => {\n return a.x - b.x;\n } );\n */\n let pos1 = this.getPosition(0);\n let pos2 = this.getPosition(1);\n\n if (pos1.x < this.serie.getXAxis().getCurrentMin() && pos2.x < this.serie.getXAxis().getCurrentMin() || pos1.x > this.serie.getXAxis().getCurrentMax() && pos2.x > this.serie.getXAxis().getCurrentMax()) {\n this.setDom('d', '');\n this._domShadow.setAttribute('d', '');\n\n this.hideLabel(0);\n return false;\n }\n\n this.showLabel(0);\n\n let sum = 0;\n\n let j;\n let waveform = this.serie.getWaveform();\n\n if (!waveform) {\n return;\n }\n\n let index1 = waveform.getIndexFromX(pos1[axis], true, Math.floor),\n index2 = waveform.getIndexFromX(pos2[axis], true, Math.ceil),\n index3,\n flipped = false;\n\n if (index1 == index2) {\n // At least one px please !\n if (waveform.getReductionType() == 'aggregate') {\n index2 += 4; // Aggregated state\n } else {\n index2++; // Non aggregated state\n }\n }\n\n if (index2 < index1) {\n index3 = index1;\n index1 = index2;\n index2 = index3;\n flipped = true;\n }\n\n let firstX, firstY, firstXVal, firstYVal, lastX, lastXVal, lastY, lastYVal;\n let data = waveform.getDataInUse();\n\n let condition, incrementation;\n\n let normalSums = true;\n if (waveform.getReductionType() == 'aggregate') {\n normalSums = false;\n }\n\n if (waveform.getXMonotoneousAscending() && // Ascending\n 1 == 1 || !waveform.getXMonotoneousAscending() && // Ascending\n 1 == 2) {\n\n j = index2;\n condition = true;\n incrementation = -1;\n } else {\n\n j = index1;\n condition = false;\n incrementation = 1;\n }\n\n for (; condition ? j >= index1 : j <= index2; j += incrementation) {\n\n xVal = waveform.getX(j, true);\n yVal = waveform.getY(j, true);\n\n x = this.serie.getX(xVal);\n y = this.serie.getY(yVal);\n\n /*\n if ( ! normalSums && j % 4 == 0 && j >= index1 && data.sums ) { // Sums are located every 4 element\n sum += data.sums[ j ];// * ( waveform.getX( j, true ) - waveform.getX( j - 3, true ) ); // y * (out-in)\n } else if( normalSums ) {\n */\n sum += waveform.getY(j, true); // * ( waveform.getX( j, true ) - waveform.getX( j - 1, true ) ); // y * (out-in)\n //}\n\n if (!firstX) {\n\n firstX = x;\n firstY = y;\n firstXVal = waveform.getX(j);\n firstYVal = waveform.getY(j);\n }\n\n if (lastX == undefined) {\n\n lastX = x;\n lastY = y;\n lastXVal = waveform.getX(j);\n lastYVal = waveform.getY(j);\n continue;\n }\n\n if (x == lastX && y == lastY) {\n //continue;\n }\n\n lastX = x;\n lastY = y;\n //console.log( data, data[ j ] );\n\n points.push([x, y, sum]);\n lastXVal = xVal;\n }\n\n lastXVal = false;\n lastYVal = false;\n lastX = false;\n lastY = false;\n\n if (sum == 0) {\n sum = 1;\n }\n\n this._sumVal = waveform.integrate(pos1.x, pos2.x);\n\n if (!this.ratio) {\n // 150px / unit\n ratio = 200 / sum;\n } else {\n // Already existing\n ratio = this.ratio * (this.sumVal / sum);\n }\n let py;\n\n if (points.length == 0) {\n return;\n }\n\n for (var i = 0, l = points.length; i < l; i++) {\n\n py = baseLine - points[i][2] * ratio;\n\n if (i > 0 && (points[i - 1][2] > sum / 2 && points[i][2] <= sum / 2 || points[i - 1][2] < sum / 2 && points[i][2] >= sum / 2)) {\n\n let pos = baseLine - (points[i - 1][2] + points[i][2]) / 2 * ratio;\n\n this.setPosition({\n x: points[i][0] + 'px',\n y: pos + 'px'\n\n }, 3);\n\n this.setLabelPosition(this.getPosition(3), 0);\n }\n\n currentLine += ' L ' + points[i][0] + ', ' + py + ' ';\n\n this.lastPointX = points[i][0];\n this.lastPointY = py;\n }\n\n this.points = points;\n this._sum = sum;\n\n if (this.serie.isFlipped()) {\n currentLine = ' M ' + baseLine + ', ' + firstX + ' ' + currentLine;\n } else {\n currentLine = ' M ' + firstX + ', ' + baseLine + ' ' + currentLine;\n }\n\n this.firstPointX = firstX;\n this.firstPointY = baseLine;\n\n this.setDom('d', currentLine);\n this._domShadow.setAttribute('d', currentLine);\n\n this.firstX = firstX;\n this.firstY = firstY;\n /*\n if ( this._selected ) {\n this.select();\n }\n this.setHandles();*/\n\n this.ratioLabel && this.updateIntegralValue(this.ratioLabel) || this.updateLabels();\n\n this.changed();\n this.handleCondition = !this.xor(incrementation == -1, flipped);\n this.setHandles();\n\n this.updateIntegralValue();\n\n return true;\n }\n\n updateIntegralValue(ratioLabel = this.ratioLabel, forceValue) {\n\n if (ratioLabel) {\n this.ratioLabel = ratioLabel;\n }\n\n if (forceValue !== undefined) {\n this.ratioLabel = forceValue / this.sumVal;\n }\n\n this.setLabelText(ratioLabel ? (Math.round(100 * this.sumVal * ratioLabel) / 100).toPrecision(3) : 'N/A', 0);\n this.updateLabels();\n return this.ratioLabel;\n }\n\n getAxis() {\n return this._data.axis || 'x';\n }\n\n /**\n * User to screen coordinate transform. In (unit)/(px), (unit) being the unit of the integral (x * y)\n * @type {Number}\n */\n set ratio(r) {\n this._ratio = r;\n }\n\n get ratio() {\n return this._ratio;\n }\n\n get sum() {\n return this._sum;\n }\n\n get sumVal() {\n return this._sumVal;\n }\n\n selectStyle() {\n this.setDom('stroke-width', '2px');\n }\n\n selectHandles() {} // Cancel areaundercurve\n\n setHandles() {\n\n if (this.points == undefined) {\n return;\n }\n\n if (!this.isSelected()) {\n return;\n }\n\n this.addHandles();\n\n if (this.handleCondition) {\n\n this.handles[1].setAttribute('x', this.firstPointX);\n this.handles[1].setAttribute('y', this.firstPointY);\n this.handles[2].setAttribute('x', this.lastPointX);\n this.handles[2].setAttribute('y', this.lastPointY);\n } else {\n\n this.handles[2].setAttribute('x', this.firstPointX);\n this.handles[2].setAttribute('y', this.firstPointY);\n this.handles[1].setAttribute('x', this.lastPointX);\n this.handles[1].setAttribute('y', this.lastPointY);\n }\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n if (this.isLocked()) {\n return;\n }\n\n var pos = this.getPosition(0);\n var pos2 = this.getPosition(1);\n\n var posToChange;\n\n if (this.handleSelected == 1) {\n\n posToChange = pos;\n } else if (this.handleSelected == 2) {\n\n posToChange = pos2;\n }\n\n if (posToChange) {\n\n if (!this._data.vertical) {\n posToChange.deltaPosition('x', deltaX, this.getXAxis());\n }\n }\n\n if (this.moving) {\n\n // If the pos2 is defined by a delta, no need to move them\n if (pos.x) {\n pos.deltaPosition('x', deltaX, this.getXAxis());\n }\n\n // If the pos2 is defined by a delta, no need to move them\n if (pos2.x) {\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n }\n }\n\n if (this.rectEvent) {\n this.setEventReceptacle();\n }\n\n this.redraw();\n this.changed();\n\n return true;\n }\n }\n\n exports.default = ShapeNMRIntegral;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 36 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(18)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.rect.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShapeRect);\n global.graphShapePeakintegration2d = mod.exports;\n }\n})(this, function (module, exports, _graphShapeRect) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShapeRect2 = _interopRequireDefault(_graphShapeRect);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n class ShapePeakIntegration2D extends _graphShapeRect2.default {\n\n constructor(graph, options) {\n\n super(graph, options);\n this.nbHandles = 4;\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'rect');\n this._dom.element = this;\n\n this.createHandles(this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n\n redrawImpl() {\n\n this.setPosition();\n this.setHandles();\n this.setBindableToDom(this._dom);\n }\n\n }\n\n exports.default = ShapePeakIntegration2D;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 37 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShape);\n global.graphShapeCross = mod.exports;\n }\n})(this, function (module, exports, _graphShape) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Displays a cross\n * @extends Shape\n */\n class ShapeCross extends _graphShape2.default {\n\n constructor(graph, options) {\n super(graph, options);\n this.nbHandles = 1;\n }\n\n /**\n * Width of the cross, also available from the constructor\n * @type {Number} width\n */\n get width() {\n return this.options.width || 10;\n }\n\n set width(l) {\n this.options.width = l;\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'path');\n this._dom.setAttribute('d', 'M -' + this.width / 2 + ' 0 h ' + this.width + ' m -' + this.width / 2 + ' -' + this.width / 2 + ' v ' + this.width + '');\n }\n\n createHandles() {\n\n this._createHandles(this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n applyPosition() {\n\n var position = this.calculatePosition(0);\n if (!position || !position.x || !position.y) {\n return;\n }\n\n this.setDom('transform', 'translate( ' + position.x + ', ' + position.y + ')');\n\n this.currentPos1x = position.x;\n this.currentPos1y = position.y;\n\n return true;\n }\n\n redrawImpl() {\n\n this.setHandles();\n }\n\n handleCreateImpl() {}\n\n handleMouseDownImpl(e) {\n\n this.moving = true;\n\n return true;\n }\n\n handleMouseUpImpl() {\n\n this.triggerChange();\n return true;\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n if (this.isLocked()) {\n return;\n }\n\n var pos = this.getFromData('pos');\n\n if (this.moving) {\n\n pos.x = this.graph.deltaPosition(pos.x, deltaX, this.getXAxis());\n pos.y = this.graph.deltaPosition(pos.y, deltaY, this.getYAxis());\n }\n\n this.redrawImpl();\n\n return true;\n }\n\n setHandles() {\n\n if (!this.areHandlesInDom()) {\n return;\n }\n\n if (isNaN(this.currentPos1x)) {\n return;\n }\n\n this.handles[1].setAttribute('x', this.currentPos1x);\n this.handles[1].setAttribute('y', this.currentPos1y);\n }\n\n selectStyle() {\n this.setDom('stroke', 'red');\n this.setDom('stroke-width', '2');\n }\n }\n\n exports.default = ShapeCross;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 38 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(12)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.line.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShapeLine);\n global.graphShapePeakboundariescenter = mod.exports;\n }\n})(this, function (module, exports, _graphShapeLine) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShapeLine2 = _interopRequireDefault(_graphShapeLine);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Shows a horizontal line with three little vertical bars. Very useful to demonstrate a peak start, end and middle value\n * @extends ShapeLine\n */\n class ShapePeakBoundaries extends _graphShapeLine2.default {\n\n constructor(graph) {\n super(graph);\n this.lineHeight = 6;\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'line');\n this.line1 = document.createElementNS(this.graph.ns, 'line');\n this.line2 = document.createElementNS(this.graph.ns, 'line');\n this.line3 = document.createElementNS(this.graph.ns, 'line');\n\n this.rectBoundary = document.createElementNS(this.graph.ns, 'path');\n\n this.rectBoundary.setAttribute('fill', 'transparent');\n this.rectBoundary.setAttribute('stroke', 'none');\n this.rectBoundary.setAttribute('pointer-events', 'fill');\n\n this.rectBoundary.jsGraphIsShape = true;\n\n this.group.appendChild(this.rectBoundary);\n this.group.appendChild(this.line1);\n this.group.appendChild(this.line2);\n this.group.appendChild(this.line3);\n this._dom.element = this;\n }\n\n createHandles() {\n this._createHandles(3, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n\n redrawImpl() {\n\n this.line1.setAttribute('stroke', this.getStrokeColor());\n this.line2.setAttribute('stroke', this.getStrokeColor());\n this.line3.setAttribute('stroke', this.getStrokeColor());\n\n this.line1.setAttribute('stroke-width', this.getStrokeWidth());\n this.line2.setAttribute('stroke-width', this.getStrokeWidth());\n this.line3.setAttribute('stroke-width', this.getStrokeWidth());\n\n this.setHandles();\n this.redrawLines();\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Redraws the vertical lines according to the positions.\n * Position 0 is the left line, position 1 is the right line and position 2 is the center line\n * @returns {ShapePeakBoundaries} The shape instance\n */\n redrawLines() {\n\n var posLeft = this.computePosition(0);\n var posRight = this.computePosition(1);\n var posCenter = this.computePosition(2);\n\n if (posLeft.x && posRight.x && posCenter.x && this.posYPx) {\n\n var height = this.lineHeight;\n this.rectBoundary.setAttribute('d', 'M ' + posLeft.x + ' ' + (this.posYPx - height) + ' v ' + 2 * height + ' H ' + posRight.x + ' v ' + -2 * height + 'z');\n this.line1.setAttribute('x1', posLeft.x);\n this.line1.setAttribute('x2', posLeft.x);\n\n this.line2.setAttribute('x1', posRight.x);\n this.line2.setAttribute('x2', posRight.x);\n\n this.line3.setAttribute('x1', posCenter.x);\n this.line3.setAttribute('x2', posCenter.x);\n\n this._dom.setAttribute('x1', posLeft.x);\n this._dom.setAttribute('x2', posRight.x);\n\n this.redrawY(height);\n }\n\n return this;\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Redraws the vertical positions of the shape\n * @returns {ShapePeakBoundaries} The shape instance\n */\n redrawY() {\n\n if (!this.posYPx) {\n return this;\n }\n\n var height = this.lineHeight;\n\n this.line1.setAttribute('y1', this.posYPx - height);\n this.line1.setAttribute('y2', this.posYPx + height);\n\n this.line2.setAttribute('y1', this.posYPx - height);\n this.line2.setAttribute('y2', this.posYPx + height);\n\n this.line3.setAttribute('y1', this.posYPx - height);\n this.line3.setAttribute('y2', this.posYPx + height);\n\n this._dom.setAttribute('y1', this.posYPx);\n this._dom.setAttribute('y2', this.posYPx);\n\n return this;\n }\n\n setHandles() {\n\n if (!this.posYPx) {\n return;\n }\n\n var posLeft = this.computePosition(0);\n var posRight = this.computePosition(1);\n var posCenter = this.computePosition(2);\n\n if (posLeft.x && posRight.x && posCenter.x) {\n\n this.handles[1].setAttribute('x', posLeft.x);\n this.handles[1].setAttribute('y', this.posYPx);\n\n this.handles[2].setAttribute('x', posRight.x);\n this.handles[2].setAttribute('y', this.posYPx);\n\n this.handles[3].setAttribute('x', posCenter.x);\n this.handles[3].setAttribute('y', this.posYPx);\n }\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Sets the y position of the shape\n * @param {Number} y - The y position in px\n * @returns {ShapePeakBoundaries} The shape instance\n */\n setY(y) {\n this.posYPx = y;\n return this;\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Sets the height of the peak lines\n * @param {Number} height - The height of the lines in px\n * @returns {ShapePeakBoundaries} The shape instance\n */\n setLineHeight(height) {\n this.lineHeihgt = height;\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY) {\n\n if (this.isLocked()) {\n return;\n }\n\n var posLeft = this.getPosition(0);\n var posRight = this.getPosition(1);\n var posCenter = this.getPosition(2);\n\n switch (this.handleSelected) {\n\n case 1:\n // left\n posLeft.deltaPosition('x', deltaX, this.getXAxis());\n\n if (Math.abs(posCenter.x - posRight.x) > Math.abs(posRight.x - posLeft.x) || Math.abs(posCenter.x - posLeft.x) > Math.abs(posRight.x - posLeft.x)) {\n posCenter.x = posLeft.x + (posRight.x - posLeft.x) * 0.1;\n }\n break;\n\n case 2:\n // left\n\n posRight.deltaPosition('x', deltaX, this.getXAxis());\n\n if (Math.abs(posCenter.x - posRight.x) > Math.abs(posRight.x - posLeft.x) || Math.abs(posCenter.x - posLeft.x) > Math.abs(posRight.x - posLeft.x)) {\n posCenter.x = posRight.x + (posLeft.x - posRight.x) * 0.1;\n }\n\n break;\n\n case 3:\n // left\n\n posCenter.deltaPosition('x', deltaX, this.getXAxis());\n\n if (Math.abs(posCenter.x - posRight.x) > Math.abs(posRight.x - posLeft.x) || Math.abs(posCenter.x - posLeft.x) > Math.abs(posRight.x - posLeft.x)) {\n return;\n }\n\n break;\n\n }\n\n this.setLabelPosition({\n y: this.getLabelPosition(0).y,\n x: posCenter.x\n });\n\n this.updateLabels();\n this.redrawLines();\n this.setHandles();\n }\n\n applyPosition() {\n\n this.redrawLines();\n return true;\n }\n\n }\n\n exports.default = ShapePeakBoundaries;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 39 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0), __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'), require('./graph.shape.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil, global.graphShape);\n global.graphShapeHtml = mod.exports;\n }\n})(this, function (module, exports, _graphUtil, _graphShape) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Represents a line\n * @extends Shape\n * @see Graph#newShape\n */\n class ShapeHTML extends _graphShape2.default {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElement('div');\n // this._dom.setAttribute( \"requiredExtensions\", \"http://www.w3.org/1999/xhtml\" );\n\n this._dom.setAttribute('style', 'position: absolute');\n let div = document.createElement('div');\n this._dom.appendChild(div);\n this.div = div;\n }\n\n /**\n * Creates the handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {}\n\n setHeight(height) {\n this.setProp('height', height);\n }\n\n setWidth(width) {\n this.setProp('width', width);\n }\n\n setContent(content) {\n this.setProp('content', content);\n }\n\n setRenderer(method) {\n this._renderer = method;\n }\n\n redraw() {\n\n if (this._renderer) {\n this._renderer(this.div);\n } else {\n this.div.innerHTML = this.getProp('content');\n }\n\n super.redraw(...arguments);\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n var position = this.calculatePosition(0);\n\n if (!position || !(0, _graphUtil.isNumeric)(position.x) || !(0, _graphUtil.isNumeric)(position.y)) {\n return;\n }\n this._dom.style.left = position.x + 'px';\n this._dom.style.top = position.y + 'px';\n\n this.currentPosX = position.x;\n this.currentPosY = position.y;\n\n return true;\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n return true;\n }\n\n /**\n * Sets the handle position\n * @private\n */\n setHandles() {}\n\n isHTML() {\n return true;\n }\n }\n\n exports.default = ShapeHTML;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 40 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.plugin.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphPlugin);\n global.graphPluginDrag = mod.exports;\n }\n})(this, function (module, exports, _graphPlugin) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Constructor for the drag plugin. Do not use this constructor directly.\n * @class PluginDrag\n * @implements Plugin\n */\n class PluginDrag extends _graphPlugin2.default {\n\n static default() {\n return {\n\n dragX: true,\n dragY: true,\n persistanceX: false,\n persistanceY: false\n\n };\n }\n\n /**\n * @private\n */\n init(graph) {\n\n this.graph = graph;\n this.time = null;\n this.totaltime = 2000;\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, target) {\n this._draggingX = x;\n this._draggingY = y;\n\n this._lastDraggingX = this._draggingX;\n this._lastDraggingY = this._draggingY;\n\n this.stopAnimation = true;\n\n this.moved = false;\n\n return true;\n }\n\n /**\n * @memberof PluginDrag\n * @private\n */\n onMouseMove(graph, x, y, e, target) {\n\n var deltaX = x - this._draggingX;\n var deltaY = y - this._draggingY;\n\n if (this.options.dragX) {\n graph._applyToAxes(function (axis) {\n axis.setCurrentMin(axis.getVal(axis.getMinPx() - deltaX));\n axis.setCurrentMax(axis.getVal(axis.getMaxPx() - deltaX));\n }, false, true, false);\n }\n\n if (this.options.dragY) {\n\n graph._applyToAxes(function (axis) {\n axis.setCurrentMin(axis.getVal(axis.getMinPx() - deltaY));\n axis.setCurrentMax(axis.getVal(axis.getMaxPx() - deltaY));\n }, false, false, true);\n }\n\n this._lastDraggingX = this._draggingX;\n this._lastDraggingY = this._draggingY;\n\n this._draggingX = x;\n this._draggingY = y;\n\n this.moved = true;\n\n this.time = Date.now();\n\n this.emit('dragging');\n\n graph.draw(true);\n }\n\n onMouseUp(graph, x, y, e, target) {\n\n var dt = Date.now() - this.time;\n\n if (x == this._lastDraggingX || y == this._lastDraggingY) {\n\n if (this.moved) {\n this.emit('dragged');\n }\n\n return;\n }\n\n this.speedX = (x - this._lastDraggingX) / dt;\n this.speedY = (y - this._lastDraggingY) / dt;\n\n if (isNaN(this.speedX) || isNaN(this.speedY)) {\n this.emit('dragged');\n return;\n }\n\n graph._applyToAxes(function (axis) {\n axis._pluginDragMin = axis.getCurrentMin();\n axis._pluginDragMax = axis.getCurrentMax();\n }, false, true, true);\n\n this.stopAnimation = false;\n this.accelerationX = -this.speedX / this.totaltime;\n this.accelerationY = -this.speedY / this.totaltime;\n\n if (this.options.persistanceX || this.options.persistanceY) {\n\n this._persistanceMove(graph);\n } else {\n\n this.emit('dragged');\n }\n }\n\n _persistanceMove(graph) {\n\n var self = this;\n\n if (self.stopAnimation) {\n self.emit('dragged');\n return;\n }\n\n window.requestAnimationFrame(function () {\n\n var dt = Date.now() - self.time;\n var dx = (0.5 * self.accelerationX * dt + self.speedX) * dt;\n var dy = (0.5 * self.accelerationY * dt + self.speedY) * dt;\n\n if (self.options.persistanceX) {\n\n graph._applyToAxes(function (axis) {\n\n axis.setCurrentMin(-axis.getRelVal(dx) + axis._pluginDragMin);\n axis.setCurrentMax(-axis.getRelVal(dx) + axis._pluginDragMax);\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n }, false, true, false);\n }\n\n if (self.options.persistanceY) {\n\n graph._applyToAxes(function (axis) {\n\n axis.setCurrentMin(-axis.getRelVal(dy) + axis._pluginDragMin);\n axis.setCurrentMax(-axis.getRelVal(dy) + axis._pluginDragMax);\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n }, false, false, true);\n }\n\n graph.draw();\n\n if (dt < self.totaltime) {\n self.emit('dragging');\n self._persistanceMove(graph);\n } else {\n self.emit('dragged');\n }\n });\n }\n }\n\n exports.default = PluginDrag;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 41 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(2), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.plugin.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphPlugin, global.graphUtil);\n global.graphPluginShape = mod.exports;\n }\n})(this, function (module, exports, _graphPlugin, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * @class PluginShape\n * @implements Plugin\n */\n class PluginShape extends _graphPlugin2.default {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n return {};\n }\n\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n\n super.init(graph, options);\n this.shapeType = options.type;\n }\n\n /**\n * Sets the shape that is created by the plugin\n * @param {String} shapeType - The type of the shape\n */\n setShape(shapeType) {\n this.shapeInfo.shapeType = shapeType;\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, target) {\n\n if (!this.shapeType && !this.options.url) {\n return;\n }\n\n var self = this,\n selfPlugin = this;\n\n var xVal, yVal;\n\n this.count = this.count || 0;\n\n x -= graph.getPaddingLeft();\n y -= graph.getPaddingTop();\n\n xVal = graph.getXAxis().getVal(x);\n yVal = graph.getYAxis().getVal(y);\n\n var shapeInfo = {\n\n position: [{\n x: xVal,\n y: yVal\n }, {\n x: xVal,\n y: yVal\n }],\n\n onChange: function (newData) {\n graph.triggerEvent('onAnnotationChange', newData);\n },\n\n locked: false,\n selectable: true,\n resizable: true,\n movable: true\n };\n\n let shapeProperties = this.options.properties;\n\n util.extend(true, shapeInfo, this.options);\n\n this.emit('beforeNewShape', e, shapeInfo);\n\n if (this.graph.prevent(false)) {\n return;\n }\n\n var shape = graph.newShape(shapeInfo.type, shapeInfo, false, shapeProperties);\n\n this.emit('createdShape', e, shape);\n\n if (shape) {\n self.currentShape = shape;\n self.currentShapeEvent = e;\n }\n\n graph.once('mouseUp', () => {\n console.log(this.currentShape);\n if (!this.currentShape) {\n // The mouse has moved\n self.emit('newShape', e, shape);\n }\n });\n }\n\n /**\n * @private\n */\n onMouseMove(graph, x, y, e) {\n\n if (this.currentShape) {\n console.log('mv');\n this.count++;\n\n var shape = this.currentShape;\n\n this.currentShape = false;\n\n if (graph.selectedSerie && !shape.serie) {\n shape.setSerie(graph.selectedSerie);\n }\n\n shape.resizing = true;\n\n if (shape.options && shape.options.onCreate) {\n shape.options.onCreate.call(shape);\n }\n\n shape.draw();\n graph.selectShape(shape);\n shape.handleMouseDown(this.currentShapeEvent, true);\n shape.handleSelected = this.options.handleSelected || 1;\n shape.handleMouseMove(e, true);\n }\n }\n\n /**\n * @private\n */\n onMouseUp() {\n\n if (this.currentShape) {\n // No need to kill it as it hasn't been actually put in the dom right now\n\n // Norman 30 July 2017: Yes but it's added in the jsGraph stack. We need to remove it. See #176\n // From now on killing the shape will result in removing it from the stack as well.\n this.currentShape.kill();\n this.currentShape = false;\n }\n }\n\n }\n\n exports.default = PluginShape;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 42 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'), require('./graph.plugin.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil, global.graphPlugin);\n global.graphPluginSelectScatter = mod.exports;\n }\n})(this, function (module, exports, _graphUtil, _graphPlugin) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n /**\n * @extends Plugin\n */\n class PluginSelectScatter extends _graphPlugin2.default {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n return {};\n }\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n\n this._path = document.createElementNS(graph.ns, 'path');\n\n util.setAttributeTo(this._path, {\n 'display': 'none',\n 'fill': 'rgba(0,0,0,0.1)',\n 'stroke': 'rgba(0,0,0,1)',\n 'shape-rendering': 'crispEdges',\n 'x': 0,\n 'y': 0,\n 'height': 0,\n 'width': 0,\n 'd': ''\n });\n\n this.graph = graph;\n\n graph.dom.appendChild(this._path);\n }\n\n /**\n * Assigns the scatter serie that should be selected to the plugin\n * @param {ScatterSerie} serie - The serie\n * @return {PluginSelectScatter} The current plugin instance\n */\n setSerie(serie) {\n this.serie = serie;\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, mute) {\n\n if (!this.serie) {\n return;\n }\n\n this.path = 'M ' + x + ' ' + y + ' ';\n this.currentX = x;\n this.currentY = y;\n\n this.xs = [this.serie.getXAxis().getVal(x - graph.getPaddingLeft())];\n this.ys = [this.serie.getYAxis().getVal(y - graph.getPaddingTop())];\n this._path.setAttribute('d', '');\n this._path.setAttribute('display', 'block');\n }\n\n /**\n * @private\n */\n onMouseMove(graph, x, y, e, mute) {\n\n if (Math.pow(x - this.currentX, 2) + Math.pow(y - this.currentY, 2) > 25) {\n\n this.path += ' L ' + x + ' ' + y + ' ';\n this.currentX = x;\n this.currentY = y;\n\n this.xs.push(this.serie.getXAxis().getVal(x - graph.getPaddingLeft()));\n this.ys.push(this.serie.getYAxis().getVal(y - graph.getPaddingTop()));\n\n this._path.setAttribute('d', this.path + ' z');\n\n this.findPoints();\n }\n }\n\n /**\n * @private\n */\n findPoints() {\n\n var data = this.serie.waveform;\n var selected = [];\n var counter = 0,\n j2;\n for (var i = 0, l = data.getLength(); i < l; i += 1) {\n\n counter = 0;\n for (var j = 0, k = this.xs.length; j < k; j += 1) {\n\n if (j == k - 1) {\n j2 = 0;\n } else {\n j2 = j + 1;\n }\n\n if (this.ys[j] < data.getY(i) && this.ys[j2] > data.getY(i) || this.ys[j] > data.getY(i) && this.ys[j2] < data.getY(i)) {\n\n if (data.getX(i) > (data.getY(i) - this.ys[j]) / (this.ys[j2] - this.ys[j]) * (this.xs[j2] - this.xs[j]) + this.xs[j]) {\n counter++;\n }\n }\n }\n\n if (counter % 2 == 1) {\n selected.push(i);\n this.serie.selectPoint(i, true, 'selected');\n } else {\n this.serie.unselectPoint(i);\n }\n }\n\n this.selected = selected;\n this.emit('selectionProcess', selected);\n }\n\n /**\n * @private\n */\n onMouseUp(graph, x, y, e) {\n this._path.setAttribute('display', 'none');\n this.emit('selectionEnd', this.selected);\n }\n\n }\n\n exports.default = PluginSelectScatter;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 43 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'), require('./graph.plugin.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil, global.graphPlugin);\n global.graphPluginZoom = mod.exports;\n }\n})(this, function (module, exports, _graphUtil, _graphPlugin) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n /**\n * @class PluginZoom\n * @implements Plugin\n */\n class PluginZoom extends _graphPlugin2.default {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n\n return {\n 'axes': 'all'\n };\n }\n\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n\n this._zoomingGroup = document.createElementNS(graph.ns, 'g');\n this._zoomingSquare = document.createElementNS(graph.ns, 'rect');\n this._zoomingSquare.setAttribute('display', 'none');\n\n util.setAttributeTo(this._zoomingSquare, {\n 'display': 'none',\n 'fill': 'rgba(171,12,12,0.2)',\n 'stroke': 'rgba(171,12,12,1)',\n 'shape-rendering': 'crispEdges',\n 'x': 0,\n 'y': 0,\n 'height': 0,\n 'width': 0,\n 'pointer-events': 'none'\n });\n\n this.graph = graph;\n graph.groupEvent.appendChild(this._zoomingGroup);\n this._zoomingGroup.appendChild(this._zoomingSquare);\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, mute) {\n\n var zoomMode = this.options.zoomMode;\n\n if (!zoomMode) {\n return;\n }\n\n this._zoomingMode = zoomMode;\n\n if (x === undefined) {\n this._backedUpZoomMode = this._zoomingMode;\n this._zoomingMode = 'y';\n x = 0;\n }\n\n if (y === undefined) {\n this._backedUpZoomMode = this._zoomingMode;\n this._zoomingMode = 'x';\n y = 0;\n }\n\n this._zoomingXStart = x;\n this._zoomingYStart = y;\n this.x1 = x - graph.getPaddingLeft();\n this.y1 = y - graph.getPaddingTop();\n\n this._zoomingSquare.setAttribute('width', 0);\n this._zoomingSquare.setAttribute('height', 0);\n this._zoomingSquare.setAttribute('display', 'block');\n\n switch (this._zoomingMode) {\n\n case 'x':\n this._zoomingSquare.setAttribute('y', graph.options.paddingTop);\n this._zoomingSquare.setAttribute('height', graph.getDrawingHeight() - graph.shift.bottom);\n break;\n\n case 'y':\n this._zoomingSquare.setAttribute('x', graph.options.paddingLeft /* + this.shift[1]*/);\n this._zoomingSquare.setAttribute('width', graph.getDrawingWidth() /* - this.shift[1] - this.shift[2]*/);\n break;\n\n case 'forceY2':\n\n this.y2 = graph.getYAxis().getPx(this.options.forcedY) + graph.options.paddingTop;\n\n break;\n\n }\n\n if (this.options.onZoomStart && !mute) {\n this.options.onZoomStart(graph, x, y, e, mute);\n }\n }\n\n /**\n * @private\n */\n onMouseMove(graph, x, y, e, mute) {\n\n //\tthis._zoomingSquare.setAttribute('display', 'none');\n\n //\tthis._zoomingSquare.setAttribute('transform', 'translate(' + Math.random() + ', ' + Math.random() + ') scale(10, 10)');\n switch (this._zoomingMode) {\n\n case 'xy':\n this._zoomingSquare.setAttribute('x', Math.min(this._zoomingXStart, x));\n this._zoomingSquare.setAttribute('y', Math.min(this._zoomingYStart, y));\n this._zoomingSquare.setAttribute('width', Math.abs(this._zoomingXStart - x));\n this._zoomingSquare.setAttribute('height', Math.abs(this._zoomingYStart - y));\n\n break;\n\n case 'forceY2':\n this._zoomingSquare.setAttribute('y', Math.min(this._zoomingYStart, this.y2));\n this._zoomingSquare.setAttribute('height', Math.abs(this._zoomingYStart - this.y2));\n this._zoomingSquare.setAttribute('x', Math.min(this._zoomingXStart, x));\n this._zoomingSquare.setAttribute('width', Math.abs(this._zoomingXStart - x));\n\n break;\n\n case 'x':\n this._zoomingSquare.setAttribute('x', Math.min(this._zoomingXStart, x));\n this._zoomingSquare.setAttribute('width', Math.abs(this._zoomingXStart - x));\n\n break;\n\n case 'y':\n this._zoomingSquare.setAttribute('y', Math.min(this._zoomingYStart, y));\n this._zoomingSquare.setAttribute('height', Math.abs(this._zoomingYStart - y));\n break;\n\n }\n\n if (this.options.onZoomMove && !mute) {\n\n this.options.onZoomMove(graph, x, y, e, mute);\n }\n //\t\tthis._zoomingSquare.setAttribute('display', 'block');\n }\n\n /**\n * @private\n */\n onMouseUp(graph, x, y, e, mute) {\n var self = this;\n this.removeZone();\n\n var _x = x - graph.options.paddingLeft;\n var _y = y - graph.options.paddingTop;\n\n this.emit('beforeZoom', {\n graph: graph,\n x: x,\n y: y,\n e: e,\n mute: mute\n });\n\n if (graph.prevent(false)) {\n\n // This doesn't work !\n //graph.prevent( true ); // Cancel future click event\n return;\n }\n\n if (x - this._zoomingXStart == 0 && this._zoomingMode != 'y' || y - this._zoomingYStart == 0 && this._zoomingMode != 'x') {\n return;\n }\n\n if (this.options.transition || this.options.smooth) {\n\n let modeX = false,\n modeY = false;\n\n if (this._zoomingMode == 'x' || this._zoomingMode == 'xy' || this._zoomingMode == 'forceY2') {\n\n this.fullX = false;\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min(axis.getVal(_x), axis.getVal(self.x1));\n axis._pluginZoomMaxFinal = Math.max(axis.getVal(_x), axis.getVal(self.x1));\n }, false, true, false);\n\n modeX = true;\n }\n\n if (this._zoomingMode == 'y' || this._zoomingMode == 'xy') {\n\n this.fullY = false;\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min(axis.getVal(_y), axis.getVal(self.y1));\n axis._pluginZoomMaxFinal = Math.max(axis.getVal(_y), axis.getVal(self.y1));\n }, false, false, true);\n\n modeY = true;\n }\n\n if (this._zoomingMode == 'forceY2') {\n\n this.fullY = false;\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min(axis.getVal(self.y2), axis.getVal(self.y1));\n axis._pluginZoomMaxFinal = Math.max(axis.getVal(self.y2), axis.getVal(self.y1));\n }, false, false, true);\n\n modeY = true;\n }\n\n this.transition(modeX, modeY, 'zoomEnd');\n } else {\n\n switch (this._zoomingMode) {\n case 'x':\n this.fullX = false;\n this.toAxes('_doZoom', [_x, this.x1], true, false);\n break;\n case 'y':\n this.fullY = false;\n this.toAxes('_doZoom', [_y, this.y1], false, true);\n break;\n case 'xy':\n this.fullX = false;\n this.fullY = false;\n this.toAxes('_doZoom', [_x, this.x1], true, false);\n this.toAxes('_doZoom', [_y, this.y1], false, true);\n break;\n\n case 'forceY2':\n\n this.fullX = false;\n this.fullY = false;\n\n this.toAxes('_doZoom', [_x, this.x1], true, false);\n this.toAxes('_doZoom', [this.y1, this.y2], false, true);\n\n break;\n }\n\n // graph.prevent( true ); // WHat are you doing ??\n graph.draw();\n\n if (this._backedUpZoomMode) {\n this._zoomingMode = this._backedUpZoomMode;\n }\n\n this.emit('zoomed');\n\n graph.pluginYieldActiveState();\n }\n }\n\n /**\n * @private\n */\n removeZone() {\n\n this._zoomingSquare.setAttribute('display', 'none');\n }\n\n /**\n * @private\n */\n onMouseWheel(delta, e, coordX, coordY, options) {\n\n if (!options) {\n options = {};\n }\n\n if (!options.baseline) {\n options.baseline = 0;\n }\n\n let baseline = options.baseline;\n\n if (options.baseline == 'mousePosition') {\n baseline = this.graph.getYAxis().getVal(coordY);\n console.log(baseline);\n }\n\n /*var serie;\n if ( ( serie = this.graph.getSelectedSerie() ) ) {\n if ( serie.getYAxis().handleMouseWheel( delta, e ) ) {\n return;\n }\n }*/\n\n var doX = options.direction == 'x';\n var doY = !(options.direction !== 'y');\n\n this.toAxes('handleMouseWheel', [delta, e, baseline], doX, doY);\n\n this.graph.drawSeries();\n }\n\n /**\n * @private\n */\n onDblClick(x, y, e, pref, mute) {\n\n var graph = this.graph;\n this.emit('beforeDblClick', {\n graph: graph,\n x: x,\n y: y,\n pref: pref,\n e: e,\n mute: mute\n });\n\n if (graph.prevent(false)) {\n return;\n }\n\n if (this.options.transition || this.options.smooth) {\n\n var modeX = false,\n modeY = false;\n\n if (pref.mode == 'xtotal' || pref.mode == 'total') {\n\n this.toAxes(function (axis) {\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getMinValue() - axis.options.axisDataSpacing.min * axis.getInterval();\n axis._pluginZoomMaxFinal = axis.getMaxValue() + axis.options.axisDataSpacing.max * axis.getInterval();\n }, false, true, false);\n\n modeX = true;\n }\n\n if (pref.mode == 'ytotal' || pref.mode == 'total') {\n\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getMinValue() - axis.options.axisDataSpacing.min * axis.getInterval();\n axis._pluginZoomMaxFinal = axis.getMaxValue() + axis.options.axisDataSpacing.max * axis.getInterval();\n }, false, false, true);\n\n modeY = true;\n }\n\n let x, y;\n\n if (pref.mode == 'gradualX' || pref.mode == 'gradualY' || pref.mode == 'gradual' || pref.mode == 'gradualXY') {\n\n x = false, y = false;\n\n if (pref.mode == 'gradualX' || pref.mode == 'gradual' || pref.mode == 'gradualXY') {\n x = true;\n modeX = true;\n }\n\n if (pref.mode == 'gradualY' || pref.mode == 'gradual' || pref.mode == 'gradualXY') {\n y = true;\n modeY = true;\n }\n\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getCurrentMin() - (axis.getCurrentMax() - axis.getCurrentMin());\n axis._pluginZoomMaxFinal = axis.getCurrentMax() + (axis.getCurrentMax() - axis.getCurrentMin());\n }, false, x, y);\n }\n\n this.transition(modeX, modeY, 'dblClick');\n return;\n }\n\n var xAxis = this.graph.getXAxis(),\n yAxis = this.graph.getYAxis();\n\n if (pref.mode == 'xtotal') {\n\n this.toAxes('setMinMaxToFitSeries', null, true, false);\n this.fullX = true;\n this.fullY = false;\n } else if (pref.mode == 'ytotal') {\n\n this.toAxes('setMinMaxToFitSeries', null, false, true);\n this.fullX = false;\n this.fullY = true;\n } else if (pref.mode == 'total') {\n\n this.toAxes('setMinMaxToFitSeries', null, true, true);\n\n this.fullX = true;\n this.fullY = true;\n // Nothing to do here\n /* this.graph._applyToAxes( function( axis ) {\n axis.emit( 'zoom', axis.currentAxisMin, axis.currentAxisMax, axis );\n }, null, true, true );\n */\n } else {\n\n x -= this.graph.options.paddingLeft;\n y -= this.graph.options.paddingTop;\n\n var xMin = xAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n xActual = xAxis.getVal(x),\n diffX = xMax - xMin,\n yMin = yAxis.getCurrentMin(),\n yMax = yAxis.getCurrentMax(),\n yActual = yAxis.getVal(y),\n diffY = yMax - yMin;\n\n if (pref.mode == 'gradualXY' || pref.mode == 'gradualX') {\n\n var ratio = (xActual - xMin) / (xMax - xMin);\n xMin = Math.max(xAxis.getMinValue() - xAxis.getInterval() * xAxis.options.axisDataSpacing.min, xMin - diffX * ratio);\n xMax = Math.min(xAxis.getMaxValue() + xAxis.getInterval() * xAxis.options.axisDataSpacing.max, xMax + diffX * (1 - ratio));\n xAxis.setCurrentMin(xMin);\n xAxis.setCurrentMax(xMax);\n\n if (xAxis.options.onZoom) {\n xAxis.options.onZoom(xMin, xMax);\n }\n\n xAxis.cacheCurrentMin();\n xAxis.cacheCurrentMax();\n xAxis.cacheInterval();\n }\n\n if (pref.mode == 'gradualXY' || pref.mode == 'gradualY') {\n\n var ratio = (yActual - yMin) / (yMax - yMin);\n yMin = Math.max(yAxis.getMinValue() - yAxis.getInterval() * yAxis.options.axisDataSpacing.min, yMin - diffY * ratio);\n yMax = Math.min(yAxis.getMaxValue() + yAxis.getInterval() * yAxis.options.axisDataSpacing.max, yMax + diffY * (1 - ratio));\n yAxis.setCurrentMin(yMin);\n yAxis.setCurrentMax(yMax);\n\n if (yAxis.options.onZoom) {\n yAxis.options.onZoom(yMin, yMax);\n }\n\n yAxis.cacheCurrentMin();\n yAxis.cacheCurrentMax();\n yAxis.cacheInterval();\n }\n }\n\n graph.pluginYieldActiveState();\n\n this.graph.draw();\n /*\n this.emit( \"dblClick\", {\n graph: graph,\n x: x,\n y: y,\n pref: pref,\n e: e,\n mute: mute\n } );\n if ( this.options.onDblClick && !mute ) {\n this.options.onDblClick( graph, x, y, e, mute );\n }*/\n }\n\n transition(modeX, modeY, eventName) {\n\n var self = this,\n maxTime = 500;\n\n if (!self.gradualUnzoomStart) {\n self.gradualUnzoomStart = Date.now();\n }\n\n window.requestAnimationFrame(function () {\n\n var dt = Date.now() - self.gradualUnzoomStart;\n\n if (dt > maxTime) {\n dt = maxTime;\n }\n var progress = Math.sin(dt / maxTime * Math.PI / 2);\n\n self.toAxes(function (axis) {\n\n axis.setCurrentMin(axis._pluginZoomMin + (axis._pluginZoomMinFinal - axis._pluginZoomMin) * progress);\n axis.setCurrentMax(axis._pluginZoomMax + (axis._pluginZoomMaxFinal - axis._pluginZoomMax) * progress);\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n }, false, modeX, modeY);\n\n self.graph.draw();\n\n if (dt < maxTime) {\n\n self.transition(modeX, modeY, eventName);\n self.emit('zooming');\n } else {\n\n self.emit('zoomed');\n self.graph.pluginYieldActiveState();\n\n if (eventName) {\n self.emit(eventName);\n }\n self.gradualUnzoomStart = 0;\n }\n });\n }\n\n isFullX() {\n return this.fullX;\n }\n\n isFullY() {\n return this.fullY;\n }\n\n toAxes(func, params, tb, lr) {\n\n var axes = this.options.axes;\n\n if (!axes || axes == 'serieSelected' && !this.graph.getSelectedSerie()) {\n axes = 'all';\n }\n\n switch (axes) {\n\n case 'all':\n this.graph._applyToAxes.apply(this.graph, arguments);\n break;\n\n case 'serieSelected':\n\n var serie = this.graph.getSelectedSerie();\n if (serie) {\n\n if (tb) {\n\n if (typeof func == 'string') {\n serie.getXAxis()[func].apply(serie.getXAxis(), params);\n } else {\n func.apply(serie.getXAxis(), params);\n }\n }\n\n if (lr) {\n\n if (typeof func == 'string') {\n serie.getYAxis()[func].apply(serie.getYAxis(), params);\n } else {\n func.apply(serie.getYAxis(), params);\n }\n }\n }\n\n break;\n\n default:\n\n if (!Array.isArray(axes)) {\n axes = [axes];\n }\n\n for (let axis of axes) {\n\n if (axis.isX() && tb) {\n // Not the best check\n\n if (typeof func == 'string') {\n axis[func].apply(axis, params);\n } else {\n func.apply(axis, params);\n }\n } else if (axis.isY() && lr) {\n // Not the best check\n\n if (typeof func == 'string') {\n axis[func].apply(axis, params);\n } else {\n func.apply(axis, params);\n }\n }\n }\n break;\n }\n }\n\n }\n\n exports.default = PluginZoom;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 44 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(3), __webpack_require__(45), __webpack_require__(2), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.core.js'), require('../graph.lru.js'), require('./graph.plugin.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphCore, global.graphLru, global.graphPlugin, global.graphUtil);\n global.graphPluginTimeseriemanager = mod.exports;\n }\n})(this, function (module, exports, _graphCore, _graphLru, _graphPlugin, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphCore2 = _interopRequireDefault(_graphCore);\n\n var _graphLru2 = _interopRequireDefault(_graphLru);\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * @class PluginTimeSerieManager\n * @implements Plugin\n */\n class PluginTimeSerieManager extends _graphPlugin2.default {\n\n constructor() {\n\n super(...arguments);\n\n this.series = [];\n this.plugins = [];\n this.currentSlots = {};\n\n this.requestLevels = new Map();\n this.update = (noRecalculate, force) => {\n\n this.series.forEach(function (serie) {\n\n this.updateSerie(serie, noRecalculate);\n });\n\n if (!noRecalculate) {\n this.recalculateSeries(force);\n }\n };\n }\n\n static default() {\n\n return {\n\n LRUName: 'PluginTimeSerieManager',\n intervals: [1000, 15000, 60000, 900000, 3600000, 8640000],\n maxParallelRequests: 3,\n optimalPxPerPoint: 2,\n nbPoints: 1000,\n url: ''\n };\n }\n\n /**\n * Init method\n * @private\n * @memberof PluginTimeSerieManager\n */\n init(graph, options) {\n this.graph = graph;\n _graphLru2.default.create(this.options.LRUName, 200);\n this.requestsRunning = 0;\n }\n\n setURL(url) {\n this.options.url = url;\n return this;\n }\n\n setAvailableIntervals() {\n this.options.intervals = arguments;\n }\n\n newSerie(serieName, serieOptions, serieType, dbElements, noZoneSerie) {\n var s = this.graph.newSerie(serieName, serieOptions, serieType);\n\n this.currentSlots[serieName] = {\n min: 0,\n max: 0,\n interval: 0\n };\n\n s.on('hide', function () {\n\n if (s._zoneSerie) {\n\n s._zoneSerie.hide();\n }\n });\n\n s.on('show', function () {\n\n if (s._zoneSerie) {\n s._zoneSerie.show();\n }\n });\n\n s.setInfo('timeSerieManagerDBElements', dbElements);\n\n if (!noZoneSerie) {\n s._zoneSerie = this.graph.newSerie(serieName + '_zone', {}, _graphCore2.default.SERIE_ZONE);\n }\n\n this.series.push(s);\n return s;\n }\n\n registerPlugin(plugin, event) {\n\n var index;\n if ((index = this.plugins.indexOf(plugin)) > -1) {\n\n for (var i = 1; i < arguments.length; i++) {\n plugin.removeListener(arguments[i], this.update);\n }\n }\n\n for (var i = 1; i < arguments.length; i++) {\n plugin.on(arguments[i], this.update);\n }\n }\n\n updateSerie(serie, noRecalculate) {\n\n var self = this;\n var from = serie.getXAxis().getCurrentMin();\n var to = serie.getXAxis().getCurrentMax();\n var priority = 1;\n\n var optimalInterval = this.getOptimalInterval(to - from);\n var optimalIntervalIndex = this.options.intervals.indexOf(optimalInterval);\n var interval;\n\n this.cleanRegister(optimalIntervalIndex);\n\n for (var i = optimalIntervalIndex; i <= optimalIntervalIndex + 1; i++) {\n\n interval = this.options.intervals[i];\n var startSlotId = self.computeSlotID(from, interval);\n var endSlotId = self.computeSlotID(to, interval);\n\n var intervalMultipliers = [[2, 5, 6], [1, 2, 4], [0, 1, 3]];\n\n intervalMultipliers.forEach(function (multiplier) {\n\n var firstSlotId = startSlotId - multiplier[0] * (endSlotId - startSlotId);\n var lastSlotId = endSlotId + multiplier[0] * (endSlotId - startSlotId);\n\n var slotId = firstSlotId;\n\n while (slotId <= lastSlotId) {\n\n if (self.computeTimeMin(slotId, interval) > Date.now()) {\n break;\n }\n\n self.register(serie, slotId, interval, interval == optimalInterval ? multiplier[1] : multiplier[2], true, noRecalculate);\n slotId++;\n }\n });\n }\n\n this.processRequests();\n }\n\n cleanRegister(interval) {\n\n if (!this.requestLevels) {\n return;\n }\n\n this.requestLevels.forEach(levelArray => {\n\n levelArray.forEach((levelElement, levelIndex) => {\n\n if (levelElement[4] < interval) {\n levelArray.splice(levelIndex, 1);\n }\n });\n });\n }\n\n register(serie, slotId, interval, priority, noProcess, noRecalculate) {\n\n var id = this.computeUniqueID(serie, slotId, interval);\n\n var data = _graphLru2.default.get(this.options.LRUName, id);\n\n if (!data || this.computeTimeMax(slotId, interval) > Date.now() && data.timeout < Date.now() - (noRecalculate ? 5000 : 100000) && priority == 1) {\n\n this.request(serie, slotId, interval, priority, id, noProcess);\n }\n }\n\n request(serie, slotId, interval, priority, slotName, noProcess) {\n\n for (var i in this.requestLevels) {\n\n if (i == priority) {\n continue;\n }\n\n if (this.requestLevels[i][slotName]) {\n\n if (this.requestLevels[i][slotName][0] !== 1) {\n // If the request is not pending\n\n delete this.requestLevels[i][slotName];\n } else {\n this.requestLevels[i][slotName][5] = priority;\n }\n }\n }\n\n if (this.requestLevels[priority] && this.requestLevels[priority][slotName]) {\n return;\n }\n\n this.requestLevels[priority] = this.requestLevels[priority] || {};\n this.requestLevels[priority][slotName] = [0, slotName, serie.getName(), slotId, interval, priority, serie.getInfo('timeSerieManagerDBElements')];\n\n if (!noProcess) {\n this.processRequests();\n }\n }\n\n processRequests() {\n\n if (this.requestsRunning >= this.options.maxParallelRequests) {\n return;\n }\n\n var self = this,\n currentLevelChecking = 1,\n requestToMake;\n\n while (true) {\n\n for (var i in this.requestLevels[currentLevelChecking]) {\n\n if (this.requestLevels[currentLevelChecking][i][0] == 1) {\n // Running request\n continue;\n }\n\n requestToMake = this.requestLevels[currentLevelChecking][i];\n break;\n }\n\n if (requestToMake) {\n break;\n }\n\n currentLevelChecking++;\n\n if (currentLevelChecking > 10) {\n return;\n }\n }\n\n this.requestsRunning++;\n\n if (!requestToMake) {\n return;\n }\n\n requestToMake[0] = 1;\n\n util.ajaxGet({\n\n url: this.getURL(requestToMake),\n method: 'GET',\n json: true\n\n }).done(function (data) {\n\n if (data.status == 1) {\n // Success\n\n self.requestsRunning--;\n\n delete self.requestLevels[currentLevelChecking][i];\n\n _graphLru2.default.store(self.options.LRUName, requestToMake[1], data.data); // Element 1 is the unique ID\n self.processRequests();\n\n if (requestToMake[5] == 1 && Object.keys(self.requestLevels[1]).length == 0) {\n\n self.recalculateSeries(true);\n }\n }\n });\n }\n\n computeTimeMax(slotId, interval) {\n return (slotId + 1) * (interval * this.options.nbPoints);\n }\n\n computeTimeMin(slotId, interval) {\n return slotId * (interval * this.options.nbPoints);\n }\n\n getURL(requestElements) {\n\n var url = this.options.url.replace('', requestElements[2]).replace('', this.computeTimeMin(requestElements[3], requestElements[4])).replace('', this.computeTimeMax(requestElements[3], requestElements[4])).replace('', requestElements[4]);\n\n var dbElements = requestElements[6] || {};\n\n for (var i in dbElements) {\n url = url.replace('<' + i + '>', dbElements[i]);\n }\n\n return url;\n }\n\n getOptimalInterval(totalspan) {\n\n var optimalInterval = (this.options.optimalPxPerPoint || 1) * totalspan / this.graph.getDrawingWidth(),\n diff = Infinity,\n optimalIntervalAmongAvailable;\n\n this.options.intervals.forEach(function (interval) {\n\n var newDiff = Math.min(diff, Math.abs(interval - optimalInterval));\n if (diff !== newDiff) {\n\n optimalIntervalAmongAvailable = interval;\n diff = newDiff;\n }\n });\n\n return optimalIntervalAmongAvailable || 1000;\n }\n\n computeUniqueID(serie, slotId, interval) {\n var extra = '';\n var info = serie.getInfo('timeSerieManagerDBElements');\n for (var i in info) {\n extra += ';' + i + ':' + info[i];\n }\n\n return serie.getName() + ';' + slotId + ';' + interval + extra;\n }\n\n computeSlotID(time, interval) {\n return Math.floor(time / (interval * this.options.nbPoints));\n }\n\n computeSlotTime(slotId, interval) {\n return slotId * (interval * this.options.nbPoints);\n }\n\n getZoneSerie(serie) {\n return serie._zoneSerie;\n }\n\n updateZoneSerie(serieName) {\n\n var serie = this.graph.getSerie(serieName);\n\n if (!serie) {\n return;\n }\n\n if (!serie._zoneSerie) {\n return;\n }\n\n serie._zoneSerie.setXAxis(serie.getXAxis());\n serie._zoneSerie.setYAxis(serie.getYAxis());\n serie._zoneSerie.setFillColor(serie.getLineColor());\n serie._zoneSerie.setLineColor(serie.getLineColor());\n serie._zoneSerie.setFillOpacity(0.2);\n serie._zoneSerie.setLineOpacity(0.3);\n }\n\n recalculateSeries(force) {\n\n var self = this;\n\n if (this.locked) {\n return;\n }\n\n this.changed = false;\n\n this.series.map(function (serie) {\n self.recalculateSerie(serie, force);\n });\n\n /*if ( this.changed ) {\n self.graph._applyToAxes( \"scaleToFitAxis\", [ this.graph.getXAxis(), false, undefined, undefined, false, true ], false, true );\n }\n */\n this.changed = false;\n //self.graph.autoscaleAxes();\n\n self.graph.draw();\n }\n\n recalculateSerie(serie, force) {\n\n var from = serie.getXAxis().getCurrentMin(),\n to = serie.getXAxis().getCurrentMax(),\n interval = this.getOptimalInterval(to - from);\n\n var startSlotId = this.computeSlotID(from, interval);\n var endSlotId = this.computeSlotID(to, interval);\n\n var data = [];\n var dataMinMax = [];\n\n if (!force && interval == this.currentSlots[serie.getName()].interval && this.currentSlots[serie.getName()].min <= startSlotId && this.currentSlots[serie.getName()].max >= endSlotId) {\n return;\n }\n\n startSlotId -= 2;\n endSlotId += 2;\n\n this.currentSlots[serie.getName()].min = startSlotId;\n this.currentSlots[serie.getName()].max = endSlotId;\n this.currentSlots[serie.getName()].interval = interval;\n\n var slotId = startSlotId;\n\n while (slotId <= endSlotId) {\n\n const lruData = _graphLru2.default.get(this.options.LRUName, this.computeUniqueID(serie, slotId, interval));\n if (lruData) {\n\n data = data.concat(lruData.data.mean);\n dataMinMax = dataMinMax.concat(lruData.data.minmax);\n } else {\n\n this.recalculateSerieUpwards(serie, slotId, interval, data, dataMinMax);\n }\n\n slotId++;\n }\n\n this.changed = true;\n\n serie.setData(data);\n\n if (serie._zoneSerie) {\n serie._zoneSerie.setData(dataMinMax);\n }\n }\n\n setIntervalCheck(interval) {\n\n if (this.interval) {\n clearInterval(this.interval);\n }\n\n this.update(true, true);\n this.interval = setInterval(() => {\n this.update(true, false);\n }, interval);\n }\n\n recalculateSerieUpwards(serie, downSlotId, downInterval, data, dataMinMax) {\n\n var intervals = this.options.intervals.slice(0);\n intervals.sort();\n\n var nextInterval = intervals[intervals.indexOf(downInterval) + 1] || -1;\n if (nextInterval < 0) {\n return [];\n }\n\n var newSlotTime = this.computeSlotTime(downSlotId, downInterval);\n var newSlotTimeEnd = this.computeSlotTime(downSlotId + 1, downInterval);\n var newSlotId = this.computeSlotID(newSlotTime, nextInterval),\n start = false;\n\n const lruData = _graphLru2.default.get(this.options.LRUName, this.computeUniqueID(serie, newSlotId, nextInterval));\n if (lruData) {\n\n for (var i = 0, l = lruData.data.mean.length; i < l; i += 2) {\n\n if (lruData.data.mean[i] < newSlotTime) {\n continue;\n } else if (start === false) {\n start = i;\n }\n\n if (lruData.data.mean[i] >= newSlotTimeEnd) {\n\n data = data.concat(lruData.data.mean.slice(start, i));\n dataMinMax = data.concat(lruData.data.minmax.slice(start, i));\n\n return;\n }\n }\n }\n\n return this.recalculateSerieUpwards(serie, newSlotId, nextInterval, data, dataMinMax);\n }\n\n lockRedraw() {\n this.locked = true;\n }\n\n unlockRedraw() {\n this.locked = false;\n }\n\n isRedrawLocked() {\n return !!this.locked;\n }\n }\n\n exports.default = PluginTimeSerieManager;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 45 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(exports);\n } else {\n var mod = {\n exports: {}\n };\n factory(mod.exports);\n global.graphLru = mod.exports;\n }\n})(this, function (exports) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.create = create;\n exports.get = get;\n exports.store = store;\n exports.empty = empty;\n exports.exist = exist;\n var memory = {},\n memoryHead = {},\n memoryCount = {},\n memoryLimit = {};\n\n function emptyMemory(store) {\n memory[store] = {};\n memoryCount[store] = 0;\n }\n\n function createStoreMemory(store, limit) {\n limit = limit || 50;\n if (!memory[store]) {\n memory[store] = {};\n memoryCount[store] = 0;\n }\n\n memoryLimit[store] = limit;\n }\n\n function getFromMemory(store, index) {\n var obj, head;\n\n if (memory[store] && memory[store][index]) {\n\n head = memoryHead[store];\n\n obj = memory[store][index];\n obj.prev = head;\n obj.next = head.next;\n head.next.prev = obj;\n head.next = obj;\n\n memoryHead[store] = obj;\n return obj.data;\n }\n }\n\n function storeInMemory(store, index, data) {\n\n var toStore, toDelete, head;\n if (memory[store] && memoryCount[store] !== undefined && memoryLimit[store]) {\n head = memoryHead[store];\n\n if (memory[store][index]) {\n\n getFromMemory(store, index);\n memory[store][index].data.data = data;\n memory[store][index].data.timeout = Date.now();\n } else {\n\n toStore = {\n data: {\n data: data,\n timeout: Date.now()\n }\n };\n\n if (typeof head == 'undefined') {\n toStore.prev = toStore;\n toStore.next = toStore;\n } else {\n toStore.prev = head.prev;\n toStore.next = head.next;\n head.next.prev = toStore;\n head.next = toStore;\n }\n\n memoryHead[store] = toStore;\n memory[store][index] = toStore;\n memoryCount[store]++;\n }\n\n // Remove oldest one\n if (memoryCount[store] > memoryLimit[store] && head) {\n toDelete = head.next;\n head.next.next.prev = head;\n head.next = head.next.next;\n toDelete.next.next = undefined;\n toDelete.next.prev = undefined;\n memoryCount[store]--;\n }\n\n return data;\n }\n }\n\n function create(store, limitMemory) {\n createStoreMemory(store, limitMemory);\n }\n\n function get(store, index) {\n var result;\n if ((result = getFromMemory(store, index)) != undefined) {\n return result;\n }\n }\n\n function store(store, index, value) {\n storeInMemory(store, index, value);\n return value;\n }\n\n function empty(store) {\n emptyMemory(store);\n }\n\n function exist(store) {\n return memory[store];\n }\n\n exports.default = get;\n});\n\n/***/ }),\n/* 46 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.plugin.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphPlugin);\n global.graphPluginSerielinedifference = mod.exports;\n }\n})(this, function (module, exports, _graphPlugin) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * @class PluginSerieLineDifference\n * @implements Plugin\n */\n class PluginSerieLineDifference extends _graphPlugin2.default {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n return {\n\n positiveStyle: {\n\n fillColor: 'green',\n fillOpacity: 0.2,\n strokeWidth: 0\n },\n\n negativeStyle: {\n fillColor: 'red',\n fillOpacity: 0.2,\n strokeWidth: 0\n },\n\n from: 0,\n to: 0\n };\n }\n\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n this.graph = graph;\n\n this.pathsPositive = [];\n this.pathsNegative = [];\n\n this.positivePolyline = this.graph.newShape('polyline').draw();\n\n this.positivePolyline.setFillColor(this.options.positiveStyle.fillColor).setFillOpacity(this.options.positiveStyle.fillOpacity).setStrokeWidth(this.options.positiveStyle.strokeWidth).applyStyle();\n\n this.negativePolyline = this.graph.newShape('polyline').draw();\n\n this.negativePolyline.setFillColor(this.options.negativeStyle.fillColor).setFillOpacity(this.options.negativeStyle.fillOpacity).setStrokeWidth(this.options.negativeStyle.strokeWidth).applyStyle();\n }\n\n /**\n * Assigns the two series for the shape. Postive values are defined when ```serieTop``` is higher than ```serieBottom```.\n * @param {SerieLine} serieTop - The top serie\n * @param {SerieLine} serieBottom - The bottom serie\n */\n setSeries(serieTop, serieBottom) {\n this.serie1 = serieTop;\n this.serie2 = serieBottom;\n }\n\n /**\n * Assigns the boundaries\n */\n setBoundaries(from, to) {\n this.options.from = from;\n this.options.to = to;\n }\n\n /**\n * @returns the starting value used to draw the zone\n */\n getFrom() {\n return this.options.from;\n }\n\n /**\n * @returns the ending value used to draw the zone\n */\n getTo() {\n return this.options.to;\n }\n\n /**\n * Calculates and draws the zone series\n * @returns {Plugin} The current plugin instance\n */\n draw() {\n\n var self = this;\n var s1 = this.serie1.searchClosestValue(this.getFrom());\n var i1, j1, i2, j2, y, y2, crossing;\n\n var top = [];\n var bottom = [];\n\n var bottomBroken;\n\n if (!s1) {\n i1 = 0;\n j1 = 0;\n } else {\n\n i1 = s1.dataIndex;\n j1 = s1.xAfterIndex * 2;\n }\n\n y = this.interpolate(this.serie1, this.getFrom());\n top.push(this.getFrom()); // x\n top.push(y); // y\n\n y = this.interpolate(this.serie2, this.getFrom());\n bottom.push(this.getFrom()); // x\n bottom.push(y); // y\n\n var s2;\n\n var order;\n\n function nextSet() {\n\n if (order === true) {\n self.pathsPositive.push([top, bottom]);\n } else if (order === false) {\n self.pathsNegative.push([top, bottom]);\n }\n\n top = [];\n bottom = [];\n order = undefined;\n }\n var ended;\n for (; i1 < this.serie1.data.length; i1++) {\n\n for (; j1 < this.serie1.data[i1].length; j1 += 2) {\n\n if (this.serie1.data[i1][j1] > this.getTo()) {\n // FINISHED !\n\n y = this.interpolate(this.serie1, this.getTo());\n y2 = this.interpolate(this.serie2, this.getTo());\n\n crossing = this.computeCrossing(top[top.length - 2], top[top.length - 1], this.getTo(), y, bottom[bottom.length - 2], bottom[bottom.length - 1], this.getTo(), y2);\n\n if (crossing) {\n\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n nextSet();\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n\n order = this.serie1.data[i1][j1 + 1] > this.serie2.data[i2][j2 + 1];\n }\n\n top.push(this.getTo()); // x\n top.push(y); // y\n\n bottom.push(this.getTo()); // x\n bottom.push(y2); // y\n\n ended = true;\n break;\n }\n\n if (!s2) {\n s2 = this.serie2.searchClosestValue(this.serie1.data[i1][j1]); // Finds the first point\n\n if (s2) {\n i2 = s2.dataIndex;\n j2 = s2.xBeforeIndex * 2;\n\n // TODO: Add here first points\n\n y = this.interpolate(this.serie2, this.serie1.data[i1][j1]);\n\n top.push(this.serie1.data[i1][j1]); // x\n top.push(this.serie1.data[i1][j1 + 1]); // y\n\n bottom.push(this.serie1.data[i1][j1]); // x\n bottom.push(y); // y\n\n order = this.serie1.data[i1][j1 + 1] > y;\n } else {\n continue;\n }\n }\n\n bottomBroken = false;\n\n crossing = this.computeCrossing(top[top.length - 2], top[top.length - 1], this.serie1.data[i1][j1], this.serie1.data[i1][j1 + 1], bottom[bottom.length - 2], bottom[bottom.length - 1], this.serie2.data[i2][j2], this.serie2.data[i2][j2 + 1]);\n\n if (crossing) {\n\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n nextSet();\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n\n order = this.serie1.data[i1][j1 + 1] > this.serie2.data[i2][j2 + 1];\n }\n\n while (this.serie2.data[i2][j2] < this.serie1.data[i1][j1]) {\n\n bottom.push(this.serie2.data[i2][j2]);\n bottom.push(this.serie2.data[i2][j2 + 1]);\n\n j2 += 2;\n if (j2 == this.serie2.data[i2].length) {\n bottomBroken = this.serie2.data[i2][j2 - 2];\n i2++;\n j2 = 0;\n break;\n }\n\n crossing = this.computeCrossing(top[top.length - 2], top[top.length - 1], this.serie1.data[i1][j1], this.serie1.data[i1][j1 + 1], bottom[bottom.length - 2], bottom[bottom.length - 1], this.serie2.data[i2][j2], this.serie2.data[i2][j2 + 1]);\n\n if (crossing) {\n\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n nextSet();\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n\n order = this.serie1.data[i1][j1 + 1] > this.serie2.data[i2][j2 + 1];\n }\n }\n\n if (bottomBroken === false) {\n top.push(this.serie1.data[i1][j1]);\n top.push(this.serie1.data[i1][j1 + 1]);\n } else {\n\n top.push(bottomBroken);\n top.push(this.interpolate(this.serie1, bottomBroken));\n\n s2 = false;\n j1 -= 2;\n nextSet();\n }\n }\n\n if (ended) {\n nextSet();\n break;\n }\n // End of X\n\n y = this.interpolate(this.serie2, top[top.length - 2]);\n if (y) {\n bottom.push(top[top.length - 2]);\n bottom.push(y);\n }\n\n nextSet();\n\n j1 = 0;\n s2 = false;\n }\n\n var d = this.pathsPositive.reduce(makePaths, '');\n this.positivePolyline.setPointsPx(d).redraw();\n\n var d = this.pathsNegative.reduce(makePaths, '');\n this.negativePolyline.setPointsPx(d).redraw();\n\n //pathsBottom.map( function( map ) { makePaths( map, self.options.negativeStyle ); } );\n\n function makePaths(d, path) {\n\n for (var i = 0; i < path[0].length; i += 2) {\n if (i == 0) {\n d += 'M ';\n }\n d += ' ' + Math.round(self.serie1.getXAxis().getPx(path[0][i])) + ', ' + Math.round(self.serie1.getYAxis().getPx(path[0][i + 1]));\n if (i < path[0].length - 2) {\n d += ' L ';\n }\n }\n\n for (var i = path[1].length - 2; i >= 0; i -= 2) {\n d += ' L ' + Math.round(self.serie2.getXAxis().getPx(path[1][i])) + ', ' + Math.round(self.serie2.getYAxis().getPx(path[1][i + 1]));\n if (i == 0) {\n d += ' z ';\n }\n }\n return d;\n }\n }\n\n /**\n * Finds the interpolated y value at point ```valX``` of the serie ```serie```\n * @returns {(Number|Boolean)} The interpolated y value is possible, ```false``` otherwise\n * @param {Serie} serie - The serie for which the y value should be computed\n * @param {Number} valX - The x value\n */\n interpolate(serie, valX) {\n\n var value = serie.searchClosestValue(valX);\n\n if (!value) {\n return false;\n }\n\n if (value.xMax == undefined) {\n return value.yMin;\n }\n\n if (value.xMin == undefined) {\n return value.yMax;\n }\n\n var ratio = (valX - value.xMin) / (value.xMax - value.xMin);\n return (1 - ratio) * value.yMin + ratio * value.yMax;\n }\n\n /**\n * Finds the crossing point between two vector and returns it, or ```false``` if it is not within the x boundaries\n * @returns {(Object|Boolean)} An object containing the crossing point in the following format: ```{ x: xCrossing, y: yCrossing }``` or ```false``` if no crossing point can be found\n * @param {Number} x11 - First x point of the first vector\n * @param {Number} y11 - First y point of the first vector\n * @param {Number} x12 - Second x point of the first vector\n * @param {Number} y12 - Second y point of the first vector\n * @param {Number} x21 - First x point of the second vector\n * @param {Number} y21 - First y point of the second vector\n * @param {Number} y22 - Second x point of the second vector\n * @param {Number} y22 - Second y point of the second vector\n */\n computeCrossing(x11, y11, x12, y12, x21, y21, x22, y22) {\n var a1 = (y12 - y11) / (x12 - x11);\n var a2 = (y22 - y21) / (x22 - x21);\n\n var b1 = y12 - a1 * x12;\n var b2 = y22 - a2 * x22;\n\n if (x11 == x12 || x21 == x22) {\n\n return false;\n }\n\n if (a1 == a2) {\n return {\n x: x11,\n y1: y11,\n y2: y11\n };\n }\n\n var x = (b1 - b2) / (a2 - a1);\n\n if (x > x12 || x < x11 || x < x21 || x > x22) {\n return false;\n }\n\n return {\n x: x,\n y: a1 * x + b1\n };\n }\n\n /**\n * @returns The positive polyline\n */\n getPositivePolyline() {\n return this.positivePolyline;\n }\n\n /**\n * @returns The negative polyline\n */\n getNegativePolyline() {\n return this.negativePolyline;\n }\n\n }\n\n exports.default = PluginSerieLineDifference;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 47 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(3), __webpack_require__(11), __webpack_require__(14), __webpack_require__(0), __webpack_require__(5), __webpack_require__(16), __webpack_require__(2), __webpack_require__(9)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.core.js'), require('../graph.axis.x.js'), require('../graph.axis.y.js'), require('../graph.util.js'), require('../series/graph.serie.line.js'), require('../series/graph.serie.scatter.js'), require('./graph.plugin.js'), require('../graph.axis.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphCore, global.graphAxisX, global.graphAxisY, global.graphUtil, global.graphSerieLine, global.graphSerieScatter, global.graphPlugin, global.graphAxis);\n global.graphPluginAxissplitting = mod.exports;\n }\n})(this, function (module, exports, _graphCore, _graphAxisX, _graphAxisY, _graphUtil, _graphSerieLine, _graphSerieScatter, _graphPlugin, _graphAxis) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphCore2 = _interopRequireDefault(_graphCore);\n\n var _graphAxisX2 = _interopRequireDefault(_graphAxisX);\n\n var _graphAxisY2 = _interopRequireDefault(_graphAxisY);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphSerieLine2 = _interopRequireDefault(_graphSerieLine);\n\n var _graphSerieScatter2 = _interopRequireDefault(_graphSerieScatter);\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n var _graphAxis2 = _interopRequireDefault(_graphAxis);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n class SerieLineExtended extends _graphSerieLine2.default {\n\n constructor() {\n super(...arguments);\n this.subSeries = [];\n }\n\n setData() {\n super.setData(...arguments);\n this.subSeries.map(sub => {\n sub.data = this.data;\n });\n return this;\n }\n\n draw() {\n this.eraseMarkers();\n return this;\n }\n\n getSymbolForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getSymbolForLegend();\n }\n\n getMarkerForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getMarkerForLegend();\n }\n }\n\n class SerieScatterExtended extends _graphSerieScatter2.default {\n\n constructor() {\n super(...arguments);\n this.subSeries = [];\n }\n\n setData() {\n super.setData(...arguments);\n this.subSeries.map(sub => {\n sub.data = this.data;\n });\n return this;\n }\n\n draw() {\n return this;\n }\n\n getSymbolForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getSymbolForLegend();\n }\n\n getMarkerForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getMarkerForLegend();\n }\n }\n\n var excludingMethods = ['constructor', 'init', 'draw', 'setLineColor', 'setLineWidth', 'setLineStyle', 'getLineColor', 'getLineWidth', 'getLineStyle', 'setMarkers', 'showMarkers', 'hideMarkers', 'getMarkerDom', 'getMarkerDomIndependant', 'getMarkerPath', 'eraseMarkers', '_recalculateMarkerPoints'];\n var addMethods = [];\n\n Object.getOwnPropertyNames(_graphSerieLine2.default.prototype).concat(addMethods).map(function (i) {\n\n if (excludingMethods.indexOf(i) > -1) {\n return;\n }\n\n SerieLineExtended.prototype[i] = function (j) {\n\n return function () {\n\n var args = arguments;\n this.subSeries.map(subSerie => {\n subSerie[j](...args);\n });\n };\n }(i);\n });\n\n /**\n * Axis splitting plugin\n * @augments Plugin\n */\n class PluginAxisSplitting extends _graphPlugin2.default {\n\n constructor(options) {\n super(...arguments);\n this.series = new Map();\n }\n\n static defaults() {\n\n return {\n axes: {\n margins: {\n high: 5,\n low: 5\n }\n }\n };\n }\n\n init(graph) {\n this.graph = graph;\n }\n\n /**\n * Creates a new bottom split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newXAxis(options) {\n return this.newBottomAxis(options);\n }\n\n /**\n * Creates a new left split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newYAxis(options) {\n return this.newLeftAxis(options);\n }\n\n /**\n * Creates a new top split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newTopAxis(options) {\n options = this.getOptions(options);\n return new SplitXAxis(this.graph, 'top', options);\n }\n\n /**\n * Creates a new bottom split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newBottomAxis(options) {\n options = this.getOptions(options);\n return new SplitXAxis(this.graph, 'bottom', options);\n }\n\n /**\n * Creates a new left split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newLeftAxis(options) {\n options = this.getOptions(options);\n return new SplitYAxis(this.graph, 'left', options);\n }\n\n /**\n * Creates a new right split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newRightAxis(options) {\n options = this.getOptions(options);\n return new SplitYAxis(this.graph, 'right', options);\n }\n\n getOptions(options) {\n var defaults = {\n marginMin: this.options.axes.margins.low,\n marginMax: this.options.axes.margins.high\n };\n return util.extend(true, defaults, options);\n }\n\n preDraw() {\n\n var xAxis, yAxis;\n\n // for ( let { serie } of this.series.values() ) {\n this.series.forEach(({\n serie\n }) => {\n\n xAxis = serie.getXAxis();\n yAxis = serie.getYAxis();\n\n let splits = 1;\n\n if (xAxis.splitNumber) {\n splits *= xAxis.splitNumber;\n }\n\n if (yAxis.splitNumber) {\n splits *= yAxis.splitNumber;\n }\n\n while (serie.subSeries.length < splits) {\n\n const name = serie.getName() + '_' + serie.subSeries.length;\n\n const s = this.graph.newSerie(name, {}, serie.getType() || _graphCore2.default.SERIE_LINE);\n\n s.excludedFromLegend = true;\n s.styles = serie.styles;\n s.data = serie.data; // Copy data\n\n if (serie.getType() == _graphCore2.default.SERIE_LINE) {\n s.markerPoints = serie.markerPoints;\n s.markerFamilies = serie.markerFamilies;\n }\n\n serie.subSeries.push(s);\n }\n\n while (serie.subSeries.length > splits) {\n\n let subserie = this.graph.getSerie(serie.getName() + '_' + (serie.subSeries.length - 1));\n\n if (subserie && subserie.kill) {\n subserie.kill();\n }\n serie.subSeries.pop();\n }\n\n if (!serie.getXAxis().splitNumber && serie.getXAxis().splitAxis) {\n serie.getXAxis().splitAxis();\n }\n\n if (!serie.getYAxis().splitNumber && serie.getYAxis().splitAxis) {\n serie.getYAxis().splitAxis();\n }\n\n // Re-assign axes to the sub series\n serie.subSeries.map((sserie, index) => {\n\n var xSubAxis, ySubAxis;\n\n //sserie.groupMarkers = firstSubSerie.groupMarkers;\n\n if (serie.getXAxis().getSubAxis) {\n let subAxisIndex = index % (xAxis.splitNumber || 1);\n xSubAxis = serie.getXAxis().getSubAxis(subAxisIndex);\n } else {\n xSubAxis = serie.getXAxis();\n }\n\n sserie.setXAxis(xSubAxis);\n\n if (serie.getYAxis().getSubAxis) {\n\n let subAxisIndex = Math.floor(index / (xAxis.splitNumber || 1));\n ySubAxis = serie.getYAxis().getSubAxis(subAxisIndex);\n } else {\n ySubAxis = serie.getYAxis();\n }\n\n sserie.setYAxis(ySubAxis);\n\n sserie.draw(true);\n });\n //}\n });\n }\n\n /**\n * Creates a new serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @param {String} type - The type of the serie\n * @return {Serie} The created serie\n */\n newSerie(name, options = {}, type) {\n\n switch (type) {\n\n case 'line':\n return this.newLineSerie(name, options);\n break;\n\n case 'scatter':\n return this.newScatterSerie(name, options);\n break;\n }\n\n throw 'Cannot create a split serie of type ' + type;\n }\n\n /**\n * Creates a new line serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @return {Serie} The created serie\n */\n newLineSerie(name, options) {\n var serieObj = {\n type: 'lineSerie',\n serie: new SerieLineExtended(name, options, 'line')\n };\n this.series.set(name, serieObj);\n serieObj.serie.init(this.graph, name, options);\n this.graph.series.push(serieObj.serie);\n return serieObj.serie;\n }\n\n /**\n * Creates a new scatter serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @return {Serie} The created serie\n */\n newScatterSerie(name, options) {\n var serieObj = {\n type: 'scatterSerie',\n serie: new SerieScatterExtended(name, options, 'scatter')\n };\n this.series.set(name, serieObj);\n serieObj.serie.init(this.graph, options);\n this.graph.series.push(serieObj.serie);\n return serieObj.serie;\n }\n\n }\n\n var defaultAxisConstructorOptions = {\n splitMarks: true\n };\n\n var SplitAxis = function (mixin) {\n\n var delegateMethods = ['turnGridsOff', 'turnGridsOn', 'gridsOff', 'gridsOn', 'setEngineering', 'setScientificScaleExponent', 'setScientific', 'setLabelColor', 'setSecondaryGridDasharray', 'setPrimaryGridDasharray', 'setSecondaryGridsOpacity', 'setPrimaryGridOpacity', 'setSecondaryGridWidth', 'setPrimaryGridWidth', 'setSecondaryGridColor', 'setPrimaryGridColor', 'setTicksLabelColor', 'setSecondaryTicksColor', 'setPrimaryTicksColor', 'setAxisColor', 'secondaryGridOn', 'secondaryGridOff', 'primaryGridOff', 'primaryGridOn', 'setSecondaryGrid', 'setPrimaryGrid', 'setGrids', 'setTickPosition', 'setExponentialFactor', 'setExponentialLabelFactor', 'setGridLinesStyle', 'forcePrimaryTickUnitMin', 'forcePrimaryTickUnitMax', 'forcePrimaryTickUnit', 'flip', 'show', 'hide', 'setDisplay'];\n\n /**\n * Split axis\n * @mixes AxisX\n * @mixes AxisY\n * @name SplitAxis\n * @static\n */\n var cl = class SplitAxis extends mixin {\n\n constructor(graph, position, options = {}) {\n\n super(graph, position, options);\n this.axes = [];\n this.position = position;\n this.constructorOptions = util.extend(true, {}, defaultAxisConstructorOptions, options);\n\n this._splitVal = [];\n }\n\n /**\n * Calls a callback onto each chunk axes. The callback receives two parameters: 1) the ```axis``` itself and 2) the ```index``` of the axis in the stack\n * @param {Function} callback - The callback to be applied to each axes\n * @return {SplitAxis} The current axis instance\n */\n all(callback) {\n\n if (!(typeof callback == 'function')) {\n return;\n }\n\n this.axes.map(callback);\n return this;\n }\n\n /**\n * Splits the axis into chunks at the positions defined as a list of parameters.\n * @param {Function} ...splits - The positions of axis splitting\n * @return {SplitAxis} The current axis instance\n * @example axis.splitAxis( 0.2, 0.5, 0.8 ); // Creates 4 chunks (0-20%, 20%-50%, 50%-80%, 80%-100%)\n */\n splitAxis(...splits) {\n\n splits.push(1);\n let splitNumber = splits.length;\n\n while (this.axes.length > splitNumber) {\n this.axes.pop().kill(true, true);\n }\n\n while (this.axes.length < splitNumber) {\n let axis = new (this.getConstructor())(this.graph, this.position, this.constructorOptions);\n this.axes.push(axis);\n axis.zoomLock = true;\n axis.init(this.graph, this.constructorOptions);\n }\n\n let from = 0;\n let i = 0;\n for (let axis of this.axes) {\n\n axis.options.marginMin = 10;\n axis.options.marginMax = 10;\n\n if (i == 0) {\n axis.options.marginMin = 0;\n }\n\n if (i == this.axes.length - 1) {\n axis.options.marginMax = 0;\n }\n\n axis.setSpan(from, from = splits[i]);\n axis.setMinMaxFlipped();\n i++;\n }\n\n this._splits = splits;\n return this;\n }\n\n /**\n * Fixes the major tick interval of all axes based on the one provided as a parameter\n * @param {Number} axisIndex - The index of the reference axis (starting at 0)\n * @return {SplitAxis} The current axis instance\n */\n fixGridIntervalBasedOnAxis(axisIndex) {\n\n this.fixGridFor = axisIndex;\n this.graph._axisHasChanged();\n return this;\n }\n\n /**\n * Spreads the chunks of the axis based on the relative interval of each one of them, so that the unit / px is constant for each chunk\n * @param {Boolean} bln - ```true``` to enable the spread, ```false``` otherwise\n * @return {SplitAxis} The current axis instance\n */\n splitSpread(bln) {\n this.autoSpread = !!bln;\n return this;\n }\n\n hasAxis(axis) {\n return this.axes.indexOf(axis) > -1;\n }\n\n _splitSpread() {\n\n let splits = [],\n total = 0,\n currentSplit = 0;\n //console.log( this._splitVal );\n for (let split of this._splitVal) {\n total += split[1] - split[0];\n }\n\n for (let split of this._splitVal) {\n\n splits.push(currentSplit += (split[1] - split[0]) / total);\n }\n\n splits.pop();\n this.splitAxis(...splits);\n }\n\n /**\n * Defines the boundaries of each chunk in axis unit.\n * @param {Array<(Array|Number)>} values - An array of either 2-component arrays (from-to) or number (mean)\n * @example axis.setChunkBoundaries( [ [ 12, 20 ], [ 100, 200 ] ] ); // First chunk from 12 to 20, second one from 100 to 200\n * @example axis.setChunkBoundaries( [ 12, [ 100, 200 ] ] ); // Second chunk from 100 to 200, first chunk with a mean at 12 and min / max determined by the relative widths of the chunks\n * @return {SplitAxis} The current axis instance\n */\n setChunkBoundaries(values) {\n\n let index = 0,\n baseWidth,\n baseWidthIndex;\n\n for (let axis of this.axes) {\n // List all axes\n\n // Two elements in the array => becomes the new reference\n if (Array.isArray(values[index]) && values[index].length > 1 && !baseWidth) {\n baseWidth = values[index][1] - values[index][0];\n baseWidthIndex = index;\n }\n\n if (values[index].length == 1 || !Array.isArray(values[index])) {\n axis._mean = values[index];\n\n if (Array.isArray(axis._mean)) {\n axis._mean = axis._mean[0];\n }\n } else {\n\n axis.forceMin(values[index][0]).forceMax(values[index][1]);\n }\n\n index++;\n }\n\n this._baseWidthVal = baseWidth;\n this._baseWidthIndex = baseWidthIndex;\n\n this._splitVal = values;\n\n this.graph._axisHasChanged();\n\n return this;\n }\n\n setMinMaxToFitSeries() {\n\n if (!this._splitVal || this._splitVal.length < 1) {\n super.setMinMaxToFitSeries(...arguments);\n this._splitVal[0] = this._splitVal[0] || [];\n this._splitVal[this._splitVal.length - 1] = this._splitVal[this._splitVal.length - 1] || [];\n\n this._splitVal[0][0] = this.getCurrentMin();\n this._splitVal[this._splitVal.length - 1][1] = this.getCurrentMax();\n this.setChunkBoundaries(this._splitVal);\n }\n }\n\n draw() {\n\n if (this.autoSpread) {\n this._splitSpread();\n }\n\n let max = 0;\n let unit;\n let subAxis;\n let spanReference;\n\n if (this._baseWidthIndex >= 0 && (subAxis = this.getSubAxis(this._baseWidthIndex))) {\n spanReference = subAxis.getSpan();\n }\n\n subAxis = undefined;\n\n if (this.fixGridFor >= 0 && (subAxis = this.getSubAxis(this.fixGridFor))) {\n\n if (subAxis._mean !== undefined) {\n let width = (subAxis.getSpan()[1] - subAxis.getSpan()[0]) / (spanReference[1] - spanReference[0]) * this._baseWidthVal;\n subAxis.forceMin(subAxis._mean - width / 2);\n subAxis.forceMax(subAxis._mean + width / 2);\n }\n\n max = subAxis.draw();\n unit = subAxis.getPrimaryTickUnit();\n }\n\n this.axes.map(axis => {\n\n if (subAxis === axis) {\n return;\n }\n\n if (axis._mean !== undefined) {\n let width = (axis.getSpan()[1] - axis.getSpan()[0]) / (spanReference[1] - spanReference[0]) * this._baseWidthVal;\n axis.forceMin(axis._mean - width / 2);\n axis.forceMax(axis._mean + width / 2);\n }\n\n if (unit) {\n axis.forcePrimaryTickUnit(unit);\n }\n\n max = Math.max(max, axis.draw());\n });\n\n // this.drawLabel();\n this.writeUnit();\n\n return max;\n }\n\n setMinPx(min) {\n\n super.setMinPx(min);\n for (let axis of this.axes) {\n axis.setMinPx(min);\n }\n }\n\n setMaxPx(max) {\n\n super.setMaxPx(max);\n\n for (let axis of this.axes) {\n axis.setMaxPx(max);\n }\n }\n\n setShift() {\n\n super.setShift(...arguments);\n\n for (let axis of this.axes) {\n axis.setShift(...arguments);\n }\n }\n\n init() {\n super.init(...arguments);\n this.splitAxis();\n }\n\n getAxisPosition() {\n var max = 0;\n\n this.axes.map(axis => {\n max = Math.max(max, axis.getAxisPosition());\n });\n\n return max;\n }\n\n getSubAxis(index) {\n\n if (this.axes.length <= index) {\n throw 'Impossible to reach axis. Index ' + index + ' is out of range';\n }\n\n return this.axes[index];\n }\n\n get splitNumber() {\n return this._splits.length;\n }\n };\n\n delegateMethods.map(methodName => {\n\n cl.prototype[methodName] = function (method) {\n\n return function () {\n //super[ method ]( ...arguments )\n\n this.axes.map(axis => {\n axis[method](...arguments);\n });\n return this;\n };\n }(methodName);\n });\n\n return cl;\n };\n\n class SplitXAxis extends SplitAxis(_graphAxisX2.default) {\n\n constructor(graph, topbottom, options) {\n super(...arguments);\n this.topbottom = topbottom;\n }\n\n getConstructor() {\n return _graphAxisX2.default;\n }\n\n getAxisPosition() {\n var max = super.getAxisPosition(...arguments);\n\n this.labelPosY = max;\n\n if (this.getLabel()) {\n max += this.graph.options.fontSize;\n }\n\n return max;\n }\n\n drawLabel() {\n super.drawLabel();\n this.label.setAttribute('y', (this.top ? -1 : 1) * (this.graph.options.fontSize + this.labelPosY));\n }\n\n draw() {\n var height = super.draw(...arguments);\n this.drawLabel();\n return height;\n }\n\n }\n\n class SplitYAxis extends SplitAxis(_graphAxisY2.default) {\n\n constructor(graph, leftright, options) {\n super(...arguments);\n ///this.leftright = leftright;\n }\n\n getConstructor() {\n return _graphAxisY2.default;\n }\n /*\n draw() {\n if ( this.getLabel() ) {\n this.axes.map( ( axis ) => {\n axis.setAxisPosition( this.graph.options.fontSize );\n } ); // Extra shift allowed for the label\n //this.setShift( this.graph.options.fontSize );\n }\n return super.draw( ...arguments );\n }\n */\n drawLabel() {\n super.drawLabel();\n }\n\n equalizePosition(width) {\n\n var widthAfter = width;\n\n if (this.getLabel()) {\n this.axes.map(axis => {\n widthAfter = Math.max(axis.equalizePosition(width), widthAfter);\n }); // Extra shift allowed for the label\n //this.setShift( this.graph.options.fontSize );\n }\n\n if (this.getLabel()) {\n this.placeLabel(this.left ? -widthAfter : widthAfter);\n return widthAfter + this.graph.options.fontSize;\n }\n }\n\n }\n\n util.mix(SplitXAxis, new _graphAxisX2.default());\n util.mix(SplitYAxis, new _graphAxisY2.default());\n\n exports.default = PluginAxisSplitting;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 48 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'), require('./graph.plugin.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil, global.graphPlugin);\n global.graphPluginMakeTracesDifferent = mod.exports;\n }\n})(this, function (module, exports, _graphUtil, _graphPlugin) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n /**\n * The intent of this plugin is to provide methods for the user to make the traces on the graph automatically different\n * Options to provide colorization, markers and line styles should be provided\n * @extends Plugin\n */\n class PluginMakeTracesDifferent extends _graphPlugin2.default {\n\n constructor() {\n super(...arguments);\n }\n\n init(graph, options) {\n super.init(graph, options);\n }\n // Load this with defaults\n static default() {\n\n return {};\n }\n\n checkHSL(color) {\n\n let result = {},\n hue,\n saturation,\n lightness;\n\n if (hue = color.h || color.hue) {\n\n if (hue < 1) {\n hue = Math.round(hue * 360);\n }\n\n result.hue = hue;\n } else {\n result.h = 0;\n }\n\n if (saturation = color.s || color.saturation) {\n\n if (saturation > 1) {\n saturation /= 100;\n }\n\n result.saturation = saturation;\n } else {\n result.saturation = 0.75;\n }\n\n if (lightness = color.lightness || color.l) {\n\n if (lightness > 1) {\n lightness /= 100;\n }\n\n result.lightness = lightness;\n } else {\n result.lightness = 0.5;\n }\n\n return result;\n }\n\n buildHSLString(hsl) {\n return 'hsl( ' + Math.round(hsl.h) + ', ' + Math.round(hsl.s * 100) + '%, ' + Math.round(hsl.l * 100) + '%)';\n }\n\n colorizeAll(options) {\n\n let series, seriesLength;\n\n if (options.serieTypes) {\n\n if (!Array.isArray(options.serieTypes)) {\n options.serieTypes = [options.serieTypes];\n }\n\n series = this.graph.allSeries(...options.serieTypes);\n } else {\n series = this.graph.getSeries();\n }\n\n seriesLength = series.length;\n\n if (!options.startingColorHSL) {\n\n if (options.colorHSL) {\n options.startingColorHSL = this.checkHSL(options.colorHSL);\n } else {\n throw 'No starting color was provided. There must exist either options.colorHSL or options.startingColorHSL';\n }\n }\n\n if (!options.endingColorHSL) {\n\n if (!options.affect || !['h', 's', 'l', 'hue', 'saturation', 'lightness'].include(options.affect)) {\n options.affect = 'h';\n }\n\n switch (options.affect) {\n\n case 'h':\n case 'hue':\n options.endingColorHSL = {\n h: options.startingColorHSL.h + 300,\n s: options.startingColorHSL.s,\n l: options.startingColorHSL.l\n };\n break;\n\n case 'saturation':\n case 's':\n let endS;\n\n if (options.startingColorHSL.s > 0.5) {\n endS = 0;\n } else {\n endS = 1;\n }\n\n options.endingColorHSL = {\n h: options.startingColorHSL.h,\n s: endS,\n l: options.startingColorHSL.l\n };\n break;\n\n case 'lightness':\n case 'l':\n let endL;\n\n if (options.startingColorHSL.l > 0.5) {\n endL = 0;\n } else {\n endL = 0.75;\n }\n\n options.endingColorHSL = {\n h: options.startingColorHSL.h,\n s: options.startingColorHSL.s,\n l: endL\n };\n break;\n }\n } else {\n options.endingColorHSL = Object.assign({}, options.startingColorHSL, options.endingColorHSL);\n }\n\n return series.map((serie, index) => {\n\n if (!serie.setLineColor) {\n throw 'The serie ' + serie.getName() + ' does not implement the method `startingColor`';\n }\n\n const colorString = this.buildHSLString({\n h: options.startingColorHSL.h + index / (seriesLength - 1) * (options.endingColorHSL.h - options.startingColorHSL.h),\n s: options.startingColorHSL.s + index / (seriesLength - 1) * (options.endingColorHSL.s - options.startingColorHSL.s),\n l: options.startingColorHSL.l + index / (seriesLength - 1) * (options.endingColorHSL.l - options.startingColorHSL.l)\n });\n\n serie.setLineColor(colorString);\n return colorString;\n });\n }\n }\n\n exports.default = PluginMakeTracesDifferent;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 49 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'), require('./graph.plugin.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil, global.graphPlugin);\n global.graphPluginPeakpicking = mod.exports;\n }\n})(this, function (module, exports, _graphUtil, _graphPlugin) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n /*\n What is it ?\n It is a plugin for automatic peak detection on a line serie\n \n How to use ?\n Basic usage:\n \n let graph = new Graph(\"dom\", {\n plugins: {\n 'peakPicking': {}\n }\n }\n );\n \n let wv = Graph.newWaveform();\n wv.setData( [ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 ] );\n let s = graph.newSerie(\"serie\").setWaveform( wv ).autoAxis();\n \n graph.getPlugin('peakPicking').setSerie( s );\n graph.draw();\n */\n\n /**\n * @extends Plugin\n */\n class PluginPeakPicking extends _graphPlugin2.default {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n\n return {\n autoPeakPicking: false,\n autoPeakPickingNb: 4,\n autoPeakPickingMinDistance: 10,\n autoPeakPickingFormat: false,\n autoPeakPickingAllowAllY: false\n };\n }\n\n init(graph, options) {\n\n super.init(graph, options);\n this.picks = [];\n\n for (var n = 0, m = this.options.autoPeakPickingNb; n < m; n++) {\n\n var shape = this.graph.newShape({\n type: 'label',\n label: {\n text: '',\n position: {\n x: 0\n },\n anchor: 'middle'\n\n },\n\n selectable: true,\n\n shapeOptions: {\n minPosY: 15\n }\n\n });\n\n shape.draw();\n\n this.picks.push(shape);\n }\n }\n\n setSerie(serie) {\n this.serie = serie;\n }\n\n serieRemoved(serie) {\n\n if (this.serie == serie) {\n this.picks.map(pick => {\n pick.kill();\n });\n }\n }\n\n preDraw() {\n\n if (!this.serie) {\n return;\n }\n\n this.detectedPeaks = [];\n this.lastYPeakPicking = false;\n }\n\n postDraw() {\n\n if (!this.serie) {\n return;\n }\n let lookForMaxima = true;\n let lookForMinima = false;\n let lastYPeakPicking;\n let peaks = [];\n\n let waveform = this.serie.getWaveform();\n\n if (!waveform) {\n throw 'The serie must have a waveform for the peak picking to work';\n }\n\n let length = waveform.getLength(),\n i = 0,\n y;\n\n for (; i < length; i++) {\n\n y = waveform.getY(i);\n\n if (this.serie.options.lineToZero) {\n peaks.push([waveform.getX(i), y]);\n continue;\n }\n\n if (!lastYPeakPicking) {\n lastYPeakPicking = [waveform.getX(i), y];\n continue;\n }\n\n if (y >= lastYPeakPicking[1] && lookForMaxima || y <= lastYPeakPicking[1] && lookForMinima) {\n\n lastYPeakPicking = [waveform.getX(i), y];\n } else if (y < lastYPeakPicking[1] && lookForMaxima || y > lastYPeakPicking[1] && lookForMinima) {\n\n if (lookForMinima) {\n lookForMinima = false;\n lookForMaxima = true;\n } else {\n\n lookForMinima = true;\n lookForMaxima = false;\n\n peaks.push(lastYPeakPicking);\n lastYPeakPicking = false;\n }\n\n lastYPeakPicking = [waveform.getX(i), y];\n }\n }\n\n var ys = peaks;\n var x,\n px,\n passed = [],\n px,\n l = ys.length,\n k,\n m,\n index;\n\n i = 0;\n\n var selected = this.graph.selectedShapes.map(function (shape) {\n return shape.getProp('xval');\n });\n\n ys.sort(function (a, b) {\n return b[1] - a[1];\n });\n\n m = 0;\n\n for (; i < l; i++) {\n\n x = ys[i][0];\n px = this.serie.getX(x);\n k = 0;\n y = this.serie.getY(ys[i][1]);\n\n if (px < this.serie.getXAxis().getMinPx() || px > this.serie.getXAxis().getMaxPx()) {\n continue;\n }\n\n if (!this.options.autoPeakPickingAllowAllY && (y > this.serie.getYAxis().getMinPx() || y < this.serie.getYAxis().getMaxPx())) {\n\n continue;\n }\n\n // Distance check\n for (; k < passed.length; k++) {\n if (Math.abs(passed[k] - px) < this.options.autoPeakPickingMinDistance) {\n break;\n }\n }\n if (k < passed.length) {\n continue;\n }\n\n // Distance check end\n\n // If the retained one has already been selected somewhere, continue;\n if ((index = selected.indexOf(x)) > -1) {\n passed.push(px);\n continue;\n }\n\n if (!this.picks[m]) {\n return;\n }\n\n //console.log( this.getYAxis().getDataMax(), this.getYAxis().getCurrentMin(), y );\n // this.picks[ m ].show();\n\n if (this.serie.getYAxis().getPx(ys[i][1]) - 20 < 0) {\n\n this.picks[m].setLabelPosition({\n x: x,\n y: '5px'\n });\n\n this.picks[m].setLabelBaseline('hanging');\n } else {\n\n this.picks[m].setLabelBaseline('no-change');\n\n this.picks[m].setLabelPosition({\n x: x,\n y: ys[i][1],\n dy: '-15px'\n });\n }\n\n this.picks[m].setProp('xval', x);\n\n if (this.options.autoPeakPickingFormat) {\n\n this.picks[m].setLabelText(this.options.autoPeakPickingFormat.call(this.picks[m], x, m));\n } else {\n this.picks[m].setLabelText(String(Math.round(x * 1000) / 1000));\n }\n\n this.picks[m].makeLabels();\n\n m++;\n while (this.picks[m] && this.picks[m].isSelected()) {\n m++;\n }\n\n if (passed.length == this.options.autoPeakPickingNb) {\n break;\n }\n }\n }\n\n /**\n * Hides the automatic peak picking (see the autoPeakPicking option)\n * @memberof SerieLine\n */\n hidePeakPicking(lock) {\n\n if (!this._hidePeakPickingLocked) {\n this._hidePeakPickingLocked = lock;\n }\n\n if (!this.graph.picks) {\n return;\n }\n for (var i = 0; i < this.graph.picks.length; i++) {\n this.graph.picks[i].hide();\n }\n }\n\n /**\n * Shows the automatic peak picking (see the autoPeakPicking option)\n * @memberof SerieLine\n */\n showPeakPicking(unlock) {\n\n if (this._hidePeakPickingLocked && !unlock) {\n return;\n }\n\n if (!this.graph.picks) {\n return;\n }\n\n for (var i = 0; i < this.graph.picks.length; i++) {\n this.graph.picks[i].show();\n }\n }\n\n killPeakPicking() {\n\n if (this.picks) {\n for (var i = 0, l = this.picks.length; i < l; i++) {\n this.picks[i].kill();\n }\n }\n }\n }\n\n exports.default = PluginPeakPicking;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 50 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0), __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'), require('./graph.shape.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil, global.graphShape);\n global.graphShapeEllipse = mod.exports;\n }\n})(this, function (module, exports, _graphUtil, _graphShape) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n /**\n * Displays an ellipse\n * @extends Shape\n */\n class ShapeEllipse extends _graphShape2.default {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'ellipse');\n }\n\n applyPosition() {\n\n var pos = this.computePosition(0);\n\n this.setDom('cx', pos.x || 0);\n this.setDom('cy', pos.y || 0);\n\n let posR = this.graph.newPosition({\n\n dx: this.getProp('rx'),\n dy: this.getProp('ry') || this.getProp('rx')\n\n });\n\n let posComputed = this.calculatePosition(posR);\n\n this.setDom('rx', Math.abs(posComputed.x) || 0);\n this.setDom('ry', Math.abs(posComputed.y) || 0);\n return true;\n }\n\n setR(rx, ry) {\n this.setProp('rx', rx);\n this.setProp('ry', ry);\n return this;\n }\n\n handleMouseUpImpl() {\n this.triggerChange();\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {}\n }\n\n exports.default = ShapeEllipse;\n module.exports = exports['default'];\n});\n\n/***/ })\n/******/ ]);\n});"]} \ No newline at end of file +{"version":3,"sources":["jsgraph-es6.js"],"names":["exports","module","define","amd","self","Number","MAX_VALUE","Math","exp","pow","ceil","POSITIVE_INFINITY","NEGATIVE_INFINITY","log","floor","max","abs","min","round","i","l","call","m","c","d","o","Object","defineProperty","configurable","enumerable","get","n","__esModule","prototype","hasOwnProperty","p","s","apply","_savedAttributes","_savedAttributesIds","splice","indexOf","_attributes","length","setAttribute","arguments","value","setAttributeTo","setAttributeNS","mapEventEmission","substring","toLowerCase","on","guid","replace","random","toString","throwError","console","error","warn","isNumeric","Array","isArray","parseFloat","hue2rgb","hslToRgb","saveDomAttributes","push","getAttribute","hasSavedAttribute","overwriteDomAttribute","restoreDomAttributes","debounce","clearTimeout","setTimeout","SVGParser","DOMParser","parseFromString","reverseArray","getOffset","getBoundingClientRect","top","left","setCSS","style","ajaxGet","Promise","XMLHttpRequest","open","type","url","json","setRequestHeader","onload","status","responseText","JSON","parse","Error","onerror","send","extend","mix","emptyDom","firstChild","removeChild","constructor","default","isPlainObject","init","graph","properties","handles","options","group","document","createElementNS","ns","_creation","_selected","createDom","_dom","jsGraphIsShape","classes","transforms","_data","masker","maskingId","maskDomWrapper","appendChild","cloneNode","maskDom","defs","isHTML","addEventListener","handleMouseOver","handleMouseOut","focus","handleMouseDown","handleClick","bind","handleDblClick","initImpl","emit","getData","getType","kill","_inDom","removeShapeFromDom","_removeShape","stopElementMoving","hide","hidden","display","isHidden","isVisible","show","redraw","addClass","makeClasses","removeClass","join","changed","setEventReceptacle","rectEvent","getBBox","x","y","width","height","setSerie","serie","getXAxis","getYAxis","xAxis","yAxis","getSerie","autoAxes","setXAxis","setYAxis","setLayer","setProp","getLayer","getProp","draw","appendToDom","makeLabels","applyStyle","position","applyPosition","redrawImpl","updateLabels","_applyTransforms","setProperties","check","getRelativePosition","exec","getPosition","getLabelPosition","getProperties","getProps","addProp","resetProp","setDom","setDomGroup","setStrokeColor","overwriteSavedProp","applySelectedStyle","getStrokeColor","setFillColor","getFillColor","setFillOpacity","setStrokeWidth","getStrokeWidth","setStrokeDasharray","setAttributes","addAttribute","addTransform","resetTransforms","setLabelText","setLabelData","getLabelText","displayLabel","hideLabel","setLabelColor","setLabelFontSize","setLabelPosition","setLabelAngle","setLabelBaseline","setLabelAnchor","setLabelSize","setLabelStrokeColor","setLabelStrokeWidth","setLabelBackgroundColor","setLabelBackgroundOpacity","applyGenericStyle","calculatePosition","compute","throw","setPosition","sortPositions","sort","computePosition","getDeltaPx","_labels","_labelsBackground","map","stopPropagation","labelDblClickListener","isLabelEditable","_applyLabelData","isNaN","textContent","_getLabelAnchor","emptyLabels","isSelected","_selectStatus","hasHandles","addHandles","isLocked","handlesInDom","removeHandles","hideHandles","areHandlesInDom","_select","isSelectable","hasStaticHandles","setHandles","getSelectStyle","_unselect","selectStyle","setSelectStyle","setStaticHandles","_createHandles","isResizable","preventDefault","prevent","resizing","handleSelected","createHandles","handleMouseDownImpl","handleMouseMoveImpl","handleMouseUpImpl","handleCreateImpl","isMovable","elementMoving","selectShape","moving","moved","_mouseCoords","_getXY","shiftKey","unselectShapes","handleMouseMove","getRelVal","preventUnselect","handleMouseUp","resize","highlight","unHighlight","lock","unlock","shapesLocked","movable","unmovable","resizable","unresizable","selectable","unselectable","unselectShape","getHighlightAttributes","highlightImpl","unHighlightImpl","_highlightAttributes","setHighlightAttributes","getMaskingID","maskWith","removeAttribute","updateMask","parseInt","target","createElement","wrapper","prepend","select","marginTop","getPaddingTop","marginLeft","getPaddingLeft","textAlign","remove","removeEventListener","previousValue","nextValue","keyCode","_forcedParentDom","appendShapeToDom","forceParentDom","showLabel","assign","onMouseDown","onMouseUp","onMouseMove","getConstructor","appendSerieToDom","bottom","right","_painted","_applyToAxes","isShown","hideGroup","showGroup","floating","getSpan","setLevel","getAxisPosition","reduce","drawingSpaceHeight","getDrawingHeight","setShift","getLevel","setMinPx","setMaxPx","linkedToAxis","equalizePosition","drawingSpaceWidth","getDrawingWidth","getFloatingAxis","getFloatingValue","getPx","clipRect","drawingSpaceMinX","drawingSpaceMinY","drawingSpaceMaxX","drawingSpaceMaxY","drawLines","shift","redrawShapes","forcedPlugin","activePlugin","_pluginExecute","keyActions","plugin","isActionAllowed","callback","removeSelectedShape","selectedShapes","keepInDom","dom","fontFamily","fontSize","groupEvent","domTitle","setTitle","title","graphingZone","updateGraphingZone","axisGroup","groupGrids","groupPrimaryGrids","groupSecondaryGrids","plotGroup","layers","_makeClosingLines","clip","markerArrow","markerHorizontalSplit","getId","markerVerticalSplit","vertLineArrow","bypassHandleMouse","which","ctrlKey","wheelDeltaY","wheelDelta","deltaY","paddingLeft","paddingTop","trackingLine","enable","snapToSerie","mode","trackingObject","xClosest","series","getSeries","withinPx","withinVal","_trackingLegend","textMethod","onMouseMoveData","getName","mouseActions","_serieExecute","borderRadius","boxShadow","border","backgroundColor","pointerEvents","paddingBottom","paddingRight","getWrapper","insertBefore","getDom","dblclick","shapesUnselectOnClick","def","time","bar","broken","axis","close","isDisplayed","closingLines","handleMouseLeave","_axesHaveChanged","_sizeChanged","closeColor","plugins","pluginAction","wheel","shapesUniqueSelection","shape","r","Map","_drawn","HTMLElement","getElementById","setWrapper","prevented","shapes","padding","currentAction","nsxlink","getTopAxis","getLeftAxis","getRightAxis","getBottomAxis","_pluginsInit","outline","getComputedStyle","setSize","_resize","setOption","displayTitle","hideTitle","sizeSet","executeRedrawSlaves","_pluginsExecute","drawn","updateLegend","drawSeries","delayUpdate","_lockUpdate","doUpdate","legend","update","resumeUpdate","isDelayedUpdate","setWidth","setHeight","getWidth","getHeight","getPaddingBottom","getPaddingRight","innerHeight","innerWidth","cacheOffset","offsetCached","uncacheOffset","setBottomAxis","setLeftAxis","setRightAxis","setTopAxis","killAxis","isX","forEach","isY","gridPrimary","gridSecondary","hasXAxis","hasTopAxis","hasBottomAxis","hasYAxis","hasLeftAxis","hasRightAxis","hasAxis","autoscaleAxes","autoscale","autoScale","autoScaleAxes","autoScaleAxis","setMinMaxToFitSeries","setBackgroundColor","getAxisState","getCurrentMin","getCurrentMax","setAxisState","setCurrentMin","setCurrentMax","saveAxisState","savedAxisState","recallAxisState","_applyToAxis","getBoundaryAxis","getBoundaryAxisFromSeries","Infinity","getSeriesFromAxis","updateDataMinMaxAxes","isFinite","setMaxValueData","setMinValueData","findAxesLinkedTo","_axisHasChanged","newSerie","SERIE_LINE","allSeries","filter","include","drawSerie","resetSeries","removeSeries","killSeries","selectSerie","selectedSerie","selectionType","unselectSerie","triggerEvent","getSelectedSerie","unselect","getShapesOfSerie","makeToolbar","toolbar","getShapes","newShape","_id","props","fillColor","fillOpacity","strokeColor","strokeWidth","layer","locked","attributes","selectOnMouseDown","selectOnClick","highlightOnMouseOver","labelEditable","labels","label","text","color","size","angle","baseline","anchor","backgroundOpacity","newPosition","removeShapes","getSelectedShapes","cancelUnselectShape","groupMain","removeSerieFromDom","nextSibling","enabled","key","ctrl","meta","alt","metaKey","altKey","forcePlugin","unforcePlugin","pluginYieldActiveState","getPlugin","makeLegend","getLegend","requireLegendUpdate","requireDelayedUpdate","orthogonalProjectionSetup","zAxis","maxZ","minZ","shiftX","shiftY","orthogonalProjectionUpdate","g","getMinPx","getZProj","getZPos","_removeSerie","contextListen","onContextMenuListen","lockShapes","unlockShapes","clientX","clientY","getDrawingSpaceWidth","getDrawingSpaceHeight","getDrawingSpaceMinX","getDrawingSpaceMinY","getDrawingSpaceMaxX","getDrawingSpaceMaxY","addSerieToTrackingLine","disableTracking","noLine","stroke","trackingLineShapeOptions","enableTracking","trueX","valueToHtml","yValue","trackingShape","setKatexRenderer","_katexRenderer","hasKatexRenderer","renderWithKatex","fromJSON","labelValue","unit","unitWrapperAfter","unitWrapperBefore","forcedMin","forcedMax","flip","flipped","_jsGraphIndex","data","SERIE_LINE_COLORED","SERIE_SCATTER","SERIE_BOX","orientation","newWaveform","id","lineStyle","unselected","entries","lineWidth","lineColor","setStyle","defaultStyle","defaultStyles","styles","Set","keys","concat","zoom","points","setMarkers","setColors","setData","errorX","errorBarX","errorBoxX","errorY","errorBarY","errorBoxY","setErrorBarXAbove","setErrorBarStyle","setErrorBoxXAbove","setErrorBoxXBelow","setErrorBoxAbove","setErrorBoxBelow","setErrorBoxStyle","autoAxis","boxes","setWaveform","exportToSchema","SERIE_BAR","isFlipped","styleName","markers","getLabel","registerConstructor","has","set","waveform","getVal","xValue","yClosest","index","serieShape","rx","getLineWidth","ry","getLineColor","onCreated","onChanged","magnet","within","findLocalMinMax","innerHTML","Date","now","window","requestAnimationFrame","offsetHeight","offsetWidth","Symbol","SERIE_CONTOUR","SERIE_ZONE","SERIE_DENSITYMAP","SERIE_LINE_3D","SERIE_ZONE_3D","TICKS_OUTSIDE","TICKS_INSIDE","TICKS_CENTERED","xOffset","xScale","setXWaveform","_makeArray","isNaNAllowed","_setData","getY","dataInUse","getScale","getShift","xdata","computeXMinMax","hasXWaveform","getXWaveform","getLength","append","getX","rescaleX","getTypedArrayClass","_typedArrayClass","setTypedArrayClass","name","isUnsigned","from","Float32Array","Float64Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","recalculateMinMaxNewPoint","minX","maxX","minY","maxY","unshift","monotoneous","getMonotoneousAscending","_monotoneousAscending","_monotoneous","getMin","getMax","getDataInUse","getIndexFromVal","getIndexFromData","dataInUseType","getIndexFromX","isMonotoneous","trace","getReductionType","getXMin","getXScale","getXShift","getXMax","getYMin","getYMax","getMinX","getMaxX","getMinY","getMaxY","getDataY","scale","setScale","setXShift","setXScale","getDataToUseFlat","fill","fit","dataY","dataX","done","getXRaw","_integrateP","integrateP","integrate","average","getAverageP","mean","getAverageX","_integrateX","checkMonotonicity","requireXMonotonicity","requireMonotonicity","isXMonotoneous","invert","reverse","resampleForDisplay","xPosition","resampleToPx","interpolate","interpolateIndex_X","getXMonotoneousAscending","isXMonotoneousAscending","divide","_arithmetic","divideBy","multiply","multiplyBy","logBase","ln","E","add","addBy","subtract","subtractBy","math","_waveArithmetic","_numberArithmetic","aggregate","_dataAggregating","_dataAggregated","_dataAggregationDirection","toUpperCase","aggregator","numPoints","direction","then","aggregates","hasAggregation","selectAggregatedData","duplicate","slice","xShift","subrangeX","findLocalMinMaxIndex","setUnit","setXUnit","xunit","getUnit","getXUnit","hasXUnit","hasUnit","findLevels","box","edge","rounding","rangeP","findLevel","rangeX","normalize","markersIndependant","getMarkerDomIndependent","counter2","markerPath","path","trackMouse","trackMouseLabel","trackMouseLabelRouding","lineToZero","selectableOnClick","overflowX","overflowY","markerFamilies","selected","extendStyles","markersDom","shown","_isMinOrMax","groupLines","domMarker","cursor","additionalData","marker","markerLabel","markerLabelSquare","domMarkerHover","domMarkerSelect","markerHovered","groupMarkerSelected","markerPoints","lines","groupMarkers","independantMarkers","initExtended1","setOptions","defaults","applyLineStyles","onMouseOverMarker","toggleMarker","infos","onMouseOutMarker","markersOffHover","setMarkerStyleTo","getMarkerCurrentFamily","getMarkerPath","split","markersOffSelect","onClickOnMarker","onSelectMarker","onUnselectMarker","onToggleMarker","_getMarkerIndexFromEvent","searchIndexByPxXY","onMouseWheel","empty","areMarkersShown","applyLineStyle","getSymbolForLegend","degrade","degradationPx","drawInit","axisCheck","currentLineId","counter","currentLine","_dataToUse","_xDataToUse","xData","getDataMax","getDataMin","removeLinesGroup","_afterLinesGroup","insertLinesGroup","removeExtraLines","hasDataChanged","_slotToUse","eraseMarkers","lookForMaxima","lookForMinima","markerFamily","pos0","getPos","hasErrors","errorDrawInit","_draw","errorDraw","insertMarkers","hasStyleChanged","updateStyle","dataHasChanged","afterDraw","markersShown","_createLine","_addPoint","_tracker","_trackerDom","children","_trackingCallback","_trackingOutCallback","markerCurrentFamily","getMarkerDom","hideTrackingMarker","errorAddPoint","getLineDashArray","setLegendSymbolStyle","styleHasChanged","searchClosestValue","getIndexFromXY","getRelPx","indexMin","indexMax","indexClosest","xMin","xMax","yMin","yMax","xExact","getMouseVal","getFlip","toFixed","getComputedTextLength","xBefore","xAfter","yBefore","yAfter","interpolatedY","dataIndex","xBeforeIndexArr","setLineStyle","getLineStyle","getStyle","extendStyle","_recalculateMarkerPoints","setLineWidth","setLineColor","showMarkers","hideMarkers","isMarkersShown","setMarkersPoints","_extendMarkers","setMarkersColor","setMarkersType","setMarkersZoom","setMarkersStrokeColor","setMarkersStrokeWidth","setMarkersFillColor","currentMarkersSelectionType","getMarkerForLegend","markerForLegend","parentNode","xmonotoneous","dx","dy","_compute","_relativeTo","_parsePercent","_getPositionPx","deltaPosition","getValPosition","getMaxValue","getMinValue","getMaxPx","getPxRel","relativeTo","listener","getListeners","_getEvents","RegExp","test","flattenListeners","getListenersAsObject","addListener","once","addOnceListener","defineEvent","defineEvents","removeListener","off","addListeners","manipulateListeners","removeListeners","removeEvent","_events","removeAllListeners","emitEvent","_getOnceReturnValue","trigger","setOnceReturnValue","_onceReturnValue","redrawShapesAfterDraw","beforeDraw","_addData","clearData","getTextForLegend","hideImpl","doesHideWhenNoSeriesShown","showImpl","toggleDisplay","_checkX","_checkY","xaxis","yaxis","setAxes","getWaveform","getWaveforms","lineForLegend","textForLegend","getIndex","setLabel","setFlip","_changedStyles","_dataHasChanged","setInfo","getInfo","setAdditionalData","getAdditionalData","allowTrackingLine","_type","excludedFromLegend","_excludedFromLegend","setDataIndices","categoryIndices","nbCategories","hasErrorBars","lineAt","axisDataSpacing","unitModification","primaryGrid","secondaryGrid","primaryGridColor","secondaryGridColor","primaryGridWidth","secondaryGridWidth","hideWhenNoSeriesShown","shiftToZero","tickPosition","nbTicksPrimary","nbTicksSecondary","ticklabelratio","exponentialFactor","exponentialLabelFactor","logScale","span","marginMin","marginMax","scientificScale","scientificScaleExponent","engineeringScale","unitInTicks","splitMarks","tickLabelOffset","useKatexForLabel","unitModificationTimeTicks","hasChanged","_lines","line","groupTicks","groupTickLabels","labelTspan","preunit","unitTspan","expTspan","expTspanExp","setTickPosition","gridLinePath","primary","secondary","setGridLinesStyle","groupSeries","widthHeightTick","ticks","ticksLabels","tickScaling","currentTick","lastCurrentTick","totalDelta","handleMouseMoveLocal","addLabel","setDisplay","_hidden","setLineAt","adaptTo","thisValue","foreignValue","preference","adapt","currentAxisMin","currentAxisMax","_zoomed","getInterval","setFloating","floatingAxis","floatingValue","setAxisDataSpacing","dataSpacing","setAxisDataSpacingMin","setAxisDataSpacingMax","minPx","setMinMaxFlipped","maxPx","minPxFlipped","maxPxFlipped","getMathMaxPx","getMathMinPx","dataMin","dataMax","forceMin","forceMax","getForcedMin","getForcedMax","forceToAxis","getNbTicksPrimary","setNbTicksPrimary","getNbTicksSecondary","setNbTicksSecondary","mouseVal","handleMouseWheel","_doZoomVal","zoomLock","_zoomLocked","_doZoom","cacheCurrentMin","cacheCurrentMax","cacheInterval","_hasChanged","getSerieShift","_serieShift","getSerieScale","_serieScale","getUnitPerTick","decimals","cache","getCurrentInterval","cachedInterval","cachedCurrentMin","cachedCurrentMax","scientificExponent","unitDecade","getEngineeringExponent","getExponentGreekLetter","writeUnit","preunitTspan","katexElement","hideTicks","resetTicksLength","deltaPx","drawLinkedToAxisTicksWrapper","drawLinearTicksWrapper","drawLogTicks","removeUselessTicks","removeUselessTickLabels","_drawLine","_hideLine","primaryTickUnit","maxPrimaryTickUnit","minPrimaryTickUnit","drawTicks","secondaryTicks","forcePrimaryTickUnit","forcePrimaryTickUnitMax","forcePrimaryTickUnitMin","getPrimaryTickUnit","incrTick","setTickLabelRatio","_widthLabels","subIncrTick","drawTickWrapper","getMaxSizeTick","nextTick","nextTickLabel","lastCurrentTickLabel","currentTickLabel","nextGridLine","setGridLineStyle","getPrimaryGridColor","getSecondaryGridColor","getPrimaryGridWidth","getSecondaryGridWidth","getPrimaryGridOpacity","getSecondaryGridOpacity","getPrimaryGridDasharray","getSecondaryGridDasharray","exponential","overwrite","drawTick","linkToAxis","scalingFunction","getRoundedPx","valueToText","getExponentialFactor","getExponentialLabelFactor","modifyUnit","getModifiedValue","setExponentialFactor","setExponentialLabelFactor","setLabelFont","labelFont","setSpan","_level","tickPx1","tickPx2","setGrids","setPrimaryGrid","setSecondaryGrid","primaryGridOn","primaryGridOff","secondaryGridOn","secondaryGridOff","gridsOn","gridsOff","turnGridsOff","turnGridsOn","setAxisColor","axisColor","getAxisColor","setTickLabelOffset","setPrimaryTicksColor","primaryTicksColor","getPrimaryTicksColor","setSecondaryTicksColor","secondaryTicksColor","getSecondaryTicksColor","setTicksLabelColor","ticksLabelColor","getTicksLabelColor","setPrimaryGridColor","setSecondaryGridColor","setPrimaryGridWidth","setSecondaryGridWidth","setPrimaryGridOpacity","primaryGridOpacity","setSecondaryGridOpacity","secondaryGridOpacity","setPrimaryGridDasharray","primaryGridDasharray","setSecondaryGridDasharray","secondaryGridDasharray","labelColor","getLabelColor","setTickContent","setUnitInTicks","setUnitWrapper","setUnitDecade","setScientific","setScientificScaleExponent","setEngineering","setLogScale","isZoomed","getValue","makeBarY","makeBoxY","makeBarX","makeBoxX","errorbarStyle","_setErrorStyle","errorboxStyle","strokeOpacity","all","paths","getErrorBarXBelow","getErrorBarXAbove","getErrorBarYBelow","getErrorBarYAbove","getErrorBoxXBelow","getErrorBoxXAbove","getErrorBoxYBelow","getErrorBoxYAbove","errorAddPointBarChart","doErrorDraw","dominantBaseline","drawLabel","drawSpecifics","transform","currentPos2x","currentPos2y","currentPos1x","currentPos1y","vertical","horizontal","noX","noY","forcedCoords","LMITER","LMBOOST","LMSHRINK","LAMBDAZERO","LAMBDAMAX","LMTOL","BIGVAL","sos","sosprev","lambda","myH","nadj","npts","delta","beta","alpha","amatrix","bLMiter","params","nudge","buildJacobian","getResidualElement","getJacobianElement","gaussj","DELTAP","WEIGHT","setYData","setXData","setWeight","weight","setInitialParams","subsetIndex","setSubset","setFunction","function","progress","hookIteration","parms","NPARMS","_from","_to","_hookIteration","buildFit","_func","NPTS","arrY","arrX","getDataX","resid","jac","_result","func","computeResiduals","leftright","setAxisPosition","shiftPosition","getAdditionalWidth","tickMargin","longestTick","fullwidthlabel","placeLabel","isLeft","isRight","scaleToFitAxis","zpos","MIN_VALUE","shapesDetails","groupPoints","selectedStyleGeneral","selectedStyleModifiers","parentElement","cx","cy","setDataCategory","symbol","doShape","modifiers","extraStyle","stdStylePerso","stdStyle","unselectPoint","selectPoint","selectPoints","getUsedCategories","groupZones","lineZone","clipId","waveforms","setWaveforms","setMinMaxWaveforms","getFillOpacity","getLineOpacity","setLineOpacity","lineOpacity","sides","currentX","currentY","currentW","currentH","_staticHandles","frame","frameWidth","frameColor","frameRounding","shapesToggleable","isSerieHideable","isSerieSelectable","svg","subG","groups","rect","rectBottom","pos","transformX","transformY","setEvents","eyeId","eyeCrossedId","adoptNode","documentElement","alignToX","alignToY","setDraggable","setAutoPosition","autoPosition","buildLegendBox","bbox","_setPosition","_requiredUpdate","hasChildNodes","lastChild","isHideable","hideShapesOnHideSerie","notHideable","hideable","seriesHideable","isToggleShapes","mousedown","fixSeries","fixSeriesAdd","categories","_barCategories","autoSeries","setSeries","setCategoryConfig","_getUsedCategories","setSeconds","getSeconds","increment","setMilliseconds","setMinutes","getMinutes","setHours","getHours","setDate","getDate","setMonth","getMonth","setFullYear","getFullYear","line1","line2","substr","threshold","increments","format","SyntaxError","masks","getTimezoneOffset","dd","ddd","i18n","dayNames","dddd","mm","mmm","monthNames","mmmm","yy","yyyy","h","hh","H","HH","M","MM","ss","L","t","tt","T","TT","Z","match","pop","S","W","shortDate","mediumDate","longDate","fullDate","shortTime","mediumTime","longTime","isoDate","isoTime","isoDateTime","isoUtcDateTime","getTime","setZPos","setz","pathDom","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","maxBoxWidth","meanLineColor","meanLineWidth","boxAboveLineWidth","boxAboveLineColor","boxAboveFillColor","boxAboveFillOpacity","boxBelowLineWidth","boxBelowLineColor","boxBelowFillColor","boxBelowFillOpacity","barAboveLineColor","barAboveLineWidth","barBelowLineColor","barBelowLineWidth","outlierLineWidth","outlierLineColor","outlierFillColor","outlierFillOpacity","Q2","Q3","Q1","whiskers","outliers","_style","_set","_gstyle","setMeanLineColor","getMeanLineColor","setMeanLineWidth","getMeanLineWidth","setBoxAboveLineColor","getBoxAboveLineColor","setBoxBelowLineColor","getBoxBelowLineColor","setBoxAboveLineWidth","getBoxAboveLineWidth","setBoxBelowLineWidth","getBoxBelowLineWidth","setBoxAboveFillColor","getBoxAboveFillColor","setBoxBelowFillColor","getBoxBelowFillColor","setBoxAboveFillOpacity","getBoxAboveFillOpacity","setBoxBelowFillOpacity","getBoxBelowFillOpacity","setBarAboveLineColor","getBarAboveLineColor","setBarBelowLineColor","getBarBelowLineColor","setBarAboveLineWidth","getBarAboveLineWidth","setBarBelowLineWidth","getBarBelowLineWidth","setOutlierLineColor","getOutlierLineColor","setOutlierLineWidth","getOutlierLineWidth","setOutlierFillColor","getOutlierFillColor","setOutlierFillOpacity","getOutlierFillOpacity","_linkedToScatterSeries","applyMeanStyle","boxPos","applyBoxStyle","setOutlierStyle","applyWhiskerStyle","getCategoryIndex","linkToScatterSerie","colors","eraseLines","latchLines","_rgb","object","rects","recalculateBinsOnDraw","calculateDensity","maxIndexX","maxIndexY","binMin","binMax","deltaX","fromX","fromY","numX","numY","densitymap","setDensityMap","calculateDensityWeighted","autoBins","setPxPerBin","calculationDensityMap","to","pxPerBin","weighted","setBinsFromTo","densityMapCalculation","numBins","method","calculateDensityAdvanced","num","weighing","densityMapCalculate","setColorMapBinBoundaries","colorMapMin","colorMapMax","autoColorMapBinBoundaries","onRedrawColorMapBinBoundaries","callbackColorMapMinMax","colorMapHSL","a","opacities","colorMap","colorMapNum","autoColorMapHSL","colorMapHSV","getColorIndex","drawRects","negativeDelta","positiveDelta","negativeThreshold","positiveThreshold","segments","zValue","zValues","setColorTo","hasNegative","_shapeZoom","setHandleNeg","showHandleNeg","hideHandleNeg","setHandlePos","setDynamicColor","lineColors","setNegative","fromPositive","toPositive","fromNegative","toNegative","setShapeZoom","resizingPosition","xBeforeIndex","firstX","firstY","lastX","lastY","nbHandles","setPointsPx","_domShadow","xor","getAxis","_sumVal","ratio","sumVal","lastPointX","lastPointY","_sum","firstPointX","firstPointY","ratioLabel","updateIntegralValue","handleCondition","toPrecision","_ratio","sum","selectHandles","element","setBindableToDom","triggerChange","getFromData","lineHeight","line3","rectBoundary","redrawLines","posYPx","redrawY","setY","setLineHeight","lineHeihgt","div","setContent","setRenderer","_renderer","currentPosX","currentPosY","dragX","dragY","persistanceX","persistanceY","totaltime","_draggingX","_draggingY","_lastDraggingX","_lastDraggingY","stopAnimation","speedX","speedY","_pluginDragMin","_pluginDragMax","accelerationX","accelerationY","_persistanceMove","shapeType","setShape","shapeInfo","count","onChange","currentShape","currentShapeEvent","onCreate","_path","xs","ys","findPoints","_zoomingGroup","_zoomingSquare","zoomMode","_zoomingMode","_backedUpZoomMode","_zoomingXStart","_zoomingYStart","x1","y1","y2","forcedY","onZoomStart","onZoomMove","removeZone","e","mute","transition","smooth","fullX","toAxes","_pluginZoomMin","_pluginZoomMax","_pluginZoomMinFinal","_pluginZoomMaxFinal","fullY","onDblClick","pref","onZoom","gradualUnzoomStart","sin","PI","isFullX","isFullY","axes","currentSlots","requestLevels","updateSerie","recalculateSeries","LRUName","intervals","maxParallelRequests","optimalPxPerPoint","nbPoints","create","requestsRunning","setURL","setAvailableIntervals","interval","_zoneSerie","registerPlugin","getOptimalInterval","cleanRegister","computeSlotID","computeTimeMin","register","processRequests","computeUniqueID","computeTimeMax","timeout","request","getURL","store","computeSlotTime","getZoneSerie","updateZoneSerie","recalculateSerie","minmax","recalculateSerieUpwards","setIntervalCheck","clearInterval","setInterval","lockRedraw","unlockRedraw","isRedrawLocked","prev","next","exist","positiveStyle","negativeStyle","pathsPositive","pathsNegative","positivePolyline","negativePolyline","serie1","serie2","setBoundaries","getFrom","getTo","xAfterIndex","computeCrossing","getPositivePolyline","getNegativePolyline","subSeries","getOwnPropertyNames","margins","high","low","newXAxis","newBottomAxis","newYAxis","newLeftAxis","newTopAxis","getOptions","newRightAxis","preDraw","splitNumber","splitAxis","getSubAxis","newLineSerie","newScatterSerie","constructorOptions","_splitVal","_splits","fixGridIntervalBasedOnAxis","fixGridFor","splitSpread","autoSpread","_splitSpread","setChunkBoundaries","_mean","_baseWidthVal","_baseWidthIndex","topbottom","labelPosY","checkHSL","hue","saturation","lightness","buildHSLString","colorizeAll","serieTypes","startingColorHSL","colorHSL","endingColorHSL","affect","autoPeakPicking","autoPeakPickingNb","autoPeakPickingMinDistance","autoPeakPickingFormat","autoPeakPickingAllowAllY","picks","shapeOptions","minPosY","serieRemoved","detectedPeaks","lastYPeakPicking","postDraw","hidePeakPicking","_hidePeakPickingLocked","showPeakPicking","killPeakPicking","setR"],"mappings":"AAAA,CAAC,aAAyD,CACnC,QAAnB,QAAOA,QAAP,EAAiD,QAAlB,QAAOC,OADgB,CAExDA,OAAOD,OAAP,CAAiB,GAFuC,CAG/B,UAAlB,QAAOE,OAAP,EAAgCA,OAAOC,GAHU,CAIxDD,YAJwD,CAK9B,QAAnB,QAAOF,QAL0C,CAMxDA,cAAmB,GANqC,CAQxD,QAAgB,GACjB,CATD,EASmB,WAAhB,QAAOI,KAAP,CAAqC,IAArC,CAA8BA,IATjC,CAS8C,UAAW,OAswgBvCC,OAAOC,SAtwgBgC,GAy8a1CC,KAAKC,GAz8aqC,GAu7S1CD,KAAKE,GAv7SqC,GAs/PlCF,KAAKG,IAt/P6B,GAw6P1CL,OAAOM,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AAa,IAAb,GACA,CAAO,IACR,CAEDqG,mBAAoB,CAClB,KAAK+7C,aAAL,EACD,CAEDh8C,qBAA2D,CAAE,CAzCf,CA4ChD,EAAQ9K,OAAR,EAlF2D,CAmF3D,EAAO5G,OAAP,CAAiB,EAAQ,SAAR,CAClB,CAnG+F,CAqGzF,CAlm3BG,CAjEM,CAqq3Bf,CA/q3BD,C","file":"jsgraph-es6.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Graph\"] = factory();\n\telse\n\t\troot[\"Graph\"] = factory();\n})(typeof self !== 'undefined' ? self : this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 19);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(exports);\n } else {\n var mod = {\n exports: {}\n };\n factory(mod.exports);\n global.graphUtil = mod.exports;\n }\n})(this, function (exports) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.setAttributeTo = setAttributeTo;\n exports.mapEventEmission = mapEventEmission;\n exports.guid = guid;\n exports.throwError = throwError;\n exports.warn = warn;\n exports.isNumeric = isNumeric;\n exports.hue2rgb = hue2rgb;\n exports.hslToRgb = hslToRgb;\n exports.saveDomAttributes = saveDomAttributes;\n exports.hasSavedAttribute = hasSavedAttribute;\n exports.overwriteDomAttribute = overwriteDomAttribute;\n exports.restoreDomAttributes = restoreDomAttributes;\n exports.debounce = debounce;\n exports.SVGParser = SVGParser;\n exports.reverseArray = reverseArray;\n exports.getOffset = getOffset;\n exports.setCSS = setCSS;\n exports.ajaxGet = ajaxGet;\n exports.extend = extend;\n exports.mix = mix;\n exports.emptyDom = emptyDom;\n /**\n * Easy set attribute method to apply to a SVG Element the attributes listed. Optional namespacing\n * @param {SVGElement} to - The SVG element to apply the attributes to\n * @param {Object} attr - A key/value hashmap of attributes\n * @param {String} [ ns = undefined ] - The namespace to use (with setAttributeNS). Default if without namespacing\n */\n function setAttributeTo(to, params, ns) {\n var i;\n\n if (ns) {\n for (i in params) {\n to.setAttributeNS(ns, i, params[i]);\n }\n } else {\n for (i in params) {\n to.setAttribute(i, params[i]);\n }\n }\n }\n\n /**\n * Maps old-style events defined within the creation (i.e. { onMouseOver: function() }) to modern event listening .on(\"mouseover\")\n * The function will read any object and select the ones starting with \"on\"\n * @params {Object} options - An option object to read the events from\n * @param {Object} source - The source object to which the options belong\n * @example util.mapEventEmission( this.options, this );\n */\n function mapEventEmission(options, source) {\n\n if (!source) {\n source = this;\n }\n\n var eventName;\n\n for (var i in options) {\n\n // Starts with onXXX\n if (i.indexOf('on') == 0 && typeof options[i] == 'function') {\n eventName = i.substring(2);\n eventName = eventName.substring(0, 1).toLowerCase() + eventName.substring(1);\n\n if (source.on) {\n\n (function (j) {\n\n source.on(eventName, function () {\n options[j].apply(source, arguments);\n });\n })(i);\n }\n }\n }\n }\n\n /**\n * @link http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript\n * @return {String} a random id\n */\n function guid() {\n //\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0,\n v = c == 'x' ? r : r & 0x3 | 0x8;\n return v.toString(16);\n });\n }\n\n function throwError(message) {\n console.error(message);\n }\n\n function warn(message) {\n console.warn(message);\n }\n\n /**\n * Checks if a variable is a numeric or not\n * @return {Boolean} true for a numeric value, false otherwise\n */\n function isNumeric(obj) {\n return !Array.isArray(obj) && obj - parseFloat(obj) + 1 >= 0;\n }\n\n /**\n * @see http://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion\n * Converts an HSL color value to RGB. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSL_color_space.\n * Assumes h, s, and l are contained in the set [0, 1] and\n * returns r, g, and b in the set [0, 255].\n *\n * @param Number h The hue\n * @param Number s The saturation\n * @param Number l The lightness\n * @return Array The RGB representation\n */\n function hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n }\n\n function hslToRgb(h, s, l) {\n var r, g, b;\n\n if (s == 0) {\n r = g = b = l; // achromatic\n } else {\n\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n\n return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];\n }\n\n function saveDomAttributes(to, attributes, identification) {\n\n if (!to) return;\n\n to._savedAttributesIds = to._savedAttributesIds || [];\n\n if (to._savedAttributesIds.indexOf(identification) > -1) {\n restoreDomAttributes(to, identification);\n }\n\n to._savedAttributes = to._savedAttributes || {};\n to._attributes = to._attributes || {};\n to._attributes[identification] = attributes;\n\n to._savedAttributesIds.push(identification);\n\n for (var i in attributes) {\n\n if (!to._savedAttributes[i]) {\n to._savedAttributes[i] = to.getAttribute(i);\n }\n\n to.setAttribute(i, attributes[i]);\n }\n }\n\n function hasSavedAttribute(dom, attr) {\n return dom._savedAttributes && dom._savedAttributes[attr] !== undefined;\n }\n\n function overwriteDomAttribute(dom, attribute, newValue) {\n if (hasSavedAttribute(dom, attribute)) {\n dom._savedAttributes[attribute] = newValue;\n }\n }\n\n function restoreDomAttributes(to, identification) {\n\n if (!to || !to._savedAttributesIds) {\n return;\n }\n\n to._savedAttributesIds.splice(to._savedAttributesIds.indexOf(identification), 1);\n delete to._attributes[identification];\n\n var attrs = {};\n\n for (var i in to._savedAttributes) {\n attrs[i] = to._savedAttributes[i];\n }\n\n for (var i = 0, l = to._savedAttributesIds.length; i < l; i++) {\n\n for (var j in to._attributes[to._savedAttributesIds[i]]) {\n attrs[j] = to._attributes[to._savedAttributesIds[i]][j];\n }\n }\n\n for (var j in attrs) {\n to.setAttribute(j, attrs[j]);\n }\n }\n\n // https://davidwalsh.name/function-debounce\n function debounce(func, wait, immediate) {\n var timeout;\n return function () {\n var context = this,\n args = arguments;\n var later = function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }\n\n function SVGParser(svgString) {\n\n var parser = new DOMParser();\n var doc = parser.parseFromString(svgString, 'image/svg+xml');\n // returns a SVGDocument, which also is a Document.\n\n return doc;\n }\n\n // http://stackoverflow.com/questions/5276953/what-is-the-most-efficient-way-to-reverse-an-array-in-javascript\n function reverseArray(array) {\n var left = null;\n var right = null;\n var length = array.length;\n for (left = 0, right = length - 1; left < right; left += 1, right -= 1) {\n var temporary = array[left];\n array[left] = array[right];\n array[right] = temporary;\n }\n return array;\n }\n\n // jQuery.fn.offset\n function getOffset(el) {\n var rect = el.getBoundingClientRect();\n return {\n top: rect.top,\n left: rect.left\n };\n }\n\n // jQuery.fn.css\n function setCSS(element, values) {\n var style = element.style;\n for (var i in values) {\n style[i] = values[i];\n }\n }\n\n function ajaxGet(options) {\n return new Promise(function (resolve, reject) {\n var request = new XMLHttpRequest();\n request.open(options.type || 'GET', options.url, true);\n if (options.json) request.setRequestHeader('Accept', 'application/json');\n request.onload = function () {\n if (request.status === 200) {\n var response = request.responseText;\n if (options.json) response = JSON.parse(response);\n resolve(response);\n } else {\n reject(new Error('Request error: ' + request.status));\n }\n };\n request.onerror = function () {\n reject(new Error('Network error: ' + request.status));\n };\n request.send();\n });\n }\n\n // https://raw.githubusercontent.com/justmoon/node-extend/888f153645115d1c6aa9a7e346e8e9cd9a83de9b/index.js\n // Copyright (c) 2014 Stefan Thomas\n var hasOwn = Object.prototype.hasOwnProperty;\n var toStr = Object.prototype.toString;\n\n var isArray = function isArray(arr) {\n if (typeof Array.isArray === 'function') {\n return Array.isArray(arr);\n }\n\n return toStr.call(arr) === '[object Array]';\n };\n\n var isPlainObject = function isPlainObject(obj) {\n if (!obj || toStr.call(obj) !== '[object Object]') {\n return false;\n }\n\n var hasOwnConstructor = hasOwn.call(obj, 'constructor');\n var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n // Not own constructor property must be Object\n if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n return false;\n }\n\n // Own properties are enumerated firstly, so to speed up,\n // if last one is own, then all properties are own.\n var key;\n for (key in obj) {/**/}\n\n return typeof key === 'undefined' || hasOwn.call(obj, key);\n };\n\n function extend() {\n var options, name, src, copy, copyIsArray, clone;\n var target = arguments[0];\n var i = 1;\n var length = arguments.length;\n var deep = false;\n\n // Handle a deep copy situation\n if (typeof target === 'boolean') {\n deep = target;\n target = arguments[1] || {};\n // skip the boolean and the target\n i = 2;\n } else if (typeof target !== 'object' && typeof target !== 'function' || target == null) {\n target = {};\n }\n\n for (; i < length; ++i) {\n options = arguments[i];\n // Only deal with non-null/undefined values\n if (options != null) {\n // Extend the base object\n for (name in options) {\n src = target[name];\n copy = options[name];\n\n // Prevent never-ending loop\n if (target !== copy) {\n // Recurse if we're merging plain objects or arrays\n if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n if (copyIsArray) {\n copyIsArray = false;\n clone = src && isArray(src) ? src : [];\n } else {\n clone = src && isPlainObject(src) ? src : {};\n }\n\n // Never move original objects, clone them\n target[name] = extend(deep, clone, copy);\n\n // Don't bring in undefined values\n } else if (typeof copy !== 'undefined') {\n target[name] = copy;\n }\n }\n }\n }\n }\n\n // Return the modified object\n return target;\n }\n\n exports.default = {};\n exports.isArray = isArray;\n exports.isPlainObject = isPlainObject;\n function mix(baseClass, mixin) {\n\n for (let prop in mixin) {\n\n if (mixin.hasOwnProperty(prop)) {\n baseClass.prototype[prop] = mixin[prop];\n }\n }\n }\n\n function emptyDom(dom) {\n while (dom.firstChild) {\n dom.removeChild(dom.firstChild);\n }\n }\n});\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(6), __webpack_require__(0), __webpack_require__(7)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.position.js'), require('../graph.util.js'), require('../dependencies/eventEmitter/EventEmitter.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphPosition, global.graphUtil, global.EventEmitter);\n global.graphShape = mod.exports;\n }\n})(this, function (module, exports, _graphPosition, _graphUtil, _EventEmitter) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphPosition2 = _interopRequireDefault(_graphPosition);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _EventEmitter2 = _interopRequireDefault(_EventEmitter);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Shape class that should be extended\n * @class Shape\n * @static\n */\n class Shape extends _EventEmitter2.default {\n\n constructor() {\n super();\n }\n\n /**\n * Initializes the shape\n * @param {Graph} graph - The graph containing the shape\n * @param {Object} properties - The properties object (not copied)\n * @return {Shape} The current shape\n */\n init(graph, properties) {\n\n var self = this;\n\n this.graph = graph;\n this.properties = properties || {};\n this.handles = [];\n this.options = this.options || {};\n\n this.group = document.createElementNS(this.graph.ns, 'g');\n\n this.group.setAttribute('clip-path', 'url(#_clipplot' + graph._creation + ')');\n\n this._selected = false;\n this.createDom();\n\n if (this._dom) {\n this._dom.jsGraphIsShape = this;\n }\n\n this.group.jsGraphIsShape = this;\n\n this.classes = [];\n this.transforms = [];\n\n if (this._data.masker) {\n\n var maskPath = document.createElementNS(this.graph.ns, 'mask');\n this.maskingId = Math.random();\n maskPath.setAttribute('id', this.maskingId);\n\n this.maskDomWrapper = document.createElementNS(this.graph.ns, 'rect');\n this.maskDomWrapper.setAttribute('fill', 'white');\n maskPath.appendChild(this.maskDomWrapper);\n\n var maskDom = this._dom.cloneNode();\n maskPath.appendChild(maskDom);\n\n this.maskDom = maskDom;\n\n this.graph.defs.appendChild(maskPath);\n }\n\n if (this.group) {\n\n if (this._dom && !this.isHTML()) {\n this.group.appendChild(this._dom);\n }\n\n this.group.addEventListener('mouseover', function (e) {\n\n self.handleMouseOver(e);\n });\n\n this.group.addEventListener('mouseout', function (e) {\n\n self.handleMouseOut(e);\n });\n\n this.group.addEventListener('mousedown', function (e) {\n\n self.graph.focus();\n\n self.handleMouseDown(e);\n });\n\n this.group.addEventListener('click', this.handleClick.bind(this));\n\n this.group.addEventListener('dblclick', function (e) {\n\n //e.preventDefault();\n // e.stopPropagation();\n\n self.handleDblClick(e);\n });\n }\n\n //\t\t\tthis.group.appendChild(this.rectEvent);\n\n this.initImpl();\n\n this.graph.emit('shapeNew', this);\n\n return this;\n }\n\n /**\n * Implentation of the init method. To be extended if necessary on extended Shape classes\n */\n initImpl() {}\n\n /**\n * @return {Object} The shape's underlying data object\n */\n getData() {\n return this._data;\n }\n\n /**\n * @returns {String} The type of the shape\n */\n getType() {\n return this.type;\n }\n\n /**\n * Removes the shape from the DOM and unlinks it from the graph\n */\n kill(keepDom) {\n\n if (this._inDom && !keepDom) {\n this.graph.removeShapeFromDom(this);\n }\n\n if (!keepDom) {\n this.graph._removeShape(this);\n }\n\n this.graph.stopElementMoving(this);\n this.graph.emit('shapeRemoved', this);\n this.emit('removed', this);\n\n this._inDom = false;\n }\n\n /**\n * Hides the shape\n * @return {Shape} The current shape\n */\n hide() {\n\n if (this.hidden) {\n return this;\n }\n\n this.hidden = true;\n if (!this.isHTML()) {\n this.group.style.display = 'none';\n } else {\n this._dom.style.display = 'none';\n }\n return this;\n }\n\n /**\n * Returns whether the shape is hidden or not\n * @return {Boolean} true if the shape is hidden, false otherwise\n */\n isHidden() {\n return this.hidden;\n }\n\n /**\n * Returns whether the shape is visible or not\n * @return {Boolean} true if the shape is visible, false if it is hidden\n */\n isVisible() {\n return !this.hidden;\n }\n\n /**\n * Shows the shape\n * @return {Shape} The current shape\n */\n show() {\n\n if (!this.hidden) {\n return this;\n }\n\n this.hidden = false;\n if (!this.isHTML()) {\n this.group.style.display = 'initial';\n } else {\n this._dom.style.display = 'initial';\n }\n\n this.redraw();\n return this;\n }\n\n /**\n * Adds a class to the shape DOM\n * @param {String} className - The class to add\n * @return {Shape} The current shape\n */\n addClass(className) {\n this.classes = this.classes || [];\n if (this.classes.indexOf(className) == -1) {\n this.classes.push(className);\n }\n this.makeClasses();\n return this;\n }\n\n /**\n * Removes a class from the shape DOM\n * @param {String} className - The class to remove\n * @return {Shape} The current shape\n */\n removeClass(className) {\n this.classes.splice(this.classes.indexOf(className), 1);\n this.makeClasses();\n return this;\n }\n\n /**\n * Builds the classes\n * @private\n * @return {Shape} The current shape\n */\n makeClasses() {\n\n if (this._dom) {\n this._dom.setAttribute('class', this.classes.join(' '));\n }\n\n return this;\n }\n\n /**\n * Triggers a ```shapeChanged``` event on the graph and a ```changed``` event on the shape\n * @return {Shape} The current shape\n */\n changed(event, parameters) {\n\n if (event) {\n this.graph.emit(event, this, parameters);\n this.emit(event, this, parameters);\n }\n\n this.emit('changed', this, parameters);\n this.graph.emit('shapeChanged', this, parameters);\n return this;\n }\n\n /**\n * Creates an event receptacle with the coordinates of the shape bounding box\n * @return {Shape} The current shape\n */\n setEventReceptacle() {\n\n if (!this.rectEvent) {\n this.rectEvent = document.createElementNS(this.graph.ns, 'rect');\n this.rectEvent.setAttribute('pointer-events', 'fill');\n this.rectEvent.setAttribute('fill', 'transparent');\n this.group.appendChild(this.rectEvent);\n this.rectEvent.jsGraphIsShape = this;\n }\n\n var box = this.group.getBBox();\n this.rectEvent.setAttribute('x', box.x);\n this.rectEvent.setAttribute('y', box.y - 10);\n this.rectEvent.setAttribute('width', box.width);\n this.rectEvent.setAttribute('height', box.height + 20);\n }\n\n /**\n * Assigns a serie to the shape\n * @param {Serie} The serie that owns the shape\n * @return {Shape} The current shape\n */\n setSerie(serie) {\n\n if (!serie) {\n return;\n }\n\n this.serie = serie;\n\n if (!serie.getXAxis || !serie.getYAxis) {\n console.error(serie);\n throw 'Serie does not implement the getXAxis or getYAxis method';\n }\n this.xAxis = serie.getXAxis();\n this.yAxis = serie.getYAxis();\n return this;\n }\n\n /**\n * @return {Serie} The serie associated to the shape\n */\n getSerie() {\n return this.serie;\n }\n\n /**\n * Assigns the shape to the default x and y axes of the graph, only if they don't exist yet\n * @return {Shape} The current shape\n * @see Graph#getXAxis\n * @see Graph#getYAxis\n */\n autoAxes() {\n\n if (!this.xAxis) {\n this.xAxis = this.graph.getXAxis();\n }\n\n if (!this.yAxis) {\n this.yAxis = this.graph.getYAxis();\n }\n\n return this;\n }\n\n /**\n * Assigns the shape to an x axis\n * @param {XAxis} The X axis related to the shape\n * @return {Shape} The current shape\n */\n setXAxis(axis) {\n this.xAxis = axis;\n return this;\n }\n\n /**\n * Assigns the shape to an y axis\n * @param {YAxis} The Y axis related to the shape\n * @return {Shape} The current shape\n */\n setYAxis(axis) {\n this.yAxis = axis;\n }\n\n /**\n * Returns the x axis associated to the shape. If non-existent, assigns it automatically\n * @return {XAxis} The x axis associated to the shape.\n */\n getXAxis() {\n\n if (!this.xAxis) {\n this.autoAxes();\n }\n\n return this.xAxis;\n }\n\n /**\n * Returns the y axis associated to the shape. If non-existent, assigns it automatically\n * @return {YAxis} The y axis associated to the shape.\n */\n getYAxis() {\n\n if (!this.yAxis) {\n this.autoAxes();\n }\n\n return this.yAxis;\n }\n\n /**\n * Sets the layer of the shape\n * @param {Number} layer - The layer number (1 being the lowest)\n * @return {Shape} The current shape\n * @see Shape#getLayer\n */\n setLayer(layer) {\n this.setProp('layer', layer);\n return this;\n }\n\n /**\n * Returns the layer on which the shape is placed\n * @return {Number} The layer number (1 being the lowest layer)\n */\n getLayer() {\n var layer = this.getProp('layer');\n\n if (layer !== undefined) {\n return layer;\n }\n\n return 1;\n }\n\n /**\n * Initial drawing of the shape. Adds it to the DOM and creates the labels. If the shape was already in the DOM, the method simply recreates the labels and reapplies the shape style, unless ```force``` is set to ```true```\n * @param {Boolean} force - Forces adding the shape to the DOM (useful if the shape has changed layer)\n * @param {Boolean} preventRedraw - Prevents the redraw method\n * @return {Shape} The current shape\n */\n draw(force, preventRedraw) {\n\n if (!this._inDom || force) {\n\n this.appendToDom();\n this._inDom = true;\n }\n\n this.makeLabels();\n\n if (!preventRedraw) {\n this.redraw();\n }\n\n this.applyStyle();\n\n return this;\n }\n\n /**\n * Redraws the shape. Repositions it, applies the style and updates the labels\n * @return {Shape} The current shape\n */\n redraw() {\n\n if (this.hidden) {\n return this;\n }\n\n this.position = this.applyPosition();\n\n this.redrawImpl();\n if (!this.position) {\n this.updateLabels();\n return this;\n }\n\n this.updateLabels();\n this._applyTransforms();\n return this;\n }\n\n /**\n * Implementation of the redraw method. Extended Shape classes should override this method\n */\n redrawImpl() {}\n\n /**\n * Sets all dumpable properties of the shape\n * @param {Object} properties - The properties object\n * @return {Shape} The current shape\n */\n setProperties(properties) {\n this.properties = properties;\n\n if (!Array.isArray(this.properties.position)) {\n this.properties.position = [this.properties.position];\n }\n var self = this;\n for (var i = 0, l = this.properties.position.length; i < l; i++) {\n\n var pos = _graphPosition2.default.check(this.properties.position[i], function (relativeTo) {\n return self.getRelativePosition(relativeTo);\n });\n\n this.properties.position[i] = pos;\n }\n\n this.emit('propertiesChanged');\n return this;\n }\n\n getRelativePosition(relativePosition) {\n\n var result;\n if ((result = /position([0-9]*)/.exec(relativePosition)) !== null) {\n return this.getPosition(result[1]);\n } else if ((result = /labelPosition([0-9]*)/.exec(relativePosition)) !== null) {\n return this.getLabelPosition(result[1]);\n }\n }\n\n /**\n * Gets all dumpable properties of the shape\n * @return {Object} properties - The properties object\n */\n getProperties(properties) {\n return this.properties;\n }\n\n /**\n * Sets a property to the shape that is remembered and can be later reexported (or maybe reimported)\n * @param {String} prop - The property to save\n * @param val - The value to save\n * @param [ index = 0 ] - The index of the property array to save the property\n * @return {Shape} The current shape\n */\n setProp(prop, val, index) {\n this.properties = this.properties || {};\n this.properties[prop] = this.properties[prop] || [];\n this.properties[prop][index || 0] = val;\n this.emit('propertyChanged', prop);\n return this;\n }\n\n /**\n * Returns a property of the shape\n * @param {String} prop - The property to retrieve\n * @param [ index = 0 ] - The index of the property array\n */\n getProp(prop, index) {\n return (this.properties[prop] || [])[index || 0];\n }\n\n /**\n * Returns all the properties of the shape\n * @param {String} prop - The property to retrieve\n */\n getProps(prop, index) {\n return this.properties[prop] || [];\n }\n\n /**\n * Adds a property to the property array\n * @param {String} prop - The property to add\n * @param val - The value to save\n */\n addProp(prop, value) {\n this.properties[prop] = this.properties[prop] || [];\n this.properties[prop].push(value);\n }\n\n /**\n * Resets the property array\n * @param {String} prop - The property to reset\n */\n resetProp(prop) {\n this.properties[prop] = [];\n }\n\n /**\n * Sets a DOM property to the shape\n */\n setDom(prop, val, noForce) {\n if (this._dom) {\n\n if (!noForce || !util.hasSavedAttribute(this._dom, prop)) {\n this._dom.setAttribute(prop, val);\n }\n }\n }\n\n /**\n * Sets a DOM property to the shape group\n */\n setDomGroup(prop, val) {\n if (this.group) {\n this.group.setAttribute(prop, val);\n }\n }\n\n /**\n * Saves the stroke color\n * @return {Shape} The current shape\n */\n setStrokeColor(color) {\n this.setProp('strokeColor', color);\n this.overwriteSavedProp('stroke', color);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the stroke color\n * @return {String} The stroke color of the shape\n */\n getStrokeColor() {\n return this.getProp('strokeColor');\n }\n\n /**\n * Saves the fill color\n * @param {String} color - The filling color\n * @return {Shape} The current shape\n */\n setFillColor(color) {\n\n this.setProp('fillColor', color);\n this.overwriteSavedProp('fill', color);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the fill color\n * @return {String} The fill color of the shape\n */\n getFillColor() {\n return this.getProp('fillColor');\n }\n\n /**\n * Saves the opacity of the filling color of the shape\n * @param {Number} opacity - The filling opacity (0 to 1)\n * @return {Shape} The current shape\n */\n setFillOpacity(opacity) {\n this.setProp('fillOpacity', opacity);\n this.overwriteSavedProp('fill-opacity', opacity);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Saves the stroke width\n * @param {String} width - The stroke width\n * @return {Shape} The current shape\n */\n setStrokeWidth(width) {\n this.setProp('strokeWidth', width);\n this.overwriteSavedProp('stroke-width', width);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the stroke width\n * @return {String} The stroke width of the shape\n */\n getStrokeWidth() {\n return this.getProp('strokeWidth');\n }\n\n /**\n * Saves the stroke dash array\n * @param {String} dasharray - The dasharray string\n * @example shape.setStrokeDasharray(\"5,5,1,4\");\n * shape.applyStyle();\n * @return {Shape} The current shape\n */\n setStrokeDasharray(dasharray) {\n this.setProp('strokeDasharray', dasharray);\n this.overwriteSavedProp('stroke-dasharray', dasharray);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Sets any extra attributes to the DOM element of the shape\n * @param {Object} attributes - An extra attribute array to apply to the shape DOM\n * @example shape.setAttributes( { \"data-bindable\" : true } );\n * shape.applyStyle();\n * @return {Shape} The current shape\n */\n setAttributes(attributes) {\n this.setProp('attributes', attributes);\n return this;\n }\n\n overwriteSavedProp(prop, newValue) {\n util.overwriteDomAttribute(this._dom, prop, newValue);\n }\n\n /**\n * Adds an extra attribute to the shape\n * @param {String} attributeName - The name of the attribute\n * @param {String} attributeValue - The value of the attribute\n * @return {Shape} The current shape\n */\n addAttribute(attributeName, attributeValue) {\n var added = {};\n added[attributeName] = attributeValue;\n this.addProp('attributes', added);\n return this;\n }\n\n /**\n * Adds a transform property to the shape.\n * @param {String} type - The transform type (\"rotate\", \"transform\" or \"scale\")\n * @param {String} args - The arguments following the transform\n * @return {Shape} The current shape\n */\n addTransform(type, args) {\n this.addProp('transforms', {\n type: type,\n arguments: Array.isArray(args) ? args : [args]\n });\n return this;\n }\n\n /**\n * Resets the transforms\n * @see Shape#addTransform\n * @return {Shape} The current shape\n */\n resetTransforms() {\n this.resetProp('transforms');\n return this;\n }\n\n /**\n * Sets the text of the label\n * @param {String} text - The text of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelText(text, index = 0) {\n this.setProp('labelText', text, index);\n return this;\n }\n\n /**\n * Sets the text of the label\n * @param {String} data - Some additional HTML tags that will be set to the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelData(data, text, index = 0) {\n this.setProp('labelData', text, index);\n return this;\n }\n\n /**\n * Returns the text of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {String} The text of the label\n */\n getLabelText(text, index = 0) {\n return this.getProp('labelText', index);\n }\n\n /**\n * Displays a hidden label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n displayLabel(index = 0) {\n this.setProp('labelVisible', true, index);\n return this;\n }\n\n /**\n * Hides a displayed label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n hideLabel(index = 0) {\n this.setProp('labelVisible', false, index);\n return this;\n }\n\n /**\n * Sets the color of the label\n * @param {String} color - The color of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelColor(color, index = 0) {\n this.setProp('labelColor', color, index);\n return this;\n }\n\n /**\n * Sets the font size of the label\n * @param {String} size - The font size (in px) of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelFontSize(size, index = 0) {\n this.setProp('labelFontSize', size, index);\n return this;\n }\n\n /**\n * Returns the position of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Position} The current position of the label\n */\n getLabelPosition(index = 0) {\n return this.getProp('labelPosition', index);\n }\n\n /**\n * Sets the position of the label\n * @param {Position} position - The position of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelPosition(position, index) {\n\n var self;\n var pos = _graphPosition2.default.check(position, function (relativeTo) {\n return self.getRelativePosition(relativeTo);\n });\n\n this.setProp('labelPosition', pos, index || 0);\n return this;\n }\n\n /**\n * Sets the angle of the label\n * @param {Number} angle - The angle of the label in degrees (0 to 360°)\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelAngle(angle, index) {\n this.setProp('labelAngle', angle, index || 0);\n return this;\n }\n\n /**\n * Sets the baseline of the label, which affects its y position with respect to the text direction. For text along the x direction, different baselines will reference differently the text to the ```y``` coordinate.\n * @param {String} baseline - The baseline of the label. Most common baselines are ```no-change```, ```central```, ```middle``` and ```hanging```. You will find an explanation of those significations on the [corresponding MDN article]{@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/dominant-baseline}\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBaseline(baseline, index) {\n this.setProp('labelBaseline', baseline, index || 0);\n return this;\n }\n\n /**\n * Sets the anchoring of the label.\n * @param {String} anchor - The anchor of the label. Values can be ```start```, ```middle```, ```end``` or ```inherit```.\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelAnchor(anchor, index) {\n this.setProp('labelAnchor', anchor, index || 0);\n return this;\n }\n\n /**\n * Sets the anchoring of the label.\n * @param {String} size - The font size in px\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelSize(size, index) {\n this.setProp('labelSize', size, index || 0);\n return this;\n }\n\n /**\n * Sets the color of the stroke of the label.\n * @param {String} color - The color of the stroke\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelStrokeColor(color, index) {\n this.setProp('labelStrokeColor', color, index || 0);\n return this;\n }\n\n /**\n * Sets the width of the stroke of the label.\n * @param {Number} width - The width of the stroke\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelStrokeWidth(width, index) {\n this.setProp('labelStrokeWidth', width, index || 0);\n return this;\n }\n\n /**\n * Sets the color of the background of the label.\n * @param {String} color - The color of the background\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBackgroundColor(color, index) {\n this.setProp('labelBackgroundColor', color, index || 0);\n return this;\n }\n\n /**\n * Sets the opacity of the background of the label.\n * @param {Number} opacity - The opacity of the background, between 0 and 1\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBackgroundOpacity(opacity, index) {\n this.setProp('labelBackgroundOpacity', opacity, index || 0);\n return this;\n }\n\n /**\n * Applies the generic style to the shape. This is a method that applies to most shapes, hence should not be overridden. However if you create a bundle of shapes that extend another one, you may use it to set common style properties to all your shapes.\n * @return {Shape} The current shape\n */\n applyGenericStyle() {\n\n this.setDom('fill', this.getProp('fillColor'), true);\n this.setDom('fill-opacity', this.getProp('fillOpacity'), true);\n this.setDom('stroke', this.getProp('strokeColor'), true);\n this.setDom('stroke-width', this.getProp('strokeWidth'), true);\n this.setDom('stroke-dasharray', this.getProp('strokeDasharray'), true);\n\n var attributes = this.getProps('attributes');\n for (var j = 0, l = attributes.length; j < l; j++) {\n\n for (var i in attributes[j]) {\n this.setDom(i, typeof attributes[j][i] == 'function' ? attributes[j][i].call(this, i) : attributes[j][i], true);\n }\n }\n\n this._applyTransforms();\n\n return this;\n }\n\n /**\n * Applies the style to the shape. This method can be extended to apply specific style to the shapes\n * @return {Shape} The current shape\n */\n applyStyle() {\n\n return this.applyGenericStyle();\n }\n\n /**\n * Returns a computed position object\n * @param {(Number|Position)} [ index = 0 ] - The index of the position to compute\n * @param {Position} relToPosition - A base position from which to compute the position (useful for dx values)\n * @return {Object} The computed position object in the format { x: x_in_px, y: y_in_px }\n */\n calculatePosition(index) {\n\n var position;\n\n position = index instanceof _graphPosition2.default ? index : this.getPosition(index);\n\n if (!position) {\n return;\n }\n\n if (position && position.compute) {\n return position.compute(this.graph, this.getXAxis(), this.getYAxis(), this.getSerie());\n }\n\n this.graph.throw();\n }\n\n /**\n * Returns a stored position object\n * @param {Number} [ index = 0 ] - The index of the position to compute\n * @return {Position} The position at the proper index, or undefined\n */\n getPosition(index) {\n\n var pos = this.getProp('position', index || 0);\n this.setProp('position', pos = _graphPosition2.default.check(pos), index);\n return pos;\n }\n\n /**\n * Sets a position object\n * @param {Position} position - The position object to store\n * @param {Number} [ index = 0 ] - The index of the position to store\n * @return {Shape} The current shape\n */\n setPosition(position, index) {\n\n var self = this;\n var pos = _graphPosition2.default.check(position, function (relativeTo) {\n return self.getRelativePosition(relativeTo);\n });\n\n return this.setProp('position', pos, index || 0);\n }\n\n /**\n * Sorts the positions\n * @param {Function} sortFunction - Function passed into the ```Array.sort``` method\n * @return {Position} The current shape\n */\n sortPositions(sortFunction) {\n this.getProps('position').sort(sortFunction);\n return this;\n }\n\n /**\n * Applies the style to the shape. This method can be extended to apply specific style to the shapes\n * @private\n * @return {Shape} The current shape\n */\n _applyTransforms() {\n\n var transforms = this.getProp('transforms'),\n transformString = '';\n\n if (!transforms) {\n return;\n }\n transforms = Array.isArray(transforms) ? transforms : [transforms];\n\n if (transforms.length == 0) {\n return;\n }\n\n for (var i = 0; i < transforms.length; i++) {\n\n transformString += transforms[i].type + '(';\n\n switch (transforms[i].type) {\n\n case 'translate':\n\n let transform = transforms[i].arguments[0].compute(this.graph, this.getXAxis(), this.getYAxis(), this.getSerie());\n\n transformString += transform.x;\n transformString += ', ';\n transformString += transform.y;\n break;\n\n case 'rotate':\n\n transformString += transforms[i].arguments[0];\n transformString += ', ';\n\n if (transforms[i].arguments.length == 1) {\n var p = this.computePosition(0);\n transformString += p.x + ', ' + p.y;\n } else {\n\n transformString += _graphPosition2.default.getDeltaPx(transforms[i].arguments[1], this.getXAxis()).replace('px', '');\n transformString += ', ';\n transformString += _graphPosition2.default.getDeltaPx(transforms[i].arguments[2], this.getYAxis()).replace('px', '');\n }\n\n break;\n }\n\n transformString += ') ';\n }\n\n this.setDomGroup('transform', transformString);\n return this;\n }\n\n /**\n * Creates all the labels\n * @private\n * @returns {Shape} The current shape\n */\n makeLabels() {\n\n this._labels = this._labels || [];\n this._labelsBackground = this._labelsBackground || [];\n\n this._labels.map(label => {\n this.group.removeChild(label);\n });\n\n this._labelsBackground.map(bg => {\n this.group.removeChild(bg);\n });\n\n this._labels = [];\n this._labelsBackground[i] = [];\n\n var i = 0;\n\n while (this.getProp('labelText', i) !== undefined) {\n\n if (!this._labels[i]) {\n\n this._labels[i] = document.createElementNS(this.graph.ns, 'text');\n this._labels[i].setAttribute('data-label-i', i);\n this._labels[i].jsGraphIsShape = this;\n\n this._labelsBackground[i] = document.createElementNS(this.graph.ns, 'rect');\n this._labelsBackground[i].setAttribute('data-label-i', i);\n this._labelsBackground[i].jsGraphIsShape = this;\n\n this.group.appendChild(this._labelsBackground[i]);\n this.group.appendChild(this._labels[i]);\n\n this._labels[i].addEventListener('dblclick', e => {\n e.stopPropagation();\n\n this.labelDblClickListener(e);\n });\n\n this._labelsBackground[i].addEventListener('dblclick', e => {\n e.stopPropagation();\n\n this.labelDblClickListener(e);\n });\n }\n\n i++;\n }\n\n this.updateLabels();\n\n return this;\n }\n\n /**\n * Determines if the label is editable\n * @param {Number} labelIndex - The index of the label\n * @return {Boolean} ```true``` if the label is editable, ```false``` otherwise\n */\n isLabelEditable(labelIndex) {\n return this.getProp('labelEditable', labelIndex || 0);\n }\n\n /**\n * Applies the label data to the dom object\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {Shape} The current shape\n */\n updateLabels() {\n\n var self = this;\n this._labels = this._labels || [];\n\n for (var i = 0, l = this._labels.length; i < l; i++) {\n this._applyLabelData(i);\n }\n }\n\n /**\n * Applies the label data to the dom object\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {Shape} The current shape\n */\n _applyLabelData(labelIndex) {\n\n labelIndex = labelIndex || 0;\n\n /** Sets the position */\n\n var visible = this.getProp('labelVisible', labelIndex);\n\n if (visible === false) {\n this._labels[labelIndex].setAttribute('display', 'none');\n this._labelsBackground[labelIndex].setAttribute('display', 'none');\n return;\n } else {\n this._labels[labelIndex].setAttribute('display', 'initial');\n this._labelsBackground[labelIndex].setAttribute('display', 'initial');\n }\n\n var position = this.calculatePosition(_graphPosition2.default.check(this.getProp('labelPosition', labelIndex)));\n\n if (isNaN(position.x) || isNaN(position.y) || position.y === false || position.x === false) {\n /*console.warn( \"Cannot compute positioning for labelIndex \" + labelIndex + \" with text \" + this.getProp( \"labelText\", labelIndex ) );\n console.log( this, this._labels );\n console.trace();*/\n return;\n }\n\n if (position.x != 'NaNpx' && !isNaN(position.x) && position.x !== 'NaN' && position.x !== false) {\n\n this._labels[labelIndex].setAttribute('x', position.x);\n this._labels[labelIndex].setAttribute('y', position.y);\n }\n\n /** Sets the angle */\n var currAngle = this.getProp('labelAngle', labelIndex) || 0;\n if (currAngle != 0) {\n\n var x = this._labels[labelIndex].getAttribute('x'),\n y = this._labels[labelIndex].getAttribute('y');\n\n this._labels[labelIndex].setAttribute('transform', 'rotate(' + currAngle + ' ' + x + ' ' + y + ')');\n // this._labelsBackground[ labelIndex ].setAttribute( 'transform', 'rotate(' + currAngle + ' ' + x + ' ' + y + ')' );\n }\n\n let labelData = this.getProp('labelHTMLData', labelIndex) || {};\n\n for (var i in labelData) {\n\n this._labels[labelIndex].setAttribute(i, labelData[i]);\n this._labelsBackground[labelIndex].setAttribute(i, labelData[i]);\n }\n\n /** Sets the baseline */\n this._labels[labelIndex].setAttribute('dominant-baseline', this.getProp('labelBaseline', labelIndex) || 'no-change');\n\n /** Sets the text */\n this._labels[labelIndex].textContent = this.getProp('labelText', labelIndex);\n\n /** Sets the color */\n this._labels[labelIndex].setAttribute('fill', this.getProp('labelColor', labelIndex) || 'black');\n\n /** Sets the size */\n this._labels[labelIndex].setAttribute('font-size', this.getProp('labelSize', labelIndex) + 'px' || '12px');\n\n /** Sets the anchor */\n this._labels[labelIndex].setAttribute('text-anchor', this._getLabelAnchor(labelIndex));\n\n /** Sets the stroke */\n this._labels[labelIndex].setAttribute('stroke', this.getProp('labelStrokeColor', labelIndex) || 'black');\n\n /** Sets the stroke */\n this._labels[labelIndex].setAttribute('stroke-width', this.getProp('labelStrokeWidth', labelIndex) || 0 + 'px');\n\n this._labels[labelIndex].setAttribute('stroke-location', 'outside');\n\n let rect = this._labels[labelIndex].getBBox();\n\n this._labelsBackground[labelIndex].setAttribute('x', rect.x);\n this._labelsBackground[labelIndex].setAttribute('y', rect.y);\n this._labelsBackground[labelIndex].setAttribute('width', rect.width);\n this._labelsBackground[labelIndex].setAttribute('height', rect.height);\n\n this._labelsBackground[labelIndex].setAttribute('fill', this.getProp('labelBackgroundColor') || 'transparent');\n this._labelsBackground[labelIndex].setAttribute('fill-opacity', this.getProp('labelBackgroundOpacity') || 1);\n\n return this;\n }\n\n /**\n * Temporarily empties the labels, until the next rendering.\n * This is used when the shape should not be displayed\n * @returns {Shape} The current shape instance\n */\n emptyLabels() {\n\n for (var i = 0, l = this._labels.length; i < l; i++) {\n /** Sets the baseline */\n this._labels[i].textContent = '';\n }\n\n return this;\n }\n\n /**\n * Returns the anchor of the label\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {String} The anchor in SVG string\n */\n _getLabelAnchor(labelIndex) {\n var anchor = this.getProp('labelAnchor', labelIndex);\n switch (anchor) {\n case 'middle':\n case 'start':\n case 'end':\n return anchor;\n break;\n\n case 'right':\n return 'end';\n break;\n\n case 'left':\n return 'start';\n break;\n\n default:\n return 'start';\n break;\n }\n }\n\n /**\n * Returns the shape selection status\n * @returns {Boolean} true is the shape is selected, false otherwise\n */\n isSelected() {\n return this._selectStatus || false;\n }\n\n /**\n * Sets or queries whether the shape can have handles. Even if the property is set to false, the getter can return true if the property ```statichandles``` is true (used when handles never disappear)\n * @param {Boolean} setter - If used, defined if the shape has handles or not\n * @returns {Boolean} true is the shape has handles, false otherwise\n * @example Shape.hasHandles( true ); // Sets that the shape has handles\n * @example Shape.hasHandles( false ); // Sets that the shape has no handles\n * @example Shape.hasHandles( ); // Queries the shape to determine if it has handles or not. Also returns true if handles are static\n */\n hasHandles(setter) {\n\n if (setter !== undefined) {\n this.setProp('handles', setter);\n }\n\n return !!this.getProp('handles') || !!this.getProp('staticHandles');\n }\n\n /**\n * Adds shape handles\n * @private\n * @return {Shape} The current shape\n */\n addHandles() {\n\n if (this.isLocked()) {\n return;\n }\n\n if (!this.handlesInDom) {\n\n this.handlesInDom = true;\n\n for (var i = 1; i < this.handles.length; i++) {\n\n if (this.handles[i]) {\n this.group.appendChild(this.handles[i]);\n }\n }\n }\n\n return this;\n }\n\n /**\n * Remove shape handles\n * @private\n * @return {Shape} The current shape\n */\n removeHandles() {\n\n this.hideHandles();\n this.handles = [];\n }\n\n /**\n * Hide shape handles\n * @private\n * @return {Shape} The current shape\n */\n hideHandles() {\n\n if (!this.handlesInDom) {\n return this;\n }\n\n for (var i = 1; i < this.handles.length; i++) {\n this.group.removeChild(this.handles[i]);\n }\n\n this.handlesInDom = false;\n return this;\n }\n\n /**\n * @protected\n * @return {Boolean} ```true``` if the handles are in the DOM\n */\n areHandlesInDom() {\n\n return this.handlesInDom;\n }\n\n /**\n * Selects the shape. Should only be called from jsGraph main instance\n * @private\n * @param {Boolean} [ mute = false ] - Mutes the method (no event emission)\n * @returns {Shape} the current shape\n */\n _select(mute) {\n\n if (!this.isSelectable()) {\n return false;\n }\n\n // Put on the stack\n this.appendToDom();\n //this.graph.appendShapeToDom( this ); // Put the shape on top of the stack !\n\n this._selectStatus = true;\n\n this.applySelectedStyle();\n\n if (this.hasHandles() && !this.hasStaticHandles()) {\n\n this.addHandles();\n this.setHandles();\n }\n\n if (!mute) {\n this.graph.emit('shapeSelected', this);\n }\n }\n\n applySelectedStyle() {\n\n if (!this._selectStatus) {\n return;\n }\n\n var style = this.getSelectStyle();\n var style2 = {};\n for (var i in style) {\n if (typeof style[i] == 'function') {\n style2[i] = style[i].call(this);\n } else {\n style2[i] = style[i];\n }\n }\n\n util.saveDomAttributes(this._dom, style2, 'select');\n }\n\n /**\n * Unselects the shape. Should only be called from jsGraph main instance\n * @private\n * @param {Boolean} [ mute = false ] - Mutes the method (no event emission)\n * @returns {Shape} the current shape\n */\n _unselect(mute) {\n\n this._selectStatus = false;\n\n util.restoreDomAttributes(this._dom, 'select');\n\n if (this.hasHandles() && !this.hasStaticHandles()) {\n this.hideHandles();\n }\n\n if (!mute) {\n this.graph.emit('shapeUnselected', this);\n }\n }\n\n /**\n * Returns the special style of the shape when it is selected.\n * @see Shape#setSelectStyle\n * @param {Object} The SVG attributes to apply to the shape\n */\n getSelectStyle() {\n return this.selectStyle;\n }\n\n /**\n * Defines the style that is applied to the shape when it is selected. The style extends the default style of the shape\n * @param {Object} [ attr = {} ] - The SVG attributes to apply to the shape\n * @example rectangle.setSelectStyle( { fill: 'red' } );\n * @returns {Shape} the current shape\n */\n setSelectStyle(attr) {\n this.selectStyle = attr;\n this.applySelectedStyle(); // Maybe the shape is already selected\n return this;\n }\n\n /**\n * Assigns static handles to the shape. In this mode, handles will not disappear\n * @param {Boolean} staticHandles - true to enable static handles, false to disable them.\n * @returns {Shape} the current shape\n */\n setStaticHandles(staticHandles) {\n this.setProp('staticHandles', staticHandles);\n }\n\n /**\n * @returns {Boolean} ```true``` if the shape has static handles, ```false``` otherwise\n */\n hasStaticHandles(staticHandles) {\n return !!this.getProp('staticHandles');\n }\n\n /**\n * Creates the handles for the shape\n * @param {Number} nb - The number of handles\n * @param {String} type - The type of SVG shape to use\n * @param {Object} [ attr = {} ] - The SVG attributes to apply to the handles\n * @param {Function} [ callbackEach ] - An additional callback the user can provide to further personalize the handles\n * @returns {Shape} the current shape\n * @private\n */\n _createHandles(nb, type, attr, callbackEach) {\n\n if (this.handles && this.handles.length > 0) {\n return;\n }\n\n var self = this;\n\n for (var i = 1, l = nb; i <= l; i++) {\n\n (j => {\n\n var self = this;\n\n var handle = document.createElementNS(self.graph.ns, type);\n handle.jsGraphIsShape = true;\n\n if (attr) {\n for (var k in attr) {\n handle.setAttribute(k, attr[k]);\n }\n }\n\n handle.addEventListener('mousedown', e => {\n\n if (self.isResizable()) {\n\n e.preventDefault();\n e.stopPropagation();\n\n self.graph.emit('beforeShapeResize', self);\n this.emit('beforeShapeResize');\n\n if (!self.graph.prevent(false)) {\n\n self.resizing = true;\n self.handleSelected = j;\n self.handleMouseDown(e);\n }\n }\n });\n\n if (callbackEach) {\n callbackEach(self.handles[j]);\n }\n\n self.handles[j] = handle;\n }).call(this, i);\n }\n\n return this.handles;\n }\n\n /**\n * Creates the handles for the shape. Should be implemented by the children shapes classes.\n */\n createHandles() {\n\n if (this.hasStaticHandles()) {\n this.addHandles();\n this.setHandles();\n }\n }\n\n /**\n * Handles mouse down event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseDownImpl() {}\n\n /**\n * Handles the mouse move event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseMoveImpl() {}\n\n /**\n * Handles mouse up event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseUpImpl() {}\n\n /**\n * Called when the shape is created\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleCreateImpl() {}\n\n /**\n * Handles mouse down events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDownImpl} method.prototype\n */\n handleMouseDown(e) {\n\n //this.handleSelected = false;\n\n if (this.isLocked()) {\n return;\n }\n\n if (this.isMovable() || this.isResizable()) {\n\n this.graph.elementMoving(this);\n }\n\n if (this.getProp('selectOnMouseDown')) {\n this.graph.selectShape(this);\n }\n\n if (this.isMovable()) {\n if (!this.resizing) {\n\n this.graph.emit('beforeShapeMove', self);\n\n if (!this.graph.prevent(false)) {\n\n this.moving = true;\n this.moved = false;\n }\n }\n }\n\n this._mouseCoords = this.graph._getXY(e);\n return this.handleMouseDownImpl(e, this._mouseCoords);\n }\n\n /**\n * Handles mouse click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDownClick} method\n * @private\n */\n handleClick(e) {\n\n this.graph.emit('shapeClicked', this);\n this.emit('shapeClicked');\n\n if (!this.isSelectable()) {\n return false;\n }\n\n if (!e.shiftKey) {\n this.graph.unselectShapes();\n }\n\n if (this.getProp('selectOnClick')) {\n\n this.graph.selectShape(this);\n }\n }\n\n /**\n * Handles mouse click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseUpImpl} method\n * @private\n */\n handleMouseMove(e) {\n //console.log( this.resizinh, this.moving, this.isSelected(), this._mouseCoords );\n if ((this.resizing || this.moving) && !this.isSelected()) {\n this.graph.selectShape(this);\n }\n\n this.graph.emit('beforeShapeMouseMove', this);\n this.emit('beforeShapeMouseMove');\n\n if (this.graph.prevent(false) || !this._mouseCoords) {\n return false;\n }\n\n this.moved = true;\n var coords = this.graph._getXY(e);\n var deltaX = this.getXAxis().getRelVal(coords.x - this._mouseCoords.x),\n deltaY = this.getYAxis().getRelVal(coords.y - this._mouseCoords.y);\n\n if (deltaX != 0 || deltaY !== 0) {\n this.preventUnselect = true;\n }\n\n this._mouseCoords = coords;\n\n var ret = this.handleMouseMoveImpl(e, deltaX, deltaY, coords.x - this._mouseCoords.x, coords.y - this._mouseCoords.y);\n\n return ret;\n }\n\n /**\n * Handles mouse up events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseUpImpl} method\n * @private\n */\n handleMouseUp(e) {\n\n if (this.moving && this.moved) {\n\n this.graph.emit('shapeMoved', this);\n this.emit('shapeMoved');\n }\n\n if (this.handleSelected || this.resize) {\n\n this.graph.emit('shapeResized', this);\n this.emit('shapeResized');\n }\n\n this.moving = false;\n this.resizing = false;\n this.handleSelected = false;\n this.graph.elementMoving(false);\n\n return this.handleMouseUpImpl(e);\n }\n\n /**\n * Handles double click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDblClickImpl} method\n * @private\n */\n handleDblClick(e) {}\n\n /**\n * Handles mouse over events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseOverImpl} method\n * @private\n */\n handleMouseOver() {\n\n if (this.getProp('highlightOnMouseOver')) {\n\n if (!this.moving && !this.resizing) {\n this.highlight();\n }\n }\n\n this.graph.emit('shapeMouseOver', this);\n }\n\n /**\n * Handles mouse out events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseOutImpl} method\n * @private\n */\n handleMouseOut() {\n\n if (this.getProp('highlightOnMouseOver')) {\n this.unHighlight();\n }\n\n this.graph.emit('shapeMouseOut', this);\n }\n\n /*\n * Updated July 1st, 2015\n */\n\n /**\n * Locks the shape (prevents selection, resizing and moving)\n * @return {Shape} The current shape\n */\n lock() {\n this.setProp('locked', true);\n return this;\n }\n\n /**\n * Unlocks the shape (prevents selection, resizing and moving)\n * @return {Shape} The current shape\n */\n unlock() {\n this.setProp('locked', false);\n return this;\n }\n\n /**\n * @return {Boolean} True if the shape is locked, false otherwise\n */\n isLocked() {\n return this.getProp('locked') || this.graph.shapesLocked;\n }\n\n /**\n * Makes the shape moveable\n * @return {Shape} The current shape\n */\n movable(bln) {\n this.setProp('movable', true);\n }\n\n /**\n * Makes the shape non-moveable\n * @return {Shape} The current shape\n */\n unmovable() {\n this.setProp('movable', false);\n return false;\n }\n\n /**\n * @return {Boolean} True if the shape is movable, false otherwise\n */\n isMovable() {\n return this.getProp('movable');\n }\n\n /**\n * Makes the shape resizable\n * @return {Shape} The current shape\n */\n resizable() {\n this.setProp('resizable', true);\n }\n\n /**\n * Makes the shape non-resizable\n * @return {Shape} The current shape\n */\n unresizable() {\n this.setProp('resizable', false);\n }\n\n /**\n * @return {Boolean} True if the shape is resizable, false otherwise\n */\n isResizable() {\n return this.getProp('resizable');\n }\n\n /**\n * Makes the shape selectable\n * @return {Shape} The current shape\n */\n selectable() {\n this.setProp('selectable', true);\n }\n\n /**\n * Makes the shape non-selectable\n * @return {Shape} The current shape\n */\n unselectable() {\n this.graph.unselectShape(this);\n this.setProp('selectable', false);\n }\n\n /**\n * @return {Boolean} True if the shape is selectable, false otherwise\n */\n isSelectable() {\n return this.getProp('selectable');\n }\n\n /**\n * Highlights the shape with attributes\n * @returns {Shape} The current shape\n * @param {Object} [ attributes ] - A hashmap of attributes to apply. If omitted, {@link Shape#getHighlightAttributes} will be called\n * @param {String} [ saveDomName=highlight ] - The name to which the current shape attributes will be saved to be recovered later with the {@link Shape#unHighlight} method\n * @example shape.highlight( { fill: 'red', 'fill-opacity': 0.5 } );\n * @see Shape#unHighlight\n */\n highlight(attributes, saveDomName) {\n\n if (!attributes) {\n attributes = this.getHighlightAttributes();\n }\n\n if (!saveDomName) {\n saveDomName = 'highlight';\n }\n\n util.saveDomAttributes(this._dom, attributes, saveDomName);\n this.highlightImpl();\n return this;\n }\n\n /**\n * Removes the highlight properties from the same\n * @returns {Shape} The current shape\n * @param {String} [ saveDomName=highlight ] - The name to which the current shape attributes will be saved to be recovered later with the {@link Shape#unHighlight} method\n * @see Shape#highlight\n */\n unHighlight(saveDomName) {\n\n if (!saveDomName) {\n saveDomName = 'highlight';\n }\n\n util.restoreDomAttributes(this._dom, saveDomName);\n this.unHighlightImpl();\n return this;\n }\n\n highlightImpl() {}\n unHighlightImpl() {}\n\n /**\n * @returns {Object} The attributes taken by the shape when highlighted\n * @see Shape#highlight\n */\n getHighlightAttributes() {\n return this._highlightAttributes;\n }\n\n /**\n * Sets the attributes the shape will take when highlighted\n * @param {Object} [ attributes ] - A hashmap of attributes to apply when the shape is highlighted\n * @returns {Shape} The current shape\n * @see Shape#highlight\n */\n setHighlightAttributes(attributes) {\n this._highlightAttributes = attributes;\n return this;\n }\n\n /**\n * Returns the masking id of the shape. Returns null if the shape does not behave as a mask\n * @returns {String} The ```id``` attribute of the shape\n */\n getMaskingID() {\n return this.maskingId;\n }\n\n /**\n * Masks the current shape with another shape passed as the first parameter of the method\n * @param {Shape} maskingShape - The shape used to mask the current shape\n * @return {Shape} The current shape\n */\n maskWith(maskingShape) {\n\n const maskingId = maskingShape.getMaskingID();\n\n if (maskingId) {\n\n this._dom.setAttribute('mask', 'url(#' + maskingId + ')');\n } else {\n\n this._dom.removeAttribute('mask');\n }\n }\n\n /**\n * Manually updates the mask of the shape. This is needed because the shape needs to be surrounded by a white rectangle (because transparent is treated as black and will not render the shape)\n * This method will work well for rectangles but should be overridden for other shapes\n * @return {Shape} The current shape\n * @todo Explore a way to make it compatible for all kinds of shapes. Maybe the masker position should span the whole graph...\n */\n updateMask() {\n return;\n if (!this.maskDom) {\n return; // eslint-disable-line no-useless-return\n }\n\n var position = {\n x: 'min',\n y: 'min'\n };\n var position2 = {\n x: 'max',\n y: 'max'\n };\n\n position = this._getPosition(position);\n position2 = this._getPosition(position2);\n\n this.maskDomWrapper.setAttribute('x', Math.min(position.x, position2.x));\n this.maskDomWrapper.setAttribute('y', Math.min(position.y, position2.y));\n\n this.maskDomWrapper.setAttribute('width', Math.abs(position2.x - position.x));\n this.maskDomWrapper.setAttribute('height', Math.abs(position2.y - position.y));\n\n for (var i = 0; i < this._dom.attributes.length; i++) {\n this.maskDom.setAttribute(this._dom.attributes[i].name, this._dom.attributes[i].value);\n }\n\n this.maskDom.setAttribute('fill', 'black');\n\n return this;\n }\n\n labelDblClickListener(e) {\n\n var i = parseInt(e.target.getAttribute('data-label-i'));\n\n var self = this;\n\n if (isNaN(i)) {\n return;\n }\n\n if (!this.isLabelEditable(i)) {\n return;\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n var shapeLabel = document.createElement('input');\n shapeLabel.setAttribute('type', 'text');\n shapeLabel.setAttribute('value', self.getProp('labelText', i));\n\n self.graph.wrapper.prepend(shapeLabel);\n shapeLabel.select();\n\n util.setCSS(shapeLabel, {\n position: 'absolute',\n marginTop: parseInt(e.target.getAttribute('y').replace('px', '')) + this.graph.getPaddingTop() - 10 + 'px',\n marginLeft: parseInt(e.target.getAttribute('x').replace('px', '')) + this.graph.getPaddingLeft() - 50 + 'px',\n textAlign: 'center',\n width: '100px'\n });\n\n const previousValue = self.getLabelText(i);\n\n const blurEvent = function () {\n\n self.setLabelText(shapeLabel.value, i);\n self._labels[i].textContent = shapeLabel.value;\n\n const nextValue = shapeLabel.value;\n\n shapeLabel.remove();\n shapeLabel.removeEventListener('blur', blurEvent);\n shapeLabel = false;\n\n self.changed('shapeLabelChanged', {\n previousValue: previousValue,\n nextValue: nextValue\n });\n };\n\n shapeLabel.addEventListener('blur', blurEvent);\n\n shapeLabel.addEventListener('keyup', function (e) {\n\n if (e.keyCode === 13) {\n blurEvent();\n }\n });\n shapeLabel.addEventListener('keypress', function (e) {\n e.stopPropagation();\n });\n shapeLabel.addEventListener('keydown', function (e) {\n e.stopPropagation();\n });\n shapeLabel.focus();\n }\n\n /**\n * Appends the shape DOM to its parent\n * @private\n * @return {Shape} The current shape\n */\n appendToDom() {\n\n if (this._forcedParentDom) {\n\n this._forcedParentDom.appendChild(this.group);\n } else {\n this.graph.appendShapeToDom(this);\n }\n return this;\n }\n\n /**\n * Forces the DOM parent (instead of the normal layer)\n * @return {Shape} The current shape\n */\n forceParentDom(dom) {\n\n this._forcedParentDom = dom;\n\n return this;\n }\n\n isHTML() {\n return false;\n }\n }\n\n /**\n * @alias Shape#calculatePosition\n */\n Shape.prototype.computePosition = Shape.prototype.calculatePosition;\n\n /**\n * @alias Shape#displayLabel\n */\n Shape.prototype.showLabel = Shape.prototype.displayLabel;\n\n /**\n * @alias Shape#kill\n */\n Shape.prototype.remove = Shape.prototype.kill;\n\n exports.default = Shape;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(7)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../dependencies/eventEmitter/EventEmitter.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.EventEmitter);\n global.graphPlugin = mod.exports;\n }\n})(this, function (module, exports, _EventEmitter) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _EventEmitter2 = _interopRequireDefault(_EventEmitter);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Represents a plugin\n * @interface\n */\n class Plugin extends _EventEmitter2.default {\n\n static default() {\n return {};\n }\n\n constructor(options) {\n super(...arguments);\n\n this.options = Object.assign({}, Plugin.default(), this.constructor.default(), options);\n }\n\n /**\n * Init function called by jsGraph on load\n */\n init(graph) {\n this.graph = graph;\n }\n\n /**\n * Handles the mousedown event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseDown() {}\n\n /**\n * Handles the mouseup event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseUp() {}\n\n /**\n * Handles the mousemove event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseMove() {}\n }\n\n exports.default = Plugin;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(6), __webpack_require__(0), __webpack_require__(7), __webpack_require__(4)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.position.js'), require('./graph.util.js'), require('./dependencies/eventEmitter/EventEmitter.js'), require('./util/waveform.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphPosition, global.graphUtil, global.EventEmitter, global.waveform);\n global.graphCore = mod.exports;\n }\n})(this, function (module, exports, _graphPosition, _graphUtil, _EventEmitter, _waveform) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphPosition2 = _interopRequireDefault(_graphPosition);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _EventEmitter2 = _interopRequireDefault(_EventEmitter);\n\n var _waveform2 = _interopRequireDefault(_waveform);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Default graph parameters\n * @name Graph~GraphOptionsDefault\n * @name GraphOptions\n * @object\n * @static\n * @memberof Graph\n * @prop {String} title - Title of the graph\n * @prop {Number} paddingTop - The top padding\n * @prop {Number} paddingLeft - The left padding\n * @prop {Number} paddingRight - The right padding\n * @prop {Number} paddingBottom - The bottom padding\n * @prop {(Number|Boolean)} padding - A common padding value for top, bottom, left and right\n * @prop {Number} fontSize - The basic text size of the graphs\n * @prop {Number} fontFamily - The basic font family. Should be installed on the computer of the user\n * @prop {Object.} plugins - A list of plugins to import with their options\n * @prop {Object.} pluginAction - The default key combination to access those actions\n * @prop {Object.} mouseActions - Alias of pluginActions\n * @prop {Object.} keyActions - Defines what happens when keys are pressed\n * @prop {Object} wheel - Define the mouse wheel action\n * @prop {Object} dblclick - Define the double click action\n * @prop {Boolean} shapesUniqueSelection - true to allow only one shape to be selected at the time\n * @prop {Boolean} shapesUnselectOnClick - true to unselect all shapes on click\n */\n const GraphOptionsDefault = {\n\n title: '',\n\n paddingTop: 30,\n paddingBottom: 5,\n paddingLeft: 20,\n paddingRight: 20,\n\n close: {\n left: true,\n right: true,\n top: true,\n bottom: true\n },\n\n closeColor: 'black',\n\n fontSize: 12,\n fontFamily: 'Myriad Pro, Helvetica, Arial',\n\n plugins: {},\n pluginAction: {},\n mouseActions: [],\n keyActions: [],\n wheel: {},\n dblclick: {},\n\n shapesUnselectOnClick: true,\n shapesUniqueSelection: true\n };\n\n const defaultScatterStyle = {\n shape: 'circle',\n r: 4\n };\n\n var _constructors = new Map();\n\n /**\n * Entry class of jsGraph that creates a new graph.\n * @extends EventEmitter\n * @tutorial basic\n */\n class Graph extends _EventEmitter2.default {\n\n /**\n * Graph constructor\n * @param {(HTMLElement|String)} [wrapper ] - The DOM Wrapper element its ```id``` property. If you do not use the wrapper during the graph creation, use it with the @link{Graph.setWrapper} method\n * @param {GraphOptions} [ options ] - The options of the graph\n * @param {Object} [ axis ] - The list of axes\n * @param {Array} axis.left - The list of left axes\n * @param {Array} axis.bottom - The list of bottom axes\n * @param {Array} axis.top - The list of top axes\n * @param {Array} axis.right - The list of right axes\n * @example var graph = new Graph(\"someDomID\");\n * @example var graph = new Graph(\"someOtherDomID\", { title: 'Graph title', paddingRight: 100 } );\n */\n constructor(wrapper, options, axis) {\n\n super();\n\n /*\n The unique ID of the graph\n @name Graph#uniqueid\n @type String\n */\n this._creation = util.guid();\n this._drawn = false;\n\n if (wrapper === Object(wrapper) && !(wrapper instanceof HTMLElement)) {\n // Wrapper is options\n axis = options;\n options = wrapper;\n wrapper = null;\n } else if (typeof wrapper == 'string') {\n wrapper = document.getElementById(wrapper);\n } else if (typeof wrapper.length == 'number') {\n wrapper = wrapper[0];\n }\n\n /**\n * @object\n * @memberof Graph\n * @name Graph#options\n * @type GraphOptions\n * @default {@link GraphOptionsDefault}\n * Access directly the options of the graph using this public object.\n * @example graph.options.mouseActions.push( { } );\n */\n this.options = util.extend({}, GraphOptionsDefault, options);\n // Options declaration must be placed before the doDom operation\n\n // doDom is a private method. We bind it to this thanks to ES6 features\n doDom.bind(this)();\n\n if (wrapper) {\n this.setWrapper(wrapper);\n }\n\n this.prevented = false;\n\n this.axis = {\n left: [],\n top: [],\n bottom: [],\n right: []\n };\n\n this.shapes = [];\n this.shapesLocked = false;\n this.plugins = {};\n\n for (var i in this.options.pluginAction) {\n this.options.pluginAction.plugin = i;\n this.options.mouseActions.push(this.options.pluginAction);\n }\n\n this.selectedShapes = [];\n\n this.series = [];\n //this._dom = wrapper;\n this._axesHaveChanged = true;\n\n if (this.options.hasOwnProperty('padding') && util.isNumeric(this.options.padding)) {\n this.options.paddingTop = this.options.paddingBottom = this.options.paddingLeft = this.options.paddingRight = this.options.padding;\n }\n\n this.currentAction = false;\n\n this.ns = Graph.ns;\n this.nsxlink = Graph.nsxlink;\n\n // Load all axes\n if (axis) {\n for (var i in axis) {\n for (var j = 0, l = axis[i].length; j < l; j++) {\n\n switch (i) {\n\n case 'top':\n this.getTopAxis(j, axis[i][j]);\n break;\n case 'left':\n this.getLeftAxis(j, axis[i][j]);\n break;\n case 'right':\n this.getRightAxis(j, axis[i][j]);\n break;\n case 'bottom':\n this.getBottomAxis(j, axis[i][j]);\n break;\n\n default:\n // Do not do anything\n break;\n }\n }\n }\n }\n\n this._pluginsInit();\n }\n\n setWrapper(wrapper) {\n\n if (!wrapper) {\n throw new Error('The wrapper DOM element was not found.');\n }\n\n if (!wrapper.appendChild) {\n throw new Error('The wrapper appears to be an invalid HTMLElement');\n }\n\n wrapper.style['-webkit-user-select'] = 'none';\n wrapper.style['-moz-user-select'] = 'none';\n wrapper.style['-o-user-select'] = 'none';\n wrapper.style['-ms-user-select'] = 'none';\n wrapper.style['user-select'] = 'none';\n\n wrapper.style.position = 'relative';\n wrapper.style.outline = 'none';\n\n // Why would that be necessary ?\n // wrapper.setAttribute( 'tabindex', 1 );\n\n this.wrapper = wrapper;\n\n // DOM\n\n if (!this.height || !this.width) {\n var wrapperStyle = getComputedStyle(wrapper);\n var w = parseInt(wrapperStyle.width, 10);\n var h = parseInt(wrapperStyle.height, 10);\n this.setSize(w, h);\n this._resize();\n }\n\n wrapper.appendChild(this.dom);\n\n _registerEvents(this);\n }\n /**\n * Returns the graph SVG wrapper element\n * @public\n * @return {SVGElement} The DOM element wrapping the graph\n */\n getDom() {\n return this.dom;\n }\n\n /**\n * Returns the unique id representing the graph\n * @public\n * @return {String} The unique ID of the graph\n */\n getId() {\n return this._creation;\n }\n\n /**\n * Returns the graph wrapper element passed during the graph creation\n * @public\n * @return {HTMLElement} The DOM element wrapping the graph\n */\n getWrapper() {\n return this.wrapper;\n }\n\n /**\n * Sets an option of the graph\n * @param {String} name - Option name\n * @param value - New option value\n * @returns {Graph} - Graph instance\n */\n setOption(name, val) {\n this.options[name] = val;\n return this;\n }\n\n /**\n * Sets the title of the graph\n */\n setTitle(title) {\n this.options.title = title;\n this.domTitle.textContent = title;\n }\n\n /**\n * Shows the title of the graph\n */\n displayTitle() {\n this.domTitle.setAttribute('display', 'inline');\n }\n\n /**\n * Hides the title of the graph\n */\n hideTitle() {\n this.domTitle.setAttribute('display', 'none');\n }\n\n hide() {\n if (this.dom.style.display !== 'none') {\n this.dom.style.display = 'none';\n }\n }\n\n show() {\n if (this.dom.style.display == 'none') {\n this.dom.style.display = 'initial';\n }\n }\n\n /**\n * Calls a repaint of the container. Used internally when zooming on the graph, or when .autoscaleAxes() is called (see {@link Graph#autoscaleAxes}).
\n * To be called after axes min/max are expected to have changed (e.g. after an axis.zoom( from, to )) has been called\n * @param {Boolean} onlyIfAxesHaveChanged - Triggers a redraw only if min/max values of the axes have changed.\n * @return {Boolean} if the redraw has been successful\n */\n redraw(onlyIfAxesHaveChanged, force) {\n\n if (!this.width || !this.height) {\n return;\n }\n\n if (!this.sizeSet) {\n this._resize();\n this.executeRedrawSlaves();\n return true;\n } else {\n\n if (!onlyIfAxesHaveChanged || force || haveAxesChanged(this) || hasSizeChanged(this)) {\n this.executeRedrawSlaves();\n refreshDrawingZone(this);\n return true;\n }\n }\n\n this.executeRedrawSlaves(true);\n return false;\n }\n\n executeRedrawSlaves() {\n this._pluginsExecute('preDraw');\n }\n\n /**\n * Draw the graph and the series. This method will only redraw what is necessary. You may trust its use when you have set new data to series, changed serie styles or called for a zoom on an axis.\n */\n draw(force) {\n\n this.drawn = true;\n this.updateLegend(true);\n this.drawSeries(this.redraw(true, force));\n\n this._pluginsExecute('postDraw');\n }\n\n /**\n * Prevents the graph, the series and the legend from redrawing automatically. Valid until {@link Graph#resumeUpdate} is called\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#resumeUpdate}\n * @see {@link Graph#doUpdate}\n * @since 1.16.19\n */\n delayUpdate() {\n this._lockUpdate = true;\n return this;\n }\n\n /**\n * Forces legend and graph update, even is {@link Graph#delayUpdate} has been called before.\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#delayUpdate}\n * @see {@link Graph#resumeUpdate}\n * @since 1.16.19\n */\n doUpdate() {\n if (this.legend) {\n this.legend.update();\n }\n this.draw();\n if (this.legend) {\n this.legend.update();\n }\n return this;\n }\n\n /**\n * Cancels the effect of {@link Graph#delayUpdate}, but does not redraw the graph automatically\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#delayUpdate}\n * @see {@link Graph#doUpdate}\n * @since 1.16.19\n */\n resumeUpdate() {\n this._lockUpdate = false;\n return this;\n }\n\n isDelayedUpdate() {\n return this._lockUpdate;\n }\n\n /**\n * Sets the total width of the graph\n * @param {Number} width - The new width of the graph\n * @param {Boolean} skipResize - true to defer graph repaint. Use {@link Graph#resize} to force repain later on. (Useful if many graph sizing operations are done successively)\n * @see Graph#setHeight\n * @see Graph#resize\n */\n setWidth(width, skipResize) {\n this.width = width;\n if (!skipResize) {\n this._resize();\n }\n }\n\n /**\n * Sets the total height of the graph\n * @param {Number} height - The new height of the graph\n * @param {Boolean} skipResize - true to defer graph repaint. Use {@link Graph#resize} to force repain later on. (Useful if many graph sizing operations are done successively)\n * @see Graph#setWidth\n * @see Graph#resize\n */\n setHeight(height, skipResize) {\n this.height = height;\n if (!skipResize) {\n this._resize();\n }\n }\n\n /**\n * Sets the new dimension of the graph and repaints it. If width and height are omitted, a simple refresh is done.\n * @param {Number} [ width ] - The new width of the graph\n * @param {Number} [ height ] - The new height of the graph\n * @see Graph#setWidth\n * @see Graph#setHeight\n * @return {Graph} The current graph\n */\n resize(w, h) {\n if (w && h) {\n this.setSize(w, h);\n }\n\n this._resize();\n return this;\n }\n\n /**\n * Sets the new dimension of the graph without repainting it. Use {@link Graph#resize} to perform the actual resizing of the graph.\n * @param {Number} [ width ] - The new width of the graph\n * @param {Number} [ height ] - The new height of the graph\n * @see Graph#setWidth\n * @see Graph#setHeight\n * @see Graph#resize\n */\n setSize(w, h) {\n this.setWidth(w, true);\n this.setHeight(h, true);\n this.getDrawingHeight();\n this.getDrawingWidth();\n }\n\n /**\n * Returns the width of the graph (set by setSize, setWidth or resize methods)\n * @return {Number} Width of the graph\n */\n getWidth() {\n return this.width;\n }\n\n /**\n * Returns the height of the graph (set by setSize, setHeight or resize methods)\n * @return {Number} Height of the graph\n */\n getHeight() {\n return this.height;\n }\n\n /**\n * Returns the top padding of the graph (space between the top of the svg container and the topmost axis)\n * @return {Number} paddingTop\n */\n getPaddingTop() {\n return this.options.paddingTop;\n }\n\n /**\n * Returns the left padding of the graph (space between the left of the svg container and the leftmost axis)\n * @return {Number} paddingTop\n */\n getPaddingLeft() {\n return this.options.paddingLeft;\n }\n\n /**\n * Returns the bottom padding of the graph (space between the bottom of the svg container and the bottommost axis)\n * @return {Number} paddingTop\n */\n getPaddingBottom() {\n return this.options.paddingBottom;\n }\n\n /**\n * Returns the right padding of the graph (space between the right of the svg container and the rightmost axis)\n * @return {Number} paddingRight\n */\n getPaddingRight() {\n return this.options.paddingRight;\n }\n\n /**\n * Returns the height of the drawable zone, including the space used by the axes\n * @param {Boolean} useCache - Use cached value. Useful if one is sure the graph hasn't changed dimension. Automatically called after a Graph.resize();\n * @returns {Number} Height of the graph\n */\n getDrawingHeight(useCache) {\n if (useCache && this.innerHeight) {\n return this.innerHeight;\n }\n return this.innerHeight = this.height - this.options.paddingTop - this.options.paddingBottom;\n }\n\n /**\n * Returns the width of the drawable zone, including the space used by the axes\n * @param {Boolean} useCache - Use cached value. Useful if one is sure the graph hasn't changed dimension. Automatically called after a Graph.resize();\n * @returns {Number} Width of the graph\n */\n getDrawingWidth(useCache) {\n if (useCache && this.innerWidth) {\n return this.innerWidth;\n }\n return this.innerWidth = this.width - this.options.paddingLeft - this.options.paddingRight;\n }\n\n /**\n * Caches the wrapper offset in the page.
\n * The position of the wrapper is used when processing most of mouse events and it is fetched via the jQuery function .offset().\n * If performance becomes a critical issue in your application, cacheOffset() should be used to store the offset position. It should be ensured that the graph doesn't move in the page. If one can know when the graph has moved, cacheOffset() should be called again to update the offset position.\n * @see Graph#uncacheOffset\n */\n cacheOffset() {\n this.offsetCached = util.getOffset(this.wrapper);\n }\n\n /**\n * Un-caches the wrapper offset value\n * @see Graph#cacheOffset\n */\n uncacheOffset() {\n this.offsetCached = false;\n }\n\n /**\n * Returns the x axis at a certain index. If any top axis exists and no bottom axis exists, returns or creates a top axis. Otherwise, creates or returns a bottom axis\n * Caution ! The options parameter will only be effective if an axis is created\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getXAxis(index, options) {\n if (this.axis.top.length > 0 && this.axis.bottom.length == 0) {\n return this.getTopAxis(index, options);\n }\n\n return this.getBottomAxis(index, options);\n }\n\n /**\n * Returns the y axis at a certain index. If any right axis exists and no left axis exists, returns or creates a right axis. Otherwise, creates or returns a left axis\n * Caution ! The options parameter will only be effective if an axis is created\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getYAxis(index, options) {\n\n if (this.axis.right.length > 0 && this.axis.left.length == 0) {\n return this.getRightAxis(index, options);\n }\n\n return this.getLeftAxis(index, options);\n }\n\n /**\n * Returns the top axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getTopAxis(index, options) {\n return _getAxis(this, index, options, 'top');\n }\n\n /**\n * Returns the bottom axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getBottomAxis(index, options) {\n return _getAxis(this, index, options, 'bottom');\n }\n\n /**\n * Returns the left axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getLeftAxis(index, options) {\n return _getAxis(this, index, options, 'left');\n }\n\n /**\n * Returns the right axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getRightAxis(index, options) {\n return _getAxis(this, index, options, 'right');\n }\n\n /**\n * Sets a bottom axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n */\n setXAxis(axis, index) {\n this.setBottomAxis(axis, index);\n }\n\n /**\n * Sets a left axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n */\n setYAxis(axis, index) {\n this.setLeftAxis(axis, index);\n }\n\n /**\n * Sets a left axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setTopAxis\n * @see Graph#setRightAxis\n * @see Graph#getLeftAxis\n * @see Graph#getYAxis\n */\n setLeftAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.left[index]) {\n this.axis.left[index].kill();\n }\n this.axis.left[index] = axis;\n }\n\n /**\n * Sets a right axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setLeftAxis\n * @see Graph#setTopAxis\n * @see Graph#getRightAxis\n * @see Graph#getYAxis\n */\n setRightAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.right[index]) {\n this.axis.right[index].kill();\n }\n this.axis.right[index] = axis;\n }\n\n /**\n * Sets a top axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setLeftAxis\n * @see Graph#setRightAxis\n * @see Graph#getBottomAxis\n * @see Graph#getXAxis\n */\n setTopAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.top[index]) {\n this.axis.top[index].kill();\n }\n this.axis.top[index] = axis;\n }\n\n /**\n * Sets a bottom axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setTopAxis\n * @see Graph#setLeftAxis\n * @see Graph#setRightAxis\n * @see Graph#getTopAxis\n * @see Graph#getXAxis\n */\n setBottomAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.bottom[index]) {\n this.axis.bottom[index].kill();\n }\n this.axis.bottom[index] = axis;\n }\n\n killAxis(axis, noRedraw = false, noSerieKill = false) {\n\n var index;\n\n if (axis.isX()) {\n\n if ((index = this.axis.bottom.indexOf(axis)) > -1) {\n this.axis.bottom.splice(index, 1);\n }\n\n if ((index = this.axis.top.indexOf(axis)) > -1) {\n this.axis.top.splice(index, 1);\n }\n\n if (!noSerieKill) {\n this.series.forEach(serie => {\n\n if (serie.getXAxis() == axis) {\n serie.kill();\n }\n });\n }\n }\n\n if (axis.isY()) {\n\n if ((index = this.axis.left.indexOf(axis)) > -1) {\n this.axis.left.splice(index, 1);\n }\n\n if ((index = this.axis.right.indexOf(axis)) > -1) {\n this.axis.right.splice(index, 1);\n }\n\n if (!noSerieKill) {\n this.series.forEach(serie => {\n\n if (serie.getYAxis() == axis) {\n serie.kill();\n }\n });\n }\n }\n\n this.axisGroup.removeChild(axis.group); // Removes all DOM\n this.groupPrimaryGrids.removeChild(axis.gridPrimary);\n this.groupSecondaryGrids.removeChild(axis.gridSecondary);\n\n if (!noRedraw) {\n this.draw(true);\n }\n }\n\n /**\n * Determines if an x axis belongs to the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasXAxis(axis) {\n return this.hasTopAxis(axis) || this.hasBottomAxis(axis);\n }\n\n /**\n * Determines if an x axis belongs to the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasYAxis(axis) {\n return this.hasLeftAxis(axis) || this.hasRightAxis(axis);\n }\n\n /**\n * Determines if an x axis belongs to top axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasTopAxis(axis) {\n return this.hasAxis(axis, this.axis.top);\n }\n\n /**\n * Determines if an x axis belongs to bottom axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasBottomAxis(axis) {\n return this.hasAxis(axis, this.axis.bottom);\n }\n\n /**\n * Determines if a y axis belongs to left axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasLeftAxis(axis) {\n return this.hasAxis(axis, this.axis.left);\n }\n\n /**\n * Determines if a y axis belongs to right axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasRightAxis(axis) {\n return this.hasAxis(axis, this.axis.right);\n }\n\n /**\n * Determines if an axis belongs to a list of axes\n * @param {Axis} axis - The axis instance to check\n * @param {Array} axisList - The list of axes to check\n * @private\n */\n hasAxis(axis, axisList) {\n for (var i = 0, l = axisList.length; i < l; i++) {\n if (axisList[i] == axis) {\n return true;\n }\n\n if (axisList[i].hasAxis(axis)) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Autoscales the x and y axes of the graph.\n * Does not repaint the canvas\n * @return {Graph} The current graph instance\n */\n autoscaleAxes() {\n\n this._applyToAxes('setMinMaxToFitSeries', null, true, true);\n\n //this._applyToAxes( \"scaleToFitAxis\", [ this.getYAxis() ], false, true )\n // X is not always ascending...\n return this;\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoscale() {\n return this.autoscaleAxes(...arguments);\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoScale() {\n return this.autoscaleAxes(...arguments);\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoScaleAxes() {\n return this.autoscaleAxes(...arguments);\n }\n\n // See #138\n /**\n * Autoscales a particular axis\n * @param {Axis} The axis to rescale\n * @return {Graph} The current graph instance\n */\n autoScaleAxis(axis) {\n if (!axis) {\n return this;\n }\n\n axis.setMinMaxToFitSeries();\n return this;\n }\n\n /**\n * Sets the background color\n * @param {String} color - An SVG accepted color for the background\n * @return {Graph} The current graph instance\n */\n setBackgroundColor(color) {\n\n this.rectEvent.setAttribute('fill', color);\n return this;\n }\n\n getAxisState() {\n\n var state = {};\n for (var i in this.axis) {\n state[i] = this.axis[i].map(function (axis) {\n return [axis.getCurrentMin(), axis.getCurrentMax()];\n });\n }\n return state;\n }\n\n setAxisState(state) {\n\n var j, l;\n for (var i in state) {\n\n if (!this.axis[i]) {\n continue;\n }\n\n for (j = 0, l = state[i].length; j < l; j++) {\n\n if (!this.axis[i][j]) {\n continue;\n }\n\n this.axis[i][j].setCurrentMin(state[i][j][0]);\n this.axis[i][j].setCurrentMax(state[i][j][1]);\n }\n }\n\n this.draw();\n }\n\n saveAxisState(savedName) {\n this.savedAxisState = this.savedAxisState || {};\n this.savedAxisState[savedName] = this.getAxisState();\n return this;\n }\n\n recallAxisState(savedName) {\n if (this.savedAxisState[savedName]) {\n this.recallAxisState(this.savedAxisState[savedName]);\n }\n return this;\n }\n\n _applyToAxis(type) {\n\n switch (type) {\n\n case 'string':\n return function (type, func, params) {\n // params.splice(1, 0, type);\n\n for (var i = 0; i < this.axis[type].length; i++) {\n this.axis[type][i][func].apply(this.axis[type][i], params);\n }\n };\n\n case 'function':\n return function (type, func, params) {\n for (var i = 0; i < this.axis[type].length; i++) {\n func.call(this, this.axis[type][i], type, params);\n }\n };\n\n default:\n throw new Error('You must either execute a function or provide a string that registers a function');\n }\n }\n\n /**\n * Calculates the minimal or maximal value of the axis. Currently, alias of getBoudaryAxisFromSeries\n */\n getBoundaryAxis(axis, minmax, usingZValues) {\n\n var valSeries = this.getBoundaryAxisFromSeries(axis, minmax, usingZValues);\n // var valShapes = this.getBoundaryAxisFromShapes( axis, xy, minmax );\n return valSeries;\n //return Math[ minmax ]( valSeries, valShapes );\n }\n\n /**\n * Calculates the minimal or maximal value of the axis, based on the series that belong to it. The value is computed so that all series just fit in the value.\n * @memberof Graph.prototype\n * @param {Axis} axis - The axis for which the value should be computed\n * @param {minmax} minmax - The minimum or maximum to look for. \"min\" for the minimum, anything else for the maximum\n * @returns {Number} The minimimum or maximum of the axis based on its series\n */\n getBoundaryAxisFromSeries(axis, minmax, usingZValues) {\n\n var min = minmax == 'min',\n val,\n func = axis.isX() ? ['getMinX', 'getMaxX'] : ['getMinY', 'getMaxY'],\n func2use = func[min ? 0 : 1],\n infinity2use = min ? +Infinity : -Infinity,\n serie,\n series,\n serieValue,\n i,\n l;\n\n val = infinity2use;\n series = this.getSeriesFromAxis(axis);\n\n for (i = 0, l = series.length; i < l; i++) {\n\n serie = series[i];\n\n if (!serie.isShown()) {\n continue;\n }\n\n serieValue = serie[func2use](usingZValues);\n val = Math[minmax](isNaN(val) ? infinity2use : val, isNaN(serieValue) ? infinity2use : serieValue);\n }\n\n return val;\n }\n\n /**\n * Returns all the series associated to an axis\n * @param {Axis} axis - The axis to which the series belong\n * @returns {Serie[]} An array containing the list of series that belong to the axis\n */\n getSeriesFromAxis(axis) {\n var series = [],\n i = this.series.length - 1;\n\n for (; i >= 0; i--) {\n if (this.series[i].getXAxis() == axis || this.series[i].getYAxis() == axis) {\n series.push(this.series[i]);\n }\n }\n\n return series;\n }\n\n /**\n * Determines the maximum and minimum of each axes, based on {@link Graph#getBoundaryAxis}. It is usually called internally, but if the data of series has changed, called this function to make sure that minimum / maximum of the axes are properly updated.\n * @see Graph#getBoundaryAxis\n */\n updateDataMinMaxAxes(usingZValues) {\n\n var axisvars = ['bottom', 'top', 'left', 'right'],\n axis,\n j,\n l,\n i;\n\n for (j = 0, l = axisvars.length; j < l; j++) {\n\n for (i = this.axis[axisvars[j]].length - 1; i >= 0; i--) {\n\n axis = this.axis[axisvars[j]][i];\n\n // 25.10.2017. Wait a second, this cannot be real. Even hidden axes must have min max values.\n // The data can be displayed while the axis is hidden\n // I assume this was added to cover another bug, but another approach must be chosen\n if (!axis.isShown()) {}\n // continue;\n\n\n //console.log( axisvars[ j ], this.getBoundaryAxisFromSeries( this.axis[ axisvars[ j ] ][ i ], xy, 'min'), this.getBoundaryAxisFromSeries( this.axis[ axisvars[ j ] ][ i ], xy, 'max') );\n\n let min = this.getBoundaryAxis(this.axis[axisvars[j]][i], 'min', usingZValues);\n let max = this.getBoundaryAxis(this.axis[axisvars[j]][i], 'max', usingZValues);\n\n if (isFinite(max)) {\n axis.setMaxValueData(max);\n }\n if (isFinite(min)) {\n axis.setMinValueData(min);\n }\n }\n }\n }\n\n /**\n * Function that is called from {@link Graph#_applyToAxes}\n * @function\n * @name AxisCallbackFunction\n * @param {Axis} axis - The axis of the function\n * @param {String} type - The type of the axis (left,right,top,bottom)\n * @param params - The params passed in the _applyToAxis function.\n * @see Graph#_applyToAxes\n */\n\n /**\n * Applies a function to axes. The function will be executed once for every axis.\n * If func is a string, the internal function belonging to the axis will be called, with the params array flattened out (in this case, params must be an array).\n * If func is a function, the function will be called with the axis, its type and params as parameters. See {@link AxisCallbackFunction} for more details.\n * @param {(AxisCallbackFunction|String)} func - The function or function name to execute\n * @param params - Extra parameters to pass to the function\n * @param {Boolean} topbottom=false - True to apply to function to top and bottom axes\n * @param {Boolean} leftright=false - True to apply to function to left and right axes\n */\n _applyToAxes(func, params, tb, lr) {\n\n var ax = [],\n i = 0,\n l;\n\n if (tb || tb == undefined) {\n ax.push('top');\n ax.push('bottom');\n }\n if (lr || lr == undefined) {\n ax.push('left');\n ax.push('right');\n }\n\n for (l = ax.length; i < l; i++) {\n this._applyToAxis(typeof func).call(this, ax[i], func, params);\n }\n }\n\n /**\n * Axes can be dependant of one another (for instance for unit conversions)\n * Finds and returns all the axes that are linked to a specific axis. Mostly used internally.\n * @param {Axis} axis - The axis that links one or multiple other dependant axes\n * @returns {Axis[]} The list of axes linked to the axis passed as parameter\n */\n findAxesLinkedTo(axis) {\n\n var axes = [];\n this._applyToAxes(function (a) {\n\n if (a.linkedToAxis && a.linkedToAxis.axis == axis) {\n axes.push(a);\n }\n }, {}, axis instanceof this.getConstructor('graph.axis.x'), axis instanceof this.getConstructor('graph.axis.y'));\n\n return axes;\n }\n\n _axisHasChanged() {\n this._axesHaveChanged = true;\n }\n\n /**\n * Creates a new serie.\n * If the a serie with the same name exists, returns this serie with update options.\n * The type of the serie is used to fetch the corresponding registered constructor registered with the name \"graph.serie.\", e.g \"line\" will fetch the \"graph.serie.line\" prototype (built-in)
\n * Built-in series types are \"line\", \"contour\", \"zone\" and \"scatter\".\n * @param {String} name - The name of the serie (unique)\n * @param {Object} options - The serie options\n * @param {Type} type - The type of the serie.\n * @returns {Serie} The newly created serie\n */\n newSerie(name, options, type) {\n\n let serie;\n\n if (typeof options !== 'object' && !type) {\n type = options;\n options = {};\n }\n\n if (!type) {\n type = Graph.SERIE_LINE;\n }\n\n if (serie = this.getSerie(name)) {\n return serie;\n }\n\n if (!(serie = makeSerie(this, name, options, type))) {\n return;\n }\n\n this.series.push(serie);\n this.emit('newSerie', serie);\n return serie;\n }\n\n /**\n * Looks for an existing serie by name or by index and returns it.\n * The index of the serie follows the creation sequence (0 for the first one, 1 for the second one, ...)\n * @param {(String|Number)} name - The name or the index of the serie\n * @returns {Serie}\n */\n getSerie(name) {\n\n if (typeof name == 'number') {\n return this.series[name] || false;\n }\n\n if (typeof name == 'function') {\n name = name();\n }\n\n var i = 0,\n l = this.series.length;\n\n for (; i < l; i++) {\n\n if (this.series[i].getName() == name || this.series[i] == name) {\n\n return this.series[i];\n }\n }\n\n return false;\n }\n\n /**\n * Returns all the series\n * @returns {Serie[]} An array of all the series\n */\n getSeries() {\n return this.series;\n }\n\n /**\n * Returns all the series that correspond to one or multiple types\n * @param {...Symbol} type - The serie types to select\n * @returns {Serie[]} An array of all the series\n * @example graph.allSeries( Graph.SERIE_LINE, Graph.SERIE_ZONE );\n */\n allSeries(...types) {\n\n return this.series.filter(serie => {\n return types.include(serie.getType());\n });\n }\n\n /**\n * Draws a specific serie\n * @param {Serie} serie - The serie to redraw\n * @param {Boolean} force - Forces redraw even if no data has changed\n */\n drawSerie(serie, force) {\n\n if (!serie.draw) {\n throw new Error('Serie has no method draw');\n }\n\n serie.draw(force);\n }\n\n /**\n * Redraws all visible series\n * @param {Boolean} force - Forces redraw even if no data has changed\n */\n drawSeries(force) {\n\n if (!this.width || !this.height) {\n return;\n }\n\n var i = this.series.length - 1;\n for (; i >= 0; i--) {\n if (this.series[i].isShown()) {\n this.drawSerie(this.series[i], force);\n }\n }\n }\n\n /**\n * @alias Graph#removeSeries\n */\n resetSeries() {\n this.removeSeries();\n }\n\n /**\n * @alias Graph#removeSeries\n */\n\n killSeries() {\n this.resetSeries();\n }\n\n /**\n * Removes all series from the graph\n */\n removeSeries() {\n while (this.series[0]) {\n this.series[0].kill(true);\n }\n this.series = [];\n\n if (this.legend) {\n this.legend.update();\n }\n }\n\n /**\n * Selects a serie. Only one serie per graph can be selected.\n * @param {Serie} serie - The serie to select\n * @param {String} selectName=\"selected\" - The name of the selection\n */\n selectSerie(serie, selectName) {\n\n if (!(typeof serie == 'object')) {\n serie = this.getSerie(serie);\n }\n\n if (this.selectedSerie == serie && this.selectedSerie.selectionType == selectName) {\n return;\n }\n\n if (this.selectedSerie !== serie && this.selectedSerie) {\n this.unselectSerie(this.selectedSerie);\n }\n\n this.selectedSerie = serie;\n this.triggerEvent('onSelectSerie', serie);\n\n serie.select(selectName || 'selected');\n }\n\n /**\n * Returns the selected serie\n * @returns {(Serie|undefined)} The selected serie\n */\n getSelectedSerie() {\n return this.selectedSerie;\n }\n\n /**\n * Unselects a serie\n * @param {Serie} serie - The serie to unselect\n */\n unselectSerie(serie) {\n\n if (!serie.unselect) {\n return;\n }\n\n serie.unselect();\n this.selectedSerie = false;\n this.triggerEvent('onUnselectSerie', serie);\n }\n\n /**\n * Returns all the shapes associated to a serie. Shapes can (but don't have to) be associated to a serie. The position of the shape can then be relative to the same axes as the serie.\n * @param {Serie} serie - The serie containing the shapes\n * @returns {Shape[]} An array containing a list of shapes associated to the serie\n */\n getShapesOfSerie(serie) {\n\n var shapes = [];\n var i = this.shapes.length - 1;\n\n for (; i >= 0; i--) {\n\n if (this.shapes[i].getSerie() == serie) {\n shapes.push(this.shapes[i]);\n }\n }\n\n return shapes;\n }\n makeToolbar(toolbarData) {\n\n var constructor = this.getConstructor('graph.toolbar');\n if (constructor) {\n return this.toolbar = new constructor(this, toolbarData);\n } else {\n return util.throwError('No constructor exists for toolbar');\n }\n }\n\n /**\n * Returns all shapes from the graph\n */\n getShapes() {\n return this.shapes || [];\n }\n\n /**\n * Creates a new shape. jsGraph will look for the registered constructor \"graph.shape.\".\n * @param {String} shapeType - The type of the shape\n * @param {Object} [shapeData] - The options passed to the shape creator\n * @param {Boolean} [mute=false] - true to create the shape quietly\n * @param {Object} [shapeProperties] - The native object containing the shape properties in the jsGraph format (caution when using it)\n * @returns {Shape} The created shape\n * @see Graph#getConstructor\n */\n newShape(shapeType, shapeData, mute = false, shapeProperties) {\n\n this.prevent(false);\n\n if (!mute) {\n\n this.emit('beforeNewShape', shapeData);\n\n if (this.prevent(false)) {\n return false;\n }\n }\n\n // Backward compatibility\n if (typeof shapeType == 'object') {\n mute = shapeData;\n shapeData = shapeType;\n shapeType = shapeData.type;\n }\n\n shapeData = shapeData || {};\n shapeData._id = util.guid();\n\n var constructor;\n if (typeof shapeType == 'function') {\n constructor = shapeType;\n } else {\n constructor = this.getConstructor('graph.shape.' + shapeType);\n }\n\n if (!constructor) {\n return util.throwError('No constructor for this shape');\n }\n\n var shape = new constructor(this, shapeData);\n\n if (!shape) {\n return util.throwError('Failed to construct shape.');\n }\n\n shape.type = shapeType;\n shape.graph = this;\n shape._data = shapeData;\n\n if (shapeData.properties !== undefined) {\n shape.setProperties(shapeData.properties);\n }\n\n shape.init(this, shapeProperties);\n\n if (shapeData.props !== undefined) {\n for (var i in shapeData.props) {\n shape.setProp(i, shapeData.props[i]);\n }\n }\n\n if (shapeData.position) {\n\n for (var i = 0, l = shapeData.position.length; i < l; i++) {\n shape.setPosition(new _graphPosition2.default(shapeData.position[i]), i);\n }\n }\n\n /* Setting shape properties */\n if (shapeData.fillColor !== undefined) {\n shape.setFillColor(shapeData.fillColor);\n }\n\n if (shapeData.fillOpacity !== undefined) {\n shape.setFillOpacity(shapeData.fillOpacity);\n }\n\n if (shapeData.strokeColor !== undefined) {\n shape.setStrokeColor(shapeData.strokeColor);\n }\n\n if (shapeData.strokeWidth !== undefined) {\n shape.setStrokeWidth(shapeData.strokeWidth);\n }\n\n if (shapeData.layer !== undefined) {\n shape.setLayer(shapeData.layer);\n }\n\n if (shapeData.locked == true) {\n shape.lock();\n }\n\n if (shapeData.movable == true) {\n shape.movable();\n }\n\n if (shapeData.selectable == true) {\n shape.selectable();\n }\n\n if (shapeData.resizable == true) {\n shape.resizable();\n }\n\n if (shapeData.attributes !== undefined) {\n shape.setProp('attributes', shapeData.attributes);\n }\n\n if (shapeData.handles !== undefined) {\n shape.setProp('handles', shapeData.handles);\n }\n\n if (shapeData.selectOnMouseDown !== undefined) {\n shape.setProp('selectOnMouseDown', true);\n }\n\n if (shapeData.selectOnClick !== undefined) {\n shape.setProp('selectOnClick', true);\n }\n\n if (shapeData.transforms !== undefined && Array.isArray(shapeData.transforms)) {\n\n shapeData.transforms.forEach(({\n\n type,\n value\n\n }) => {\n\n shape.addTransform(type, value);\n });\n }\n\n if (shapeData.highlightOnMouseOver !== undefined) {\n shape.setProp('highlightOnMouseOver', true);\n }\n\n if (shapeData.labelEditable) {\n shape.setProp('labelEditable', shapeData.labelEditable);\n }\n\n if (shapeData.labels && !shapeData.label) {\n shapeData.label = shapeData.labels;\n }\n\n if (shapeData.label !== undefined) {\n\n if (!Array.isArray(shapeData.label)) {\n shapeData.label = [shapeData.label];\n }\n\n for (var i = 0, l = shapeData.label.length; i < l; i++) {\n\n shape.showLabel(i);\n shape.setLabelText(shapeData.label[i].text, i);\n shape.setLabelPosition(shapeData.label[i].position, i);\n shape.setLabelColor(shapeData.label[i].color || 'black', i);\n shape.setLabelSize(shapeData.label[i].size, i);\n shape.setLabelAngle(shapeData.label[i].angle || 0, i);\n shape.setLabelBaseline(shapeData.label[i].baseline || 'no-change', i);\n shape.setLabelAnchor(shapeData.label[i].anchor || 'start', i);\n shape.setLabelBackgroundColor(shapeData.label[i].backgroundColor || 'transparent', i);\n shape.setLabelBackgroundOpacity(shapeData.label[i].backgroundOpacity || 1, i);\n }\n }\n\n if (shapeData.serie) {\n shape.setSerie(this.getSerie(shapeData.serie));\n }\n shape.createHandles();\n shape.applyStyle();\n\n this.shapes.push(shape);\n\n if (!mute) {\n this.emit('newShape', shape, shapeData);\n }\n\n return shape;\n }\n\n /**\n * Creates a new position. Arguments are passed to the position constructor\n * @param {...*} varArgs\n * @see Position\n */\n newPosition(varArgs) {\n\n return new _graphPosition2.default(...arguments);\n\n // 18 September 2016 Norman: What is that ?\n //Array.prototype.unshift.call( arguments, null );\n //return new( Function.prototype.bind.apply( GraphPosition, arguments ) )();\n }\n\n /**\n * Redraws all shapes. To be called if their definitions have changed\n */\n redrawShapes() {\n\n //this.graphingZone.removeChild(this.shapeZone);\n for (var i = 0, l = this.shapes.length; i < l; i++) {\n this.shapes[i].redraw();\n }\n //this.graphingZone.insertBefore(this.shapeZone, this.axisGroup);\n }\n\n /**\n * Removes all shapes from the graph\n */\n removeShapes() {\n for (var i = 0, l = this.shapes.length; i < l; i++) {\n if (this.shapes[i] && this.shapes[i].kill) {\n this.shapes[i].kill(true);\n }\n }\n this.shapes = [];\n }\n\n /**\n * Selects a shape\n * @param {Shape} shape - The shape to select\n * @param {Boolean} mute - Select the shape quietly\n */\n selectShape(shape, mute) {\n\n // Already selected. Returns false\n\n if (!shape) {\n return;\n }\n\n if (this.selectedShapes.indexOf(shape) > -1) {\n return false;\n }\n\n if (!shape.isSelectable()) {\n return false;\n }\n\n if (!mute) {\n this.emit('beforeShapeSelect', shape);\n }\n\n if (this.prevent(false)) {\n return;\n }\n\n if (this.selectedShapes.length > 0 && this.options.shapesUniqueSelection) {\n // Only one selected shape at the time\n\n this.unselectShapes(mute);\n }\n\n shape._select(mute);\n this.selectedShapes.push(shape);\n\n if (!mute) {\n this.emit('shapeSelect', shape);\n }\n }\n\n getSelectedShapes() {\n return this.selectedShapes;\n }\n\n /**\n * Unselects a shape\n * @param {Shape} shape - The shape to unselect\n * @param {Boolean} mute - Unselect the shape quietly\n */\n unselectShape(shape, mute) {\n\n if (this.selectedShapes.indexOf(shape) == -1) {\n return;\n }\n\n if (!mute) {\n this.emit('beforeShapeUnselect', shape);\n }\n\n if (this.cancelUnselectShape) {\n this.cancelUnselectShape = false;\n return;\n }\n\n shape._unselect();\n\n this.selectedShapes.splice(this.selectedShapes.indexOf(shape), 1);\n\n if (!mute) {\n this.emit('shapeUnselect', shape);\n }\n }\n\n /**\n * Unselects all shapes\n * @param {Boolean} [ mute = false ] - Mutes all unselection events\n * @return {Graph} The current graph instance\n */\n unselectShapes(mute) {\n\n while (this.selectedShapes[0]) {\n this.unselectShape(this.selectedShapes[0], mute);\n }\n\n return this;\n }\n\n _removeShape(shape) {\n this.shapes.splice(this.shapes.indexOf(shape), 1);\n }\n\n appendShapeToDom(shape) {\n\n if (shape.isHTML()) {\n this.wrapper.insertBefore(shape._dom, this.dom);\n }\n\n this.getLayer(shape.getLayer(), 'shape').appendChild(shape.group);\n }\n\n removeShapeFromDom(shape) {\n\n if (shape.isHTML()) {\n this.wrapper.removeChild(shape._dom);\n }\n\n this.getLayer(shape.getLayer(), 'shape').removeChild(shape.group);\n }\n\n appendSerieToDom(serie) {\n this.getLayer(serie.getLayer(), 'serie').appendChild(serie.groupMain);\n }\n\n removeSerieFromDom(serie) {\n this.getLayer(serie.getLayer(), 'serie').removeChild(serie.groupMain);\n }\n\n getLayer(layer, mode) {\n\n if (!this.layers[layer]) {\n\n this.layers[layer] = [];\n\n this.layers[layer][0] = document.createElementNS(Graph.ns, 'g');\n this.layers[layer][0].setAttribute('data-layer', layer);\n this.layers[layer][1] = document.createElementNS(Graph.ns, 'g');\n this.layers[layer][2] = document.createElementNS(Graph.ns, 'g');\n\n this.layers[layer][0].appendChild(this.layers[layer][1]);\n this.layers[layer][0].appendChild(this.layers[layer][2]);\n\n var i = 1,\n prevLayer;\n\n while (!(prevLayer = this.layers[layer - i]) && layer - i >= 0) {\n i++;\n }\n\n if (!prevLayer) {\n\n this.plotGroup.insertBefore(this.layers[layer][0], this.plotGroup.firstChild);\n } else if (prevLayer.nextSibling) {\n\n this.plotGroup.insertBefore(this.layers[layer][0], prevLayer.nextSibling);\n } else {\n\n this.plotGroup.appendChild(this.layers[layer][0]);\n }\n }\n\n return this.layers[layer][mode == 'shape' ? 2 : 1];\n }\n\n focus() {\n this.wrapper.focus();\n }\n\n elementMoving(movingElement) {\n this.bypassHandleMouse = movingElement;\n }\n\n stopElementMoving(element) {\n\n if (element && element == this.bypassHandleMouse) {\n this.bypassHandleMouse = false;\n } else if (!element) {\n this.bypassHandleMouse = false;\n }\n }\n\n _makeClosingLines() {\n\n this.closingLines = {};\n var els = ['top', 'bottom', 'left', 'right'],\n i = 0,\n l = 4;\n for (; i < l; i++) {\n var line = document.createElementNS(Graph.ns, 'line');\n line.setAttribute('stroke', this.options.closeColor);\n line.setAttribute('shape-rendering', 'crispEdges');\n line.setAttribute('stroke-linecap', 'square');\n line.setAttribute('display', 'none');\n this.closingLines[els[i]] = line;\n this.graphingZone.appendChild(line);\n }\n }\n\n isActionAllowed(e, action) {\n\n if (action.type !== e.type && (action.type !== undefined || e.type !== 'mousedown') && !((e.type === 'wheel' || e.type === 'mousewheel') && action.type == 'mousewheel')) {\n return;\n }\n\n if (action.enabled && (typeof action.enabled == 'function' ? !action.enabled(this) : !action.enabled)) {\n return;\n }\n\n if (action.key) {\n\n if (action.key !== e.keyCode) {\n\n let keyCheck = {\n 'backspace': 8,\n 'enter': 13,\n 'tab': 9,\n 'shift': 16,\n 'ctrl': 17,\n 'alt': 18,\n 'pause': 19,\n 'escape': 27,\n 'up': 33,\n 'down': 34,\n 'left': 37,\n 'right': 39\n };\n\n if (keyCheck[action.key] !== e.keyCode) {\n return;\n }\n }\n }\n\n if (action.shift === undefined) {\n action.shift = false;\n }\n\n if (action.ctrl === undefined) {\n action.ctrl = false;\n }\n\n if (action.meta === undefined) {\n action.meta = false;\n }\n\n if (action.alt === undefined) {\n action.alt = false;\n }\n\n return e.shiftKey == action.shift && e.ctrlKey == action.ctrl && e.metaKey == action.meta && e.altKey == action.alt;\n }\n\n forcePlugin(plugin) {\n this.forcedPlugin = plugin;\n }\n\n unforcePlugin() {\n this.forcedPlugin = false;\n }\n\n _pluginsExecute(funcName, ...args) {\n\n //\t\t\tArray.prototype.splice.apply(args, [0, 0, this]);\n\n for (var i in this.plugins) {\n\n if (this.plugins[i] && this.plugins[i][funcName]) {\n\n this.plugins[i][funcName].apply(this.plugins[i], args);\n }\n }\n }\n\n _pluginExecute(which, func, args) {\n\n //Array.prototype.splice.apply( args, [ 0, 0, this ] );\n if (!which) {\n return;\n }\n\n if (this.plugins[which] && this.plugins[which][func]) {\n\n this.plugins[which][func].apply(this.plugins[which], args);\n return true;\n }\n }\n\n pluginYieldActiveState() {\n this.activePlugin = false;\n }\n\n _serieExecute(serie, func, args) {\n\n if (typeof serie !== 'object') {\n serie = this.getSerie(serie);\n }\n\n if (typeof serie[func] == 'function') {\n serie.apply(serie, args);\n }\n }\n _pluginsInit() {\n\n var constructor, pluginName, pluginOptions;\n\n for (var i in this.options.plugins) {\n\n pluginName = i;\n pluginOptions = this.options.plugins[i];\n\n constructor = this.getConstructor('graph.plugin.' + pluginName);\n\n if (constructor) {\n\n //var options = util.extend( true, {}, constructor.defaults(), pluginOptions );\n this.plugins[pluginName] = new constructor(pluginOptions);\n\n util.mapEventEmission(this.plugins[pluginName].options, this.plugins[pluginName]);\n this.plugins[pluginName].init(this, pluginOptions);\n } else {\n util.throwError('Plugin \"' + pluginName + '\" has not been registered');\n }\n }\n }\n\n /**\n * Returns an initialized plugin\n * @param {String} pluginName\n * @returns {Plugin} The plugin which name is \n */\n getPlugin(pluginName) {\n var plugin = this.plugins[pluginName];\n\n if (!plugin) {\n return util.throwError('Plugin \"' + pluginName + '\" has not been loaded or properly registered');\n }\n\n return plugin;\n }\n triggerEvent() {\n var func = arguments[0];\n /*,\n args = Array.prototype.splice.apply( arguments, [ 0, 1 ] );\n */\n if (typeof this.options[func] == 'function') {\n return this.options[func].apply(this, arguments);\n }\n }\n\n /**\n * Creates a legend. Only one legend is allowed per graph\n * @param {Object} options - The legend options\n */\n makeLegend(options) {\n\n if (this.legend) {\n return this.legend;\n }\n\n var constructor = this.getConstructor('graph.legend');\n if (constructor) {\n this.legend = new constructor(this, options);\n } else {\n return util.throwError('Graph legend is not available as it has not been registered');\n }\n\n return this.legend;\n }\n\n /**\n * Redraws the legend if it exists\n * @param {Boolean} [ onlyIfRequired = false ] ```true``` to redraw the legend only when it actually needs to be updated\n * @return {Graph} The graph instance\n */\n updateLegend(onlyIfRequired = false) {\n\n if (!this.legend) {\n return;\n }\n\n this.legend.update(onlyIfRequired);\n return this;\n }\n\n /**\n * @returns {Legend} The legend item\n */\n getLegend() {\n if (!this.legend) {\n return;\n }\n\n return this.legend;\n }\n\n requireLegendUpdate() {\n\n if (!this.legend) {\n return;\n }\n\n this.legend.requireDelayedUpdate();\n }\n\n orthogonalProjectionSetup() {\n\n this.options.zAxis = util.extend(true, {\n maxZ: 10,\n minZ: 0,\n shiftX: -25,\n shiftY: -15,\n xAxis: this.getXAxis(),\n yAxis: this.getYAxis()\n });\n }\n\n orthogonalProjectionUpdate() {\n\n if (!this.zAxis) {\n this.zAxis = {\n g: document.createElementNS(Graph.ns, 'g'),\n l: document.createElementNS(Graph.ns, 'line')\n };\n\n this.zAxis.g.appendChild(this.zAxis.l);\n this.groupGrids.appendChild(this.zAxis.g);\n }\n\n let refAxisX = this.options.zAxis.xAxis;\n let refAxisY = this.options.zAxis.yAxis;\n\n var x0 = refAxisX.getMinPx();\n var y0 = refAxisY.getMinPx();\n\n var dx = refAxisX.getZProj(this.options.zAxis.maxZ);\n var dy = refAxisY.getZProj(this.options.zAxis.maxZ);\n\n this.zAxis.l.setAttribute('stroke', 'black');\n this.zAxis.l.setAttribute('x1', x0);\n this.zAxis.l.setAttribute('x2', x0 + dx);\n this.zAxis.l.setAttribute('y1', y0);\n this.zAxis.l.setAttribute('y2', y0 + dy);\n\n this.updateDataMinMaxAxes(true);\n\n var sort = this.series.map(serie => {\n return [serie.getZPos(), serie];\n });\n\n sort.sort((sa, sb) => {\n return sb[0] - sa[0];\n });\n\n let i = 0;\n sort.forEach(s => {\n s[1].setLayer(i);\n this.appendSerieToDom(s[1]);\n i++;\n });\n\n this.drawSeries(true);\n }\n\n /**\n * Kills the graph\n **/\n kill() {\n this.wrapper.removeChild(this.dom);\n }\n _removeSerie(serie) {\n this.series.splice(this.series.indexOf(serie), 1);\n this._pluginsExecute('serieRemoved', serie);\n }\n contextListen(target, menuElements, callback) {\n\n if (this.options.onContextMenuListen) {\n return this.options.onContextMenuListen(target, menuElements, callback);\n }\n }\n lockShapes() {\n this.shapesLocked = true;\n\n // Removes the current actions of the shapes\n for (var i = 0, l = this.shapes.length; i < l; i++) {\n this.shapes[i].moving = false;\n this.shapes[i].resizing = false;\n }\n }\n unlockShapes() {\n //\t\tconsole.log('unlock');\n this.shapesLocked = false;\n }\n prevent(arg) {\n var curr = this.prevented;\n if (arg != -1) {\n this.prevented = arg == undefined || arg;\n }\n return curr;\n }\n _getXY(e) {\n\n var x = e.clientX,\n y = e.clientY;\n\n var pos = this.offsetCached || util.getOffset(this.wrapper);\n\n x -= pos.left;\n y -= pos.top;\n\n return {\n x: x,\n y: y\n };\n }\n _resize() {\n\n if (!this.width || !this.height) {\n return;\n }\n\n this.getDrawingWidth();\n this.getDrawingHeight();\n\n this.sizeSet = true;\n this.dom.setAttribute('width', this.width);\n this.dom.setAttribute('height', this.height);\n this.domTitle.setAttribute('x', this.width / 2);\n\n this._sizeChanged = true;\n\n if (this.drawn) {\n this.requireLegendUpdate();\n this.draw(true);\n }\n }\n\n updateGraphingZone() {\n util.setAttributeTo(this.graphingZone, {\n 'transform': 'translate(' + this.options.paddingLeft + ', ' + this.options.paddingTop + ')'\n });\n\n this._sizeChanged = true;\n }\n\n // We have to proxy the methods in case they are called anonymously\n getDrawingSpaceWidth() {\n return () => this.drawingSpaceWidth;\n }\n\n getDrawingSpaceHeight() {\n return () => this.drawingSpaceHeight;\n }\n\n getDrawingSpaceMinX() {\n return () => this.drawingSpaceMinX;\n }\n\n getDrawingSpaceMinY() {\n return () => this.drawingSpaceMinY;\n }\n\n getDrawingSpaceMaxX() {\n return () => this.drawingSpaceMaxX;\n }\n\n getDrawingSpaceMaxY() {\n return () => this.drawingSpaceMaxY;\n }\n\n /**\n * Enables the line tracking\n * @param {Object|Boolean} options - Defines the tracking behavior. If a boolean, simply enables or disables the existing tracking.\n */\n trackingLine(options) {\n\n var self = this;\n\n if (typeof options === 'boolean') {\n\n if (this.options.trackingLine) {\n this.options.trackingLine.enable = options;\n }\n return;\n }\n\n if (options) {\n this.options.trackingLine = options;\n }\n\n options.series = options.series || [];\n options.enable = options.enable === undefined ? true : !!options.enable;\n\n // Individual tracking\n if (options.mode == 'individual') {\n\n if (options.series) {\n\n if (!Array.isArray(options.series)) {\n\n if (options.series == 'all') {\n\n options.series = this.series.map(serie => ({\n serie: serie\n }));\n } else {\n\n options.series = [options.series];\n }\n }\n\n options.series.forEach(sOptions => {\n\n if (typeof sOptions.serie !== 'object') {\n\n if (typeof sOptions !== 'object') {\n throw new Error('Misuse of the trackingLine() method. Each serie must be an object with the serie property: { series: [ { serie: jsGraphSerie, options: { ... someOptions } } ] }');\n }\n\n sOptions.serie = this.getSerie(sOptions.serie);\n }\n\n if (!sOptions.serie) {\n return;\n }\n\n self.addSerieToTrackingLine(sOptions.serie, sOptions);\n });\n }\n } else {\n\n options.series.forEach(serie => {\n serie.serie.disableTracking();\n });\n }\n\n if (options.noLine) {\n return;\n }\n\n if (!this.trackingObject) {\n // Avoid multiple creation of tracking lines\n\n // Creates a new shape called trackingLine, in the first layer (below everything)\n this.trackingObject = this.newShape('line', util.extend(true, {\n position: [{\n y: 'min'\n }, {\n y: 'max'\n }],\n stroke: 'black',\n layer: -1\n }, options.trackingLineShapeOptions));\n }\n\n this.trackingObject.draw();\n\n return this.trackingObject;\n }\n\n addSerieToTrackingLine(serie, options) {\n\n if (!this.options.trackingLine) {\n\n this.trackingLine({\n mode: 'individual'\n });\n }\n\n this.options.trackingLine.series.forEach((serieO, index) => {\n if (serieO.serie == serie) {\n this.options.trackingLine.series.splice(index, 1);\n }\n });\n\n this.options.trackingLine.series.push(Object.assign({\n serie: serie\n }, options));\n\n serie.enableTracking((serie, index, x, y) => {\n\n if (this.options.trackingLine.enable) {\n\n if (index) {\n\n if (this.trackingObject) {\n\n this.trackingObject.show();\n this.trackingObject.getPosition(0).x = index.trueX; //serie.getData()[ 0 ][ index.closestIndex * 2 ];\n this.trackingObject.getPosition(1).x = index.trueX; //serie.getData()[ 0 ][ index.closestIndex * 2 ];\n this.trackingObject.redraw();\n }\n\n serie._trackingLegend = _trackingLegendSerie(this, {\n serie: serie\n }, x, y, serie._trackingLegend, options.textMethod ? options.textMethod : output => {\n\n for (var i in output) {\n return output[i].serie.serie.getName() + ': ' + output[i].serie.serie.getYAxis().valueToHtml(output[i].yValue);\n }\n }, index.trueX);\n\n if (serie._trackingLegend) {\n serie._trackingLegend.style.display = 'block';\n }\n }\n }\n }, serie => {\n\n if (this.trackingObject) {\n this.trackingObject.hide();\n }\n\n if (serie.trackingShape) {\n serie.trackingShape.hide();\n }\n\n if (serie._trackingLegend) {\n serie._trackingLegend.style.display = 'none';\n }\n\n serie._trackingLegend = _trackingLegendSerie(this, {\n\n serie: serie\n\n }, false, false, serie._trackingLegend, false, false);\n });\n }\n\n /**\n * Pass here the katex.render method to be used later\n * @param {Function} renderer - katexRendered - renderer\n * @return {Graph} The current graph instance\n */\n setKatexRenderer(renderer) {\n this._katexRenderer = renderer;\n }\n\n hasKatexRenderer() {\n return !!this._katexRenderer;\n }\n\n renderWithKatex(katexValue, katexElement) {\n\n if (this._katexRenderer) {\n\n if (katexElement) {\n katexElement.removeChild(katexElement.firstChild);\n } else {\n katexElement = document.createElementNS(Graph.ns, 'foreignObject');\n }\n\n let div = document.createElement('div');\n\n katexElement.appendChild(div);\n this._katexRenderer(katexValue, div);\n\n return katexElement;\n }\n\n return false;\n }\n\n /**\n * Returns a graph created from a schema\n * @param {Object} schema - The schema (see https://github.com/cheminfo/json-chart/blob/master/chart-schema.json)\n * @param {HTMLElement} wrapper - The wrapping element\n * @returns {Graph} Newly created graph\n */\n static fromJSON(schema, wrapper) {\n\n let graph,\n options = {},\n axes = {\n left: [],\n top: [],\n right: [],\n bottom: []\n },\n style;\n\n if (schema.title) {\n options.title = schema.title;\n }\n\n if (schema.axis) {\n\n schema.axis.forEach(function (schemaAxis) {\n\n if (!schemaAxis.type) {\n util.throwError('Axis type is required (top, bottom, left or right)');\n }\n\n var axisOptions = {};\n if (schemaAxis.label) {\n axisOptions.labelValue = schemaAxis.label;\n }\n\n if (schemaAxis.unit !== undefined) {\n axisOptions.unit = schemaAxis.unit;\n }\n\n if (schemaAxis.unitWrapperAfter !== undefined) {\n axisOptions.unitWrapperAfter = schemaAxis.unitWrapperAfter;\n }\n\n if (schemaAxis.unitWrapperBefore !== undefined) {\n axisOptions.unitWrapperBefore = schemaAxis.unitWrapperBefore;\n }\n\n if (schemaAxis.min !== undefined) {\n axisOptions.forcedMin = schemaAxis.min;\n }\n\n if (schemaAxis.max !== undefined) {\n axisOptions.forcedMax = schemaAxis.max;\n }\n\n if (schemaAxis.flip !== undefined) {\n axisOptions.flipped = schemaAxis.flip;\n }\n\n axes[schemaAxis.type].push(axisOptions);\n schemaAxis._jsGraphIndex = axes[schemaAxis.type].length - 1;\n });\n }\n\n graph = new Graph(wrapper, options, axes);\n\n if (schema.width) {\n graph.setWidth(schema.width);\n }\n\n if (schema.height) {\n graph.setHeight(schema.width);\n }\n\n graph._resize();\n\n if (schema.data) {\n\n schema.data.forEach(function (schemaSerie) {\n\n var serieType = schemaSerie.type,\n serie,\n serieOptions = {},\n serieAxis;\n\n let waveform;\n\n switch (schemaSerie.type) {\n\n case 'bar':\n util.throwError('Bar charts not supported');\n serieType = false;\n break;\n\n case 'color':\n serieType = Graph.SERIE_LINE_COLORED;\n break;\n\n case 'scatter':\n serieType = Graph.SERIE_SCATTER;\n break;\n\n case 'box':\n serieType = Graph.SERIE_BOX;\n\n if (schemaSerie.orientation == 'x' || schemaSerie.orientation == 'y') {\n serieOptions.orientation = schemaSerie.orientation;\n }\n break;\n\n default:\n serieType = Graph.SERIE_LINE;\n break;\n }\n\n if (serieType !== Graph.SERIE_BOX) {\n waveform = Graph.newWaveform();\n }\n\n if (!serieType) {\n util.throwError('No valid serie type was found');\n return;\n }\n\n serie = graph.newSerie(schemaSerie.id || schemaSerie.label || util.guid(), serieOptions, serieType);\n\n if (schemaSerie.lineStyle) {\n\n let lineStyle;\n\n if (Array.isArray(lineStyle)) {\n lineStyle = {\n unselected: lineStyle\n };\n }\n\n Object.entries(lineStyle).forEach(([styleName, style]) => {\n\n var styleSerie = {};\n\n switch (serieType) {\n\n case Graph.SERIE_LINE:\n if (style.lineWidth !== undefined) {\n styleSerie.lineWidth = style.lineWidth;\n }\n\n if (style.color !== undefined) {\n styleSerie.lineColor = style.color;\n }\n\n if (style.lineStyle) {\n styleSerie.lineStyle = style.lineStyle;\n }\n\n serie.setStyle(styleSerie, styleName);\n break;\n }\n });\n }\n\n let defaultStyle = {};\n let defaultStyles = {};\n\n if (schemaSerie.defaultStyle) {\n defaultStyle = schemaSerie.defaultStyle;\n }\n\n if (schemaSerie.defaultStyles) {\n defaultStyles = schemaSerie.defaultStyles;\n }\n\n if (schemaSerie.styles) {\n\n let individualStyles;\n\n if (Array.isArray(schemaSerie.styles)) {\n individualStyles = {\n unselected: schemaSerie.styles\n };\n } else {\n individualStyles = schemaSerie.styles;\n }\n\n let styleNames = new Set(Object.keys(defaultStyles).concat(Object.keys(individualStyles)));\n\n styleNames.forEach(styleName => {\n\n var styleSerie = {};\n let style = [],\n styles;\n\n if (individualStyles && individualStyles[styleName]) {\n\n style = individualStyles[styleName];\n\n if (!Array.isArray(style)) {\n style = [style];\n }\n\n styles = style.map(function (eachStyleElement) {\n\n switch (serieType) {\n\n case Graph.SERIE_LINE:\n\n return {\n type: eachStyleElement.shape,\n zoom: eachStyleElement.zoom,\n strokeWidth: eachStyleElement.lineWidth,\n strokeColor: eachStyleElement.lineColor,\n fillColor: eachStyleElement.color,\n points: eachStyleElement.points\n };\n\n break;\n\n case Graph.SERIE_BOX:\n\n return eachStyleElement;\n\n break;\n\n case Graph.SERIE_SCATTER:\n return eachStyleElement;\n\n break;\n }\n });\n }\n\n switch (serieType) {\n\n case Graph.SERIE_LINE:\n\n serie.setMarkers(styles, styleName);\n break;\n\n case Graph.SERIE_SCATTER:\n serie.setStyle(Object.assign({}, defaultScatterStyle, defaultStyle, defaultStyles[styleName] || {}), styles, styleName);\n break;\n\n case Graph.SERIE_BOX:\n\n serie.setStyle(styles[0], styleName || 'unselected');\n break;\n }\n });\n }\n\n if (schemaSerie.color && serieType == Graph.SERIE_LINE_COLORED) {\n serie.setColors(schemaSerie.color);\n }\n\n if (serieType !== Graph.SERIE_BOX) {\n waveform.setData(schemaSerie.y, schemaSerie.x);\n }\n\n if (!serie) {\n return;\n }\n\n let errorBarsXAbove = [],\n errorBarsXBelow = [],\n errorBarsYAbove = [],\n errorBarsYBelow = [],\n errorBoxesXAbove = [],\n errorBoxesXBelow = [],\n errorBoxesYAbove = [],\n errorBoxesYBelow = [];\n\n if (waveform !== undefined) {\n var errors = [];\n if (schemaSerie.errorX) {\n\n for (var i = 0, l = schemaSerie.errorX.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorX[i])) {\n\n errorBarsXAbove.push(schemaSerie.errorX[i][0]);\n errorBarsXBelow.push(schemaSerie.errorX[i][1]);\n } else {\n errorBarsXAbove.push(schemaSerie.errorX[i]);\n errorBarsXBelow.push(schemaSerie.errorX[i]);\n }\n }\n } else if (schemaSerie.errorBarX || schemaSerie.errorBoxX) {\n\n if (schemaSerie.errorBarX) {\n\n for (var i = 0, l = schemaSerie.errorBarX.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBarX[i])) {\n\n errorBarsXAbove.push(schemaSerie.errorBarX[i][0]);\n errorBarsXBelow.push(schemaSerie.errorBarX[i][1]);\n } else {\n errorBarsXAbove.push(schemaSerie.errorBarX[i]);\n errorBarsXBelow.push(schemaSerie.errorBarX[i]);\n }\n }\n }\n\n if (schemaSerie.errorBoxX) {\n\n for (var i = 0, l = schemaSerie.errorBoxX.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBoxX[i])) {\n\n errorBoxesXAbove.push(schemaSerie.errorBoxX[i][0]);\n errorBoxesXBelow.push(schemaSerie.errorBoxX[i][1]);\n } else {\n errorBoxesXAbove.push(schemaSerie.errorBoxX[i]);\n errorBoxesXBelow.push(schemaSerie.errorBoxX[i]);\n }\n }\n }\n }\n\n if (schemaSerie.errorY) {\n\n for (var i = 0, l = schemaSerie.errorY.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorY[i])) {\n\n errorBarsYAbove.push(schemaSerie.errorY[i][0]);\n errorBarsYBelow.push(schemaSerie.errorY[i][1]);\n } else {\n errorBarsYAbove.push(schemaSerie.errorY[i]);\n errorBarsYBelow.push(schemaSerie.errorY[i]);\n }\n }\n } else if (schemaSerie.errorBarY || schemaSerie.errorBoxY) {\n\n if (schemaSerie.errorBarY) {\n\n for (var i = 0, l = schemaSerie.errorBarY.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBarY[i])) {\n\n errorBarsYAbove.push(schemaSerie.errorBarY[i][0]);\n errorBarsYBelow.push(schemaSerie.errorBarY[i][1]);\n } else {\n errorBarsYAbove.push(schemaSerie.errorBarY[i]);\n errorBarsYBelow.push(schemaSerie.errorBarY[i]);\n }\n }\n }\n\n if (schemaSerie.errorBoxY) {\n\n for (var i = 0, l = schemaSerie.errorBoxY.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBoxY[i])) {\n\n errorBoxesYAbove.push(schemaSerie.errorBoxY[i][0]);\n errorBoxesYBelow.push(schemaSerie.errorBoxY[i][1]);\n } else {\n errorBoxesYAbove.push(schemaSerie.errorBoxY[i]);\n errorBoxesYBelow.push(schemaSerie.errorBoxY[i]);\n }\n }\n }\n }\n\n style = {};\n if (errorBarsXAbove.length > 0) {\n waveform.setErrorBarXAbove(Graph.newWaveform(errorBarsXAbove));\n style.right = {};\n }\n if (errorBarsXBelow.length > 0) {\n waveform.setErrorBarXAbove(Graph.newWaveform(errorBarsXAbove));\n style.left = {};\n }\n if (errorBarsYAbove.length > 0) {\n waveform.setErrorBarXAbove(Graph.newWaveform(errorBarsYAbove));\n style.top = {};\n }\n if (errorBarsYBelow.length > 0) {\n waveform.setErrorBarXAbove(Graph.newWaveform(errorBarsYAbove));\n style.bottom = {};\n }\n\n serie.setErrorBarStyle(style);\n\n style = {};\n if (errorBoxesXAbove.length > 0) {\n waveform.setErrorBoxXAbove(Graph.newWaveform(errorBoxesXAbove));\n style.right = {};\n }\n if (errorBoxesXBelow.length > 0) {\n waveform.setErrorBoxXBelow(Graph.newWaveform(errorBoxesXBelow));\n style.left = {};\n }\n if (errorBoxesYAbove.length > 0) {\n waveform.setErrorBoxAbove(Graph.newWaveform(errorBoxesYAbove));\n style.top = {};\n }\n if (errorBoxesYBelow.length > 0) {\n waveform.setErrorBoxBelow(Graph.newWaveform(errorBoxesYBelow));\n style.bottom = {};\n }\n serie.setErrorBoxStyle(style);\n }\n\n if (schema.axis) {\n serieAxis = schema.axis[schemaSerie.xAxis];\n\n if (!serieAxis || serieAxis.type !== 'top' && serieAxis.type !== 'bottom') {\n util.warn('No x axis found. Setting automatically');\n serie.setXAxis(graph.getXAxis(0));\n } else {\n if (serieAxis.type == 'top') {\n serie.setXAxis(graph.getTopAxis(serieAxis._jsGraphIndex));\n } else if (serieAxis.type == 'bottom') {\n serie.setXAxis(graph.getBottomAxis(serieAxis._jsGraphIndex));\n }\n }\n\n serieAxis = schema.axis[schemaSerie.yAxis];\n\n if (!serieAxis || serieAxis.type !== 'left' && serieAxis.type !== 'right') {\n util.warn('No y axis found. Setting automatically');\n serie.setYAxis(graph.getYAxis(0));\n } else {\n if (serieAxis.type == 'left') {\n serie.setYAxis(graph.getLeftAxis(serieAxis._jsGraphIndex));\n } else if (serieAxis.type == 'right') {\n serie.setYAxis(graph.getRightAxis(serieAxis._jsGraphIndex));\n }\n }\n } else {\n util.warn('No axes found. Setting automatically');\n serie.autoAxis();\n }\n\n switch (serieType) {\n\n case Graph.SERIE_BOX:\n\n serie.setData(schemaSerie.boxes);\n\n break;\n\n default:\n case Graph.SERIE_SCATTER:\n case Graph.SERIE_LINE_COLORED:\n case Graph.SERIE_LINE:\n\n serie.setWaveform(waveform);\n\n break;\n }\n });\n }\n\n graph.autoscaleAxes();\n graph.draw();\n\n return graph;\n }\n\n exportToSchema() {\n\n let schema = {};\n\n schema.title = this.options.title;\n\n schema.width = this.getWidth();\n schema.height = this.getHeight();\n\n let axesPositions = ['top', 'bottom', 'left', 'right'];\n let axesExport = [];\n let allaxes = {\n x: [],\n y: []\n };\n\n axesPositions.map(axisPosition => {\n\n if (!this.axis[axisPosition]) {\n return;\n }\n\n axesExport = axesExport.concat(this.axis[axisPosition].map(axis => {\n return {\n\n type: axisPosition,\n label: axis.options.label,\n unit: axis.options.unit,\n min: axis.options.forcedMin,\n max: axis.options.forcedMax,\n flip: axis.options.flipped\n\n };\n }));\n\n if (axisPosition == 'top' || axisPosition == 'bottom') {\n allaxes.x = allaxes.x.concat(this.axis[axisPosition]);\n } else {\n allaxes.y = allaxes.y.concat(this.axis[axisPosition]);\n }\n });\n\n schema.axis = axesExport;\n\n let seriesExport = [];\n\n let toType = type => {\n switch (type) {\n\n case Graph.SERIE_LINE:\n return 'line';\n break;\n\n case Graph.SERIE_BAR:\n return 'bar';\n break;\n\n case Graph.SERIE_LINE_COLORED:\n return 'color';\n break;\n\n case Graph.SERIE_SCATTER:\n return 'scatter';\n break;\n }\n };\n\n let exportData = (serie, x) => {\n\n let data = [];\n\n switch (serie.getType()) {\n\n case Graph.SERIE_LINE:\n\n for (var i = 0; i < serie.data.length; i++) {\n\n for (var j = 0; j < serie.data[i].length - 1; j += 2) {\n\n data.push(serie.data[i][j + (x && serie.isFlipped() || !x && !serie.isFlipped() ? 1 : 0)]);\n }\n }\n break;\n\n case Graph.SERIE_SCATTER:\n\n for (var j = 0; j < serie.data.length - 1; j += 2) {\n\n data.push(serie.data[i + (x && serie.isFlipped() || !x && !serie.isFlipped() ? 1 : 0)]);\n }\n\n break;\n }\n\n return data;\n };\n\n schema.data = seriesExport.concat(this.series.map(serie => {\n\n let style = [];\n let linestyle = [];\n\n if (serie.getType() == Graph.SERIE_LINE) {\n\n for (var stylename in serie.styles) {\n linestyle.push({\n styleName: stylename,\n color: serie.styles[stylename].lineColor,\n lineWidth: serie.styles[stylename].lineWidth,\n lineStyle: serie.styles[stylename].lineStyle\n });\n\n let styleObj = {\n styleName: stylename,\n styles: []\n };\n style.push(styleObj);\n\n styleObj.styles = styleObj.styles.concat((serie.styles[stylename].markers || []).map(markers => {\n return {\n shape: markers.type,\n zoom: markers.zoom,\n lineWidth: markers.strokeWidth,\n lineColor: markers.strokeColor,\n color: markers.fillColor,\n points: markers.points\n };\n }));\n }\n }\n\n return {\n label: serie.getLabel(),\n id: serie.getName(),\n type: toType(serie.getType()),\n x: exportData(serie, true),\n y: exportData(serie, false),\n xAxis: allaxes.x.indexOf(serie.getXAxis()),\n yAxis: allaxes.y.indexOf(serie.getYAxis()),\n style: style,\n lineStyle: linestyle\n };\n }));\n\n return schema;\n }\n\n /**\n * Registers a constructor to jsGraph. Constructors are used on a later basis by jsGraph to create series, shapes or plugins\n * @param {String} constructorName - The name of the constructor\n * @param {Function} constructor - The constructor method\n * @see Graph.getConstructor\n * @static\n */\n static registerConstructor(constructorName, constructor) {\n\n if (_constructors.has(constructorName)) {\n return util.throwError('Constructor ' + constructor + ' already exists.');\n }\n\n _constructors.set(constructorName, constructor);\n }\n\n /**\n * Returns a registered constructor\n * @param {String} constructorName - The constructor name to look for\n * @param {Boolean} [softFail = false ] - Fails silently if the constructor doesn't exist, and returns false\n * @returns {Function} The registered constructor\n * @throws Error\n * @see Graph.registerConstructor\n * @static\n */\n static getConstructor(constructorName, softFail = false) {\n\n if (!_constructors.has(constructorName)) {\n\n if (softFail) {\n return false;\n }\n\n return util.throwError('Constructor \"' + constructorName + \"\\\" doesn't exist\");\n }\n\n return _constructors.get(constructorName);\n }\n\n static newWaveform() {\n return new _waveform2.default(...arguments);\n }\n\n static waveform() {\n return new _waveform2.default(...arguments);\n }\n }\n\n // Adds getConstructor to the prototype. Cannot do that in ES6 classes\n Graph.prototype.getConstructor = Graph.getConstructor;\n\n function makeSerie(graph, name, options, type) {\n\n var constructor = graph.getConstructor(type, true);\n if (!constructor && typeof type == 'string') {\n constructor = graph.getConstructor('graph.serie.' + type, true);\n }\n\n if (constructor) {\n\n var serie = new constructor(graph, name, options);\n //serie.init( graph, name, options );\n graph.appendSerieToDom(serie);\n } else {\n\n return util.throwError('No constructor exists for the serie type provided. Use Graph.registerConstructor( name, constructor ) first is you use your own series');\n }\n\n return serie;\n }\n\n function getAxisLevelFromSpan(span, level) {\n\n for (var i = 0, l = level.length; i < l; i++) {\n\n var possible = true;\n for (var k = 0, m = level[i].length; k < m; k++) {\n\n if (!(span[0] < level[i][k][0] && span[1] < level[i][k][0] || span[0] > level[i][k][1] && span[1] > level[i][k][1])) {\n possible = false;\n }\n }\n\n if (possible) {\n\n level[i].push(span);\n return i;\n }\n }\n\n level.push([span]);\n return level.length - 1;\n }\n\n function refreshDrawingZone(graph) {\n\n var i, j, l, xy, min, max, axis;\n var shift = {\n top: [],\n bottom: [],\n left: [],\n right: []\n };\n\n var levels = {\n top: [],\n bottom: [],\n left: [],\n right: []\n };\n\n graph._painted = true;\n // Apply to top and bottom\n\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n axis.hideGroup();\n return;\n } else {\n axis.showGroup();\n }\n\n if (axis.floating) {\n return;\n }\n\n var level = getAxisLevelFromSpan(axis.getSpan(), levels[position]);\n axis.setLevel(level);\n\n shift[position][level] = Math.max(axis.getAxisPosition(), shift[position][level] || 0);\n }, false, true, false);\n\n var shiftTop = shift.top.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n var shiftBottom = shift.bottom.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n graph.drawingSpaceHeight = graph.getDrawingHeight() - shiftTop - shiftBottom;\n\n [shift.top, shift.bottom].map(function (arr) {\n arr.reduce(function (prev, current, index) {\n arr[index] = prev + current;\n return prev + current;\n }, 0);\n });\n\n // Apply to top and bottom\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown() || axis.floating) {\n return;\n }\n\n axis.setShift(shift[position][axis.getLevel()]);\n }, false, true, false);\n\n // Applied to left and right\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n axis.hideGroup();\n // Don't return here. We need to go through the draw method as the axis must be assigned minPx and maxPx values.\n // This is because some series can still be visible although the axis isn't.\n } else {\n axis.showGroup();\n }\n\n axis.setMinPx(shiftTop);\n axis.setMaxPx(graph.getDrawingHeight(true) - shiftBottom);\n\n if (axis.floating) {\n return;\n }\n\n // First we need to draw it in order to determine the width to allocate\n // graph is done to accomodate 0 and 100000 without overlapping any element in the DOM (label, ...)\n\n // Let's not draw dependant axes yet\n let drawn = !axis.linkedToAxis ? axis.draw() : 0;\n\n if (!axis.isShown()) {\n return;\n }\n // Get axis position gives the extra shift that is common\n var level = getAxisLevelFromSpan(axis.getSpan(), levels[position]);\n axis.setLevel(level);\n shift[position][level] = Math.max(drawn, shift[position][level] || 0);\n }, false, false, true);\n\n var shift2 = util.extend(true, {}, shift);\n\n // Applied to left and right\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown() || axis.floating) {\n return;\n }\n\n shift2[position][axis.getLevel()] = Math.max(shift[position][axis.getLevel()], axis.equalizePosition(shift[position][axis.getLevel()]));\n }, false, false, true);\n\n shift = shift2;\n\n var shiftLeft = shift.left.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n var shiftRight = shift.right.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n graph.drawingSpaceWidth = graph.getDrawingWidth() - shiftLeft - shiftRight;\n\n [shift.left, shift.right].map(function (arr) {\n arr.reduce(function (prev, current, index) {\n arr[index] = prev + current;\n return prev + current;\n }, 0);\n });\n\n // Apply to left and right\n graph._applyToAxes((axis, position) => {\n\n if (!axis.isShown() || axis.floating) {\n return;\n }\n axis.setShift(shift[position][axis.getLevel()]);\n }, false, false, true);\n\n // Apply to top and bottom\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n // return;\n }\n\n axis.setMinPx(shiftLeft);\n axis.setMaxPx(graph.getDrawingWidth(true) - shiftRight);\n\n if (axis.floating) {\n return;\n }\n\n if (!axis.linkedToAxis) {\n axis.draw();\n }\n }, false, true, false);\n\n // Floating axes\n graph._applyToAxes(function (axis) {\n\n if (!axis.floating) {\n return;\n }\n\n var floatingAxis = axis.getFloatingAxis();\n var floatingValue = axis.getFloatingValue();\n var floatingPx = floatingAxis.getPx(floatingValue);\n\n axis.setShift(floatingPx);\n\n if (!axis.linkedToAxis) {\n axis.draw();\n }\n }, false, true, true);\n\n _closeLine(graph, 'right', graph.getDrawingWidth(true), graph.getDrawingWidth(true), shiftTop, graph.getDrawingHeight(true) - shiftBottom);\n _closeLine(graph, 'left', 0, 0, shiftTop, graph.getDrawingHeight(true) - shiftBottom);\n _closeLine(graph, 'top', shiftLeft, graph.getDrawingWidth(true) - shiftRight, 0, 0);\n _closeLine(graph, 'bottom', shiftLeft, graph.getDrawingWidth(true) - shiftRight, graph.getDrawingHeight(true) - shiftBottom, graph.getDrawingHeight(true) - shiftBottom);\n\n graph.clipRect.setAttribute('y', shiftTop);\n graph.clipRect.setAttribute('x', shiftLeft);\n graph.clipRect.setAttribute('width', graph.getDrawingWidth() - shiftLeft - shiftRight);\n graph.clipRect.setAttribute('height', graph.getDrawingHeight() - shiftTop - shiftBottom);\n\n graph.rectEvent.setAttribute('y', shiftTop + graph.getPaddingTop());\n graph.rectEvent.setAttribute('x', shiftLeft + graph.getPaddingLeft());\n\n graph.rectEvent.setAttribute('width', graph.drawingSpaceWidth);\n graph.rectEvent.setAttribute('height', graph.drawingSpaceHeight);\n\n graph.drawingSpaceMinX = shiftLeft + graph.getPaddingLeft(); // + \"px\";\n graph.drawingSpaceMinY = shiftTop + graph.getPaddingTop(); // + \"px\";\n graph.drawingSpaceMaxX = graph.getDrawingWidth() - shiftRight + graph.getPaddingLeft(); // + \"px\";\n graph.drawingSpaceMaxY = graph.getDrawingHeight() - shiftBottom + graph.getPaddingTop(); // + \"px\";\n\n // Apply to top and bottom\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n return;\n }\n\n axis.drawLines();\n }, false, true, true);\n\n /*\n graph.shapeZoneRect.setAttribute('x', shift[1]);\n graph.shapeZoneRect.setAttribute('y', shift[2]);\n graph.shapeZoneRect.setAttribute('width', graph.getDrawingWidth() - shift[2] - shift[3]);\n graph.shapeZoneRect.setAttribute('height', graph.getDrawingHeight() - shift[1] - shift[0]);\n */\n graph.shift = shift;\n graph.redrawShapes(); // Not sure this should be automatic here. The user should be clever.\n }\n\n function _handleKey(graph, event, type) {\n\n var self = graph;\n console.log(event, type);\n if (graph.forcedPlugin) {\n\n graph.activePlugin = graph.forcedPlugin;\n graph._pluginExecute(graph.activePlugin, type, [graph, event]);\n return;\n }\n\n checkKeyActions(graph, event, [graph, event], type);\n }\n\n // Similar to checkMouseActions\n function checkKeyActions(graph, e, parameters, methodName) {\n\n var keyComb = graph.options.keyActions,\n i,\n l;\n\n for (i = 0, l = keyComb.length; i < l; i++) {\n\n if (keyComb[i].plugin) {\n // Is it a plugin ?\n\n if (graph.forcedPlugin == keyComb[i].plugin || graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n graph.activePlugin = keyComb[i].plugin; // Lease the mouse action to the current action\n graph._pluginExecute(keyComb[i].plugin, methodName, parameters);\n\n e.preventDefault();\n e.stopPropagation();\n\n return true;\n }\n } else if (keyComb[i].callback && graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n keyComb[i].callback.apply(graph, parameters);\n return true;\n }\n\n if (keyComb[i].removeSelectedShape && graph.isActionAllowed(e, keyComb[i])) {\n\n e.preventDefault();\n e.stopPropagation();\n\n graph.selectedShapes.map(shape => {\n\n shape.kill(keyComb[i].keepInDom);\n });\n }\n\n /* else if ( keyComb[ i ].series ) {\n var series;\n if ( keyComb[ i ].series === 'all' ) {\n series = graph.series;\n }\n if ( !Array.isArray( keyComb[ i ].series ) ) {\n series = [ series ];\n }\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n for ( var j = 0; j < series.length; i++ ) {\n graph._serieExecute( series[ i ], methodName, parameters );\n }\n return true;\n }*/\n }\n\n return false;\n }\n\n function doDom() {\n\n // Create SVG element, set the NS\n this.dom = document.createElementNS(Graph.ns, 'svg');\n this.dom.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xlink', 'http://www.w3.org/1999/xlink');\n //this.dom.setAttributeNS(this.ns, 'xmlns:xlink', this.nsxml);\n util.setAttributeTo(this.dom, {\n 'xmlns': Graph.ns,\n 'font-family': this.options.fontFamily,\n 'font-size': this.options.fontSize\n });\n\n try {\n util.setAttributeTo(this.dom, {\n 'data-jsgraph-version': 'v2.0.72'\n });\n } catch (e) {\n // ignore\n }\n\n this.defs = document.createElementNS(Graph.ns, 'defs');\n this.dom.appendChild(this.defs);\n\n this.groupEvent = document.createElementNS(Graph.ns, 'g');\n\n this.rectEvent = document.createElementNS(Graph.ns, 'rect');\n util.setAttributeTo(this.rectEvent, {\n 'pointer-events': 'fill',\n 'fill': 'transparent'\n });\n this.groupEvent.appendChild(this.rectEvent);\n\n this.dom.appendChild(this.groupEvent);\n\n // Handling graph title\n this.domTitle = document.createElementNS(Graph.ns, 'text');\n this.setTitle(this.options.title);\n util.setAttributeTo(this.domTitle, {\n 'text-anchor': 'middle',\n 'y': 20\n });\n this.groupEvent.appendChild(this.domTitle);\n //\n\n this.graphingZone = document.createElementNS(Graph.ns, 'g');\n this.updateGraphingZone();\n\n this.groupEvent.appendChild(this.graphingZone);\n\n /* this.shapeZoneRect = document.createElementNS(this.ns, 'rect');\n //this.shapeZoneRect.setAttribute('pointer-events', 'fill');\n this.shapeZoneRect.setAttribute('fill', 'transparent');\n this.shapeZone.appendChild(this.shapeZoneRect);\n */\n this.axisGroup = document.createElementNS(Graph.ns, 'g');\n this.graphingZone.appendChild(this.axisGroup);\n\n this.groupGrids = document.createElementNS(Graph.ns, 'g');\n\n // With the z stacking, this should probably be removed\n //this.groupGrids.setAttribute( 'clip-path', 'url(#_clipplot' + this._creation + ')' );\n\n this.groupPrimaryGrids = document.createElementNS(Graph.ns, 'g');\n this.groupSecondaryGrids = document.createElementNS(Graph.ns, 'g');\n\n this.axisGroup.appendChild(this.groupGrids);\n\n this.groupGrids.appendChild(this.groupSecondaryGrids);\n this.groupGrids.appendChild(this.groupPrimaryGrids);\n\n this.plotGroup = document.createElementNS(Graph.ns, 'g');\n this.graphingZone.appendChild(this.plotGroup);\n\n // 5 September 2014. I encountered a case here shapeZone must be above plotGroup\n /*this.shapeZone = document.createElementNS( this.ns, 'g' );\n this.graphingZone.appendChild( this.shapeZone );\n */\n\n this.layers = [];\n\n this._makeClosingLines();\n\n this.clip = document.createElementNS(Graph.ns, 'clipPath');\n this.clip.setAttribute('id', '_clipplot' + this._creation);\n this.defs.appendChild(this.clip);\n\n this.clipRect = document.createElementNS(Graph.ns, 'rect');\n this.clip.appendChild(this.clipRect);\n this.clip.setAttribute('clipPathUnits', 'userSpaceOnUse');\n\n this.markerArrow = document.createElementNS(this.ns, 'marker');\n this.markerArrow.setAttribute('viewBox', '0 0 10 10');\n this.markerArrow.setAttribute('id', 'arrow' + this._creation);\n this.markerArrow.setAttribute('refX', '6');\n this.markerArrow.setAttribute('refY', '5');\n this.markerArrow.setAttribute('markerUnits', 'strokeWidth');\n this.markerArrow.setAttribute('markerWidth', '8');\n this.markerArrow.setAttribute('markerHeight', '6');\n this.markerArrow.setAttribute('orient', 'auto');\n //this.markerArrow.setAttribute('fill', 'context-stroke');\n //this.markerArrow.setAttribute('stroke', 'context-stroke');\n\n var pathArrow = document.createElementNS(Graph.ns, 'path');\n pathArrow.setAttribute('d', 'M 0 0 L 10 5 L 0 10 z');\n //pathArrow.setAttribute( 'fill', 'context-stroke' );\n this.markerArrow.appendChild(pathArrow);\n\n this.defs.appendChild(this.markerArrow);\n\n // Horionzal split marker for axis\n this.markerHorizontalSplit = document.createElementNS(Graph.ns, 'marker');\n this.markerHorizontalSplit.setAttribute('viewBox', '0 0 6 8');\n this.markerHorizontalSplit.setAttribute('id', 'horionzalsplit_' + this.getId());\n this.markerHorizontalSplit.setAttribute('refX', '3');\n this.markerHorizontalSplit.setAttribute('refY', '4');\n this.markerHorizontalSplit.setAttribute('markerUnits', 'strokeWidth');\n this.markerHorizontalSplit.setAttribute('markerWidth', '6');\n this.markerHorizontalSplit.setAttribute('markerHeight', '8');\n\n var path = document.createElementNS(Graph.ns, 'line');\n path.setAttribute('x1', '0');\n path.setAttribute('y1', '8');\n\n path.setAttribute('x2', '6');\n path.setAttribute('y2', '0');\n\n path.setAttribute('stroke', 'black');\n this.markerHorizontalSplit.appendChild(path);\n\n this.defs.appendChild(this.markerHorizontalSplit);\n\n // Vertical split marker for axis\n this.markerVerticalSplit = document.createElementNS(Graph.ns, 'marker');\n this.markerVerticalSplit.setAttribute('viewBox', '0 0 8 6');\n this.markerVerticalSplit.setAttribute('id', 'verticalsplit_' + this.getId());\n this.markerVerticalSplit.setAttribute('refX', '4');\n this.markerVerticalSplit.setAttribute('refY', '3');\n this.markerVerticalSplit.setAttribute('markerUnits', 'strokeWidth');\n this.markerVerticalSplit.setAttribute('markerWidth', '8');\n this.markerVerticalSplit.setAttribute('markerHeight', '6');\n\n var path = document.createElementNS(Graph.ns, 'line');\n\n path.setAttribute('x1', '0');\n path.setAttribute('y1', '0');\n\n path.setAttribute('x2', '8');\n path.setAttribute('y2', '6');\n\n path.setAttribute('stroke', 'black');\n this.markerVerticalSplit.appendChild(path);\n this.defs.appendChild(this.markerVerticalSplit);\n\n this.vertLineArrow = document.createElementNS(Graph.ns, 'marker');\n this.vertLineArrow.setAttribute('viewBox', '0 0 10 10');\n this.vertLineArrow.setAttribute('id', 'verticalline' + this._creation);\n this.vertLineArrow.setAttribute('refX', '0');\n this.vertLineArrow.setAttribute('refY', '5');\n this.vertLineArrow.setAttribute('markerUnits', 'strokeWidth');\n this.vertLineArrow.setAttribute('markerWidth', '20');\n this.vertLineArrow.setAttribute('markerHeight', '10');\n this.vertLineArrow.setAttribute('orient', 'auto');\n //this.vertLineArrow.setAttribute('fill', 'context-stroke');\n //this.vertLineArrow.setAttribute('stroke', 'context-stroke');\n this.vertLineArrow.setAttribute('stroke-width', '1px');\n\n var pathVertLine = document.createElementNS(Graph.ns, 'path');\n pathVertLine.setAttribute('d', 'M 0 -10 L 0 10');\n pathVertLine.setAttribute('stroke', 'black');\n\n this.vertLineArrow.appendChild(pathVertLine);\n\n this.defs.appendChild(this.vertLineArrow);\n\n // Removed with z stacking ?\n // this.plotGroup.setAttribute( 'clip-path', 'url(#_clipplot' + this._creation + ')' );\n\n this.bypassHandleMouse = false;\n }\n\n function _registerEvents(graph) {\n var self = graph;\n\n if (!graph.wrapper) {\n throw 'No wrapper exists. Cannot register the events.';\n }\n\n graph.dom.setAttribute('tabindex', 0);\n\n graph.dom.addEventListener('keydown', e => {\n _handleKey(graph, e, 'keydown');\n });\n\n graph.dom.addEventListener('keypress', e => {\n _handleKey(graph, e, 'keypress');\n });\n\n graph.dom.addEventListener('keyup', e => {\n _handleKey(graph, e, 'keyup');\n });\n // Not sure this has to be prevented\n\n // August 17th, 2017: I extended the graph.groupEvent to the more general graph.dom to make the zoom plugin more\n // intuitive. Let us see if it breaks another example...\n graph.dom.addEventListener('mousemove', e => {\n //e.preventDefault();\n var coords = graph._getXY(e);\n _handleMouseMove(graph, coords.x, coords.y, e);\n });\n\n graph.dom.addEventListener('mouseleave', e => {\n\n _handleMouseLeave(graph);\n });\n\n graph.groupEvent.addEventListener('mousedown', e => {\n\n graph.focus();\n\n // e.preventDefault();\n if (e.which == 3 || e.ctrlKey) {\n return;\n }\n\n var coords = graph._getXY(e);\n _handleMouseDown(graph, coords.x, coords.y, e);\n });\n\n graph.dom.addEventListener('mouseup', e => {\n\n graph.emit('mouseUp', e);\n var coords = graph._getXY(e);\n\n _handleMouseUp(graph, coords.x, coords.y, e);\n });\n\n graph.wrapper.addEventListener('mouseup', e => {\n e.stopPropagation();\n });\n\n graph.dom.addEventListener('dblclick', e => {\n\n graph.emit('dblClick', e);\n var coords = graph._getXY(e);\n\n _handleDblClick(graph, coords.x, coords.y, e);\n });\n\n graph.groupEvent.addEventListener('click', e => {\n\n // Cancel right click or Command+Click\n if (e.which == 3 || e.ctrlKey) {\n return;\n }\n\n // e.preventDefault();\n var coords = graph._getXY(e);\n\n if (!graph.prevent(false)) {\n _handleClick(graph, coords.x, coords.y, e);\n }\n\n //}, 200 );\n });\n\n graph.groupEvent.addEventListener('mousewheel', e => {\n\n var deltaY = e.wheelDeltaY || e.wheelDelta || -e.deltaY;\n var coords = graph._getXY(e);\n _handleMouseWheel(graph, deltaY, coords.x, coords.y, e);\n\n return false;\n });\n\n graph.groupEvent.addEventListener('wheel', e => {\n\n var coords = graph._getXY(e);\n var deltaY = e.wheelDeltaY || e.wheelDelta || -e.deltaY;\n _handleMouseWheel(graph, deltaY, coords.x, coords.y, e);\n\n return false;\n });\n }\n\n function _handleMouseDown(graph, x, y, e) {\n\n var self = graph;\n\n if (graph.forcedPlugin) {\n\n graph.activePlugin = graph.forcedPlugin;\n graph._pluginExecute(graph.activePlugin, 'onMouseDown', [graph, x, y, e]);\n return;\n }\n\n if (graph.activePlugin) {\n graph.activePlugin = false;\n }\n\n checkMouseActions(graph, e, [graph, x, y, e], 'onMouseDown');\n }\n\n function _handleMouseMove(graph, x, y, e) {\n\n if (graph.bypassHandleMouse) {\n graph.bypassHandleMouse.handleMouseMove(e);\n return;\n }\n\n if (graph.activePlugin && graph._pluginExecute(graph.activePlugin, 'onMouseMove', [graph, x, y, e])) {\n return;\n }\n\n //\t\t\treturn;\n\n graph._applyToAxes('handleMouseMove', [x - graph.options.paddingLeft, e], true, false);\n graph._applyToAxes('handleMouseMove', [y - graph.options.paddingTop, e], false, true);\n\n if (!graph.activePlugin) {\n var index;\n\n // Takes care of the tracking line\n if (graph.options.trackingLine && graph.options.trackingLine.enable && graph.options.trackingLine.snapToSerie) {\n\n if (graph.options.trackingLine.mode == 'common') {\n\n var snapToSerie = graph.options.trackingLine.snapToSerie;\n index = snapToSerie.handleMouseMove(false, true);\n\n if (this.trackingObject) {\n\n if (!index) {\n\n graph.trackingObject.hide();\n } else {\n\n graph.trackingObject.show();\n\n graph.trackingObject.getPosition(0).x = index.xClosest;\n graph.trackingObject.getPosition(1).x = index.xClosest;\n graph.trackingObject.redraw();\n\n var x = snapToSerie.getXAxis().getPx(index.xClosest) + graph.options.paddingLeft;\n }\n }\n\n var series = graph.options.trackingLine.series;\n\n // Gets a default value\n if (!series) {\n\n series = graph.getSeries().map(function (serie) {\n return {\n serie: serie,\n withinPx: 20,\n withinVal: -1\n };\n });\n }\n\n graph._trackingLegend = _trackingLegendSerie(graph, series, x, y, graph._trackingLegend, graph.options.trackingLine.textMethod, index.xClosest);\n }\n }\n }\n // End takes care of the tracking line\n\n if (graph.options.onMouseMoveData) {\n var results = {};\n\n for (var i = 0; i < graph.series.length; i++) {\n\n results[graph.series[i].getName()] = graph.series[i].handleMouseMove(false, true);\n }\n\n graph.options.onMouseMoveData.call(graph, e, results);\n }\n\n checkMouseActions(graph, e, [graph, x, y, e], 'onMouseMove');\n }\n\n function checkMouseActions(graph, e, parameters, methodName) {\n\n var keyComb = graph.options.mouseActions,\n i,\n l,\n executed = false;\n\n for (i = 0, l = keyComb.length; i < l; i++) {\n\n if (keyComb[i].plugin) {\n // Is it a plugin ?\n\n if (graph.forcedPlugin == keyComb[i].plugin || graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n // Lease the mouse action to the current action\n // 25.10.2017: Except for mousewheel. See #111\n if (e.type !== 'wheel' && e.type !== 'mousewheel') {\n graph.activePlugin = keyComb[i].plugin;\n }\n\n graph._pluginExecute(keyComb[i].plugin, methodName, parameters);\n executed = true;\n continue;\n }\n } else if (keyComb[i].callback && graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n keyComb[i].callback.apply(graph, parameters);\n executed = true;\n continue;\n } else if (keyComb[i].series) {\n\n var series;\n if (keyComb[i].series === 'all') {\n series = graph.series;\n }\n\n if (!Array.isArray(keyComb[i].series)) {\n series = [series];\n }\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n for (var j = 0; j < series.length; i++) {\n graph._serieExecute(series[i], methodName, parameters);\n }\n executed = true;\n continue;\n }\n }\n\n return executed;\n }\n\n var _trackingLegendSerie = function (graph, serie, x, y, legend, textMethod, xValue) {\n\n var justCreated = false;\n\n if (!Array.isArray(serie)) {\n serie = [serie];\n }\n\n var output = [];\n\n if (!legend && graph.options.trackingLine.legend) {\n justCreated = true;\n legend = _makeTrackingLegend(graph);\n }\n\n serie.map(serie => {\n\n var index = serie.serie.handleMouseMove(xValue, false);\n\n if (!index || !textMethod) {\n\n if (serie.serie.trackingShape) {\n serie.serie.trackingShape.hide();\n }\n\n return legend;\n }\n\n // Should we display the dot ?\n if (serie.withinPx > 0 && Math.abs(x - graph.options.paddingLeft - serie.serie.getXAxis().getPx(index.xClosest)) - serie.withinPx > 1e-14 || serie.withinVal > 0 && Math.abs(serie.serie.getXAxis().getVal(x - graph.options.paddingLeft) - index.xClosest) - serie.withinVal > serie.serie.getXAxis().getVal(x - graph.options.paddingLeft) / 100000) {\n\n if (serie.serie.trackingShape) {\n serie.serie.trackingShape.hide();\n }\n } else {\n\n output[serie.serie.getName()] = {\n\n yValue: index.xClosest,\n xValue: index.yClosest,\n serie: serie,\n index: index\n\n };\n\n let serieShape;\n if (graph.options.trackingLine && graph.options.trackingLine.serieShape) {\n serieShape = graph.options.trackingLine.serieShape;\n } else {\n serieShape = {\n shape: 'ellipse',\n properties: {\n rx: [serie.serie.getLineWidth() * 3 + 'px'],\n ry: [serie.serie.getLineWidth() * 3 + 'px']\n }\n };\n }\n\n if (!serie.serie.trackingShape) {\n\n serie.serie.trackingShape = graph.newShape(serieShape.shape, {\n fillColor: serie.serie.getLineColor(),\n strokeColor: 'White',\n strokeWidth: serie.serie.getLineWidth()\n }, true, serieShape.properties).setSerie(serie.serie).forceParentDom(serie.serie.groupMain).draw();\n\n serieShape.onCreated && serieShape.onCreated(serie.serie.trackingShape);\n\n serie.serie.trackingShape.on('changed', () => {\n\n serieShape.onChanged && serieShape.onChanged(serie.serie.trackingShape);\n });\n }\n\n serie.serie.trackingShape.show();\n serie.serie.trackingShape.getPosition(0).x = index.xClosest;\n\n if (serieShape.magnet) {\n\n let magnetOptions = serieShape.magnet,\n val = magnetOptions.within,\n minmaxpos;\n\n if (magnetOptions.withinPx) {\n val = serie.serie.getXAxis().getRelVal(magnetOptions.withinPx);\n }\n\n if (minmaxpos = serie.serie.findLocalMinMax(index.xClosest, val, magnetOptions.mode)) {\n\n serie.serie.trackingShape.getPosition(0).x = minmaxpos;\n }\n }\n\n serie.serie.trackingShape.redraw();\n }\n }); // End map\n\n if (!graph.options.trackingLine.legend) {\n return;\n }\n\n if (Object.keys(output).length == 0 || !textMethod) {\n legend.style.display = 'none';\n } else {\n\n if (legend.style.display == 'none' || justCreated) {\n\n forceTrackingLegendMode(graph, legend, x, y, true);\n } else {\n _trackingLegendMove(graph, legend, x, y);\n }\n\n legend.style.display = 'block';\n var txt = textMethod(output, xValue, x, y);\n\n legend.innerHTML = txt;\n\n //legend.innerHTML = textMethod( output, xValue, x, y );\n }\n\n return legend;\n };\n\n var forceTrackingLegendMode = function (graph, legend, toX, toY, skip) {\n\n var ratio = 0,\n start = Date.now(),\n h = legend.offsetHeight,\n startX = parseInt(legend.style.marginLeft.replace('px', '') || 0),\n startY = parseInt(legend.style.marginTop.replace('px', '') || 0);\n\n toX = toX > graph.getWidth() / 2 ? toX - toX % 10 - 20 - legend.offsetWidth : toX - toX % 10 + 30;\n toY = toY - toY % 10 + h / 2;\n\n if (skip) {\n legend.style.marginLeft = toX + 'px';\n legend.style.marginTop = toY + 'px';\n return;\n }\n\n function next() {\n\n var progress = (Date.now() - start) / 200;\n if (progress > 1) {\n progress = 1;\n }\n\n legend.style.marginLeft = (toX - startX) * progress + startX + 'px';\n legend.style.marginTop = (toY - startY) * progress + startY + 'px';\n\n if (progress < 1) {\n window.requestAnimationFrame(next);\n }\n }\n\n window.requestAnimationFrame(next);\n };\n\n var _trackingLegendMove = util.debounce(forceTrackingLegendMode, 50);\n\n function _makeTrackingLegend(graph) {\n\n var group = document.createElement('div');\n group.setAttribute('class', 'trackingLegend');\n group.style.position = 'absolute';\n group.style.borderRadius = '4px';\n group.style.boxShadow = '1px 1px 3px 0px rgba(100,100,100,0.6)';\n group.style.border = '2px solid #333333';\n group.style.backgroundColor = 'rgba(255, 255, 255, 0.5 )';\n group.style.pointerEvents = 'none';\n group.style.paddingTop = '5px';\n group.style.paddingBottom = '5px';\n group.style.paddingLeft = '10px';\n group.style.paddingRight = '10px';\n\n graph.getWrapper().insertBefore(group, graph.getDom());\n\n return group;\n }\n\n function _handleDblClick(graph, x, y, e) {\n //\tvar _x = x - graph.options.paddingLeft;\n //\tvar _y = y - graph.options.paddingTop;\n var pref = graph.options.dblclick;\n checkMouseActions(graph, e, [x, y, e], 'onDblClick');\n /*\n if ( !pref || !pref.type ) {\n return;\n }\n switch ( pref.type ) {\n case 'plugin':\n var plugin;\n if ( ( plugin = graph.plugins[ pref.plugin ] ) ) {\n plugin.onDblClick( graph, x, y, pref.options, e );\n }\n break;\n }*/\n }\n\n function _handleMouseUp(graph, x, y, e) {\n\n if (graph.bypassHandleMouse) {\n graph.bypassHandleMouse.handleMouseUp(e);\n graph.activePlugin = false;\n return;\n }\n\n graph._pluginExecute(graph.activePlugin, 'onMouseUp', [graph, x, y, e]);\n graph.activePlugin = false;\n }\n\n function _handleClick(graph, x, y, e) {\n\n graph.emit('click', [graph, x, y, e]);\n // Not on a shape\n checkMouseActions(graph, e, [x, y, e], 'onClick');\n\n if (!e.target.jsGraphIsShape && !graph.prevent(false) && graph.options.shapesUnselectOnClick) {\n\n graph.unselectShapes();\n }\n }\n\n function _getAxis(graph, num, options, pos) {\n\n var options = options || {};\n var inst;\n\n var _availableAxes = {\n\n def: {\n x: graph.getConstructor('graph.axis.x'),\n y: graph.getConstructor('graph.axis.y')\n },\n\n time: {\n x: graph.getConstructor('graph.axis.x.time')\n },\n\n bar: {\n x: graph.getConstructor('graph.axis.x.bar')\n }\n };\n\n switch (options.type) {\n\n case 'time':\n var axisInstance = _availableAxes.time;\n break;\n\n case 'bar':\n var axisInstance = _availableAxes.bar;\n break;\n\n case 'broken':\n var axisInstance = _availableAxes.broken;\n break;\n\n default:\n var axisInstance = _availableAxes.def;\n break;\n }\n\n switch (pos) {\n\n case 'top':\n case 'bottom':\n inst = axisInstance.x;\n break;\n\n case 'left':\n case 'right':\n inst = axisInstance.y;\n break;\n }\n\n num = num || 0;\n\n if (typeof num == 'object') {\n options = num;\n num = 0;\n }\n\n if (!graph.axis[pos][num]) {\n\n graph.axis[pos][num] = new inst(graph, pos, options);\n graph.axis[pos][num].init(graph, options);\n }\n\n return graph.axis[pos][num];\n }\n\n function _closeLine(graph, mode, x1, x2, y1, y2) {\n\n if (graph.options.close === false) {\n return;\n }\n\n var l = 0;\n\n graph.axis[mode].map(function (g) {\n\n if (g.isDisplayed() && !g.floating) {\n l++;\n }\n });\n\n if ((graph.options.close === true || graph.options.close[mode]) && l == 0) {\n\n graph.closingLines[mode].setAttribute('display', 'block');\n graph.closingLines[mode].setAttribute('x1', x1);\n graph.closingLines[mode].setAttribute('x2', x2);\n graph.closingLines[mode].setAttribute('y1', y1);\n graph.closingLines[mode].setAttribute('y2', y2);\n } else {\n\n graph.closingLines[mode].setAttribute('display', 'none');\n }\n }\n\n function _handleMouseWheel(graph, delta, coordX, coordY, e) {\n if (checkMouseActions(graph, e, [delta, e, coordX, coordY], 'onMouseWheel')) {\n e.preventDefault();\n e.stopPropagation();\n }\n }\n\n function _handleMouseLeave(graph) {\n if (graph.options.handleMouseLeave) {\n graph.options.handleMouseLeave.call(graph);\n }\n }\n\n function haveAxesChanged(graph) {\n var temp = graph._axesHaveChanged;\n graph._axesHaveChanged = false;\n return temp;\n }\n\n function hasSizeChanged(graph) {\n var temp = graph._sizeChanged;\n graph._sizeChanged = false;\n return temp;\n }\n\n // Constants\n Graph.SERIE_LINE = Symbol();\n Graph.SERIE_SCATTER = Symbol();\n Graph.SERIE_CONTOUR = Symbol();\n Graph.SERIE_BAR = Symbol();\n Graph.SERIE_BOX = Symbol();\n Graph.SERIE_ZONE = Symbol();\n Graph.SERIE_LINE_COLORED = Symbol();\n Graph.SERIE_ZONE = Symbol();\n Graph.SERIE_DENSITYMAP = Symbol();\n Graph.SERIE_LINE_3D = Symbol();\n Graph.SERIE_ZONE_3D = Symbol();\n\n Graph.TICKS_OUTSIDE = Symbol();\n Graph.TICKS_INSIDE = Symbol();\n Graph.TICKS_CENTERED = Symbol();\n\n Graph.ns = 'http://www.w3.org/2000/svg';\n Graph.nsxlink = 'http://www.w3.org/1999/xlink';\n\n exports.default = Graph;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(13), __webpack_require__(20)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./fit_lm'), require('extend'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.fit_lm, global.extend);\n global.waveform = mod.exports;\n }\n})(this, function (module, exports, _fit_lm, _extend) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _fit_lm2 = _interopRequireDefault(_fit_lm);\n\n var _extend2 = _interopRequireDefault(_extend);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n class Waveform {\n\n constructor(data = [], xOffset = 0, xScale = 1) {\n\n this.xOffset = xOffset;\n this.xScale = xScale;\n this.setData(data);\n }\n\n /** [ [ x1, y1 ], [ x2, y2 ] ] */\n\n /*\n setDataXY( data ) {\n let newData = [ this._makeArray( data.length ), this._makeArray( data.length ) ],\n warnNaN = false;\n const nanable = this.isNaNAllowed();\n data.map( ( el, index ) => {\n if ( !nanable && ( el[ 0 ] !== el[ 0 ] || el[ 1 ] !== el[ 1 ] ) ) {\n warnNaN = true;\n }\n newData[ 0 ][ index ] = el[ 0 ];\n newData[ 1 ][ index ] = el[ 1 ];\n } );\n if ( warnNaN ) {\n this.warn( \"Trying to assign NaN values to a typed array that does not support NaNs. 0's will be used instead\" );\n }\n this._setData( ...newData );\n return this;\n }\n */\n setData(data, dataX = null) {\n\n /* First, we must treat the case of the array of array for backward compatibility */\n if (Array.isArray(data[0])) {\n let x = [];\n let y = [];\n data.forEach(el => {\n x.push(el[0]);\n y.push(el[1]);\n });\n\n this.setXWaveform(x);\n data = y;\n }\n\n let newData = this._makeArray(data.length),\n warnNaN = false;\n\n const nanable = this.isNaNAllowed();\n\n data.map((el, index) => {\n\n if (!nanable && (el[0] !== el[0] || el[1] !== el[1])) {\n warnNaN = true;\n }\n\n newData[index] = el;\n });\n\n if (warnNaN) {\n this.warn(\"Trying to assign NaN values to a typed array that does not support NaNs. 0's will be used instead\");\n }\n\n this._setData(newData);\n\n if (dataX) {\n this.setXWaveform(dataX);\n }\n return this;\n }\n\n getY(index, optimized) {\n\n if (optimized && this.dataInUse) {\n return this.dataInUse.y[index] * this.getScale() + this.getShift();\n }\n\n return this.data[index] * this.getScale() + this.getShift();\n }\n\n /*\n flipXY() {\n let temp;\n temp = this.data.x;\n this.data.x = this.data.y;\n this.data.y = temp;\n this._setData( this.data.x, this.data.y );\n }*/\n\n setXWaveform(waveform) {\n\n if (!(waveform instanceof Waveform)) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n } else {\n throw \"Cannot set X waveform. Data is not a valid array.\";\n }\n }\n\n this.xdata = waveform;\n this.computeXMinMax();\n return this;\n }\n\n hasXWaveform() {\n return !!this.xdata;\n }\n\n getXWaveform() {\n if (this.xdata) {\n return this.xdata;\n }\n\n var wave = new Waveform();\n for (var i = 0; i < this.getLength(); i += 1) {\n wave.append(this.getX(i));\n }\n return wave;\n }\n\n rescaleX(offset, scale) {\n this.xScale = scale;\n this.xOffset = offset;\n this.computeXMinMax();\n return this;\n }\n\n getTypedArrayClass() {\n return this._typedArrayClass || false;\n }\n\n setTypedArrayClass(constructor) {\n\n if (this.getTypedArrayClass() && this.isNaNAllowed() && !this.isNaNAllowed(constructor)) {\n this.warn(\"NaN values are not allowed by the new constructor (\" + constructor.name + \") while it was allowed by the previous one (\" + this._typedArrayClass.name + \")\");\n }\n\n if (this.getTypedArrayClass() && this.isUnsigned() && !this.isUnsigned(constructor)) {\n this.warn(\"You are switching from signed values to unsigned values. You may experience data corruption if there were some negative values.\");\n }\n\n this._typedArrayClass = constructor;\n\n if (this.data) {\n this._setData(constructor.from(this.data));\n }\n\n if (this.hasXWaveform()) {\n this.getXWaveform().setTypedArrayClass(constructor);\n }\n }\n\n isNaNAllowed(constructor = this._typedArrayClass) {\n\n // The following types accept NaNs\n return constructor == Array || constructor == Float32Array || constructor == Float64Array;\n }\n\n isUnsigned(constructor = this._typedArrayClass) {\n\n // The following types accept NaNs\n return constructor == Uint8Array || constructor == Uint8ClampedArray || constructor == Uint16Array || constructor == Uint32Array;\n }\n\n recalculateMinMaxNewPoint(x, y) {\n if (x < this.minX || this.minX === undefined) {\n this.minX = x;\n }\n\n if (x > this.maxX || this.maxX === undefined) {\n this.maxX = x;\n }\n\n if (y < this.minY || this.minY === undefined) {\n this.minY = y;\n }\n\n if (y > this.maxY || this.maxY === undefined) {\n this.maxY = y;\n }\n }\n\n prepend(x, y) {\n\n if (typeof x == \"function\") {\n x = x(this);\n }\n\n if (typeof y == \"function\") {\n y = y(this);\n }\n\n if (this.xdata) {\n this.xdata.prepend(null, x);\n } else if (x !== null) {\n this.xdata = this.getXWaveform();\n this.xdata.prepend(null, x);\n } else {\n this.xOffset -= this.xScale;\n }\n\n this.data.unshift(y);\n this.recalculateMinMaxNewPoint(x, y);\n return this;\n }\n\n append(x, y) {\n\n if (typeof x == \"function\") {\n x = x(this);\n }\n\n if (typeof y == \"function\") {\n y = y(this);\n }\n\n if (this.xdata) {\n this.xdata.append(null, x);\n } else if (x !== null) {\n this.xdata = this.getXWaveform();\n this.xdata.append(null, x);\n }\n\n if (this.monotoneous) {\n if (y > this.data[this.data.y] && this.getMonotoneousAscending() === false) {\n this.monotoneous = false;\n } else if (y < this.data[this.data.y] && this.getMonotoneousAscending() === true) {\n this.monotoneous = false;\n }\n }\n\n if (this.data.length == 1 || this._monotoneousAscending === undefined) {\n\n this.monotoneous = true;\n\n if (y == this.data[0]) {\n this._monotoneousAscending = undefined;\n } else {\n this._monotoneousAscending = y > this.data[0];\n }\n }\n\n this.data.push(y);\n this.recalculateMinMaxNewPoint(x, y);\n\n return this;\n }\n\n _makeArray(length) {\n\n const constructor = this.getTypedArrayClass();\n if (constructor) {\n return new constructor(length);\n }\n return new Array(length);\n }\n\n _setData(dataY) {\n const l = dataY.length;\n let i = 1,\n monoDir = dataY[1] > dataY[0],\n minY = dataY[0],\n maxY = dataY[0];\n\n this._monotoneous = true;\n\n for (; i < l; i++) {\n if (dataY[i] !== dataY[i - 1] && monoDir !== dataY[i] > dataY[i - 1]) {\n this._monotoneous = false;\n }\n\n if (dataY[i] === dataY[i]) {\n // NaN support\n minY = Math.min(dataY[i], minY);\n maxY = Math.max(dataY[i], maxY);\n }\n }\n\n if (this._monotoneous) {\n this._monotoneousAscending = dataY[1] > dataY[0];\n }\n\n this.minY = minY;\n this.maxY = maxY;\n\n this.data = dataY;\n\n this.computeXMinMax();\n }\n\n computeXMinMax() {\n\n if (!this.data) {\n\n return;\n }\n\n if (this.xdata) {\n\n this.minX = this.xdata.getMin();\n this.maxX = this.xdata.getMax();\n } else {\n\n const b1 = this.xOffset + this.xScale * this.getLength(),\n b2 = this.xOffset;\n\n this.minX = Math.min(b1, b2);\n this.maxX = Math.max(b1, b2);\n }\n }\n\n getDataInUse() {\n return this.dataInUse || this.data;\n }\n\n getIndexFromVal(val, useDataToUse = false, roundingMethod = Math.round) {\n\n let data;\n\n if (useDataToUse && this.dataInUse) {\n data = this.dataInUse.y;\n } else {\n data = this.data;\n }\n\n let position;\n\n position = this.getIndexFromData(val, data, this.data.getMonotoneousAscending(), roundingMethod);\n\n if (useDataToUse && this.dataInUse && this.dataInUseType == \"aggregateY\") {\n // In case of aggregation, round to the closest element of 4.\n return position - position % 4;\n }\n\n return position;\n }\n\n getIndexFromX(xval, useDataToUse = false, roundingMethod = Math.round) {\n\n let xdata;\n\n if (useDataToUse && this.dataInUse) {\n xdata = this.dataInUse.x;\n } else if (this.xdata) {\n xdata = this.xdata.getData();\n }\n\n let position;\n\n if (this.hasXWaveform()) {\n position = this.xdata.getIndexFromData(xval, xdata, this.xdata.getMonotoneousAscending(), roundingMethod);\n } else {\n position = Math.max(0, Math.min(this.getLength() - 1, roundingMethod((xval - this.xOffset) / this.xScale)));\n }\n\n if (useDataToUse && this.dataInUse && this.dataInUseType == \"aggregateX\") {\n // In case of aggregation, round to the closest element of 4.\n return position - position % 4;\n }\n\n return position;\n }\n\n getIndexFromData(val, valCollection, isAscending, roundingMethod) {\n\n if (!this.isMonotoneous()) {\n console.trace();\n throw \"Impossible to get the index from a non-monotoneous wave !\";\n }\n\n let data, position;\n\n val -= this.getShift();\n val /= this.getScale();\n\n return binarySearch(val, valCollection, !isAscending);\n }\n\n getReductionType() {\n return this.dataInUseType;\n }\n\n getXMin() {\n return this.minX * this.getXScale() + this.getXShift();\n }\n\n getXMax() {\n return this.maxX * this.getXScale() + this.getXShift();\n }\n\n getYMin() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getYMax() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getMin() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getMax() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getMinX() {\n\n return this.minX * this.getXScale() + this.getXShift();\n }\n\n getMaxX() {\n return this.maxX * this.getXScale() + this.getXShift();\n }\n\n getMinY() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getMaxY() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getDataY() {\n return this.data;\n }\n\n getData(optimized) {\n if (!optimized || !this.dataInUse) {\n return this.data;\n }\n return this.dataInUse.y;\n }\n\n setShift(shift = 0) {\n\n // We must update the min and the max of the y data\n //this.minY += ( shift - this.getShift() );\n //this.maxY += ( shift - this.getShift() );\n this.shift = shift;\n return this;\n }\n\n getShift() {\n return this.shift || 0;\n }\n\n getScale() {\n return this.scale || 1;\n }\n\n setScale(scale = 1) {\n\n // this.minY = ( this.minY - this.getShift() ) * scale;\n // this.maxY = ( this.maxY - this.getShift() ) * scale;\n this.scale = scale;\n return this;\n }\n\n setXShift(shift = 0) {\n\n if (!this.hasXWaveform) {\n return this;\n }\n\n // We must update the min and the max of the x data\n // That's important for when the data has already been set\n // this.minX += ( shift - this.getXShift() );\n // this.maxX += ( shift - this.getXShift() );\n this.getXWaveform().setShift(shift);\n return this;\n }\n\n getXShift(shift = 0) {\n\n if (!this.hasXWaveform) {\n return 0;\n }\n\n return this.getXWaveform().getShift();\n }\n\n setXScale(scale = 1) {\n\n if (!this.hasXWaveform) {\n return this;\n }\n\n this.getXWaveform().setScale(scale);\n return this;\n }\n\n getXScale() {\n\n if (!this.hasXWaveform) {\n return 1;\n }\n\n return this.getXWaveform().getScale();\n }\n\n getLength() {\n return this.data.length;\n }\n\n getDataToUseFlat() {\n\n let l;\n let j = 0;\n let arr;\n\n if (this.dataInUse) {\n\n l = this.dataInUse.x.length;\n arr = new Array(l * 2).fill(0);\n\n for (var i = 0; i < l; i += 1) {\n arr[j] = this.dataInUse.x[i];\n arr[j + 1] = this.dataInUse.y[i];\n j += 2;\n }\n } else {\n\n l = this.getLength();\n arr = new Array(l * 2).fill(0);\n for (var i = 0; i < l; i += 1) {\n arr[j + 1] = this.data[i];\n arr[j] = this.getX(i);\n j += 2;\n }\n }\n\n return arr;\n }\n\n fit(options) {\n\n var self = this;\n\n return new Promise(function (resolver, rejector) {\n\n var fit = new _fit_lm2.default((0, _extend2.default)({}, {\n\n dataY: self,\n dataX: self.getXWaveform(),\n done: function (results) {\n resolver(results);\n },\n waveform: new Waveform()\n\n }, options));\n\n fit.init();\n fit.fit();\n });\n }\n\n getX(index, optimized) {\n\n if (optimized && this.dataInUse) {\n return this.dataInUse.x[index] * this.getXScale() + this.getXShift();\n }\n\n if (this.xdata) {\n return this.xdata.data[index] * this.getXScale() + this.getXShift();\n } else {\n return this.xOffset + index * this.xScale;\n }\n }\n\n getXRaw(index, optimized) {\n\n if (optimized && this.dataInUse) {\n return this.dataInUse.x[index];\n }\n\n if (this.xdata) {\n return this.xdata.data[index];\n } else {\n return index;\n }\n }\n\n _integrateP(from = 0, to = this.getLength() - 1) {\n\n from = Math.round(from);\n to = Math.round(to);\n\n if (from > to) {\n let temp = from;\n from = to;\n to = temp;\n }\n\n var l = to - from + 1;\n var sum = 0,\n delta;\n\n let deltaTot = 0;\n let diff;\n var arrY = this.getData();\n\n for (; from <= to; from++) {\n\n if (arrY.length - 1 > from) {\n diff = this.getX(from + 1) - this.getX(from);\n deltaTot += diff;\n sum += arrY[from] * diff;\n }\n }\n\n return [sum, l, deltaTot];\n }\n\n integrateP(from, to) {\n var val = this._integrateP(from, to);\n return val[0];\n }\n\n integrate(fromX, toX) {\n return this.integrateP(this.getIndexFromX(fromX), this.getIndexFromX(toX));\n }\n\n average(p0 = 0, p1 = this.getLength() - 1) {\n return this.getAverageP(p0, p1);\n }\n\n mean() {\n return this.average();\n }\n\n getAverageP(from, to) {\n var sum = this._integrateP(from, to);\n return sum[0] / sum[2];\n }\n\n getAverageX(from, to) {\n var sum = this._integrateX(from, to);\n return sum[0] / sum[2];\n }\n\n checkMonotonicity() {\n\n let i = 1,\n data = this.getData();\n const l = this.data.length;\n let dir = data[1] > data[0];\n\n for (; i < l; i++) {\n if (data[i] !== data[i - 1] && dir !== data[i] > data[i - 1]) {\n return this._monotoneous = false;\n }\n }\n\n this._monotoneousAscending = data[1] > data[0];\n return this._monotoneous = true;\n }\n\n requireXMonotonicity() {\n if (this.xdata) {\n this.xdata.requireMonotonicity();\n }\n }\n\n requireMonotonicity() {\n if (!this.isMonotoneous()) {\n throw \"The wave must be monotonic\";\n }\n }\n\n isMonotoneous() {\n return !!this._monotoneous;\n }\n\n isXMonotoneous() {\n if (this.xdata) {\n return this.xdata.isMonotoneous();\n }\n // Offset and scale is always monotoneous\n return true;\n }\n\n invert(data) {\n\n let d = dataY || this.data;\n d.reverse();\n\n if (this.isMonotoneous()) {\n this._monotoneousAscending = !this._monotoneousAscending;\n }\n\n return d;\n }\n\n resampleForDisplay(options) {\n // Serie redrawing\n\n let i = 0;\n\n this.requireXMonotonicity();\n\n let inverting = false,\n dataY = this.getDataY(),\n data = {\n x: [],\n y: []\n },\n dataMinMax = [],\n resampleSum,\n resampleMin,\n resampleMax,\n resampleNum,\n resample_x_start,\n resample_x_px_start,\n x_px,\n doing_mean = false,\n firstPointIndex = 0,\n xval;\n\n const l = this.getLength();\n\n if (!options.xPosition) {\n throw \"No position calculation method provided\";\n }\n\n if (!options.resampleToPx) {\n throw \"No \\\"resampleToPx\\\" method was provided. Unit: px per point\";\n }\n\n if (options.minX > options.maxX) {\n let temp = options.minX;\n options.minX = options.maxX;\n options.maxX = temp;\n }\n\n if (this.xdata && !this.xdata.getMonotoneousAscending() || !this.xdata && this.xScale < -0) {\n inverting = true;\n i = l;\n }\n\n for (; inverting ? i > 0 : i < l; inverting ? i-- : i++) {\n\n xval = this.getX(i);\n\n if (options.minX > xval) {\n\n firstPointIndex = i;\n continue;\n }\n\n x_px = options.xPosition(xval);\n\n if (!doing_mean) {\n\n if (!firstPointIndex) {\n\n firstPointIndex = i;\n } else {\n\n data.x.push(xval);\n data.y.push(dataY[firstPointIndex]);\n }\n\n while (isNaN(dataY[i])) {\n\n if (inverting) {\n i--;\n } else {\n i++;\n }\n }\n\n resampleSum = resampleMin = resampleMax = dataY[firstPointIndex];\n resampleNum = 1;\n resample_x_px_start = x_px;\n resample_x_start = xval;\n firstPointIndex = 0;\n\n doing_mean = true;\n\n continue;\n }\n\n if (Math.abs(x_px - resample_x_px_start) > options.resampleToPx || i == l || i == 0 || isNaN(dataY[i])) {\n\n let xpos = (resample_x_start + xval) / 2;\n\n data.x.push(xpos);\n data.y.push(resampleSum / resampleNum);\n\n dataMinMax.push(xpos, resampleMin, resampleMax);\n\n if (options.maxX !== undefined && xval > options.maxX) {\n\n break;\n }\n\n doing_mean = false;\n\n continue;\n }\n\n resampleSum += dataY[i];\n resampleNum++;\n\n resampleMin = Math.min(resampleMin, dataY[i]);\n resampleMax = Math.max(resampleMax, dataY[i]);\n }\n\n this.dataInUseType = \"resampled\";\n this.dataInUse = data;\n return dataMinMax;\n }\n\n interpolate(x) {\n\n let yData = this.getDataY();\n let xIndex;\n\n if (this.xdata) {\n let xData = this.xdata.getData();\n xIndex = binarySearch(x, xData, !this.xdata.getMonotoneousAscending());\n if (xData[xIndex] == x) {\n return yData[xIndex];\n }\n return (x - xData[xIndex]) / (xData[xIndex + 1] - xData[xIndex]) * (yData[xIndex + 1] - yData[xIndex]) + yData[xIndex];\n } else {\n xIndex = (x - this.xOffset) / this.xScale;\n let xIndexF = Math.floor(xIndex);\n return (xIndex - xIndexF) * (yData[xIndexF + 1] - yData[xIndexF]) + yData[xIndexF];\n }\n }\n\n interpolateIndex_X(index) {\n\n let yData = this.getDataY();\n if (this.xdata) {\n let xData = this.xdata.getData();\n let indexStart = Math.floor(index);\n\n return (index - indexStart) * (xData[indexStart + 1] - xData[indexStart]) + xData[indexStart];\n }\n }\n\n getMonotoneousAscending() {\n\n if (!this.isMonotoneous()) {\n return \"The waveform is not monotoneous\";\n }\n\n return this._monotoneousAscending;\n }\n\n getXMonotoneousAscending() {\n if (this.xdata) {\n return this.xdata.getMonotoneousAscending();\n }\n\n return this.xScale > 0;\n }\n\n isXMonotoneousAscending() {\n return this.getXMonotoneousAscending(...arguments);\n }\n\n divide(numberOrWave) {\n return this._arithmetic(numberOrWave, DIVIDE);\n }\n\n divideBy() {\n return this.divide(...arguments);\n }\n\n multiply(numberOrWave) {\n return this._arithmetic(numberOrWave, MULTIPLY);\n }\n\n multiplyBy() {\n return this.multiply(...arguments);\n }\n\n log() {\n return this.logBase(10);\n }\n\n ln() {\n return this.logBase(Math.E);\n }\n\n logBase(base) {\n\n let logBase = Math.log(base);\n this.data.map(valY => {\n\n return Math.log(valY) / logBase;\n });\n }\n\n add(numberOrWave) {\n return this._arithmetic(numberOrWave, ADD);\n }\n\n addBy() {\n return this.add(...arguments);\n }\n\n subtract(numberOrWave) {\n return this._arithmetic(numberOrWave, SUBTRACT);\n }\n\n subtractBy() {\n return this.subtract(...arguments);\n }\n\n math(method) {\n\n for (var i = 0; i < this.getLength(); i++) {\n this.data[i] = method(this.getY(i), this.getX(i));\n }\n\n this._setData(this.data);\n return this;\n }\n\n _arithmetic(numberOrWave, operator) {\n\n if (numberOrWave instanceof Waveform) {\n return this._waveArithmetic(numberOrWave, operator);\n } else if (typeof numberOrWave == 'number') {\n\n return this._numberArithmetic(numberOrWave, operator);\n }\n }\n\n _numberArithmetic(num, operation) {\n\n let i = 0,\n l = this.getLength();\n\n if (operation == MULTIPLY) {\n\n for (; i < l; i++) {\n this.data[i] *= num;\n }\n\n this.minY *= num;\n this.maxY *= num;\n } else if (operation == DIVIDE) {\n\n for (; i < l; i++) {\n this.data[i] /= num;\n }\n\n this.minY /= num;\n this.maxY /= num;\n } else if (operation == ADD) {\n\n for (; i < l; i++) {\n this.data[i] += num;\n }\n\n this.minY += num;\n this.maxY += num;\n } else if (operation == SUBTRACT) {\n\n for (; i < l; i++) {\n this.data[i] -= num;\n }\n\n this.minY -= num;\n this.maxY -= num;\n }\n\n return this;\n }\n\n _waveArithmetic(wave, operation) {\n\n let yDataThis = this.getDataY(),\n i = 0;\n const l = this.getLength();\n this.requireXMonotonicity();\n wave.requireXMonotonicity();\n\n if (operation == MULTIPLY) {\n\n for (; i < l; i++) {\n yDataThis[i] *= wave.interpolate(this.getX(i));\n }\n } else if (operation == DIVIDE) {\n\n for (; i < l; i++) {\n yDataThis[i] /= wave.interpolate(this.getX(i));\n }\n } else if (operation == ADD) {\n\n for (; i < l; i++) {\n yDataThis[i] += wave.interpolate(this.getX(i));\n }\n } else if (operation == SUBTRACT) {\n\n for (; i < l; i++) {\n yDataThis[i] -= wave.interpolate(this.getX(i));\n }\n }\n\n this._setData(yDataThis);\n return this;\n }\n\n aggregate(direction = 'x') {\n\n this._dataAggregating = {};\n this._dataAggregated = {};\n this._dataAggregationDirection = direction.toUpperCase();\n\n var pow2 = pow2floor(this.getLength());\n\n this._dataAggregating = aggregator({\n\n minX: this.minX,\n maxX: this.maxX,\n minY: this.minY,\n maxY: this.maxY,\n data: this.data,\n xdata: this.xdata ? this.xdata.getData() : undefined,\n xScale: this.xScale,\n xOffset: this.xOffset,\n numPoints: pow2,\n direction: direction\n\n }).then(event => {\n\n this._dataAggregated = event.aggregates;\n this._dataAggregating = false;\n });\n }\n\n hasAggregation() {\n return !!this._dataAggregated;\n }\n\n selectAggregatedData(pxWidth) {\n\n if (pxWidth < 2) {\n return false;\n }\n /*\n console.log( direction, this._dataAggregationDirection );\n if( direction !== this._dataAggregationDirection ) {\n throw \"The data is not aggregated in that direction\";\n }\n */\n\n var level = pow2ceil(pxWidth);\n\n if (this._dataAggregated[level]) {\n\n this.dataInUseType = \"aggregate\" + this._dataAggregationDirection;\n this.dataInUse = this._dataAggregated[level];\n return;\n } else if (this._dataAggregating) {\n\n return this._dataAggregating;\n }\n\n this.dataInUseType = \"none\";\n this.dataInUse = {\n y: this.data,\n x: this.getXWaveform().data\n };\n }\n\n duplicate(alsoDuplicateXWave) {\n var newWaveform = new Waveform();\n newWaveform._setData(this.getDataY().slice());\n newWaveform.rescaleX(this.xOffset, this.xShift);\n newWaveform.setShift(this.getShift());\n newWaveform.setScale(this.getScale());\n\n if (this.xdata) {\n if (alsoDuplicateXWave) {\n newWaveform.setXWaveform(this.xdata.duplicate());\n } else {\n newWaveform.setXWaveform(this.xdata);\n }\n\n newWaveform.setXShift(this.getXShift());\n newWaveform.setXScale(this.getXScale());\n } else {\n newWaveform.xOffset = this.xOffset;\n newWaveform.xScale = this.xScale;\n }\n\n return newWaveform;\n }\n\n subrangeX(fromX, toX) {\n\n if (!this.xdata) {\n // We can select the new range from there\n\n let fromP = this.getIndexFromX(fromX),\n toP = this.getIndexFromX(toP);\n\n return new Waveform().setData(this.data.slice(fromP, toP)).rescaleX(this.xOffset, this.xScale);\n } else {\n\n var waveform = new Waveform();\n\n for (var i = 0, l = this.data.length; i < l; i++) {\n\n if (this.data[i] >= fromX && this.data[i] < toX) {\n\n waveform.append(this.dataX[i], this.data[i]);\n }\n }\n\n return waveform;\n }\n }\n\n findLocalMinMax(xRef, xWithin, type) {\n\n let index = this.getIndexFromX(xRef),\n indexPlus = this.getIndexFromX(xRef + xWithin),\n indexMinus = this.getIndexFromX(xRef - xWithin);\n\n return this.findLocalMinMaxIndex(indexMinus, indexPlus, type);\n }\n\n findLocalMinMaxIndex(indexMinus, indexPlus, type) {\n\n let tmp;\n\n if (indexPlus < indexMinus) {\n tmp = indexPlus;\n indexPlus = indexMinus;\n indexMinus = tmp;\n }\n\n let curr, currI;\n\n if (type == 'max') {\n\n curr = Number.NEGATIVE_INFINITY;\n\n for (var i = indexMinus; i <= indexPlus; i++) {\n\n if (this.getY(i) > curr) {\n curr = this.getY(i);\n currI = i;\n }\n }\n } else {\n\n curr = Number.POSITIVE_INFINITY;\n\n for (var i = indexMinus; i <= indexPlus; i++) {\n\n if (this.getY(i) < curr) {\n curr = this.getY(i);\n currI = i;\n }\n }\n }\n\n if (currI == indexMinus || currI == indexPlus) {\n return false;\n }\n\n return this.getX(currI);\n }\n\n warn(text) {\n if (console) {\n console.warn(text);\n }\n }\n\n setUnit(unit) {\n this.unit = unit;\n return this;\n }\n\n setXUnit(unit) {\n if (this.hasXWaveform()) {\n this.xdata.setUnit(unit);\n }\n\n this.xunit = unit;\n return this;\n }\n\n getUnit() {\n return this.unit || \"\";\n }\n\n getXUnit() {\n if (this.hasXWaveform()) {\n return this.xdata.getUnit();\n }\n\n return this.xunit | \"\";\n }\n\n hasXUnit() {\n return this.getXUnit().length > 0;\n }\n\n hasUnit() {\n return this.getUnit().length > 0;\n }\n\n findLevels(level, options) {\n\n options = (0, _extend2.default)({\n\n box: 1,\n edge: 'both',\n rounding: 'before',\n rangeP: [0, this.getLength()]\n\n }, options);\n\n var lastLvlIndex = options.rangeP[0];\n var lvlIndex;\n var indices = [];\n var i = 0;\n\n while (lvlIndex = this.findLevel(level, (0, _extend2.default)(true, {}, options, {\n rangeP: [lastLvlIndex, options.rangeP[1]]\n }))) {\n indices.push(lvlIndex);\n lastLvlIndex = Math.ceil(lvlIndex);\n\n i++;\n if (i > 1000) {\n return;\n }\n }\n\n return indices;\n }\n\n // Find the first level in the specified range\n findLevel(level, options) {\n\n options = (0, _extend2.default)({\n\n box: 1,\n edge: 'both',\n direction: 'ascending',\n rounding: 'before',\n rangeP: [0, this.getLength()]\n\n }, options);\n\n if (options.rangeX) {\n options.rangeP = options.rangeX.map(this.getIndexFromX);\n }\n\n var value, below, i, j, l, increment;\n\n var box = options.box;\n\n if (box % 2 == 0) {\n box++;\n }\n\n if (options.direction == \"descending\") {\n i = options.rangeP[1], l = options.rangeP[0], increment = -1;\n } else {\n i = options.rangeP[0], l = options.rangeP[1], increment = +1;\n }\n\n for (;; i += increment) {\n\n if (options.direction == \"descending\") {\n if (i < l) {\n break;\n }\n } else {\n if (i > l) {\n break;\n }\n }\n\n if (i < options.rangeP[0] + (box - 1) / 2) {\n continue;\n }\n\n if (i > options.rangeP[1] - (box - 1) / 2) {\n break;\n }\n\n value = this.getAverageP(i - (box - 1) / 2, i + (box - 1) / 2);\n\n if (below === undefined) {\n below = value < level;\n continue;\n }\n // Crossing up\n if (value >= level && below) {\n\n below = false;\n\n if (options.edge == 'ascending' || options.edge == 'both') {\n // Found something\n\n for (j = i + (box - 1) / 2; j >= i - (box - 1) / 2; j--) {\n\n if (this.data[j] >= level && this.data[j - 1] <= level) {\n // Find a crossing\n\n switch (options.rounding) {\n case 'before':\n return j - 1;\n break;\n\n case 'after':\n return j;\n break;\n\n case 'interpolate':\n return getIndexInterpolate(level, this.data[j], this.data[j - 1], j, j - 1);\n break;\n }\n }\n }\n }\n } else if (value <= level && !below) {\n\n below = true;\n\n if (options.edge == 'descending' || options.edge == 'both') {\n\n for (j = i + (box - 1) / 2; j >= i - (box - 1) / 2; j--) {\n\n if (this.data[j] <= level && this.data[j - 1] >= level) {\n // Find a crossing\n\n switch (options.rounding) {\n case 'before':\n return j - 1;\n break;\n\n case 'after':\n return j;\n break;\n\n case 'interpolate':\n return getIndexInterpolate(level, this.data[j], this.data[j - 1], j, j - 1);\n break;\n }\n }\n }\n }\n }\n }\n }\n\n normalize(mode) {\n\n let factor, total, minValue, maxValue, ratio, i;\n\n if (mode == 'max1' || mode == 'max100') {\n\n factor = 1;\n\n if (mode == 'max100') {\n factor = 100;\n }\n\n maxValue = this.data[0];\n\n for (i = 1; i < this.getLength(); i++) {\n\n if (this.data[i] > maxValue) {\n\n maxValue = this.data[i];\n }\n }\n\n for (i = 0; i < this.getLength(); i++) {\n\n this.data[i] /= maxValue / factor;\n }\n } else if (mode == 'sum1') {\n\n total = 0;\n\n for (i = 0; i < this.getLength(); i++) {\n total += this.data[i];\n }\n\n for (i = 0; i < this.getLength(); i++) {\n\n this.data[i] /= total;\n }\n } else if (mode == 'max1min0') {\n\n maxValue = this.data[0], minValue = this.data[0];\n\n for (i = 1; i < this.getLength(); i++) {\n if (this.data[i] > maxValue) {\n\n maxValue = this.data[i];\n } else if (this.data[i] < minValue) {\n\n minValue = this.data[i];\n }\n }\n\n ratio = 1 / (maxValue - minValue);\n\n for (i = 0; i < this.getLength(); i++) {\n\n this.data[i] = (this.data[i] - minValue) * ratio;\n }\n }\n\n this.setData(this.data);\n }\n\n };\n\n const MULTIPLY = Symbol();\n const ADD = Symbol();\n const SUBTRACT = Symbol();\n const DIVIDE = Symbol();\n\n // http://stackoverflow.com/questions/26965171/fast-nearest-power-of-2-in-javascript\n function pow2ceil(v) {\n v--;\n var p = 2;\n while (v >>= 1) {\n p <<= 1;\n }\n return p;\n }\n\n function pow2floor(v) {\n\n var p = 1;\n\n while (v >>= 1) {\n p <<= 1;\n }\n return p;\n }\n\n function getIndexInterpolate(value, valueBefore, valueAfter, indexBefore, indexAfter) {\n return (value - valueBefore) / (valueAfter - valueBefore) * (indexAfter - indexBefore) + indexBefore;\n }\n\n function binarySearch(target, haystack, reverse) {\n\n let seedA = 0,\n length = haystack.length,\n seedB = length - 1,\n seedInt,\n i = 0,\n nanDirection = 1;\n\n if (haystack[seedA] == target) {\n return seedA;\n }\n\n if (haystack[seedB] == target) {\n return seedB;\n }\n\n while (true) {\n i++;\n if (i > 100) {\n throw \"Error loop\";\n }\n\n seedInt = Math.floor((seedA + seedB) / 2);\n\n // seedInt -= seedInt % 2; // Always looks for an x.\n\n while (isNaN(haystack[seedInt])) {\n\n if (seedInt >= haystack.length - 1) {\n\n return haystack.length - 1;\n } else if (seedInt <= 0) {\n\n return 0;\n }\n\n seedInt += nanDirection;\n }\n\n if (seedInt == seedA || haystack[seedInt] == target || seedInt == seedB) {\n return seedInt;\n }\n\n // console.log(seedA, seedB, seedInt, haystack[seedInt]);\n if (haystack[seedInt] <= target) {\n if (reverse) {\n seedB = seedInt;\n } else {\n seedA = seedInt;\n }\n } else if (haystack[seedInt] > target) {\n if (reverse) {\n seedA = seedInt;\n } else {\n seedB = seedInt;\n }\n } else {\n return false;\n }\n\n nanDirection *= -1;\n }\n }\n\n exports.default = Waveform;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(3), __webpack_require__(8), __webpack_require__(0), __webpack_require__(10), __webpack_require__(4)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.core.js'), require('./graph.serie.js'), require('../graph.util.js'), require('../mixins/graph.mixin.errorbars.js'), require('../util/waveform.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphCore, global.graphSerie, global.graphUtil, global.graphMixinErrorbars, global.waveform);\n global.graphSerieLine = mod.exports;\n }\n})(this, function (module, exports, _graphCore, _graphSerie, _graphUtil, _graphMixinErrorbars, _waveform) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphCore2 = _interopRequireDefault(_graphCore);\n\n var _graphSerie2 = _interopRequireDefault(_graphSerie);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphMixinErrorbars2 = _interopRequireDefault(_graphMixinErrorbars);\n\n var _waveform2 = _interopRequireDefault(_waveform);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Serie line\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends Serie\n */\n class SerieLine extends _graphSerie2.default {\n\n static default() {\n /**\n * @name SerieLineDefaultOptions\n * @object\n * @static\n * @memberof SerieLine\n */\n return {\n\n lineColor: 'black',\n lineStyle: 1,\n flip: false,\n label: '',\n lineWidth: 1,\n markers: false,\n trackMouse: false,\n trackMouseLabel: false,\n trackMouseLabelRouding: 1,\n lineToZero: false,\n selectableOnClick: false,\n markersIndependant: false,\n overflowX: false,\n overflowY: false\n };\n }\n\n constructor(graph, name, options) {\n\n super(...arguments);\n\n this.selectionType = 'unselected';\n this.markerFamilies = {};\n\n util.mapEventEmission(this.options, this); // Register events\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n lineWidth: this.options.lineWidth,\n markers: this.options.markers\n };\n\n this.styles.selected = {\n lineWidth: 3\n };\n\n this.extendStyles();\n this.markersDom = new Map();\n\n this.shown = true;\n\n this.data = [];\n this._isMinOrMax = {\n x: {\n min: false,\n max: false\n },\n y: {\n min: false,\n max: false\n }\n };\n\n // Optimize is no markerPoints => save loops\n // this.markerPoints = {};\n\n this.groupLines = document.createElementNS(this.graph.ns, 'g');\n this.domMarker = document.createElementNS(this.graph.ns, 'path');\n this.domMarker.style.cursor = 'pointer';\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n this.additionalData = {};\n\n this.marker = document.createElementNS(this.graph.ns, 'circle');\n this.marker.setAttribute('fill', 'black');\n this.marker.setAttribute('r', 3);\n this.marker.setAttribute('display', 'none');\n\n this.markerLabel = document.createElementNS(this.graph.ns, 'text');\n this.markerLabelSquare = document.createElementNS(this.graph.ns, 'rect');\n this.markerLabelSquare.setAttribute('fill', 'white');\n this.domMarkerHover = {};\n this.domMarkerSelect = {};\n this.markerHovered = 0;\n this.groupMarkerSelected = document.createElementNS(this.graph.ns, 'g');\n\n this.markerPoints = {};\n\n //this.scale = 1;\n //this.shift = 0;\n this.lines = [];\n\n this.groupMain.appendChild(this.groupLines);\n\n this.groupMain.appendChild(this.marker);\n\n this.groupMain.appendChild(this.groupMarkerSelected);\n this.groupMain.appendChild(this.markerLabelSquare);\n this.groupMain.appendChild(this.markerLabel);\n\n this.groupMarkers = document.createElementNS(this.graph.ns, 'g');\n this.groupMain.appendChild(this.groupMarkers);\n\n this.independantMarkers = [];\n\n if (this.initExtended1) {\n this.initExtended1();\n }\n\n this.groupLines.addEventListener('click', e => {\n\n if (this.options.selectableOnClick) {\n\n if (this.isSelected()) {\n\n this.graph.unselectSerie(this);\n } else {\n this.graph.selectSerie(this);\n }\n }\n });\n\n if (this.options.markers) {\n this.setMarkers(this.options.markers, 'unselected');\n }\n }\n\n /**\n * Sets the options of the serie\n * @see SerieLineDefaultOptions\n * @param {Object} options - A object containing the options to set\n * @return {SerieLine} The current serie\n * @memberof SerieLine\n */\n setOptions(options) {\n this.options = util.extend(true, {}, SerieLine.prototype.defaults, options || {});\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n markers: this.options.markers\n };\n\n this.applyLineStyles();\n return this;\n }\n\n onMouseOverMarker(e, index) {\n\n var toggledOn = this.toggleMarker(index, true, true);\n\n if (this.options.onMouseOverMarker) {\n\n this.options.onMouseOverMarker(index, this.infos ? this.infos[index] || false : false, [this.waveform.getX(index), this.waveform.getY(index)]);\n }\n }\n\n onMouseOutMarker(e, index) {\n this.markersOffHover();\n\n if (this.options.onMouseOutMarker) {\n this.options.onMouseOutMarker(index, this.infos ? this.infos[index] || false : false, [this.waveform.getX(index), this.waveform.getY(index)]);\n }\n }\n\n /**\n * Selects one of the markers of the serie\n * @param {Number} index - The point index to select (starting at 0)\n * @param {Boolean} [force = undefined] - Forces state of the marker. true forces selection, false forces deselection. undefined toggles the state of the marker\n * @param {Boolean} [hover = false] - true to set the selection in mode \"hover\" (will disappear on mouse out of the marker). false to set the selection in mode \"select\" (will disappear when another marker is selected)\n * @returns {Boolean} The new state of the marker\n * @memberof SerieLine\n */\n toggleMarker(index, force, hover) {\n\n let i = index;\n\n var _on;\n if (typeof force === 'undefined') {\n _on = !hover ? !this.domMarkerSelect[index] : !this.domMarkerHover[index];\n }\n var el = this['domMarker' + (hover ? 'Hover' : 'Select')];\n\n if (_on || force === true) {\n\n if (!el[index]) {\n\n var dom = document.createElementNS(this.graph.ns, 'path');\n\n this.setMarkerStyleTo(dom, this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(i)]);\n this['domMarker' + (hover ? 'Hover' : 'Select')][index] = dom;\n this.groupMarkerSelected.appendChild(dom);\n } else {\n dom = el[index];\n }\n\n let x = this.getX(this.waveform.getX(i)),\n y = this.getY(this.waveform.getY(i));\n\n dom.setAttribute('d', 'M ' + x + ' ' + y + ' ' + this.getMarkerPath(this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(i)], 1));\n\n if (hover) {\n this.markerHovered++;\n }\n } else if (!_on || force === false) {\n\n if (hover && this.domMarkerHover[index] && !this.domMarkerSelect[index] || this.domMarkerSelect[index]) {\n\n if (!el[index]) {\n return;\n }\n\n this.groupMarkerSelected.removeChild(el[index]);\n\n delete el[index];\n\n if (hover) this.markerHovered--;\n }\n }\n\n return _on;\n }\n\n /**\n * Toggles off markers that have the hover mode \"on\"\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n markersOffHover() {\n\n for (var i in this.domMarkerHover) {\n this.toggleMarker(i.split(','), false, true);\n }\n return this;\n }\n\n /**\n * Toggles off markers that have the select mode \"on\"\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n markersOffSelect() {\n\n for (var i in this.domMarkerSelect) {\n this.toggleMarker(i.split(','), false, false);\n }\n return this;\n }\n\n onClickOnMarker(e, index) {\n\n var toggledOn = this.toggleMarker(index);\n\n if (toggledOn && this.options.onSelectMarker) {\n this.options.onSelectMarker(index, this.infos ? this.infos[index[0]] || false : false);\n }\n\n if (!toggledOn && this.options.onUnselectMarker) {\n this.options.onUnselectMarker(index, this.infos ? this.infos[index[0]] || false : false);\n }\n\n if (this.options.onToggleMarker) {\n this.options.onToggleMarker(index, this.infos ? this.infos[index[0]] || false : false, toggledOn);\n }\n }\n\n _getMarkerIndexFromEvent(e) {\n var px = this.graph._getXY(e);\n\n // return this.searchIndexByPxXY( ( px.x ), ( px.y ) );\n return this.searchIndexByPxXY(px.x - this.graph.getPaddingLeft(), px.y - this.graph.getPaddingTop());\n }\n\n onMouseWheel() {}\n\n /**\n * Cleans the DOM from the serie internal object (serie and markers). Mostly used internally when a new {@link Serie#setData} is called\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n empty() {\n\n for (var i = 0, l = this.lines.length; i < l; i++) {\n this.groupLines.removeChild(this.lines[i]);\n }\n this.lines = [];\n\n return this;\n }\n\n /**\n * Applies a selection to the serie\n * @param {String} [ selectionType = \"selected\" ] - The selection name\n * @returns {SerieLine} The current serie\n * @see SerieLine#unselect\n * @memberof SerieLine\n */\n select(selectionType) {\n\n selectionType = selectionType || 'selected';\n\n this.selected = selectionType !== 'unselected';\n\n if (this.areMarkersShown() || this.areMarkersShown(selectionType)) {\n this.selectionType = selectionType;\n\n this.draw(true); // Drawing is absolutely required here\n this.applyLineStyles();\n } else {\n this.selectionType = selectionType;\n this.applyLineStyles();\n }\n\n this.applyLineStyle(this.getSymbolForLegend());\n return this;\n }\n\n /**\n * Removes the selection to the serie. Effectively, calls {@link SerieLine#select}(\"unselected\").\n * @returns {SerieLine} The current serie\n * @see SerieLine#select\n * @memberof SerieLine\n */\n unselect() {\n\n this.selected = false;\n\n return this.select('unselected');\n }\n\n /**\n * Degrades the data of the serie. This option is used for big data sets that have monotoneously increasing (or decreasing) x values.\n * For example, a serie containing 1'000'000 points, displayed over 1'000px, will have 1'000 points per pixel. Often it does not make sense to display more than 2-3 points per pixel.\n * degrade( pxPerPoint ) allows a degradation of the serie, based on a a number of pixel per point. It computes the average of the data that would be displayed over each pixel range\n * Starting from jsGraph 2.0, it does not calculate the minimum and maximum and creates the zone serie anymore\n * @return {SerieLine} The current serie instance\n * @example serie.degrade( 0.5 ); // Will display 2 points per pixels\n * @memberof SerieLine\n */\n degrade(pxPerP) {\n\n this.degradationPx = pxPerP;\n return this;\n }\n\n drawInit(force) {\n\n var data, xData;\n\n try {\n this.axisCheck();\n } catch (e) {\n console.warn(e);\n return false;\n }\n\n this.currentLineId = 0;\n this.counter = 0;\n this._drawn = true;\n this.currentLine = '';\n\n // Degradation\n\n if (this.waveform) {\n\n if (this.degradationPx) {\n\n this.waveform.resampleForDisplay({\n\n resampleToPx: this.degradationPx,\n xPosition: this.getXAxis().getPx.bind(this.getXAxis()),\n minX: this.getXAxis().getCurrentMin(),\n maxX: this.getXAxis().getCurrentMax()\n\n });\n\n this._dataToUse = [this.waveform.getDataToUseFlat()];\n } else if (this.waveform.hasAggregation()) {\n\n let xaxis = this.getXAxis(),\n numberOfPointsInTotal = this.graph.getDrawingWidth() * (xaxis.getDataMax() - xaxis.getDataMin()) / (xaxis.getCurrentMax() - xaxis.getCurrentMin()),\n promise = this.waveform.selectAggregatedData(numberOfPointsInTotal);\n\n if (promise instanceof Promise) {\n\n promise.then(() => {\n\n this.draw(force);\n });\n\n return false;\n } else if (promise === false) {\n\n return false;\n } else {\n\n this._dataToUse = this.waveform.getDataToUseFlat();\n }\n }\n\n // this._dataToUse = this.waveform.getDataToUseFlat();\n } else {\n\n this._dataToUse = this.data;\n this._xDataToUse = this.xData;\n }\n\n return true;\n }\n\n removeLinesGroup() {\n this._afterLinesGroup = this.groupLines.nextSibling;\n this.groupMain.removeChild(this.groupLines);\n }\n\n insertLinesGroup() {\n\n if (!this._afterLinesGroup) {\n throw 'Could not find group after lines to insertion.';\n }\n\n this.groupMain.insertBefore(this.groupLines, this._afterLinesGroup);\n this._afterLinesGroup = false;\n }\n\n removeExtraLines() {\n\n var i = this.currentLineId,\n l = this.lines.length;\n\n for (; i < l; i++) {\n this.groupLines.removeChild(this.lines[i]);\n }\n\n this.lines.splice(this.currentLineId, l - this.currentLineId);\n this.currentLineId = 0;\n }\n\n /**\n * Draws the serie\n * @memberof SerieLine\n */\n draw(force) {\n // Serie redrawing\n\n super.draw(...arguments);\n\n if (!this.getXAxis() || !this.getYAxis()) {\n throw 'No axes were defined for this serie';\n }\n\n if (force || this.hasDataChanged()) {\n if (!this.drawInit(force)) {\n return;\n }\n\n var data = this._dataToUse,\n xData = this._xDataToUse,\n slotToUse = this._slotToUse;\n\n this.removeLinesGroup();\n this.eraseMarkers();\n\n this.lookForMaxima = true;\n this.lookForMinima = false;\n\n this.markerFamily = this.markerFamilies[this.selectionType || 'unselected'];\n\n this.pos0 = this.getYAxis().getPos(0);\n\n if (this.hasErrors()) {\n this.errorDrawInit();\n }\n\n this._draw();\n\n if (this.hasErrors()) {\n this.errorDraw();\n }\n\n this.removeExtraLines();\n this.insertMarkers();\n this.insertLinesGroup();\n }\n\n // Unhovers everything\n for (var i in this.domMarkerHover) {\n this.toggleMarker(i.split(','), false, true);\n }\n\n // Deselects everything\n for (var i in this.domMarkerSelect) {\n this.toggleMarker(i.split(','), false, false);\n }\n\n this.applyLineStyle(this.getSymbolForLegend());\n\n if (this.hasStyleChanged(this.selectionType)) {\n this.updateStyle();\n }\n\n this.dataHasChanged(false);\n super.afterDraw();\n }\n\n _draw() {\n\n let self = this,\n waveform = this.waveform,\n data,\n x,\n y,\n lastX = false,\n lastY = false,\n xpx,\n ypx,\n xpx2,\n ypx2,\n xAxis = this.getXAxis(),\n yAxis = this.getYAxis(),\n xMin = xAxis.getCurrentMin(),\n yMin = yAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n yMax = yAxis.getCurrentMax();\n\n if (!waveform) {\n return;\n }\n\n data = waveform.getData(true);\n\n // Y crossing\n let yLeftCrossingRatio,\n yLeftCrossing,\n yRightCrossingRatio,\n yRightCrossing,\n xTopCrossingRatio,\n xTopCrossing,\n xBottomCrossingRatio,\n xBottomCrossing,\n\n\n /*xshift = waveform.getXShift(),\n xscale = wave.getXScale(),*/\n yshift = waveform.getShift(),\n yscale = waveform.getScale();\n\n let pointOutside = false;\n let lastPointOutside = false;\n let pointOnAxis;\n\n let _monotoneous = this.isMonotoneous(),\n _markersShown = this.markersShown();\n\n let i = 0,\n l = waveform.getLength();\n\n this.currentLine = '';\n\n if (waveform.isXMonotoneous()) {\n\n if (waveform.isXMonotoneousAscending()) {\n\n i = waveform.getIndexFromX(xMin, true) || 0;\n l = waveform.getIndexFromX(xMax, true);\n\n if (l === false) {\n l = waveform.getLength();\n }\n } else {\n\n i = waveform.getIndexFromX(xMax, true) || 0;\n l = waveform.getIndexFromX(xMin, true);\n\n if (l === false) {\n l = waveform.getLength();\n }\n }\n\n l += 2;\n if (l > data.length) {\n l = data.length;\n }\n }\n\n for (; i < l; i += 1) {\n\n x = waveform.getX(i, true);\n y = data[i] * yscale + yshift;\n\n if (x != x || y != y) {\n // NaN checks\n this._createLine();\n continue;\n }\n\n if (!this.options.overflowX && x < xMin && lastX < xMin || !this.options.overflowX && x > xMax && lastX > xMax || (!this.options.overflowY && y < yMin && lastY < yMin || !this.options.overflowY && y > yMax && lastY > yMax) && !this.options.lineToZero) {\n lastX = x;\n lastY = y;\n lastPointOutside = true;\n continue;\n }\n\n this.counter2 = i;\n\n if (_markersShown) {\n this.getMarkerCurrentFamily(this.counter2);\n }\n\n xpx2 = this.getX(x);\n ypx2 = this.getY(y);\n //xpx2 = 0;\n //ypx2 = 0;\n\n if (xpx2 == xpx && ypx2 == ypx) {\n continue;\n }\n\n if (xpx2 != xpx2 || ypx2 != ypx2) {\n // NaN checks\n if (this.counter > 0) {\n\n this._createLine();\n }\n continue;\n }\n\n if (!_monotoneous) {\n\n pointOutside = !this.options.overflowX && (x < xMin || x > xMax) || !this.options.overflowY && (y < yMin || y > yMax);\n } else {\n pointOutside = !this.options.overflowY && (y < yMin || y > yMax);\n }\n\n if (this.options.lineToZero) {\n pointOutside = x < xMin || x > xMax;\n\n if (pointOutside) {\n continue;\n }\n } else {\n\n if (pointOutside || lastPointOutside) {\n\n if ((lastX === false || lastY === false) && !lastPointOutside) {\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n } else {\n\n pointOnAxis = [];\n // Y crossing\n yLeftCrossingRatio = (x - xMin) / (x - lastX);\n yLeftCrossing = y - yLeftCrossingRatio * (y - lastY);\n yRightCrossingRatio = (x - xMax) / (x - lastX);\n yRightCrossing = y - yRightCrossingRatio * (y - lastY);\n\n // X crossing\n xTopCrossingRatio = (y - yMin) / (y - lastY);\n xTopCrossing = x - xTopCrossingRatio * (x - lastX);\n xBottomCrossingRatio = (y - yMax) / (y - lastY);\n xBottomCrossing = x - xBottomCrossingRatio * (x - lastX);\n\n if (yLeftCrossingRatio < 1 && yLeftCrossingRatio > 0 && yLeftCrossing !== false && yLeftCrossing < yMax && yLeftCrossing > yMin) {\n pointOnAxis.push([xMin, yLeftCrossing]);\n }\n\n if (yRightCrossingRatio < 1 && yRightCrossingRatio > 0 && yRightCrossing !== false && yRightCrossing < yMax && yRightCrossing > yMin) {\n pointOnAxis.push([xMax, yRightCrossing]);\n }\n\n if (xTopCrossingRatio < 1 && xTopCrossingRatio > 0 && xTopCrossing !== false && xTopCrossing < xMax && xTopCrossing > xMin) {\n pointOnAxis.push([xTopCrossing, yMin]);\n }\n\n if (xBottomCrossingRatio < 1 && xBottomCrossingRatio > 0 && xBottomCrossing !== false && xBottomCrossing < xMax && xBottomCrossing > xMin) {\n pointOnAxis.push([xBottomCrossing, yMax]);\n }\n\n if (pointOnAxis.length > 0) {\n\n if (!pointOutside) {\n // We were outside and now go inside\n\n if (pointOnAxis.length > 1) {\n console.error('Programmation error. Please e-mail me.');\n console.log(pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY);\n }\n\n this._createLine();\n this._addPoint(this.getX(pointOnAxis[0][0]), this.getY(pointOnAxis[0][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n this._addPoint(xpx2, ypx2, lastX, lastY, false, false, true);\n } else if (!lastPointOutside) {\n // We were inside and now go outside\n\n if (pointOnAxis.length > 1) {\n console.error('Programmation error. Please e-mail me.');\n console.log(pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY);\n }\n\n this._addPoint(this.getX(pointOnAxis[0][0]), this.getY(pointOnAxis[0][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n } else {\n\n // No crossing: do nothing\n if (pointOnAxis.length == 2) {\n this._createLine();\n\n this._addPoint(this.getX(pointOnAxis[0][0]), this.getY(pointOnAxis[0][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n this._addPoint(this.getX(pointOnAxis[1][0]), this.getY(pointOnAxis[1][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n }\n }\n } else if (!pointOutside) {\n\n this._addPoint(xpx2, ypx2, lastX, lastY, i, false, false);\n } // else {\n // Norman:\n // This else case is not the sign of a bug. If yLeftCrossing == 0 or 1 for instance, pointOutside or lastPointOutside will be true\n // However, there's no need to draw anything because the point is on the axis and will already be covered.\n // 28 Aug 2015\n\n /*\n if ( lastPointOutside !== pointOutside ) {\n console.error( \"Programmation error. A crossing should have been found\" );\n console.log( yLeftCrossing, yLeftCrossingRatio, yMax, yMin );\n console.log( yRightCrossing, yRightCrossingRatio, yMax, yMin );\n console.log( xTopCrossing, xTopCrossingRatio, xMax, xMin );\n console.log( xBottomCrossing, xBottomCrossingRatio, xMax, xMin );\n console.log( pointOutside, lastPointOutside )\n }\n */\n // }\n }\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n\n lastPointOutside = pointOutside;\n\n continue;\n }\n }\n\n this._addPoint(xpx2, ypx2, x, y, i, false, true);\n\n //this.detectPeaks( x, y );\n\n xpx = xpx2;\n ypx = ypx2;\n\n lastX = x;\n lastY = y;\n }\n\n this._createLine();\n\n if (this._tracker) {\n\n if (this._trackerDom) {\n this._trackerDom.remove();\n }\n\n var cloned = this.groupLines.cloneNode(true);\n this.groupMain.appendChild(cloned);\n\n for (i = 0, l = cloned.children.length; i < l; i++) {\n\n cloned.children[i].setAttribute('stroke', 'transparent');\n cloned.children[i].setAttribute('stroke-width', '25px');\n cloned.children[i].setAttribute('pointer-events', 'stroke');\n }\n\n this._trackerDom = cloned;\n\n this.groupMain.addEventListener('mousemove', e => {\n var coords = this.graph._getXY(e),\n ret = this.handleMouseMove(false, false);\n\n this._trackingCallback(this, ret, coords.x, coords.y);\n });\n\n this.groupMain.addEventListener('mouseleave', e => {\n this._trackingOutCallback(this);\n });\n }\n\n return this;\n }\n\n kill() {\n super.kill();\n }\n\n /**\n * @param {Number} k - Index of the point for which we should get the family\n * @memberof SerieLine\n */\n getMarkerCurrentFamily(k) {\n\n if (!this.markerPoints || !this.markerPoints[this.selectionType]) {\n return;\n }\n\n var family;\n\n for (var z = 0; z < this.markerPoints[this.selectionType].length; z++) {\n if (this.markerPoints[this.selectionType][z][0] <= k) {\n // This one is a possibility !\n if (this.markerPoints[this.selectionType][z][1] >= k) {\n // Verify that it's in the boundary\n this.markerCurrentFamily = this.markerPoints[this.selectionType][z][2];\n family = this.markerFamilies[this.selectionType][this.markerCurrentFamily];\n }\n } else {\n break;\n }\n }\n\n if (!family) {\n return false;\n }\n this.getMarkerDom(family);\n return this.markerCurrentFamily;\n }\n\n setMarkerStyleTo(dom, family) {\n\n if (!dom || !family) {\n console.trace();\n throw 'Cannot set marker style. DOM does not exist.';\n }\n\n dom.setAttribute('fill', family.fillColor || 'transparent');\n dom.setAttribute('stroke', family.strokeColor || this.getLineColor());\n dom.setAttribute('stroke-width', family.strokeWidth || 1);\n }\n\n /**\n * Hides the tracking marker (see the trackMouse option)\n * @memberof SerieLine\n */\n hideTrackingMarker() {\n this.marker.setAttribute('display', 'none');\n this.markerLabel.setAttribute('display', 'none');\n this.markerLabelSquare.setAttribute('display', 'none');\n }\n\n _addPoint(xpx, ypx, x, y, j, move, allowMarker) {\n\n /*if( ! this.currentLineId ) {\n throw \"No current line\"\n }* @memberof SerieLine\n */\n\n if (xpx !== xpx || ypx !== ypx) {\n return;\n }\n\n if (this.counter == 0) {\n this.currentLine = 'M ';\n } else {\n\n if (this.options.lineToZero || move) {\n this.currentLine += 'M ';\n } else {\n this.currentLine += 'L ';\n }\n }\n\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += ypx;\n this.currentLine += ' ';\n\n if (this.options.lineToZero && this.pos0 !== undefined) {\n\n this.currentLine += 'L ';\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += this.pos0;\n this.currentLine += ' ';\n }\n\n if (this.hasErrors()) {\n this.errorAddPoint(j, x, y, xpx, ypx);\n }\n\n if (!this.markerPoints) {\n this.counter++;\n\n return;\n }\n\n if (this.markersShown() && allowMarker !== false && this.markerFamily) {\n drawMarkerXY(this, this.markerFamily[this.markerCurrentFamily], xpx, ypx, this.markersDom.get(this.markerFamily[this.markerCurrentFamily]));\n }\n\n this.counter++;\n }\n\n // Returns the DOM\n _createLine() {\n\n var i = this.currentLineId++,\n line;\n\n // Creates a line if needed\n if (this.lines[i]) {\n line = this.lines[i];\n } else {\n\n line = document.createElementNS(this.graph.ns, 'path');\n this.applyLineStyle(line);\n this.groupLines.appendChild(line);\n this.lines[i] = line;\n }\n\n if (this.counter == 0) {\n line.setAttribute('d', '');\n } else {\n line.setAttribute('d', this.currentLine);\n }\n\n this.currentLine = 'M ';\n this.counter = 0;\n\n return line;\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyles() {\n\n for (var i = 0; i < this.lines.length; i++) {\n this.applyLineStyle(this.lines[i]);\n }\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n } else {\n line.removeAttribute('stroke-dasharray');\n }\n line.setAttribute('fill', 'none');\n //\tline.setAttribute('shape-rendering', 'optimizeSpeed');\n }\n\n /**\n * Updates the current style (lines + legend) of the serie. Use this method if you have explicitely changed the options of the serie\n * @example var opts = { lineColor: 'red' };\n * var s = graph.newSerie( \"name\", opts ).setData( someData );\n * opts.lineColor = 'green';\n * s.updateStyle(); // Sets the lineColor to green\n * s.draw(); // Would also do the same thing, but recalculates the whole serie display (including (x,y) point pairs)\n * @memberof SerieLine\n */\n updateStyle() {\n this.applyLineStyles();\n this.setLegendSymbolStyle();\n\n this.styleHasChanged(false);\n }\n\n // Revised August 2014. Ok\n getMarkerPath(family, add) {\n\n var z = family.zoom || 1,\n add = add || 0,\n el = [];\n\n switch (family.type) {\n\n case 2:\n el = ['m', -2, -2, 'l', 4, 4, 'm', -4, 0, 'l', 4, -4];\n break;\n\n case 3:\n el = ['m', -2, 0, 'l', 4, 0, 'm', -2, -2, 'l', 0, 4];\n break;\n\n case 4:\n el = ['m', -1, -1, 'l', 2, 0, 'l', -1, 2, 'z'];\n break;\n\n default:\n case 1:\n el = ['m', -2, -2, 'l', 4, 0, 'l', 0, 4, 'l', -4, 0, 'z'];\n break;\n\n }\n\n if ((z == 1 || !z) && !add) {\n return el.join(' ');\n }\n\n var num = 'number';\n\n if (!el) {\n return;\n }\n\n for (var i = 0, l = el.length; i < l; i++) {\n\n if (typeof el[i] == num) {\n\n el[i] *= z + add;\n }\n }\n\n return el.join(' ');\n }\n\n // Revised August 2014. Ok\n getMarkerDom(family) {\n\n var self = this;\n\n if (!this.markersDom.has(family)) {\n\n var dom = document.createElementNS(this.graph.ns, 'path');\n this.setMarkerStyleTo(dom, family);\n this.markersDom.set(family, {\n dom: dom,\n path: ''\n });\n\n dom.addEventListener('mouseover', function (e) {\n var closest = self._getMarkerIndexFromEvent(e);\n self.onMouseOverMarker(e, closest);\n });\n\n dom.addEventListener('mouseout', function (e) {\n var closest = self._getMarkerIndexFromEvent(e);\n self.onMouseOutMarker(e, closest);\n });\n\n dom.addEventListener('click', function (e) {\n var closest = self._getMarkerIndexFromEvent(e);\n self.onClickOnMarker(e, closest);\n });\n }\n\n return family.dom;\n }\n\n // In case markers are not grouped in families but independant\n getMarkerDomIndependent(index, family) {\n\n if (!this.independantMarkers[index]) {\n\n var dom = document.createElementNS(this.graph.ns, 'path');\n this.setMarkerStyleTo(dom, family);\n\n dom.addEventListener('mouseover', e => {\n\n this.onMouseOverMarker(e, index);\n });\n\n dom.addEventListener('mouseout', e => {\n\n this.onMouseOutMarker(e, index);\n });\n\n dom.addEventListener('click', e => {\n\n this.onClickOnMarker(e, index);\n });\n\n this.independantMarkers[index] = dom;\n }\n\n this.groupMarkers.appendChild(this.independantMarkers[index]);\n\n return this.independantMarkers[index];\n }\n\n /**\n * Searches the closest point pair (x,y) to the a pair of pixel position\n * @param {Number} x - The x position in pixels (from the left)\n * @param {Number} y - The y position in pixels (from the left)\n * @returns {Number} Index in the data array of the closest (x,y) pair to the pixel position passed in parameters\n * @memberof SerieLine\n */\n searchIndexByPxXY(x, y) {\n\n var oldDist = false,\n xyindex = false,\n dist;\n\n var xData = this._xDataToUse,\n p_x,\n p_y;\n\n for (var k = 0, m = this.waveform.getLength(); k < m; k += 1) {\n\n p_x = this.waveform.getX(k);\n p_y = this.waveform.getY(k);\n\n dist = Math.pow(this.getX(p_x) - x, 2) + Math.pow(this.getY(p_y) - y, 2);\n //console.log(x, y, dist, this.data[i][k], this.data[i][k + 1]);\n\n if (!oldDist || dist < oldDist) {\n oldDist = dist;\n xyindex = k;\n }\n }\n\n return xyindex;\n }\n\n /**\n * Performs a binary search to find the closest point index to an x value. For the binary search to work, it is important that the x values are monotoneous.\n * @param {Number} valX - The x value to search for\n * @returns {Object} Index in the data array of the closest (x,y) pair to the pixel position passed in parameters\n * @memberof SerieLine\n */\n searchClosestValue(valX, valY) {\n\n if (this.waveform) {\n\n const indexX = this.waveform.getIndexFromXY(valX, valY, undefined, undefined, this.getXAxis().getRelPx(1), this.getYAxis().getRelPx(1));\n\n let returnObj = {};\n\n let direction;\n\n if (valX > this.waveform.getX(indexX)) {\n direction = 0;\n } else {\n direction = 1;\n }\n\n Object.assign(returnObj, {\n indexMin: indexX + direction,\n indexMax: indexX + direction + 1,\n indexClosest: indexX,\n xMin: this.waveform.getX(indexX + direction),\n xMax: this.waveform.getX(indexX + direction + 1),\n yMin: this.waveform.getY(indexX + direction),\n yMax: this.waveform.getY(indexX + direction + 1),\n xClosest: this.waveform.getX(indexX),\n yClosest: this.waveform.getY(indexX),\n xExact: valX\n });\n return returnObj;\n }\n }\n\n handleMouseMove(xValue, doMarker, yValue) {\n\n var valX = xValue || this.getXAxis().getMouseVal(),\n valY = yValue || this.getYAxis().getMouseVal(),\n xMinIndex,\n xMin,\n yMin,\n xMax,\n yMax;\n\n var value = this.searchClosestValue(valX, valY);\n\n if (!value) {\n return;\n }\n\n var ratio, intY;\n\n if (value.xMax == value.xMin) {\n intY = value.yMin;\n } else {\n\n //ratio = ( valX - value.xMin ) / ( value.xMax - value.xMin );\n //intY = ( ( 1 - ratio ) * value.yMin + ratio * value.yMax );\n }\n\n if (doMarker && this.options.trackMouse) {\n\n if (value.xMin == undefined) {\n\n return false;\n } else {\n\n if (!this.marker) {\n return;\n }\n\n var x = this.getX(this.getFlip() ? value.yClosest : value.xClosest);\n var y = this.getY(this.getFlip() ? value.xClosest : value.yClosest);\n\n if (isNaN(x) || isNaN(y)) {\n return;\n }\n\n this.marker.setAttribute('display', 'block');\n this.marker.setAttribute('cx', x);\n this.marker.setAttribute('cy', y);\n\n this.markerLabel.setAttribute('display', 'block');\n this.markerLabelSquare.setAttribute('display', 'block');\n\n switch (this.options.trackMouseLabel) {\n\n case false:\n\n break;\n\n default:\n this.markerLabel.textContent = this.options.trackMouseLabel.replace('', valX.toFixed(this.options.trackMouseLabelRouding)).replace('', intY.toFixed(this.options.trackMouseLabelRouding));\n break;\n }\n\n this.markerLabel.setAttribute('x', x + 5);\n this.markerLabel.setAttribute('y', y - 5);\n\n this.markerLabelSquare.setAttribute('x', x + 5);\n this.markerLabelSquare.setAttribute('y', y - 5 - this.graph.options.fontSize);\n this.markerLabelSquare.setAttribute('width', this.markerLabel.getComputedTextLength() + 2);\n this.markerLabelSquare.setAttribute('height', this.graph.options.fontSize + 2);\n }\n }\n\n return {\n xBefore: value.xMin,\n xAfter: value.xMax,\n yBefore: value.yMin,\n yAfter: value.yMax,\n trueX: value.xExact,\n indexClosest: value.indexClosest,\n interpolatedY: intY,\n\n xClosest: value.xClosest,\n yClosest: value.yClosest\n };\n }\n /**\n * Gets the maximum value of the y values between two x values. The x values must be monotoneously increasing\n * @param {Number} startX - The start of the x values\n * @param {Number} endX - The end of the x values\n * @returns {Number} Maximal y value in between startX and endX\n * @memberof SerieLine\n */\n getMax(start, end) {\n\n var start2 = Math.min(start, end),\n end2 = Math.max(start, end),\n v1 = this.searchClosestValue(start2),\n v2 = this.searchClosestValue(end2),\n i,\n j,\n max = -Infinity,\n initJ,\n maxJ;\n\n // console.log( start2, end2, v1, v2 );\n\n if (!v1) {\n start2 = this.minX;\n v1 = this.searchClosestValue(start2);\n }\n\n if (!v2) {\n end2 = this.maxX;\n v2 = this.searchClosestValue(end2);\n }\n\n if (!v1 || !v2) {\n return -Infinity;\n }\n\n for (i = v1.dataIndex; i <= v2.dataIndex; i++) {\n initJ = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n maxJ = i == v2.dataIndex ? v2.xBeforeIndexArr : this.data[i].length;\n\n for (j = initJ; j <= maxJ; j += 2) {\n max = Math.max(max, this.data[i][j + 1]);\n }\n }\n\n return max;\n }\n\n /**\n * Gets the minimum value of the y values between two x values. The x values must be monotoneously increasing\n * @param {Number} startX - The start of the x values\n * @param {Number} endX - The end of the x values\n * @returns {Number} Maximal y value in between startX and endX\n * @memberof SerieLine\n */\n getMin(start, end) {\n\n var start2 = Math.min(start, end),\n end2 = Math.max(start, end),\n v1 = this.searchClosestValue(start2),\n v2 = this.searchClosestValue(end2),\n i,\n j,\n min = Infinity,\n initJ,\n maxJ;\n\n if (!v1) {\n start2 = this.minX;\n v1 = this.searchClosestValue(start2);\n }\n\n if (!v2) {\n end2 = this.maxX;\n v2 = this.searchClosestValue(end2);\n }\n\n if (!v1 || !v2) {\n return Infinity;\n }\n\n for (i = v1.dataIndex; i <= v2.dataIndex; i++) {\n initJ = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n maxJ = i == v2.dataIndex ? v2.xBeforeIndexArr : this.data[i].length;\n\n for (j = initJ; j <= maxJ; j += 2) {\n min = Math.min(min, this.data[i][j + 1]);\n }\n }\n\n return min;\n }\n\n /* LINE STYLE * @memberof SerieLine\n */\n\n setStyle(style, selectionType = 'unselected') {\n\n this.styles[selectionType] = style;\n this.styleHasChanged(selectionType);\n }\n\n setLineStyle(number, selectionType = 'unselected', applyToSelected) {\n\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].lineStyle = number;\n\n if (applyToSelected) {\n this.setLineStyle(number, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getLineStyle(selectionType) {\n return this.getStyle(selectionType).lineStyle;\n }\n\n getLineDashArray(selectionType = this.selectionType || 'unselected') {\n\n switch (this.getStyle(selectionType).lineStyle) {\n\n case 2:\n return '1, 1';\n break;\n case 3:\n return '2, 2';\n break;\n case 4:\n return '3, 3';\n break;\n case 5:\n return '4, 4';\n break;\n case 6:\n return '5, 5';\n break;\n\n case 7:\n return '5 2';\n break;\n case 8:\n return '2 5';\n break;\n\n case 9:\n return '4 2 4 4';\n break;\n case 10:\n return '1,3,1';\n break;\n case 11:\n return '9 2';\n break;\n case 12:\n return '2 9';\n break;\n\n case 1:\n case false:\n return false;\n break;\n\n default:\n return this.styles[selectionType].lineStyle;\n break;\n }\n\n this.styleHasChanged(selectionType);\n }\n\n getStyle(selectionType = this.selectionType || 'unselected') {\n return this.styles[selectionType];\n }\n\n extendStyles() {\n for (var i in this.styles) {\n\n var s = this.styles[i];\n if (s) {\n this.styles[i] = util.extend(true, {}, this.styles.unselected, s);\n }\n }\n }\n\n extendStyle(styleTarget, styleOrigin) {\n var s = this.styles[styleTarget];\n\n this.styles[styleTarget] = util.extend(true, {}, this.styles[styleOrigin || 'unselected'], s || {});\n\n this.styles[styleTarget].markers.map(function (marker) {\n if (marker.dom) {\n marker.dom = '';\n }\n });\n\n this._recalculateMarkerPoints(styleTarget, this.styles[styleTarget].markers);\n this.styleHasChanged(styleTarget);\n }\n\n /* * @memberof SerieLine\n */\n\n setLineWidth(width, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].lineWidth = width;\n\n if (applyToSelected) {\n this.setLineWidth(width, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getLineWidth(selectionType) {\n\n return this.getStyle(selectionType).lineWidth || 1;\n }\n\n /* LINE COLOR * @memberof SerieLine\n */\n setLineColor(color, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].lineColor = color;\n\n if (applyToSelected) {\n this.setLineColor(color, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getLineColor(selectionType) {\n\n return this.getStyle(selectionType).lineColor || 'black';\n }\n\n /* * @memberof SerieLine\n */\n\n /* MARKERS * @memberof SerieLine\n */\n showMarkers(selectionType, redraw) {\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].showMarkers = true;\n\n if (redraw && this._drawn) {\n this.draw(true);\n } else {\n this.styleHasChanged(selectionType);\n }\n\n return this;\n }\n\n hideMarkers(selectionType, redraw) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType].showMarkers = false;\n\n if (redraw && this._drawn) {\n this.draw(true);\n } else {\n this.styleHasChanged(selectionType);\n }\n return this;\n }\n\n markersShown(selectionType) {\n return this.getStyle(selectionType).showMarkers !== false;\n }\n\n areMarkersShown() {\n return this.markersShown.apply(this, arguments);\n }\n\n isMarkersShown() {\n return this.markersShown.apply(this, arguments);\n }\n\n // Multiple markers\n setMarkers(families, selectionType, applyToSelected) {\n // Family has to be an object\n // Family looks like\n /*\n {\n \ttype: 1,\n \tzoom: 1,\n \tstrokeWidth: 1,\n \tstrokeColor: '',\n \tfillColor: '',\n points: []\n }\n * @memberof SerieLine\n */\n\n this.styles[selectionType || 'unselected'] = this.styles[selectionType || 'unselected'] || {};\n\n this.showMarkers(selectionType, false);\n\n if (!Array.isArray(families) && typeof families == 'object') {\n families = [families];\n } else if (!families) {\n\n families = [{\n type: 1,\n zoom: 1,\n points: 'all'\n }];\n }\n\n this.styles[selectionType || 'unselected'].markers = families;\n\n if (applyToSelected) {\n this.styles.selected.markers = util.extend(true, {}, families);\n }\n\n this._recalculateMarkerPoints(selectionType, families);\n this.styleHasChanged(selectionType);\n this.dataHasChanged(true); // Data has not really changed, but marker placing is performed during the draw method\n return this;\n }\n\n setMarkersPoints(points, family, selectionType) {\n this._extendMarkers('points', points, family, selectionType, true);\n }\n\n setMarkersColor(color, family, selectionType) {\n this._extendMarkers('color', color, family, selectionType);\n }\n\n setMarkersType(type, family, selectionType) {\n this._extendMarkers('type', type, family, selectionType);\n }\n\n setMarkersZoom(zoom, family, selectionType) {\n this._extendMarkers('zoom', zoom, family, selectionType);\n }\n\n setMarkersStrokeColor(strokeColor, family, selectionType) {\n this._extendMarkers('strokeColor', strokeColor, family, selectionType);\n }\n\n setMarkersStrokeWidth(strokeWidth, family, selectionType) {\n this._extendMarkers('strokeWidth', strokeWidth, family, selectionType);\n }\n\n setMarkersFillColor(fillColor, family, selectionType) {\n this._extendMarkers('fillColor', fillColor, family, selectionType);\n }\n\n _extendMarkers(type, value, family, selectionType, recalculatePoints) {\n\n family = family || 0;\n selectionType = selectionType || 'unselected';\n\n if (!this.styles[selectionType] || !this.styles[selectionType].markers) {\n return;\n }\n\n this.styles[selectionType].markers[family][type] = value;\n\n if (recalculatePoints) {\n this._recalculateMarkerPoints(selectionType, this.styles[selectionType].markers);\n }\n\n if (!this.markersDom[this.styles[selectionType].markers[family]]) {\n // DOM doesn't exist yet.\n return;\n }\n\n this.setMarkerStyleTo(this.markersDom[this.styles[selectionType].markers[family]].dom, this.styles[selectionType].markers[family]);\n }\n\n _recalculateMarkerPoints(selectionType, families) {\n\n var markerPoints = [];\n // Overwriting any other undefined families\n markerPoints.push([0, Infinity, null]);\n\n for (var i = 0, k = families.length; i < k; i++) {\n\n families[i].markerPath = this.getMarkerPath(families[i]);\n\n if (!families[i].points) {\n families[i].points = 'all';\n }\n\n if (!Array.isArray(families[i].points)) {\n families[i].points = [families[i].points];\n }\n\n for (var j = 0, l = families[i].points.length; j < l; j++) {\n\n if (families[i].points[j] == 'all') {\n\n markerPoints.push([0, Infinity, i]);\n } else if (!Array.isArray(families[i].points[j])) {\n\n markerPoints.push([families[i].points[j], families[i].points[j], i]);\n //markerPoints.push( [ family[ i ].points[ j ] + 1, null ] );\n } else {\n\n markerPoints.push([families[i].points[j][0], families[i].points[j][1], i]);\n }\n }\n }\n\n this.markerFamilies[selectionType || 'unselected'] = families;\n\n // Let's sort if by the first index.\n markerPoints.sort(function (a, b) {\n return a[0] - b[0] || (a[2] == null ? -1 : 1);\n });\n\n this.markerPoints[selectionType || 'unselected'] = markerPoints;\n }\n\n insertMarkers(selectionType) {\n\n if (!this.markerFamilies || !this.markerFamilies[selectionType || this.selectionType] || this.options.markersIndependant) {\n return;\n }\n\n for (var i = 0, l = this.markerFamilies[selectionType || this.selectionType].length; i < l; i++) {\n\n if (!this.markersDom.has(this.markerFamilies[selectionType || this.selectionType][i])) {\n continue;\n }\n\n let dom = this.markersDom.get(this.markerFamilies[selectionType || this.selectionType][i]);\n\n dom.dom.setAttribute('d', dom.path);\n\n this.groupMarkers.appendChild(dom.dom);\n this.currentMarkersSelectionType = this.selectionType;\n }\n }\n\n getMarkerForLegend() {\n\n if (!this.markerPoints || !this.markerPoints[this.selectionType]) {\n return;\n }\n\n if (!this.markerForLegend) {\n\n var marker = document.createElementNS(this.graph.ns, 'path');\n this.setMarkerStyleTo(marker, this.markerFamilies[this.selectionType][0]);\n\n marker.setAttribute('d', 'M 14 0 ' + this.getMarkerPath(this.markerFamilies[this.selectionType][0]));\n\n this.markerForLegend = marker;\n }\n\n return this.markerForLegend;\n }\n\n eraseMarkers() {\n\n var self = this;\n\n if (this.options.markersIndependant) {\n\n for (var i in this.independantMarkers) {\n self.groupMarkers.removeChild(this.independantMarkers[i]);\n }\n\n this.independantMarkers = {};\n } else if (this.currentMarkersSelectionType) {\n\n this.markersDom.forEach(function (el) {\n\n if (!el.dom) {\n return;\n }\n\n if (el.dom.parentNode !== self.groupMarkers) {\n return;\n }\n\n self.groupMarkers.removeChild(el.dom);\n el.path = '';\n });\n\n this.currentMarkersSelectionType = false;\n }\n }\n\n isMonotoneous() {\n if (this.waveform) {\n return this.waveform.isMonotoneous();\n }\n\n return !!this.xmonotoneous;\n }\n\n findLocalMinMax(xRef, xWithin, type) {\n\n if (!this.waveform) {\n return false;\n }\n\n return this.waveform.findLocalMinMax(xRef, xWithin, type);\n }\n\n }\n\n function drawMarkerXY(graph, family, x, y, markerDom) {\n\n if (!family) {\n return;\n }\n\n if (graph.options.markersIndependant) {\n var dom = graph.getMarkerDomIndependent(graph.counter2, family);\n var p = 'M ' + x + ' ' + y + ' ';\n p += family.markerPath + ' ';\n\n dom.setAttribute('d', p);\n }\n\n markerDom.path = markerDom.path || '';\n markerDom.path += 'M ' + x + ' ' + y + ' ';\n markerDom.path += family.markerPath + ' ';\n }\n\n util.mix(SerieLine, _graphMixinErrorbars2.default);\n\n exports.default = SerieLine;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports);\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports);\n global.graphPosition = mod.exports;\n }\n})(this, function (module, exports) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n function _parsePx(px) {\n if (px && px.indexOf && px.indexOf('px') > -1) {\n return parseInt(px.replace('px', ''));\n }\n return false;\n }\n\n function isNumeric(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n }\n\n /**\n * Utility class to compute positioning\n * @class\n */\n class Position {\n\n constructor(x, y, dx, dy) {\n\n if (typeof x == 'object') {\n this.x = x.x;\n this.y = x.y;\n this.dx = x.dx;\n this.dy = x.dy;\n } else {\n this.x = x;\n this.y = y;\n this.dx = dx;\n this.dy = dy;\n }\n }\n\n duplicate() {\n return new Position(this.x, this.y, this.dx, this.dy);\n }\n\n /**\n * Computes the position of the position\n * @param {Graph} graph - The graph for which the position has to be computed\n * @param {AxisX} xAxis - The x axis to consider (has to belong to the graph)\n * @param {AxisY} yAxis - The y axis to consider (has to belong to the graph)\n * @param {Serie} [serie] - For non-existing y value, use a serie to compute it automatically from the serie data\n * @return {Object} An object in the format ```{x: xPx, y: yPx}``` containing the position in pixels of the position\n */\n compute(graph, xAxis, yAxis, serie) {\n\n if (!graph || !xAxis || !yAxis || !graph.hasXAxis || !graph.hasYAxis) {\n graph.throw();\n }\n\n if (!graph.hasXAxis(xAxis)) {\n throw 'Graph does not contain the x axis that was used as a parameter';\n }\n\n if (!graph.hasYAxis(yAxis)) {\n throw 'Graph does not contain the x axis that was used as a parameter';\n }\n\n return this._compute(graph, xAxis, yAxis, serie);\n }\n\n _compute(graph, xAxis, yAxis, serie) {\n\n var relativeTo = this._relativeTo;\n if (relativeTo) {\n var relativeToComputed = relativeTo._compute(graph, xAxis, yAxis, serie);\n }\n\n var parsed,\n pos = {\n x: false,\n y: false\n };\n\n if (!xAxis) {\n xAxis = graph.getXAxis();\n }\n\n if (!yAxis) {\n yAxis = graph.getYAxis();\n }\n\n for (var i in pos) {\n\n var axis = i == 'x' ? xAxis : yAxis;\n var val = this[i];\n var dval = this['d' + i];\n\n if (val === undefined && (dval !== undefined && relativeTo === undefined || relativeTo === undefined)) {\n\n if (i == 'x') {\n\n if (dval === undefined) {\n continue;\n }\n\n pos[i] = relativeTo ? relativeTo[i] : 0;\n } else if (this.x !== undefined && serie) {\n\n if (_parsePx(this.x) !== false) {\n console.warn('You have defined x in px and not y. Makes no sense. Returning 0 for y');\n pos[i] = 0;\n } else {\n\n var closest = serie.searchClosestValue(this.x);\n\n if (!closest) {\n console.warn('Could not find y position for x = ' + this.x + ' on serie \"' + serie.getName() + '\". Returning 0 for y.');\n pos[i] = 0;\n } else {\n pos[i] = serie.getY(closest.yMin);\n }\n }\n }\n } else if (val !== undefined) {\n\n pos[i] = this.getPx(val, axis);\n }\n\n if (dval !== undefined) {\n\n var def = val !== undefined || relativeToComputed == undefined || relativeToComputed[i] == undefined ? pos[i] : relativeToComputed[i];\n\n if (i == 'y' && relativeToComputed && relativeToComputed.x !== undefined && relativeToComputed.y == undefined) {\n\n if (!serie) {\n throw 'Error. No serie exists. Cannot find y value';\n return;\n }\n\n var closest = serie.searchClosestValue(relativeTo.x);\n if (closest) {\n def = serie.getY(closest.yMin);\n }\n\n //console.log( relativeTo.x, closest, serie.getY( closest.yMin ), def );\n }\n\n if (!def) {\n def = 0;\n }\n\n if ((parsed = _parsePx(dval)) !== false) {\n // dx in px => val + 10px\n\n pos[i] = def + parsed; // return integer (will be interpreted as px)\n } else if ((parsed = this._parsePercent(dval)) !== false) {\n\n pos[i] = def + this._getPositionPx(parsed, true, axis, graph); // returns xx%\n } else if (axis) {\n\n pos[i] = def + axis.getRelPx(dval); // px + unittopx\n }\n }\n }\n\n return pos;\n }\n\n _getPositionPx(value, x, axis, graph) {\n\n var parsed;\n\n if ((parsed = _parsePx(value)) !== false) {\n return parsed; // return integer (will be interpreted as px)\n }\n\n if ((parsed = this._parsePercent(value)) !== false) {\n return parsed / 100 * (x ? graph.getDrawingWidth() : graph.getDrawingHeight());\n } else if (axis) {\n return axis.getPos(value);\n }\n }\n\n _parsePercent(percent) {\n if (percent && percent.indexOf && percent.indexOf('%') > -1) {\n return percent;\n }\n return false;\n }\n\n /**\n * Computes the value in pixels of an amplitude (or a distance) for a certain axis\n * @param {Number} value - The value in axis unit\n * @param {Axis} Axis - The x axis to consider (has to belong to the graph)\n * @return {String} The value in pixels, e.g. \"20px\"\n */\n getDeltaPx(value, axis) {\n var v;\n if ((v = _parsePx(value)) !== false) {\n return v + 'px';\n } else {\n\n return axis.getRelPx(value) + 'px';\n }\n }\n\n deltaPosition(mode, delta, axis) {\n\n mode = mode == 'y' ? 'y' : 'x';\n var ref = this[mode],\n refd = this['d' + mode],\n refPx,\n deltaPx;\n\n if (ref !== undefined) {\n if ((refPx = _parsePx(ref)) !== false) {\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this[mode] = refPx + deltaPx + 'px';\n } else {\n this[mode] = refPx + axis.getRelPx(delta) + 'px';\n }\n } else {\n\n ref = this.getValPosition(ref, axis);\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this[mode] = ref + axis.getRelVal(deltaPx);\n } else {\n this[mode] = ref + delta;\n }\n }\n } else if (refd !== undefined) {\n\n if (mode == 'y' && ref === undefined && !this._relativeTo) {\n // This means that the shape is placed by the x value. Therefore, the dy is only a stand-off.\n // Therefore, we do nothing\n return;\n }\n\n if ((refPx = _parsePx(refd)) !== false) {\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this['d' + mode] = refPx + deltaPx + 'px';\n } else {\n this['d' + mode] = refPx + axis.getRelPx(delta) + 'px';\n }\n } else {\n\n refd = this.getValPosition(refd, axis);\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this['d' + mode] = refd + axis.getRelVal(deltaPx);\n } else {\n this['d' + mode] = refd + delta;\n }\n }\n }\n }\n\n getValPosition(rel, axis) {\n\n if (rel == 'max') {\n return axis.getMaxValue();\n }\n\n if (rel == 'min') {\n return axis.getMinValue();\n }\n\n return rel;\n }\n\n /**\n * Computes a value in pixels\n * @param {Number} value - The value in axis unit\n * @param {Axis} axis - The x or y axis to consider (has to belong to the graph)\n * @param {Boolean} rel - Whether or not the value is a distance\n * @return {(Number|String)} The computed value\n */\n getPx(value, axis, rel) {\n\n var parsed;\n\n if (typeof value == 'function') {\n\n return value(axis, rel);\n } else if ((parsed = _parsePx(value)) !== false) {\n\n return parsed; // return integer (will be interpreted as px)\n } else if ((parsed = this._parsePercent(value)) !== false) {\n\n return parsed; // returns xx%\n } else if (axis) {\n\n if (value == 'min') {\n\n return axis.getMinPx();\n } else if (value == 'max') {\n\n return axis.getMaxPx();\n } else if (rel) {\n\n return axis.getRelPx(value);\n } else if (isNumeric(value)) {\n\n return axis.getPos(value);\n }\n }\n }\n\n getPxRel(value, axis) {\n return this.getPx(value, axis, true);\n }\n\n /**\n * Assigns the current position as relative to another. This is used when a position is used with \"dx\" or \"dy\" and not \"x\" or \"y\"\n * @param {Position} pos - The reference position\n * @return {Position} The current position\n */\n relativeTo(pos) {\n this._relativeTo = Position.check(pos);\n return this;\n }\n\n /**\n * Checks if an object is a position. If not, creates a new Position instance with the ```pos``` object. If a new position is created, ```callback``` is fired with the position as a unique parameter. The return of the function, if not false, should be a ```Position``` instance which serves as the reference position.\n * @example Position.check( { x: 1, y: 2 }, function() { return someOtherPosition; } );\n * @param {(Object|Position)} pos - The position object or the object fed into the constructor\n * @param {Function} callback - The callback fired if a new position is created\n * @return {Position} The resulting position object\n */\n static check(pos, callback) {\n if (pos instanceof Position) {\n return pos;\n }\n\n var posObject = new Position(pos);\n\n if (pos && pos.relativeTo) {\n const position = callback(pos.relativeTo);\n if (position) {\n posObject.relativeTo(position);\n }\n }\n\n return posObject;\n }\n }\n\n exports.default = Position;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports);\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports);\n global.EventEmitter = mod.exports;\n }\n})(this, function (module, exports) {\n /*!\n * EventEmitter v4.2.9 - git.io/ee\n * Oliver Caldwell\n * MIT license\n * @preserve\n */\n\n 'use strict';\n\n /**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n function EventEmitter() {}\n\n // Shortcuts to improve speed and size\n var proto = EventEmitter.prototype;\n\n /**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\n function indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n }\n\n /**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\n function alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n }\n\n /**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\n proto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n } else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n };\n\n /**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\n proto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n };\n\n /**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\n proto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n };\n\n /**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n };\n\n /**\n * Alias of addListener\n */\n proto.on = alias('addListener');\n\n /**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n };\n\n /**\n * Alias of addOnceListener.\n */\n proto.once = alias('addOnceListener');\n\n /**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n };\n\n /**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n };\n\n /**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of removeListener\n */\n proto.off = alias('removeListener');\n\n /**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n };\n\n /**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n };\n\n /**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n } else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n } else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n };\n\n /**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n } else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n } else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n };\n\n /**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\n proto.removeAllListeners = alias('removeEvent');\n\n /**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emitEvent = function emitEvent(evt, args) {\n var listeners = this.getListenersAsObject(evt);\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n i = listeners[key].length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[key][i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n };\n\n /**\n * Alias of emitEvent\n */\n proto.trigger = alias('emitEvent');\n\n /**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n };\n\n /**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\n proto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n };\n\n /**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\n proto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n } else {\n return true;\n }\n };\n\n /**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\n proto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n };\n\n exports.default = EventEmitter;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(7), __webpack_require__(0), __webpack_require__(4)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../dependencies/eventEmitter/EventEmitter.js'), require('../graph.util.js'), require('../util/waveform.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.EventEmitter, global.graphUtil, global.waveform);\n global.graphSerie = mod.exports;\n }\n})(this, function (module, exports, _EventEmitter, _graphUtil, _waveform) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _EventEmitter2 = _interopRequireDefault(_EventEmitter);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _waveform2 = _interopRequireDefault(_waveform);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Serie class to be extended\n * @static\n */\n class Serie extends _EventEmitter2.default {\n\n static default() {\n\n return {\n redrawShapesAfterDraw: false\n };\n }\n\n constructor(graph, name, options) {\n\n super(...arguments);\n this.graph = graph;\n this.name = name;\n this.options = Object.assign({}, Serie.default(), this.constructor.default(), options);\n\n //if( new.target.default ) {\n //console.log( new.target.default() );\n //}\n }\n\n draw() {}\n\n beforeDraw() {}\n\n afterDraw() {\n\n if (this.options.redrawShapesAfterDraw) {\n this.graph.getShapesOfSerie(this).forEach(shape => {\n shape.redraw();\n });\n }\n\n this.emit('draw');\n }\n\n /**\n * Sets data to the serie\n * @memberof Serie\n * @param {(Object|Array|Array[])} data - The data of the serie\n * @param {Boolean} [ oneDimensional=false ] - In some cases you may need to force the 1D type. This is required when one uses an array or array to define the data (see examples)\n * @param{String} [ type=float ] - Specify the type of the data. Use int to save memory (half the amount of bytes allocated to the data).\n * @example serie.setData( [ [ x1, y1 ], [ x2, y2 ], ... ] );\n * @example serie.setData( [ x1, y1, x2, y2, ... ] ); // Faster\n * @example serie.setData( [ [ x1, y1, x2, y2, ..., xn, yn ] , [ xm, ym, x(m + 1), y(m + 1), ...] ], true ) // 1D array with a gap in the middle\n * @example serie.setData( { x: x0, dx: spacing, y: [ y1, y2, y3, y4 ] } ); // Data with equal x separation. Fastest way\n */\n setData(data, oneDimensional, type) {\n\n if (data instanceof _waveform2.default) {\n return this.setWaveform(data);\n }\n\n throw 'Setting data other than waveforms in not supported by default. You must implemented this method in the inherited class.';\n }\n\n _addData(type, howmany) {\n return [];\n }\n\n /**\n * Removes all the data from the serie, without redrawing\n * @returns {Serie} The current serie\n */\n clearData() {\n this.setData(new _waveform2.default());\n return this;\n }\n\n /**\n * Returns the data in its current form\n * @returns {Array.<(Float64Array|Int32Array)>} An array containing the data chunks. Has only one member if the data has no gaps\n * @memberof Serie\n */\n getData() {\n return this.data;\n }\n\n /**\n * Sets the options of the serie (no extension of default options)\n * @param {Object} options - The options of the serie\n * @memberof Serie\n */\n setOptions(options) {\n this.options = options || {};\n }\n\n /**\n * Sets the options of the serie (no extension of default options)\n * @param {String} name - The option name\n * @param value - The option value\n * @memberof Serie\n * @example serie.setOption('selectableOnClick', true );\n */\n setOption(name, value) {\n this.options[name] = value;\n }\n\n /**\n * Removes the serie from the graph. The method doesn't perform any axis autoscaling or repaint of the graph. This should be done manually.\n * @return {Serie} The current serie instance\n * @memberof Serie\n */\n kill(noLegendUpdate) {\n\n this.graph.removeSerieFromDom(this);\n this.graph._removeSerie(this);\n\n if (this.graph.legend && !noLegendUpdate) {\n\n this.graph.legend.update();\n }\n\n this.graph = undefined;\n return this;\n }\n\n /**\n * Hides the serie\n * @memberof Serie\n * @param {Boolean} [ hideShapes = false ] - true to hide the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n hide(hideShapes, mute = false) {\n\n this.hidden = true;\n this.groupMain.setAttribute('display', 'none');\n\n this.getSymbolForLegend().setAttribute('opacity', 0.5);\n this.getTextForLegend().setAttribute('opacity', 0.5);\n\n this.hideImpl();\n\n if (hideShapes) {\n var shapes = this.graph.getShapesOfSerie(this);\n for (var i = 0, l = shapes.length; i < l; i++) {\n shapes[i].hide();\n }\n }\n\n if (!mute) {\n this.emit('hide');\n }\n\n if (this.getXAxis().doesHideWhenNoSeriesShown() || this.getYAxis().doesHideWhenNoSeriesShown()) {\n this.graph.draw(true);\n }\n\n return this;\n }\n\n /**\n * Shows the serie\n * @memberof Serie\n * @param {Boolean} [showShapes=false] - true to show the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n show(showShapes, mute = false) {\n\n this.hidden = false;\n this.groupMain.setAttribute('display', 'block');\n\n this.getSymbolForLegend().setAttribute('opacity', 1);\n this.getTextForLegend().setAttribute('opacity', 1);\n\n this.showImpl();\n\n this.draw(true);\n\n if (showShapes) {\n var shapes = this.graph.getShapesOfSerie(this);\n for (var i = 0, l = shapes.length; i < l; i++) {\n shapes[i].show();\n }\n }\n\n if (!mute) {\n this.emit('show');\n }\n\n if (this.getXAxis().doesHideWhenNoSeriesShown() || this.getYAxis().doesHideWhenNoSeriesShown()) {\n this.graph.draw(true);\n }\n return this;\n }\n\n hideImpl() {}\n showImpl() {}\n\n /**\n * Toggles the display of the serie (effectively, calls .show() and .hide() alternatively on each call)\n * @memberof Serie\n * @param {Boolean} [hideShapes=false] - true to hide the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n toggleDisplay() {\n\n if (!this.isShown()) {\n this.show();\n } else {\n this.hide();\n }\n\n return this;\n }\n\n /**\n * Determines if the serie is currently visible\n * @memberof Serie\n * @returns {Boolean} The current visibility status of the serie\n */\n isShown() {\n return !this.hidden;\n }\n\n /**\n * Checks that axes assigned to the serie have been defined and have proper values\n * @memberof Serie\n */\n axisCheck() {\n\n if (!this.getXAxis() || !this.getYAxis()) {\n throw 'No axis exist for this serie. Check that they were properly assigned';\n }\n\n if (isNaN(this.getXAxis().getCurrentMin()) || isNaN(this.getXAxis().getCurrentMax()) || isNaN(this.getYAxis().getCurrentMin()) || isNaN(this.getYAxis().getCurrentMax())) {\n throw 'Axis min and max values are not defined. Try autoscaling';\n }\n }\n /**\n * Returns the x position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The x position in px corresponding to the x value\n */\n getX(val) {\n return (val = this.getXAxis().getPx(val)) - val % 0.2;\n }\n\n /**\n * Returns the y position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The y position in px corresponding to the y value\n */\n getY(val) {\n return (val = this.getYAxis().getPx(val)) - val % 0.2;\n }\n\n /**\n * Returns the selection state of the serie. Generic for most serie types\n * @memberof Serie\n * @returns {Boolean} true if the serie is selected, false otherwise\n */\n isSelected() {\n return this.selected || this.selectionType !== 'unselected';\n }\n\n _checkX(val) {\n this.minX = Math.min(this.minX, val);\n this.maxX = Math.max(this.maxX, val);\n }\n\n _checkY(val) {\n this.minY = Math.min(this.minY, val);\n this.maxY = Math.max(this.maxY, val);\n }\n\n /**\n * Getter for the serie name\n * @memberof Serie\n * @returns {String} The serie name\n */\n getName() {\n return this.name;\n }\n\n /* AXIS */\n\n /**\n * Assigns axes automatically, based on {@link Graph#getXAxis} and {@link Graph#getYAxis}.\n * @memberof Serie\n * @returns {Serie} The current serie\n */\n autoAxis() {\n\n if (this.isFlipped()) {\n\n this.setXAxis(this.graph.getYAxis());\n this.setYAxis(this.graph.getXAxis());\n } else {\n\n this.setXAxis(this.graph.getXAxis());\n this.setYAxis(this.graph.getYAxis());\n }\n\n // After axes have been assigned, the graph axes should update their min/max\n this.graph.updateDataMinMaxAxes();\n return this;\n }\n\n autoAxes() {\n return this.autoAxis(...arguments);\n }\n\n /**\n * Assigns an x axis to the serie\n * @memberof Serie\n * @param {Axis|Number} axis - The axis to use as an x axis. If an integer, {@link Graph#getXAxis} or {@link Graph#getYAxis} will be used\n * @returns {Serie} The current serie\n * @example serie.setXAxis( graph.getTopAxis( 1 ) ); // Assigns the second top axis to the serie\n */\n setXAxis(axis) {\n\n if (typeof axis == 'number') {\n this.xaxis = this.isFlipped() ? this.graph.getYAxis(axis) : this.graph.getXAxis(axis);\n } else {\n this.xaxis = axis;\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Assigns an y axis to the serie\n * @memberof Serie\n * @param {Axis|Number} axis - The axis to use as an y axis. If an integer, {@link Graph#getXAxis} or {@link Graph#getYAxis} will be used\n * @returns {Serie} The current serie\n * @example serie.setYAxis( graph.getLeftAxis( 4 ) ); // Assigns the 5th left axis to the serie\n */\n setYAxis(axis) {\n if (typeof axis == 'number') {\n this.xaxis = this.isFlipped() ? this.graph.getXAxis(axis) : this.graph.getYAxis(axis);\n } else {\n this.yaxis = axis;\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Assigns two axes to the serie\n * @param {GraphAxis} axis1 - First axis to assign to the serie (x or y)\n * @param {GraphAxis} axis2 - Second axis to assign to the serie (y or x)\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setAxes() {\n\n for (var i = 0; i < 2; i++) {\n\n if (arguments[i]) {\n this[arguments[i].isX() ? 'setXAxis' : 'setYAxis'](arguments[i]);\n }\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * @returns {GraphAxis} The x axis assigned to the serie\n * @memberof Serie\n */\n getXAxis() {\n return this.xaxis;\n }\n\n /**\n * @returns {GraphAxis} The y axis assigned to the serie\n * @memberof Serie\n */\n getYAxis() {\n return this.yaxis;\n }\n\n /* */\n\n /* DATA MIN MAX */\n\n /**\n * @returns {Number} Lowest x value of the serie's data\n * @memberof Serie\n */\n getMinX() {\n return this.minX;\n }\n\n /**\n * @returns {Number} Highest x value of the serie's data\n * @memberof Serie\n */\n getMaxX() {\n return this.maxX;\n }\n\n /**\n * @returns {Number} Lowest y value of the serie's data\n * @memberof Serie\n */\n getMinY() {\n return this.minY;\n }\n\n /**\n * @returns {Number} Highest y value of the serie's data\n * @memberof Serie\n */\n getMaxY() {\n return this.maxY;\n }\n\n getWaveform() {\n return this.waveform;\n }\n\n getWaveforms() {\n return [this.waveform];\n }\n\n setWaveform(waveform) {\n\n if (!(waveform instanceof _waveform2.default)) {\n console.trace();\n console.error(waveform);\n throw new Error('Cannot assign waveform to serie. Waveform is not of the proper Waveform instance');\n }\n\n this.waveform = waveform;\n\n this.minX = this.waveform.getXMin();\n this.maxX = this.waveform.getXMax();\n this.minY = this.waveform.getMin();\n this.maxY = this.waveform.getMax();\n\n this.graph.updateDataMinMaxAxes();\n this.dataHasChanged();\n\n return this;\n }\n\n /**\n * Computes and returns a line SVG element with the same line style as the serie, or width 20px\n * @returns {SVGElement}\n * @memberof Serie\n */\n getSymbolForLegend() {\n\n if (!this.lineForLegend) {\n\n var line = document.createElementNS(this.graph.ns, 'line');\n this.applyLineStyle(line);\n\n line.setAttribute('x1', 5);\n line.setAttribute('x2', 25);\n line.setAttribute('y1', 0);\n line.setAttribute('y2', 0);\n\n line.setAttribute('cursor', 'pointer');\n\n this.lineForLegend = line;\n }\n\n return this.lineForLegend;\n }\n\n /**\n * Explicitely applies the line style to the SVG element returned by {@link Serie#getSymbolForLegend}\n * @see Serie#getSymbolForLegend\n * @returns {SVGElement}\n * @memberof Serie\n */\n setLegendSymbolStyle() {\n this.applyLineStyle(this.getSymbolForLegend());\n }\n\n /**\n * @alias Serie#setLegendSymbolStyle\n * @memberof Serie\n */\n updateStyle() {\n this.setLegendSymbolStyle();\n this.graph.updateLegend();\n }\n\n /**\n * Computes and returns a text SVG element with the label of the serie as a text, translated by 35px\n * @returns {SVGElement}\n * @memberof Serie\n * @see Serie#getLabel\n */\n getTextForLegend() {\n\n if (!this.textForLegend) {\n\n var text = document.createElementNS(this.graph.ns, 'text');\n text.setAttribute('cursor', 'pointer');\n text.textContent = this.getLabel();\n\n this.textForLegend = text;\n }\n\n return this.textForLegend;\n }\n\n /**\n * @returns {Number} The current index of the serie\n * @memberof Serie\n */\n getIndex() {\n return this.graph.series.indexOf(this);\n }\n\n /**\n * @returns {String} The label or, alternatively - the name of the serie\n * @memberof Serie\n */\n getLabel() {\n return this.options.label || this.name;\n }\n\n /**\n * Sets the label of the serie. Note that this does not automatically updates the legend\n * @param {String} label - The new label of the serie\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setLabel(label) {\n this.options.label = label;\n\n if (this.textForLegend) {\n this.textForLegend.textContent = label;\n }\n\n this.graph.requireLegendUpdate();\n return this;\n }\n\n /* FLIP */\n\n /**\n * Assigns the flipping value of the serie. A flipped serie will have inverted axes. However this method does not automatically re-assigns the axes of the serie. Call {@link Serie#autoAxis} to re-assign the axes automatically, or any other axis setting method.\n * @param {Boolean} [flipped=false] - true to flip the serie\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setFlip(flipped) {\n this.options.flip = flipped;\n return this;\n }\n\n /**\n * @returns {Boolean} true if the serie is flipped, false otherwise\n * @memberof Serie\n */\n getFlip() {\n return this.options.flip;\n }\n\n /**\n * @alias Serie#getFlip\n * @memberof Serie\n */\n isFlipped() {\n return this.options.flip;\n }\n\n /**\n * Sets the layer onto which the serie should be displayed. This method does not trigger a graph redraw.\n * @memberof Serie\n * @param {Number} layerIndex=1 - The index of the layer into which the serie will be drawn\n * @returns {Serie} The current serie\n */\n setLayer(layerIndex) {\n let newLayer = parseInt(layerIndex) || 1;\n\n if (newLayer !== this.options.layer) {\n this.options.layer = newLayer;\n this.graph.appendSerieToDom(this);\n }\n\n return this;\n }\n\n /**\n * Sets the layer onto which the serie should be displayed. This method does not trigger a graph redraw.\n * @memberof Serie\n * @returns {Nunber} The index of the layer into which the serie will be drawn\n */\n getLayer() {\n return this.options.layer || 1;\n }\n\n setStyle(style, selectionType = 'unselected') {\n this.styles[selectionType] = style;\n this.styleHasChanged(selectionType);\n }\n\n /**\n * Notifies jsGraph that the style of the serie has changed and needs to be redrawn on the next repaint\n * @param {String} selectionType - The selection for which the style may have changed\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n styleHasChanged(selectionType = 'unselected') {\n this._changedStyles = this._changedStyles || {};\n\n if (selectionType === false) {\n for (var i in this._changedStyles) {\n this._changedStyles[i] = false;\n }\n } else {\n this._changedStyles[selectionType || 'unselected'] = true;\n }\n\n this.graph.requireLegendUpdate();\n return this;\n }\n\n /**\n * Checks if the style has changed for a selection type\n * @param {String} selectionType - The selection for which the style may have changed\n * @returns {Boolean} true if the style has changed\n * @private\n * @memberof Serie\n */\n hasStyleChanged(selectionType) {\n this._changedStyles = this._changedStyles || {};\n return this._changedStyles[selectionType || 'unselected'];\n }\n\n /**\n * Notifies jsGraph that the data of the serie has changed\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n dataHasChanged(arg) {\n this._dataHasChanged = arg === undefined || arg;\n return this;\n }\n\n /**\n * Checks if the data has changed\n * @returns {Boolean} true if the data has changed\n * @private\n * @memberof Serie\n */\n hasDataChanged() {\n return this._dataHasChanged;\n }\n\n /**\n * Set a key/value arbitrary information to the serie. It is particularly useful if you have this serie has a reference through an event for instance, and you want to retrieve data associated to it\n * @param {String} prop - The property\n * @param value - The value\n * @returns {Serie} The current serie\n * @see Serie#getInfo\n * @memberof Serie\n */\n setInfo(prop, value) {\n this.infos = this.infos || {};\n this.infos[prop] = value;\n return this;\n }\n\n /**\n * Retrives an information value from its key\n * @param {String} prop - The property\n * @returns The value associated to the prop parameter\n * @see Serie#setInfo\n * @memberof Serie\n */\n getInfo(prop, value) {\n return (this.infos || {})[prop];\n }\n\n /**\n * @deprecated\n * @memberof Serie\n */\n setAdditionalData(data) {\n this.additionalData = data;\n return this;\n }\n\n /**\n * @deprecated\n * @memberof Serie\n */\n getAdditionalData() {\n return this.additionalData;\n }\n\n /**\n * Flags the serie as selected\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n select() {\n this.selected = true;\n return this;\n }\n\n /**\n * Flags the serie as unselected\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n unselect() {\n this.selected = false;\n return this;\n }\n\n /**\n * Allows mouse tracking of the serie\n * @memberof Serie\n * @returns {Serie} The current serie\n * @param {Function} hoverCallback - Function to be called when the mouse enters the serie area\n * @param {Function} outCallback - Function to be called when the mouse exits the serie area\n * @private\n */\n enableTracking(hoverCallback, outCallback) {\n this._tracker = true;\n this._trackingCallback = hoverCallback;\n this._trackingOutCallback = outCallback;\n\n return this;\n }\n\n /**\n * Disables mouse tracking of the serie\n * @memberof Serie\n * @returns {Serie} The current serie\n * @private\n */\n disableTracking() {\n\n if (this._trackerDom) {\n this._trackerDom.remove();\n this._trackerDom = null;\n }\n\n this._tracker = false;\n this._trackingCallback = null;\n return this;\n }\n\n /**\n * Allows mouse tracking of the serie\n * @memberof Serie\n * @param {Object} options - The tracking line options\n * @returns {Serie} The current serie\n */\n allowTrackingLine(options) {\n\n options = options || {};\n this.graph.addSerieToTrackingLine(this, options);\n }\n\n getMarkerForLegend() {\n return false;\n }\n\n get type() {\n return this._type;\n }\n\n getType() {\n return this._type;\n }\n\n set excludedFromLegend(bln) {\n this._excludedFromLegend = bln;\n }\n\n get excludedFromLegend() {\n return !!this._excludedFromLegend;\n }\n\n setDataIndices(categories, nb) {\n this.categoryIndices = categories;\n this.nbCategories = nb;\n }\n\n hasErrors() {\n if (!this.waveform) {\n return false;\n }\n\n return this.waveform.hasErrorBars();\n }\n }\n\n exports.default = Serie;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(3), __webpack_require__(7), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.core.js'), require('./dependencies/eventEmitter/EventEmitter.js'), require('./graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphCore, global.EventEmitter, global.graphUtil);\n global.graphAxis = mod.exports;\n }\n})(this, function (module, exports, _graphCore, _EventEmitter, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphCore2 = _interopRequireDefault(_graphCore);\n\n var _EventEmitter2 = _interopRequireDefault(_EventEmitter);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Default graph parameters\n * @name AxisOptionsDefault\n * @object\n * @static\n * @memberof Axis\n * @prop {Boolean} display - Whether to display or not the axis\n * @prop {Boolean} flipped - Flips the axis (maximum and minimum will be inverted)\n * @prop {Numner} axisDataSpacing.min - The spacing of the at the bottom of the axis. The value is multiplied by the (max - min) values given by the series (0.1 means 10% of the serie width / height).\n * @prop {Number} axisDataSpacing.max - The spacing of the at the top of the axis. The value is multiplied by the (max - min) values given by the series (0.1 means 10% of the serie width / height).\n * @prop {String} unitModification - Used to change the units of the axis in a defined way. Currently, \"time\" and \"time:min.sec\" are supported. They will display the value in days, hours, minutes and seconds and the data should be expressed in seconds.\n * @prop {Boolean} primaryGrid - Whether or not to display the primary grid (on the main ticks)\n * @prop {Boolean} secondaryGrid - Whether or not to display the secondary grid (on the secondary ticks)\n * @prop {Number} tickPosition - Sets the position of the ticks with regards to the axis ( 1 = inside, 2 = centered, 3 = outside ).\n * @prop {Number} nbTicksPrimary - The number of primary ticks to use (approximately)\n * @prop {Number} nbTicksSecondary - The number of secondary ticks to use (approximately)\n * @prop {Number} ticklabelratio - Scaling factor on the labels under each primary ticks\n * @prop {Number} exponentialFactor - Scales the labels under each primary ticks by 10^(exponentialFactor)\n * @prop {Number} exponentialLabelFactor - Scales the axis label by 10^(exponentialFactor)\n * @prop {Boolean} logScale - Display the axis in log scale (base 10)\n * @prop {(Number|Boolean)} forcedMin - Use a number to force the minimum value of the axis (becomes independant of its series)\n * @prop {(Number|Boolean)} forcedMax - Use a number to force the maximum value of the axis (becomes independant of its series)\n */\n const defaults = {\n lineAt: false,\n display: true,\n flipped: false,\n axisDataSpacing: {\n min: 0.1,\n max: 0.1\n },\n unitModification: false,\n primaryGrid: true,\n secondaryGrid: true,\n\n primaryGridColor: '#f0f0f0',\n secondaryGridColor: '#f0f0f0',\n\n primaryGridWidth: 1,\n secondaryGridWidth: 1,\n\n hideWhenNoSeriesShown: false,\n shiftToZero: false,\n tickPosition: 1,\n nbTicksPrimary: 3,\n nbTicksSecondary: 10,\n ticklabelratio: 1,\n exponentialFactor: 0,\n exponentialLabelFactor: 0,\n logScale: false,\n forcedMin: false,\n forcedMax: false,\n\n span: [0, 1],\n marginMin: 0,\n marginMax: 0,\n\n scientificScale: false,\n scientificScaleExponent: false,\n engineeringScale: false,\n\n unitInTicks: false,\n unit: false,\n unitWrapperBefore: '',\n unitWrapperAfter: '',\n\n splitMarks: false,\n\n tickLabelOffset: 0,\n\n useKatexForLabel: false\n };\n\n /**\n * Axis constructor. Usually not instanced directly, but for custom made axes, that's possible\n * @class Axis\n * @static\n * @augments EventEmitter\n * @example function myAxis() {};\n * myAxis.prototype = new Graph.getConstructor(\"axis\");\n * graph.setBottomAxis( new myAxis( { } ) );\n */\n class Axis extends _EventEmitter2.default {\n\n constructor() {\n\n super();\n }\n\n init(graph, options, overwriteoptions) {\n\n this.unitModificationTimeTicks = [[1, [1, 2, 5, 10, 20, 30]], [60, [1, 2, 5, 10, 20, 30]], [3600, [1, 2, 6, 12]], [3600 * 24, [1, 2, 3, 4, 5, 10, 20, 40]]];\n\n this.graph = graph;\n this.options = util.extend(true, {}, defaults, overwriteoptions, options);\n\n this.group = document.createElementNS(this.graph.ns, 'g');\n this.hasChanged = true;\n\n this.rectEvent = document.createElementNS(this.graph.ns, 'rect');\n this.rectEvent.setAttribute('pointer-events', 'fill');\n this.rectEvent.setAttribute('fill', 'transparent');\n this.group.appendChild(this.rectEvent);\n\n this.graph.axisGroup.appendChild(this.group); // Adds to the main axiszone\n\n // Lines at a certain value\n this._lines = [];\n\n this.line = document.createElementNS(this.graph.ns, 'line');\n this.line.setAttribute('stroke', 'black');\n this.line.setAttribute('shape-rendering', 'crispEdges');\n this.line.setAttribute('stroke-linecap', 'square');\n this.groupTicks = document.createElementNS(this.graph.ns, 'g');\n this.groupTickLabels = document.createElementNS(this.graph.ns, 'g');\n\n this.group.appendChild(this.groupTicks);\n this.group.appendChild(this.groupTickLabels);\n this.group.appendChild(this.line);\n\n this.label = document.createElementNS(this.graph.ns, 'text');\n\n this.labelTspan = document.createElementNS(this.graph.ns, 'tspan'); // Contains the main label\n this.preunit = ''; //document.createElementNS( this.graph.ns, 'tspan' ); // Contains the scaling unit\n this.unitTspan = document.createElementNS(this.graph.ns, 'tspan'); // Contains the unit\n this.expTspan = document.createElementNS(this.graph.ns, 'tspan'); // Contains the exponent (x10)\n this.expTspanExp = document.createElementNS(this.graph.ns, 'tspan'); // Contains the exponent value\n\n this.label.appendChild(this.labelTspan);\n //this.label.appendChild( this.preunitTspan );\n this.label.appendChild(this.unitTspan);\n this.label.appendChild(this.expTspan);\n this.label.appendChild(this.expTspanExp);\n\n this.expTspan.setAttribute('dx', 6);\n this.expTspanExp.setAttribute('dy', -5);\n this.expTspanExp.setAttribute('font-size', '0.8em');\n\n this.label.setAttribute('text-anchor', 'middle');\n\n this.setTickPosition(this.options.tickPosition);\n\n this.gridLinePath = {\n primary: '',\n secondary: ''\n };\n\n this.gridPrimary = document.createElementNS(this.graph.ns, 'path');\n this.gridSecondary = document.createElementNS(this.graph.ns, 'path');\n\n this.graph.groupPrimaryGrids.appendChild(this.gridPrimary);\n this.graph.groupSecondaryGrids.appendChild(this.gridSecondary);\n\n this.setGridLinesStyle();\n\n this.group.appendChild(this.label);\n\n this.groupSeries = document.createElementNS(this.graph.ns, 'g');\n this.group.appendChild(this.groupSeries);\n\n this.widthHeightTick = 0;\n\n this.ticks = {};\n this.ticksLabels = [];\n this.tickScaling = {\n 1: 3,\n 2: 2,\n 3: 1,\n 4: 0.5\n };\n\n this.currentTick = {};\n this.lastCurrentTick = {};\n\n this.series = [];\n this.totalDelta = 0;\n this.currentAction = false;\n\n this.group.addEventListener('mousemove', e => {\n e.preventDefault();\n var coords = this.graph._getXY(e);\n this.handleMouseMoveLocal(coords.x, coords.y, e);\n\n for (var i = 0, l = this.series.length; i < l; i++) {\n this.series[i].handleMouseMove(false, true);\n }\n });\n\n this.labels = [];\n this.group.addEventListener('click', e => {\n e.preventDefault();\n var coords = this.graph._getXY(e);\n this.addLabel(this.getVal(coords.x - this.graph.getPaddingLeft()));\n });\n\n //this.clip = document.createElementNS( this.graph.ns, 'clipPath' );\n //this.clip.setAttribute( 'id', '_clip' + this.axisRand );\n //this.graph.defs.appendChild( this.clip );\n /*\n this.clipRect = document.createElementNS( this.graph.ns, 'rect' );\n this.clip.appendChild( this.clipRect );\n this.clip.setAttribute( 'clipPathUnits', 'userSpaceOnUse' );\n */\n this.gridPrimary.setAttribute('clip-path', 'url(#_clipplot' + this.graph._creation + ')');\n this.gridSecondary.setAttribute('clip-path', 'url(#_clipplot' + this.graph._creation + ')');\n this.graph._axisHasChanged(this);\n }\n\n handleMouseMoveLocal() {}\n\n /**\n * Hides the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n hide() {\n this.options.display = false;\n return this;\n }\n\n /**\n * Shows the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n show() {\n this.options.display = true;\n return this;\n }\n\n /**\n * Shows or hides the axis\n * @memberof Axis\n * @param {Boolean} display - true to display the axis, false to hide it\n * @return {Axis} The current axis\n */\n setDisplay(bool) {\n this.options.display = !!bool;\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Boolean} A boolean indicating the displayed state of the axis\n */\n isDisplayed() {\n\n if (!this.options.hideWhenNoSeriesShown) {\n return this.options.display;\n }\n\n return this.graph.getSeriesFromAxis(this).reduce((accumulator, serie) => {\n return accumulator || serie.isShown();\n }, false);\n }\n\n isShown() {\n\n return this.isDisplayed(...arguments);\n }\n\n hideGroup() {\n if (this._hidden) {\n return;\n }\n this._hidden = true;\n this.group.setAttribute('display', 'none');\n }\n\n showGroup() {\n if (!this._hidden) {\n return;\n }\n this._hidden = false;\n this.group.setAttribute('display', 'initial');\n }\n\n kill(noRedraw, noSerieKill) {\n this.graph.killAxis(this, noRedraw, noSerieKill);\n }\n /**\n * Forces the appearence of a straight perpendicular line at value 0\n * @param {Array} atValues - An array of x or y values where the lines are displayed\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setLineAt(atValues) {\n this.options.lineAt = atValues;\n return this;\n }\n\n // Used to adapt the 0 of the axis to the zero of another axis that has the same direction\n\n /**\n * Aligns ```thisValue``` of the axis to ```foreignValue``` of another axis\n * @param {(Axis|Boolean)} axis - The axis with which the 0 should be aligned. Use \"false\" to deactivate the adapt to 0 mode.\n * @param {Number} thisValue - The value of the current axis that should be aligned\n * @param {Number} foreignValue - The value of the reference axis that should be aligned\n * @param {String} preference - \"min\" or \"max\". Defined the boundary that should behave the more normally\n * @memberof Axis\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n adaptTo(axis, thisValue, foreignValue, preference) {\n\n if (!axis) {\n this.options.adaptTo = false;\n return this;\n }\n\n this.options.adaptTo = {\n axis: axis,\n thisValue: thisValue,\n foreignValue: foreignValue,\n preference: preference\n };\n\n this.adapt();\n\n return this;\n }\n\n /**\n * Adapts maximum and minimum of the axis if options.adaptTo is defined\n * @memberof Axis\n * @returns {Axis} The current axis\n * @since 1.13.2\n */\n adapt() {\n\n if (!this.options.adaptTo) {\n return;\n }\n\n var axis = this.options.adaptTo.axis,\n current = this.options.adaptTo.thisValue,\n foreign = this.options.adaptTo.foreignValue;\n\n if (axis.currentAxisMin === undefined || axis.currentAxisMax === undefined) {\n axis.setMinMaxToFitSeries();\n }\n\n if (this.options.forcedMin !== false && this.options.forcedMax == false || this.options.adaptTo.preference !== 'max') {\n\n if (this.options.forcedMin !== false) {\n this.currentAxisMin = this.options.forcedMin;\n } else {\n this.currentAxisMin = this._zoomed ? this.getCurrentMin() : this.getMinValue() - (current - this.getMinValue()) * (this.options.axisDataSpacing.min * (axis.getCurrentMax() - axis.getCurrentMin()) / (foreign - axis.getCurrentMin()));\n }\n\n if (this.currentAxisMin == current) {\n this.currentAxisMin -= this.options.axisDataSpacing.min * this.getInterval();\n }\n\n var use = this.options.forcedMin !== false ? this.options.forcedMin : this.currentAxisMin;\n this.currentAxisMax = (current - use) * (axis.getCurrentMax() - axis.getCurrentMin()) / (foreign - axis.getCurrentMin()) + use;\n } else {\n\n if (this.options.forcedMax !== false) {\n this.currentAxisMax = this.options.forcedMax;\n } else {\n this.currentAxisMax = this._zoomed ? this.getCurrentMax() : this.getMaxValue() + (this.getMaxValue() - current) * (this.options.axisDataSpacing.max * (axis.getCurrentMax() - axis.getCurrentMin()) / (axis.getCurrentMax() - foreign));\n }\n\n if (this.currentAxisMax == current) {\n this.currentAxisMax += this.options.axisDataSpacing.max * this.getInterval();\n }\n\n var use = this.options.forcedMax !== false ? this.options.forcedMax : this.currentAxisMax;\n\n this.currentAxisMin = (current - use) * (axis.getCurrentMin() - axis.getCurrentMax()) / (foreign - axis.getCurrentMax()) + use;\n }\n\n this.graph._axisHasChanged(this);\n }\n\n // Floating axis. Adapts axis position orthogonally to another axis at a defined value. Not taken into account for margins\n\n /**\n * Makes the axis floating (not aligned to the right or the left anymore). You need to specify another axis (perpendicular) and a value at which this axis should be located\n * @param {Axis} axis - The axis on which the current axis should be aligned to\n * @param {Number} value - The value on which the current axis should be aligned\n * @memberof Axis\n * @return {Axis} The current axis\n * @example graph.getYAxis().setFloat( graph.getBottomAxis(), 0 ); // Alignes the y axis with the origin of the bottom axis\n */\n setFloating(axis, value) {\n\n this.floating = true;\n this.floatingAxis = axis;\n this.floatingValue = value;\n\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Axis} The axis referencing the floating value of the current axis\n */\n getFloatingAxis() {\n return this.floatingAxis;\n }\n\n /**\n * @memberof Axis\n * @return {Axis} The value to which the current axis is aligned to\n */\n getFloatingValue() {\n return this.floatingValue;\n }\n\n /**\n * Sets the axis data spacing\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} min - The spacing at the axis min value\n * @param {Number} [ max = min ] - The spacing at the axis max value. If omitted, will be equal to the \"min\" parameter\n * @return {Axis} The current axis\n */\n setAxisDataSpacing(val1, val2) {\n this.options.axisDataSpacing.min = val1;\n this.options.axisDataSpacing.max = val2 || val1;\n return this;\n }\n\n dataSpacing() {\n return this.setAxisDataSpacing(...arguments);\n }\n\n /**\n * Sets the axis data spacing at the minimum of the axis\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} min - The spacing at the axis min value\n * @return {Axis} The current axis\n */\n setAxisDataSpacingMin(val) {\n this.options.axisDataSpacing.min = val;\n }\n\n /**\n * Sets the axis data spacing at the maximum of the axis\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} max - The spacing at the axis max value\n * @return {Axis} The current axis\n */\n setAxisDataSpacingMax(val) {\n this.options.axisDataSpacing.max = val;\n }\n\n setMinPx(px) {\n\n this.minPx = px;\n this.setMinMaxFlipped();\n }\n\n setMaxPx(px) {\n\n this.maxPx = px;\n this.setMinMaxFlipped();\n }\n\n /**\n * @memberof Axis\n * @return {Number} The position in px of the bottom of the axis\n */\n getMinPx() {\n return this.minPxFlipped;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The position in px of the top of the axis\n */\n getMaxPx() {\n return this.maxPxFlipped;\n }\n\n getMathMaxPx() {\n return this.maxPx;\n }\n\n getMathMinPx() {\n return this.minPx;\n }\n\n // Returns the true minimum of the axis. Either forced in options or the one from the data\n\n /**\n * Retrieves the minimum possible value of the axis. Can be set by \"forcedMin\", \"adapt0ToAxis\" or by the values of the series the axis contains. Does not take into account any zooming.\n * @memberof Axis\n * @return {Number} The minimum possible value of the axis\n */\n getMinValue() {\n return this.options.forcedMin !== false ? this.options.forcedMin : this.dataMin;\n }\n\n /**\n * Retrieves the maximum possible value of the axis. Can be set by \"forcedMax\", \"adapt0ToAxis\" or by the values of the series the axis contains. Does not take into account any zooming.\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getMaxValue() {\n return this.options.forcedMax !== false ? this.options.forcedMax : this.dataMax;\n }\n\n setMinValueData(min) {\n this.dataMin = min;\n\n // 25.10.2017. This is to help in the case there's no autoscaling\n if (isNaN(this.getCurrentMin())) {\n //this.setCurrentMin( this.getMinValue() );\n //this.cache();\n\n }\n }\n\n setMaxValueData(max) {\n this.dataMax = max;\n\n // 25.10.2017. This is to help in the case there's no autoscaling\n // 02.02.2018. Don't agree with this. Next time, put a link to show the use of this piece of code\n if (isNaN(this.getCurrentMax())) {\n // this.setCurrentMax( this.getMaxValue() );\n //this.cache();\n\n }\n }\n\n /**\n * Retrieves the maximum possible value of the axis based only on the data. Does not take into account the possible axis forcing\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getDataMax() {\n return this.dataMax;\n }\n\n /**\n * Retrieves the minimum possible value of the axis based only on the data. Does not take into account the possible axis forcing\n * @memberof Axis\n * @return {Number} The minimum possible value of the axis\n */\n getDataMin() {\n return this.dataMin;\n }\n\n /**\n * Forces the minimum value of the axis (no more dependant on the serie values)\n * @memberof Axis\n * @param {Number} min - The minimum value of the axis\n * @param {Boolean} noRescale - ```true``` to prevent the axis to rescale to set this minimum. Rescales anyway if current min is lower than the value. Defaults to ```false```\n * @return {Axis} The current axis\n */\n forceMin(min, noRescale = false) {\n this.options.forcedMin = min;\n this.setCurrentMin(noRescale ? this.getCurrentMin() : undefined);\n this.graph._axisHasChanged(this);\n return this;\n }\n\n /**\n * Forces the maximum value of the axis (no more dependant on the serie values).\n * @memberof Axis\n * @param {Number} max - The maximum value of the axis\n * @param {Boolean} noRescale - ```true``` to prevent the axis to rescale to set this maximum. Rescales anyway if current max is higher than the value\n * @return {Axis} The current axis\n */\n forceMax(max, noRescale = false) {\n this.options.forcedMax = max;\n this.setCurrentMax(noRescale ? this.getCurrentMax() : undefined);\n this.graph._axisHasChanged(this);\n return this;\n }\n\n /**\n * Retrieves the forced minimum of the axis\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getForcedMin() {\n return this.options.forcedMin;\n }\n\n /**\n * Retrieves the forced minimum of the axis\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getForcedMax() {\n return this.options.forcedMax;\n }\n\n /**\n * Forces the min and max values of the axis to the min / max values of another axis\n * @param {Axis} axis - The axis from which the min / max values are retrieved.\n * @memberof Axis\n * @return {Axis} The current axis\n */\n forceToAxis(axis) {\n if (axis.getMaxValue && axis.getMinValue) {\n this.options.forcedMin = axis.getMinValue();\n this.options.forcedMax = axis.getMaxValue();\n }\n\n return this;\n }\n\n getNbTicksPrimary() {\n return this.options.nbTicksPrimary;\n }\n\n setNbTicksPrimary(nb) {\n this.options.nbTicksPrimary = nb;\n }\n\n getNbTicksSecondary() {\n return this.options.nbTicksSecondary;\n }\n\n setNbTicksSecondary(nb) {\n this.options.nbTicksSecondary = nb;\n return this;\n }\n\n handleMouseMove(px) {\n this.mouseVal = this.getVal(px);\n }\n\n handleMouseWheel(delta, e, baseline) {\n\n delta = Math.min(0.2, Math.max(-0.2, delta));\n\n if (baseline == 'min') {\n baseline = this.getMinValue();\n } else if (baseline == 'max') {\n baseline = this.getMaxValue();\n } else if (!baseline) {\n baseline = 0;\n }\n\n this._doZoomVal((this.getCurrentMax() - baseline) * (1 + delta) + baseline, (this.getCurrentMin() - baseline) * (1 + delta) + baseline);\n\n this.graph.draw();\n //\tthis.graph.drawSeries(true);\n }\n\n set zoomLock(bln) {\n this._zoomLocked = bln;\n }\n\n get zoomLock() {\n return this._zoomLocked || false;\n }\n\n /**\n * Performs a zoom on the axis, without redraw afterwards\n * @param {Number} val1 - The new axis minimum\n * @param {Number} val2 - The new axis maximum\n * @memberof Axis\n * @return {Axis} The current axis\n * @example\n * graph.getBottomAxis().zoom( 50, 70 ); // Axis boundaries will be 50 and 70 after next redraw\n * graph.redraw();\n * @example\n * graph.getBottomAxis().forceMin( 0 ).forceMax( 100 ).zoom( 50, 70 ); // Axis boundaries will be 50 and 70 after next redraw\n * graph.draw();\n * graph.autoscaleAxes(); // New bottom axis boundaries will be 0 and 100, not 50 and 70 !\n * graph.draw();\n */\n zoom(val1, val2, forceLock) {\n\n if (!forceLock && this.zoomLock) {\n return;\n }\n\n return this._doZoomVal(val1, val2, true);\n }\n\n _doZoomVal(val1, val2, mute) {\n\n return this._doZoom(this.getPx(val1), this.getPx(val2), val1, val2, mute);\n }\n\n _doZoom(px1, px2, val1, val2, mute) {\n\n //if(this.options.display || 1 == 1) {\n var val1 = val1 !== undefined ? val1 : this.getVal(px1);\n var val2 = val2 !== undefined ? val2 : this.getVal(px2);\n\n this.setCurrentMin(Math.min(val1, val2));\n this.setCurrentMax(Math.max(val1, val2));\n\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n\n this._zoomed = true;\n\n this.adapt();\n\n this._hasChanged = true;\n\n // New method\n if (!mute) {\n this.emit('zoom', [this.currentAxisMin, this.currentAxisMax, this]);\n }\n\n return this;\n }\n\n getSerieShift() {\n return this._serieShift;\n }\n\n getSerieScale() {\n return this._serieScale;\n }\n\n getMouseVal() {\n return this.mouseVal;\n }\n\n getUnitPerTick(px, nbTick, valrange) {\n\n var pxPerTick = px / nbTicks; // 1000 / 100 = 10 px per tick\n if (!nbTick) {\n nbTick = px / 10;\n } else {\n nbTick = Math.min(nbTick, px / 10);\n }\n\n // So now the question is, how many units per ticks ?\n // Say, we have 0.0004 unit per tick\n var unitPerTick = valrange / nbTick;\n\n switch (this.options.unitModification) {\n\n case 'time':\n case 'time:min.sec':\n {\n\n //const max = this.getModifiedValue( this.getMaxValue() );/*,\n /*units = [\n [ 60, 'min' ],\n [ 3600, 'h' ],\n [ 3600 * 24, 'd' ]\n ];*/\n\n let i, l, k, m;\n let breaked = false;\n for (i = 0, l = this.unitModificationTimeTicks.length; i < l; i++) {\n for (k = 0, m = this.unitModificationTimeTicks[i][1].length; k < m; k++) {\n if (unitPerTick < this.unitModificationTimeTicks[i][0] * this.unitModificationTimeTicks[i][1][k]) {\n breaked = true;\n break;\n }\n }\n if (breaked) {\n break;\n }\n }\n\n //i and k contain the good variable;\n if (i !== this.unitModificationTimeTicks.length) {\n unitPerTickCorrect = this.unitModificationTimeTicks[i][0] * this.unitModificationTimeTicks[i][1][k];\n } else {\n unitPerTickCorrect = 1;\n }\n\n break;\n }\n default:\n {\n\n // We take the log\n var decimals = Math.floor(Math.log(unitPerTick) / Math.log(10));\n /*\n Example:\n 13'453 => Math.log10() = 4.12 => 4\n 0.0000341 => Math.log10() = -4.46 => -5\n */\n\n var numberToNatural = unitPerTick * Math.pow(10, -decimals);\n\n /*\n Example:\n 13'453 (4) => 1.345\n 0.0000341 (-5) => 3.41\n */\n\n this.decimals = -decimals;\n\n var possibleTicks = [1, 2, 5, 10];\n var closest = false;\n for (let i = possibleTicks.length - 1; i >= 0; i--) {\n if (!closest || Math.abs(possibleTicks[i] - numberToNatural) < Math.abs(closest - numberToNatural)) {\n closest = possibleTicks[i];\n }\n }\n\n // Ok now closest is the number of unit per tick in the natural number\n /*\n Example:\n 13'453 (4) (1.345) => 1\n 0.0000341 (-5) (3.41) => 5\n */\n\n // Let's scale it back\n var unitPerTickCorrect = closest * Math.pow(10, decimals);\n\n /*\n Example:\n 13'453 (4) (1.345) (1) => 10'000\n 0.0000341 (-5) (3.41) (5) => 0.00005\n */\n break;\n }\n }\n\n var nbTicks = valrange / unitPerTickCorrect;\n\n var pxPerTick = px / nbTick;\n return [unitPerTickCorrect, nbTicks, pxPerTick];\n }\n\n /**\n * Resets the min and max of the serie to fit the series it contains\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setMinMaxToFitSeries(noNotify) {\n\n var interval = this.getInterval();\n\n if (this.options.logScale) {\n\n this.currentAxisMin = Math.max(1e-50, this.getMinValue() * 0.9);\n this.currentAxisMax = Math.max(1e-50, this.getMaxValue() * 1.1);\n } else {\n\n this.currentAxisMin = this.getMinValue();\n this.currentAxisMax = this.getMaxValue();\n\n if (this.getForcedMin() === false) {\n this.currentAxisMin -= this.options.axisDataSpacing.min * interval;\n }\n\n if (this.getForcedMax() === false) {\n this.currentAxisMax += this.options.axisDataSpacing.max * interval;\n }\n }\n\n if (isNaN(this.currentAxisMin) || isNaN(this.currentAxisMax)) {\n this.currentAxisMax = undefined;\n this.currentAxisMin = undefined;\n }\n\n this.cache();\n\n this._zoomed = false;\n\n this.adapt();\n\n if (!noNotify) {\n this.graph._axisHasChanged(this);\n }\n\n this.emit('zoomOutFull', [this.currentAxisMin, this.currentAxisMax, this]);\n\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Number} the maximum interval ( max - min ) of the axis ( not nessarily the current one )\n */\n getInterval() {\n return this.getMaxValue() - this.getMinValue();\n }\n\n /**\n * @memberof Axis\n * @return {Number} the maximum interval ( max - min ) of the axis ( not nessarily the current one )\n */\n getCurrentInterval() {\n return this.cachedInterval;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The current minimum value of the axis\n */\n getCurrentMin() {\n return this.cachedCurrentMin;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The current maximum value of the axis\n */\n getCurrentMax() {\n return this.cachedCurrentMax;\n }\n\n /**\n * Caches the current axis minimum\n * @memberof Axis\n */\n cacheCurrentMin() {\n this.cachedCurrentMin = this.currentAxisMin == this.currentAxisMax ? this.options.logScale ? this.currentAxisMin / 10 : this.currentAxisMin - 1 : this.currentAxisMin;\n }\n\n /**\n * Caches the current axis maximum\n * @memberof Axis\n */\n cacheCurrentMax() {\n this.cachedCurrentMax = this.currentAxisMax == this.currentAxisMin ? this.options.logScale ? this.currentAxisMax * 10 : this.currentAxisMax + 1 : this.currentAxisMax;\n }\n\n /**\n * Caches the current interval\n * @memberof Axis\n */\n cacheInterval() {\n this.cachedInterval = this.cachedCurrentMax - this.cachedCurrentMin;\n }\n\n cache() {\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n }\n\n /**\n * Sets the current minimum value of the axis. If lower that the forced value, the forced value is used\n * @memberof Axis\n * @param {Number} val - The new minimum value\n * @return {Axis} The current axis\n */\n setCurrentMin(val) {\n\n if (val === undefined || this.getForcedMin() !== false && (val < this.getForcedMin() || val === undefined)) {\n val = this.getMinValue();\n }\n this.currentAxisMin = val;\n if (this.options.logScale) {\n this.currentAxisMin = Math.max(1e-50, val);\n }\n\n this.cacheCurrentMin();\n this.cacheInterval();\n\n this.graph._axisHasChanged(this);\n return this;\n }\n\n /**\n * Sets the current maximum value of the axis. If higher that the forced value, the forced value is used\n * @memberof Axis\n * @param {Number} val - The new maximum value\n * @return {Axis} The current axis\n */\n setCurrentMax(val) {\n\n if (val === undefined || this.getForcedMax() !== false && (val > this.getForcedMax() || val === undefined)) {\n val = this.getMaxValue();\n }\n\n this.currentAxisMax = val;\n\n if (this.options.logScale) {\n this.currentAxisMax = Math.max(1e-50, val);\n }\n\n this.cacheCurrentMax();\n this.cacheInterval();\n\n this.graph._axisHasChanged(this);\n }\n\n /**\n * Sets the flipping state of the axis. If enabled, the axis is descending rather than ascending.\n * @memberof Axis\n * @param {Boolean} flip - The new flipping state of the axis\n * @return {Axis} The current axis\n */\n flip(flip) {\n this.options.flipped = flip;\n this.setMinMaxFlipped();\n return this;\n }\n /*\n setMinMaxFlipped() {\n var interval = this.maxPx - this.minPx;\n var maxPx = this.maxPx - interval * this.options.span[ 0 ];\n var minPx = this.maxPx - interval * this.options.span[ 1 ];\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n // this.minPx = minPx;\n //this.maxPx = maxPx;\n }\n */\n /**\n * @memberof Axis\n * @return {Boolean} The current flipping state of the axis\n */\n isFlipped() {\n return this.options.flipped;\n }\n\n _draw() {\n // Redrawing of the axis\n\n var self = this;\n // var visible;\n\n // this.drawInit();\n\n if (this.currentAxisMin === undefined || this.currentAxisMax === undefined) {\n this.setMinMaxToFitSeries(true); // We reset the min max as a function of the series\n }\n\n // this.cache();\n\n // this.setSlaveAxesBoundaries();\n\n // The data min max is stored in this.dataMin, this.dataMax\n\n //var widthPx = this.maxPx - this.minPx;\n var widthPx = Math.abs(this.getMaxPx() - this.getMinPx());\n var valrange = this.getCurrentInterval();\n\n /* Number of px per unit */\n /* Example: width: 1000px\n /* \t\t\t10 - 100 => 11.11\n /*\t\t\t0 - 2 => 500\n /*\t\t\t0 - 0.00005 => 20'000'000\n */\n\n if (!this.isShown()) {\n this.line.setAttribute('display', 'none');\n return 0;\n }\n\n this.line.setAttribute('display', 'block');\n\n if (this.options.scientificScale == true) {\n\n if (this.options.scientificScaleExponent) {\n\n this.scientificExponent = this.options.scientificScaleExponent;\n } else {\n this.scientificExponent = Math.floor(Math.log(Math.max(Math.abs(this.getCurrentMax()), Math.abs(this.getCurrentMin()))) / Math.log(10));\n }\n } else {\n this.scientificExponent = 0;\n }\n\n /************************************/\n /*** DRAWING LABEL ******************/\n /************************************/\n\n this.gridLinePath.primary = '';\n this.gridLinePath.secondary = '';\n\n /*\n var label;\n if ( label = this.getLabel() ) {\n // Sets the label\n this.labelTspan.textContent = label;\n }\n */\n let letter;\n if (!this.options.useKatexForLabel || !this.graph.hasKatexRenderer()) {\n\n if (this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && (this.scientificExponent = this.getEngineeringExponent(this.scientificExponent)) && (letter = this.getExponentGreekLetter(this.scientificExponent))) {\n\n this.preunit = letter;\n this.unitTspan.setAttribute('dx', 0);\n } else if (this.scientificExponent !== 0 && !isNaN(this.scientificExponent)) {\n\n if (this.options.engineeringScale) {\n this.scientificExponent = this.getEngineeringExponent(this.scientificExponent);\n }\n\n this.preunit = '';\n\n this.expTspan.setAttribute('display', 'visible');\n this.expTspanExp.setAttribute('display', 'visible');\n\n this.expTspan.textContent = 'x10';\n this.expTspanExp.textContent = this.scientificExponent;\n } else {\n\n if (!this.options.unit) {\n this.unitTspan.setAttribute('display', 'none');\n }\n\n this.preunit = '';\n this.expTspan.setAttribute('display', 'none');\n this.expTspanExp.setAttribute('display', 'none');\n }\n\n this.writeUnit();\n } else {\n\n let string = this.getLabel();\n /*,\n domEl;*/\n\n if (this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && (this.scientificExponent = this.getEngineeringExponent(this.scientificExponent)) && (letter = this.getExponentGreekLetter(this.scientificExponent))) {\n\n string += letter;\n this.preunitTspan.innerHTML = letter;\n this.preunitTspan.setAttribute('display', 'visible');\n this.unitTspan.setAttribute('dx', 0);\n\n string += ' ' + letter + ' ' + this.options.unit;\n } else if (this.scientificExponent !== 0 && !isNaN(this.scientificExponent)) {\n\n if (this.options.engineeringScale) {\n this.scientificExponent = this.getEngineeringExponent(this.scientificExponent);\n }\n string += ' \\\\cdot 10^' + this.scientificExponent + ' ' + this.options.unit;\n }\n\n this.katexElement = this.graph.renderWithKatex(string, this.katexElement);\n }\n\n if (!this.options.hideTicks) {\n\n this.resetTicksLength();\n\n if (this.linkedToAxis) {\n // px defined, linked to another axis\n\n this.linkedToAxis.deltaPx = 10;\n var widthHeight = this.drawLinkedToAxisTicksWrapper(widthPx, valrange);\n } else if (!this.options.logScale) {\n // So the setting is: How many ticks in total ? Then we have to separate it\n\n var widthHeight = this.drawLinearTicksWrapper(widthPx, valrange);\n } else {\n\n var widthHeight = this.drawLogTicks();\n }\n } else {\n var widthHeight = 0;\n }\n\n this.removeUselessTicks();\n this.removeUselessTickLabels();\n\n this.gridPrimary.setAttribute('d', this.gridLinePath.primary);\n this.gridSecondary.setAttribute('d', this.gridLinePath.secondary);\n\n // Looks for axes linked to this current axis\n var axes = this.graph.findAxesLinkedTo(this);\n axes.forEach(function (axis) {\n\n if (!axis.linkedToAxis) {\n return;\n }\n axis.setMinPx(self.getMinPx());\n axis.setMaxPx(self.getMaxPx());\n\n axis.draw();\n });\n\n /************************************/\n /*** DRAW CHILDREN IMPL SPECIFIC ****/\n /************************************/\n\n // this.drawSpecifics();\n\n return widthHeight;\n }\n\n drawLines() {\n\n if (this.options.lineAt && Array.isArray(this.options.lineAt)) {\n\n this.options.lineAt.forEach((val, index) => {\n\n if (!isNaN(val) && this.getCurrentMin() <= val && this.getCurrentMax() >= val) {\n\n this._lines[index] = this._drawLine(val, this._lines[index]);\n } else {\n this._hideLine(this._lines[index]);\n }\n });\n }\n }\n\n writeUnit() {\n if (this.options.unit) {\n\n this.unitTspan.setAttribute('display', 'visible');\n this.unitTspan.setAttribute('dx', 5);\n\n this.expTspan.setAttribute('display', 'none');\n this.expTspanExp.setAttribute('display', 'none');\n this.unitTspan.innerHTML = (this.options.unitWrapperBefore + this.preunit + this.options.unit + this.options.unitWrapperAfter).replace(/\\^([-+0-9]*)(.*)/g, \"$1$2\");\n } else {\n this.unitTspan.setAttribute('display', 'none');\n }\n }\n\n getExponentGreekLetter(val) {\n\n switch (val) {\n\n case 3:\n {\n return 'k';\n }\n\n case 6:\n {\n return 'M';\n }\n case 9:\n {\n return 'G';\n }\n case 12:\n {\n return 'T';\n }\n case 15:\n {\n return 'E';\n }\n case -3:\n {\n return 'm';\n }\n case -6:\n {\n return 'μ';\n }\n case -9:\n {\n return 'n';\n }\n case -12:\n {\n return 'p';\n }\n case -15:\n {\n return 'f';\n }\n default:\n {\n return '';\n }\n }\n }\n\n drawLinearTicksWrapper(widthPx, valrange) {\n\n let tickPrimaryUnit;\n\n if (this.options.primaryTickUnit) {\n\n tickPrimaryUnit = this.options.primaryTickUnit;\n } else {\n\n tickPrimaryUnit = this.getUnitPerTick(widthPx, this.getNbTicksPrimary(), valrange)[0];\n\n if (this.options.maxPrimaryTickUnit && this.options.maxPrimaryTickUnit < tickPrimaryUnit) {\n tickPrimaryUnit = this.options.maxPrimaryTickUnit;\n } else if (this.options.minPrimaryTickUnit && this.options.minPrimaryTickUnit > tickPrimaryUnit) {\n tickPrimaryUnit = this.options.minPrimaryTickUnit;\n }\n }\n\n // We need to get here the width of the ticks to display the axis properly, with the correct shift\n return this.drawTicks(tickPrimaryUnit, this.secondaryTicks());\n }\n\n forcePrimaryTickUnit(primaryInterval) {\n this.options.primaryTickUnit = primaryInterval;\n }\n\n forcePrimaryTickUnitMax(value) {\n this.options.maxPrimaryTickUnit = value;\n }\n\n forcePrimaryTickUnitMin(value) {\n this.options.minPrimaryTickUnit = value;\n }\n\n getPrimaryTickUnit() {\n return this.incrTick;\n }\n\n setTickLabelRatio(tickRatio) {\n this.options.ticklabelratio = tickRatio;\n }\n\n doesHideWhenNoSeriesShown() {\n return this.options.hideWhenNoSeriesShown;\n }\n\n draw() {\n\n this._widthLabels = 0;\n var drawn = this._draw();\n this._widthLabels += drawn;\n return drawn;\n }\n\n drawTicks(primary, secondary) {\n\n var unitPerTick = primary,\n min = this.getCurrentMin(),\n max = this.getCurrentMax(),\n secondaryIncr,\n incrTick,\n subIncrTick,\n loop = 0;\n\n if (secondary) {\n secondaryIncr = unitPerTick / secondary;\n }\n\n incrTick = this.options.shiftToZero ? this.dataMin - Math.ceil((this.dataMin - min) / unitPerTick) * unitPerTick : Math.floor(min / unitPerTick) * unitPerTick;\n this.incrTick = primary;\n\n while (incrTick <= max) {\n\n loop++;\n if (loop > 200) {\n break;\n }\n\n if (secondary) {\n\n subIncrTick = incrTick + secondaryIncr;\n this.subIncrTick = subIncrTick;\n //widthHeight = Math.max(widthHeight, this.drawTick(subIncrTick, 1));\n var loop2 = 0;\n\n while (subIncrTick < incrTick + unitPerTick) {\n loop2++;\n if (loop2 > 100) {\n break;\n }\n\n if (subIncrTick < min || subIncrTick > max) {\n subIncrTick += secondaryIncr;\n continue;\n }\n\n this.drawTickWrapper(subIncrTick, false, Math.abs(subIncrTick - incrTick - unitPerTick / 2) < 1e-4 ? 2 : 3);\n\n subIncrTick += secondaryIncr;\n }\n }\n\n if (incrTick < min || incrTick > max) {\n incrTick += primary;\n continue;\n }\n\n this.drawTickWrapper(incrTick, true, 1);\n incrTick += primary;\n }\n\n this.widthHeightTick = this.getMaxSizeTick();\n return this.widthHeightTick;\n }\n\n nextTick(level, callback) {\n\n this.ticks[level] = this.ticks[level] || [];\n this.lastCurrentTick[level] = this.lastCurrentTick[level] || 0;\n this.currentTick[level] = this.currentTick[level] || 0;\n\n if (this.currentTick[level] >= this.ticks[level].length) {\n var tick = document.createElementNS(this.graph.ns, 'line');\n this.groupTicks.appendChild(tick);\n this.ticks[level].push(tick);\n\n callback(tick);\n }\n\n var tick = this.ticks[level][this.currentTick[level]];\n\n if (this.currentTick[level] >= this.lastCurrentTick[level]) {\n tick.setAttribute('display', 'visible');\n }\n\n this.currentTick[level]++;\n\n return tick;\n }\n\n nextTickLabel(callback) {\n\n this.ticksLabels = this.ticksLabels || [];\n this.lastCurrentTickLabel = this.lastCurrentTickLabel || 0;\n this.currentTickLabel = this.currentTickLabel || 0;\n\n if (this.currentTickLabel >= this.ticksLabels.length) {\n\n var tickLabel = document.createElementNS(this.graph.ns, 'text');\n this.groupTickLabels.appendChild(tickLabel);\n this.ticksLabels.push(tickLabel);\n callback(tickLabel);\n }\n\n var tickLabel = this.ticksLabels[this.currentTickLabel];\n\n if (this.currentTickLabel >= this.lastCurrentTickLabel) {\n tickLabel.setAttribute('display', 'visible');\n }\n\n this.currentTickLabel++;\n\n return tickLabel;\n }\n\n removeUselessTicks() {\n\n for (var j in this.currentTick) {\n\n for (var i = this.currentTick[j]; i < this.ticks[j].length; i++) {\n this.ticks[j][i].setAttribute('display', 'none');\n }\n\n this.lastCurrentTick[j] = this.currentTick[j];\n this.currentTick[j] = 0;\n }\n }\n\n removeUselessTickLabels() {\n\n for (var i = this.currentTickLabel; i < this.ticksLabels.length; i++) {\n this.ticksLabels[i].setAttribute('display', 'none');\n }\n\n this.lastCurrentTickLabel = this.currentTickLabel;\n this.currentTickLabel = 0;\n }\n /*\n doGridLine() {\n var gridLine = document.createElementNS( this.graph.ns, 'line' );\n this.groupGrids.appendChild( gridLine );\n return gridLine;\n };*/\n\n nextGridLine(primary, x1, x2, y1, y2) {\n\n if (!(primary && this.options.primaryGrid || !primary && this.options.secondaryGrid)) {\n return;\n }\n\n this.gridLinePath[primary ? 'primary' : 'secondary'] += 'M ' + x1 + ' ' + y1 + ' L ' + x2 + ' ' + y2;\n }\n\n setGridLineStyle(gridLine, primary) {\n\n gridLine.setAttribute('shape-rendering', 'crispEdges');\n gridLine.setAttribute('stroke', primary ? this.getPrimaryGridColor() : this.getSecondaryGridColor());\n gridLine.setAttribute('stroke-width', primary ? this.getPrimaryGridWidth() : this.getSecondaryGridWidth());\n gridLine.setAttribute('stroke-opacity', primary ? this.getPrimaryGridOpacity() : this.getSecondaryGridOpacity());\n\n var dasharray;\n if (dasharray = primary ? this.getPrimaryGridDasharray() : this.getSecondaryGridDasharray()) {\n gridLine.setAttribute('stroke-dasharray', dasharray);\n }\n }\n\n setGridLinesStyle() {\n this.setGridLineStyle(this.gridPrimary, true);\n this.setGridLineStyle(this.gridSecondary, false);\n return this;\n }\n\n resetTicksLength() {}\n\n secondaryTicks() {\n return this.options.nbTicksSecondary;\n }\n\n drawLogTicks() {\n var min = this.getCurrentMin(),\n max = this.getCurrentMax();\n var incr = Math.min(min, max);\n var max = Math.max(min, max);\n\n if (incr < 1e-50) {\n incr = 1e-50;\n }\n\n if (Math.log(incr) - Math.log(max) > 20) {\n max = Math.pow(10, Math.log(incr) * 20);\n }\n\n var optsMain = {\n fontSize: '1.0em',\n exponential: true,\n overwrite: false\n };\n\n if (incr < 0) {\n incr = 0;\n }\n\n var pow = incr == 0 ? 0 : Math.floor(Math.log(incr) / Math.log(10));\n var incr = 1,\n val;\n while ((val = incr * Math.pow(10, pow)) < max) {\n if (incr == 1) {\n // Superior power\n if (val > min) this.drawTickWrapper(val, true, 1, optsMain);\n }\n if (incr == 10) {\n incr = 1;\n pow++;\n } else {\n\n if (incr != 1 && val > min) {\n\n this.drawTickWrapper(val, false, 2, {\n overwrite: '',\n fontSize: '0.6em'\n });\n }\n\n incr++;\n }\n }\n\n this.widthHeightTick = this.getMaxSizeTick();\n return this.widthHeightTick;\n }\n\n drawTickWrapper(value, label, level, options) {\n\n //var pos = this.getPos( value );\n\n this.drawTick(value, level, options);\n }\n\n /**\n * Used to scale the master axis into the slave axis\n * @function SlaveAxisScalingFunction\n * @param {Number} val - The master value to convert into a slave value\n * @returns undefined\n */\n\n /**\n * Makes this axis a slave. This can be used to show the same data with different units, specifically when a conversion function exists from axis -> slaveAxis but not in reverse. This axis should actually have no series.\n * @param {Axis} axis - The master axis\n * @param {SlaveAxisScalingFunction} scalingFunction - The scaling function used to map masterValue -> slaveValue\n * @param {Number} decimals - The number of decimals to round the value to\n * @memberof Axis\n * @return {Number} The width or height used by the axis (used internally)\n */\n linkToAxis(axis, scalingFunction, decimals) {\n\n this.linkedToAxis = {\n axis: axis,\n scalingFunction: scalingFunction,\n decimals: decimals || 1\n };\n }\n\n drawLinkedToAxisTicksWrapper(widthPx, valrange) {\n\n var opts = this.linkedToAxis,\n px = 0,\n val,\n t,\n l,\n delta2;\n\n // Redrawing the main axis ? Why ?\n //opts.axis.draw();\n\n if (!opts.deltaPx) {\n opts.deltaPx = 10;\n }\n\n do {\n\n val = opts.scalingFunction(opts.axis.getVal(px + this.getMinPx()));\n\n if (opts.decimals) {\n this.decimals = opts.decimals;\n }\n\n t = this.drawTick(val, 1, {}, px + this.getMinPx());\n\n if (!t) {\n console.error(val, px, this.getMinPx());\n throw new Error('Unable to draw tick. Please report the test-case');\n }\n\n l = String(t[1].textContent).length * 8;\n delta2 = Math.round(l / 5) * 5;\n\n if (delta2 > opts.deltaPx) {\n opts.deltaPx = delta2;\n // this.drawInit();\n this.drawLinkedToAxisTicksWrapper(widthPx, valrange);\n return;\n }\n\n px += opts.deltaPx;\n } while (px < widthPx);\n }\n\n /**\n * Transform a value into pixels, according to the axis scaling. The value is referenced to the drawing wrapper, not the the axis minimal value\n * @param {Number} value - The value to translate into pixels\n * @memberof Axis\n * @return {Number} The value transformed into pixels\n */\n getPos(value) {\n return this.getPx(value);\n }\n\n /**\n * @alias Axis~getPos\n */\n getPx(value) {\n // if(this.getMaxPx() == undefined)\n // console.log(this);\n //console.log(this.getMaxPx(), this.getMinPx(), this.getCurrentInterval());\n // Ex 50 / (100) * (1000 - 700) + 700\n\n //console.log( value, this.getCurrentMin(), this.getMaxPx(), this.getMinPx(), this.getCurrentInterval() );\n\n if (!this.options.logScale) {\n\n return (value - this.getCurrentMin()) / this.getCurrentInterval() * (this.getMaxPx() - this.getMinPx()) + this.getMinPx();\n } else {\n // 0 if value = min\n // 1 if value = max\n\n if (value < 0) return;\n\n var value = (Math.log(value) - Math.log(this.getCurrentMin())) / (Math.log(this.getCurrentMax()) - Math.log(this.getCurrentMin())) * (this.getMaxPx() - this.getMinPx()) + this.getMinPx();\n\n return value;\n }\n }\n\n /**\n * @alias Axis~getPos\n */\n getRoundedPx(value) {\n // if(this.getMaxPx() == undefined)\n // console.log(this);\n //console.log(this.getMaxPx(), this.getMinPx(), this.getCurrentInterval());\n // Ex 50 / (100) * (1000 - 700) + 700\n\n //console.log( value, this.getCurrentMin(), this.getMaxPx(), this.getMinPx(), this.getCurrentInterval() );\n return Math.round(this.getPx(value) * 10) / 10;\n }\n\n /**\n * Transform a pixel position (referenced to the graph zone, not to the axis minimum) into a value, according to the axis scaling.\n * @param {Number} pixels - The number of pixels to translate into a value\n * @memberof Axis\n * @return {Number} The axis value corresponding to the pixel position\n */\n getVal(px) {\n\n if (!this.options.logScale) {\n\n return (px - this.getMinPx()) / (this.getMaxPx() - this.getMinPx()) * this.getCurrentInterval() + this.getCurrentMin();\n } else {\n\n return Math.exp((px - this.getMinPx()) / (this.getMaxPx() - this.getMinPx()) * (Math.log(this.getCurrentMax()) - Math.log(this.getCurrentMin())) + Math.log(this.getCurrentMin()));\n }\n }\n\n /**\n * Transform a delta value into pixels\n * @param {Number} value - The value to translate into pixels\n * @return {Number} The value transformed into pixels\n * @example graph.getBottomAxis().forceMin( 20 ).forceMax( 50 ).getRelPx( 2 ); // Returns how many pixels will be covered by 2 units. Let's assume 600px of width, it's ( 2 / 30 ) * 600 = 40px\n */\n getRelPx(delta) {\n\n return delta / this.getCurrentInterval() * (this.getMaxPx() - this.getMinPx());\n }\n\n /**\n * Transform a delta pixels value into value\n * @param {Number} pixels - The pixel to convert into a value\n * @return {Number} The delta value corresponding to delta pixels\n * @see Axis~getRelPx\n * @example graph.getBottomAxis().forceMin( 20 ).forceMax( 50 ).getRelVal( 40 ); // Returns 2 (for 600px width)\n */\n getRelVal(px) {\n return px / (this.getMaxPx() - this.getMinPx()) * this.getCurrentInterval();\n }\n\n valueToText(value) {\n\n if (this.scientificExponent) {\n\n value /= Math.pow(10, this.scientificExponent);\n return value.toFixed(1);\n } else {\n\n value = value * Math.pow(10, this.getExponentialFactor()) * Math.pow(10, this.getExponentialLabelFactor());\n if (this.options.shiftToZero) {\n value -= this.dataMin;\n }\n if (this.options.ticklabelratio) {\n value *= this.options.ticklabelratio;\n }\n if (this.options.unitModification) {\n value = this.modifyUnit(value, this.options.unitModification);\n return value;\n }\n\n var dec = this.decimals - this.getExponentialFactor() - this.getExponentialLabelFactor();\n\n if (isNaN(value)) {\n return '';\n }\n\n if (dec > 0) {\n value = value.toFixed(dec);\n } else {\n value = value.toFixed(0);\n }\n\n if (this.options.unitInTicks && this.options.unit) {\n value += ' ' + this.options.unit;\n }\n\n return value;\n }\n }\n\n /**\n * Computes a value and returns it in HTML formatting\n * @memberof Axis\n * @param {Number} value - The value to compute\n * @param {Boolean} noScaling - Does not display scaling\n * @param {Boolean} noUnits - Does not display units\n * @return {String} An HTML string containing the computed value\n * @example graph.getXAxis().setUnit( \"m\" ).setUnitDecade( true ).setScientific( true );\n * graph.getXAxis().valueToHtml( 3500 ); // Returns \"3.5 km\"\n * @see Axis#valueToText\n */\n valueToHtml(value, noScaling, noUnits) {\n\n var text = this.valueToText(value);\n var letter;\n\n if (this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && (this.scientificExponent = this.getEngineeringExponent(this.scientificExponent)) && (letter = this.getExponentGreekLetter(this.scientificExponent))) {\n\n text += letter;\n } else if (this.scientificExponent !== 0 && !isNaN(this.scientificExponent) && !noScaling) {\n text += 'x10';\n text += '' + this.scientificExponent + '';\n }\n\n if (this.options.unit && !noUnits) {\n\n text += this.options.unit.replace(/\\^([-+0-9]*)/g, '$1');\n }\n\n return text;\n }\n\n getModifiedValue(value) {\n if (this.options.ticklabelratio) {\n value *= this.options.ticklabelratio;\n }\n\n if (this.options.shiftToZero) {\n value -= this.getMinValue() * (this.options.ticklabelratio || 1);\n }\n\n return value;\n }\n\n modifyUnit(value, mode) {\n\n var text = '';\n var incr = this.incrTick;\n var umin;\n\n switch (mode) {\n\n case 'time':\n // val must be in seconds => transform in hours / days / months\n var max = this.getModifiedValue(this.getMaxValue()),\n units = [[60, 'min'], [3600, 'h'], [3600 * 24, 'd']];\n\n if (max < 3600) {\n // to minutes\n umin = 0;\n } else if (max < 3600 * 24) {\n umin = 1;\n } else if (max < 3600 * 24 * 30) {\n umin = 2;\n }\n\n if (!units[umin]) {\n return false;\n }\n\n value = value / units[umin][0];\n var valueRounded = Math.floor(value);\n text = valueRounded + units[umin][1];\n\n // Addind lower unit for precision\n umin--;\n while (incr < 1 * units[umin + 1][0] && umin > -1) {\n\n value = (value - valueRounded) * units[umin + 1][0] / units[umin][0];\n valueRounded = Math.round(value);\n text += ' ' + valueRounded + units[umin][1];\n umin--;\n }\n\n break;\n\n case 'time:min.sec':\n value = value / 60;\n var valueRounded = Math.floor(value);\n var s = Math.round((value - valueRounded) * 60) + '';\n s = s.length == 1 ? '0' + s : s;\n text = valueRounded + '.' + s;\n break;\n\n default:\n break;\n }\n\n return text;\n }\n\n getExponentialFactor() {\n return this.options.exponentialFactor;\n }\n\n setExponentialFactor(value) {\n this.options.exponentialFactor = value;\n }\n\n setExponentialLabelFactor(value) {\n this.options.exponentialLabelFactor = value;\n }\n\n getExponentialLabelFactor() {\n return this.options.exponentialLabelFactor;\n }\n\n /**\n * Sets the label of the axis\n * @param {Number} label - The label to display under the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setLabel(label) {\n this.options.labelValue = label;\n return this;\n }\n\n setLabelFont(font) {\n this.options.labelFont = font;\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {String} The label value\n */\n getLabel() {\n return this.options.labelValue;\n }\n\n setSpan(_from, _to) {\n\n this.options.span = [_from, _to];\n return this;\n }\n\n getSpan() {\n return this.options.span;\n }\n\n setLevel(level) {\n this._level = level;\n return this;\n }\n\n getLevel() {\n return this._level;\n }\n\n setShift(shift) {\n this.shift = shift;\n }\n\n getShift() {\n return this.shift;\n }\n\n /**\n * Changes the tick position\n * @param {Number} pos - The new position ( \"outside\", \"centered\" or \"inside\" )\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setTickPosition(pos) {\n switch (pos) {\n case 3:\n case 'outside':\n case _graphCore2.default.TICKS_OUTSIDE:\n {\n pos = 3;\n break;\n }\n\n case 2:\n case 'centered':\n case _graphCore2.default.TICKS_CENTERED:\n {\n pos = 2;\n break;\n }\n\n case 1:\n case 'inside':\n case _graphCore2.default.TICKS_INSIDE:\n default:\n {\n pos = 1;\n break;\n }\n }\n\n this.options.tickPosition = pos;\n\n switch (this.options.tickPosition) {\n case 3:\n this.tickPx1 = -2;\n this.tickPx2 = 0;\n break;\n\n case 2:\n this.tickPx1 = -1;\n this.tickPx2 = 1;\n break;\n\n default:\n case 1:\n this.tickPx1 = 0;\n this.tickPx2 = 2;\n break;\n }\n\n return this;\n }\n\n /**\n * Displays or hides the axis grids\n * @param {Boolean} on - true to enable the grids, false to disable them\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setGrids(on) {\n this.options.primaryGrid = on;\n this.options.secondaryGrid = on;\n return this;\n }\n\n /**\n * Displays or hides the axis primary grid\n * @param {Boolean} on - true to enable the grids, false to disable it\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setPrimaryGrid(on) {\n this.options.primaryGrid = on;\n return this;\n }\n\n /**\n * Displays or hides the axis secondary grid\n * @param {Boolean} on - true to enable the grids, false to disable it\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setSecondaryGrid(on) {\n this.options.secondaryGrid = on;\n return this;\n }\n\n /**\n * Enables primary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n primaryGridOn() {\n return this.setPrimaryGrid(true);\n }\n\n /**\n * Disables primary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n primaryGridOff() {\n return this.setPrimaryGrid(false);\n }\n\n /**\n * Enables secondary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n secondaryGridOn() {\n return this.setSecondaryGrid(true);\n }\n\n /**\n * Disables secondary grid\n * @return {Axis} The current axis\n */\n secondaryGridOff() {\n return this.setSecondaryGrid(false);\n }\n\n /**\n * Enables all the grids\n * @return {Axis} The current axis\n */\n gridsOn() {\n return this.setGrids(true);\n }\n\n /**\n * Disables all the grids\n * @return {Axis} The current axis\n */\n gridsOff() {\n return this.setGrids(false);\n }\n\n /**\n * @alias Axis#gridsOff\n */\n turnGridsOff() {\n return this.gridsOff(...arguments);\n }\n\n /**\n * @alias Axis#gridsOn\n */\n turnGridsOn() {\n return this.gridsOn(...arguments);\n }\n\n /**\n * Sets the axis color\n * @memberof Axis\n * @param {String} color - The color to set the axis\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setAxisColor(color) {\n this.options.axisColor = color;\n return this;\n }\n\n /**\n * Gets the axis color\n * @memberof Axis\n * @return {String} The color of the axis\n * @since 1.13.2\n */\n getAxisColor() {\n return this.options.axisColor || 'black';\n }\n\n setTickLabelOffset(offsetValue) {\n this.options.tickLabelOffset = offsetValue;\n return this;\n }\n\n /**\n * Sets the color of the main ticks\n * @memberof Axis\n * @param {String} color - The new color of the primary ticks\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setPrimaryTicksColor(color) {\n this.options.primaryTicksColor = color;\n return this;\n }\n\n /**\n * Gets the color of the main ticks\n * @memberof Axis\n * @return {String} The color of the primary ticks\n * @since 1.13.2\n */\n getPrimaryTicksColor() {\n return this.options.primaryTicksColor || 'black';\n }\n\n /**\n * Sets the color of the secondary ticks\n * @memberof Axis\n * @param {String} color - The new color of the secondary ticks\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setSecondaryTicksColor(color) {\n this.options.secondaryTicksColor = color;\n return this;\n }\n\n /**\n * Gets the color of the secondary ticks\n * @memberof Axis\n * @return {String} The color of the secondary ticks\n * @since 1.13.2\n */\n getSecondaryTicksColor() {\n return this.options.secondaryTicksColor || 'black';\n }\n\n /**\n * Sets the color of the tick labels\n * @memberof Axis\n * @param {String} color - The new color of the tick labels\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setTicksLabelColor(color) {\n this.options.ticksLabelColor = color;\n if (Array.isArray(this.ticksLabels)) {\n this.ticksLabels.forEach(tick => {\n tick.setAttribute('fill', color);\n });\n }\n return this;\n }\n\n /**\n * Gets the color of the tick labels\n * @memberof Axis\n * @return {String} The color of the tick labels\n * @since 1.13.2\n */\n getTicksLabelColor() {\n return this.options.ticksLabelColor || 'black';\n }\n\n /**\n * Sets the color of the primary grid\n * @memberof Axis\n * @param {String} color - The primary grid color\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridColor(color) {\n this.options.primaryGridColor = color;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the color of the primary grid\n * @memberof Axis\n * @return {String} color - The primary grid color\n * @since 1.13.3\n */\n getPrimaryGridColor() {\n return this.options.primaryGridColor;\n }\n\n /**\n * Sets the color of the primary grid\n * @memberof Axis\n * @param {String} color - The primary grid color\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridColor(color) {\n this.options.secondaryGridColor = color;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the color of the secondary grid\n * @memberof Axis\n * @return {String} color - The secondary grid color\n * @since 1.13.3\n */\n getSecondaryGridColor() {\n return this.options.secondaryGridColor;\n }\n\n /**\n * Sets the width of the primary grid lines\n * @memberof Axis\n * @param {Number} width - The width of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridWidth(width) {\n this.options.primaryGridWidth = width;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the width of the primary grid lines\n * @memberof Axis\n * @return {Number} width - The width of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridWidth() {\n return this.options.primaryGridWidth;\n }\n\n /**\n * Sets the width of the secondary grid lines\n * @memberof Axis\n * @param {Number} width - The width of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridWidth(width) {\n this.options.secondaryGridWidth = width;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the width of the secondary grid lines\n * @memberof Axis\n * @return {Number} width - The width of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridWidth() {\n return this.options.secondaryGridWidth;\n }\n\n /**\n * Sets the opacity of the primary grid lines\n * @memberof Axis\n * @param {Number} opacity - The opacity of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridOpacity(opacity) {\n this.options.primaryGridOpacity = opacity;\n return this;\n }\n\n /**\n * Gets the opacity of the primary grid lines\n * @memberof Axis\n * @return {Number} opacity - The opacity of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridOpacity() {\n return this.options.primaryGridOpacity;\n }\n\n /**\n * Sets the opacity of the secondary grid lines\n * @memberof Axis\n * @param {Number} opacity - The opacity of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridOpacity(opacity) {\n this.options.secondaryGridOpacity = opacity;\n return this;\n }\n\n /**\n * Gets the opacity of the secondary grid lines\n * @memberof Axis\n * @return {Number} opacity - The opacity of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridOpacity() {\n return this.options.secondaryGridOpacity;\n }\n\n /**\n * Sets the dasharray of the primary grid lines\n * @memberof Axis\n * @param {String} dasharray - The dasharray of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridDasharray(dasharray) {\n this.options.primaryGridDasharray = dasharray;\n return this;\n }\n\n /**\n * Gets the dasharray of the primary grid lines\n * @memberof Axis\n * @return {String} dasharray - The dasharray of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridDasharray() {\n return this.options.primaryGridDasharray;\n }\n\n /**\n * Sets the dasharray of the secondary grid lines\n * @memberof Axis\n * @param {String} dasharray - The dasharray of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridDasharray(dasharray) {\n this.options.secondaryGridDasharray = dasharray;\n return this;\n }\n\n /**\n * Gets the dasharray of the secondary grid lines\n * @memberof Axis\n * @return {String} dasharray - The dasharray of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridDasharray() {\n return this.options.secondaryGridDasharray;\n }\n\n /**\n * Sets the color of the label\n * @memberof Axis\n * @param {String} color - The new color of the label\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setLabelColor(color) {\n this.options.labelColor = color;\n return this;\n }\n\n /**\n * Gets the color of the label\n * @memberof Axis\n * @return {String} The color of the label\n * @since 1.13.2\n */\n getLabelColor() {\n return this.options.labelColor;\n }\n\n setTickContent(dom, val, options) {\n if (!options) options = {};\n\n if (options.overwrite || !options.exponential) {\n\n dom.textContent = options.overwrite || this.valueToText(val);\n } else {\n var log = Math.round(Math.log(val) / Math.log(10));\n var unit = Math.floor(val * Math.pow(10, -log));\n\n dom.textContent = unit != 1 ? unit + 'x10' : '10';\n var tspan = document.createElementNS(this.graph.ns, 'tspan');\n tspan.textContent = log;\n tspan.setAttribute('font-size', '0.7em');\n tspan.setAttribute('dy', -5);\n dom.appendChild(tspan);\n }\n\n if (options.fontSize) {\n dom.setAttribute('font-size', options.fontSize);\n }\n }\n\n /**\n * @memberof Axis\n * @returns {Boolean} true if it is an x axis, false otherwise\n */\n isX() {\n return false;\n }\n\n /**\n * @memberof Axis\n * @returns {Boolean} true if it is an y axis, false otherwise\n */\n isY() {\n return false;\n }\n\n /**\n * Sets the unit of the axis\n * @param {String} unit - The unit of the axis\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setUnit(unit) {\n this.options.unit = unit;\n return this;\n }\n\n /**\n * Places the unit in every tick\n * @param {Boolean} bool - ```true``` to place the unit, ```false``` otherwise\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 2.0.44\n */\n setUnitInTicks(bool) {\n this.options.unitInTicks = bool;\n return this;\n }\n\n /**\n * Sets characters wrapping the unit\n * @param {String} before - The string to insert before\n * @param {String} after - The string to insert after\n * @return {Axis} The current axis\n * @memberof Axis\n * @example axis.setUnitWrapper(\"[\", \"]\").setUnit('m'); // Will display [m]\n * @since 1.13.3\n */\n setUnitWrapper(before, after) {\n this.options.unitWrapperBefore = before;\n this.options.unitWrapperAfter = after;\n return this;\n }\n\n /**\n * Allows the unit to scale with thousands\n * @param {Boolean} on - Enables this mode\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setUnitDecade(on) {\n this.options.unitDecade = on;\n return this;\n }\n\n /**\n * Enable the scientific mode for the axis values. This way, big numbers can be avoided, e.g. \"1000000000\" would be displayed 1 with 109 or \"G\" shown on near the axis unit.\n * @param {Boolean} on - Enables the scientific mode\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setScientific(on) {\n this.options.scientificScale = on;\n return this;\n }\n\n /**\n * In the scientific mode, forces the axis to take a specific power of ten. Useful if you want to show kilometers instead of meters for example. In this case you would use \"3\" as a value.\n * @param {Number} scientificScaleExponent - Forces the scientific scale to take a defined power of ten\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n * @see Axis#setScientific\n */\n setScientificScaleExponent(scientificScaleExponent) {\n this.options.scientificScaleExponent = scientificScaleExponent;\n return this;\n }\n\n /**\n * The engineer scaling is similar to the scientific scaling ({@link Axis#setScientificScale}) but allowing only mupltiples of 3 to be used to scale the axis (for instance, go from grams to kilograms while skipping decagrams and hexagrams)\n * @param {Boolean} engineeringScaling - true to turn on the engineering scaling\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n * @see Axis#setScientific\n */\n setEngineering(engineeringScaling) {\n //bool\n this.options.scientificScale = engineeringScaling;\n this.options.engineeringScale = engineeringScaling;\n return this;\n }\n\n /**\n * Calculates the closest engineering exponent from a scientific exponent\n * @param {Number} scientificExponent - The exponent of 10 based on which the axis will be scaled\n * @return {Number} The appropriate engineering exponent\n * @memberof Axis\n * @since 1.13.3\n * @private\n */\n getEngineeringExponent(scientificExponent) {\n\n if (scientificExponent > 0) {\n scientificExponent -= scientificExponent % 3;\n } else {\n scientificExponent -= (3 - -scientificExponent % 3) % 3;\n }\n\n return scientificExponent;\n }\n\n /**\n * Enables log scaling\n * @param {Boolean} logScale - ```true``` to enable the log scaling, ```false``` to disable it\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setLogScale(log) {\n this.options.logScale = log;\n return this;\n }\n\n isZoomed() {\n return !(this.currentAxisMin == this.getMinValue() || this.currentAxisMax == this.getMaxValue());\n }\n\n hasAxis() {\n return false;\n }\n\n getType() {\n return null;\n }\n\n useKatexForLabel(use = true) {\n this.options.useKatexForLabel = use;\n return this;\n }\n\n }\n\n /**\n * @alias Axis#getVal\n */\n Axis.prototype.getValue = Axis.prototype.getVal;\n\n /**\n * @alias Axis#getRelPx\n */\n Axis.prototype.getDeltaPx = Axis.prototype.getRelPx;\n\n exports.default = Axis;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil);\n global.graphMixinErrorbars = mod.exports;\n }\n})(this, function (module, exports, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n var ErrorBarMixin = {\n /*\n doErrorDraw: function( orientation, error, originVal, originPx, xpx, ypx ) {\n if ( !( error instanceof Array ) ) {\n error = [ error ];\n }\n var functionName = orientation == 'y' ? 'getY' : 'getX';\n var bars = orientation == 'y' ? [ 'top', 'bottom' ] : [ 'left', 'right' ];\n var j;\n if ( isNaN( xpx ) || isNaN( ypx ) ) {\n return;\n }\n for ( var i = 0, l = error.length; i < l; i++ ) {\n if ( error[ i ] instanceof Array ) { // TOP\n j = bars[ 0 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal + error[ i ][ 0 ] ), originPx, j );\n j = bars[ 1 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal - error[ i ][ 1 ] ), originPx, j );\n } else {\n j = bars[ 0 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal + error[ i ] ), originPx, j );\n j = bars[ 1 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal - error[ i ] ), originPx, j );\n }\n }\n },\n */\n\n /*\n makeError: function( orientation, type, coord, origin, quadOrientation ) {\n var method;\n switch ( this.errorstyles[ level ].type ) {\n case 'bar':\n method = \"makeBar\";\n break;\n case 'box':\n method = \"makeBox\";\n break;\n }\n return this[ method + orientation.toUpperCase() ]( coord, origin, this.errorstyles[ level ][ quadOrientation ] );\n },*/\n\n makeBarY: function (coordY, origin, style) {\n if (!coordY || style === undefined) {\n return;\n }\n var width = !util.isNumeric(style.width) ? 10 : style.width;\n return ' V ' + coordY + ' m -' + width / 2 + ' 0 h ' + width + ' m -' + width / 2 + ' 0 V ' + origin + ' ';\n },\n\n makeBoxY: function (coordY, origin, style) {\n if (!coordY || style === undefined) {\n return;\n }\n return ' m 5 0 V ' + coordY + ' h -10 V ' + origin + ' m 5 0 ';\n },\n\n makeBarX: function (coordX, origin, style) {\n if (!coordX || style === undefined) {\n return;\n }\n var height = !util.isNumeric(style.width) ? 10 : style.width;\n return ' H ' + coordX + ' m 0 -' + height / 2 + ' v ' + height + ' m 0 -' + height / 2 + ' H ' + origin + ' ';\n },\n\n makeBoxX: function (coordX, origin, style) {\n if (!coordX || style === undefined) {\n return;\n }\n return ' v 5 H ' + coordX + ' v -10 H ' + origin + ' v 5 ';\n },\n /*\n check: function( index, valY, valX ) {\n var dx, dy;\n if ( ( this.getType() == Graph.SERIE_LINE || this.getType() == Graph.SERIE_SCATTER ) ) {\n if ( !( dx = this.data[ index * 2 ] ) || !( dy = this.data[ index * 2 + 1 ] ) ) { //\n return;\n }\n }\n if ( dx === undefined ) {\n return;\n }\n for ( var i = 0, l = valY.length; i < l; i++ ) {\n if ( Array.isArray( valY[ i ] ) ) {\n if ( !isNaN( valY[ i ][ 0 ] ) ) {\n this._checkY( dy + valY[ i ][ 0 ] );\n }\n if ( !isNaN( valY[ i ][ 1 ] ) ) {\n this._checkY( dy - valY[ i ][ 1 ] );\n }\n } else {\n if ( !isNaN( valY[ i ] ) ) {\n this._checkY( dy + valY[ i ] );\n this._checkY( dy - valY[ i ] );\n }\n }\n }\n for ( var i = 0, l = valX.length; i < l; i++ ) {\n if ( Array.isArray( valX[ i ] ) ) {\n if ( !isNaN( valX[ i ][ 0 ] ) ) {\n this._checkX( dx - valX[ i ][ 0 ] );\n }\n if ( !isNaN( valX[ i ][ 1 ] ) ) {\n this._checkX( dx + valX[ i ][ 1 ] );\n }\n } else {\n if ( !isNaN( valY[ i ] ) ) {\n this._checkX( dx - valX[ i ] );\n this._checkX( dx + valX[ i ] );\n }\n }\n }\n },\n */\n\n /**\n *\n * @example serie.setErrorStyle( [ { type: 'bar', x: {} }, { type: 'box', top: { strokeColor: 'green', fillColor: 'olive' }, bottom: { strokeColor: 'red', fillColor: \"#800000\" } } ] );\n */\n setErrorBarStyle: function (errorstyle) {\n\n this.errorbarStyle = this._setErrorStyle(errorstyle);\n return this;\n },\n\n setErrorBoxStyle: function (errorstyle) {\n\n this.errorboxStyle = this._setErrorStyle(errorstyle);\n return this;\n },\n\n _setErrorStyle(errorstyles = {}) {\n\n var styles = [];\n var pairs = [['y', 'top', 'bottom'], ['x', 'left', 'right']];\n\n var makePath = style => {\n\n style.dom = document.createElementNS(this.graph.ns, 'path');\n style.dom.setAttribute('fill', style.fillColor || 'none');\n style.dom.setAttribute('stroke', style.strokeColor || 'black');\n style.dom.setAttribute('stroke-opacity', style.strokeOpacity || 1);\n style.dom.setAttribute('fill-opacity', style.fillOpacity || 1);\n style.dom.setAttribute('stroke-width', style.strokeWidth || 1);\n\n this.groupMain.appendChild(style.dom);\n };\n // i is bar or box\n\n var styles = {};\n\n if (typeof errorstyles == 'string') {\n errorstyles = {};\n }\n\n for (var j = 0, l = pairs.length; j < l; j++) {\n\n if (errorstyles.all) {\n\n errorstyles[pairs[j][1]] = util.extend(true, {}, errorstyles.all);\n errorstyles[pairs[j][2]] = util.extend(true, {}, errorstyles.all);\n }\n\n if (errorstyles[pairs[j][0]]) {\n //.x, .y\n\n errorstyles[pairs[j][1]] = util.extend(true, {}, errorstyles[pairs[j][0]]);\n errorstyles[pairs[j][2]] = util.extend(true, {}, errorstyles[pairs[j][0]]);\n }\n\n for (var k = 1; k <= 2; k++) {\n\n if (errorstyles[pairs[j][k]]) {\n\n styles[pairs[j][k]] = errorstyles[pairs[j][k]];\n makePath(styles[pairs[j][k]]);\n }\n }\n }\n\n return styles;\n },\n\n errorDrawInit: function () {\n var error;\n // var pathError = \"M 0 0 \";\n\n if (this.errorboxStyle) {\n\n this.errorboxStyle.paths = {\n top: '',\n bottom: '',\n left: '',\n right: ''\n };\n }\n\n if (this.errorbarStyle) {\n\n this.errorbarStyle.paths = {\n top: '',\n bottom: '',\n left: '',\n right: ''\n };\n }\n },\n\n errorAddPoint: function (index, dataX, dataY, xpx, ypx) {\n\n /* eslint-disable no-cond-assign */\n let error;\n if (error = this.waveform.getErrorBarXBelow(index)) {\n this.errorbarStyle.paths.left += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.left += this.makeBarX(this.getX(dataX - error), xpx, this.errorbarStyle.left);\n }\n\n if (error = this.waveform.getErrorBarXAbove(index)) {\n this.errorbarStyle.paths.right += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.right += this.makeBarX(this.getX(dataX + error), xpx, this.errorbarStyle.right);\n }\n\n if (error = this.waveform.getErrorBarYBelow(index)) {\n this.errorbarStyle.paths.bottom += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.bottom += this.makeBarY(this.getY(dataY - error), ypx, this.errorbarStyle.bottom);\n }\n\n if (error = this.waveform.getErrorBarYAbove(index)) {\n this.errorbarStyle.paths.top += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.top += this.makeBarY(this.getY(dataY + error), ypx, this.errorbarStyle.top);\n }\n\n if (error = this.waveform.getErrorBoxXBelow(index)) {\n this.errorboxStyle.paths.left += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.left += this.makeBoxX(this.getX(dataX - error), xpx, this.errorboxStyle.left);\n }\n\n if (error = this.waveform.getErrorBoxXAbove(index)) {\n this.errorboxStyle.paths.right += ' M ' + xpx + ' ' + ypx;\n\n this.errorboxStyle.paths.right += this.makeBoxX(this.getX(dataX + error), xpx, this.errorboxStyle.right);\n }\n\n if (error = this.waveform.getErrorBoxYBelow(index)) {\n this.errorboxStyle.paths.bottom += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.bottom += this.makeBoxY(this.getY(dataY - error), ypx, this.errorboxStyle.bottom);\n }\n\n if (error = this.waveform.getErrorBoxYAbove(index)) {\n this.errorboxStyle.paths.top += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.top += this.makeBoxY(this.getY(dataY + error), ypx, this.errorboxStyle.top);\n }\n /* eslint-enable */\n },\n\n errorAddPointBarChart: function (j, posY, xpx, ypx) {\n var error;\n if (this.error && (error = this.error[j])) {\n this.doErrorDraw('y', error, posY, ypx, xpx, ypx);\n }\n },\n\n errorDraw: function () {\n\n if (this.errorbarStyle) {\n\n for (var j in this.errorbarStyle.paths) {\n\n if (this.errorbarStyle[j] && this.errorbarStyle[j].dom) {\n this.errorbarStyle[j].dom.setAttribute('d', this.errorbarStyle.paths[j]);\n }\n }\n }\n\n if (this.errorboxStyle) {\n\n for (var j in this.errorboxStyle.paths) {\n\n if (this.errorboxStyle[j] && this.errorboxStyle[j].dom) {\n this.errorboxStyle[j].dom.setAttribute('d', this.errorboxStyle.paths[j]);\n }\n }\n }\n }\n };\n\n exports.default = ErrorBarMixin;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(9)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.axis.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphAxis);\n global.graphAxisX = mod.exports;\n }\n})(this, function (module, exports, _graphAxis) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphAxis2 = _interopRequireDefault(_graphAxis);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Generic constructor of a y axis\n * @augments Axis\n */\n class AxisX extends _graphAxis2.default {\n\n constructor(graph, topbottom, options = {}) {\n\n super(graph, topbottom, options);\n this.top = topbottom == 'top';\n }\n\n /**\n * @private\n * Returns the position of the axis, used by refreshDrawingZone in core module\n */\n getAxisPosition() {\n\n if (!this.options.display) {\n return 0;\n }\n\n let size;\n\n if (this.options.tickLabelOffset == 0) {\n // Normal mode, no offset\n size = this.options.tickPosition == 1 ? 8 : 20;\n size += this.graph.options.fontSize * 1;\n } else {\n // With an offset, and ticks inside, axis position is actually 0. Otherwise, it's the heights of the ticks\n size = this.options.tickPosition == 1 ? 0 : 12;\n }\n\n if (this.getLabel()) {\n size += this.graph.options.fontSize;\n }\n\n return size;\n }\n\n /**\n * @returns {Boolean} always ```true```\n */\n isX() {\n return true;\n }\n\n /**\n * @returns {Boolean} always ```false```\n */\n isY() {\n return false;\n }\n\n /**\n * @private\n * Used to set the x position of the axis\n */\n setShift(shift) {\n\n this.shift = shift;\n if (this.getShift() === undefined || !this.graph.getDrawingHeight()) {\n return;\n }\n\n this.group.setAttribute('transform', 'translate(0 ' + (this.floating ? this.getShift() : this.top ? this.shift : this.graph.getDrawingHeight() - this.shift) + ')');\n }\n\n /**\n * Caclulates the maximum tick height\n * @return {Number} The maximum tick height\n */\n getMaxSizeTick() {\n return (this.top ? -1 : 1) * (this.options.tickPosition == 1 ? 10 : 10);\n }\n\n /**\n * Draws a tick. Mostly used internally but it can be useful if you want to make your own axes\n * @param {Number} value - The value in axis unit to place the tick\n * @param {Number} level - The importance of the tick\n * @param {Object} options - Further options to be passed to ```setTickContent```\n * @param {Number} forcedPos - Forces the position of the tick (for axis dependency)\n */\n drawTick(value, level, options, forcedPos) {\n\n var self = this,\n val;\n\n val = forcedPos || this.getPos(value);\n\n if (val == undefined || isNaN(val)) {\n return;\n }\n\n var tick = this.nextTick(level, function (tick) {\n\n tick.setAttribute('y1', (self.top ? 1 : -1) * self.tickPx1 * self.tickScaling[level]);\n tick.setAttribute('y2', (self.top ? 1 : -1) * self.tickPx2 * self.tickScaling[level]);\n\n if (level == 1) {\n tick.setAttribute('stroke', self.getPrimaryTicksColor());\n } else {\n tick.setAttribute('stroke', self.getSecondaryTicksColor());\n }\n });\n\n // tick.setAttribute( 'shape-rendering', 'crispEdges' );\n tick.setAttribute('x1', val);\n tick.setAttribute('x2', val);\n\n this.nextGridLine(level == 1, val, val, 0, this.graph.getDrawingHeight());\n\n // this.groupTicks.appendChild( tick );\n if (level == 1) {\n var tickLabel = this.nextTickLabel(tickLabel => {\n\n tickLabel.setAttribute('y', (self.top ? -1 : 1) * ((self.options.tickPosition == 1 ? 8 : 20) + (self.top ? 10 : 0)) + this.options.tickLabelOffset);\n tickLabel.setAttribute('text-anchor', 'middle');\n if (self.getTicksLabelColor() !== 'black') {\n tickLabel.setAttribute('fill', self.getTicksLabelColor());\n }\n tickLabel.style.dominantBaseline = 'hanging';\n });\n\n tickLabel.setAttribute('x', val);\n this.setTickContent(tickLabel, value, options);\n }\n // this.ticks.push( tick );\n\n return [tick, tickLabel];\n }\n\n drawLabel() {\n // Place label correctly\n\n if (this.getLabelColor() !== 'black') {\n this.label.setAttribute('fill', this.getLabelColor());\n }\n\n if (this.options.labelFont) {\n this.label.setAttribute('font-family', this.options.labelFont);\n }\n\n this.label.setAttribute('text-anchor', 'middle');\n this.label.setAttribute('style', 'display: initial;');\n this.label.setAttribute('x', Math.abs(this.getMaxPx() + this.getMinPx()) / 2);\n this.label.setAttribute('y', (this.top ? -1 : 1) * ((this.options.tickPosition == 1 ? 10 : 25) + this.graph.options.fontSize));\n this.labelTspan.textContent = this.getLabel();\n }\n\n draw() {\n var tickWidth = super.draw(...arguments);\n this.drawSpecifics();\n\n return tickWidth;\n }\n /**\n * Paints the label, the axis line and anything else specific to x axes\n */\n drawSpecifics() {\n\n // Adjusts group shift\n //this.group.setAttribute('transform', 'translate(0 ' + this.getShift() + ')');\n\n this.drawLabel();\n\n this.line.setAttribute('x1', this.getMinPx());\n this.line.setAttribute('x2', this.getMaxPx());\n this.line.setAttribute('y1', 0);\n this.line.setAttribute('y2', 0);\n\n this.line.setAttribute('stroke', this.getAxisColor());\n\n if (!this.top) {\n\n this.labelTspan.style.dominantBaseline = 'hanging';\n this.expTspan.style.dominantBaseline = 'hanging';\n this.expTspanExp.style.dominantBaseline = 'hanging';\n\n this.unitTspan.style.dominantBaseline = 'hanging';\n // this.preunitTspan.style.dominantBaseline = 'hanging';\n }\n\n var span = this.getSpan();\n this.line.setAttribute('marker-start', !this.options.splitMarks || span[0] == 0 ? '' : 'url(#horionzalsplit_' + this.graph.getId() + ')');\n this.line.setAttribute('marker-end', !this.options.splitMarks || span[1] == 1 ? '' : 'url(#horionzalsplit_' + this.graph.getId() + ')');\n }\n\n /**\n * @private\n */\n _drawLine(pos, line) {\n\n let px = this.getPx(pos);\n\n if (!line) {\n line = document.createElementNS(this.graph.ns, 'line');\n } else {\n line.setAttribute('display', 'initial');\n }\n\n line.setAttribute('x1', px);\n line.setAttribute('x2', px);\n\n line.setAttribute('y1', 0);\n line.setAttribute('y2', this.graph.drawingSpaceHeight);\n\n line.setAttribute('stroke', 'black');\n this.group.appendChild(line);\n\n return line;\n }\n\n _hideLine(line) {\n if (!line) {\n return;\n }\n line.setAttribute('display', 'none');\n }\n\n /**\n * @private\n */\n handleMouseMoveLocal(x) {\n // handleMouseMoveLocal( x, y, e )\n x -= this.graph.getPaddingLeft();\n this.mouseVal = this.getVal(x);\n }\n\n /**\n * Caches the minimum px and maximum px position of the axis. Includes axis spans and flipping. Mostly used internally\n */\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n\n if (isNaN(interval)) {\n return;\n }\n\n var maxPx = interval * this.options.span[1] + this.minPx - this.options.marginMax;\n var minPx = interval * this.options.span[0] + this.minPx + this.options.marginMin;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n }\n\n getZProj(zValue) {\n return zValue * this.graph.options.zAxis.shiftX;\n }\n\n }\n\n exports.default = AxisX;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShape);\n global.graphShapeLine = mod.exports;\n }\n})(this, function (module, exports, _graphShape) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Represents a line\n * @extends Shape\n * @see Graph#newShape\n */\n class ShapeLine extends _graphShape2.default {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'line');\n\n if (!this.getStrokeColor()) {\n this.setStrokeColor('black');\n }\n\n if (!this.getStrokeWidth()) {\n this.setStrokeWidth(1);\n }\n }\n\n /**\n * Creates the handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {\n\n this._createHandles(2, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n var position = this.calculatePosition(0);\n var position2 = this.calculatePosition(1);\n\n if (!position || !position.x || !position.y) {\n return;\n }\n\n this.setDom('x2', position.x);\n this.setDom('y2', position.y);\n\n this.setDom('y1', position2.y);\n this.setDom('x1', position2.x);\n\n this.currentPos2x = position2.x;\n this.currentPos2y = position2.y;\n\n this.currentPos1x = position.x;\n this.currentPos1y = position.y;\n\n return true;\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n if (this.isLocked()) {\n return;\n }\n\n var pos = this.getPosition(0);\n var pos2 = this.getPosition(1);\n\n var posToChange;\n if (this.handleSelected == 1) {\n\n posToChange = pos;\n } else if (this.handleSelected == 2) {\n\n posToChange = pos2;\n }\n\n if (posToChange) {\n\n if (!this._data.vertical) {\n posToChange.deltaPosition('x', deltaX, this.getXAxis());\n }\n\n if (!this._data.horizontal) {\n posToChange.deltaPosition('y', deltaY, this.getYAxis());\n }\n }\n\n if (this.moving) {\n console.log(this._data);\n // If the pos2 is defined by a delta, no need to move them\n if (pos.x && !this._data.noX) {\n pos.deltaPosition('x', deltaX, this.getXAxis());\n }\n if (pos.y && !this._data.noY) {\n pos.deltaPosition('y', deltaY, this.getYAxis());\n }\n\n // If the pos2 is defined by a delta, no need to move them\n if (pos2.x && !this._data.noX) {\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n }\n if (pos2.y && !this._data.noY) {\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n }\n }\n\n if (this._data.forcedCoords) {\n\n var forced = this._data.forcedCoords;\n\n if (forced.y !== undefined) {\n\n if (typeof forced.y == 'function') {\n pos2.y = pos.y = forced.y(this);\n } else {\n pos2.y = forced.y;\n pos.y = forced.y;\n }\n }\n\n if (forced.x !== undefined) {\n\n if (typeof forced.x == 'function') {\n pos2.x = pos.x = forced.x(this);\n } else {\n pos2.x = forced.x;\n pos.x = forced.x;\n }\n }\n }\n\n if (this.rectEvent) {\n this.setEventReceptacle();\n }\n\n this.redraw();\n this.changed();\n this.setHandles();\n\n return true;\n }\n\n /**\n * Sets the handle position\n * @private\n */\n setHandles() {\n\n if (!this.areHandlesInDom()) {\n return;\n }\n\n if (isNaN(this.currentPos1x)) {\n return;\n }\n\n this.handles[1].setAttribute('x', this.currentPos1x);\n this.handles[1].setAttribute('y', this.currentPos1y);\n\n this.handles[2].setAttribute('x', this.currentPos2x);\n this.handles[2].setAttribute('y', this.currentPos2y);\n }\n\n /**\n * Creates an line receptacle with the coordinates of the line, but continuous and thicker\n * @return {Shape} The current shape\n */\n setEventReceptacle() {\n\n if (!this.currentPos1x) {\n return;\n }\n\n if (!this.rectEvent) {\n this.rectEvent = document.createElementNS(this.graph.ns, 'line');\n this.rectEvent.setAttribute('pointer-events', 'stroke');\n this.rectEvent.setAttribute('stroke', 'transparent');\n this.rectEvent.jsGraphIsShape = this;\n this.group.appendChild(this.rectEvent);\n }\n\n this.rectEvent.setAttribute('x1', this.currentPos1x);\n this.rectEvent.setAttribute('y1', this.currentPos1y);\n this.rectEvent.setAttribute('x2', this.currentPos2x);\n this.rectEvent.setAttribute('y2', this.currentPos2y);\n this.rectEvent.setAttribute('stroke-width', this.getProp('strokeWidth') + 2);\n }\n }\n\n exports.default = ShapeLine;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports);\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports);\n global.fit_lm = mod.exports;\n }\n})(this, function (module, exports) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n class FitHost {\n\n constructor(options) {\n\n this.DELTAP = 1e-6;\n this.BIGVAL = 9e99;\n this.WEIGHT = 1.0;\n\n this.setYData(options.dataY);\n this.setXData(options.dataX);\n this.setWeight(options.weight);\n this.setInitialParams(options.params);\n\n if (options.subsetIndex) {\n this.setSubset(...options.subsetIndex);\n }\n\n this.setFunction(options.function);\n\n if (options.progress) {\n this.hookIteration(options.progress);\n }\n\n this.options = options;\n }\n\n //[ [ x1, y1 ], [ x2, y2 ] ]\n setYData(data) {\n // Waveform instance\n this.data = data;\n }\n\n setXData(data) {\n // Waveform instance\n this.dataX = data;\n }\n\n setWeight(weight) {\n // Waveform instance\n this.weight = weight;\n }\n\n setInitialParams(params) {\n this.parms = params;\n\n this.parms = this.parms.map(el => {\n if (typeof el == 'function') {\n return el(this.data, this.dataX);\n } else {\n return el;\n }\n });\n this.NPARMS = params.length;\n }\n\n setSubset(fromIndex, toIndex) {\n if (fromIndex !== undefined && toIndex !== undefined) {\n this._from = fromIndex;\n this._to = toIndex;\n }\n }\n\n hookIteration(f) {\n this._hookIteration = params => {\n let data = this.buildFit(params, 200);\n f(data);\n };\n }\n\n setFunction(func) {\n this._func = func;\n }\n\n init() {\n\n // Get data length\n if (this._from !== undefined && this._to !== undefined) {\n\n if (this._from >= this._to) {\n throw 'Impossible to fit negative subranges. The starting index must be lower than the ending index';\n }\n\n this.NPTS = this._to - this._from + 1;\n\n if (this.data && this.data.getLength() <= this._to) {\n throw 'Wave Y has not enough point to be fitted to subrange [' + this._from + ', ' + this._to + ']';\n }\n\n if (this._from < 0) {\n throw 'Impossible to fit a subrange with negative indices';\n }\n } else {\n\n this.NPTS = this.data.getLength();\n this._from = 0;\n this._to = this.data.getLength() - 1;\n }\n\n if (this.dataX && this.dataX.getLength() <= this._to) {\n throw 'Wave X has not enough point to be fitted to subrange [' + this._from + ', ' + this._to + ']';\n }\n\n this.arrY = this.data.getDataY();\n\n if (this.dataX) {\n this.arrX = this.dataX.getDataY();\n } else {\n this.arrX = this.data.getDataX();\n }\n\n this.resid = new Array(this.NPTS).fill(0);\n this.jac = new Array(this.NPTS).fill(0);\n this.jac = this.jac.map(el => new Array(this.NPARMS));\n }\n\n fit() {\n\n this.log('Starting the fit with initial parameter list {' + this.parms.join() + '};');\n new LM(this, this.NPARMS, this.NPTS, this._hookIteration);\n this.log('Fit successful. Output parameters {' + this.parms.join() + '};');\n\n this._result = this.buildFit(this.parms, 200);\n\n if (this.options.done) {\n this.options.done(this.parms, this._result);\n }\n\n return this._result;\n }\n\n func(x, param) {\n return this._func(x, param);\n }\n\n computeResiduals() {\n var sumsq = 0;\n for (var i = 0; i < this.NPTS; i++) {\n this.resid[i] = (this.func(this.arrX[i + this._from], this.parms) - this.arrY[i + this._from]) * this.WEIGHT;\n sumsq += this.resid[i] * this.resid[i];\n }\n\n return sumsq;\n }\n\n log(message) {\n if (this.options.log) {\n console.log(message);\n }\n }\n\n //------the four mandated interface methods------------\n nudge(dp) {\n\n for (var j = 0; j < this.NPARMS; j++) {\n this.parms[j] += dp[j];\n }\n return this.computeResiduals();\n }\n\n buildJacobian() {\n // Allows LM to compute a new Jacobian.\n // Uses current parms[] and two-sided finite difference.\n // If current parms[] is bad, returns false.\n var delta = new Array(this.NPARMS);\n var FACTOR = 0.5 / this.DELTAP;\n var d = 0;\n\n for (var j = 0; j < this.NPARMS; j++) {\n for (var k = 0; k < this.NPARMS; k++) delta[k] = k == j ? this.DELTAP : 0.0;\n\n d = this.nudge(delta); // resid at pplus\n if (d == this.BIGVAL) {\n throw 'Bad dBuildJacobian() exit 2';\n }\n\n for (var i = 0; i < this.NPTS; i++) {\n this.jac[i][j] = this.getResidualElement(i);\n }\n\n for (var k = 0; k < this.NPARMS; k++) {\n delta[k] = k == j ? -2 * this.DELTAP : 0.0;\n }\n\n d = this.nudge(delta); // resid at pminus\n if (d == this.BIGVAL) {\n throw 'Bad dBuildJacobian(). exit 3';\n }\n\n for (var i = 0; i < this.NPTS; i++) this.jac[i][j] -= this.getResidualElement(i); // fetches resid[]\n\n for (var i = 0; i < this.NPTS; i++) this.jac[i][j] *= FACTOR;\n\n for (var k = 0; k < this.NPARMS; k++) delta[k] = k == j ? this.DELTAP : 0.0;\n\n d = this.nudge(delta);\n if (d == this.BIGVAL) {\n throw 'Bad dBuildJacobian(). exit 4';\n }\n }\n return true;\n }\n\n getResidualElement(i) {\n // Allows LM to see one element of the resid[] vector.\n return this.resid[i];\n }\n\n getJacobianElement(i, j) {\n // Allows LM to see one element of the Jacobian matrix.\n return this.jac[i][j];\n }\n\n buildFit(parms, length) {\n let x;\n\n if (!length) {\n x = this.arrX;\n } else {\n\n const xmin = this.dataX.getMin(this._from, this._to);\n const xmax = this.dataX.getMax(this._from, this._to);\n\n x = new Array(length).fill(0).map((el, index) => index * (xmax - xmin) / (length - 1) + xmin);\n }\n\n var fit = new Array(x.length);\n for (var i = 0, l = x.length; i < l; i++) {\n fit[i] = this.func(x[i], this.parms);\n }\n\n let waveformResult = this.options.waveform;\n waveformResult.setData(fit, x);\n //waveformResult.setXWaveform( x );\n\n return waveformResult;\n }\n }\n\n class LM {\n\n constructor(gH, gnadj, gnpnts, hook) {\n\n this.LMITER = 100; // max number of L-M iterations\n this.LMBOOST = 2.0; // damping increase per failed step\n this.LMSHRINK = 0.10; // damping decrease per successful step\n this.LAMBDAZERO = 0.001; // initial damping\n this.LAMBDAMAX = 1E9; // max damping\n this.LMTOL = 1E-12; // exit tolerance\n this.BIGVAL = 9e99; // trouble flag\n\n this.sos;\n this.sosprev;\n this.lambda;\n\n this.myH = null; // overwritten by constructor\n this.nadj = 0; // overwritten by constructor\n this.npts = 0; // overwritten by constructor\n\n this.delta; // local parm change\n this.beta;\n this.alpha;\n this.amatrix;\n\n // Constructor sets up fields and drives iterations.\n this.myH = gH;\n this.nadj = gnadj;\n this.npts = gnpnts;\n\n this.delta = new Array(this.nadj).fill(0);\n this.beta = new Array(this.nadj).fill(0);\n\n this.alpha = new Array(this.nadj).fill(0);\n this.amatrix = new Array(this.nadj).fill(0);\n\n this.alpha = this.alpha.map(() => new Array(this.nadj));\n this.amatrix = this.amatrix.map(() => new Array(this.nadj));\n\n this.lambda = this.LAMBDAZERO;\n\n var niter = 0;\n var done = false;\n do {\n done = this.bLMiter();\n\n if (hook) {\n hook(this.myH.params);\n }\n\n niter++;\n } while (!done && niter < this.LMITER);\n }\n\n bLMiter() {\n // Each call performs one LM iteration.\n // Returns true if done with iterations; false=wants more.\n // Global nadj, npts; needs nadj, myH to be preset.\n // Ref: M.Lampton, Computers in Physics v.11 pp.110-115 1997.\n for (var k = 0; k < this.nadj; k++) this.delta[k] = 0.0;\n this.sos = this.myH.nudge(this.delta);\n if (this.sos == this.BIGVAL) {\n console.error(' bLMiter finds faulty initial nudge()');\n return false;\n }\n this.sosprev = this.sos;\n\n this.myH.log(' bLMiter..SumOfSquares= ' + this.sos);\n if (!this.myH.buildJacobian()) {\n console.error(' bLMiter finds buildJacobian()=false');\n return false;\n }\n\n for (var k = 0; k < this.nadj; k++) // get downhill gradient beta\n {\n this.beta[k] = 0.0;\n for (var i = 0; i < this.npts; i++) {\n this.beta[k] -= this.myH.getResidualElement(i) * this.myH.getJacobianElement(i, k);\n }\n }\n\n for (var k = 0; k < this.nadj; k++) // get curvature matrix alpha\n for (var j = 0; j < this.nadj; j++) {\n this.alpha[j][k] = 0.0;\n for (var i = 0; i < this.npts; i++) {\n this.alpha[j][k] += this.myH.getJacobianElement(i, j) * this.myH.getJacobianElement(i, k);\n }\n }\n var rrise = 0;\n do // inner damping loop searches for one downhill step\n {\n for (var k = 0; k < this.nadj; k++) {\n // copy and damp it\n for (var j = 0; j < this.nadj; j++) {\n this.amatrix[j][k] = this.alpha[j][k] + (j == k ? this.lambda : 0.0);\n }\n }\n\n this.gaussj(this.amatrix, this.nadj); // invert\n\n for (var k = 0; k < this.nadj; k++) // compute delta[]\n {\n this.delta[k] = 0.0;\n for (var j = 0; j < this.nadj; j++) this.delta[k] += this.amatrix[j][k] * this.beta[j];\n }\n this.sos = this.myH.nudge(this.delta); // try it out.\n if (this.sos == this.BIGVAL) {\n console.error(' LMinner failed SOS step');\n return false;\n }\n rrise = (this.sos - this.sosprev) / (1 + this.sos);\n if (rrise <= 0.0) // good step!\n {\n this.lambda *= this.LMSHRINK; // shrink lambda\n break; // leave lmInner.\n }\n for (var q = 0; q < this.nadj; q++) {\n // reverse course!\n this.delta[q] *= -1.0;\n }\n this.myH.nudge(this.delta); // sosprev should still be OK\n if (rrise < this.LMTOL) {\n // finished but keep prev parms\n break; // leave inner loop\n }\n this.lambda *= this.LMBOOST; // else try more damping.\n } while (this.lambda < this.LAMBDAMAX);\n return rrise > -this.LMTOL || this.lambda > this.LAMBDAMAX;\n }\n\n gaussj(a, N) {\n // Inverts the double array a[N][N] by Gauss-Jordan method\n // M.Lampton UCB SSL (c)2003, 2005\n\n var det = 1.0,\n big,\n save;\n var i, j, k, L;\n var ik = new Array(100);\n var jk = new Array(100);\n\n for (k = 0; k < N; k++) {\n big = 0.0;\n for (i = k; i < N; i++) for (j = k; j < N; j++) // find biggest element\n if (Math.abs(big) <= Math.abs(a[i][j])) {\n big = a[i][j];\n ik[k] = i;\n jk[k] = j;\n }\n if (big == 0.0) return 0.0;\n i = ik[k];\n if (i > k) for (j = 0; j < N; j++) // exchange rows\n {\n save = a[k][j];\n a[k][j] = a[i][j];\n a[i][j] = -save;\n }\n j = jk[k];\n if (j > k) for (i = 0; i < N; i++) {\n save = a[i][k];\n a[i][k] = a[i][j];\n a[i][j] = -save;\n }\n for (i = 0; i < N; i++) // build the inverse\n if (i != k) a[i][k] = -a[i][k] / big;\n for (i = 0; i < N; i++) for (j = 0; j < N; j++) if (i != k && j != k) a[i][j] += a[i][k] * a[k][j];\n for (j = 0; j < N; j++) if (j != k) a[k][j] /= big;\n a[k][k] = 1.0 / big;\n det *= big; // bomb point\n } // end k loop\n for (L = 0; L < N; L++) {\n k = N - L - 1;\n j = ik[k];\n if (j > k) for (i = 0; i < N; i++) {\n save = a[i][k];\n a[i][k] = -a[i][j];\n a[i][j] = save;\n }\n i = jk[k];\n if (i > k) for (j = 0; j < N; j++) {\n save = a[k][j];\n a[k][j] = -a[i][j];\n a[i][j] = save;\n }\n }\n return det;\n }\n }\n\n exports.default = FitHost;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(9)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.axis.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphAxis);\n global.graphAxisY = mod.exports;\n }\n})(this, function (module, exports, _graphAxis) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphAxis2 = _interopRequireDefault(_graphAxis);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Generic constructor of a y axis\n * @extends Axis\n */\n class AxisY extends _graphAxis2.default {\n\n constructor(graph, leftright, options) {\n\n super(graph, leftright, options);\n this.leftright = leftright;\n this.left = leftright == 'left';\n }\n\n /**\n * @private\n */\n setAxisPosition(shift) {\n this.shiftPosition = shift;\n }\n\n getAxisPosition() {\n return this.shiftPosition || 0;\n }\n\n getAdditionalWidth() {\n let pos = 0;\n if (this.getLabel()) {\n pos += this.graph.options.fontSize;\n }\n\n if (this.isShown()) {\n pos += Math.abs(this.tickMargin);\n }\n return pos;\n }\n\n /**\n * @returns {Boolean} always ```false```\n */\n isX() {\n return false;\n }\n\n /**\n * @returns {Boolean} always ```true```\n */\n isY() {\n return true;\n }\n\n /**\n * @private\n */\n resetTicksLength() {\n this.longestTick = [false, 0];\n }\n\n /**\n * @private\n */\n getMaxSizeTick() {\n // Gives an extra margin of 5px\n return this.longestTick && this.longestTick[0] ? this.longestTick[0].getComputedTextLength() + 5 : 0; //(this.left ? 10 : 0);\n }\n\n draw() {\n\n this.tickMargin = this.left ? -5 - this.tickPx1 * this.tickScaling[1] : 2 - this.tickPx1 * this.tickScaling[1];\n var tickWidth = super.draw(...arguments);\n tickWidth += this.getAdditionalWidth();\n this.drawSpecifics(tickWidth);\n\n this.fullwidthlabel = tickWidth;\n\n return tickWidth;\n }\n\n equalizePosition(width) {\n\n this.placeLabel(this.left ? -width : width);\n\n if (this.getLabel()) {\n return width + this.graph.options.fontSize;\n }\n\n return 0;\n }\n\n /**\n * @private\n */\n drawTick(value, level, options, forcedPos) {\n let pos, tick, tickLabel;\n\n pos = forcedPos || this.getPos(value);\n\n if (pos == undefined || isNaN(pos)) {\n return;\n }\n\n tick = this.nextTick(level, tick => {\n\n tick.setAttribute('x1', (this.left ? 1 : -1) * this.tickPx1 * this.tickScaling[level]);\n tick.setAttribute('x2', (this.left ? 1 : -1) * this.tickPx2 * this.tickScaling[level]);\n\n if (level == 1) {\n tick.setAttribute('stroke', this.getPrimaryTicksColor());\n } else {\n tick.setAttribute('stroke', this.getSecondaryTicksColor());\n }\n });\n\n tick.setAttribute('y1', pos);\n tick.setAttribute('y2', pos);\n\n this.nextGridLine(level == 1, 0, this.graph.getDrawingWidth(), pos, pos);\n\n // this.groupTicks.appendChild( tick );\n if (level == 1) {\n tickLabel = this.nextTickLabel(tickLabel => {\n\n tickLabel.setAttribute('x', this.tickMargin + this.options.tickLabelOffset);\n if (this.getTicksLabelColor() !== 'black') {\n tickLabel.setAttribute('fill', this.getTicksLabelColor());\n }\n\n if (this.left) {\n tickLabel.setAttribute('text-anchor', 'end');\n } else {\n tickLabel.setAttribute('text-anchor', 'start');\n }\n tickLabel.style.dominantBaseline = 'central';\n });\n\n tickLabel.setAttribute('y', pos);\n this.setTickContent(tickLabel, value, options);\n\n if (String(tickLabel.textContent).length >= this.longestTick[1]) {\n this.longestTick[0] = tickLabel;\n this.longestTick[1] = String(tickLabel.textContent).length;\n }\n }\n }\n\n drawLabel() {\n\n if (this.getLabelColor() !== 'black') {\n this.label.setAttribute('fill', this.getLabelColor());\n }\n\n this.label.setAttribute('dominant-baseline', !this.left ? 'auto' : 'auto');\n this.labelTspan.textContent = this.getLabel();\n }\n\n placeLabel(y) {\n this.label.setAttribute('transform', 'translate(' + y + ', ' + Math.abs(this.getMaxPx() + this.getMinPx()) / 2 + ') rotate(-90)');\n }\n\n /**\n * @private\n */\n drawSpecifics() {\n // Place label correctly\n //this.label.setAttribute('x', (this.getMaxPx() - this.getMinPx()) / 2);\n /*\n if ( !this.left ) {\n this.labelTspan.style.dominantBaseline = 'hanging';\n this.expTspan.style.dominantBaseline = 'hanging';\n this.expTspanExp.style.dominantBaseline = 'hanging';\n this.unitTspan.style.dominantBaseline = 'hanging';\n this.preunitTspan.style.dominantBaseline = 'hanging';\n }\n */\n this.line.setAttribute('y1', this.getMinPx());\n this.line.setAttribute('y2', this.getMaxPx());\n this.line.setAttribute('x1', 0);\n this.line.setAttribute('x2', 0);\n\n this.line.setAttribute('stroke', this.getAxisColor());\n\n var span = this.getSpan();\n this.line.setAttribute('marker-start', !this.options.splitMarks || span[0] == 0 ? '' : 'url(#verticalsplit_' + this.graph.getId() + ')');\n this.line.setAttribute('marker-end', !this.options.splitMarks || span[1] == 1 ? '' : 'url(#verticalsplit_' + this.graph.getId() + ')');\n }\n\n /**\n * @private\n */\n setShift(shift) {\n\n this.shift = shift;\n\n if (!this.shift || !this.graph.getWidth()) {\n return;\n }\n\n let xshift = this.shift;\n xshift = this.floating ? xshift : this.isLeft() ? xshift : this.graph.getWidth() - this.graph.getPaddingRight() - this.graph.getPaddingLeft() - xshift;\n this.group.setAttribute('transform', 'translate( ' + xshift + ' 0 )');\n this.drawLabel();\n }\n\n /**\n * @private\n */\n isLeft() {\n return this.left;\n }\n\n /**\n * @private\n */\n isRight() {\n return !this.left;\n }\n\n /**\n * @private\n */\n isFlipped() {\n return !this.options.flipped;\n }\n\n /**\n * @private\n */\n _drawLine(pos, line) {\n\n let px = this.getPx(pos);\n\n if (!line) {\n line = document.createElementNS(this.graph.ns, 'line');\n } else {\n line.setAttribute('display', 'initial');\n }\n\n line.setAttribute('y1', px);\n line.setAttribute('y2', px);\n\n line.setAttribute('x1', 0);\n line.setAttribute('x2', this.graph.drawingSpaceWidth);\n\n line.setAttribute('stroke', 'black');\n this.group.appendChild(line);\n\n return line;\n }\n\n _hideLine(line) {\n if (!line) {\n return;\n }\n\n line.setAttribute('display', 'none');\n }\n\n /**\n * @private\n */\n handleMouseMoveLocal(x, y) {\n y -= this.graph.getPaddingTop();\n this.mouseVal = this.getVal(y);\n }\n\n /**\n * Scales the axis with respect to the series contained in an x axis\n * @param {Axis} [ axis = graph.getXAxis() ] - The X axis to use as a reference\n * @param {Serie} [ excludeSerie ] - A serie to exclude\n * @param {Number} [ start = xaxis.getCurrentMin() ] - The start of the boundary\n * @param {Number} [ end = xaxis.getCurrentMax() ] - The end of the boundary\n * @param {Boolean} [ min = true ] - Adapt the min\n * @param {Boolean} [ max = true ] - Adapt the max\n * @returns {Axis} The current axis\n */\n scaleToFitAxis(axis, excludeSerie, start, end, min, max) {\n //console.log( axis instanceof GraphAxis );\n if (!axis || !axis.isX()) {\n axis = this.graph.getXAxis();\n }\n\n if (isNaN(start)) {\n start = axis.getCurrentMin();\n }\n\n if (isNaN(end)) {\n end = axis.getCurrentMax();\n }\n\n if (min === undefined) {\n min = true;\n }\n\n if (max === undefined) {\n max = true;\n }\n\n if (typeof excludeSerie == 'number') {\n end = start;\n start = excludeSerie;\n excludeSerie = false;\n }\n\n var maxV = -Infinity,\n minV = Infinity,\n j = 0;\n\n for (var i = 0, l = this.graph.series.length; i < l; i++) {\n\n if (!this.graph.series[i].isShown()) {\n continue;\n }\n\n if (this.graph.series[i] == excludeSerie) {\n continue;\n }\n\n if (!(this.graph.series[i].getXAxis() == axis) || this.graph.series[i].getYAxis() !== this) {\n continue;\n }\n\n j++;\n\n maxV = max ? Math.max(maxV, this.graph.series[i].getMax(start, end)) : 0;\n minV = min ? Math.min(minV, this.graph.series[i].getMin(start, end)) : 0;\n }\n\n if (j == 0) {\n\n this.setMinMaxToFitSeries(); // No point was found\n } else {\n\n // If we wanted originally to resize min and max. Otherwise we use the current value\n minV = min ? minV : this.getCurrentMin();\n maxV = max ? maxV : this.getCurrentMax();\n\n var interval = maxV - minV;\n\n minV -= this.options.axisDataSpacing.min * interval;\n maxV += this.options.axisDataSpacing.max * interval;\n\n this._doZoomVal(minV, maxV);\n }\n\n return this;\n }\n\n /**\n * Caches the minimum px and maximum px position of the axis. Includes axis spans and flipping. Mostly used internally\n * @return {Axis} The current axis instance\n */\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n\n if (isNaN(interval)) {\n return;\n }\n\n var maxPx = this.maxPx - interval * this.options.span[0] - this.options.marginMin;\n var minPx = this.maxPx - interval * this.options.span[1] + this.options.marginMax;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n }\n\n getZProj(zValue) {\n return zValue * this.graph.options.zAxis.shiftY;\n }\n\n }\n\n exports.default = AxisY;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports);\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports);\n global.graphMixinSerie3d = mod.exports;\n }\n})(this, function (module, exports) {\n \"use strict\";\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n var Serie3DMixin = {\n\n /**\n * Returns the x position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The x position in px corresponding to the x value\n */\n getX: function (val) {\n return (val = this.getXAxis().getPx(val)) - val % 0.2 + this.getXAxis().getZProj(this.options.zpos);\n },\n\n /**\n * Returns the y position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie3DMixin\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The y position in px corresponding to the y value\n */\n getY: function (val) {\n return (val = this.getYAxis().getPx(val)) - val % 0.2 + this.getYAxis().getZProj(this.options.zpos);\n },\n\n getZPos: function () {\n return this.options.zpos;\n },\n\n /**\n * @returns {Number} Lowest x value of the serie's data\n * @memberof Serie\n */\n getMinX: function (useZValues) {\n if (!useZValues) {\n return this.minX;\n }\n\n return getZCorrectedValue(this, true, true);\n },\n\n /**\n * @returns {Number} Highest x value of the serie's data\n * @memberof Serie\n */\n getMaxX: function (useZValues) {\n\n if (!useZValues) {\n return this.maxX;\n }\n return getZCorrectedValue(this, true, false);\n },\n\n /**\n * @returns {Number} Lowest y value of the serie's data\n * @memberof Serie\n */\n getMinY: function (useZValues) {\n\n if (!useZValues) {\n return this.minY;\n }\n return getZCorrectedValue(this, false, true);\n },\n\n /**\n * @returns {Number} Highest y value of the serie's data\n * @memberof Serie\n */\n getMaxY: function (useZValues) {\n\n if (!useZValues) {\n return this.maxY;\n }\n return getZCorrectedValue(this, false, false);\n }\n\n };\n\n function getZCorrectedValue(serie, x, min) {\n\n let i, l, data, val, valFinal;\n let wf = serie.getWaveforms();\n\n for (let wave of wf) {\n\n i = 0;\n l = wave.getLength();\n data = wave.getData();\n\n for (; i < l; i += 1) {\n\n if (x) {\n val = serie.getXAxis().getVal(serie.getX(wave.getX(i, true)));\n } else {\n val = serie.getYAxis().getVal(serie.getY(data[i]));\n }\n\n if (i == 0) {\n valFinal = val;\n } else {\n\n if (min) {\n valFinal = Math.min(valFinal, val);\n } else {\n valFinal = Math.max(valFinal, val);\n }\n }\n }\n }\n return valFinal;\n }\n\n exports.default = Serie3DMixin;\n module.exports = exports[\"default\"];\n});\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(8), __webpack_require__(0), __webpack_require__(10)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.serie.js'), require('../graph.util.js'), require('../mixins/graph.mixin.errorbars.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphSerie, global.graphUtil, global.graphMixinErrorbars);\n global.graphSerieScatter = mod.exports;\n }\n})(this, function (module, exports, _graphSerie, _graphUtil, _graphMixinErrorbars) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphSerie2 = _interopRequireDefault(_graphSerie);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphMixinErrorbars2 = _interopRequireDefault(_graphMixinErrorbars);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n const defaults = {};\n\n var type = 'scatter';\n\n /**\n * @static\n * @augments Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\n class SerieScatter extends _graphSerie2.default {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n this.id = Math.random() + Date.now();\n this.shapes = []; // Stores all shapes\n this.shown = true;\n this.data = [];\n\n this.shapesDetails = [];\n this.shapes = [];\n\n this._type = type;\n\n util.mapEventEmission(this.options, this);\n\n this._isMinOrMax = {\n x: {\n min: false,\n max: false\n },\n y: {\n min: false,\n max: false\n }\n };\n\n this.groupPoints = document.createElementNS(this.graph.ns, 'g');\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.additionalData = {};\n\n this.selectedStyleGeneral = {};\n this.selectedStyleModifiers = {};\n\n this.groupPoints.addEventListener('mouseover', e => {\n var id = parseInt(e.target.parentElement.getAttribute('data-shapeid'));\n this.emit('mouseover', id, this.waveform.getX(id), this.waveform.getY(id));\n });\n\n this.groupPoints.addEventListener('mouseout', e => {\n var id = parseInt(e.target.parentElement.getAttribute('data-shapeid'));\n this.emit('mouseout', id, this.waveform.getX(id), this.waveform.getY(id));\n });\n\n this.minX = Number.MAX_VALUE;\n this.minY = Number.MAX_VALUE;\n this.maxX = Number.MIN_VALUE;\n this.maxY = Number.MIN_VALUE;\n\n this.groupMain.appendChild(this.groupPoints);\n this.currentAction = false;\n\n if (this.initExtended1) {\n this.initExtended1();\n }\n\n this.styles = {};\n this.styles.unselected = {};\n this.styles.selected = {};\n\n this.styles.unselected.default = {\n shape: 'circle',\n cx: 0,\n cy: 0,\n r: 3,\n stroke: 'transparent',\n fill: 'black'\n };\n\n this.styles.selected.default = {\n shape: 'circle',\n cx: 0,\n cy: 0,\n r: 4,\n stroke: 'transparent',\n fill: 'black'\n };\n }\n\n /**\n * Applies for x as the category axis\n * @example serie.setDataCategory( { x: \"someName\", y: Waveform } );\n */\n setDataCategory(data) {\n\n let minY = +Infinity;\n let maxY = -Infinity;\n\n for (let dataCategory of data) {\n\n this._checkY(dataCategory.y.getMaxY());\n this._checkY(dataCategory.y.getMinY());\n }\n\n this.data = data;\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n return this;\n }\n\n /**\n * Removes all DOM points\n * @private\n */\n empty() {\n\n while (this.groupPoints.firstChild) {\n this.groupPoints.removeChild(this.groupPoints.firstChild);\n }\n }\n\n getSymbolForLegend() {\n\n if (this.symbol) {\n return this.symbol;\n }\n\n var g = document.createElementNS(this.graph.ns, 'g');\n g.setAttribute('data-shapeid', -1);\n var shape = this.doShape(g, this.styles.unselected.default);\n\n var style = this.getStyle('unselected', -1, true);\n\n for (var i in style[-1]) {\n if (i == 'shape') {\n continue;\n }\n shape.setAttribute(i, style[-1][i]);\n }\n\n return g;\n }\n\n /**\n * Sets style to the scatter points\n * First argument is the style applied by default to all points\n * Second argument is an array of modifiers that allows customization of any point of the scatter plot. Data for each elements of the array will augment allStyles, so be sure to reset the style if needed.\n * All parameters - except shape - will be set as parameters to the DOM element of the shape\n *\n * @example\n * var modifiers = [];\n * modifiers[ 20 ] = { shape: 'circle', r: 12, fill: 'rgba(0, 100, 255, 0.3)', stroke: 'rgb(0, 150, 255)' };\n * serie.setStyle( { shape: 'circle', r: 2, fill: 'rgba(255, 0, 0, 0.3)', stroke: 'rgb(255, 100, 0)' }, modifiers ); // Will modify scatter point n°20\n *\n * @param {Object} allStyles - The general style for all markers\n * @param {Object} [ modifiers ] - The general style for all markers\n * @param {String} [ selectionMode=\"unselected\" ] - The selection mode to which this style corresponds. Default is unselected\n *\n */\n setStyle(all, modifiers, mode = 'unselected') {\n\n if (typeof modifiers == 'string') {\n mode = modifiers;\n modifiers = false;\n }\n\n /*\n if( ! this.styles[ mode ] ) {\n }\n if ( mode !== \"selected\" && mode !== \"unselected\" ) {\n throw \"Style mode is not correct. Should be selected or unselected\";\n }\n */\n\n this.styles[mode] = this.styles[mode] || {};\n this.styles[mode].all = all;\n this.styles[mode].modifiers = modifiers;\n\n this.styleHasChanged(mode);\n\n return this;\n }\n\n /**\n * Redraws the serie\n * @private\n * @param {force} Boolean - Forces redraw even if the data hasn't changed\n */\n draw(force) {\n // Serie redrawing\n\n if (!force && !this.hasDataChanged() && !this.hasStyleChanged('unselected')) {\n return;\n }\n\n var x,\n y,\n xpx,\n ypx,\n j = 0,\n k,\n m,\n currentLine,\n max;\n\n var isCategory = this.getXAxis().getType() == 'category';\n\n this._drawn = true;\n\n this.dataHasChanged(false);\n this.styleHasChanged(false);\n this.groupMain.removeChild(this.groupPoints);\n\n var keys = [];\n\n j = 0;\n k = 0;\n\n if (this.hasErrors()) {\n this.errorDrawInit();\n }\n\n if (isCategory) {\n\n let k = 0;\n\n for (; j < this.data.length; j++) {\n\n if (!this.categoryIndices.hasOwnProperty(this.data[j].x)) {\n continue;\n }\n\n if (this.error) {\n // this.errorAddPoint( j, position[ 0 ] + position[ 1 ] / 2, 0, this.getX( position[ 0 ] + position[ 1 ] / 2 ), ypx );\n }\n\n for (var n = 0, l = this.data[j].y.getLength(); n < l; n++) {\n\n //let xpos = i / ( l - 1 ) * ( position[ 1 ] ) + position[ 0 ];\n\n ypx = this.getY(this.data[j].y.getY(n));\n xpx = this.getX(n / (l - 1) * (0.8 / this.nbCategories) + this.categoryIndices[this.data[j].x] + 0.1 / this.nbCategories);\n n++;\n\n this.shapesDetails[k] = this.shapesDetails[k] || [];\n this.shapesDetails[k][0] = xpx;\n this.shapesDetails[k][1] = ypx;\n keys.push(k);\n k++;\n }\n }\n } else {\n\n for (; j < this.waveform.getLength(); j++) {\n\n if (this.waveform.getX(j) < this.getXAxis().getCurrentMin() || this.waveform.getX(j) > this.getXAxis().getCurrentMax() || this.waveform.getY(j) < this.getYAxis().getCurrentMin() || this.waveform.getY(j) > this.getYAxis().getCurrentMax()) {\n\n if (this.shapes[j]) {\n this.shapes[j].setAttribute('display', 'none');\n }\n continue;\n }\n\n if (this.shapes[j]) {\n this.shapes[j].setAttribute('display', 'initial');\n }\n\n xpx = this.getX(this.waveform.getX(j));\n ypx = this.getY(this.waveform.getY(j));\n\n if (this.hasErrors()) {\n this.errorAddPoint(j, this.waveform.getX(j), this.waveform.getY(j), xpx, ypx);\n }\n\n this.shapesDetails[j] = this.shapesDetails[j] || [];\n this.shapesDetails[j][0] = xpx;\n this.shapesDetails[j][1] = ypx;\n keys.push(j);\n\n //this.shapes[ j / 2 ] = this.shapes[ j / 2 ] || undefined;\n }\n }\n\n if (this.hasErrors()) {\n this.errorDraw();\n }\n\n // This will automatically create the shapes\n this.applyStyle('unselected', keys);\n\n this.groupMain.appendChild(this.groupPoints);\n }\n\n _addPoint(xpx, ypx, k) {\n\n let shape;\n let g = document.createElementNS(this.graph.ns, 'g');\n g.setAttribute('transform', 'translate(' + xpx + ', ' + ypx + ')');\n g.setAttribute('data-shapeid', k);\n\n if (this.extraStyle && this.extraStyle[k]) {\n\n shape = this.doShape(g, this.extraStyle[k]);\n } else if (this.stdStylePerso) {\n\n shape = this.doShape(g, this.stdStylePerso);\n } else {\n\n shape = this.doShape(g, this.stdStyle);\n }\n\n this.shapes[k] = shape;\n this.groupPoints.appendChild(g);\n }\n\n doShape(group, shape) {\n var el = document.createElementNS(this.graph.ns, shape.shape);\n group.appendChild(el);\n return el;\n }\n\n getStyle(selection, index, noSetPosition) {\n\n var selection = selection || 'unselected';\n var indices;\n\n var styles = {};\n\n if (typeof index == 'number') {\n indices = [index];\n } else if (Array.isArray(index)) {\n indices = index;\n }\n\n var shape, index, modifier, style, j; // loop variables\n var styleAll;\n\n if (this.styles[selection].all !== undefined) {\n\n styleAll = this.styles[selection].all;\n\n if (typeof styleAll == 'function') {\n\n styleAll = styleAll();\n } else if (styleAll === false) {\n\n styleAll = {};\n }\n }\n\n var i = 0,\n l = indices.length;\n\n for (; i < l; i++) {\n\n index = indices[i];\n shape = this.shapes[index];\n\n if ((modifier = this.styles[selection].modifiers) && (typeof modifier == 'function' || modifier[index])) {\n\n if (typeof modifier == 'function') {\n\n style = modifier(index, shape);\n } else if (modifier[index]) {\n\n style = modifier[index];\n }\n\n styles[index] = Object.assign({}, styleAll, style);\n } else if (styleAll !== undefined) {\n\n styles[index] = styleAll;\n } else {\n\n styles[index] = this.styles[selection].default;\n }\n\n if (!styles[index]) {\n styles[index] = styleAll;\n }\n\n if (!shape) {\n // Shape doesn't exist, let's create it\n\n if (!styles[index].shape) {\n console.error(style);\n throw 'No shape was defined with this style.';\n }\n\n var g = document.createElementNS(this.graph.ns, 'g');\n g.setAttribute('data-shapeid', index);\n this.shapes[index] = this.doShape(g, styles[index]);\n this.groupPoints.appendChild(g);\n shape = this.shapes[index];\n }\n\n if (!noSetPosition) {\n shape.parentNode.setAttribute('transform', 'translate(' + this.shapesDetails[index][0] + ', ' + this.shapesDetails[index][1] + ')');\n }\n }\n\n return styles;\n }\n\n applyStyle(selection, index, noSetPosition) {\n\n var i, j;\n var styles = this.getStyle(selection, index, noSetPosition);\n\n for (i in styles) {\n\n for (j in styles[i]) {\n\n if (j !== 'shape') {\n\n if (styles[i][j]) {\n\n this.shapes[i].setAttribute(j, styles[i][j]);\n } else {\n\n this.shapes[i].removeAttribute(j);\n }\n }\n }\n }\n }\n\n unselectPoint(index) {\n this.selectPoint(index, false);\n }\n\n selectPoint(index, setOn, selectionType) {\n\n if (this.shapesDetails[index][2] && this.shapesDetails[index][2] == selectionType) {\n return;\n }\n\n if (typeof setOn == 'string') {\n selectionType = setOn;\n setOn = undefined;\n }\n\n if (Array.isArray(index)) {\n return this.selectPoints(index);\n }\n\n if (this.shapes[index] && this.shapesDetails[index]) {\n\n if ((this.shapesDetails[index][2] || setOn === false) && setOn !== true) {\n\n var selectionStyle = this.shapesDetails[index][2];\n this.shapesDetails[index][2] = false;\n\n var allStyles = this.getStyle(selectionStyle, index, true);\n for (var i in allStyles[index]) {\n this.shapes[index].removeAttribute(i);\n }\n\n this.applyStyle('unselected', index, true);\n } else {\n\n selectionType = selectionType || 'selected';\n this.shapesDetails[index][2] = selectionType;\n\n this.applyStyle(selectionType, index, true);\n }\n }\n }\n\n getUsedCategories() {\n\n if (typeof this.data[0] == 'object') {\n return this.data.map(d => d.x);\n }\n\n return [];\n }\n\n }\n\n util.mix(SerieScatter, _graphMixinErrorbars2.default);\n\n exports.default = SerieScatter;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(8), __webpack_require__(4), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.serie.js'), require('../util/waveform.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphSerie, global.waveform, global.graphUtil);\n global.graphSerieZone = mod.exports;\n }\n})(this, function (module, exports, _graphSerie, _waveform, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphSerie2 = _interopRequireDefault(_graphSerie);\n\n var _waveform2 = _interopRequireDefault(_waveform);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * @static\n * @extends Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\n class SerieZone extends _graphSerie2.default {\n\n static default() {\n return {\n fillColor: 'rgba( 0, 0, 0, 0.1 )',\n lineColor: 'rgba( 0, 0, 0, 1 )',\n lineWidth: '1px'\n };\n }\n constructor(graph, name, options) {\n super(...arguments);\n\n this.selectionType = 'unselected';\n this.id = (0, _graphUtil.guid)();\n\n this.groupZones = document.createElementNS(this.graph.ns, 'g');\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n this.lineZone = document.createElementNS(this.graph.ns, 'path');\n this.lineZone.setAttribute('stroke', 'black');\n this.lineZone.setAttribute('stroke-width', '1px');\n\n this.groupMain.appendChild(this.groupZones);\n this.groupZones.appendChild(this.lineZone);\n\n this.applyLineStyle(this.lineZone);\n this.styleHasChanged();\n\n this.clip = document.createElementNS(this.graph.ns, 'clipPath');\n this.clipId = (0, _graphUtil.guid)();\n this.clip.setAttribute('id', this.clipId);\n\n this.graph.defs.appendChild(this.clip);\n }\n\n /**\n * Assigns a collection of waveforms that make up the zone\n * The waveforms will appended one after the other, without break\n * @param {...Waveform} waveforms - The collection of waveforms\n * @return {SerieZone} - The current serie zone instance\n * @memberof SerieZone\n */\n setWaveform(...waveforms) {\n this.waveforms = waveforms;\n\n this.waveforms = this.waveforms.map(wave => {\n\n if (!(wave instanceof _waveform2.default)) {\n return new _waveform2.default(wave);\n } else {\n return wave;\n }\n });\n\n this.minX = this.waveforms[0].getXMin();\n this.maxX = this.waveforms[0].getXMax();\n this.minY = this.waveforms[0].getMin();\n this.maxY = this.waveforms[0].getMax();\n\n this.waveforms.map(wave => {\n\n this.minX = Math.min(wave.getXMin(), this.minX);\n this.maxX = Math.max(wave.getXMin(), this.maxX);\n this.minY = Math.min(wave.getMin(), this.minY);\n this.maxY = Math.max(wave.getMax(), this.maxY);\n });\n\n this.graph.updateDataMinMaxAxes();\n this.dataHasChanged();\n return this;\n }\n\n setWaveforms() {\n return this.setWaveform(...arguments);\n }\n\n getWaveforms() {\n return this.waveforms;\n }\n\n setMinMaxWaveforms(min, max) {\n this.waveforms = [min, max.reverse()];\n return this;\n }\n\n /**\n * Removes all the dom concerning this serie from the drawing zone\n */\n empty() {\n\n while (this.group.firstChild) {\n this.group.removeChild(this.group.firstChild);\n }\n }\n\n /**\n * Redraws the serie\n * @private\n *\n * @param {force} Boolean - Forces redraw even if the data hasn't changed\n */\n draw(force) {\n // Serie redrawing\n\n if (force || this.hasDataChanged()) {\n\n if (!this.waveforms) {\n return;\n }\n\n let dataX = 0,\n dataY = 0,\n xpx = 0,\n ypx = 0,\n j = 0,\n line = '',\n buffer,\n move = false;\n\n const xminpx = this.getXAxis().getMinPx(),\n xmaxpx = this.getXAxis().getMaxPx(),\n yminpx = this.getYAxis().getMinPx(),\n ymaxpx = this.getYAxis().getMaxPx();\n\n const xmin = this.getXAxis().getCurrentMin(),\n xmax = this.getXAxis().getCurrentMax(),\n ymin = this.getYAxis().getCurrentMin(),\n ymax = this.getYAxis().getCurrentMax();\n\n //this.clipRect.setAttribute( \"x\", Math.min( xmin, xmax ) );\n //this.clipRect.setAttribute( \"y\", Math.min( ymin, ymax ) );\n //this.clipRect.setAttribute( \"width\", Math.abs( xmax - xmin ) );\n //this.clipRect.setAttribute( \"height\", Math.abs( ymax - ymin ) );\n\n this.groupMain.removeChild(this.groupZones);\n\n for (let waveform of this.waveforms) {\n\n for (j = 0; j < waveform.getLength(); j += 1) {\n dataX = waveform.getX(j, true);\n dataY = waveform.getY(j, true);\n\n // The y axis in screen coordinate is inverted vs cartesians\n if (dataY[j] < ymin) {\n ypx = this.getY(ymin);\n } else if (dataY[j] > ymax) {\n ypx = this.getY(ymax);\n }\n\n if (dataX !== dataX) {\n continue;\n }\n\n if (dataY !== dataY) {\n // Let's make a new line\n\n if (line.length == 0) {\n continue;\n }\n\n line += 'L ' + xpx + ', ' + this.getY(waveform.getMinY());\n move = true;\n continue;\n }\n\n ypx = this.getY(dataY);\n xpx = this.getX(dataX);\n\n if (dataX < xmin || dataX > xmax) {\n buffer = [dataX, dataY[j], xpx, ypx];\n continue;\n }\n\n if (move) {\n line += ' M ' + xpx + ', ' + this.getY(waveform.getMinY()) + ' ';\n move = false;\n }\n\n if (line.length > 0) {\n line += ' L ';\n }\n\n if (buffer) {\n line += buffer[2] + ',' + buffer[3] + ' ';\n buffer = false;\n } else {\n line += xpx + ',' + ypx + ' ';\n }\n }\n }\n\n if (line !== '') {\n this.lineZone.setAttribute('d', 'M ' + line + ' z');\n } else {\n this.lineZone.setAttribute('d', '');\n }\n this.groupMain.appendChild(this.groupZones);\n }\n\n if (this.hasStyleChanged(this.selectionType)) {\n this.applyLineStyle(this.lineZone);\n this.styleHasChanged(false);\n }\n }\n\n /**\n * Applies the computed style to the DOM element fed as a parameter\n * @private\n *\n * @param {SVGLineElement} line - The line to which the style has to be applied to\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n line.setAttribute('fill', this.getFillColor());\n line.setAttribute('fill-opacity', this.getFillOpacity());\n line.setAttribute('stroke-opacity', this.getLineOpacity());\n }\n\n /**\n * Sets the line width\n *\n * @param {Number} width - The line width\n * @returns {SerieZone} - The current serie\n */\n setLineWidth(width) {\n this.options.lineWidth = width;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line width\n *\n * @returns {Number} - The line width\n */\n getLineWidth() {\n return this.options.lineWidth;\n }\n\n /**\n * Sets the line opacity\n *\n * @param {Number} opacity - The line opacity\n * @returns {SerieZone} - The current serie\n */\n setLineOpacity(opacity) {\n this.options.lineOpacity = opacity;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line opacity\n *\n * @returns {Number} - The line opacity\n */\n getLineOpacity() {\n return this.options.lineOpacity;\n }\n\n /**\n * Sets the line color\n *\n * @param {String} color - The line color\n * @returns {SerieZone} - The current serie\n */\n setLineColor(color) {\n this.options.lineColor = color;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line width\n *\n * @returns {Number} - The line width\n */\n getLineColor() {\n return this.options.lineColor;\n }\n\n /**\n * Sets the fill opacity\n *\n * @param {Number} opacity - The fill opacity\n * @returns {SerieZone} - The current serie\n */\n setFillOpacity(opacity) {\n this.options.fillOpacity = opacity;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the fill opacity\n *\n * @returns {Number} - The fill opacity\n */\n getFillOpacity() {\n return this.options.fillOpacity;\n }\n\n /**\n * Sets the fill color\n *\n * @param {Number} width - The line width\n * @returns {Number} - The line width\n */\n setFillColor(color) {\n this.options.fillColor = color;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the fill color\n *\n * @returns {Number} - The fill color\n */\n getFillColor() {\n return this.options.fillColor;\n }\n\n }\n\n exports.default = SerieZone;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(1), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShape, global.graphUtil);\n global.graphShapeRect = mod.exports;\n }\n})(this, function (module, exports, _graphShape, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Represents a rectangle that extends the Shape class\n * @class ShapeRectangle\n * @augments Shape\n * @see Graph#newShape\n */\n class ShapeRectangle extends _graphShape2.default {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'rect');\n\n if (!this.getStrokeColor()) {\n this.setStrokeColor('black');\n }\n\n if (!this.getStrokeWidth()) {\n this.setStrokeWidth(1);\n }\n\n if (!this.getFillColor()) {\n this.setFillColor('transparent');\n }\n\n return this;\n }\n\n /**\n * Creates the Handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {\n if (!this.hasHandles()) {\n return;\n }\n\n /*\n this._data.handles = this._data.handles || {\n type: 'corners'\n };\n */\n\n var handles = this.getProp('handles');\n\n if (typeof handles != 'object') {\n handles = {};\n }\n\n if (!handles.type) {\n handles.type = 'corners';\n }\n\n switch (handles.type) {\n\n case 'sides':\n\n util.extend(handles, {\n sides: {\n top: true,\n bottom: true,\n left: true,\n right: true\n }\n });\n\n var j = 0;\n for (var i in handles.sides) {\n if (handles.sides[i]) {\n j++;\n }\n }\n\n this._createHandles(j, 'g').map(function (g) {\n\n var r = document.createElementNS(self.graph.ns, 'rect');\n r.setAttribute('x', '-3');\n r.setAttribute('width', '6');\n r.setAttribute('y', '-6');\n r.setAttribute('height', '12');\n r.setAttribute('stroke', 'black');\n r.setAttribute('fill', 'white');\n r.setAttribute('cursor', 'pointer');\n\n g.appendChild(r);\n });\n\n var j = 1;\n\n for (var i in handles.sides) {\n if (handles.sides[i]) {\n this.handles[i] = this['handle' + j];\n this.sides[j] = i;\n j++;\n }\n }\n\n break;\n\n case 'corners':\n this._createHandles(4, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white'\n });\n\n if (this.handles) {\n this.handles[2].setAttribute('cursor', 'nesw-resize');\n this.handles[4].setAttribute('cursor', 'nesw-resize');\n\n this.handles[1].setAttribute('cursor', 'nwse-resize');\n this.handles[3].setAttribute('cursor', 'nwse-resize');\n }\n\n break;\n\n case 'seamlessX':\n\n this._createHandles(2, 'rect', {\n transform: 'translate(-3 -3)',\n stroke: 'transparent',\n fill: 'transparent',\n width: '20px',\n cursor: 'ew-resize'\n });\n\n break;\n }\n\n super.createHandles();\n\n return this;\n }\n\n /**\n * Updates the position\n * @memberof ShapeRectangle\n * @private\n * @return {Shape} The current shape\n */\n applyPosition() {\n\n var pos = this.computePosition(0),\n pos2 = this.computePosition(1),\n x,\n y,\n width,\n height;\n\n if (pos.x < pos2.x) {\n x = pos.x;\n width = pos2.x - pos.x;\n } else {\n x = pos2.x;\n width = pos.x - pos2.x;\n }\n\n if (pos.y < pos2.y) {\n y = pos.y;\n height = pos2.y - pos.y;\n } else {\n y = pos2.y;\n height = pos.y - pos2.y;\n }\n\n this.currentX = x;\n this.currentY = y;\n this.currentW = width;\n this.currentH = height;\n\n if (!isNaN(x) && !isNaN(y) && x !== false && y !== false) {\n\n this.setDom('width', width);\n this.setDom('height', height);\n this.setDom('x', x);\n this.setDom('y', y);\n\n this.setHandles();\n this.updateMask();\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Implements mouse move event\n * @private\n * @return {Shape} The current shape\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n var handles = this.getProp('handles');\n\n if (!this.moving && !this.handleSelected) {\n return;\n }\n\n var pos = this.getPosition(0);\n var pos2 = this.getPosition(1);\n\n var invX = this.getXAxis().isFlipped(),\n invY = this.getYAxis().isFlipped(),\n posX = pos.x,\n posY = pos.y,\n pos2X = pos2.x,\n pos2Y = pos2.y;\n\n if (this.moving) {\n\n pos.deltaPosition('x', deltaX, this.getXAxis());\n pos.deltaPosition('y', deltaY, this.getYAxis());\n\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n } else {\n\n switch (handles.type) {\n\n case 'seamlessX':\n // Do nothing for now\n\n switch (this.handleSelected) {\n\n case 1:\n pos.deltaPosition('x', deltaX, this.getXAxis());\n break;\n\n case 2:\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n break;\n }\n\n break;\n\n case 'sides':\n // Do nothing for now\n\n switch (this.sides[this.handleSelected]) {\n\n case 'left':\n pos.deltaPosition('x', deltaX, this.getXAxis());\n break;\n\n case 'right':\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n break;\n\n case 'top':\n pos.deltaPosition('y', deltaY, this.getYAxis());\n break;\n\n case 'bottom':\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n break;\n\n }\n\n break;\n\n case 'corners':\n default:\n\n if (this.handleSelected == 1) {\n\n pos.deltaPosition('x', deltaX, this.getXAxis());\n pos.deltaPosition('y', deltaY, this.getYAxis());\n } else if (this.handleSelected == 2) {\n\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n pos.deltaPosition('y', deltaY, this.getYAxis());\n } else if (this.handleSelected == 3) {\n\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n } else if (this.handleSelected == 4) {\n\n pos.deltaPosition('x', deltaX, this.getXAxis());\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n }\n\n break;\n\n }\n }\n\n this.redraw();\n this.changed();\n this.setHandles();\n\n return true;\n }\n\n /**\n * Places handles properly\n * @private\n * @return {Shape} The current shape\n */\n setHandles() {\n\n if (this.isLocked() || !this.isSelectable() && !this._staticHandles) {\n return;\n }\n\n if (!this.handlesInDom) {\n return;\n }\n\n var pos = this.computePosition(0);\n var pos2 = this.computePosition(1);\n\n var handles = this.getProp('handles');\n\n switch (handles.type) {\n\n case 'seamlessX':\n\n if (this.handles[1]) {\n this.handles[1].setAttribute('transform', 'translate(-10) translate(' + pos.x + ')');\n this.handles[1].setAttribute('height', Math.abs(pos2.y - pos.y));\n this.handles[1].setAttribute('y', Math.min(pos2.y, pos.y));\n }\n\n if (this.handles[2]) {\n this.handles[2].setAttribute('transform', 'translate(-10) translate(' + pos2.x + ')');\n this.handles[2].setAttribute('height', Math.abs(pos2.y - pos.y));\n this.handles[2].setAttribute('y', Math.min(pos2.y, pos.y));\n }\n\n break;\n\n case 'sides':\n\n if (this.handles.left) {\n this.handles.left.setAttribute('transform', 'translate(' + this.currentX + ' ' + (this.currentY + this.currentH / 2) + ')');\n }\n\n if (this.handles.right) {\n this.handles.right.setAttribute('transform', 'translate( ' + (this.currentX + this.currentW) + ' ' + (this.currentY + this.currentH / 2) + ')');\n }\n\n if (this.handles.top) {\n this.handles.top.setAttribute('transform', 'translate( ' + (this.currentX + this.currentW / 2) + ' ' + this.currentY + ')');\n }\n\n if (this.handles.bottom) {\n this.handles.bottom.setAttribute('transform', 'translate( ' + (this.currentX + this.currentW / 2) + ' ' + (this.currentY + this.currentH) + ')');\n }\n\n break;\n\n case 'corners':\n default:\n\n this.handles[1].setAttribute('x', pos.x);\n this.handles[1].setAttribute('y', pos.y);\n\n this.handles[2].setAttribute('x', pos2.x);\n this.handles[2].setAttribute('y', pos.y);\n\n this.handles[3].setAttribute('x', pos2.x);\n this.handles[3].setAttribute('y', pos2.y);\n\n this.handles[4].setAttribute('x', pos.x);\n this.handles[4].setAttribute('y', pos2.y);\n\n break;\n\n }\n }\n\n }\n\n exports.default = ShapeRectangle;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(3), __webpack_require__(6), __webpack_require__(21), __webpack_require__(11), __webpack_require__(14), __webpack_require__(22), __webpack_require__(23), __webpack_require__(5), __webpack_require__(24), __webpack_require__(25), __webpack_require__(26), __webpack_require__(27), __webpack_require__(16), __webpack_require__(17), __webpack_require__(28), __webpack_require__(29), __webpack_require__(30), __webpack_require__(1), __webpack_require__(31), __webpack_require__(32), __webpack_require__(50), __webpack_require__(33), __webpack_require__(34), __webpack_require__(12), __webpack_require__(35), __webpack_require__(36), __webpack_require__(18), __webpack_require__(37), __webpack_require__(38), __webpack_require__(39), __webpack_require__(2), __webpack_require__(40), __webpack_require__(41), __webpack_require__(42), __webpack_require__(43), __webpack_require__(44), __webpack_require__(46), __webpack_require__(47), __webpack_require__(48), __webpack_require__(49), __webpack_require__(4), __webpack_require__(13)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.core.js'), require('./graph.position.js'), require('./graph.legend.js'), require('./graph.axis.x.js'), require('./graph.axis.y.js'), require('./graph.axis.x.bar.js'), require('./graph.axis.x.time.js'), require('./series/graph.serie.line.js'), require('./series/graph.serie.line.3d.js'), require('./series/graph.serie.bar.js'), require('./series/graph.serie.box.js'), require('./series/graph.serie.line.colored.js'), require('./series/graph.serie.scatter.js'), require('./series/graph.serie.zone.js'), require('./series/graph.serie.zone.3d.js'), require('./series/graph.serie.densitymap.js'), require('./series/graph.serie.contour.js'), require('./shapes/graph.shape.js'), require('./shapes/graph.shape.areaundercurve.js'), require('./shapes/graph.shape.arrow.js'), require('./shapes/graph.shape.ellipse.js'), require('./shapes/graph.shape.label.js'), require('./shapes/graph.shape.polyline.js'), require('./shapes/graph.shape.line.js'), require('./shapes/graph.shape.nmrintegral.js'), require('./shapes/graph.shape.peakintegration2d.js'), require('./shapes/graph.shape.rect.js'), require('./shapes/graph.shape.cross.js'), require('./shapes/graph.shape.peakboundariescenter.js'), require('./shapes/graph.shape.html.js'), require('./plugins/graph.plugin.js'), require('./plugins/graph.plugin.drag.js'), require('./plugins/graph.plugin.shape.js'), require('./plugins/graph.plugin.selectScatter.js'), require('./plugins/graph.plugin.zoom.js'), require('./plugins/graph.plugin.timeseriemanager.js'), require('./plugins/graph.plugin.serielinedifference.js'), require('./plugins/graph.plugin.axissplitting.js'), require('./plugins/graph.plugin.makeTracesDifferent.js'), require('./plugins/graph.plugin.peakpicking.js'), require('./util/waveform.js'), require('./util/fit_lm.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphCore, global.graphPosition, global.graphLegend, global.graphAxisX, global.graphAxisY, global.graphAxisXBar, global.graphAxisXTime, global.graphSerieLine, global.graphSerieLine3d, global.graphSerieBar, global.graphSerieBox, global.graphSerieLineColored, global.graphSerieScatter, global.graphSerieZone, global.graphSerieZone3d, global.graphSerieDensitymap, global.graphSerieContour, global.graphShape, global.graphShapeAreaundercurve, global.graphShapeArrow, global.graphShapeEllipse, global.graphShapeLabel, global.graphShapePolyline, global.graphShapeLine, global.graphShapeNmrintegral, global.graphShapePeakintegration2d, global.graphShapeRect, global.graphShapeCross, global.graphShapePeakboundariescenter, global.graphShapeHtml, global.graphPlugin, global.graphPluginDrag, global.graphPluginShape, global.graphPluginSelectScatter, global.graphPluginZoom, global.graphPluginTimeseriemanager, global.graphPluginSerielinedifference, global.graphPluginAxissplitting, global.graphPluginMakeTracesDifferent, global.graphPluginPeakpicking, global.waveform, global.fit_lm);\n global.graph = mod.exports;\n }\n})(this, function (module, exports, _graphCore, _graphPosition, _graphLegend, _graphAxisX, _graphAxisY, _graphAxisXBar, _graphAxisXTime, _graphSerieLine, _graphSerieLine3d, _graphSerieBar, _graphSerieBox, _graphSerieLineColored, _graphSerieScatter, _graphSerieZone, _graphSerieZone3d, _graphSerieDensitymap, _graphSerieContour, _graphShape, _graphShapeAreaundercurve, _graphShapeArrow, _graphShapeEllipse, _graphShapeLabel, _graphShapePolyline, _graphShapeLine, _graphShapeNmrintegral, _graphShapePeakintegration2d, _graphShapeRect, _graphShapeCross, _graphShapePeakboundariescenter, _graphShapeHtml, _graphPlugin, _graphPluginDrag, _graphPluginShape, _graphPluginSelectScatter, _graphPluginZoom, _graphPluginTimeseriemanager, _graphPluginSerielinedifference, _graphPluginAxissplitting, _graphPluginMakeTracesDifferent, _graphPluginPeakpicking, _waveform, _fit_lm) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphCore2 = _interopRequireDefault(_graphCore);\n\n var _graphPosition2 = _interopRequireDefault(_graphPosition);\n\n var _graphLegend2 = _interopRequireDefault(_graphLegend);\n\n var _graphAxisX2 = _interopRequireDefault(_graphAxisX);\n\n var _graphAxisY2 = _interopRequireDefault(_graphAxisY);\n\n var _graphAxisXBar2 = _interopRequireDefault(_graphAxisXBar);\n\n var _graphAxisXTime2 = _interopRequireDefault(_graphAxisXTime);\n\n var _graphSerieLine2 = _interopRequireDefault(_graphSerieLine);\n\n var _graphSerieLine3d2 = _interopRequireDefault(_graphSerieLine3d);\n\n var _graphSerieBar2 = _interopRequireDefault(_graphSerieBar);\n\n var _graphSerieBox2 = _interopRequireDefault(_graphSerieBox);\n\n var _graphSerieLineColored2 = _interopRequireDefault(_graphSerieLineColored);\n\n var _graphSerieScatter2 = _interopRequireDefault(_graphSerieScatter);\n\n var _graphSerieZone2 = _interopRequireDefault(_graphSerieZone);\n\n var _graphSerieZone3d2 = _interopRequireDefault(_graphSerieZone3d);\n\n var _graphSerieDensitymap2 = _interopRequireDefault(_graphSerieDensitymap);\n\n var _graphSerieContour2 = _interopRequireDefault(_graphSerieContour);\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n var _graphShapeAreaundercurve2 = _interopRequireDefault(_graphShapeAreaundercurve);\n\n var _graphShapeArrow2 = _interopRequireDefault(_graphShapeArrow);\n\n var _graphShapeEllipse2 = _interopRequireDefault(_graphShapeEllipse);\n\n var _graphShapeLabel2 = _interopRequireDefault(_graphShapeLabel);\n\n var _graphShapePolyline2 = _interopRequireDefault(_graphShapePolyline);\n\n var _graphShapeLine2 = _interopRequireDefault(_graphShapeLine);\n\n var _graphShapeNmrintegral2 = _interopRequireDefault(_graphShapeNmrintegral);\n\n var _graphShapePeakintegration2d2 = _interopRequireDefault(_graphShapePeakintegration2d);\n\n var _graphShapeRect2 = _interopRequireDefault(_graphShapeRect);\n\n var _graphShapeCross2 = _interopRequireDefault(_graphShapeCross);\n\n var _graphShapePeakboundariescenter2 = _interopRequireDefault(_graphShapePeakboundariescenter);\n\n var _graphShapeHtml2 = _interopRequireDefault(_graphShapeHtml);\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n var _graphPluginDrag2 = _interopRequireDefault(_graphPluginDrag);\n\n var _graphPluginShape2 = _interopRequireDefault(_graphPluginShape);\n\n var _graphPluginSelectScatter2 = _interopRequireDefault(_graphPluginSelectScatter);\n\n var _graphPluginZoom2 = _interopRequireDefault(_graphPluginZoom);\n\n var _graphPluginTimeseriemanager2 = _interopRequireDefault(_graphPluginTimeseriemanager);\n\n var _graphPluginSerielinedifference2 = _interopRequireDefault(_graphPluginSerielinedifference);\n\n var _graphPluginAxissplitting2 = _interopRequireDefault(_graphPluginAxissplitting);\n\n var _graphPluginMakeTracesDifferent2 = _interopRequireDefault(_graphPluginMakeTracesDifferent);\n\n var _graphPluginPeakpicking2 = _interopRequireDefault(_graphPluginPeakpicking);\n\n var _waveform2 = _interopRequireDefault(_waveform);\n\n var _fit_lm2 = _interopRequireDefault(_fit_lm);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n // Corrent naming is important here !\n\n _graphCore2.default.registerConstructor('graph.position', _graphPosition2.default);\n\n _graphCore2.default.registerConstructor('graph.axis.x', _graphAxisX2.default);\n _graphCore2.default.registerConstructor('graph.axis.y', _graphAxisY2.default);\n _graphCore2.default.registerConstructor('graph.axis.x.bar', _graphAxisXBar2.default);\n _graphCore2.default.registerConstructor('graph.axis.x.time', _graphAxisXTime2.default);\n\n _graphCore2.default.registerConstructor('graph.serie.line', _graphSerieLine2.default);\n _graphCore2.default.registerConstructor('graph.serie.line.3d', _graphSerieLine3d2.default);\n _graphCore2.default.registerConstructor('graph.serie.line.color', _graphSerieLineColored2.default);\n _graphCore2.default.registerConstructor('graph.serie.contour', _graphSerieContour2.default);\n _graphCore2.default.registerConstructor('graph.serie.bar', _graphSerieBar2.default);\n _graphCore2.default.registerConstructor('graph.serie.box', _graphSerieBox2.default);\n _graphCore2.default.registerConstructor('graph.serie.scatter', _graphSerieScatter2.default);\n _graphCore2.default.registerConstructor('graph.serie.zone', _graphSerieZone2.default);\n _graphCore2.default.registerConstructor('graph.serie.zone.3d', _graphSerieZone3d2.default);\n _graphCore2.default.registerConstructor('graph.serie.densitymap', _graphSerieDensitymap2.default);\n\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_LINE, _graphSerieLine2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_LINE_3D, _graphSerieLine3d2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_LINE_COLORED, _graphSerieLineColored2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_CONTOUR, _graphSerieContour2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_BAR, _graphSerieBar2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_BOX, _graphSerieBox2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_SCATTER, _graphSerieScatter2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_ZONE, _graphSerieZone2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_ZONE_3D, _graphSerieZone3d2.default);\n _graphCore2.default.registerConstructor(_graphCore2.default.SERIE_DENSITYMAP, _graphSerieDensitymap2.default);\n\n //Graph.registerConstructor( \"graph.serie.line.broken\", GraphSerieLineBroken );\n\n _graphCore2.default.registerConstructor('graph.plugin.shape', _graphPluginShape2.default);\n _graphCore2.default.registerConstructor('graph.plugin.drag', _graphPluginDrag2.default);\n _graphCore2.default.registerConstructor('graph.plugin.zoom', _graphPluginZoom2.default);\n _graphCore2.default.registerConstructor('graph.plugin.selectScatter', _graphPluginSelectScatter2.default);\n _graphCore2.default.registerConstructor('graph.plugin.timeSerieManager', _graphPluginTimeseriemanager2.default);\n _graphCore2.default.registerConstructor('graph.plugin.serielinedifference', _graphPluginSerielinedifference2.default);\n _graphCore2.default.registerConstructor('graph.plugin.serieLineDifference', _graphPluginSerielinedifference2.default);\n _graphCore2.default.registerConstructor('graph.plugin.axissplitting', _graphPluginAxissplitting2.default);\n _graphCore2.default.registerConstructor('graph.plugin.makeTracesDifferent', _graphPluginMakeTracesDifferent2.default);\n _graphCore2.default.registerConstructor('graph.plugin.peakPicking', _graphPluginPeakpicking2.default);\n\n _graphCore2.default.registerConstructor('graph.shape', _graphShape2.default);\n _graphCore2.default.registerConstructor('graph.shape.areaundercurve', _graphShapeAreaundercurve2.default);\n _graphCore2.default.registerConstructor('graph.shape.arrow', _graphShapeArrow2.default);\n _graphCore2.default.registerConstructor('graph.shape.ellipse', _graphShapeEllipse2.default);\n _graphCore2.default.registerConstructor('graph.shape.label', _graphShapeLabel2.default);\n _graphCore2.default.registerConstructor('graph.shape.polyline', _graphShapePolyline2.default);\n _graphCore2.default.registerConstructor('graph.shape.line', _graphShapeLine2.default);\n _graphCore2.default.registerConstructor('graph.shape.nmrintegral', _graphShapeNmrintegral2.default);\n _graphCore2.default.registerConstructor('graph.shape.html', _graphShapeHtml2.default);\n _graphCore2.default.registerConstructor('graph.shape.peakintegration2d', _graphShapePeakintegration2d2.default);\n // Graph.registerConstructor( \"graph.shape.peakinterval\", GraphShapePeakInterval );\n // Graph.registerConstructor( \"graph.shape.peakinterval2\", GraphShapePeakInterval2 );\n // Graph.registerConstructor( \"graph.shape.rangex\", GraphShapeRangeX );\n _graphCore2.default.registerConstructor('graph.shape.rect', _graphShapeRect2.default);\n _graphCore2.default.registerConstructor('graph.shape.rectangle', _graphShapeRect2.default);\n _graphCore2.default.registerConstructor('graph.shape.cross', _graphShapeCross2.default);\n //Graph.registerConstructor( \"graph.shape.zoom2d\", GraphShapeZoom2D );\n _graphCore2.default.registerConstructor('graph.shape.peakboundariescenter', _graphShapePeakboundariescenter2.default);\n\n // Graph.registerConstructor( \"graph.toolbar\", GraphToolbar );\n _graphCore2.default.registerConstructor('graph.legend', _graphLegend2.default);\n _graphCore2.default.registerConstructor('graph.waveform', _waveform2.default);\n\n exports.default = _graphCore2.default;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = target[name];\n\t\t\t\tcopy = options[name];\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\ttarget[name] = extend(deep, clone, copy);\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\ttarget[name] = copy;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(6), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.position.js'), require('./graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphPosition, global.graphUtil);\n global.graphLegend = mod.exports;\n }\n})(this, function (module, exports, _graphPosition, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphPosition2 = _interopRequireDefault(_graphPosition);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Default legend configuration\n * @name LegendOptionsDefault\n * @object\n * @static\n * @prop {Boolean} frame - true to display a frame around the legend\n * @prop {Number} frameWidth - The width of the frame stroke\n * @prop {String} frameColor - The stroke color of the frame\n * @prop {String} backgroundColor - The background color of the frame\n * @prop {Number} paddingLeft - The left padding\n * @prop {Number} paddingRight - The right padding\n * @prop {Number} paddingTop - The top padding\n * @prop {Number} paddingBottom - The bottom padding\n * @prop {Boolean} shapesToggleable - true to toggle the shapes linked to serie with its status (shown or hidden)\n * @prop {Boolean} isSerieHideable - true to allow series to be hidden through the legend\n * @prop {Boolean} isSerieSelectable - true to allow series to be selected through the legend\n */\n var legendDefaults = {\n\n backgroundColor: 'rgba(255, 255, 255, 0.8)',\n frame: true,\n frameWidth: 1,\n frameColor: 'black',\n paddingTop: 10,\n paddingLeft: 10,\n paddingBottom: 10,\n paddingRight: 10,\n color: 'black',\n frameRounding: 0,\n\n movable: false,\n\n shapesToggleable: true,\n isSerieHideable: true,\n isSerieSelectable: true\n\n };\n\n /**\n * Legend constructor. You should not call this method directly, but rather use {@link graph.makeLegend}\n * @example var legend = graph.makeLegend( { backgroundColor: 'rgba(255, 255, 255, 0.8)',\n * frame: true,\n * frameWidth: 1,\n * frameColor: 'black',\n * paddingTop: 10,\n * paddingLeft: 10,\n * paddingBottom: 10,\n * paddingRight: 10,\n * frameRounding: 3,\n *\n * movable: false,\n *\n * shapesToggleable: true,\n * isSerieHideable: true,\n * isSerieSelectable: true\n * } );\n */\n class Legend {\n\n constructor(graph, options) {\n\n this.options = util.extend({}, legendDefaults, options);\n\n this.graph = graph;\n this.svg = document.createElementNS(this.graph.ns, 'g');\n this.subG = document.createElementNS(this.graph.ns, 'g');\n\n this.groups = [];\n this.rect = document.createElementNS(this.graph.ns, 'rect');\n this.rectBottom = document.createElementNS(this.graph.ns, 'rect');\n\n this.rect.setAttribute('x', 0);\n this.rect.setAttribute('y', 0);\n\n this.rectBottom.setAttribute('x', 0);\n this.rectBottom.setAttribute('y', 0);\n\n this.series = false;\n\n this.svg.setAttribute('display', 'none');\n this.pos = {\n x: undefined,\n y: undefined,\n transformX: 0,\n transformY: 0\n };\n\n this.setEvents();\n\n this.eyeId = util.guid();\n this.eyeCrossedId = util.guid();\n\n var eyeClosed = util.SVGParser('');\n // var eyeClosed = util.SVGParser('');\n\n /* var eyeClosed = document.createElementNS( this.graph.ns, \"symbol\");\n eyeClosed.setAttribute('id', this.eyeId );\n eyeClosed.setAttribute(\"viewBox\", '0 0 100 100');\n var rect = document.createElementNS( this.graph.ns, \"rect\" );\n rect.setAttribute('width', 100 );\n rect.setAttribute('height', 100 );\n rect.setAttribute('x', 0 );\n rect.setAttribute('y', 0 );\n rect.setAttribute('fill', 'black');\n eyeClosed.appendChild( rect );\n */\n var eye = util.SVGParser('');\n\n this.svg.appendChild(document.adoptNode(eye.documentElement.firstChild));\n this.svg.appendChild(document.adoptNode(eyeClosed.documentElement.firstChild));\n\n this.svg.appendChild(this.subG);\n\n this.applyStyle();\n }\n\n /**\n * Sets the position of the legend\n * @param {Position} position - the position to set the legend to versus the graph main axes ({@link Graph#getXAxis} and {@link Graph#getYAxis})\n * @param {String} alignToX - \"right\" or \"left\". References the legend right or left boundary using the position parameter\n * @param {String} alignToY - \"top\" or \"bottom\". References the legend top or bottom boundary using the position parameter\n * @example legend.setPosition( { x: 'max', y: '0px' }, 'right', 'top' ); // The rightmost side of the legend will at the maximum value of the axis, and will be positioned at the top\n */\n setPosition(position, alignToX, alignToY) {\n\n if (!position) {\n return;\n }\n\n this.position = position;\n this.alignToX = alignToX || 'left';\n this.alignToY = alignToY || 'top';\n }\n\n setDraggable(bln) {\n this.options.movable = bln;\n }\n\n setAutoPosition(position) {\n\n if (['bottom', 'left', 'top', 'right'].indexOf(position = position.toLowerCase()) > -1) {\n this.autoPosition = position;\n return this;\n }\n\n this.requireDelayedUpdate();\n this.autoPosition = false;\n }\n\n autoPosition() {\n return this.setAutoPosition(...arguments);\n }\n\n buildLegendBox() {\n\n var series = this.series || this.graph.getSeries(),\n posX = 0,\n posY = this.options.paddingTop;\n\n if (!this.autoPosition) {\n this.graph.graphingZone.appendChild(this.getDom());\n } else {\n this.graph.getDom().appendChild(this.getDom());\n }\n\n for (var i = 0, l = series.length; i < l; i++) {\n\n if (series[i].excludedFromLegend && !this.series) {\n continue;\n }\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n\n var bbox = getBBox(this.groups[i]);\n\n if (posX + bbox.width > this.graph.getDrawingWidth() - this.options.paddingRight) {\n posY += 16;\n posX = 0;\n }\n }\n\n this.groups[i].setAttribute('transform', 'translate( ' + posX + ', ' + posY + ')');\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n\n posX += bbox.width + 10;\n posY += 0;\n } else {\n\n posX = 0;\n posY += 16;\n }\n }\n\n var bbox = getBBox(this.subG);\n\n /* Independant on box position */\n this.width = bbox.width + this.options.paddingRight + this.options.paddingLeft;\n this.height = bbox.height + this.options.paddingBottom + this.options.paddingTop;\n\n this.rect.setAttribute('width', this.width);\n this.rect.setAttribute('height', this.height);\n this.rect.setAttribute('fill', 'none');\n this.rect.setAttribute('pointer-events', 'fill');\n\n this.rect.setAttribute('display', 'none');\n\n if (this.options.movable) {\n this.rectBottom.style.cursor = 'move';\n }\n\n this.rectBottom.setAttribute('width', this.width);\n this.rectBottom.setAttribute('height', this.height);\n\n this.rectBottom.setAttribute('x', bbox.x - this.options.paddingLeft);\n this.rectBottom.setAttribute('y', bbox.y - this.options.paddingTop);\n /* End independant on box position */\n\n this.position = this.position || {};\n\n switch (this.autoPosition) {\n\n case 'bottom':\n this.position.y = this.graph.getHeight() + 'px';\n // Try to center with respect to the drawing space, not the full graph. It's useful when the graph is fairly asymmetric (i.e. multiple axes on 1 side)\n this.position.x = (this.graph.drawingSpaceWidth - this.width) / 2 + this.graph.drawingSpaceMinX + 'px';\n this.alignToY = 'bottom';\n this.alignToX = false;\n break;\n\n case 'left':\n this.position.x = '6px';\n this.position.y = (this.graph.getHeight() - this.height) / 2 + 'px';\n this.alignToX = 'left';\n this.alignToY = false;\n break;\n\n case 'right':\n this.position.x = this.graph.getWidth() + 'px';\n this.position.y = (this.graph.getHeight() - this.height) / 2 + 'px';\n this.alignToX = 'right';\n this.alignToY = false;\n break;\n\n case 'top':\n this.position.x = (this.graph.drawingSpaceWidth - this.width) / 2 + this.graph.drawingSpaceMinX + 'px';\n this.position.y = '10px';\n this.alignToY = 'top';\n this.alignToX = false;\n break;\n }\n\n if (this.autoPosition) {\n switch (this.autoPosition) {\n\n case 'bottom':\n this.graph.options.paddingBottom = this.height + 10;\n break;\n\n case 'left':\n this.graph.options.paddingLeft = this.width + 5;\n break;\n\n case 'right':\n this.graph.options.paddingRight = this.width + 10;\n break;\n\n case 'top':\n this.graph.options.paddingTop = this.height + 14;\n break;\n }\n\n this.graph.updateGraphingZone();\n this.graph.getDrawingHeight();\n this.graph.getDrawingWidth();\n // this.graph.redraw( false );\n }\n\n this.bbox = bbox;\n }\n\n calculatePosition() {\n\n var pos = _graphPosition2.default.check(this.position);\n let poscoords = pos.compute(this.graph, this.graph.getXAxis(), this.graph.getYAxis());\n\n if (!poscoords) {\n return;\n }\n\n if (pos.y == 'max') {\n poscoords.y += this.graph.getPaddingTop();\n }\n\n if (pos.x == 'max') {\n poscoords.x -= this.graph.getPaddingRight();\n }\n\n if (this.alignToX == 'right') {\n poscoords.x -= this.width;\n poscoords.x -= this.bbox.x;\n } else {\n //poscoords.x -= this.bbox.x;\n }\n\n if (this.alignToY == 'bottom') {\n poscoords.y -= this.height;\n poscoords.y -= this.bbox.y;\n } else {\n\n poscoords.y -= this.bbox.y;\n }\n\n this.pos.transformX = poscoords.x;\n this.pos.transformY = poscoords.y;\n\n this._setPosition();\n }\n\n /**\n * Updates the legend position and content\n */\n update(onlyIfRequired) {\n\n if (this.graph.isDelayedUpdate() || !this._requiredUpdate && onlyIfRequired) {\n return;\n }\n\n this._requiredUpdate = false;\n\n var self = this;\n\n this.applyStyle();\n\n while (this.subG.hasChildNodes()) {\n this.subG.removeChild(this.subG.lastChild);\n }\n\n this.svg.insertBefore(this.rectBottom, this.svg.firstChild);\n\n var series = this.series || this.graph.getSeries(),\n line,\n text,\n g;\n\n if (series.length > 0) {\n this.svg.setAttribute('display', 'block');\n } else {\n return;\n }\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n var fullWidth = this.graph.getDrawingWidth();\n }\n\n var posX, posY;\n\n for (var i = 0, l = series.length; i < l; i++) {\n\n if (series[i].excludedFromLegend && !this.series) {\n continue;\n }\n\n (function (j) {\n\n var g,\n line,\n text,\n xPadding = 0;\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n var fullWidth = this.graph.getDrawingWidth();\n }\n\n g = document.createElementNS(self.graph.ns, 'g');\n var rect = document.createElementNS(self.graph.ns, 'rect');\n\n self.subG.appendChild(g);\n\n g.appendChild(rect);\n\n var line = series[j].getSymbolForLegend();\n var marker = series[j].getMarkerForLegend();\n var text = series[j].getTextForLegend();\n\n var dx = 35;\n\n if (this.isHideable()) {\n dx += 20;\n\n var eyeUse = document.createElementNS(self.graph.ns, 'use');\n eyeUse.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', '#' + (series[i].isShown() ? this.eyeId : this.eyeCrossedId));\n eyeUse.setAttribute('width', 15);\n eyeUse.setAttribute('height', 15);\n eyeUse.setAttribute('x', 35);\n eyeUse.setAttribute('y', -8);\n\n eyeUse.addEventListener('click', function (e) {\n e.stopPropagation();\n\n var id;\n if (series[j].isShown()) {\n series[j].hide(self.options.hideShapesOnHideSerie);\n id = self.eyeCrossedId;\n } else {\n series[j].show(self.options.hideShapesOnHideSerie);\n id = self.eyeId;\n }\n\n eyeUse.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', '#' + id);\n });\n }\n\n text.setAttribute('transform', 'translate(' + dx + ', 3)');\n\n text.setAttribute('color', this.options.color);\n\n if (line) {\n g.appendChild(line);\n }\n\n if (series[j].getType() == 'scatter') {\n line.setAttribute('transform', 'translate( 20, 0 )');\n }\n\n if (marker) {\n g.appendChild(marker);\n }\n\n if (eyeUse) {\n g.appendChild(eyeUse);\n }\n\n g.appendChild(text);\n\n var bbox = getBBox(g);\n\n rect.setAttribute('x', bbox.x);\n rect.setAttribute('y', bbox.y);\n rect.setAttribute('width', bbox.width);\n rect.setAttribute('height', bbox.height);\n rect.setAttribute('fill', 'none');\n rect.setAttribute('pointer-events', 'fill');\n\n self.groups[j] = g;\n\n g.addEventListener('click', function (e) {\n\n var serie = series[j];\n\n if (!serie.isShown()) {\n return;\n }\n\n if (self.isSelectable() && !serie.isSelected()) {\n\n self.graph.selectSerie(serie);\n } else {\n\n self.graph.unselectSerie(serie);\n }\n\n e.preventDefault();\n e.stopPropagation();\n });\n }).call(this, i);\n }\n\n this.svg.appendChild(this.rect);\n this.buildLegendBox();\n this.calculatePosition();\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be hidden or not\n */\n isHideable() {\n return this.options.isSerieHideable;\n }\n\n notHideable() {\n this.options.isSerieHideable = false;\n return this;\n }\n\n hideable() {\n this.options.isSerieHideable = true;\n return this;\n }\n\n set seriesHideable(hideable) {\n this.options.isSerieHideable = !!hideable;\n }\n\n /**\n * @type {Boolean}\n */\n get seriesHideable() {\n return this.options.isSerieHideable;\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be selected or not\n */\n isSelectable() {\n return this.options.isSerieSelectable;\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be t or not\n */\n isToggleShapes() {\n return this.options.shapesToggleable;\n }\n\n /**\n * @return {SVGGroupElement} The SVG group element wrapping the legend\n */\n getDom() {\n return this.svg;\n }\n\n setEvents() {\n\n var self = this;\n var pos = this.pos;\n\n var mousedown = function (e) {\n\n e.stopPropagation();\n console.log('down');\n if (self.options.movable) {\n pos.x = e.clientX;\n pos.y = e.clientY;\n\n e.preventDefault();\n self.mousedown = true;\n self.graph.elementMoving(self);\n\n self.rect.setAttribute('display', 'block');\n }\n };\n\n var mousemove = function (e) {\n self.handleMouseMove(e);\n };\n\n this.svg.addEventListener('mousedown', mousedown);\n this.svg.addEventListener('click', function (e) {\n e.stopPropagation();\n });\n this.svg.addEventListener('dblclick', function (e) {\n e.stopPropagation();\n });\n this.svg.addEventListener('mousemove', mousemove);\n //this.rect.addEventListener( 'mousemove', mousemove );\n }\n\n handleMouseUp(e) {\n\n e.stopPropagation();\n e.preventDefault();\n this.mousedown = false;\n this.rect.setAttribute('display', 'none');\n this.graph.elementMoving(false);\n }\n\n handleMouseMove(e) {\n\n if (!this.mousedown) {\n return;\n }\n\n var pos = this.pos;\n\n var deltaX = e.clientX - pos.x;\n var deltaY = e.clientY - pos.y;\n\n pos.transformX += deltaX;\n pos.transformY += deltaY;\n\n pos.x = e.clientX;\n pos.y = e.clientY;\n\n e.stopPropagation();\n e.preventDefault();\n\n this._setPosition();\n }\n\n _setPosition() {\n\n var pos = this.pos;\n if (!isNaN(pos.transformX) && !isNaN(pos.transformY) && pos.transformX !== false && pos.transformY !== false) {\n this.svg.setAttribute('transform', 'translate(' + pos.transformX + ', ' + pos.transformY + ')');\n }\n }\n\n /**\n * Re-applies the legend style\n */\n applyStyle() {\n\n if (this.options.frame) {\n this.rectBottom.setAttribute('stroke', this.options.frameColor);\n this.rectBottom.setAttribute('stroke-width', this.options.frameWidth + 'px');\n this.rectBottom.setAttribute('rx', this.options.frameRounding);\n this.rectBottom.setAttribute('ry', this.options.frameRounding);\n }\n\n this.rectBottom.setAttribute('fill', this.options.backgroundColor);\n }\n\n /**\n * Re-applies the legend style\n * @param {...(GraphSerie|GraphSerie[])} a serie or an array of series\n */\n fixSeries() {\n var series = [];\n\n if (arguments[0] === false) {\n this.series = false;\n this.update();\n return;\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n if (Array.isArray(arguments[i])) {\n series = series.concat(arguments[i]);\n } else {\n series.push(arguments[i]);\n }\n }\n\n this.update();\n this.series = series;\n }\n\n fixSeriesAdd(serie) {\n this.series = this.series || [];\n this.series.push(serie);\n }\n\n requireDelayedUpdate() {\n this._requiredUpdate = true;\n }\n\n }\n\n function getBBox(svgElement) {\n // Firefox throws when trying to call getBBox() on elements\n // that are not yet rendered.\n try {\n return svgElement.getBBox();\n } catch (e) {\n return {\n height: 0,\n width: 0,\n x: 0,\n y: 0\n };\n }\n }\n\n exports.default = Legend;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(11)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.axis.x.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphAxisX);\n global.graphAxisXBar = mod.exports;\n }\n})(this, function (module, exports, _graphAxisX) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphAxisX2 = _interopRequireDefault(_graphAxisX);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Generic constructor of a y axis\n * @class AxisXBar\n * @augments Axis\n */\n class AxisXBar extends _graphAxisX2.default {\n\n constructor(graph, topbottom, options = {}) {\n super(graph, topbottom, options);\n }\n\n /**\n * @param {Object[]} categories - Categories array\n * @param {(String|Number)} categories[].title - The title of the category (to be dispalyed)\n * @param {(String|Number)} categories[].name - The name of the category (to indentify series)\n * @returns {AxisBar} The current axis instance\n */\n set categories(categories) {\n this._barCategories = categories;\n return this;\n }\n\n draw() {\n\n var self = this,\n tickLabel,\n elements = this._barCategories;\n\n this.forceMin(0);\n this.forceMax(1);\n\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n\n if (!elements) {\n return;\n }\n\n if (!Array.isArray(elements)) {\n elements = [elements];\n }\n\n // this.drawInit();\n\n //var widthPerElement = width / elements.length;\n for (var i = 0; i <= elements.length; i++) {\n this.drawTick(i / elements.length, 2);\n\n if (i < elements.length) {\n tickLabel = this.nextTickLabel(function (tickLabel) {\n\n tickLabel.setAttribute('y', (self.top ? -1 : 1) * ((self.options.tickPosition == 1 ? 8 : 20) + (self.top ? 10 : 0)));\n tickLabel.setAttribute('text-anchor', 'middle');\n if (self.getTicksLabelColor() !== 'black') {\n tickLabel.setAttribute('fill', self.getTicksLabelColor());\n }\n tickLabel.style.dominantBaseline = 'hanging';\n });\n\n tickLabel.setAttribute('x', this.getPos((i + 0.5) / elements.length));\n tickLabel.textContent = elements[i].title;\n }\n }\n\n this.drawSpecifics();\n return this;\n }\n\n /**\n * Sets the series automatically\n * @returns {AxisBar} The current axis instance\n */\n autoSeries() {\n\n let series = [];\n for (let serie of this.graph.series) {\n if (serie.getXAxis() == this) {\n series.push(serie);\n }\n }\n\n this.setSeries(...series);\n return this;\n }\n\n /**\n * Sets the series that should belong to the axis\n * @param {...(Series|Number|String)} series - List of series identified either by their instance, or their index (string or number)\n * @returns {AxisBar} The current axis instance\n */\n setSeries() {\n\n var self = this;\n this.series = arguments;\n\n Array.prototype.map.call(this.series, function (serie, index) {\n\n if (!(typeof serie == 'object')) {\n serie = self.graph.getSerie(serie);\n }\n\n if (serie.setCategoryConfig) {\n serie.setCategoryConfig(index, self._barCategories, self.series.length);\n }\n });\n\n this._getUsedCategories();\n\n return this;\n }\n\n _getUsedCategories() {\n\n let categories = {},\n total = 0;\n\n Array.prototype.map.call(this.series, serie => {\n let usedCategories = serie.getUsedCategories();\n for (let cat of usedCategories) {\n\n if (!categories.hasOwnProperty(cat)) {\n categories[cat] = 1;\n total += 1;\n }\n\n categories[cat]++;\n total++;\n }\n });\n\n let accumulator = 0;\n for (let i in categories) {\n let temp = categories[i];\n categories[i] = accumulator;\n accumulator += temp;\n }\n\n let dispatchedCategories = {};\n\n Array.prototype.map.call(this.series, serie => {\n\n let scategories = serie.getUsedCategories(),\n indices = {};\n\n scategories.forEach(cat => {\n\n dispatchedCategories[cat] = dispatchedCategories[cat] || 0.5;\n indices[cat] = (categories[cat] + dispatchedCategories[cat]) / total;\n dispatchedCategories[cat]++;\n });\n\n serie.setDataIndices(indices, total);\n });\n }\n\n getType() {\n return 'category';\n }\n }\n\n exports.default = AxisXBar;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(9), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.axis.js'), require('./graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphAxis, global.graphUtil);\n global.graphAxisXTime = mod.exports;\n }\n})(this, function (module, exports, _graphAxis, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphAxis2 = _interopRequireDefault(_graphAxis);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n var axisFormat = [{\n\n threshold: 20,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 seconds\n increment: 1,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n }, {\n\n threshold: 50,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 2 seconds\n increment: 2,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n }, {\n\n threshold: 100,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 5 seconds\n increment: 5,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n }, {\n\n threshold: 600,\n increments: {\n\n 1: {\n increment: 10, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 seconds\n increment: 30,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n }, { // One day\n\n threshold: 1000,\n increments: {\n\n 1: { // 1h\n increment: 1,\n unit: 'h',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 minutes\n increment: 10,\n unit: 'i',\n format: 'MM\"min\"'\n }\n }\n }, { // One day\n\n threshold: 1500,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 1,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 3000,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 2,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 8000,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 10,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 26400,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 20,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 86400,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 1,\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 200000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 2, // One day on the first axis\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 6, // One day on the first axis\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 1400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 12, // One day on the first axis\n unit: 'h',\n format: 'HH\"h\"MM'\n }\n }\n }, { // One day\n\n threshold: 6400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n }, { // One day\n\n threshold: 12400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 2, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n }, { // One day\n\n threshold: 86400000 * 0.5,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 7, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n }, { // One day\n\n threshold: 86400000 * 0.8,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 15, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n }, { // One month\n\n threshold: 86400000 * 1,\n increments: {\n\n 1: {\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 3, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n }, { // One month\n\n threshold: 86400000 * 2,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 4, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n }, { // One month\n\n threshold: 86400000 * 10,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 6, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n }, { // One month\n\n threshold: 86400000 * 12,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 1, // One day on the first axis\n unit: 'y',\n format: 'yyyy'\n }\n }\n }];\n\n /*\n * Date Format 1.2.3\n * (c) 2007-2009 Steven Levithan \n * MIT license\n *\n * Includes enhancements by Scott Trenda \n * and Kris Kowal \n *\n * Accepts a date, a mask, or a date and a mask.\n * Returns a formatted version of the given date.\n * The date defaults to the current date/time.\n * The mask defaults to dateFormat.masks.default.\n */\n\n var dateFormat = function () {\n var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\\1?|[WLloSZ]|\"[^\"]*\"|'[^']*'/g,\n timezone = /\\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\\d{4})?)\\b/g,\n timezoneClip = /[^-+\\dA-Z]/g,\n pad = function (val, len) {\n val = String(val);\n len = len || 2;\n while (val.length < len) val = '0' + val;\n return val;\n },\n getWeek = function (d, f) {\n var onejan = new Date(d[f + 'FullYear'](), 0, 1);\n return Math.ceil(((d - onejan) / 86400000 + onejan[f + 'Day']() + 1) / 7);\n };\n\n // Regexes and supporting functions are cached through closure\n return function (date, mask, utc) {\n var dF = dateFormat;\n\n // You can't provide utc if you skip other args (use the \"UTC:\" mask prefix)\n if (arguments.length == 1 && Object.prototype.toString.call(date) == '[object String]' && !/\\d/.test(date)) {\n mask = date;\n date = undefined;\n }\n\n // Passing date through Date applies Date.parse, if necessary\n date = date ? new Date(date) : new Date();\n if (isNaN(date)) throw SyntaxError('invalid date:' + date);\n\n mask = String(dF.masks[mask] || mask || dF.masks.default);\n\n // Allow setting the utc argument via the mask\n if (mask.slice(0, 4) == 'UTC:') {\n mask = mask.slice(4);\n utc = true;\n }\n\n var _ = utc ? 'getUTC' : 'get',\n d = date[_ + 'Date'](),\n D = date[_ + 'Day'](),\n m = date[_ + 'Month'](),\n y = date[_ + 'FullYear'](),\n H = date[_ + 'Hours'](),\n M = date[_ + 'Minutes'](),\n s = date[_ + 'Seconds'](),\n L = date[_ + 'Milliseconds'](),\n o = utc ? 0 : date.getTimezoneOffset(),\n flags = {\n d: d,\n dd: pad(d),\n ddd: dF.i18n.dayNames[D],\n dddd: dF.i18n.dayNames[D + 7],\n m: m + 1,\n mm: pad(m + 1),\n mmm: dF.i18n.monthNames[m],\n mmmm: dF.i18n.monthNames[m + 12],\n yy: String(y).slice(2),\n yyyy: y,\n h: H % 12 || 12,\n hh: pad(H % 12 || 12),\n H: H,\n HH: pad(H),\n M: M,\n MM: pad(M),\n s: s,\n ss: pad(s),\n l: pad(L, 3),\n L: pad(L > 99 ? Math.round(L / 10) : L),\n t: H < 12 ? 'a' : 'p',\n tt: H < 12 ? 'am' : 'pm',\n T: H < 12 ? 'A' : 'P',\n TT: H < 12 ? 'AM' : 'PM',\n Z: utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),\n o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),\n S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],\n W: getWeek(date, _)\n };\n\n return mask.replace(token, function ($0) {\n return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);\n });\n };\n }();\n\n // Some common format strings\n dateFormat.masks = {\n 'default': 'ddd mmm dd yyyy HH:MM:ss',\n shortDate: 'm/d/yy',\n mediumDate: 'mmm d, yyyy',\n longDate: 'mmmm d, yyyy',\n fullDate: 'dddd, mmmm d, yyyy',\n shortTime: 'h:MM TT',\n mediumTime: 'h:MM:ss TT',\n longTime: 'h:MM:ss TT Z',\n isoDate: 'yyyy-mm-dd',\n isoTime: 'HH:MM:ss',\n isoDateTime: \"yyyy-mm-dd'T'HH:MM:ss\",\n isoUtcDateTime: \"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'\"\n };\n\n // Internationalization strings\n dateFormat.i18n = {\n dayNames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n };\n\n /* END DATE FORMAT */\n\n function getClosestIncrement(value, basis) {\n return Math.round(value / basis) * basis;\n }\n\n function roundDate(date, format) {\n\n switch (format.unit) {\n\n case 's':\n // Round at n hour\n\n date.setSeconds(getClosestIncrement(date.getSeconds(), format.increment));\n date.setMilliseconds(0);\n\n break;\n\n case 'i':\n // Round at n hour\n\n date.setMinutes(getClosestIncrement(date.getMinutes(), format.increment));\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'h':\n // Round at n hour\n\n date.setHours(getClosestIncrement(date.getHours(), format.increment));\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'd':\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n\n date.setDate(getClosestIncrement(date.getDate(), format.increment));\n\n break;\n\n case 'm':\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n\n date.setMonth(getClosestIncrement(date.getMonth(), format.increment));\n\n break;\n\n case 'y':\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n date.setMonth(0);\n\n //date.setYear( getClosest( date.getDate(), format.increment ) );\n\n break;\n\n default:\n {\n throw new Error('Date format not recognized');\n }\n }\n\n return date;\n }\n\n function incrementDate(date, format) {\n\n switch (format.unit) {\n\n case 's':\n\n date.setSeconds(date.getSeconds() + format.increment);\n date.setMilliseconds(0);\n\n break;\n\n case 'i':\n\n date.setMinutes(date.getMinutes() + format.increment);\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'h':\n // Round at n hour\n\n date.setHours(date.getHours() + format.increment);\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'd':\n\n date.setDate(date.getDate() + format.increment);\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n\n break;\n\n case 'm':\n\n date.setMonth(date.getMonth() + format.increment);\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n\n break;\n\n case 'y':\n\n date.setFullYear(date.getFullYear() + format.increment);\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n date.setMonth(0);\n\n break;\n\n default:\n {\n throw new Error('Date format not recognized');\n }\n }\n\n return date;\n }\n\n function getGroup(axis, level, number) {\n\n if (axis.groups[level][number]) {\n axis.groups[level][number].group.setAttribute('display', 'block');\n return axis.groups[level][number];\n }\n\n var g = {\n\n group: document.createElementNS(axis.graph.ns, 'g'),\n text: document.createElementNS(axis.graph.ns, 'text')\n };\n\n var line = document.createElementNS(axis.graph.ns, 'line');\n\n line.setAttribute('stroke', 'black');\n line.setAttribute('y1', 0);\n switch (level) {\n\n case 2:\n\n line.setAttribute('y2', 6);\n g.text.setAttribute('y', 15);\n\n g.line = line;\n\n g.group.appendChild(g.line);\n break;\n\n default:\n case 1:\n\n line.setAttribute('y2', 20);\n g.text.setAttribute('y', 10);\n\n g.line1 = line;\n g.line2 = line.cloneNode();\n\n g.group.appendChild(g.line1);\n g.group.appendChild(g.line2);\n\n break;\n }\n\n g.text.setAttribute('text-anchor', 'middle');\n g.text.setAttribute('dominant-baseline', 'middle');\n\n g.group.appendChild(g.text);\n\n axis.getWrapper(level).appendChild(g.group);\n\n return axis.groups[level][number] = g;\n }\n\n function hideGroups(axis, level, from) {\n\n for (; from < axis.groups[level].length; from++) {\n\n hideGroup(axis.groups[level][from]);\n }\n }\n\n function hideGroup(group) {\n group.group.setAttribute('display', 'none');\n }\n\n function getDateText(date, format) {\n\n return dateFormat(date, format);\n }\n\n function renderGroup(level, group, text, minPx, maxPx, x1, x2) {\n\n switch (level) {\n\n case 2:\n\n if (x1 < minPx || x1 > maxPx) {\n\n hideGroup(group);\n return;\n }\n\n group.line.setAttribute('x1', x1);\n group.line.setAttribute('x2', x1);\n group.text.setAttribute('x', x1);\n group.text.textContent = text;\n\n break;\n\n default:\n case 1:\n\n var x1B = Math.max(minPx, Math.min(maxPx, x1)),\n x2B = Math.max(minPx, Math.min(maxPx, x2));\n\n if (isNaN(x2B) || isNaN(x1B)) {\n return;\n }\n\n group.line1.setAttribute('x1', x1B);\n group.line2.setAttribute('x1', x2B);\n\n group.line1.setAttribute('x2', x1B);\n group.line2.setAttribute('x2', x2B);\n\n group.text.setAttribute('x', (x1B + x2B) / 2);\n\n while (text.length * 8 > x2B - x1B) {\n\n text = text.substr(0, text.length - 2) + '.';\n\n if (text.length == 1) {\n text = '';\n break;\n }\n }\n\n group.text.textContent = text;\n break;\n }\n }\n\n class GraphTimeAxis extends _graphAxis2.default {\n\n constructor() {\n\n super(...arguments);\n }\n\n init(graph, options) {\n\n super.init(graph, options);\n\n this.wrapper = {\n 1: document.createElementNS(graph.ns, 'g'),\n 2: document.createElementNS(graph.ns, 'g')\n };\n this.groups = {\n 1: [],\n 2: []\n };\n\n var rect = document.createElementNS(graph.ns, 'rect');\n rect.setAttribute('fill', '#c0c0c0');\n rect.setAttribute('stroke', '#808080');\n rect.setAttribute('height', '20');\n rect.setAttribute('x', '0');\n rect.setAttribute('y', '0');\n\n this.rect = rect;\n\n this.wrapper[1].appendChild(this.rect);\n\n // this.init( graph, options );\n\n this.group.appendChild(this.wrapper[1]);\n this.group.appendChild(this.wrapper[2]);\n\n this.wrapper[1].setAttribute('transform', 'translate( 0, 25 )');\n this.wrapper[2].setAttribute('transform', 'translate( 0, 00 )');\n }\n\n draw() {\n // Redrawing of the axis\n\n //this.drawInit();\n\n this.cacheCurrentMax();\n this.cacheCurrentMin();\n\n if (this.currentAxisMin == undefined || this.currentAxisMax == undefined) {\n this.setMinMaxToFitSeries(true); // We reset the min max as a function of the series\n }\n\n this.line.setAttribute('x1', this.getMinPx());\n this.line.setAttribute('x2', this.getMaxPx());\n this.line.setAttribute('y1', 0);\n this.line.setAttribute('y2', 0);\n\n var widthPx = this.maxPx - this.minPx;\n var widthTime = this.getCurrentInterval();\n\n var timePerPx = widthTime / widthPx;\n\n var maxVal = this.getCurrentMax();\n var minVal = this.getCurrentMin();\n\n this.rect.setAttribute('width', widthPx);\n this.rect.setAttribute('x', this.minPx);\n\n if (!maxVal || !minVal) {\n return 0;\n }\n\n var currentFormat;\n\n for (i = 0; i < axisFormat.length; i++) {\n\n if (axisFormat[i].threshold > timePerPx) {\n currentFormat = axisFormat[i];\n\n break;\n }\n }\n\n if (!currentFormat) {\n currentFormat = axisFormat[axisFormat.length - 1];\n }\n\n var xVal1,\n xVal2,\n level = 0,\n dateFirst,\n currentDate,\n text,\n group,\n i;\n\n for (level = 1; level <= 2; level++) {\n\n if (!util.isNumeric(minVal)) {\n hideGroups(this, level, 0);\n break;\n }\n\n dateFirst = new Date(minVal);\n\n currentDate = roundDate(dateFirst, currentFormat.increments[level]);\n\n i = 0;\n\n do {\n /** @ignore */\n text = getDateText(currentDate, currentFormat.increments[level].format);\n group = getGroup(this, level, i);\n\n xVal1 = this.getPx(currentDate.getTime());\n currentDate = incrementDate(currentDate, currentFormat.increments[level]);\n xVal2 = this.getPx(currentDate.getTime());\n\n renderGroup(level, group, text, this.getMinPx(), this.getMaxPx(), xVal1, xVal2);\n\n i++;\n if (i > 100) {\n break;\n }\n } while (currentDate.getTime() < maxVal);\n\n hideGroups(this, level, i);\n }\n }\n\n isX() {\n return true;\n }\n\n getWrapper(level) {\n return this.wrapper[level];\n }\n\n setShift(shift) {\n this.shift = shift;\n this.group.setAttribute('transform', 'translate(0 ' + (this.top ? this.shift : this.graph.getDrawingHeight() - this.shift) + ')');\n }\n\n getAxisPosition() {\n return 60;\n }\n\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n var maxPx = interval * this.options.span[1] + this.minPx;\n var minPx = interval * this.options.span[0] + this.minPx;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n }\n\n }\n\n exports.default = GraphTimeAxis;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(3), __webpack_require__(5), __webpack_require__(4), __webpack_require__(15), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.core.js'), require('./graph.serie.line.js'), require('../util/waveform.js'), require('../mixins/graph.mixin.serie3d.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphCore, global.graphSerieLine, global.waveform, global.graphMixinSerie3d, global.graphUtil);\n global.graphSerieLine3d = mod.exports;\n }\n})(this, function (module, exports, _graphCore, _graphSerieLine, _waveform, _graphMixinSerie3d, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphCore2 = _interopRequireDefault(_graphCore);\n\n var _graphSerieLine2 = _interopRequireDefault(_graphSerieLine);\n\n var _waveform2 = _interopRequireDefault(_waveform);\n\n var _graphMixinSerie3d2 = _interopRequireDefault(_graphMixinSerie3d);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Serie line with 3D projection\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends SerieLine\n */\n class SerieLine3D extends _graphSerieLine2.default {\n\n static defaults() {\n return {\n zpos: 0\n };\n }\n constructor(graph, name, options) {\n super(...arguments);\n }\n\n /**\n * Sets the z-position\n * @memberof SerieLine3D\n * @param {Number} zPos - The position in the z axis\n */\n setZPos(zPos) {\n this.options.zpos = zPos;\n return this;\n }\n\n setz() {\n return this.setZPos(...arguments);\n }\n }\n\n util.mix(SerieLine3D, _graphMixinSerie3d2.default);\n exports.default = SerieLine3D;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0), __webpack_require__(5), __webpack_require__(10)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'), require('./graph.serie.line.js'), require('../mixins/graph.mixin.errorbars.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil, global.graphSerieLine, global.graphMixinErrorbars);\n global.graphSerieBar = mod.exports;\n }\n})(this, function (module, exports, _graphUtil, _graphSerieLine, _graphMixinErrorbars) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphSerieLine2 = _interopRequireDefault(_graphSerieLine);\n\n var _graphMixinErrorbars2 = _interopRequireDefault(_graphMixinErrorbars);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n /**\n * Represents a bar serie.\n Needs to be used exclusively with a bar axis ({@link AxisXBar}).\n Supports error bars, line color, line width, fill color, fill opacity.\n * @example graph.newSerie(\"serieName\", { fillColor: 'red', fillOpacity: 0.2 }, \"bar\" );\n * @extends Serie\n */\n class SerieBar extends _graphSerieLine2.default {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.pathDom = document.createElementNS(this.graph.ns, 'path');\n this.groupMain.appendChild(this.pathDom);\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n lineWidth: this.options.lineWidth,\n fillColor: this.options.fillColor,\n fillOpacity: this.options.fillOpacity,\n markers: this.options.markers\n };\n }\n\n /**\n * Sets the data of the bar serie\n * @param {Object} data\n * @example serie.setData( { \"cat1\": val1, \"cat2\": val2, \"cat4\": val4 } );\n * @return {SerieBar} The current serie instance\n */\n setData(data) {\n\n this.data = data;\n this.minY = Number.MAX_SAFE_INTEGER;\n this.maxY = Number.MIN_SAFE_INTEGER;\n\n for (var i in this.data) {\n this._checkY(this.data[i]);\n }\n\n return this;\n }\n\n /**\n * Sets the fill color\n */\n setFillColor(fillColor, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].fillColor = fillColor;\n\n if (applyToSelected) {\n this.setFillColor(fillColor, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n /**\n * Returns the fill color\n */\n getFillColor(selectionType) {\n return this.getStyle(selectionType).fillColor;\n }\n\n /*\n * @memberof SerieBar\n */\n setFillOpacity(opacity, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].fillOpacity = opacity;\n\n if (applyToSelected) {\n this.setLineWidth(opacity, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getFillOpacity(selectionType) {\n\n return this.getStyle(selectionType).fillOpacity || 1;\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n */\n applyLineStyles() {\n this.applyLineStyle(this.pathDom);\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieBar\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n } else {\n line.removeAttribute('stroke-dasharray');\n }\n line.setAttribute('fill', this.getFillColor());\n line.setAttribute('fill-opacity', this.getFillOpacity() || 1);\n }\n\n draw() {\n\n var path = '';\n var categoryNumber, position;\n\n if (this.error) {\n this.errorDrawInit();\n }\n\n for (var i in this.data) {\n\n if (!this.categoryIndices[i]) {\n continue;\n }\n\n path += 'M ' + this.getXAxis().getPos(this.categoryIndices[i]) + ' ' + this.getYAxis().getPos(0) + ' V ' + this.getYAxis().getPos(this.data[i]) + ' h ' + this.getXAxis().getDeltaPx(1 / this.nbCategories) + ' V ' + this.getYAxis().getPos(0);\n\n if (this.error) {\n this.errorAddPointBarChart(i, this.data[i], this.getXAxis().getPos(this.categoryIndices[i] + 0.5 / this.nbCategories), this.getYAxis().getPos(this.data[i]));\n }\n }\n\n if (this.error) {\n this.errorDraw();\n }\n\n this.pathDom.setAttribute('d', path);\n this.applyLineStyles();\n }\n\n // Markers now allowed\n setMarkers() {}\n\n getUsedCategories() {\n return Object.keys(this.data);\n }\n\n }\n\n exports.default = SerieBar;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(8), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.serie.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphSerie, global.graphUtil);\n global.graphSerieBox = mod.exports;\n }\n})(this, function (module, exports, _graphSerie, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphSerie2 = _interopRequireDefault(_graphSerie);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * @static\n * @extends Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\n class SerieBox extends _graphSerie2.default {\n\n static default() {\n return {\n orientation: 'y',\n maxBoxWidth: 20,\n\n defaultStyle: {\n\n meanLineColor: 'rgb( 100, 0, 0 )',\n meanLineWidth: 2,\n\n boxAboveLineWidth: 1,\n boxAboveLineColor: 'rgb( 0, 0, 0 )',\n boxAboveFillColor: 'transparent',\n boxAboveFillOpacity: 1,\n boxBelowLineWidth: 1,\n boxBelowLineColor: 'rgb( 0, 0, 0 )',\n boxBelowFillColor: 'transparent',\n boxBelowFillOpacity: 1,\n\n barAboveLineColor: 'rgba( 0, 0, 0, 1 )',\n barAboveLineWidth: 1,\n barBelowLineColor: 'rgba( 0, 0, 0, 1 )',\n barBelowLineWidth: 1,\n\n outlierLineWidth: 1,\n outlierLineColor: 'rgb( 255, 255, 255 )',\n outlierFillColor: 'rgb( 0, 0, 0 )',\n outlierFillOpacity: 1\n }\n };\n }\n\n constructor(graph, name, options) {\n\n super(...arguments);\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.pathDom = document.createElementNS(this.graph.ns, 'path');\n this.groupMain.appendChild(this.pathDom);\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = this.options.defaultStyle;\n }\n\n /**\n * Sets the data of the bar serie\n * @param {Object} data\n * @example serie.setData( [ { x: 'cat', Q2: valMean, Q1: valBoxMin, Q3: valBoxMax, whiskers: [ val1, val2 ], outliers: [ ...yList ] } ] );\n * @return {SerieBar} The current serie instance\n */\n setData(data, noRescale) {\n\n this.data = data;\n\n if (!Array.isArray(data)) {\n return;\n }\n\n let axisref, axisval, methodref, methodval, blnX;\n\n if (this.options.orientation == 'y') {\n axisref = this.getXAxis();\n axisval = this.getYAxis();\n methodref = this._checkX.bind(this);\n methodval = this._checkY.bind(this);\n blnX = true;\n\n this.minY = data[0].Q2;\n this.maxY = data[0].Q2;\n this.maxX = data[0].x;\n this.minX = data[0].x;\n } else {\n axisref = this.getYAxis();\n axisval = this.getXAxis();\n methodref = this._checkY.bind(this);\n methodval = this._checkX.bind(this);\n blnX = false;\n\n this.minX = data[0].Q2;\n this.maxX = data[0].Q2;\n this.maxY = data[0].y;\n this.minY = data[0].y;\n }\n\n if (noRescale) {\n methodref = function () {};\n methodval = function () {};\n }\n\n if (!axisref || !axisval) {\n (0, _graphUtil.throwError)('Error in setting data of the box serie. The X and Y axes must be set beforehand');\n }\n\n for (var i in this.data) {\n\n if (blnX) {\n methodref(this.data[i].x);\n this.data[i].pos = this.data[i].x;\n } else {\n methodref(this.data[i].y);\n this.data[i].pos = this.data[i].y;\n }\n\n if (this.data[i].Q3) {\n\n methodval(this.data[i].Q3);\n }\n\n if (this.data[i].Q1) {\n methodval(this.data[i].Q1);\n }\n\n if (this.data[i].whiskers) {\n\n if (Array.isArray(this.data[i].whiskers)) {\n\n if (this.data[i].whiskers.length > 0) {\n methodval(this.data[i].whiskers[0]);\n }\n\n if (this.data[i].whiskers.length > 1) {\n methodval(this.data[i].whiskers[1]);\n }\n } else {\n methodval(this.data[i].whiskers);\n this.data[i].whiskers = [this.data[i].whiskers];\n }\n } else {\n this.data[i].whiskers = [];\n }\n\n if (Array.isArray(this.data[i].outliers)) {\n this.data[i].outliers.map(val => methodval(val));\n } else {\n this.data[i].outliers = [];\n }\n }\n\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n _style(type, styleValue, selectionType = 'unselected', applyToSelected = false) {\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType][type] = styleValue;\n\n if (applyToSelected) {\n this._set(type, styleValue, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n return this;\n }\n\n _gstyle(type, selectionType) {\n return this.getStyle(selectionType)[type];\n }\n\n /**\n * Retrives a selection object\n * @param {String} [ selectionType = \"unselected\" ] - The selection type\n * @returns {Object} The selection object\n */\n getStyle(selectionType = 'unselected') {\n\n return this.styles[selectionType] || {};\n }\n\n /**\n * Sets the mean line color\n * @param {String} color - The mean line color\n * @returns {SerieBox} The current serie instance\n */\n setMeanLineColor() {\n return this._style('meanLineColor', ...arguments);\n }\n\n /**\n * Returns the mean line color\n * @return {String} The mean line color\n */\n getMeanLineColor() {\n return this._gstyle('meanLineColor', ...arguments);\n }\n\n setStyle(style, selectionType = 'unselected') {\n //console.log( style, selectionType );\n this.styles[selectionType] = (0, _graphUtil.extend)({}, this.default().defaultStyle, this.styles.unselected, style);\n this.styleHasChanged(selectionType);\n }\n\n /**\n * Sets the mean line width\n * @param {Number} width - The line width\n * @returns {SerieBox} The current serie instance\n */\n setMeanLineWidth() {\n return this._style('meanLineWidth', ...arguments);\n }\n\n /**\n * Returns the mean line width\n * @return {Number} The mean line width\n */\n getMeanLineWidth() {\n return this._gstyle('meanLineWidth', ...arguments);\n }\n\n /**\n * Sets the box line color\n * @param {Number} color - The color of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveLineColor() {\n return this._style('boxAboveLineColor', ...arguments);\n }\n\n /**\n * Returns the box line color\n * @return {String} The line color of the box above the median\n */\n getBoxAboveLineColor() {\n return this._gstyle('boxAboveLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} color - The color of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowLineColor() {\n return this._style('boxBelowLineColor', ...arguments);\n }\n\n /**\n * Returns the fill color\n * @return {String} The line color of the box below the median\n */\n getBoxBelowLineColor() {\n return this._gstyle('boxBelowLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The contour width of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveLineWidth() {\n return this._style('boxAboveLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the box above the median\n * @return {Number} The line width of the box above the median\n */\n getBoxAboveLineWidth() {\n return this._gstyle('boxAboveLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The contour width of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowLineWidth() {\n return this._style('boxBelowLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the box below the median\n * @return {Number} The line width of the box below the median\n */\n getBoxBelowLineWidth() {\n return this._gstyle('boxBelowLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The fill color of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveFillColor() {\n return this._style('boxAboveFillColor', ...arguments);\n }\n\n /**\n * Returns the fill color of the box above the median\n * @return {String} The fill color of the box above the median\n */\n getBoxAboveFillColor() {\n return this._gstyle('boxAboveFillColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The fill color of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowFillColor() {\n return this._style('boxBelowFillColor', ...arguments);\n }\n\n /**\n * Returns the fill color of the box below the median\n * @return {String} The fill color of the box below the median\n */\n getBoxBelowFillColor() {\n return this._gstyle('boxBelowFillColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} opacity - The fill opacity of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveFillOpacity() {\n return this._style('boxAboveFillOpacity', ...arguments);\n }\n\n /**\n * Returns the fill opacity of the box above the median\n * @return {Number} The fill opacity of the box above the median\n */\n getBoxAboveFillOpacity() {\n return this._gstyle('boxAboveFillOpacity', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} opacity - The fill opacity of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowFillOpacity() {\n return this._style('boxBelowFillOpacity', ...arguments);\n }\n\n /**\n * Returns the fill opacity of the box below the median\n * @return {Number} The fill opacity of the box below the median\n */\n getBoxBelowFillOpacity() {\n return this._gstyle('boxBelowFillOpacity', ...arguments);\n }\n\n /**\n * Sets the whisker color\n * @param {String} color - The line color of the whisker above the median\n * @returns {SerieBox} The current serie instance\n */\n setBarAboveLineColor() {\n return this._style('barAboveLineColor', ...arguments);\n }\n\n /**\n * Returns the line color of the whisker above the median\n * @return {String} The line color of the whisker above the median\n */\n getBarAboveLineColor() {\n return this._gstyle('barAboveLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The line color of the whisker below the median\n * @returns {SerieBox} The current serie instance\n */\n setBarBelowLineColor() {\n return this._style('barBelowLineColor', ...arguments);\n }\n\n /**\n * Returns the line color of the whisker below the median\n * @return {String} The line color of the whisker below the median\n */\n getBarBelowLineColor() {\n return this._gstyle('barBelowLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The line width of the whisker above the median\n * @returns {SerieBox} The current serie instance\n */\n setBarAboveLineWidth() {\n return this._style('barAboveLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the whisker above the median\n * @return {Number} The line width of the whisker above the median\n */\n getBarAboveLineWidth() {\n return this._gstyle('barAboveLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The line width of the whisker below the median\n * @returns {SerieBox} The current serie instance\n */\n setBarBelowLineWidth() {\n return this._style('barBelowLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the whisker below the median\n * @return {Number} The line width of the whisker below the median\n */\n getBarBelowLineWidth() {\n return this._gstyle('barBelowLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The outlier stroke color\n * @returns {SerieBox} The current serie instance\n */\n setOutlierLineColor() {\n return this._style('outlierLineColor', ...arguments);\n }\n\n /**\n * Returns the line color of the outliers\n * @return {String} The line color of the outliers\n */\n getOutlierLineColor() {\n return this._gstyle('outlierLineColor', ...arguments);\n }\n\n /**\n * Sets the stroke width\n * @param {Number} width - The outlier stroke width\n * @returns {SerieBox} The current serie instance\n */\n setOutlierLineWidth() {\n return this._style('outlierLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the outliers\n * @return {Number} The line width of the outliers\n */\n getOutlierLineWidth() {\n return this._gstyle('outlierLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The outlier fill color\n * @returns {SerieBox} The current serie instance\n */\n setOutlierFillColor() {\n return this._style('outlierFillColor', ...arguments);\n }\n\n /**\n * Returns the fill color of the outliers\n * @return {String} The fill color of the outliers\n */\n getOutlierFillColor() {\n return this._gstyle('outlierFillColor', ...arguments);\n }\n\n /**\n * Sets the outlier fill opacity\n * @param {Number} opacity - The outlier fill opacity\n * @returns {SerieBox} The current serie instance\n */\n setOutlierFillOpacity() {\n return this._style('outlierFillOpacity', ...arguments);\n }\n\n /**\n * Returns the fill opacity of the outliers\n * @return {Number} The fill opacity of the outliers\n */\n getOutlierFillOpacity() {\n return this._gstyle('outlierFillOpacity', ...arguments);\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n * @returns {SerieBox} The current serie instance\n */\n applyLineStyles() {\n this.applyLineStyle(this.pathDom);\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieBar\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n line.removeAttribute('stroke-dasharray');\n line.setAttribute('fill', this.getFillColor());\n line.setAttribute('fill-opacity', this.getFillOpacity() || 1);\n }\n\n draw() {\n\n if (!this.data) {\n return;\n }\n\n let position;\n let axis = this.options.orientation == 'y' ? this.getYAxis() : this.getXAxis();\n let axis2 = this.options.orientation == 'y' ? this.getXAxis() : this.getYAxis();\n let boxOtherDimension; // width or height of the box\n let useCategories = false;\n let mean, boxAbove, boxBelow, barAbove, barBelow, outliers, posAbove, posBelow;\n let categoryNumber;\n\n (0, _graphUtil.emptyDom)(this.groupMain);\n\n if (axis2.getType() == 'category') {\n\n boxOtherDimension = axis2.getRelPx(0.8 / this.nbCategories);\n useCategories = true;\n } else {\n // Get all the spacing and determine the smallest one\n boxOtherDimension = this.options.maxBoxWidth;\n // console.log( boxOtherDimension );\n for (var i = 0, l = this.data.length; i < l - 1; i++) {\n\n // console.log( Math.abs( axis.getPx( this.data[ i + 1 ].pos ) - axis.getPx( this.data[ i ].pos ) ), axis.getPx( this.data[ i + 1 ].pos ), axis.getPx( this.data[ i ].pos ) );\n boxOtherDimension = Math.min(boxOtherDimension, Math.abs(axis2.getPx(this.data[i + 1].pos) - axis2.getPx(this.data[i].pos)));\n }\n // console.log( boxOtherDimension );\n }\n\n for (var i = 0, l = this.data.length; i < l; i++) {\n\n if (axis2.getType() == 'category') {\n\n let cat = this.options.orientation == 'y' ? this.data[i].x : this.data[i].y;\n\n if (!this.categoryIndices.hasOwnProperty(cat)) {\n\n if (Array.isArray(this._linkedToScatterSeries)) {\n for (let scatter_serie of this._linkedToScatterSeries) {\n\n if (scatter_serie.categoryIndices.hasOwnProperty(cat)) {\n\n position = [axis2.getPos(scatter_serie.categoryIndices[cat]) + 1.2 * boxOtherDimension / 2];\n\n if (this.options.orientation == 'y') {\n axis = scatter_serie.getYAxis();\n } else {\n axis = scatter_serie.getXAxis();\n }\n\n break;\n }\n }\n }\n } else {\n\n position = [axis2.getPos(this.categoryIndices[cat]) + 1.2 * boxOtherDimension / 2];\n }\n } else {\n\n position = [axis2.getPos(this.options.orientation == 'y' ? this.data[i].x : this.data[i].y), boxOtherDimension];\n }\n\n mean = axis.getPos(this.data[i].Q2);\n boxAbove = axis.getPos(this.data[i].Q3);\n boxBelow = axis.getPos(this.data[i].Q1);\n\n this.data[i].whiskers.map(val => {\n\n if (val < this.data[i].Q1) {\n barBelow = axis.getPos(val);\n } else {\n barAbove = axis.getPos(val);\n }\n });\n\n outliers = this.data[i].outliers.map(val => axis.getPos(val));\n\n var lineMean = document.createElementNS(this.graph.ns, 'line');\n\n this.applyMeanStyle(lineMean);\n\n var rectAbove = document.createElementNS(this.graph.ns, 'rect');\n var rectBelow = document.createElementNS(this.graph.ns, 'rect');\n\n if (this.options.orientation == 'y') {\n\n rectAbove.setAttribute('width', boxOtherDimension);\n rectAbove.setAttribute('x', position[0] - boxOtherDimension / 2);\n\n rectBelow.setAttribute('width', boxOtherDimension);\n rectBelow.setAttribute('x', position[0] - boxOtherDimension / 2);\n\n lineMean.setAttribute('x1', position[0] - boxOtherDimension / 2);\n lineMean.setAttribute('x2', position[0] + boxOtherDimension / 2);\n lineMean.setAttribute('y1', mean);\n lineMean.setAttribute('y2', mean);\n } else {\n\n rectAbove.setAttribute('height', boxOtherDimension);\n rectAbove.setAttribute('y', position[0] - boxOtherDimension / 2);\n\n rectBelow.setAttribute('height', boxOtherDimension);\n rectBelow.setAttribute('y', position[0] - boxOtherDimension / 2);\n\n lineMean.setAttribute('y1', position[0] - boxOtherDimension / 2);\n lineMean.setAttribute('y2', position[0] + boxOtherDimension / 2);\n lineMean.setAttribute('x1', mean);\n lineMean.setAttribute('x2', mean);\n }\n\n this.boxPos(rectAbove, mean, boxAbove, this.options.orientation == 'x');\n this.boxPos(rectBelow, mean, boxBelow, this.options.orientation == 'x');\n\n this.applyBoxStyle(rectAbove, rectBelow);\n\n var whiskerAbove = document.createElementNS(this.graph.ns, 'line');\n var whiskerBelow = document.createElementNS(this.graph.ns, 'line');\n\n if (this.options.orientation == 'y') {\n\n if (barAbove !== undefined) {\n whiskerAbove.setAttribute('y1', boxAbove);\n whiskerAbove.setAttribute('y2', barAbove);\n whiskerAbove.setAttribute('x1', position[0]);\n whiskerAbove.setAttribute('x2', position[0]);\n }\n\n if (barBelow !== undefined) {\n whiskerBelow.setAttribute('y1', boxBelow);\n whiskerBelow.setAttribute('y2', barBelow);\n whiskerBelow.setAttribute('x1', position[0]);\n whiskerBelow.setAttribute('x2', position[0]);\n }\n } else {\n\n if (barAbove !== undefined) {\n whiskerAbove.setAttribute('x1', boxAbove);\n whiskerAbove.setAttribute('x2', barAbove);\n whiskerAbove.setAttribute('y1', position[0]);\n whiskerAbove.setAttribute('y2', position[0]);\n }\n\n if (barBelow !== undefined) {\n whiskerBelow.setAttribute('x1', boxBelow);\n whiskerBelow.setAttribute('x2', barBelow);\n whiskerBelow.setAttribute('y1', position[0]);\n whiskerBelow.setAttribute('y2', position[0]);\n }\n }\n\n outliers.map(outliervalue => {\n\n let outlier = document.createElementNS(this.graph.ns, 'circle');\n\n outlier.setAttribute('r', 2);\n\n if (this.options.orientation == 'y') {\n\n outlier.setAttribute('cx', position[0]);\n outlier.setAttribute('cy', outliervalue);\n } else {\n\n outlier.setAttribute('cy', position[0]);\n outlier.setAttribute('cx', outliervalue);\n }\n\n this.setOutlierStyle(outlier);\n\n this.groupMain.appendChild(outlier);\n });\n\n if (barAbove !== undefined) {\n this.groupMain.appendChild(whiskerAbove);\n }\n\n if (barBelow !== undefined) {\n this.groupMain.appendChild(whiskerBelow);\n }\n\n if (boxAbove !== undefined) {\n this.groupMain.appendChild(rectAbove);\n }\n\n if (boxBelow !== undefined) {\n this.groupMain.appendChild(rectBelow);\n }\n\n this.groupMain.appendChild(lineMean);\n\n this.applyWhiskerStyle(whiskerAbove, whiskerBelow);\n }\n }\n\n applyBoxStyle(above, below) {\n\n above.setAttribute('stroke', this.getBoxAboveLineColor());\n above.setAttribute('stroke-width', this.getBoxAboveLineWidth());\n\n if (this.getBoxAboveFillColor() !== undefined) {\n above.setAttribute('fill', this.getBoxAboveFillColor());\n }\n if (this.getBoxAboveFillOpacity() !== undefined) {\n above.setAttribute('fill-opacity', this.getBoxAboveFillOpacity());\n }\n\n below.setAttribute('stroke', this.getBoxBelowLineColor());\n below.setAttribute('stroke-width', this.getBoxBelowLineWidth());\n\n if (this.getBoxBelowFillColor() !== undefined) {\n below.setAttribute('fill', this.getBoxBelowFillColor());\n }\n if (this.getBoxAboveFillOpacity() !== undefined) {\n below.setAttribute('fill-opacity', this.getBoxBelowFillOpacity());\n }\n }\n\n applyWhiskerStyle(above, below) {\n\n above.setAttribute('stroke', this.getBarAboveLineColor());\n above.setAttribute('stroke-width', this.getBarAboveLineWidth());\n\n below.setAttribute('stroke', this.getBarBelowLineColor());\n below.setAttribute('stroke-width', this.getBarBelowLineWidth());\n }\n\n applyMeanStyle(line) {\n\n line.setAttribute('stroke', this.getMeanLineColor());\n line.setAttribute('stroke-width', this.getMeanLineWidth());\n }\n\n setOutlierStyle(outlier) {\n\n outlier.setAttribute('stroke', this.getOutlierLineColor());\n outlier.setAttribute('stroke-width', this.getOutlierLineWidth());\n\n if (this.getBoxBelowFillColor() !== undefined) {\n outlier.setAttribute('fill', this.getOutlierFillColor());\n }\n if (this.getBoxAboveFillOpacity() !== undefined) {\n outlier.setAttribute('fill-opacity', this.getOutlierFillOpacity());\n }\n }\n /**\n * Returns the index of a category based on its name\n * @param {String} name - The name of the category\n */\n getCategoryIndex(name) {\n\n if (!this.categories) {\n throw new Error('No categories were defined. Probably axis.setSeries was not called');\n }\n\n for (var i = 0; i < this.categories.length; i++) {\n\n if (this.categories[i].name == name) {\n return i;\n }\n }\n\n return false;\n }\n\n // Markers now allowed\n setMarkers() {}\n\n boxPos(box, mean, extremity, blnX) {\n\n if (mean > extremity) {\n\n box.setAttribute(blnX ? 'x' : 'y', extremity);\n box.setAttribute(blnX ? 'width' : 'height', mean - extremity);\n } else {\n\n box.setAttribute(blnX ? 'x' : 'y', mean);\n box.setAttribute(blnX ? 'width' : 'height', extremity - mean);\n }\n }\n\n getUsedCategories() {\n let xymode = this.options.orientation == 'y' ? 'x' : 'y';\n\n let categories = this.data.map(d => d[xymode]);\n\n if (Array.isArray(this._linkedToScatterSeries)) {\n this._linkedToScatterSeries.map(scatter_serie => {\n\n scatter_serie.getUsedCategories().map(scatter_serie_cat => {\n let index;\n if ((index = categories.indexOf(scatter_serie_cat)) > -1) {\n categories.splice(index, 1);\n }\n });\n });\n }\n\n return categories;\n }\n\n linkToScatterSerie(...series) {\n this._linkedToScatterSeries = series;\n }\n }\n\n exports.default = SerieBox;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(5), __webpack_require__(0), __webpack_require__(10)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.serie.line.js'), require('../graph.util.js'), require('../mixins/graph.mixin.errorbars.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphSerieLine, global.graphUtil, global.graphMixinErrorbars);\n global.graphSerieLineColored = mod.exports;\n }\n})(this, function (module, exports, _graphSerieLine, _graphUtil, _graphMixinErrorbars) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphSerieLine2 = _interopRequireDefault(_graphSerieLine);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphMixinErrorbars2 = _interopRequireDefault(_graphMixinErrorbars);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Colored serie line\n * @example graph.newSerie( name, options, \"color\" );\n * @see Graph#newSerie\n * @augments SerieLine\n */\n class SerieLineColor extends _graphSerieLine2.default {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n this.lines = this.lines || {};\n }\n\n setColors(colors) {\n this.colors = colors;\n }\n\n _draw() {\n\n var self = this,\n data = this._dataToUse,\n toBreak,\n i = 0,\n j,\n k,\n m,\n x,\n y,\n k,\n o,\n lastX = false,\n lastY = false,\n xpx,\n ypx,\n xpx2,\n ypx2,\n xAxis = this.getXAxis(),\n yAxis = this.getYAxis(),\n xMin = xAxis.getCurrentMin(),\n yMin = yAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n yMax = yAxis.getCurrentMax();\n\n // Y crossing\n var yLeftCrossingRatio, yLeftCrossing, yRightCrossingRatio, yRightCrossing, xTopCrossingRatio, xTopCrossing, xBottomCrossingRatio, xBottomCrossing;\n\n var incrXFlip = 0;\n var incrYFlip = 1;\n\n var pointOutside = false;\n var lastPointOutside = false;\n var pointOnAxis;\n\n this.eraseLines();\n\n if (this.isFlipped()) {\n incrXFlip = 1;\n incrYFlip = 0;\n }\n\n this.currentLine = '';\n m = this.waveform.getLength();\n\n for (j = 0; j < m; j += 2) {\n\n x = this.waveform.getX(j);\n y = this.waveform.getY(j);\n\n if (x < xMin && lastX < xMin || x > xMax && lastX > xMax || (y < yMin && lastY < yMin || y > yMax && lastY > yMax) && !this.options.lineToZero) {\n lastX = x;\n lastY = y;\n lastPointOutside = true;\n continue;\n }\n\n this.counter2 = j;\n\n if (this.markersShown()) {\n this.getMarkerCurrentFamily(this.counter2);\n }\n\n xpx2 = this.getX(x);\n ypx2 = this.getY(y);\n\n if (xpx2 == xpx && ypx2 == ypx) {\n continue;\n }\n\n pointOutside = x < xMin || y < yMin || x > xMax || y > yMax;\n /*\n if ( this.options.lineToZero ) {\n pointOutside = ( x < xMin || x > xMax );\n if ( pointOutside ) {\n continue;\n }\n } else {\n if ( pointOutside || lastPointOutside ) {\n if ( ( lastX === false || lastY === false ) && !lastPointOutside ) {\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n } else {\n pointOnAxis = [];\n // Y crossing\n yLeftCrossingRatio = ( x - xMin ) / ( x - lastX );\n yLeftCrossing = y - yLeftCrossingRatio * ( y - lastY );\n yRightCrossingRatio = ( x - xMax ) / ( x - lastX );\n yRightCrossing = y - yRightCrossingRatio * ( y - lastY );\n // X crossing\n xTopCrossingRatio = ( y - yMin ) / ( y - lastY );\n xTopCrossing = x - xTopCrossingRatio * ( x - lastX );\n xBottomCrossingRatio = ( y - yMax ) / ( y - lastY );\n xBottomCrossing = x - xBottomCrossingRatio * ( x - lastX );\n if ( yLeftCrossingRatio < 1 && yLeftCrossingRatio > 0 && yLeftCrossing !== false && yLeftCrossing < yMax && yLeftCrossing > yMin ) {\n pointOnAxis.push( [ xMin, yLeftCrossing ] );\n }\n if ( yRightCrossingRatio < 1 && yRightCrossingRatio > 0 && yRightCrossing !== false && yRightCrossing < yMax && yRightCrossing > yMin ) {\n pointOnAxis.push( [ xMax, yRightCrossing ] );\n }\n if ( xTopCrossingRatio < 1 && xTopCrossingRatio > 0 && xTopCrossing !== false && xTopCrossing < xMax && xTopCrossing > xMin ) {\n pointOnAxis.push( [ xTopCrossing, yMin ] );\n }\n if ( xBottomCrossingRatio < 1 && xBottomCrossingRatio > 0 && xBottomCrossing !== false && xBottomCrossing < xMax && xBottomCrossing > xMin ) {\n pointOnAxis.push( [ xBottomCrossing, yMax ] );\n }\n if ( pointOnAxis.length > 0 ) {\n if ( !pointOutside ) { // We were outside and now go inside\n if ( pointOnAxis.length > 1 ) {\n console.error( \"Programmation error. Please e-mail me.\" );\n console.log( pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY );\n }\n this._createLine();\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n this._addPoint( xpx2, ypx2, lastX, lastY, false, false, true );\n } else if ( !lastPointOutside ) { // We were inside and now go outside\n if ( pointOnAxis.length > 1 ) {\n console.error( \"Programmation error. Please e-mail me.\" );\n console.log( pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY );\n }\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n } else {\n // No crossing: do nothing\n if ( pointOnAxis.length == 2 ) {\n this._createLine();\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n this._addPoint( this.getX( pointOnAxis[ 1 ][ 0 ] ), this.getY( pointOnAxis[ 1 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n }\n }\n } else if ( !pointOutside ) {\n this._addPoint( xpx2, ypx2, lastX, lastY, j, false, false );\n }\n }\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n lastPointOutside = pointOutside;\n continue;\n }\n }*/\n\n if (isNaN(xpx2) || isNaN(ypx2)) {\n if (this.counter > 0) {\n\n // this._createLine();\n }\n continue;\n }\n\n var color = this.colors[j];\n\n this._addPoint(xpx2, ypx2, x, y, xpx, ypx, lastX, lastY, j, color, false, true);\n\n xpx = xpx2;\n ypx = ypx2;\n\n lastX = x;\n lastY = y;\n }\n\n this.latchLines();\n\n if (this._tracker) {\n\n if (this._trackerDom) {\n this._trackerDom.remove();\n }\n\n var cloned = this.groupLines.cloneNode(true);\n this.groupMain.appendChild(cloned);\n\n for (var i = 0, l = cloned.children.length; i < l; i++) {\n\n cloned.children[i].setAttribute('stroke', 'transparent');\n cloned.children[i].setAttribute('stroke-width', '25px');\n cloned.children[i].setAttribute('pointer-events', 'stroke');\n }\n\n self._trackerDom = cloned;\n\n self.groupMain.addEventListener('mousemove', function (e) {\n var coords = self.graph._getXY(e),\n ret = self.handleMouseMove(false, false);\n self._trackingCallback(self, ret, coords.x, coords.y);\n });\n\n self.groupMain.addEventListener('mouseleave', function (e) {\n self._trackingOutCallback(self);\n });\n }\n return this;\n }\n\n _addPoint(xpx, ypx, x, y, xpxbefore, ypxbefore, xbefore, ybefore, j, color, move, allowMarker) {\n\n if (xpxbefore === undefined || ypxbefore === undefined) {\n return;\n }\n\n if (isNaN(xpx) || isNaN(ypx)) {\n return;\n }\n\n if (color._rgb) {\n color = 'rgba(' + color._rgb[0] + ',' + color._rgb[1] + ',' + color._rgb[2] + ',' + (color._rgb[3] || 1) + ')';\n }\n\n var line = this.lines[color];\n if (!line) {\n line = this.lines[color] = {\n object: document.createElementNS(this.graph.ns, 'path'),\n path: '',\n color: color\n };\n line.object.setAttribute('stroke', color);\n line.color = color;\n // this.applyLineStyle( line );\n this.groupLines.appendChild(line.object);\n }\n\n line.path += 'M ' + xpxbefore + ' ' + ypxbefore + ' L ' + xpx + ' ' + ypx;\n\n if (this.hasErrors()) {\n this.errorAddPoint(j, x, y, xpx, ypx);\n }\n\n /*if ( this.markersShown() && allowMarker !== false ) {\n drawMarkerXY( this, this.markerFamilies[ this.selectionType ][ this.markerCurrentFamily ], xpx, ypx );\n }*/\n }\n\n removeExtraLines() {}\n\n // Returns the DOM\n latchLines() {\n\n for (var i in this.lines) {\n this.lines[i].object.setAttribute('d', this.lines[i].path);\n }\n }\n\n // Returns the DOM\n eraseLines() {\n\n for (var i in this.lines) {\n this.lines[i].path = '';\n this.lines[i].object.setAttribute('d', '');\n }\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyle(line) {\n\n //line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute('stroke-width', this.getLineWidth());\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n } else {\n line.removeAttribute('stroke-dasharray');\n }\n line.setAttribute('fill', 'none');\n //\tline.setAttribute('shape-rendering', 'optimizeSpeed');\n }\n }\n\n exports.default = SerieLineColor;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(3), __webpack_require__(17), __webpack_require__(4), __webpack_require__(15), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.core.js'), require('./graph.serie.zone.js'), require('../util/waveform.js'), require('../mixins/graph.mixin.serie3d.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphCore, global.graphSerieZone, global.waveform, global.graphMixinSerie3d, global.graphUtil);\n global.graphSerieZone3d = mod.exports;\n }\n})(this, function (module, exports, _graphCore, _graphSerieZone, _waveform, _graphMixinSerie3d, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphCore2 = _interopRequireDefault(_graphCore);\n\n var _graphSerieZone2 = _interopRequireDefault(_graphSerieZone);\n\n var _waveform2 = _interopRequireDefault(_waveform);\n\n var _graphMixinSerie3d2 = _interopRequireDefault(_graphMixinSerie3d);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Serie line with 3D projection\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends SerieLine\n */\n class SerieZone3D extends _graphSerieZone2.default {\n\n static default() {\n return {\n zpos: 0\n };\n }\n constructor(graph, name, options) {\n super(...arguments);\n }\n\n /**\n * Sets the z-position\n * @memberof SerieZone3D\n * @param {Number} zPos - The position in the z axis\n */\n setZPos(zPos) {\n this.options.zpos = zPos;\n return this;\n }\n\n setz() {\n return this.setZPos(...arguments);\n }\n }\n\n util.mix(SerieZone3D, _graphMixinSerie3d2.default);\n exports.default = SerieZone3D;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 29 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(8), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.serie.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphSerie, global.graphUtil);\n global.graphSerieDensitymap = mod.exports;\n }\n})(this, function (module, exports, _graphSerie, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphSerie2 = _interopRequireDefault(_graphSerie);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Density map serie\n * @example graph.newSerie( name, options, \"densitymap\" );\n * @see Graph#newSerie\n * @augments Serie\n */\n class SerieDensityMap extends _graphSerie2.default {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n util.mapEventEmission(this.options, this); // Register events\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.rects = [];\n this.paths = [];\n\n this.recalculateBinsOnDraw = false;\n }\n /**\n * Sets the data of the serie. Careful, only one format allowed for now.\n * @memberof SerieDensityMap\n * @param {Array} data - A vector containing 2-elements arrays\n * @return {SerieDensityMap} The current instance\n * @example serie.setData( [ [ x1, y1 ], [ x2, y2 ], ..., [ xn, yn ] ] );\n */\n setData(data) {\n\n this.minX = this.maxX = this.minY = this.maxY = 0;\n var i = 0,\n l = data.length;\n this.data = data;\n\n this.minX = Number.POSITIVE_INFINITY;\n this.minY = Number.POSITIVE_INFINITY;\n this.maxX = Number.NEGATIVE_INFINITY;\n this.maxY = Number.NEGATIVE_INFINITY;\n\n for (i = 0; i < l; i++) {\n this._checkX(data[i][0]);\n this._checkY(data[i][1]);\n }\n\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Calculates the bins from the (x,y) dataset\n * @memberof SerieDensityMap\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} numX - The number of x bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @param {Number} numY - The number of y bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n calculateDensity(fromX, deltaX, numX, fromY, deltaY, numY) {\n\n var densitymap = [],\n i,\n l = this.data.length,\n indexX,\n indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n for (i = 0; i < l; i++) {\n indexX = ~~((this.data[i][0] - fromX) / deltaX);\n indexY = ~~((this.data[i][1] - fromY) / deltaY);\n\n if (indexX > numX || indexY > numY || indexX < 0 || indexY < 0) {\n continue;\n }\n\n densitymap[indexX] = densitymap[indexX] || [];\n densitymap[indexX][indexY] = densitymap[indexX][indexY] + 1 || 1;\n\n binMin = densitymap[indexX][indexY] < binMin ? densitymap[indexX][indexY] : binMin;\n binMax = densitymap[indexX][indexY] > binMax ? densitymap[indexX][indexY] : binMax;\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = numX;\n this.maxIndexY = numY;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = numX;\n this.numY = numY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Sets the density map from a precalculated data set\n * @memberof SerieDensityMap\n * @param {Array} densitymap - A 2D-array containing the map\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n setDensityMap(densitymap, fromX, deltaX, numX, fromY, deltaY, numY) {\n\n var i,\n j,\n l = this.data.length,\n indexX,\n indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n for (i = 0; i < densitymap.length; i++) {\n\n for (j = 0; j < densitymap[i].length; j++) {\n binMin = densitymap[i][j] < binMin ? densitymap[i][j] : binMin;\n binMax = densitymap[i][j] > binMax ? densitymap[i][j] : binMax;\n }\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = densitymap.length;\n this.maxIndexY = densitymap[0].length;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = this.maxIndexX;\n this.numY = this.maxIndexY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Calculates the bins from the (x,y) dataset using bin weighing\n * Will assign a set of (x,y) to the 4 neighbouring bins according to its exact position\n * @memberof SerieDensityMap\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} numX - The number of x bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @param {Number} numY - The number of y bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n calculateDensityWeighted(fromX, deltaX, numX, fromY, deltaY, numY) {\n\n var densitymap = [],\n i,\n l = this.data.length,\n indexX,\n indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n var compX, compY;\n var exactX, exactY;\n var indexXLow, indexXHigh, indexYLow, indexYHigh;\n\n for (i = 0; i < l; i++) {\n exactX = (this.data[i][0] - fromX) / deltaX - 0.5;\n exactY = (this.data[i][1] - fromY) / deltaY - 0.5;\n\n indexX = Math.floor(exactX);\n indexY = Math.floor(exactY);\n\n indexXLow = indexX; //Math.floor( exactX );\n indexYLow = indexY; //Math.floor( exactY );\n\n indexXHigh = indexX + 1; //Math.ceil( exactX );\n indexYHigh = indexY + 1; //Math.ceil( exactY );\n\n compX = 1 - (exactX - indexX);\n compY = 1 - (exactY - indexY);\n\n //console.log( exactY, indexY );\n //console.log( compY, indexYLow, indexYHigh );\n if (indexX > numX || indexY > numY || indexX < 0 || indexY < 0) {\n continue;\n }\n\n densitymap[indexXLow] = densitymap[indexXLow] || [];\n densitymap[indexXHigh] = densitymap[indexXHigh] || [];\n\n densitymap[indexXLow][indexYLow] = densitymap[indexXLow][indexYLow] || 0;\n densitymap[indexXHigh][indexYLow] = densitymap[indexXHigh][indexYLow] || 0;\n densitymap[indexXLow][indexYHigh] = densitymap[indexXLow][indexYHigh] || 0;\n densitymap[indexXHigh][indexYHigh] = densitymap[indexXHigh][indexYHigh] || 0;\n\n densitymap[indexXLow][indexYLow] += compX * compY;\n densitymap[indexXHigh][indexYLow] += (1 - compX) * compY;\n densitymap[indexXLow][indexYHigh] += compX * (1 - compY);\n densitymap[indexXHigh][indexYHigh] += (1 - compX) * (1 - compY);\n\n // A loop would be nicer, but would it be faster ?\n binMin = densitymap[indexXLow][indexYLow] < binMin ? densitymap[indexXLow][indexYLow] : binMin;\n binMax = densitymap[indexXLow][indexYLow] > binMax ? densitymap[indexXLow][indexYLow] : binMax;\n binMin = densitymap[indexXHigh][indexYLow] < binMin ? densitymap[indexXHigh][indexYLow] : binMin;\n binMax = densitymap[indexXHigh][indexYLow] > binMax ? densitymap[indexXHigh][indexYLow] : binMax;\n binMin = densitymap[indexXLow][indexYHigh] < binMin ? densitymap[indexXLow][indexYHigh] : binMin;\n binMax = densitymap[indexXLow][indexYHigh] > binMax ? densitymap[indexXLow][indexYHigh] : binMax;\n binMin = densitymap[indexXHigh][indexYHigh] < binMin ? densitymap[indexXHigh][indexYHigh] : binMin;\n binMax = densitymap[indexXHigh][indexYHigh] > binMax ? densitymap[indexXHigh][indexYHigh] : binMax;\n\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = numX;\n this.maxIndexY = numY;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = numX;\n this.numY = numY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Calculates the density map based on the minimum and maximum values found in the data array\n * @memberof SerieDensityMap\n * @param {Number} [ numX = 400 ] - The number of x bins\n * @param {Number} [ numY = numX ] - The number of y bins\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n autoBins(numX, numY) {\n\n this.numX = numX || 400;\n this.numY = numY || this.numX;\n\n this.calculateDensity(this.minX, (this.maxX - this.minX) / numX, numX, this.minY, (this.maxY - this.minY) / numY, numY);\n\n this.recalculateBinsOnDraw = false;\n\n return this;\n }\n\n /**\n * Only calculates the density map upon redraw based on the current state of the graph. In this mode, a fixed number of pixels per bin is used to calculate the number of bins and fed into\n * the calculation of the density map. In this method, the color map spans on the full scale of the density map values (i.e. a subrange cannot be defined, like you would do using {@link SerieDensityMap#setColorMapBinBoundaries}).\n * @memberof SerieDensityMap\n * @param {Number} pxPerBinX - The number of x bins per pixels. Should be an integer, but technically it doesn't have to\n * @param {Number} pxPerBinY - The number of y bins per pixels. Should be an integer, but technically it doesn't have to\n * @param {Boolean} weightedDensityMap - Whether jsGraph should use weighted density mapping or not\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n setPxPerBin(pxPerBinX, pxPerBinY, weightedDensityMap) {\n\n if (pxPerBinX) {\n this.calculationDensityMap({\n from: 'min',\n to: 'max',\n pxPerBin: pxPerBinX,\n weighted: weightedDensityMap\n });\n }\n\n if (pxPerBinY) {\n this.calculationDensityMap(false, {\n from: 'min',\n to: 'max',\n pxPerBin: pxPerBinY,\n weighted: weightedDensityMap\n });\n }\n\n return this;\n }\n\n /**\n * Sets bins in the ```x``` or ```y``` direction based on a from value, a to value and a number of bins.\n * @memberof SerieDensityMap\n * @param {String} mode - ```x``` or ```y```\n * @param {Number} from - The from value of the bin for the calculation with ```calculateDensityMap```\n * @param {Number} to - The to value\n * @param {Number} num - The number of bins\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n setBinsFromTo(mode, from, to, num) {\n\n this.densityMapCalculation = this.densityMapCalculation || {};\n\n this.densityMapCalculation[mode] = {\n from: from,\n to: to,\n numBins: num\n };\n this.calculationDensityMap();\n return this;\n }\n\n calculationDensityMap(x, y) {\n\n this.method = this.calculateDensityAdvanced;\n this.densityMapCalculation = this.densityMapCalculation || {};\n\n if (x) {\n this.densityMapCalculation.x = x;\n }\n\n if (y) {\n this.densityMapCalculation.y = y;\n }\n }\n\n calculateDensityAdvanced() {\n\n var results = {\n x: {\n from: 0,\n num: 0,\n delta: 0,\n weighing: false\n },\n\n y: {\n from: 0,\n num: 0,\n delta: 0,\n weighing: false\n }\n };\n\n var widthValues = {\n x: this.graph.drawingSpaceWidth,\n y: this.graph.drawingSpaceHeight\n };\n var axisGetter = {\n x: this.getXAxis,\n y: this.getYAxis\n };\n\n var weighing = false;\n\n for (var i in this.densityMapCalculation) {\n\n if (this.densityMapCalculation[i].weighted) {\n weighing = true;\n results[i].weighing = true;\n }\n\n if (this.densityMapCalculation[i].pxPerBin) {\n\n // In value\n\n var from = this.densityMapCalculation[i].from == 'min' ? axisGetter[i].call(this).getCurrentMin() : this.densityMapCalculation[i].from;\n var to = this.densityMapCalculation[i].to == 'max' ? axisGetter[i].call(this).getCurrentMax() : this.densityMapCalculation[i].to;\n\n // In px\n var dimension = Math.abs(axisGetter[i].call(this).getRelPx(to - from));\n results[i].num = Math.ceil(widthValues[i] / this.densityMapCalculation[i].pxPerBin);\n\n //console.log( from, from - axisGetter[ i ].call( this ).getRelVal( ( results[i ].num * this.densityMapCalculation[ i ].pxPerBin - dimension ) / 2 ), ( results[i ].num * this.densityMapCalculation[ i ].pxPerBin - dimension ) / 2 );\n results[i].from = from - Math.abs(axisGetter[i].call(this).getRelVal((results[i].num * this.densityMapCalculation[i].pxPerBin - dimension) / 2));\n results[i].delta = Math.abs(axisGetter[i].call(this).getRelVal(this.densityMapCalculation[i].pxPerBin));\n } else {\n\n results[i].num = this.densityMapCalculation[i].numBins || 400;\n results[i].from = this.densityMapCalculation[i].from == 'min' ? axisGetter[i].call(this).getCurrentMin() : this.densityMapCalculation[i].from;\n results[i].delta = this.densityMapCalculation[i].to ? ((this.densityMapCalculation[i].to == 'max' ? axisGetter[i].call(this).getCurrentMax() : this.densityMapCalculation[i].to) - results[i].from) / results[i].num : this.densityMapCalculate[i].delta;\n }\n\n // console.log( axisGetter[ i ].call( this ).getCurrentMin(), axisGetter[ i ].call( this ).getCurrentMax(), )\n }\n //console.log( this.getYAxis().getCurrentMin(), this.getYAxis().getCurrentMax(), this.graph.drawingSpaceHeight );\n\n //console.log( this.densityMapCalculation );\n\n (weighing ? this.calculateDensityWeighted : this.calculateDensity).call(this, results.x.from, results.x.delta, results.x.num, results.y.from, results.y.delta, results.y.num);\n }\n\n /**\n * Selects a subrange of bins for the color mapping. There is no need to recalculate the color map after calling this method\n * @memberof SerieDensityMap\n * @param {Number} binMin - The minimum bin value\n * @param {Number} binMax - The maximum bin value\n * @return {SerieDensityMap} The current instance\n * @example // In this case, all bins with values below binMin * 2 (the middle scale) will be rendered with the first color of the color map\n * serie.setColorMapBinBoundaries( serie.binMin * 2, serie.binMax );\n */\n setColorMapBinBoundaries(min, max) {\n this.colorMapMin = min;\n this.colorMapMax = max;\n return this;\n }\n\n /**\n * Calls {@link SerieDensityMap#setColorMapBinBoundaries} using the minimum and maximum bin values calculated by {@link SerieDensityMap#calculateDensity}. This function must be called, since colorMinMap and colorMaxMap are not set automatically when the density map is calculated.\n * @memberof SerieDensityMap\n * @param {Number} binMin - The minimum bin value\n * @param {Number} binMax - The maximum bin value\n * @return {SerieDensityMap} The current instance\n */\n autoColorMapBinBoundaries() {\n this.colorMapMin = this.binMin;\n this.colorMapMax = this.binMax;\n return this;\n }\n\n /**\n * Allows the use of a callback to determine the color map min and max value just before the density map is redrawn. This is very useful when the density map is recalculate before redraw, such as in the case where bins per pixels are used\n * @memberof SerieDensityMap\n * @param {(String|Function)} callback - The callback function to call. Should return an array with two elements ```[ colorMapMin, colorMapMax ]```. This parameter can also take the value ```auto```, in which case ```autoColorMapBinBoundaries``` will be called before redraw\n * @return {SerieDensityMap} The current instance\n */\n onRedrawColorMapBinBoundaries(callback) {\n this.callbackColorMapMinMax = callback;\n return this;\n }\n\n /**\n * Generates a color map based on a serie of HSL(A) values.\n * @summary Colors can scale linearly, logarithmically (enhances short range differences) or exponentially (enhances long range differences).\n * One word of advice though. SVG being not canvas, jsGraph has to create a path for each color value of the color map. In other words, if you're asking for 16-bit coloring (65536 values), 65536 SVG paths will be created and your browser will start to suffer from it.\n * As of now, all the colors in colorStops will be places at equal distances from each other between colorMapMin and colorMapMax set by {@link autoColorMapBinBoundaries} or {@link setColorMapBinBoundaries}\n * @memberof SerieDensityMap\n * @param {Array} colorStops - An array of objects, each having the following format: { h: [ 0-360], s: 0-1, l: 0-1, a: 0-1}\n * @param {Number} numColors - The number of colors to compute.\n * @param {String} [ method = \"linear\" ] - The method to use to calculate the density map: linear, exp, or log\n * @return {SerieDensityMap} The current instance\n */\n colorMapHSL(colorStops, numColors, method) {\n\n method = method || 'linear';\n\n var methods = {\n 'exp': function (value) {\n return (Math.exp(value / numColors * 1) - Math.exp(0)) / (Math.exp(1) - Math.exp(0));\n },\n 'log': function (value) {\n return (Math.log(value + 1) - Math.log(1)) / (Math.log(numColors + 1) - Math.log(1));\n },\n 'linear': function (value) {\n return (value - 0) / (numColors - 0);\n }\n };\n\n var k = 0,\n colorMap = [],\n opacities = [];\n\n var color = {\n h: null,\n s: null,\n l: null,\n a: null\n };\n\n var ratio, first;\n\n var slices = colorStops.length - 1;\n\n for (var i = 0; i <= numColors; i++) {\n\n ratio = methods[method](i);\n\n first = Math.floor(ratio * slices);\n\n if (first == colorStops.length - 1) {\n // Handle 1\n first = slices - 1;\n }\n\n ratio = (ratio - first / slices) / (1 / slices);\n\n for (var j in color) {\n color[j] = (colorStops[first + 1][j] - colorStops[first][j]) * ratio + colorStops[first][j];\n }\n\n colorMap[k] = 'hsl(' + color.h + ', ' + Math.round(color.s * 100) + '%, ' + Math.round(color.l * 100) + '%)'; //this.HSVtoRGB( color.h, color.s, color.v );\n opacities[k] = color.a;\n k++;\n }\n\n this.opacities = opacities;\n this.colorMap = colorMap;\n this.colorMapNum = numColors;\n return this;\n }\n\n /**\n * Calls {@link SerieDensityMap#colorMapHSV} using 100 colors.\n * @memberof SerieDensityMap\n * @param {Array} colorStops - An array of objects, each having the following format: { h: [ 0-360], s: 0-1, l: 0-1, a: 0-1}\n * @param {String} [ method = \"linear\" ] - The method to use to calculate the density map: linear, exp or log\n * @return {SerieDensityMap} The current instance\n */\n autoColorMapHSL(colorStops, method = 'linear') {\n this.colorMapHSV(colorStops, 100, method);\n return this;\n }\n\n /* byteToHex( b ) {\n return hexChar[ ( b >> 4 ) & 0x0f ] + hexChar[ b & 0x0f ];\n }\n */\n /*\n HSVtoRGB( h, s, v ) {\n var r, g, b, i, f, p, q, t;\n if ( arguments.length === 1 ) {\n s = h.s, v = h.v, h = h.h;\n }\n i = Math.floor( h * 6 );\n f = h * 6 - i;\n p = v * ( 1 - s );\n q = v * ( 1 - f * s );\n t = v * ( 1 - ( 1 - f ) * s );\n switch ( i % 6 ) {\n case 0:\n r = v, g = t, b = p;\n break;\n case 1:\n r = q, g = v, b = p;\n break;\n case 2:\n r = p, g = v, b = t;\n break;\n case 3:\n r = p, g = q, b = v;\n break;\n case 4:\n r = t, g = p, b = v;\n break;\n case 5:\n r = v, g = p, b = q;\n break;\n }\n return \"#\" + this.byteToHex( Math.floor( r * 255 ) ) + this.byteToHex( Math.floor( g * 255 ) ) + this.byteToHex( Math.floor( b * 255 ) );\n }\n */\n\n /**\n * Returns the color index (```[ 0 - 1 ]```) for a certain value, based on colorMapMin and colorMapMax.\n * @memberof SerieDensityMap\n * @param {Number} binValue - The value of the bin\n * @return {Number} The color index\n */\n getColorIndex(binValue) {\n\n return Math.max(0, Math.min(this.colorMapNum, Math.floor((binValue - this.colorMapMin) / (this.colorMapMax - this.colorMapMin) * this.colorMapNum)));\n }\n\n /**\n * Draws the serie\n * @memberof SerieDensityMap\n * @private\n */\n draw() {\n\n var colorIndex;\n\n if (this.method) {\n this.method();\n }\n\n if (!this.callbackColorMapMinMax || this.colorMapMin == undefined || this.colorMapMax == undefined || this.callbackColorMapMinMax == 'auto') {\n\n this.autoColorMapBinBoundaries();\n } else {\n var val = this.callbackColorMapMinMax(this.binMin, this.binMax);\n\n this.setColorMapBinBoundaries(val[0], val[1]);\n }\n\n var deltaXPx = this.getXAxis().getRelPx(this.deltaX),\n deltaYPx = this.getYAxis().getRelPx(this.deltaY);\n\n for (var i = 0; i < this.paths.length; i++) {\n this.paths[i] = '';\n }\n\n for (var i = 0; i < this.maxIndexX; i++) {\n\n for (var j = 0; j < this.maxIndexY; j++) {\n\n if (this.densitymap[i] == undefined || this.densitymap[i][j] == undefined) {\n continue;\n }\n\n colorIndex = this.getColorIndex(this.densitymap[i][j]);\n if (!this.paths[colorIndex]) {\n this.paths[colorIndex] = '';\n }\n\n this.paths[colorIndex] += ' M ' + this.getXAxis().getPx(i * this.deltaX + this.fromX) + ' ' + this.getYAxis().getPx(j * this.deltaY + this.fromY) + ' h ' + deltaXPx + ' v ' + deltaYPx + ' h -' + deltaXPx + ' z';\n }\n }\n /*\n this.maxIndexX = indexX;\n this.maxIndexY = indexY;*/\n\n this.drawRects();\n }\n\n /**\n * Draws the rectangles\n * @memberof SerieDensityMap\n * @private\n */\n drawRects() {\n\n for (var i = 0; i < this.paths.length; i++) {\n\n if (!this.rects[i]) {\n this.rects[i] = document.createElementNS(this.graph.ns, 'path');\n this.rects[i].setAttribute('shape-rendering', 'crispEdges');\n }\n\n if (this.paths[i] !== undefined) {\n this.rects[i].setAttribute('d', this.paths[i]);\n this.rects[i].setAttribute('fill', this.colorMap[i]);\n this.rects[i].setAttribute('fill-opacity', this.opacities[i]);\n }\n this.groupMain.appendChild(this.rects[i]);\n }\n }\n\n /**\n * Sets the options of the serie\n * @see SerieDensityMapDefaultOptions\n * @param {Object} options - A object containing the options to set\n * @return {SerieDensityMap} The current serie\n * @memberof SerieDensityMap\n */\n setOptions(options) {\n this.options = util.extend(true, {}, this.defaults(), options || {});\n // Unselected style\n\n return this;\n }\n }\n\n exports.default = SerieDensityMap;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 30 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(5), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.serie.line.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphSerieLine, global.graphUtil);\n global.graphSerieContour = mod.exports;\n }\n})(this, function (module, exports, _graphSerieLine, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphSerieLine2 = _interopRequireDefault(_graphSerieLine);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Constructor for the contour serie. Do not use this constructor directly, but use the {@link Graph#newSerie} method\n * @private\n * @extends Serie\n * @example graph.newSerie( name, options, \"contour\" );\n * @see Graph#newSerie\n */\n class SerieContour extends _graphSerieLine2.default {\n\n constructor(graph, name, options) {\n super(...arguments);\n\n this.negativeDelta = 0;\n this.positiveDelta = 0;\n\n this.negativeThreshold = 0;\n this.positiveThreshold = 0;\n\n this.groupMain.setAttribute('clip-path', 'url(#_clipplot' + graph._creation + ')');\n }\n\n /**\n * Sets the contour lines\n * @memberof SerieContour.prototype\n * @param {Object} data - The object data\n * @param {Number} data.minX - The minimum x value\n * @param {Number} data.maxX - The maximum x value\n * @param {Number} data.minY - The minimum y value\n * @param {Number} data.maxY - The maximum y value\n * @param {Object[]} data.segments - The segments making up the contour lines\n * @param {Number[]} data.segments.lines - An array of alternating (x1,y1,x2,y2) quadruplet\n * @param {Number} data.segments.zValue - The corresponding z-value of this array\n * @return {Serie} The current serie\n */\n setData(data, arg, type) {\n\n var z = 0;\n var x,\n dx,\n arg = arg || '2D',\n type = type || 'float',\n i,\n l = data.length,\n j,\n k,\n arr,\n datas = [];\n\n if (!(data instanceof Array)) {\n\n if (typeof data == 'object') {\n // Def v2\n this.minX = data.minX;\n this.minY = data.minY;\n this.maxX = data.maxX;\n this.maxY = data.maxY;\n\n data = data.segments;\n l = data.length;\n }\n }\n\n for (i = 0; i < l; i++) {\n k = data[i].lines.length;\n arr = this._addData(type, k);\n\n for (j = 0; j < k; j += 2) {\n\n arr[j] = data[i].lines[j];\n this._checkX(arr[j]);\n arr[j + 1] = data[i].lines[j + 1];\n this._checkY(arr[j + 1]);\n }\n\n datas.push({\n lines: arr,\n zValue: data[i].zValue\n });\n }\n this.data = datas;\n this.graph.updateDataMinMaxAxes();\n\n this.dataHasChanged(true);\n\n return this;\n }\n\n /**\n * Draws the serie if the data has changed\n * @memberof SerieContour.prototype\n * @param {Boolean} force - Forces redraw even if the data hasn't changed\n * @return {Serie} The current serie\n */\n draw(force) {\n\n if (force || this.hasDataChanged()) {\n\n this.currentLine = 0;\n var x,\n y,\n xpx,\n ypx,\n xpx2,\n ypx2,\n i = 0,\n l = this.data.length,\n j = 0,\n k,\n m,\n currentLine,\n domLine,\n arr;\n this.minZ = Infinity;\n this.maxZ = -Infinity;\n\n var next = this.groupLines.nextSibling;\n this.groupMain.removeChild(this.groupLines);\n this.zValues = {};\n\n var incrXFlip = 0;\n var incrYFlip = 1;\n if (this.getFlip()) {\n incrXFlip = 0;\n incrYFlip = 1;\n }\n\n var minY = this.getYAxis().getCurrentMin();\n var minX = this.getXAxis().getCurrentMin();\n\n var maxX = this.getXAxis().getCurrentMax();\n var maxY = this.getYAxis().getCurrentMax();\n\n this.counter = 0;\n this.currentLineId = 0;\n\n for (; i < l; i++) {\n this.currentLine = '';\n j = 0;\n k = 0;\n\n for (arr = this.data[i].lines, m = arr.length; j < m; j += 4) {\n\n var lastxpx, lastypx;\n\n if (arr[j + incrXFlip] < minX && arr[j + 2 + incrXFlip] < minX || arr[j + incrYFlip] < minY && arr[j + 2 + incrYFlip] < minY || arr[j + incrYFlip] > maxY && arr[j + 2 + incrYFlip] > maxY || arr[j + incrXFlip] > maxX && arr[j + 2 + incrXFlip] > maxX) {\n continue;\n }\n\n xpx2 = this.getX(arr[j + incrXFlip]);\n ypx2 = this.getY(arr[j + incrYFlip]);\n\n xpx = this.getX(arr[j + 2 + incrXFlip]);\n ypx = this.getY(arr[j + 2 + incrYFlip]);\n\n if (xpx == xpx2 && ypx == ypx2) {\n continue;\n }\n\n /*\tif( j > 0 && ( lastxpx !== undefined && lastypx !== undefined && Math.abs( xpx2 - lastxpx ) <= 30 && Math.abs( ypx2 - lastypx ) <= 30 ) ) {\n currentLine += \"L\";\n } else {\n currentLine += \"M\";\n }\n */\n\n this.currentLine += 'M ';\n this.currentLine += xpx2;\n this.currentLine += ' ';\n this.currentLine += ypx2;\n\n this.currentLine += 'L ';\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += ypx;\n\n this.counter++;\n\n lastxpx = xpx;\n lastypx = ypx;\n\n k++;\n }\n\n this.currentLine += ' z';\n\n domLine = this._createLine();\n domLine.setAttribute('data-zvalue', this.data[i].zValue);\n\n this.zValues[this.data[i].zValue] = {\n dom: domLine\n };\n\n this.minZ = Math.min(this.minZ, this.data[i].zValue);\n this.maxZ = Math.max(this.maxZ, this.data[i].zValue);\n }\n\n i++;\n\n for (i = this.currentLine + 1; i < this.lines.length; i++) {\n this.groupLines.removeChild(this.lines[i]);\n this.lines.splice(i, 1);\n }\n\n i = 0;\n\n for (; i < l; i++) {\n this.setColorTo(this.lines[i], this.data[i].zValue, this.minZ, this.maxZ);\n }\n\n this.onMouseWheel(0, {\n shiftKey: false\n });\n this.groupMain.insertBefore(this.groupLines, next);\n } else if (this.hasStyleChanged(this.selectionType)) {\n\n for (; i < l; i++) {\n this.setColorTo(this.lines[i], this.data[i].zValue, this.minZ, this.maxZ);\n }\n }\n }\n\n onMouseWheel(delta, e, fixed, positive) {\n\n delta /= 250;\n\n if (fixed !== undefined) {\n\n if (!positive) {\n this.negativeThreshold = -fixed * this.minZ;\n this.negativeDelta = -Math.pow(Math.abs(this.negativeThreshold / -this.minZ), 1 / 3);\n }\n\n if (positive) {\n this.positiveThreshold = fixed * this.maxZ;\n this.positiveDelta = Math.pow(this.positiveThreshold / this.maxZ, 1 / 3);\n }\n } else {\n\n if (!e.shiftKey || !this.options.hasNegative) {\n\n this.positiveDelta = Math.min(1, Math.max(0, this.positiveDelta + Math.min(0.1, Math.max(-0.1, delta))));\n this.positiveThreshold = this.maxZ * Math.pow(this.positiveDelta, 3);\n } else {\n\n this.negativeDelta = Math.min(0, Math.max(-1, this.negativeDelta + Math.min(0.1, Math.max(-0.1, delta))));\n this.negativeThreshold = -this.minZ * Math.pow(this.negativeDelta, 3);\n }\n }\n\n if (isNaN(this.positiveDelta)) {\n this.positiveDelta = 0;\n }\n\n if (isNaN(this.negativeDelta)) {\n this.negativeDelta = 0;\n }\n\n for (var i in this.zValues) {\n\n this.zValues[i].dom.setAttribute('display', i >= 0 && i >= this.positiveThreshold || i <= 0 && i <= this.negativeThreshold ? 'block' : 'none');\n }\n\n if (this._shapeZoom) {\n\n if (!this.options.hasNegative) {\n this._shapeZoom.hideHandleNeg();\n } else {\n\n this._shapeZoom.setHandleNeg(-Math.pow(this.negativeDelta, 3), this.minZ);\n this._shapeZoom.showHandleNeg();\n }\n\n this._shapeZoom.setHandlePos(Math.pow(this.positiveDelta, 3), this.maxZ);\n }\n }\n\n /**\n * Sets rainbow colors based on hsl format\n * @memberof SerieContour.prototype\n * @param {Object} colors\n * @param {Object} colors.fromPositive\n * @param {Number} colors.fromPositive.h\n * @param {Number} colors.fromPositive.s\n * @param {Number} colors.fromPositive.l\n * @param {Object} colors.toPositive\n * @param {Number} colors.toPositive.h\n * @param {Number} colors.toPositive.s\n * @param {Number} colors.toPositive.l\n * @param {Object} colors.fromNegative\n * @param {Number} colors.fromNegative.h\n * @param {Number} colors.fromNegative.s\n * @param {Number} colors.fromNegative.l\n * @param {Object} colors.toNegative\n * @param {Number} colors.toNegative.h\n * @param {Number} colors.toNegative.s\n * @param {Number} colors.toNegative.l\n * @return {Serie} The current serie\n */\n setDynamicColor(colors) {\n this.lineColors = colors;\n\n this.styleHasChanged();\n }\n\n setNegative(bln) {\n this.options.hasNegative = bln;\n\n if (bln) {\n this.negativeThreshold = 0;\n }\n }\n\n setColorTo(line, zValue, min, max) {\n\n if (!this.lineColors) {\n return;\n }\n\n var hsl = {\n h: 0,\n s: 0,\n l: 0\n };\n\n for (var i in hsl) {\n\n if (zValue > 0) {\n hsl[i] = this.lineColors.fromPositive[i] + (this.lineColors.toPositive[i] - this.lineColors.fromPositive[i]) * (zValue / max);\n } else {\n hsl[i] = this.lineColors.fromNegative[i] + (this.lineColors.toNegative[i] - this.lineColors.fromNegative[i]) * (zValue / min);\n }\n }\n\n hsl.h /= 360;\n\n var rgb = util.hslToRgb(hsl.h, hsl.s, hsl.l);\n\n line.setAttribute('stroke', 'rgb(' + rgb.join() + ')');\n }\n\n getSymbolForLegend() {\n\n if (!this.lineForLegend) {\n\n var line = document.createElementNS(this.graph.ns, 'ellipse');\n\n line.setAttribute('cx', 7);\n line.setAttribute('cy', 0);\n line.setAttribute('rx', 8);\n line.setAttribute('ry', 3);\n\n line.setAttribute('cursor', 'pointer');\n this.lineForLegend = line;\n }\n\n this.applyLineStyle(this.lineForLegend, this.maxZ);\n\n return this.lineForLegend;\n }\n\n applyLineStyle(line, overwriteValue) {\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth() + (this.isSelected() ? 2 : 0));\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n }\n line.setAttribute('fill', 'none');\n\n this.setColorTo(line, overwriteValue !== undefined ? overwriteValue : line.getAttribute('data-zvalue'), this.minZ, this.maxZ);\n // line.setAttribute('shape-rendering', 'optimizeSpeed');\n\n this.hasStyleChanged(false);\n }\n\n setShapeZoom(shape) {\n this._shapeZoom = shape;\n }\n\n }\n\n exports.default = SerieContour;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 31 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShape);\n global.graphShapeAreaundercurve = mod.exports;\n }\n})(this, function (module, exports, _graphShape) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Displays a surface under a line serie\n * @extends GraphShape\n */\n class ShapeSurfaceUnderCurve extends _graphShape2.default {\n\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'path');\n }\n\n createHandles() {\n\n this._createHandles(2, 'line', {\n 'stroke-width': '3',\n 'stroke': 'transparent',\n 'pointer-events': 'stroke',\n 'cursor': 'ew-resize'\n });\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY) {\n\n if (this.isLocked()) {\n return;\n }\n\n if (this.moving) {\n\n this.getPosition(0).deltaPosition('x', deltaX, this.getXAxis());\n this.getPosition(1).deltaPosition('x', deltaX, this.getXAxis());\n } else if (this.serie && this.handleSelected) {\n\n this.resizingPosition = this.handleSelected == 1 ? this.getPosition(0) : this.getPosition(1);\n\n var value = this.serie.searchClosestValue(this.getXAxis().getVal(this.graph._getXY(e).x - this.graph.getPaddingLeft()));\n\n if (!value) {\n return;\n }\n\n if (this.resizingPosition.x != value.xMin) {\n this.preventUnselect = true;\n }\n\n this.resizingPosition.x = value.xMin;\n } else if (this.handleSelected) {\n\n this.resizingPosition = this.handleSelected == 1 ? this.getPosition(0) : this.getPosition(1);\n this.resizingPosition.deltaPosition('x', deltaX, this.getXAxis());\n }\n\n this.applyPosition();\n }\n /*\n redrawImpl: function() {\n //var doDraw = this.setPosition();\n //\tthis.setDom('fill', 'url(#' + 'patternFill' + this.graph._creation + ')')\n if ( this.position != this.doDraw ) {\n this.group.setAttribute( \"visibility\", this.position ? \"visible\" : 'hidden' );\n this.doDraw = this.position;\n }\n },\n */\n applyPosition() {\n\n if (!this.serie) {\n return;\n }\n\n var posXY = this.computePosition(0),\n posXY2 = this.computePosition(1),\n w = Math.abs(posXY.x - posXY2.x),\n x = Math.min(posXY.x, posXY2.x);\n\n // this.reversed = x == posXY2.x;\n\n if (w < 2 || x + w < 0 || x > this.graph.getDrawingWidth()) {\n this.setDom('d', '');\n return false;\n }\n\n var v1 = this.serie.searchClosestValue(this.getPosition(0).x),\n v2 = this.serie.searchClosestValue(this.getPosition(1).x),\n v3,\n i,\n j,\n init,\n max,\n k,\n x,\n y,\n firstX,\n firstY,\n currentLine,\n maxY = 0,\n minY = Number.MAX_VALUE;\n\n if (!v1 || !v2) {\n return false;\n }\n\n if (v1.xBeforeIndex > v2.xBeforeIndex) {\n v3 = v1;\n v1 = v2;\n v2 = v3;\n\n //this.handleSelected = ( this.handleSelected == 1 ) ? 2 : 1;\n }\n\n this.counter = 0;\n\n for (i = v1.dataIndex; i <= v2.dataIndex; i++) {\n this.currentLine = '';\n init = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n max = i == v2.dataIndex ? v2.xBeforeIndexArr : this.serie.data[i].length;\n k = 0;\n\n if (init == max) {\n max++;\n }\n\n for (j = init; j <= max; j += 2) {\n\n x = this.serie.getX(this.serie.data[i][j + 0]);\n y = this.serie.getY(this.serie.data[i][j + 1]);\n\n maxY = Math.max(this.serie.data[i][j + 1], maxY);\n minY = Math.min(this.serie.data[i][j + 1], minY);\n\n if (j == init) {\n this.firstX = x;\n this.firstY = y;\n }\n\n if (k > 0) {\n this.currentLine += ' L ' + x + ' ' + y + ' ';\n } else {\n this.currentLine += ' M ' + x + ' ' + y + ' ';\n }\n\n //this.serie._addPoint( x, y, false, this.currentLine );\n k++;\n }\n\n this.lastX = x;\n this.lastY = y;\n\n if (!this.firstX || !this.firstY || !this.lastX || !this.lastY) {\n return;\n }\n\n this.currentLine += ' V ' + this.getYAxis().getPx(0) + ' H ' + this.firstX + ' z';\n this.setDom('d', this.currentLine);\n }\n\n this.maxY = this.serie.getY(maxY);\n this.setHandles();\n\n this.changed();\n\n return true;\n }\n\n setHandles() {\n\n if (!this.firstX) {\n return;\n }\n\n var posXY = this.computePosition(0),\n posXY2 = this.computePosition(1);\n\n if (posXY.x < posXY2.x) {\n\n this.handles[1].setAttribute('x1', this.firstX);\n this.handles[1].setAttribute('x2', this.firstX);\n\n this.handles[2].setAttribute('x1', this.lastX);\n this.handles[2].setAttribute('x2', this.lastX);\n } else {\n\n this.handles[1].setAttribute('x1', this.lastX);\n this.handles[1].setAttribute('x2', this.lastX);\n\n this.handles[2].setAttribute('x1', this.firstX);\n this.handles[2].setAttribute('x2', this.firstX);\n }\n this.handles[1].setAttribute('y1', this.getYAxis().getMaxPx());\n this.handles[1].setAttribute('y2', this.serie.getY(0));\n\n this.handles[2].setAttribute('y1', this.getYAxis().getMaxPx());\n this.handles[2].setAttribute('y2', this.serie.getY(0));\n }\n }\n\n exports.default = ShapeSurfaceUnderCurve;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 32 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(12)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.line.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShapeLine);\n global.graphShapeArrow = mod.exports;\n }\n})(this, function (module, exports, _graphShapeLine) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShapeLine2 = _interopRequireDefault(_graphShapeLine);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Displays an arrow\n * @extends GraphShapeLine\n */\n class ShapeArrow extends _graphShapeLine2.default {\n\n constructor(graph) {\n\n super(graph);\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'line');\n this._dom.setAttribute('marker-end', 'url(#arrow' + this.graph._creation + ')');\n\n this.createHandles(this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n\n this.setStrokeColor('black');\n this.setStrokeWidth(1);\n }\n }\n\n exports.default = ShapeArrow;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 33 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShape);\n global.graphShapeLabel = mod.exports;\n }\n})(this, function (module, exports, _graphShape) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Blank shape used to display label\n * Use myShapelabel.setLabelText(); and associated methods\n * @extend GraphShape\n */\n class ShapeLabel extends _graphShape2.default {\n\n constructor(graph, options) {\n\n super(graph, options);\n }\n\n createDom() {\n return false;\n }\n\n applyPosition() {\n return true;\n }\n }\n\n exports.default = ShapeLabel;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 34 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShape);\n global.graphShapePolyline = mod.exports;\n }\n})(this, function (module, exports, _graphShape) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Represents a line that extends the Shape class. Used by the plugin {@link PluginSerieLineDifference}\n * @extends Shape\n * @see Graph#newShape\n */\n class ShapePolyline extends _graphShape2.default {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'path');\n\n if (!this.getStrokeColor()) {\n this.setStrokeColor('black');\n }\n\n if (this.getStrokeWidth() == undefined) {\n this.setStrokeWidth(1);\n }\n }\n\n /**\n * No handles for the polyline\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {}\n\n /**\n * Force the points of the polyline already computed in pixels\n * @param {String} a SVG string to be used in the ```d``` attribute of the path.\n * @return {ShapePolyline} The current polyline instance\n */\n setPointsPx(points) {\n this.setProp('pxPoints', points);\n return this;\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n let pxPoints;\n let pos = this.computePosition(0);\n\n if (pxPoints = this.getProp('pxPoints')) {\n\n pxPoints = ' M ' + pos.x + ' ' + pos.y + ' ' + pxPoints;\n this.setDom('d', pxPoints);\n } else if (this.points) {\n\n var xAxis, yAxis;\n\n if (this.serie) {\n\n xAxis = this.serie.getXAxis();\n yAxis = this.serie.getYAxis();\n } else if (this.xAxis && this.yAxis) {\n\n xAxis = this.xAxis;\n yAxis = this.yAxis;\n }\n\n this.setDom('d', 'M ' + this.points.map(function (p) {\n return xAxis.getPx(p[0]) + ', ' + yAxis.getPx(p[1]);\n }).join(' L '));\n }\n\n this.changed();\n return true;\n }\n }\n\n exports.default = ShapePolyline;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 35 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(1), __webpack_require__(6)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.js'), require('../graph.position.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShape, global.graphPosition);\n global.graphShapeNmrintegral = mod.exports;\n }\n})(this, function (module, exports, _graphShape, _graphPosition) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n var _graphPosition2 = _interopRequireDefault(_graphPosition);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Displays an integral with NMR style\n * @extends ShapeSurfaceUnderCurve\n */\n class ShapeNMRIntegral extends _graphShape2.default {\n\n constructor(graph, options) {\n\n super(graph, options);\n\n this.nbHandles = 2;\n }\n\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'path');\n this._domShadow = document.createElementNS(this.graph.ns, 'path');\n this._domShadow.jsGraphIsShape = this;\n this._dom.setAttribute('pointer-events', 'stroke');\n this._domShadow.setAttribute('pointer-events', 'stroke');\n this._domShadow.setAttribute('stroke-width', '12');\n this._domShadow.setAttribute('fill', 'transparent');\n this._domShadow.setAttribute('stroke', 'transparent');\n this.group.appendChild(this._domShadow);\n }\n\n initImpl() {\n this.setFillColor('transparent');\n this.setStrokeColor('black');\n }\n\n createHandles() {\n\n this._createHandles(2, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white'\n });\n\n this.handles[1].setAttribute('fill', 'red');\n }\n\n xor(a, b) {\n return a && !b || !a && b;\n }\n\n applyPosition() {\n\n let x,\n y,\n xVal,\n yVal,\n axis = this.getAxis(),\n points = [];\n\n let currentLine = '',\n baseLine = this.getProp('baseLine', 0) || 300,\n ratio;\n\n if (!this.serie) {\n throw 'No serie exists for this shape';\n }\n /*\n this.sortPositions( ( a, b ) => {\n return a.x - b.x;\n } );\n */\n let pos1 = this.getPosition(0);\n let pos2 = this.getPosition(1);\n\n if (pos1.x < this.serie.getXAxis().getCurrentMin() && pos2.x < this.serie.getXAxis().getCurrentMin() || pos1.x > this.serie.getXAxis().getCurrentMax() && pos2.x > this.serie.getXAxis().getCurrentMax()) {\n this.setDom('d', '');\n this._domShadow.setAttribute('d', '');\n\n this.hideLabel(0);\n return false;\n }\n\n this.showLabel(0);\n\n let sum = 0;\n\n let j;\n let waveform = this.serie.getWaveform();\n\n if (!waveform) {\n return;\n }\n\n let index1 = waveform.getIndexFromX(pos1[axis], true, Math.floor),\n index2 = waveform.getIndexFromX(pos2[axis], true, Math.ceil),\n index3,\n flipped = false;\n\n if (index1 == index2) {\n // At least one px please !\n if (waveform.getReductionType() == 'aggregate') {\n index2 += 4; // Aggregated state\n } else {\n index2++; // Non aggregated state\n }\n }\n\n if (index2 < index1) {\n index3 = index1;\n index1 = index2;\n index2 = index3;\n flipped = true;\n }\n\n let firstX, firstY, firstXVal, firstYVal, lastX, lastXVal, lastY, lastYVal;\n let data = waveform.getDataInUse();\n\n let condition, incrementation;\n\n let normalSums = true;\n if (waveform.getReductionType() == 'aggregate') {\n normalSums = false;\n }\n\n if (waveform.getXMonotoneousAscending() && // Ascending\n 1 == 1 || !waveform.getXMonotoneousAscending() && // Ascending\n 1 == 2) {\n\n j = index2;\n condition = true;\n incrementation = -1;\n } else {\n\n j = index1;\n condition = false;\n incrementation = 1;\n }\n\n for (; condition ? j >= index1 : j <= index2; j += incrementation) {\n\n xVal = waveform.getX(j, true);\n yVal = waveform.getY(j, true);\n\n x = this.serie.getX(xVal);\n y = this.serie.getY(yVal);\n\n /*\n if ( ! normalSums && j % 4 == 0 && j >= index1 && data.sums ) { // Sums are located every 4 element\n sum += data.sums[ j ];// * ( waveform.getX( j, true ) - waveform.getX( j - 3, true ) ); // y * (out-in)\n } else if( normalSums ) {\n */\n sum += waveform.getY(j, true); // * ( waveform.getX( j, true ) - waveform.getX( j - 1, true ) ); // y * (out-in)\n //}\n\n if (!firstX) {\n\n firstX = x;\n firstY = y;\n firstXVal = waveform.getX(j);\n firstYVal = waveform.getY(j);\n }\n\n if (lastX == undefined) {\n\n lastX = x;\n lastY = y;\n lastXVal = waveform.getX(j);\n lastYVal = waveform.getY(j);\n continue;\n }\n\n if (x == lastX && y == lastY) {\n //continue;\n }\n\n lastX = x;\n lastY = y;\n //console.log( data, data[ j ] );\n\n points.push([x, y, sum]);\n lastXVal = xVal;\n }\n\n lastXVal = false;\n lastYVal = false;\n lastX = false;\n lastY = false;\n\n if (sum == 0) {\n sum = 1;\n }\n\n this._sumVal = waveform.integrate(pos1.x, pos2.x);\n\n if (!this.ratio) {\n // 150px / unit\n ratio = 200 / sum;\n } else {\n // Already existing\n ratio = this.ratio * (this.sumVal / sum);\n }\n let py;\n\n if (points.length == 0) {\n return;\n }\n\n for (var i = 0, l = points.length; i < l; i++) {\n\n py = baseLine - points[i][2] * ratio;\n\n if (i > 0 && (points[i - 1][2] > sum / 2 && points[i][2] <= sum / 2 || points[i - 1][2] < sum / 2 && points[i][2] >= sum / 2)) {\n\n let pos = baseLine - (points[i - 1][2] + points[i][2]) / 2 * ratio;\n\n this.setPosition({\n x: points[i][0] + 'px',\n y: pos + 'px'\n\n }, 3);\n\n this.setLabelPosition(this.getPosition(3), 0);\n }\n\n currentLine += ' L ' + points[i][0] + ', ' + py + ' ';\n\n this.lastPointX = points[i][0];\n this.lastPointY = py;\n }\n\n this.points = points;\n this._sum = sum;\n\n if (this.serie.isFlipped()) {\n currentLine = ' M ' + baseLine + ', ' + firstX + ' ' + currentLine;\n } else {\n currentLine = ' M ' + firstX + ', ' + baseLine + ' ' + currentLine;\n }\n\n this.firstPointX = firstX;\n this.firstPointY = baseLine;\n\n this.setDom('d', currentLine);\n this._domShadow.setAttribute('d', currentLine);\n\n this.firstX = firstX;\n this.firstY = firstY;\n /*\n if ( this._selected ) {\n this.select();\n }\n this.setHandles();*/\n\n this.serie.ratioLabel && this.updateIntegralValue(this.serie.ratioLabel) || this.updateLabels();\n\n this.changed();\n this.handleCondition = !this.xor(incrementation == -1, flipped);\n this.setHandles();\n\n this.updateIntegralValue();\n\n return true;\n }\n\n updateIntegralValue(ratioLabel = this.serie.ratioLabel, forceValue) {\n console.log(ratioLabel);\n if (ratioLabel) {\n this.serie.ratioLabel = ratioLabel;\n }\n\n if (!isNaN(forceValue) && !isNaN(this.sumVal) && this.sumVal) {\n this.serie.ratioLabel = forceValue / this.sumVal;\n }\n\n this.setLabelText(ratioLabel ? (Math.round(100 * this.sumVal * ratioLabel) / 100).toPrecision(3) : 'N/A', 0);\n this.updateLabels();\n return this.serie.ratioLabel;\n }\n\n getAxis() {\n return this._data.axis || 'x';\n }\n\n /**\n * User to screen coordinate transform. In (unit)/(px), (unit) being the unit of the integral (x * y)\n * @type {Number}\n */\n set ratio(r) {\n this._ratio = r;\n }\n\n get ratio() {\n return this._ratio;\n }\n\n get sum() {\n return this._sum;\n }\n\n get sumVal() {\n return this._sumVal;\n }\n\n selectStyle() {\n this.setDom('stroke-width', '2px');\n }\n\n selectHandles() {} // Cancel areaundercurve\n\n setHandles() {\n\n if (this.points == undefined) {\n return;\n }\n\n if (!this.isSelected()) {\n return;\n }\n\n this.addHandles();\n\n if (this.handleCondition) {\n\n this.handles[1].setAttribute('x', this.firstPointX);\n this.handles[1].setAttribute('y', this.firstPointY);\n this.handles[2].setAttribute('x', this.lastPointX);\n this.handles[2].setAttribute('y', this.lastPointY);\n } else {\n\n this.handles[2].setAttribute('x', this.firstPointX);\n this.handles[2].setAttribute('y', this.firstPointY);\n this.handles[1].setAttribute('x', this.lastPointX);\n this.handles[1].setAttribute('y', this.lastPointY);\n }\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n if (this.isLocked()) {\n return;\n }\n\n var pos = this.getPosition(0);\n var pos2 = this.getPosition(1);\n\n var posToChange;\n\n if (this.handleSelected == 1) {\n\n posToChange = pos;\n } else if (this.handleSelected == 2) {\n\n posToChange = pos2;\n }\n\n if (posToChange) {\n\n if (!this._data.vertical) {\n posToChange.deltaPosition('x', deltaX, this.getXAxis());\n }\n }\n\n if (this.moving) {\n\n // If the pos2 is defined by a delta, no need to move them\n if (pos.x) {\n pos.deltaPosition('x', deltaX, this.getXAxis());\n }\n\n // If the pos2 is defined by a delta, no need to move them\n if (pos2.x) {\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n }\n }\n\n if (this.rectEvent) {\n this.setEventReceptacle();\n }\n\n this.redraw();\n this.changed();\n\n return true;\n }\n }\n\n exports.default = ShapeNMRIntegral;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 36 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(18)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.rect.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShapeRect);\n global.graphShapePeakintegration2d = mod.exports;\n }\n})(this, function (module, exports, _graphShapeRect) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShapeRect2 = _interopRequireDefault(_graphShapeRect);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n class ShapePeakIntegration2D extends _graphShapeRect2.default {\n\n constructor(graph, options) {\n\n super(graph, options);\n this.nbHandles = 4;\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'rect');\n this._dom.element = this;\n\n this.createHandles(this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n\n redrawImpl() {\n\n this.setPosition();\n this.setHandles();\n this.setBindableToDom(this._dom);\n }\n\n }\n\n exports.default = ShapePeakIntegration2D;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 37 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShape);\n global.graphShapeCross = mod.exports;\n }\n})(this, function (module, exports, _graphShape) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Displays a cross\n * @extends Shape\n */\n class ShapeCross extends _graphShape2.default {\n\n constructor(graph, options) {\n super(graph, options);\n this.nbHandles = 1;\n }\n\n /**\n * Width of the cross, also available from the constructor\n * @type {Number} width\n */\n get width() {\n return this.options.width || 10;\n }\n\n set width(l) {\n this.options.width = l;\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'path');\n this._dom.setAttribute('d', 'M -' + this.width / 2 + ' 0 h ' + this.width + ' m -' + this.width / 2 + ' -' + this.width / 2 + ' v ' + this.width + '');\n }\n\n createHandles() {\n\n this._createHandles(this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n applyPosition() {\n\n var position = this.calculatePosition(0);\n if (!position || !position.x || !position.y) {\n return;\n }\n\n this.setDom('transform', 'translate( ' + position.x + ', ' + position.y + ')');\n\n this.currentPos1x = position.x;\n this.currentPos1y = position.y;\n\n return true;\n }\n\n redrawImpl() {\n\n this.setHandles();\n }\n\n handleCreateImpl() {}\n\n handleMouseDownImpl(e) {\n\n this.moving = true;\n\n return true;\n }\n\n handleMouseUpImpl() {\n\n this.triggerChange();\n return true;\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n if (this.isLocked()) {\n return;\n }\n\n var pos = this.getFromData('pos');\n\n if (this.moving) {\n\n pos.x = this.graph.deltaPosition(pos.x, deltaX, this.getXAxis());\n pos.y = this.graph.deltaPosition(pos.y, deltaY, this.getYAxis());\n }\n\n this.redrawImpl();\n\n return true;\n }\n\n setHandles() {\n\n if (!this.areHandlesInDom()) {\n return;\n }\n\n if (isNaN(this.currentPos1x)) {\n return;\n }\n\n this.handles[1].setAttribute('x', this.currentPos1x);\n this.handles[1].setAttribute('y', this.currentPos1y);\n }\n\n selectStyle() {\n this.setDom('stroke', 'red');\n this.setDom('stroke-width', '2');\n }\n }\n\n exports.default = ShapeCross;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 38 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(12)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.shape.line.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphShapeLine);\n global.graphShapePeakboundariescenter = mod.exports;\n }\n})(this, function (module, exports, _graphShapeLine) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShapeLine2 = _interopRequireDefault(_graphShapeLine);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Shows a horizontal line with three little vertical bars. Very useful to demonstrate a peak start, end and middle value\n * @extends ShapeLine\n */\n class ShapePeakBoundaries extends _graphShapeLine2.default {\n\n constructor(graph) {\n super(graph);\n this.lineHeight = 6;\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'line');\n this.line1 = document.createElementNS(this.graph.ns, 'line');\n this.line2 = document.createElementNS(this.graph.ns, 'line');\n this.line3 = document.createElementNS(this.graph.ns, 'line');\n\n this.rectBoundary = document.createElementNS(this.graph.ns, 'path');\n\n this.rectBoundary.setAttribute('fill', 'transparent');\n this.rectBoundary.setAttribute('stroke', 'none');\n this.rectBoundary.setAttribute('pointer-events', 'fill');\n\n this.rectBoundary.jsGraphIsShape = true;\n\n this.group.appendChild(this.rectBoundary);\n this.group.appendChild(this.line1);\n this.group.appendChild(this.line2);\n this.group.appendChild(this.line3);\n this._dom.element = this;\n }\n\n createHandles() {\n this._createHandles(3, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n\n redrawImpl() {\n\n this.line1.setAttribute('stroke', this.getStrokeColor());\n this.line2.setAttribute('stroke', this.getStrokeColor());\n this.line3.setAttribute('stroke', this.getStrokeColor());\n\n this.line1.setAttribute('stroke-width', this.getStrokeWidth());\n this.line2.setAttribute('stroke-width', this.getStrokeWidth());\n this.line3.setAttribute('stroke-width', this.getStrokeWidth());\n\n this.setHandles();\n this.redrawLines();\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Redraws the vertical lines according to the positions.\n * Position 0 is the left line, position 1 is the right line and position 2 is the center line\n * @returns {ShapePeakBoundaries} The shape instance\n */\n redrawLines() {\n\n var posLeft = this.computePosition(0);\n var posRight = this.computePosition(1);\n var posCenter = this.computePosition(2);\n\n if (posLeft.x && posRight.x && posCenter.x && this.posYPx) {\n\n var height = this.lineHeight;\n this.rectBoundary.setAttribute('d', 'M ' + posLeft.x + ' ' + (this.posYPx - height) + ' v ' + 2 * height + ' H ' + posRight.x + ' v ' + -2 * height + 'z');\n this.line1.setAttribute('x1', posLeft.x);\n this.line1.setAttribute('x2', posLeft.x);\n\n this.line2.setAttribute('x1', posRight.x);\n this.line2.setAttribute('x2', posRight.x);\n\n this.line3.setAttribute('x1', posCenter.x);\n this.line3.setAttribute('x2', posCenter.x);\n\n this._dom.setAttribute('x1', posLeft.x);\n this._dom.setAttribute('x2', posRight.x);\n\n this.redrawY(height);\n }\n\n return this;\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Redraws the vertical positions of the shape\n * @returns {ShapePeakBoundaries} The shape instance\n */\n redrawY() {\n\n if (!this.posYPx) {\n return this;\n }\n\n var height = this.lineHeight;\n\n this.line1.setAttribute('y1', this.posYPx - height);\n this.line1.setAttribute('y2', this.posYPx + height);\n\n this.line2.setAttribute('y1', this.posYPx - height);\n this.line2.setAttribute('y2', this.posYPx + height);\n\n this.line3.setAttribute('y1', this.posYPx - height);\n this.line3.setAttribute('y2', this.posYPx + height);\n\n this._dom.setAttribute('y1', this.posYPx);\n this._dom.setAttribute('y2', this.posYPx);\n\n return this;\n }\n\n setHandles() {\n\n if (!this.posYPx) {\n return;\n }\n\n var posLeft = this.computePosition(0);\n var posRight = this.computePosition(1);\n var posCenter = this.computePosition(2);\n\n if (posLeft.x && posRight.x && posCenter.x) {\n\n this.handles[1].setAttribute('x', posLeft.x);\n this.handles[1].setAttribute('y', this.posYPx);\n\n this.handles[2].setAttribute('x', posRight.x);\n this.handles[2].setAttribute('y', this.posYPx);\n\n this.handles[3].setAttribute('x', posCenter.x);\n this.handles[3].setAttribute('y', this.posYPx);\n }\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Sets the y position of the shape\n * @param {Number} y - The y position in px\n * @returns {ShapePeakBoundaries} The shape instance\n */\n setY(y) {\n this.posYPx = y;\n return this;\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Sets the height of the peak lines\n * @param {Number} height - The height of the lines in px\n * @returns {ShapePeakBoundaries} The shape instance\n */\n setLineHeight(height) {\n this.lineHeihgt = height;\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY) {\n\n if (this.isLocked()) {\n return;\n }\n\n var posLeft = this.getPosition(0);\n var posRight = this.getPosition(1);\n var posCenter = this.getPosition(2);\n\n switch (this.handleSelected) {\n\n case 1:\n // left\n posLeft.deltaPosition('x', deltaX, this.getXAxis());\n\n if (Math.abs(posCenter.x - posRight.x) > Math.abs(posRight.x - posLeft.x) || Math.abs(posCenter.x - posLeft.x) > Math.abs(posRight.x - posLeft.x)) {\n posCenter.x = posLeft.x + (posRight.x - posLeft.x) * 0.1;\n }\n break;\n\n case 2:\n // left\n\n posRight.deltaPosition('x', deltaX, this.getXAxis());\n\n if (Math.abs(posCenter.x - posRight.x) > Math.abs(posRight.x - posLeft.x) || Math.abs(posCenter.x - posLeft.x) > Math.abs(posRight.x - posLeft.x)) {\n posCenter.x = posRight.x + (posLeft.x - posRight.x) * 0.1;\n }\n\n break;\n\n case 3:\n // left\n\n posCenter.deltaPosition('x', deltaX, this.getXAxis());\n\n if (Math.abs(posCenter.x - posRight.x) > Math.abs(posRight.x - posLeft.x) || Math.abs(posCenter.x - posLeft.x) > Math.abs(posRight.x - posLeft.x)) {\n return;\n }\n\n break;\n\n }\n\n this.setLabelPosition({\n y: this.getLabelPosition(0).y,\n x: posCenter.x\n });\n\n this.updateLabels();\n this.redrawLines();\n this.setHandles();\n }\n\n applyPosition() {\n\n this.redrawLines();\n return true;\n }\n\n }\n\n exports.default = ShapePeakBoundaries;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 39 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0), __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'), require('./graph.shape.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil, global.graphShape);\n global.graphShapeHtml = mod.exports;\n }\n})(this, function (module, exports, _graphUtil, _graphShape) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Represents a line\n * @extends Shape\n * @see Graph#newShape\n */\n class ShapeHTML extends _graphShape2.default {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElement('div');\n // this._dom.setAttribute( \"requiredExtensions\", \"http://www.w3.org/1999/xhtml\" );\n\n this._dom.setAttribute('style', 'position: absolute');\n let div = document.createElement('div');\n this._dom.appendChild(div);\n this.div = div;\n }\n\n /**\n * Creates the handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {}\n\n setHeight(height) {\n this.setProp('height', height);\n }\n\n setWidth(width) {\n this.setProp('width', width);\n }\n\n setContent(content) {\n this.setProp('content', content);\n }\n\n setRenderer(method) {\n this._renderer = method;\n }\n\n redraw() {\n\n if (this._renderer) {\n this._renderer(this.div);\n } else {\n this.div.innerHTML = this.getProp('content');\n }\n\n super.redraw(...arguments);\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n var position = this.calculatePosition(0);\n\n if (!position || !(0, _graphUtil.isNumeric)(position.x) || !(0, _graphUtil.isNumeric)(position.y)) {\n return;\n }\n this._dom.style.left = position.x + 'px';\n this._dom.style.top = position.y + 'px';\n\n this.currentPosX = position.x;\n this.currentPosY = position.y;\n\n return true;\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n return true;\n }\n\n /**\n * Sets the handle position\n * @private\n */\n setHandles() {}\n\n isHTML() {\n return true;\n }\n }\n\n exports.default = ShapeHTML;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 40 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.plugin.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphPlugin);\n global.graphPluginDrag = mod.exports;\n }\n})(this, function (module, exports, _graphPlugin) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * Constructor for the drag plugin. Do not use this constructor directly.\n * @class PluginDrag\n * @implements Plugin\n */\n class PluginDrag extends _graphPlugin2.default {\n\n static default() {\n return {\n\n dragX: true,\n dragY: true,\n persistanceX: false,\n persistanceY: false\n\n };\n }\n\n /**\n * @private\n */\n init(graph) {\n\n this.graph = graph;\n this.time = null;\n this.totaltime = 2000;\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, target) {\n this._draggingX = x;\n this._draggingY = y;\n\n this._lastDraggingX = this._draggingX;\n this._lastDraggingY = this._draggingY;\n\n this.stopAnimation = true;\n\n this.moved = false;\n\n return true;\n }\n\n /**\n * @memberof PluginDrag\n * @private\n */\n onMouseMove(graph, x, y, e, target) {\n\n var deltaX = x - this._draggingX;\n var deltaY = y - this._draggingY;\n\n if (this.options.dragX) {\n graph._applyToAxes(function (axis) {\n axis.setCurrentMin(axis.getVal(axis.getMinPx() - deltaX));\n axis.setCurrentMax(axis.getVal(axis.getMaxPx() - deltaX));\n }, false, true, false);\n }\n\n if (this.options.dragY) {\n\n graph._applyToAxes(function (axis) {\n axis.setCurrentMin(axis.getVal(axis.getMinPx() - deltaY));\n axis.setCurrentMax(axis.getVal(axis.getMaxPx() - deltaY));\n }, false, false, true);\n }\n\n this._lastDraggingX = this._draggingX;\n this._lastDraggingY = this._draggingY;\n\n this._draggingX = x;\n this._draggingY = y;\n\n this.moved = true;\n\n this.time = Date.now();\n\n this.emit('dragging');\n\n graph.draw(true);\n }\n\n onMouseUp(graph, x, y, e, target) {\n\n var dt = Date.now() - this.time;\n\n if (x == this._lastDraggingX || y == this._lastDraggingY) {\n\n if (this.moved) {\n this.emit('dragged');\n }\n\n return;\n }\n\n this.speedX = (x - this._lastDraggingX) / dt;\n this.speedY = (y - this._lastDraggingY) / dt;\n\n if (isNaN(this.speedX) || isNaN(this.speedY)) {\n this.emit('dragged');\n return;\n }\n\n graph._applyToAxes(function (axis) {\n axis._pluginDragMin = axis.getCurrentMin();\n axis._pluginDragMax = axis.getCurrentMax();\n }, false, true, true);\n\n this.stopAnimation = false;\n this.accelerationX = -this.speedX / this.totaltime;\n this.accelerationY = -this.speedY / this.totaltime;\n\n if (this.options.persistanceX || this.options.persistanceY) {\n\n this._persistanceMove(graph);\n } else {\n\n this.emit('dragged');\n }\n }\n\n _persistanceMove(graph) {\n\n var self = this;\n\n if (self.stopAnimation) {\n self.emit('dragged');\n return;\n }\n\n window.requestAnimationFrame(function () {\n\n var dt = Date.now() - self.time;\n var dx = (0.5 * self.accelerationX * dt + self.speedX) * dt;\n var dy = (0.5 * self.accelerationY * dt + self.speedY) * dt;\n\n if (self.options.persistanceX) {\n\n graph._applyToAxes(function (axis) {\n\n axis.setCurrentMin(-axis.getRelVal(dx) + axis._pluginDragMin);\n axis.setCurrentMax(-axis.getRelVal(dx) + axis._pluginDragMax);\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n }, false, true, false);\n }\n\n if (self.options.persistanceY) {\n\n graph._applyToAxes(function (axis) {\n\n axis.setCurrentMin(-axis.getRelVal(dy) + axis._pluginDragMin);\n axis.setCurrentMax(-axis.getRelVal(dy) + axis._pluginDragMax);\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n }, false, false, true);\n }\n\n graph.draw();\n\n if (dt < self.totaltime) {\n self.emit('dragging');\n self._persistanceMove(graph);\n } else {\n self.emit('dragged');\n }\n });\n }\n }\n\n exports.default = PluginDrag;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 41 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(2), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.plugin.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphPlugin, global.graphUtil);\n global.graphPluginShape = mod.exports;\n }\n})(this, function (module, exports, _graphPlugin, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * @class PluginShape\n * @implements Plugin\n */\n class PluginShape extends _graphPlugin2.default {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n return {};\n }\n\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n\n super.init(graph, options);\n this.shapeType = options.type;\n }\n\n /**\n * Sets the shape that is created by the plugin\n * @param {String} shapeType - The type of the shape\n */\n setShape(shapeType) {\n this.shapeInfo.shapeType = shapeType;\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, target) {\n\n if (!this.shapeType && !this.options.url) {\n return;\n }\n\n var self = this,\n selfPlugin = this;\n\n var xVal, yVal;\n\n this.count = this.count || 0;\n\n x -= graph.getPaddingLeft();\n y -= graph.getPaddingTop();\n\n xVal = graph.getXAxis().getVal(x);\n yVal = graph.getYAxis().getVal(y);\n\n var shapeInfo = {\n\n position: [{\n x: xVal,\n y: yVal\n }, {\n x: xVal,\n y: yVal\n }],\n\n onChange: function (newData) {\n graph.triggerEvent('onAnnotationChange', newData);\n },\n\n locked: false,\n selectable: true,\n resizable: true,\n movable: true\n };\n\n let shapeProperties = this.options.properties;\n\n util.extend(true, shapeInfo, this.options);\n\n this.emit('beforeNewShape', e, shapeInfo);\n\n if (this.graph.prevent(false)) {\n return;\n }\n\n var shape = graph.newShape(shapeInfo.type, shapeInfo, false, shapeProperties);\n\n this.emit('createdShape', e, shape);\n\n if (shape) {\n self.currentShape = shape;\n self.currentShapeEvent = e;\n }\n\n graph.once('mouseUp', () => {\n console.log(this.currentShape);\n if (!this.currentShape) {\n // The mouse has moved\n self.emit('newShape', e, shape);\n }\n });\n }\n\n /**\n * @private\n */\n onMouseMove(graph, x, y, e) {\n\n if (this.currentShape) {\n console.log('mv');\n this.count++;\n\n var shape = this.currentShape;\n\n this.currentShape = false;\n\n if (graph.selectedSerie && !shape.serie) {\n shape.setSerie(graph.selectedSerie);\n }\n\n shape.resizing = true;\n\n if (shape.options && shape.options.onCreate) {\n shape.options.onCreate.call(shape);\n }\n\n shape.draw();\n graph.selectShape(shape);\n shape.handleMouseDown(this.currentShapeEvent, true);\n shape.handleSelected = this.options.handleSelected || 1;\n shape.handleMouseMove(e, true);\n }\n }\n\n /**\n * @private\n */\n onMouseUp() {\n\n if (this.currentShape) {\n // No need to kill it as it hasn't been actually put in the dom right now\n\n // Norman 30 July 2017: Yes but it's added in the jsGraph stack. We need to remove it. See #176\n // From now on killing the shape will result in removing it from the stack as well.\n this.currentShape.kill();\n this.currentShape = false;\n }\n }\n\n }\n\n exports.default = PluginShape;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 42 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'), require('./graph.plugin.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil, global.graphPlugin);\n global.graphPluginSelectScatter = mod.exports;\n }\n})(this, function (module, exports, _graphUtil, _graphPlugin) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n /**\n * @extends Plugin\n */\n class PluginSelectScatter extends _graphPlugin2.default {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n return {};\n }\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n\n this._path = document.createElementNS(graph.ns, 'path');\n\n util.setAttributeTo(this._path, {\n 'display': 'none',\n 'fill': 'rgba(0,0,0,0.1)',\n 'stroke': 'rgba(0,0,0,1)',\n 'shape-rendering': 'crispEdges',\n 'x': 0,\n 'y': 0,\n 'height': 0,\n 'width': 0,\n 'd': ''\n });\n\n this.graph = graph;\n\n graph.dom.appendChild(this._path);\n }\n\n /**\n * Assigns the scatter serie that should be selected to the plugin\n * @param {ScatterSerie} serie - The serie\n * @return {PluginSelectScatter} The current plugin instance\n */\n setSerie(serie) {\n this.serie = serie;\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, mute) {\n\n if (!this.serie) {\n return;\n }\n\n this.path = 'M ' + x + ' ' + y + ' ';\n this.currentX = x;\n this.currentY = y;\n\n this.xs = [this.serie.getXAxis().getVal(x - graph.getPaddingLeft())];\n this.ys = [this.serie.getYAxis().getVal(y - graph.getPaddingTop())];\n this._path.setAttribute('d', '');\n this._path.setAttribute('display', 'block');\n }\n\n /**\n * @private\n */\n onMouseMove(graph, x, y, e, mute) {\n\n if (Math.pow(x - this.currentX, 2) + Math.pow(y - this.currentY, 2) > 25) {\n\n this.path += ' L ' + x + ' ' + y + ' ';\n this.currentX = x;\n this.currentY = y;\n\n this.xs.push(this.serie.getXAxis().getVal(x - graph.getPaddingLeft()));\n this.ys.push(this.serie.getYAxis().getVal(y - graph.getPaddingTop()));\n\n this._path.setAttribute('d', this.path + ' z');\n\n this.findPoints();\n }\n }\n\n /**\n * @private\n */\n findPoints() {\n\n var data = this.serie.waveform;\n var selected = [];\n var counter = 0,\n j2;\n for (var i = 0, l = data.getLength(); i < l; i += 1) {\n\n counter = 0;\n for (var j = 0, k = this.xs.length; j < k; j += 1) {\n\n if (j == k - 1) {\n j2 = 0;\n } else {\n j2 = j + 1;\n }\n\n if (this.ys[j] < data.getY(i) && this.ys[j2] > data.getY(i) || this.ys[j] > data.getY(i) && this.ys[j2] < data.getY(i)) {\n\n if (data.getX(i) > (data.getY(i) - this.ys[j]) / (this.ys[j2] - this.ys[j]) * (this.xs[j2] - this.xs[j]) + this.xs[j]) {\n counter++;\n }\n }\n }\n\n if (counter % 2 == 1) {\n selected.push(i);\n this.serie.selectPoint(i, true, 'selected');\n } else {\n this.serie.unselectPoint(i);\n }\n }\n\n this.selected = selected;\n this.emit('selectionProcess', selected);\n }\n\n /**\n * @private\n */\n onMouseUp(graph, x, y, e) {\n this._path.setAttribute('display', 'none');\n this.emit('selectionEnd', this.selected);\n }\n\n }\n\n exports.default = PluginSelectScatter;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 43 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'), require('./graph.plugin.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil, global.graphPlugin);\n global.graphPluginZoom = mod.exports;\n }\n})(this, function (module, exports, _graphUtil, _graphPlugin) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n /**\n * @class PluginZoom\n * @implements Plugin\n */\n class PluginZoom extends _graphPlugin2.default {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n\n return {\n 'axes': 'all'\n };\n }\n\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n\n this._zoomingGroup = document.createElementNS(graph.ns, 'g');\n this._zoomingSquare = document.createElementNS(graph.ns, 'rect');\n this._zoomingSquare.setAttribute('display', 'none');\n\n util.setAttributeTo(this._zoomingSquare, {\n 'display': 'none',\n 'fill': 'rgba(171,12,12,0.2)',\n 'stroke': 'rgba(171,12,12,1)',\n 'shape-rendering': 'crispEdges',\n 'x': 0,\n 'y': 0,\n 'height': 0,\n 'width': 0,\n 'pointer-events': 'none'\n });\n\n this.graph = graph;\n graph.groupEvent.appendChild(this._zoomingGroup);\n this._zoomingGroup.appendChild(this._zoomingSquare);\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, mute) {\n\n var zoomMode = this.options.zoomMode;\n\n if (!zoomMode) {\n return;\n }\n\n this._zoomingMode = zoomMode;\n\n if (x === undefined) {\n this._backedUpZoomMode = this._zoomingMode;\n this._zoomingMode = 'y';\n x = 0;\n }\n\n if (y === undefined) {\n this._backedUpZoomMode = this._zoomingMode;\n this._zoomingMode = 'x';\n y = 0;\n }\n\n this._zoomingXStart = x;\n this._zoomingYStart = y;\n this.x1 = x - graph.getPaddingLeft();\n this.y1 = y - graph.getPaddingTop();\n\n this._zoomingSquare.setAttribute('width', 0);\n this._zoomingSquare.setAttribute('height', 0);\n this._zoomingSquare.setAttribute('display', 'block');\n\n switch (this._zoomingMode) {\n\n case 'x':\n this._zoomingSquare.setAttribute('y', graph.options.paddingTop);\n this._zoomingSquare.setAttribute('height', graph.getDrawingHeight() - graph.shift.bottom);\n break;\n\n case 'y':\n this._zoomingSquare.setAttribute('x', graph.options.paddingLeft /* + this.shift[1]*/);\n this._zoomingSquare.setAttribute('width', graph.getDrawingWidth() /* - this.shift[1] - this.shift[2]*/);\n break;\n\n case 'forceY2':\n\n this.y2 = graph.getYAxis().getPx(this.options.forcedY) + graph.options.paddingTop;\n\n break;\n\n }\n\n if (this.options.onZoomStart && !mute) {\n this.options.onZoomStart(graph, x, y, e, mute);\n }\n }\n\n /**\n * @private\n */\n onMouseMove(graph, x, y, e, mute) {\n\n //\tthis._zoomingSquare.setAttribute('display', 'none');\n\n //\tthis._zoomingSquare.setAttribute('transform', 'translate(' + Math.random() + ', ' + Math.random() + ') scale(10, 10)');\n switch (this._zoomingMode) {\n\n case 'xy':\n this._zoomingSquare.setAttribute('x', Math.min(this._zoomingXStart, x));\n this._zoomingSquare.setAttribute('y', Math.min(this._zoomingYStart, y));\n this._zoomingSquare.setAttribute('width', Math.abs(this._zoomingXStart - x));\n this._zoomingSquare.setAttribute('height', Math.abs(this._zoomingYStart - y));\n\n break;\n\n case 'forceY2':\n this._zoomingSquare.setAttribute('y', Math.min(this._zoomingYStart, this.y2));\n this._zoomingSquare.setAttribute('height', Math.abs(this._zoomingYStart - this.y2));\n this._zoomingSquare.setAttribute('x', Math.min(this._zoomingXStart, x));\n this._zoomingSquare.setAttribute('width', Math.abs(this._zoomingXStart - x));\n\n break;\n\n case 'x':\n this._zoomingSquare.setAttribute('x', Math.min(this._zoomingXStart, x));\n this._zoomingSquare.setAttribute('width', Math.abs(this._zoomingXStart - x));\n\n break;\n\n case 'y':\n this._zoomingSquare.setAttribute('y', Math.min(this._zoomingYStart, y));\n this._zoomingSquare.setAttribute('height', Math.abs(this._zoomingYStart - y));\n break;\n\n }\n\n if (this.options.onZoomMove && !mute) {\n\n this.options.onZoomMove(graph, x, y, e, mute);\n }\n //\t\tthis._zoomingSquare.setAttribute('display', 'block');\n }\n\n /**\n * @private\n */\n onMouseUp(graph, x, y, e, mute) {\n var self = this;\n this.removeZone();\n\n var _x = x - graph.options.paddingLeft;\n var _y = y - graph.options.paddingTop;\n\n this.emit('beforeZoom', {\n graph: graph,\n x: x,\n y: y,\n e: e,\n mute: mute\n });\n\n if (graph.prevent(false)) {\n\n // This doesn't work !\n //graph.prevent( true ); // Cancel future click event\n return;\n }\n\n if (x - this._zoomingXStart == 0 && this._zoomingMode != 'y' || y - this._zoomingYStart == 0 && this._zoomingMode != 'x') {\n return;\n }\n\n if (this.options.transition || this.options.smooth) {\n\n let modeX = false,\n modeY = false;\n\n if (this._zoomingMode == 'x' || this._zoomingMode == 'xy' || this._zoomingMode == 'forceY2') {\n\n this.fullX = false;\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min(axis.getVal(_x), axis.getVal(self.x1));\n axis._pluginZoomMaxFinal = Math.max(axis.getVal(_x), axis.getVal(self.x1));\n }, false, true, false);\n\n modeX = true;\n }\n\n if (this._zoomingMode == 'y' || this._zoomingMode == 'xy') {\n\n this.fullY = false;\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min(axis.getVal(_y), axis.getVal(self.y1));\n axis._pluginZoomMaxFinal = Math.max(axis.getVal(_y), axis.getVal(self.y1));\n }, false, false, true);\n\n modeY = true;\n }\n\n if (this._zoomingMode == 'forceY2') {\n\n this.fullY = false;\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min(axis.getVal(self.y2), axis.getVal(self.y1));\n axis._pluginZoomMaxFinal = Math.max(axis.getVal(self.y2), axis.getVal(self.y1));\n }, false, false, true);\n\n modeY = true;\n }\n\n this.transition(modeX, modeY, 'zoomEnd');\n } else {\n\n switch (this._zoomingMode) {\n case 'x':\n this.fullX = false;\n this.toAxes('_doZoom', [_x, this.x1], true, false);\n break;\n case 'y':\n this.fullY = false;\n this.toAxes('_doZoom', [_y, this.y1], false, true);\n break;\n case 'xy':\n this.fullX = false;\n this.fullY = false;\n this.toAxes('_doZoom', [_x, this.x1], true, false);\n this.toAxes('_doZoom', [_y, this.y1], false, true);\n break;\n\n case 'forceY2':\n\n this.fullX = false;\n this.fullY = false;\n\n this.toAxes('_doZoom', [_x, this.x1], true, false);\n this.toAxes('_doZoom', [this.y1, this.y2], false, true);\n\n break;\n }\n\n // graph.prevent( true ); // WHat are you doing ??\n graph.draw();\n\n if (this._backedUpZoomMode) {\n this._zoomingMode = this._backedUpZoomMode;\n }\n\n this.emit('zoomed');\n\n graph.pluginYieldActiveState();\n }\n }\n\n /**\n * @private\n */\n removeZone() {\n\n this._zoomingSquare.setAttribute('display', 'none');\n }\n\n /**\n * @private\n */\n onMouseWheel(delta, e, coordX, coordY, options) {\n\n if (!options) {\n options = {};\n }\n\n if (!options.baseline) {\n options.baseline = 0;\n }\n\n let baseline = options.baseline;\n\n if (options.baseline == 'mousePosition') {\n baseline = this.graph.getYAxis().getVal(coordY);\n console.log(baseline);\n }\n\n /*var serie;\n if ( ( serie = this.graph.getSelectedSerie() ) ) {\n if ( serie.getYAxis().handleMouseWheel( delta, e ) ) {\n return;\n }\n }*/\n\n var doX = options.direction == 'x';\n var doY = !(options.direction !== 'y');\n\n this.toAxes('handleMouseWheel', [delta, e, baseline], doX, doY);\n\n this.graph.drawSeries();\n }\n\n /**\n * @private\n */\n onDblClick(x, y, e, pref, mute) {\n\n var graph = this.graph;\n this.emit('beforeDblClick', {\n graph: graph,\n x: x,\n y: y,\n pref: pref,\n e: e,\n mute: mute\n });\n\n if (graph.prevent(false)) {\n return;\n }\n\n if (this.options.transition || this.options.smooth) {\n\n var modeX = false,\n modeY = false;\n\n if (pref.mode == 'xtotal' || pref.mode == 'total') {\n\n this.toAxes(function (axis) {\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getMinValue() - axis.options.axisDataSpacing.min * axis.getInterval();\n axis._pluginZoomMaxFinal = axis.getMaxValue() + axis.options.axisDataSpacing.max * axis.getInterval();\n }, false, true, false);\n\n modeX = true;\n }\n\n if (pref.mode == 'ytotal' || pref.mode == 'total') {\n\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getMinValue() - axis.options.axisDataSpacing.min * axis.getInterval();\n axis._pluginZoomMaxFinal = axis.getMaxValue() + axis.options.axisDataSpacing.max * axis.getInterval();\n }, false, false, true);\n\n modeY = true;\n }\n\n let x, y;\n\n if (pref.mode == 'gradualX' || pref.mode == 'gradualY' || pref.mode == 'gradual' || pref.mode == 'gradualXY') {\n\n x = false, y = false;\n\n if (pref.mode == 'gradualX' || pref.mode == 'gradual' || pref.mode == 'gradualXY') {\n x = true;\n modeX = true;\n }\n\n if (pref.mode == 'gradualY' || pref.mode == 'gradual' || pref.mode == 'gradualXY') {\n y = true;\n modeY = true;\n }\n\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getCurrentMin() - (axis.getCurrentMax() - axis.getCurrentMin());\n axis._pluginZoomMaxFinal = axis.getCurrentMax() + (axis.getCurrentMax() - axis.getCurrentMin());\n }, false, x, y);\n }\n\n this.transition(modeX, modeY, 'dblClick');\n return;\n }\n\n var xAxis = this.graph.getXAxis(),\n yAxis = this.graph.getYAxis();\n\n if (pref.mode == 'xtotal') {\n\n this.toAxes('setMinMaxToFitSeries', null, true, false);\n this.fullX = true;\n this.fullY = false;\n } else if (pref.mode == 'ytotal') {\n\n this.toAxes('setMinMaxToFitSeries', null, false, true);\n this.fullX = false;\n this.fullY = true;\n } else if (pref.mode == 'total') {\n\n this.toAxes('setMinMaxToFitSeries', null, true, true);\n\n this.fullX = true;\n this.fullY = true;\n // Nothing to do here\n /* this.graph._applyToAxes( function( axis ) {\n axis.emit( 'zoom', axis.currentAxisMin, axis.currentAxisMax, axis );\n }, null, true, true );\n */\n } else {\n\n x -= this.graph.options.paddingLeft;\n y -= this.graph.options.paddingTop;\n\n var xMin = xAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n xActual = xAxis.getVal(x),\n diffX = xMax - xMin,\n yMin = yAxis.getCurrentMin(),\n yMax = yAxis.getCurrentMax(),\n yActual = yAxis.getVal(y),\n diffY = yMax - yMin;\n\n if (pref.mode == 'gradualXY' || pref.mode == 'gradualX') {\n\n var ratio = (xActual - xMin) / (xMax - xMin);\n xMin = Math.max(xAxis.getMinValue() - xAxis.getInterval() * xAxis.options.axisDataSpacing.min, xMin - diffX * ratio);\n xMax = Math.min(xAxis.getMaxValue() + xAxis.getInterval() * xAxis.options.axisDataSpacing.max, xMax + diffX * (1 - ratio));\n xAxis.setCurrentMin(xMin);\n xAxis.setCurrentMax(xMax);\n\n if (xAxis.options.onZoom) {\n xAxis.options.onZoom(xMin, xMax);\n }\n\n xAxis.cacheCurrentMin();\n xAxis.cacheCurrentMax();\n xAxis.cacheInterval();\n }\n\n if (pref.mode == 'gradualXY' || pref.mode == 'gradualY') {\n\n var ratio = (yActual - yMin) / (yMax - yMin);\n yMin = Math.max(yAxis.getMinValue() - yAxis.getInterval() * yAxis.options.axisDataSpacing.min, yMin - diffY * ratio);\n yMax = Math.min(yAxis.getMaxValue() + yAxis.getInterval() * yAxis.options.axisDataSpacing.max, yMax + diffY * (1 - ratio));\n yAxis.setCurrentMin(yMin);\n yAxis.setCurrentMax(yMax);\n\n if (yAxis.options.onZoom) {\n yAxis.options.onZoom(yMin, yMax);\n }\n\n yAxis.cacheCurrentMin();\n yAxis.cacheCurrentMax();\n yAxis.cacheInterval();\n }\n }\n\n graph.pluginYieldActiveState();\n\n this.graph.draw();\n /*\n this.emit( \"dblClick\", {\n graph: graph,\n x: x,\n y: y,\n pref: pref,\n e: e,\n mute: mute\n } );\n if ( this.options.onDblClick && !mute ) {\n this.options.onDblClick( graph, x, y, e, mute );\n }*/\n }\n\n transition(modeX, modeY, eventName) {\n\n var self = this,\n maxTime = 500;\n\n if (!self.gradualUnzoomStart) {\n self.gradualUnzoomStart = Date.now();\n }\n\n window.requestAnimationFrame(function () {\n\n var dt = Date.now() - self.gradualUnzoomStart;\n\n if (dt > maxTime) {\n dt = maxTime;\n }\n var progress = Math.sin(dt / maxTime * Math.PI / 2);\n\n self.toAxes(function (axis) {\n\n axis.setCurrentMin(axis._pluginZoomMin + (axis._pluginZoomMinFinal - axis._pluginZoomMin) * progress);\n axis.setCurrentMax(axis._pluginZoomMax + (axis._pluginZoomMaxFinal - axis._pluginZoomMax) * progress);\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n }, false, modeX, modeY);\n\n self.graph.draw();\n\n if (dt < maxTime) {\n\n self.transition(modeX, modeY, eventName);\n self.emit('zooming');\n } else {\n\n self.emit('zoomed');\n self.graph.pluginYieldActiveState();\n\n if (eventName) {\n self.emit(eventName);\n }\n self.gradualUnzoomStart = 0;\n }\n });\n }\n\n isFullX() {\n return this.fullX;\n }\n\n isFullY() {\n return this.fullY;\n }\n\n toAxes(func, params, tb, lr) {\n\n var axes = this.options.axes;\n\n if (!axes || axes == 'serieSelected' && !this.graph.getSelectedSerie()) {\n axes = 'all';\n }\n\n switch (axes) {\n\n case 'all':\n this.graph._applyToAxes.apply(this.graph, arguments);\n break;\n\n case 'serieSelected':\n\n var serie = this.graph.getSelectedSerie();\n if (serie) {\n\n if (tb) {\n\n if (typeof func == 'string') {\n serie.getXAxis()[func].apply(serie.getXAxis(), params);\n } else {\n func.apply(serie.getXAxis(), params);\n }\n }\n\n if (lr) {\n\n if (typeof func == 'string') {\n serie.getYAxis()[func].apply(serie.getYAxis(), params);\n } else {\n func.apply(serie.getYAxis(), params);\n }\n }\n }\n\n break;\n\n default:\n\n if (!Array.isArray(axes)) {\n axes = [axes];\n }\n\n for (let axis of axes) {\n\n if (axis.isX() && tb) {\n // Not the best check\n\n if (typeof func == 'string') {\n axis[func].apply(axis, params);\n } else {\n func.apply(axis, params);\n }\n } else if (axis.isY() && lr) {\n // Not the best check\n\n if (typeof func == 'string') {\n axis[func].apply(axis, params);\n } else {\n func.apply(axis, params);\n }\n }\n }\n break;\n }\n }\n\n }\n\n exports.default = PluginZoom;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 44 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(3), __webpack_require__(45), __webpack_require__(2), __webpack_require__(0)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.core.js'), require('../graph.lru.js'), require('./graph.plugin.js'), require('../graph.util.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphCore, global.graphLru, global.graphPlugin, global.graphUtil);\n global.graphPluginTimeseriemanager = mod.exports;\n }\n})(this, function (module, exports, _graphCore, _graphLru, _graphPlugin, _graphUtil) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphCore2 = _interopRequireDefault(_graphCore);\n\n var _graphLru2 = _interopRequireDefault(_graphLru);\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * @class PluginTimeSerieManager\n * @implements Plugin\n */\n class PluginTimeSerieManager extends _graphPlugin2.default {\n\n constructor() {\n\n super(...arguments);\n\n this.series = [];\n this.plugins = [];\n this.currentSlots = {};\n\n this.requestLevels = new Map();\n this.update = (noRecalculate, force) => {\n\n this.series.forEach(function (serie) {\n\n this.updateSerie(serie, noRecalculate);\n });\n\n if (!noRecalculate) {\n this.recalculateSeries(force);\n }\n };\n }\n\n static default() {\n\n return {\n\n LRUName: 'PluginTimeSerieManager',\n intervals: [1000, 15000, 60000, 900000, 3600000, 8640000],\n maxParallelRequests: 3,\n optimalPxPerPoint: 2,\n nbPoints: 1000,\n url: ''\n };\n }\n\n /**\n * Init method\n * @private\n * @memberof PluginTimeSerieManager\n */\n init(graph, options) {\n this.graph = graph;\n _graphLru2.default.create(this.options.LRUName, 200);\n this.requestsRunning = 0;\n }\n\n setURL(url) {\n this.options.url = url;\n return this;\n }\n\n setAvailableIntervals() {\n this.options.intervals = arguments;\n }\n\n newSerie(serieName, serieOptions, serieType, dbElements, noZoneSerie) {\n var s = this.graph.newSerie(serieName, serieOptions, serieType);\n\n this.currentSlots[serieName] = {\n min: 0,\n max: 0,\n interval: 0\n };\n\n s.on('hide', function () {\n\n if (s._zoneSerie) {\n\n s._zoneSerie.hide();\n }\n });\n\n s.on('show', function () {\n\n if (s._zoneSerie) {\n s._zoneSerie.show();\n }\n });\n\n s.setInfo('timeSerieManagerDBElements', dbElements);\n\n if (!noZoneSerie) {\n s._zoneSerie = this.graph.newSerie(serieName + '_zone', {}, _graphCore2.default.SERIE_ZONE);\n }\n\n this.series.push(s);\n return s;\n }\n\n registerPlugin(plugin, event) {\n\n var index;\n if ((index = this.plugins.indexOf(plugin)) > -1) {\n\n for (var i = 1; i < arguments.length; i++) {\n plugin.removeListener(arguments[i], this.update);\n }\n }\n\n for (var i = 1; i < arguments.length; i++) {\n plugin.on(arguments[i], this.update);\n }\n }\n\n updateSerie(serie, noRecalculate) {\n\n var self = this;\n var from = serie.getXAxis().getCurrentMin();\n var to = serie.getXAxis().getCurrentMax();\n var priority = 1;\n\n var optimalInterval = this.getOptimalInterval(to - from);\n var optimalIntervalIndex = this.options.intervals.indexOf(optimalInterval);\n var interval;\n\n this.cleanRegister(optimalIntervalIndex);\n\n for (var i = optimalIntervalIndex; i <= optimalIntervalIndex + 1; i++) {\n\n interval = this.options.intervals[i];\n var startSlotId = self.computeSlotID(from, interval);\n var endSlotId = self.computeSlotID(to, interval);\n\n var intervalMultipliers = [[2, 5, 6], [1, 2, 4], [0, 1, 3]];\n\n intervalMultipliers.forEach(function (multiplier) {\n\n var firstSlotId = startSlotId - multiplier[0] * (endSlotId - startSlotId);\n var lastSlotId = endSlotId + multiplier[0] * (endSlotId - startSlotId);\n\n var slotId = firstSlotId;\n\n while (slotId <= lastSlotId) {\n\n if (self.computeTimeMin(slotId, interval) > Date.now()) {\n break;\n }\n\n self.register(serie, slotId, interval, interval == optimalInterval ? multiplier[1] : multiplier[2], true, noRecalculate);\n slotId++;\n }\n });\n }\n\n this.processRequests();\n }\n\n cleanRegister(interval) {\n\n if (!this.requestLevels) {\n return;\n }\n\n this.requestLevels.forEach(levelArray => {\n\n levelArray.forEach((levelElement, levelIndex) => {\n\n if (levelElement[4] < interval) {\n levelArray.splice(levelIndex, 1);\n }\n });\n });\n }\n\n register(serie, slotId, interval, priority, noProcess, noRecalculate) {\n\n var id = this.computeUniqueID(serie, slotId, interval);\n\n var data = _graphLru2.default.get(this.options.LRUName, id);\n\n if (!data || this.computeTimeMax(slotId, interval) > Date.now() && data.timeout < Date.now() - (noRecalculate ? 5000 : 100000) && priority == 1) {\n\n this.request(serie, slotId, interval, priority, id, noProcess);\n }\n }\n\n request(serie, slotId, interval, priority, slotName, noProcess) {\n\n for (var i in this.requestLevels) {\n\n if (i == priority) {\n continue;\n }\n\n if (this.requestLevels[i][slotName]) {\n\n if (this.requestLevels[i][slotName][0] !== 1) {\n // If the request is not pending\n\n delete this.requestLevels[i][slotName];\n } else {\n this.requestLevels[i][slotName][5] = priority;\n }\n }\n }\n\n if (this.requestLevels[priority] && this.requestLevels[priority][slotName]) {\n return;\n }\n\n this.requestLevels[priority] = this.requestLevels[priority] || {};\n this.requestLevels[priority][slotName] = [0, slotName, serie.getName(), slotId, interval, priority, serie.getInfo('timeSerieManagerDBElements')];\n\n if (!noProcess) {\n this.processRequests();\n }\n }\n\n processRequests() {\n\n if (this.requestsRunning >= this.options.maxParallelRequests) {\n return;\n }\n\n var self = this,\n currentLevelChecking = 1,\n requestToMake;\n\n while (true) {\n\n for (var i in this.requestLevels[currentLevelChecking]) {\n\n if (this.requestLevels[currentLevelChecking][i][0] == 1) {\n // Running request\n continue;\n }\n\n requestToMake = this.requestLevels[currentLevelChecking][i];\n break;\n }\n\n if (requestToMake) {\n break;\n }\n\n currentLevelChecking++;\n\n if (currentLevelChecking > 10) {\n return;\n }\n }\n\n this.requestsRunning++;\n\n if (!requestToMake) {\n return;\n }\n\n requestToMake[0] = 1;\n\n util.ajaxGet({\n\n url: this.getURL(requestToMake),\n method: 'GET',\n json: true\n\n }).done(function (data) {\n\n if (data.status == 1) {\n // Success\n\n self.requestsRunning--;\n\n delete self.requestLevels[currentLevelChecking][i];\n\n _graphLru2.default.store(self.options.LRUName, requestToMake[1], data.data); // Element 1 is the unique ID\n self.processRequests();\n\n if (requestToMake[5] == 1 && Object.keys(self.requestLevels[1]).length == 0) {\n\n self.recalculateSeries(true);\n }\n }\n });\n }\n\n computeTimeMax(slotId, interval) {\n return (slotId + 1) * (interval * this.options.nbPoints);\n }\n\n computeTimeMin(slotId, interval) {\n return slotId * (interval * this.options.nbPoints);\n }\n\n getURL(requestElements) {\n\n var url = this.options.url.replace('', requestElements[2]).replace('', this.computeTimeMin(requestElements[3], requestElements[4])).replace('', this.computeTimeMax(requestElements[3], requestElements[4])).replace('', requestElements[4]);\n\n var dbElements = requestElements[6] || {};\n\n for (var i in dbElements) {\n url = url.replace('<' + i + '>', dbElements[i]);\n }\n\n return url;\n }\n\n getOptimalInterval(totalspan) {\n\n var optimalInterval = (this.options.optimalPxPerPoint || 1) * totalspan / this.graph.getDrawingWidth(),\n diff = Infinity,\n optimalIntervalAmongAvailable;\n\n this.options.intervals.forEach(function (interval) {\n\n var newDiff = Math.min(diff, Math.abs(interval - optimalInterval));\n if (diff !== newDiff) {\n\n optimalIntervalAmongAvailable = interval;\n diff = newDiff;\n }\n });\n\n return optimalIntervalAmongAvailable || 1000;\n }\n\n computeUniqueID(serie, slotId, interval) {\n var extra = '';\n var info = serie.getInfo('timeSerieManagerDBElements');\n for (var i in info) {\n extra += ';' + i + ':' + info[i];\n }\n\n return serie.getName() + ';' + slotId + ';' + interval + extra;\n }\n\n computeSlotID(time, interval) {\n return Math.floor(time / (interval * this.options.nbPoints));\n }\n\n computeSlotTime(slotId, interval) {\n return slotId * (interval * this.options.nbPoints);\n }\n\n getZoneSerie(serie) {\n return serie._zoneSerie;\n }\n\n updateZoneSerie(serieName) {\n\n var serie = this.graph.getSerie(serieName);\n\n if (!serie) {\n return;\n }\n\n if (!serie._zoneSerie) {\n return;\n }\n\n serie._zoneSerie.setXAxis(serie.getXAxis());\n serie._zoneSerie.setYAxis(serie.getYAxis());\n serie._zoneSerie.setFillColor(serie.getLineColor());\n serie._zoneSerie.setLineColor(serie.getLineColor());\n serie._zoneSerie.setFillOpacity(0.2);\n serie._zoneSerie.setLineOpacity(0.3);\n }\n\n recalculateSeries(force) {\n\n var self = this;\n\n if (this.locked) {\n return;\n }\n\n this.changed = false;\n\n this.series.map(function (serie) {\n self.recalculateSerie(serie, force);\n });\n\n /*if ( this.changed ) {\n self.graph._applyToAxes( \"scaleToFitAxis\", [ this.graph.getXAxis(), false, undefined, undefined, false, true ], false, true );\n }\n */\n this.changed = false;\n //self.graph.autoscaleAxes();\n\n self.graph.draw();\n }\n\n recalculateSerie(serie, force) {\n\n var from = serie.getXAxis().getCurrentMin(),\n to = serie.getXAxis().getCurrentMax(),\n interval = this.getOptimalInterval(to - from);\n\n var startSlotId = this.computeSlotID(from, interval);\n var endSlotId = this.computeSlotID(to, interval);\n\n var data = [];\n var dataMinMax = [];\n\n if (!force && interval == this.currentSlots[serie.getName()].interval && this.currentSlots[serie.getName()].min <= startSlotId && this.currentSlots[serie.getName()].max >= endSlotId) {\n return;\n }\n\n startSlotId -= 2;\n endSlotId += 2;\n\n this.currentSlots[serie.getName()].min = startSlotId;\n this.currentSlots[serie.getName()].max = endSlotId;\n this.currentSlots[serie.getName()].interval = interval;\n\n var slotId = startSlotId;\n\n while (slotId <= endSlotId) {\n\n const lruData = _graphLru2.default.get(this.options.LRUName, this.computeUniqueID(serie, slotId, interval));\n if (lruData) {\n\n data = data.concat(lruData.data.mean);\n dataMinMax = dataMinMax.concat(lruData.data.minmax);\n } else {\n\n this.recalculateSerieUpwards(serie, slotId, interval, data, dataMinMax);\n }\n\n slotId++;\n }\n\n this.changed = true;\n\n serie.setData(data);\n\n if (serie._zoneSerie) {\n serie._zoneSerie.setData(dataMinMax);\n }\n }\n\n setIntervalCheck(interval) {\n\n if (this.interval) {\n clearInterval(this.interval);\n }\n\n this.update(true, true);\n this.interval = setInterval(() => {\n this.update(true, false);\n }, interval);\n }\n\n recalculateSerieUpwards(serie, downSlotId, downInterval, data, dataMinMax) {\n\n var intervals = this.options.intervals.slice(0);\n intervals.sort();\n\n var nextInterval = intervals[intervals.indexOf(downInterval) + 1] || -1;\n if (nextInterval < 0) {\n return [];\n }\n\n var newSlotTime = this.computeSlotTime(downSlotId, downInterval);\n var newSlotTimeEnd = this.computeSlotTime(downSlotId + 1, downInterval);\n var newSlotId = this.computeSlotID(newSlotTime, nextInterval),\n start = false;\n\n const lruData = _graphLru2.default.get(this.options.LRUName, this.computeUniqueID(serie, newSlotId, nextInterval));\n if (lruData) {\n\n for (var i = 0, l = lruData.data.mean.length; i < l; i += 2) {\n\n if (lruData.data.mean[i] < newSlotTime) {\n continue;\n } else if (start === false) {\n start = i;\n }\n\n if (lruData.data.mean[i] >= newSlotTimeEnd) {\n\n data = data.concat(lruData.data.mean.slice(start, i));\n dataMinMax = data.concat(lruData.data.minmax.slice(start, i));\n\n return;\n }\n }\n }\n\n return this.recalculateSerieUpwards(serie, newSlotId, nextInterval, data, dataMinMax);\n }\n\n lockRedraw() {\n this.locked = true;\n }\n\n unlockRedraw() {\n this.locked = false;\n }\n\n isRedrawLocked() {\n return !!this.locked;\n }\n }\n\n exports.default = PluginTimeSerieManager;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 45 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(exports);\n } else {\n var mod = {\n exports: {}\n };\n factory(mod.exports);\n global.graphLru = mod.exports;\n }\n})(this, function (exports) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n exports.create = create;\n exports.get = get;\n exports.store = store;\n exports.empty = empty;\n exports.exist = exist;\n var memory = {},\n memoryHead = {},\n memoryCount = {},\n memoryLimit = {};\n\n function emptyMemory(store) {\n memory[store] = {};\n memoryCount[store] = 0;\n }\n\n function createStoreMemory(store, limit) {\n limit = limit || 50;\n if (!memory[store]) {\n memory[store] = {};\n memoryCount[store] = 0;\n }\n\n memoryLimit[store] = limit;\n }\n\n function getFromMemory(store, index) {\n var obj, head;\n\n if (memory[store] && memory[store][index]) {\n\n head = memoryHead[store];\n\n obj = memory[store][index];\n obj.prev = head;\n obj.next = head.next;\n head.next.prev = obj;\n head.next = obj;\n\n memoryHead[store] = obj;\n return obj.data;\n }\n }\n\n function storeInMemory(store, index, data) {\n\n var toStore, toDelete, head;\n if (memory[store] && memoryCount[store] !== undefined && memoryLimit[store]) {\n head = memoryHead[store];\n\n if (memory[store][index]) {\n\n getFromMemory(store, index);\n memory[store][index].data.data = data;\n memory[store][index].data.timeout = Date.now();\n } else {\n\n toStore = {\n data: {\n data: data,\n timeout: Date.now()\n }\n };\n\n if (typeof head == 'undefined') {\n toStore.prev = toStore;\n toStore.next = toStore;\n } else {\n toStore.prev = head.prev;\n toStore.next = head.next;\n head.next.prev = toStore;\n head.next = toStore;\n }\n\n memoryHead[store] = toStore;\n memory[store][index] = toStore;\n memoryCount[store]++;\n }\n\n // Remove oldest one\n if (memoryCount[store] > memoryLimit[store] && head) {\n toDelete = head.next;\n head.next.next.prev = head;\n head.next = head.next.next;\n toDelete.next.next = undefined;\n toDelete.next.prev = undefined;\n memoryCount[store]--;\n }\n\n return data;\n }\n }\n\n function create(store, limitMemory) {\n createStoreMemory(store, limitMemory);\n }\n\n function get(store, index) {\n var result;\n if ((result = getFromMemory(store, index)) != undefined) {\n return result;\n }\n }\n\n function store(store, index, value) {\n storeInMemory(store, index, value);\n return value;\n }\n\n function empty(store) {\n emptyMemory(store);\n }\n\n function exist(store) {\n return memory[store];\n }\n\n exports.default = get;\n});\n\n/***/ }),\n/* 46 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('./graph.plugin.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphPlugin);\n global.graphPluginSerielinedifference = mod.exports;\n }\n})(this, function (module, exports, _graphPlugin) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n /**\n * @class PluginSerieLineDifference\n * @implements Plugin\n */\n class PluginSerieLineDifference extends _graphPlugin2.default {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n return {\n\n positiveStyle: {\n\n fillColor: 'green',\n fillOpacity: 0.2,\n strokeWidth: 0\n },\n\n negativeStyle: {\n fillColor: 'red',\n fillOpacity: 0.2,\n strokeWidth: 0\n },\n\n from: 0,\n to: 0\n };\n }\n\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n this.graph = graph;\n\n this.pathsPositive = [];\n this.pathsNegative = [];\n\n this.positivePolyline = this.graph.newShape('polyline').draw();\n\n this.positivePolyline.setFillColor(this.options.positiveStyle.fillColor).setFillOpacity(this.options.positiveStyle.fillOpacity).setStrokeWidth(this.options.positiveStyle.strokeWidth).applyStyle();\n\n this.negativePolyline = this.graph.newShape('polyline').draw();\n\n this.negativePolyline.setFillColor(this.options.negativeStyle.fillColor).setFillOpacity(this.options.negativeStyle.fillOpacity).setStrokeWidth(this.options.negativeStyle.strokeWidth).applyStyle();\n }\n\n /**\n * Assigns the two series for the shape. Postive values are defined when ```serieTop``` is higher than ```serieBottom```.\n * @param {SerieLine} serieTop - The top serie\n * @param {SerieLine} serieBottom - The bottom serie\n */\n setSeries(serieTop, serieBottom) {\n this.serie1 = serieTop;\n this.serie2 = serieBottom;\n }\n\n /**\n * Assigns the boundaries\n */\n setBoundaries(from, to) {\n this.options.from = from;\n this.options.to = to;\n }\n\n /**\n * @returns the starting value used to draw the zone\n */\n getFrom() {\n return this.options.from;\n }\n\n /**\n * @returns the ending value used to draw the zone\n */\n getTo() {\n return this.options.to;\n }\n\n /**\n * Calculates and draws the zone series\n * @returns {Plugin} The current plugin instance\n */\n draw() {\n\n var self = this;\n var s1 = this.serie1.searchClosestValue(this.getFrom());\n var i1, j1, i2, j2, y, y2, crossing;\n\n var top = [];\n var bottom = [];\n\n var bottomBroken;\n\n if (!s1) {\n i1 = 0;\n j1 = 0;\n } else {\n\n i1 = s1.dataIndex;\n j1 = s1.xAfterIndex * 2;\n }\n\n y = this.interpolate(this.serie1, this.getFrom());\n top.push(this.getFrom()); // x\n top.push(y); // y\n\n y = this.interpolate(this.serie2, this.getFrom());\n bottom.push(this.getFrom()); // x\n bottom.push(y); // y\n\n var s2;\n\n var order;\n\n function nextSet() {\n\n if (order === true) {\n self.pathsPositive.push([top, bottom]);\n } else if (order === false) {\n self.pathsNegative.push([top, bottom]);\n }\n\n top = [];\n bottom = [];\n order = undefined;\n }\n var ended;\n for (; i1 < this.serie1.data.length; i1++) {\n\n for (; j1 < this.serie1.data[i1].length; j1 += 2) {\n\n if (this.serie1.data[i1][j1] > this.getTo()) {\n // FINISHED !\n\n y = this.interpolate(this.serie1, this.getTo());\n y2 = this.interpolate(this.serie2, this.getTo());\n\n crossing = this.computeCrossing(top[top.length - 2], top[top.length - 1], this.getTo(), y, bottom[bottom.length - 2], bottom[bottom.length - 1], this.getTo(), y2);\n\n if (crossing) {\n\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n nextSet();\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n\n order = this.serie1.data[i1][j1 + 1] > this.serie2.data[i2][j2 + 1];\n }\n\n top.push(this.getTo()); // x\n top.push(y); // y\n\n bottom.push(this.getTo()); // x\n bottom.push(y2); // y\n\n ended = true;\n break;\n }\n\n if (!s2) {\n s2 = this.serie2.searchClosestValue(this.serie1.data[i1][j1]); // Finds the first point\n\n if (s2) {\n i2 = s2.dataIndex;\n j2 = s2.xBeforeIndex * 2;\n\n // TODO: Add here first points\n\n y = this.interpolate(this.serie2, this.serie1.data[i1][j1]);\n\n top.push(this.serie1.data[i1][j1]); // x\n top.push(this.serie1.data[i1][j1 + 1]); // y\n\n bottom.push(this.serie1.data[i1][j1]); // x\n bottom.push(y); // y\n\n order = this.serie1.data[i1][j1 + 1] > y;\n } else {\n continue;\n }\n }\n\n bottomBroken = false;\n\n crossing = this.computeCrossing(top[top.length - 2], top[top.length - 1], this.serie1.data[i1][j1], this.serie1.data[i1][j1 + 1], bottom[bottom.length - 2], bottom[bottom.length - 1], this.serie2.data[i2][j2], this.serie2.data[i2][j2 + 1]);\n\n if (crossing) {\n\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n nextSet();\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n\n order = this.serie1.data[i1][j1 + 1] > this.serie2.data[i2][j2 + 1];\n }\n\n while (this.serie2.data[i2][j2] < this.serie1.data[i1][j1]) {\n\n bottom.push(this.serie2.data[i2][j2]);\n bottom.push(this.serie2.data[i2][j2 + 1]);\n\n j2 += 2;\n if (j2 == this.serie2.data[i2].length) {\n bottomBroken = this.serie2.data[i2][j2 - 2];\n i2++;\n j2 = 0;\n break;\n }\n\n crossing = this.computeCrossing(top[top.length - 2], top[top.length - 1], this.serie1.data[i1][j1], this.serie1.data[i1][j1 + 1], bottom[bottom.length - 2], bottom[bottom.length - 1], this.serie2.data[i2][j2], this.serie2.data[i2][j2 + 1]);\n\n if (crossing) {\n\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n nextSet();\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n\n order = this.serie1.data[i1][j1 + 1] > this.serie2.data[i2][j2 + 1];\n }\n }\n\n if (bottomBroken === false) {\n top.push(this.serie1.data[i1][j1]);\n top.push(this.serie1.data[i1][j1 + 1]);\n } else {\n\n top.push(bottomBroken);\n top.push(this.interpolate(this.serie1, bottomBroken));\n\n s2 = false;\n j1 -= 2;\n nextSet();\n }\n }\n\n if (ended) {\n nextSet();\n break;\n }\n // End of X\n\n y = this.interpolate(this.serie2, top[top.length - 2]);\n if (y) {\n bottom.push(top[top.length - 2]);\n bottom.push(y);\n }\n\n nextSet();\n\n j1 = 0;\n s2 = false;\n }\n\n var d = this.pathsPositive.reduce(makePaths, '');\n this.positivePolyline.setPointsPx(d).redraw();\n\n var d = this.pathsNegative.reduce(makePaths, '');\n this.negativePolyline.setPointsPx(d).redraw();\n\n //pathsBottom.map( function( map ) { makePaths( map, self.options.negativeStyle ); } );\n\n function makePaths(d, path) {\n\n for (var i = 0; i < path[0].length; i += 2) {\n if (i == 0) {\n d += 'M ';\n }\n d += ' ' + Math.round(self.serie1.getXAxis().getPx(path[0][i])) + ', ' + Math.round(self.serie1.getYAxis().getPx(path[0][i + 1]));\n if (i < path[0].length - 2) {\n d += ' L ';\n }\n }\n\n for (var i = path[1].length - 2; i >= 0; i -= 2) {\n d += ' L ' + Math.round(self.serie2.getXAxis().getPx(path[1][i])) + ', ' + Math.round(self.serie2.getYAxis().getPx(path[1][i + 1]));\n if (i == 0) {\n d += ' z ';\n }\n }\n return d;\n }\n }\n\n /**\n * Finds the interpolated y value at point ```valX``` of the serie ```serie```\n * @returns {(Number|Boolean)} The interpolated y value is possible, ```false``` otherwise\n * @param {Serie} serie - The serie for which the y value should be computed\n * @param {Number} valX - The x value\n */\n interpolate(serie, valX) {\n\n var value = serie.searchClosestValue(valX);\n\n if (!value) {\n return false;\n }\n\n if (value.xMax == undefined) {\n return value.yMin;\n }\n\n if (value.xMin == undefined) {\n return value.yMax;\n }\n\n var ratio = (valX - value.xMin) / (value.xMax - value.xMin);\n return (1 - ratio) * value.yMin + ratio * value.yMax;\n }\n\n /**\n * Finds the crossing point between two vector and returns it, or ```false``` if it is not within the x boundaries\n * @returns {(Object|Boolean)} An object containing the crossing point in the following format: ```{ x: xCrossing, y: yCrossing }``` or ```false``` if no crossing point can be found\n * @param {Number} x11 - First x point of the first vector\n * @param {Number} y11 - First y point of the first vector\n * @param {Number} x12 - Second x point of the first vector\n * @param {Number} y12 - Second y point of the first vector\n * @param {Number} x21 - First x point of the second vector\n * @param {Number} y21 - First y point of the second vector\n * @param {Number} y22 - Second x point of the second vector\n * @param {Number} y22 - Second y point of the second vector\n */\n computeCrossing(x11, y11, x12, y12, x21, y21, x22, y22) {\n var a1 = (y12 - y11) / (x12 - x11);\n var a2 = (y22 - y21) / (x22 - x21);\n\n var b1 = y12 - a1 * x12;\n var b2 = y22 - a2 * x22;\n\n if (x11 == x12 || x21 == x22) {\n\n return false;\n }\n\n if (a1 == a2) {\n return {\n x: x11,\n y1: y11,\n y2: y11\n };\n }\n\n var x = (b1 - b2) / (a2 - a1);\n\n if (x > x12 || x < x11 || x < x21 || x > x22) {\n return false;\n }\n\n return {\n x: x,\n y: a1 * x + b1\n };\n }\n\n /**\n * @returns The positive polyline\n */\n getPositivePolyline() {\n return this.positivePolyline;\n }\n\n /**\n * @returns The negative polyline\n */\n getNegativePolyline() {\n return this.negativePolyline;\n }\n\n }\n\n exports.default = PluginSerieLineDifference;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 47 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(3), __webpack_require__(11), __webpack_require__(14), __webpack_require__(0), __webpack_require__(5), __webpack_require__(16), __webpack_require__(2), __webpack_require__(9)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.core.js'), require('../graph.axis.x.js'), require('../graph.axis.y.js'), require('../graph.util.js'), require('../series/graph.serie.line.js'), require('../series/graph.serie.scatter.js'), require('./graph.plugin.js'), require('../graph.axis.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphCore, global.graphAxisX, global.graphAxisY, global.graphUtil, global.graphSerieLine, global.graphSerieScatter, global.graphPlugin, global.graphAxis);\n global.graphPluginAxissplitting = mod.exports;\n }\n})(this, function (module, exports, _graphCore, _graphAxisX, _graphAxisY, _graphUtil, _graphSerieLine, _graphSerieScatter, _graphPlugin, _graphAxis) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var _graphCore2 = _interopRequireDefault(_graphCore);\n\n var _graphAxisX2 = _interopRequireDefault(_graphAxisX);\n\n var _graphAxisY2 = _interopRequireDefault(_graphAxisY);\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphSerieLine2 = _interopRequireDefault(_graphSerieLine);\n\n var _graphSerieScatter2 = _interopRequireDefault(_graphSerieScatter);\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n var _graphAxis2 = _interopRequireDefault(_graphAxis);\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n class SerieLineExtended extends _graphSerieLine2.default {\n\n constructor() {\n super(...arguments);\n this.subSeries = [];\n }\n\n setData() {\n super.setData(...arguments);\n this.subSeries.map(sub => {\n sub.data = this.data;\n });\n return this;\n }\n\n draw() {\n this.eraseMarkers();\n return this;\n }\n\n getSymbolForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getSymbolForLegend();\n }\n\n getMarkerForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getMarkerForLegend();\n }\n }\n\n class SerieScatterExtended extends _graphSerieScatter2.default {\n\n constructor() {\n super(...arguments);\n this.subSeries = [];\n }\n\n setData() {\n super.setData(...arguments);\n this.subSeries.map(sub => {\n sub.data = this.data;\n });\n return this;\n }\n\n draw() {\n return this;\n }\n\n getSymbolForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getSymbolForLegend();\n }\n\n getMarkerForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getMarkerForLegend();\n }\n }\n\n var excludingMethods = ['constructor', 'init', 'draw', 'setLineColor', 'setLineWidth', 'setLineStyle', 'getLineColor', 'getLineWidth', 'getLineStyle', 'setMarkers', 'showMarkers', 'hideMarkers', 'getMarkerDom', 'getMarkerDomIndependant', 'getMarkerPath', 'eraseMarkers', '_recalculateMarkerPoints'];\n var addMethods = [];\n\n Object.getOwnPropertyNames(_graphSerieLine2.default.prototype).concat(addMethods).map(function (i) {\n\n if (excludingMethods.indexOf(i) > -1) {\n return;\n }\n\n SerieLineExtended.prototype[i] = function (j) {\n\n return function () {\n\n var args = arguments;\n this.subSeries.map(subSerie => {\n subSerie[j](...args);\n });\n };\n }(i);\n });\n\n /**\n * Axis splitting plugin\n * @augments Plugin\n */\n class PluginAxisSplitting extends _graphPlugin2.default {\n\n constructor(options) {\n super(...arguments);\n this.series = new Map();\n }\n\n static defaults() {\n\n return {\n axes: {\n margins: {\n high: 5,\n low: 5\n }\n }\n };\n }\n\n init(graph) {\n this.graph = graph;\n }\n\n /**\n * Creates a new bottom split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newXAxis(options) {\n return this.newBottomAxis(options);\n }\n\n /**\n * Creates a new left split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newYAxis(options) {\n return this.newLeftAxis(options);\n }\n\n /**\n * Creates a new top split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newTopAxis(options) {\n options = this.getOptions(options);\n return new SplitXAxis(this.graph, 'top', options);\n }\n\n /**\n * Creates a new bottom split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newBottomAxis(options) {\n options = this.getOptions(options);\n return new SplitXAxis(this.graph, 'bottom', options);\n }\n\n /**\n * Creates a new left split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newLeftAxis(options) {\n options = this.getOptions(options);\n return new SplitYAxis(this.graph, 'left', options);\n }\n\n /**\n * Creates a new right split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newRightAxis(options) {\n options = this.getOptions(options);\n return new SplitYAxis(this.graph, 'right', options);\n }\n\n getOptions(options) {\n var defaults = {\n marginMin: this.options.axes.margins.low,\n marginMax: this.options.axes.margins.high\n };\n return util.extend(true, defaults, options);\n }\n\n preDraw() {\n\n var xAxis, yAxis;\n\n // for ( let { serie } of this.series.values() ) {\n this.series.forEach(({\n serie\n }) => {\n\n xAxis = serie.getXAxis();\n yAxis = serie.getYAxis();\n\n let splits = 1;\n\n if (xAxis.splitNumber) {\n splits *= xAxis.splitNumber;\n }\n\n if (yAxis.splitNumber) {\n splits *= yAxis.splitNumber;\n }\n\n while (serie.subSeries.length < splits) {\n\n const name = serie.getName() + '_' + serie.subSeries.length;\n\n const s = this.graph.newSerie(name, {}, serie.getType() || _graphCore2.default.SERIE_LINE);\n\n s.excludedFromLegend = true;\n s.styles = serie.styles;\n s.data = serie.data; // Copy data\n\n if (serie.getType() == _graphCore2.default.SERIE_LINE) {\n s.markerPoints = serie.markerPoints;\n s.markerFamilies = serie.markerFamilies;\n }\n\n serie.subSeries.push(s);\n }\n\n while (serie.subSeries.length > splits) {\n\n let subserie = this.graph.getSerie(serie.getName() + '_' + (serie.subSeries.length - 1));\n\n if (subserie && subserie.kill) {\n subserie.kill();\n }\n serie.subSeries.pop();\n }\n\n if (!serie.getXAxis().splitNumber && serie.getXAxis().splitAxis) {\n serie.getXAxis().splitAxis();\n }\n\n if (!serie.getYAxis().splitNumber && serie.getYAxis().splitAxis) {\n serie.getYAxis().splitAxis();\n }\n\n // Re-assign axes to the sub series\n serie.subSeries.map((sserie, index) => {\n\n var xSubAxis, ySubAxis;\n\n //sserie.groupMarkers = firstSubSerie.groupMarkers;\n\n if (serie.getXAxis().getSubAxis) {\n let subAxisIndex = index % (xAxis.splitNumber || 1);\n xSubAxis = serie.getXAxis().getSubAxis(subAxisIndex);\n } else {\n xSubAxis = serie.getXAxis();\n }\n\n sserie.setXAxis(xSubAxis);\n\n if (serie.getYAxis().getSubAxis) {\n\n let subAxisIndex = Math.floor(index / (xAxis.splitNumber || 1));\n ySubAxis = serie.getYAxis().getSubAxis(subAxisIndex);\n } else {\n ySubAxis = serie.getYAxis();\n }\n\n sserie.setYAxis(ySubAxis);\n\n sserie.draw(true);\n });\n //}\n });\n }\n\n /**\n * Creates a new serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @param {String} type - The type of the serie\n * @return {Serie} The created serie\n */\n newSerie(name, options = {}, type) {\n\n switch (type) {\n\n case 'line':\n return this.newLineSerie(name, options);\n break;\n\n case 'scatter':\n return this.newScatterSerie(name, options);\n break;\n }\n\n throw 'Cannot create a split serie of type ' + type;\n }\n\n /**\n * Creates a new line serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @return {Serie} The created serie\n */\n newLineSerie(name, options) {\n var serieObj = {\n type: 'lineSerie',\n serie: new SerieLineExtended(name, options, 'line')\n };\n this.series.set(name, serieObj);\n serieObj.serie.init(this.graph, name, options);\n this.graph.series.push(serieObj.serie);\n return serieObj.serie;\n }\n\n /**\n * Creates a new scatter serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @return {Serie} The created serie\n */\n newScatterSerie(name, options) {\n var serieObj = {\n type: 'scatterSerie',\n serie: new SerieScatterExtended(name, options, 'scatter')\n };\n this.series.set(name, serieObj);\n serieObj.serie.init(this.graph, options);\n this.graph.series.push(serieObj.serie);\n return serieObj.serie;\n }\n\n }\n\n var defaultAxisConstructorOptions = {\n splitMarks: true\n };\n\n var SplitAxis = function (mixin) {\n\n var delegateMethods = ['turnGridsOff', 'turnGridsOn', 'gridsOff', 'gridsOn', 'setEngineering', 'setScientificScaleExponent', 'setScientific', 'setLabelColor', 'setSecondaryGridDasharray', 'setPrimaryGridDasharray', 'setSecondaryGridsOpacity', 'setPrimaryGridOpacity', 'setSecondaryGridWidth', 'setPrimaryGridWidth', 'setSecondaryGridColor', 'setPrimaryGridColor', 'setTicksLabelColor', 'setSecondaryTicksColor', 'setPrimaryTicksColor', 'setAxisColor', 'secondaryGridOn', 'secondaryGridOff', 'primaryGridOff', 'primaryGridOn', 'setSecondaryGrid', 'setPrimaryGrid', 'setGrids', 'setTickPosition', 'setExponentialFactor', 'setExponentialLabelFactor', 'setGridLinesStyle', 'forcePrimaryTickUnitMin', 'forcePrimaryTickUnitMax', 'forcePrimaryTickUnit', 'flip', 'show', 'hide', 'setDisplay'];\n\n /**\n * Split axis\n * @mixes AxisX\n * @mixes AxisY\n * @name SplitAxis\n * @static\n */\n var cl = class SplitAxis extends mixin {\n\n constructor(graph, position, options = {}) {\n\n super(graph, position, options);\n this.axes = [];\n this.position = position;\n this.constructorOptions = util.extend(true, {}, defaultAxisConstructorOptions, options);\n\n this._splitVal = [];\n }\n\n /**\n * Calls a callback onto each chunk axes. The callback receives two parameters: 1) the ```axis``` itself and 2) the ```index``` of the axis in the stack\n * @param {Function} callback - The callback to be applied to each axes\n * @return {SplitAxis} The current axis instance\n */\n all(callback) {\n\n if (!(typeof callback == 'function')) {\n return;\n }\n\n this.axes.map(callback);\n return this;\n }\n\n /**\n * Splits the axis into chunks at the positions defined as a list of parameters.\n * @param {Function} ...splits - The positions of axis splitting\n * @return {SplitAxis} The current axis instance\n * @example axis.splitAxis( 0.2, 0.5, 0.8 ); // Creates 4 chunks (0-20%, 20%-50%, 50%-80%, 80%-100%)\n */\n splitAxis(...splits) {\n\n splits.push(1);\n let splitNumber = splits.length;\n\n while (this.axes.length > splitNumber) {\n this.axes.pop().kill(true, true);\n }\n\n while (this.axes.length < splitNumber) {\n let axis = new (this.getConstructor())(this.graph, this.position, this.constructorOptions);\n this.axes.push(axis);\n axis.zoomLock = true;\n axis.init(this.graph, this.constructorOptions);\n }\n\n let from = 0;\n let i = 0;\n for (let axis of this.axes) {\n\n axis.options.marginMin = 10;\n axis.options.marginMax = 10;\n\n if (i == 0) {\n axis.options.marginMin = 0;\n }\n\n if (i == this.axes.length - 1) {\n axis.options.marginMax = 0;\n }\n\n axis.setSpan(from, from = splits[i]);\n axis.setMinMaxFlipped();\n i++;\n }\n\n this._splits = splits;\n return this;\n }\n\n /**\n * Fixes the major tick interval of all axes based on the one provided as a parameter\n * @param {Number} axisIndex - The index of the reference axis (starting at 0)\n * @return {SplitAxis} The current axis instance\n */\n fixGridIntervalBasedOnAxis(axisIndex) {\n\n this.fixGridFor = axisIndex;\n this.graph._axisHasChanged();\n return this;\n }\n\n /**\n * Spreads the chunks of the axis based on the relative interval of each one of them, so that the unit / px is constant for each chunk\n * @param {Boolean} bln - ```true``` to enable the spread, ```false``` otherwise\n * @return {SplitAxis} The current axis instance\n */\n splitSpread(bln) {\n this.autoSpread = !!bln;\n return this;\n }\n\n hasAxis(axis) {\n return this.axes.indexOf(axis) > -1;\n }\n\n _splitSpread() {\n\n let splits = [],\n total = 0,\n currentSplit = 0;\n //console.log( this._splitVal );\n for (let split of this._splitVal) {\n total += split[1] - split[0];\n }\n\n for (let split of this._splitVal) {\n\n splits.push(currentSplit += (split[1] - split[0]) / total);\n }\n\n splits.pop();\n this.splitAxis(...splits);\n }\n\n /**\n * Defines the boundaries of each chunk in axis unit.\n * @param {Array<(Array|Number)>} values - An array of either 2-component arrays (from-to) or number (mean)\n * @example axis.setChunkBoundaries( [ [ 12, 20 ], [ 100, 200 ] ] ); // First chunk from 12 to 20, second one from 100 to 200\n * @example axis.setChunkBoundaries( [ 12, [ 100, 200 ] ] ); // Second chunk from 100 to 200, first chunk with a mean at 12 and min / max determined by the relative widths of the chunks\n * @return {SplitAxis} The current axis instance\n */\n setChunkBoundaries(values) {\n\n let index = 0,\n baseWidth,\n baseWidthIndex;\n\n for (let axis of this.axes) {\n // List all axes\n\n // Two elements in the array => becomes the new reference\n if (Array.isArray(values[index]) && values[index].length > 1 && !baseWidth) {\n baseWidth = values[index][1] - values[index][0];\n baseWidthIndex = index;\n }\n\n if (values[index].length == 1 || !Array.isArray(values[index])) {\n axis._mean = values[index];\n\n if (Array.isArray(axis._mean)) {\n axis._mean = axis._mean[0];\n }\n } else {\n\n axis.forceMin(values[index][0]).forceMax(values[index][1]);\n }\n\n index++;\n }\n\n this._baseWidthVal = baseWidth;\n this._baseWidthIndex = baseWidthIndex;\n\n this._splitVal = values;\n\n this.graph._axisHasChanged();\n\n return this;\n }\n\n setMinMaxToFitSeries() {\n\n if (!this._splitVal || this._splitVal.length < 1) {\n super.setMinMaxToFitSeries(...arguments);\n this._splitVal[0] = this._splitVal[0] || [];\n this._splitVal[this._splitVal.length - 1] = this._splitVal[this._splitVal.length - 1] || [];\n\n this._splitVal[0][0] = this.getCurrentMin();\n this._splitVal[this._splitVal.length - 1][1] = this.getCurrentMax();\n this.setChunkBoundaries(this._splitVal);\n }\n }\n\n draw() {\n\n if (this.autoSpread) {\n this._splitSpread();\n }\n\n let max = 0;\n let unit;\n let subAxis;\n let spanReference;\n\n if (this._baseWidthIndex >= 0 && (subAxis = this.getSubAxis(this._baseWidthIndex))) {\n spanReference = subAxis.getSpan();\n }\n\n subAxis = undefined;\n\n if (this.fixGridFor >= 0 && (subAxis = this.getSubAxis(this.fixGridFor))) {\n\n if (subAxis._mean !== undefined) {\n let width = (subAxis.getSpan()[1] - subAxis.getSpan()[0]) / (spanReference[1] - spanReference[0]) * this._baseWidthVal;\n subAxis.forceMin(subAxis._mean - width / 2);\n subAxis.forceMax(subAxis._mean + width / 2);\n }\n\n max = subAxis.draw();\n unit = subAxis.getPrimaryTickUnit();\n }\n\n this.axes.map(axis => {\n\n if (subAxis === axis) {\n return;\n }\n\n if (axis._mean !== undefined) {\n let width = (axis.getSpan()[1] - axis.getSpan()[0]) / (spanReference[1] - spanReference[0]) * this._baseWidthVal;\n axis.forceMin(axis._mean - width / 2);\n axis.forceMax(axis._mean + width / 2);\n }\n\n if (unit) {\n axis.forcePrimaryTickUnit(unit);\n }\n\n max = Math.max(max, axis.draw());\n });\n\n // this.drawLabel();\n this.writeUnit();\n\n return max;\n }\n\n setMinPx(min) {\n\n super.setMinPx(min);\n for (let axis of this.axes) {\n axis.setMinPx(min);\n }\n }\n\n setMaxPx(max) {\n\n super.setMaxPx(max);\n\n for (let axis of this.axes) {\n axis.setMaxPx(max);\n }\n }\n\n setShift() {\n\n super.setShift(...arguments);\n\n for (let axis of this.axes) {\n axis.setShift(...arguments);\n }\n }\n\n init() {\n super.init(...arguments);\n this.splitAxis();\n }\n\n getAxisPosition() {\n var max = 0;\n\n this.axes.map(axis => {\n max = Math.max(max, axis.getAxisPosition());\n });\n\n return max;\n }\n\n getSubAxis(index) {\n\n if (this.axes.length <= index) {\n throw 'Impossible to reach axis. Index ' + index + ' is out of range';\n }\n\n return this.axes[index];\n }\n\n get splitNumber() {\n return this._splits.length;\n }\n };\n\n delegateMethods.map(methodName => {\n\n cl.prototype[methodName] = function (method) {\n\n return function () {\n //super[ method ]( ...arguments )\n\n this.axes.map(axis => {\n axis[method](...arguments);\n });\n return this;\n };\n }(methodName);\n });\n\n return cl;\n };\n\n class SplitXAxis extends SplitAxis(_graphAxisX2.default) {\n\n constructor(graph, topbottom, options) {\n super(...arguments);\n this.topbottom = topbottom;\n }\n\n getConstructor() {\n return _graphAxisX2.default;\n }\n\n getAxisPosition() {\n var max = super.getAxisPosition(...arguments);\n\n this.labelPosY = max;\n\n if (this.getLabel()) {\n max += this.graph.options.fontSize;\n }\n\n return max;\n }\n\n drawLabel() {\n super.drawLabel();\n this.label.setAttribute('y', (this.top ? -1 : 1) * (this.graph.options.fontSize + this.labelPosY));\n }\n\n draw() {\n var height = super.draw(...arguments);\n this.drawLabel();\n return height;\n }\n\n }\n\n class SplitYAxis extends SplitAxis(_graphAxisY2.default) {\n\n constructor(graph, leftright, options) {\n super(...arguments);\n ///this.leftright = leftright;\n }\n\n getConstructor() {\n return _graphAxisY2.default;\n }\n /*\n draw() {\n if ( this.getLabel() ) {\n this.axes.map( ( axis ) => {\n axis.setAxisPosition( this.graph.options.fontSize );\n } ); // Extra shift allowed for the label\n //this.setShift( this.graph.options.fontSize );\n }\n return super.draw( ...arguments );\n }\n */\n drawLabel() {\n super.drawLabel();\n }\n\n equalizePosition(width) {\n\n var widthAfter = width;\n\n if (this.getLabel()) {\n this.axes.map(axis => {\n widthAfter = Math.max(axis.equalizePosition(width), widthAfter);\n }); // Extra shift allowed for the label\n //this.setShift( this.graph.options.fontSize );\n }\n\n if (this.getLabel()) {\n this.placeLabel(this.left ? -widthAfter : widthAfter);\n return widthAfter + this.graph.options.fontSize;\n }\n }\n\n }\n\n util.mix(SplitXAxis, new _graphAxisX2.default());\n util.mix(SplitYAxis, new _graphAxisY2.default());\n\n exports.default = PluginAxisSplitting;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 48 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'), require('./graph.plugin.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil, global.graphPlugin);\n global.graphPluginMakeTracesDifferent = mod.exports;\n }\n})(this, function (module, exports, _graphUtil, _graphPlugin) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n /**\n * The intent of this plugin is to provide methods for the user to make the traces on the graph automatically different\n * Options to provide colorization, markers and line styles should be provided\n * @extends Plugin\n */\n class PluginMakeTracesDifferent extends _graphPlugin2.default {\n\n constructor() {\n super(...arguments);\n }\n\n init(graph, options) {\n super.init(graph, options);\n }\n // Load this with defaults\n static default() {\n\n return {};\n }\n\n checkHSL(color) {\n\n let result = {},\n hue,\n saturation,\n lightness;\n\n if (hue = color.h || color.hue) {\n\n if (hue < 1) {\n hue = Math.round(hue * 360);\n }\n\n result.hue = hue;\n } else {\n result.h = 0;\n }\n\n if (saturation = color.s || color.saturation) {\n\n if (saturation > 1) {\n saturation /= 100;\n }\n\n result.saturation = saturation;\n } else {\n result.saturation = 0.75;\n }\n\n if (lightness = color.lightness || color.l) {\n\n if (lightness > 1) {\n lightness /= 100;\n }\n\n result.lightness = lightness;\n } else {\n result.lightness = 0.5;\n }\n\n return result;\n }\n\n buildHSLString(hsl) {\n return 'hsl( ' + Math.round(hsl.h) + ', ' + Math.round(hsl.s * 100) + '%, ' + Math.round(hsl.l * 100) + '%)';\n }\n\n colorizeAll(options) {\n\n let series, seriesLength;\n\n if (options.serieTypes) {\n\n if (!Array.isArray(options.serieTypes)) {\n options.serieTypes = [options.serieTypes];\n }\n\n series = this.graph.allSeries(...options.serieTypes);\n } else {\n series = this.graph.getSeries();\n }\n\n seriesLength = series.length;\n\n if (!options.startingColorHSL) {\n\n if (options.colorHSL) {\n options.startingColorHSL = this.checkHSL(options.colorHSL);\n } else {\n throw 'No starting color was provided. There must exist either options.colorHSL or options.startingColorHSL';\n }\n }\n\n if (!options.endingColorHSL) {\n\n if (!options.affect || !['h', 's', 'l', 'hue', 'saturation', 'lightness'].include(options.affect)) {\n options.affect = 'h';\n }\n\n switch (options.affect) {\n\n case 'h':\n case 'hue':\n options.endingColorHSL = {\n h: options.startingColorHSL.h + 300,\n s: options.startingColorHSL.s,\n l: options.startingColorHSL.l\n };\n break;\n\n case 'saturation':\n case 's':\n let endS;\n\n if (options.startingColorHSL.s > 0.5) {\n endS = 0;\n } else {\n endS = 1;\n }\n\n options.endingColorHSL = {\n h: options.startingColorHSL.h,\n s: endS,\n l: options.startingColorHSL.l\n };\n break;\n\n case 'lightness':\n case 'l':\n let endL;\n\n if (options.startingColorHSL.l > 0.5) {\n endL = 0;\n } else {\n endL = 0.75;\n }\n\n options.endingColorHSL = {\n h: options.startingColorHSL.h,\n s: options.startingColorHSL.s,\n l: endL\n };\n break;\n }\n } else {\n options.endingColorHSL = Object.assign({}, options.startingColorHSL, options.endingColorHSL);\n }\n\n return series.map((serie, index) => {\n\n if (!serie.setLineColor) {\n throw 'The serie ' + serie.getName() + ' does not implement the method `startingColor`';\n }\n\n const colorString = this.buildHSLString({\n h: options.startingColorHSL.h + index / (seriesLength - 1) * (options.endingColorHSL.h - options.startingColorHSL.h),\n s: options.startingColorHSL.s + index / (seriesLength - 1) * (options.endingColorHSL.s - options.startingColorHSL.s),\n l: options.startingColorHSL.l + index / (seriesLength - 1) * (options.endingColorHSL.l - options.startingColorHSL.l)\n });\n\n serie.setLineColor(colorString);\n return colorString;\n });\n }\n }\n\n exports.default = PluginMakeTracesDifferent;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 49 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0), __webpack_require__(2)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'), require('./graph.plugin.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil, global.graphPlugin);\n global.graphPluginPeakpicking = mod.exports;\n }\n})(this, function (module, exports, _graphUtil, _graphPlugin) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphPlugin2 = _interopRequireDefault(_graphPlugin);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n /*\n What is it ?\n It is a plugin for automatic peak detection on a line serie\n \n How to use ?\n Basic usage:\n \n let graph = new Graph(\"dom\", {\n plugins: {\n 'peakPicking': {}\n }\n }\n );\n \n let wv = Graph.newWaveform();\n wv.setData( [ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 ] );\n let s = graph.newSerie(\"serie\").setWaveform( wv ).autoAxis();\n \n graph.getPlugin('peakPicking').setSerie( s );\n graph.draw();\n */\n\n /**\n * @extends Plugin\n */\n class PluginPeakPicking extends _graphPlugin2.default {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n\n return {\n autoPeakPicking: false,\n autoPeakPickingNb: 4,\n autoPeakPickingMinDistance: 10,\n autoPeakPickingFormat: false,\n autoPeakPickingAllowAllY: false\n };\n }\n\n init(graph, options) {\n\n super.init(graph, options);\n this.picks = [];\n\n for (var n = 0, m = this.options.autoPeakPickingNb; n < m; n++) {\n\n var shape = this.graph.newShape({\n type: 'label',\n label: {\n text: '',\n position: {\n x: 0\n },\n anchor: 'middle'\n\n },\n\n selectable: true,\n\n shapeOptions: {\n minPosY: 15\n }\n\n });\n\n shape.draw();\n\n this.picks.push(shape);\n }\n }\n\n setSerie(serie) {\n this.serie = serie;\n }\n\n serieRemoved(serie) {\n\n if (this.serie == serie) {\n this.picks.map(pick => {\n pick.kill();\n });\n }\n }\n\n preDraw() {\n\n if (!this.serie) {\n return;\n }\n\n this.detectedPeaks = [];\n this.lastYPeakPicking = false;\n }\n\n postDraw() {\n\n if (!this.serie) {\n return;\n }\n let lookForMaxima = true;\n let lookForMinima = false;\n let lastYPeakPicking;\n let peaks = [];\n\n let waveform = this.serie.getWaveform();\n\n if (!waveform) {\n throw 'The serie must have a waveform for the peak picking to work';\n }\n\n let length = waveform.getLength(),\n i = 0,\n y;\n\n for (; i < length; i++) {\n\n y = waveform.getY(i);\n\n if (this.serie.options.lineToZero) {\n peaks.push([waveform.getX(i), y]);\n continue;\n }\n\n if (!lastYPeakPicking) {\n lastYPeakPicking = [waveform.getX(i), y];\n continue;\n }\n\n if (y >= lastYPeakPicking[1] && lookForMaxima || y <= lastYPeakPicking[1] && lookForMinima) {\n\n lastYPeakPicking = [waveform.getX(i), y];\n } else if (y < lastYPeakPicking[1] && lookForMaxima || y > lastYPeakPicking[1] && lookForMinima) {\n\n if (lookForMinima) {\n lookForMinima = false;\n lookForMaxima = true;\n } else {\n\n lookForMinima = true;\n lookForMaxima = false;\n\n peaks.push(lastYPeakPicking);\n lastYPeakPicking = false;\n }\n\n lastYPeakPicking = [waveform.getX(i), y];\n }\n }\n\n var ys = peaks;\n var x,\n px,\n passed = [],\n px,\n l = ys.length,\n k,\n m,\n index;\n\n i = 0;\n\n var selected = this.graph.selectedShapes.map(function (shape) {\n return shape.getProp('xval');\n });\n\n ys.sort(function (a, b) {\n return b[1] - a[1];\n });\n\n m = 0;\n\n for (; i < l; i++) {\n\n x = ys[i][0];\n px = this.serie.getX(x);\n k = 0;\n y = this.serie.getY(ys[i][1]);\n\n if (px < this.serie.getXAxis().getMinPx() || px > this.serie.getXAxis().getMaxPx()) {\n continue;\n }\n\n if (!this.options.autoPeakPickingAllowAllY && (y > this.serie.getYAxis().getMinPx() || y < this.serie.getYAxis().getMaxPx())) {\n\n continue;\n }\n\n // Distance check\n for (; k < passed.length; k++) {\n if (Math.abs(passed[k] - px) < this.options.autoPeakPickingMinDistance) {\n break;\n }\n }\n if (k < passed.length) {\n continue;\n }\n\n // Distance check end\n\n // If the retained one has already been selected somewhere, continue;\n if ((index = selected.indexOf(x)) > -1) {\n passed.push(px);\n continue;\n }\n\n if (!this.picks[m]) {\n return;\n }\n\n //console.log( this.getYAxis().getDataMax(), this.getYAxis().getCurrentMin(), y );\n // this.picks[ m ].show();\n\n if (this.serie.getYAxis().getPx(ys[i][1]) - 20 < 0) {\n\n this.picks[m].setLabelPosition({\n x: x,\n y: '5px'\n });\n\n this.picks[m].setLabelBaseline('hanging');\n } else {\n\n this.picks[m].setLabelBaseline('no-change');\n\n this.picks[m].setLabelPosition({\n x: x,\n y: ys[i][1],\n dy: '-15px'\n });\n }\n\n this.picks[m].setProp('xval', x);\n\n if (this.options.autoPeakPickingFormat) {\n\n this.picks[m].setLabelText(this.options.autoPeakPickingFormat.call(this.picks[m], x, m));\n } else {\n this.picks[m].setLabelText(String(Math.round(x * 1000) / 1000));\n }\n\n this.picks[m].makeLabels();\n\n m++;\n while (this.picks[m] && this.picks[m].isSelected()) {\n m++;\n }\n\n if (passed.length == this.options.autoPeakPickingNb) {\n break;\n }\n }\n }\n\n /**\n * Hides the automatic peak picking (see the autoPeakPicking option)\n * @memberof SerieLine\n */\n hidePeakPicking(lock) {\n\n if (!this._hidePeakPickingLocked) {\n this._hidePeakPickingLocked = lock;\n }\n\n if (!this.graph.picks) {\n return;\n }\n for (var i = 0; i < this.graph.picks.length; i++) {\n this.graph.picks[i].hide();\n }\n }\n\n /**\n * Shows the automatic peak picking (see the autoPeakPicking option)\n * @memberof SerieLine\n */\n showPeakPicking(unlock) {\n\n if (this._hidePeakPickingLocked && !unlock) {\n return;\n }\n\n if (!this.graph.picks) {\n return;\n }\n\n for (var i = 0; i < this.graph.picks.length; i++) {\n this.graph.picks[i].show();\n }\n }\n\n killPeakPicking() {\n\n if (this.picks) {\n for (var i = 0, l = this.picks.length; i < l; i++) {\n this.picks[i].kill();\n }\n }\n }\n }\n\n exports.default = PluginPeakPicking;\n module.exports = exports['default'];\n});\n\n/***/ }),\n/* 50 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports, __webpack_require__(0), __webpack_require__(1)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n factory(module, exports, require('../graph.util.js'), require('./graph.shape.js'));\n } else {\n var mod = {\n exports: {}\n };\n factory(mod, mod.exports, global.graphUtil, global.graphShape);\n global.graphShapeEllipse = mod.exports;\n }\n})(this, function (module, exports, _graphUtil, _graphShape) {\n 'use strict';\n\n Object.defineProperty(exports, \"__esModule\", {\n value: true\n });\n\n var util = _interopRequireWildcard(_graphUtil);\n\n var _graphShape2 = _interopRequireDefault(_graphShape);\n\n function _interopRequireDefault(obj) {\n return obj && obj.__esModule ? obj : {\n default: obj\n };\n }\n\n function _interopRequireWildcard(obj) {\n if (obj && obj.__esModule) {\n return obj;\n } else {\n var newObj = {};\n\n if (obj != null) {\n for (var key in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key];\n }\n }\n\n newObj.default = obj;\n return newObj;\n }\n }\n\n /**\n * Displays an ellipse\n * @extends Shape\n */\n class ShapeEllipse extends _graphShape2.default {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'ellipse');\n }\n\n applyPosition() {\n\n var pos = this.computePosition(0);\n\n this.setDom('cx', pos.x || 0);\n this.setDom('cy', pos.y || 0);\n\n let posR = this.graph.newPosition({\n\n dx: this.getProp('rx'),\n dy: this.getProp('ry') || this.getProp('rx')\n\n });\n\n let posComputed = this.calculatePosition(posR);\n\n this.setDom('rx', Math.abs(posComputed.x) || 0);\n this.setDom('ry', Math.abs(posComputed.y) || 0);\n return true;\n }\n\n setR(rx, ry) {\n this.setProp('rx', rx);\n this.setProp('ry', ry);\n return this;\n }\n\n handleMouseUpImpl() {\n this.triggerChange();\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {}\n }\n\n exports.default = ShapeEllipse;\n module.exports = exports['default'];\n});\n\n/***/ })\n/******/ ]);\n});"]} \ No newline at end of file diff --git a/dist/jsgraph-module.js b/dist/jsgraph-module.js index 3f26e56f2..76f71ed14 100644 --- a/dist/jsgraph-module.js +++ b/dist/jsgraph-module.js @@ -1,3 +1,5 @@ +import extend from 'extend'; + function _parsePx(px) { if (px && px.indexOf && px.indexOf('px') > -1) { return parseInt(px.replace('px', '')); @@ -624,7 +626,7 @@ var isPlainObject = function isPlainObject(obj) { return typeof key === 'undefined' || hasOwn.call(obj, key); }; -function extend() { +function extend$1() { var options, name, src, copy, copyIsArray, clone; var target = arguments[0]; var i = 1; @@ -662,7 +664,7 @@ function extend() { } // Never move original objects, clone them - target[name] = extend(deep, clone, copy); + target[name] = extend$1(deep, clone, copy); // Don't bring in undefined values } else if (typeof copy !== 'undefined') { @@ -1562,267 +1564,13 @@ class LM { //module.export = FitHost -var dataAggregator; - -if (typeof URL === 'undefined' || typeof URL.createObjectURL === 'undefined' || typeof Blob === 'undefined' || typeof Worker === 'undefined') { - dataAggregator = () => {}; -} else { - var aggregatorWorker; - var queue = {}; - - let string = function () { - - onmessage = function (e) { - - const data = e.data.data, - // The initial data - maxX = e.data.maxX, - minX = e.data.minX, - maxY = e.data.maxY, - minY = e.data.minY, - direction = e.data.direction; - - let numPoints = e.data.numPoints; // Total number of points in the slot - let l = data.length; // Number of data in the original buffer - let i = 0; - let k = -4; - let slots = []; - let dataAggregatedX = []; - let dataAggregatedY = []; - let aggregationSum = []; - let getX; - let slotNumber; - let lastAggregationX; - let lastAggregation; - let lastAggregationSum; - let newAggregation; - let newAggregationX; - - if (e.data.xdata) { - - getX = function getX(index) { - return e.data.xdata[index]; - }; - } else { - getX = function getX(index) { - return index * e.data.xScale + e.data.xOffset; - }; - } - - let aggregations = {}; - - // Direction x - if (direction == 'x') { - const dataPerSlot = numPoints / (maxX - minX); // Computed number of aggregation per slot - - for (; i < l; i++) { - - // dataPerSlot: 1 / 1000 ( compression by 1'000 ) - //console.log( dataPerSlot, getX( i ) ); - slotNumber = Math.floor((getX(i) - minX) * dataPerSlot); - - if (slots[k] !== slotNumber) { - k += 4; - slots[k] = slotNumber; - - let slotX = (slotNumber + 0.5) / dataPerSlot + minX; - - dataAggregatedX[k] = slotX; - dataAggregatedX[k + 1] = slotX; - dataAggregatedX[k + 2] = slotX; - dataAggregatedX[k + 3] = slotX; - - dataAggregatedY[k] = data[i]; - dataAggregatedY[k + 1] = data[i]; - dataAggregatedY[k + 2] = data[i]; - dataAggregatedY[k + 3] = data[i]; - aggregationSum[k] = 0; - } - - dataAggregatedY[k + 1] = Math.min(data[i], dataAggregatedY[k + 1]); - dataAggregatedY[k + 2] = Math.max(data[i], dataAggregatedY[k + 2]); - dataAggregatedY[k + 3] = data[i]; - aggregationSum[k] += data[i]; - } - } else { - // y - - const dataPerSlot = numPoints / (maxY - minY); // Computed number of aggregation per slot - - for (; i < l; i++) { - - // dataPerSlot: 1 / 1000 ( compression by 1'000 ) - //console.log( dataPerSlot, getX( i ) ); - slotNumber = Math.floor((data[i] - minY) * dataPerSlot); - - if (slots[k] !== slotNumber) { - k += 4; - slots[k] = slotNumber; - - let slotY = (slotNumber + 0.5) / dataPerSlot + minY; - - dataAggregatedY[k] = slotY; - dataAggregatedY[k + 1] = slotY; - dataAggregatedY[k + 2] = slotY; - dataAggregatedY[k + 3] = slotY; - - dataAggregatedX[k] = data[i]; - dataAggregatedX[k + 1] = data[i]; - dataAggregatedX[k + 2] = data[i]; - dataAggregatedX[k + 3] = data[i]; - aggregationSum[k] = 0; - } - dataAggregatedX[k + 1] = Math.min(getX(i), dataAggregatedX[k + 1]); - dataAggregatedX[k + 2] = Math.max(getX(i), dataAggregatedX[k + 2]); - dataAggregatedX[k + 3] = getX(i); - aggregationSum[k] += getX(i); - } - } - - aggregations[numPoints] = { - x: dataAggregatedX, - y: dataAggregatedY, - sums: aggregationSum - }; - - lastAggregation = dataAggregatedY; - lastAggregationX = dataAggregatedX; - lastAggregationSum = aggregationSum; - - while (numPoints > 256) { - - numPoints /= 2; - - newAggregation = []; - newAggregationX = []; - - k = 0; - - if (direction == 'x') { - - for (i = 0, l = lastAggregation.length - 8; i < l; i += 8) { - - newAggregationX[k] = (lastAggregationX[i] + lastAggregationX[i + 4]) / 2; - newAggregationX[k + 1] = newAggregationX[k]; - newAggregationX[k + 2] = newAggregationX[k]; - newAggregationX[k + 3] = newAggregationX[k]; - - newAggregation[k] = lastAggregation[i]; - newAggregation[k + 1] = Math.min(lastAggregation[i + 1], lastAggregation[i + 5]); - newAggregation[k + 2] = Math.max(lastAggregation[i + 2], lastAggregation[i + 6]); - newAggregation[k + 3] = lastAggregation[i + 7]; - - aggregationSum[k] = (lastAggregationSum[i] + lastAggregationSum[i + 4]) / 2; - - k += 4; - } - } else { - - for (i = 0, l = lastAggregation.length - 8; i < l; i += 8) { - - newAggregation[k] = (lastAggregation[i] + lastAggregation[i + 4]) / 2; - newAggregation[k + 1] = newAggregation[k]; - newAggregation[k + 2] = newAggregation[k]; - newAggregation[k + 3] = newAggregation[k]; - - newAggregationX[k] = lastAggregationX[i]; - newAggregationX[k + 1] = Math.min(lastAggregationX[i + 1], lastAggregationX[i + 5]); - newAggregationX[k + 2] = Math.max(lastAggregationX[i + 2], lastAggregationX[i + 6]); - newAggregationX[k + 3] = lastAggregationX[i + 7]; - - aggregationSum[k] = (lastAggregationSum[i] + lastAggregationSum[i + 4]) / 2; - - k += 4; - } - } - - aggregations[numPoints] = { - x: newAggregationX, - y: newAggregation, - sums: aggregationSum - }; - - lastAggregation = newAggregation; - lastAggregationX = newAggregationX; - lastAggregationSum = aggregationSum; - - aggregationSum = []; - } - - postMessage({ - aggregates: aggregations, - _queueId: e.data._queueId - }); - }; - }.toString(); - - string = string.replace(/^\s*function\s*\(\s*\)\s*\{/, ''); - string = string.replace(/}\s*$/, ''); - /* - if ( typeof URL == "undefined" ) { - module.exports = function() {}; - } else { - */ - - var workerUrl = URL.createObjectURL(new Blob([string], { - type: 'application/javascript' - })); - - aggregatorWorker = new Worker(workerUrl); - - aggregatorWorker.onmessage = function (e) { - - var id = e.data._queueId; - delete e.data._queueId; - queue[id](e.data); - delete queue[id]; - }; - - dataAggregator = function (toOptimize) { - - var requestId = Date.now(); - toOptimize._queueId = requestId; - - var prom = new Promise(resolver => { - queue[requestId] = resolver; - }); - - aggregatorWorker.postMessage(toOptimize); - return prom; - }; -} - -var aggregator = dataAggregator; - class Waveform { constructor(data = [], xOffset = 0, xScale = 1) { this.xOffset = xOffset; this.xScale = xScale; - - // Error bar handling - this.errors = { - - nb: 0, - - bars: { - above: null, - below: null - }, - - boxes: { - above: null, - below: null - } - }; - this.setData(data); - - this.BELOW = Waveform.BELOW; - this.ABOVE = Waveform.ABOVE; - this.BOX = Waveform.BOX; - this.BAR = Waveform.BAR; } /** [ [ x1, y1 ], [ x2, y2 ] ] */ @@ -1868,7 +1616,7 @@ class Waveform { data.map((el, index) => { - if (!nanable && Number.isNaN(el[0]) || Number.isNaN(el[1])) { + if (!nanable && (el[0] !== el[0] || el[1] !== el[1])) { warnNaN = true; } @@ -1887,7 +1635,7 @@ class Waveform { return this; } - getY(index, optimized = false) { + getY(index, optimized) { if (optimized && this.dataInUse) { return this.dataInUse.y[index] * this.getScale() + this.getShift(); @@ -1912,7 +1660,7 @@ class Waveform { if (Array.isArray(waveform)) { waveform = new Waveform(waveform); } else { - throw 'Cannot set X waveform. Data is not a valid array.'; + throw "Cannot set X waveform. Data is not a valid array."; } } @@ -1926,20 +1674,14 @@ class Waveform { } getXWaveform() { - if (this.xdata) { return this.xdata; } - let wave = new Waveform(), - xs = []; + var wave = new Waveform(); for (var i = 0; i < this.getLength(); i += 1) { - xs.push(this.getX(i)); + wave.append(this.getX(i)); } - - wave.setData(xs); - - this.xdata = wave; return wave; } @@ -1957,11 +1699,11 @@ class Waveform { setTypedArrayClass(constructor) { if (this.getTypedArrayClass() && this.isNaNAllowed() && !this.isNaNAllowed(constructor)) { - this.warn('NaN values are not allowed by the new constructor (' + constructor.name + ') while it was allowed by the previous one (' + this._typedArrayClass.name + ')'); + this.warn("NaN values are not allowed by the new constructor (" + constructor.name + ") while it was allowed by the previous one (" + this._typedArrayClass.name + ")"); } if (this.getTypedArrayClass() && this.isUnsigned() && !this.isUnsigned(constructor)) { - this.warn('You are switching from signed values to unsigned values. You may experience data corruption if there were some negative values.'); + this.warn("You are switching from signed values to unsigned values. You may experience data corruption if there were some negative values."); } this._typedArrayClass = constructor; @@ -1983,7 +1725,7 @@ class Waveform { isUnsigned(constructor = this._typedArrayClass) { - // The following types accept unsigned numbers + // The following types accept NaNs return constructor == Uint8Array || constructor == Uint8ClampedArray || constructor == Uint16Array || constructor == Uint32Array; } @@ -2007,11 +1749,11 @@ class Waveform { prepend(x, y) { - if (typeof x == 'function') { + if (typeof x == "function") { x = x(this); } - if (typeof y == 'function') { + if (typeof y == "function") { y = y(this); } @@ -2031,15 +1773,11 @@ class Waveform { append(x, y) { - if (!this.data) { - this.data = []; - } - - if (typeof x == 'function') { + if (typeof x == "function") { x = x(this); } - if (typeof y == 'function') { + if (typeof y == "function") { y = y(this); } @@ -2051,9 +1789,9 @@ class Waveform { } if (this.monotoneous) { - if (y >= this.data[this.data.y] && this.getMonotoneousAscending() === false) { + if (y > this.data[this.data.y] && this.getMonotoneousAscending() === false) { this.monotoneous = false; - } else if (y <= this.data[this.data.y] && this.getMonotoneousAscending() === true) { + } else if (y < this.data[this.data.y] && this.getMonotoneousAscending() === true) { this.monotoneous = false; } } @@ -2084,8 +1822,7 @@ class Waveform { return new Array(length); } - _setData(dataY = this.data) { - + _setData(dataY) { const l = dataY.length; let i = 1, monoDir = dataY[1] > dataY[0], @@ -2110,25 +1847,8 @@ class Waveform { this._monotoneousAscending = dataY[1] > dataY[0]; } - if (this.hasErrorBars()) { - // If prefer to loop again here - - for (i = 0; i < l; i++) { - - if (dataY[i] === dataY[i]) { - // NaN support - - minY = Math.min(minY, dataY[i] - this.getMaxError(i, 'below')); - maxY = Math.max(maxY, dataY[i] + this.getMaxError(i, 'above')); - } - } - - this.minY = minY; - this.maxY = maxY; - } else { - this.minY = minY; - this.maxY = maxY; - } + this.minY = minY; + this.maxY = maxY; this.data = dataY; @@ -2142,7 +1862,11 @@ class Waveform { return; } - if (!this.xdata) { + if (this.xdata) { + + this.minX = this.xdata.getMin(); + this.maxX = this.xdata.getMax(); + } else { const b1 = this.xOffset + this.xScale * this.getLength(), b2 = this.xOffset; @@ -2170,7 +1894,7 @@ class Waveform { position = this.getIndexFromData(val, data, this.data.getMonotoneousAscending(), roundingMethod); - if (useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateY') { + if (useDataToUse && this.dataInUse && this.dataInUseType == "aggregateY") { // In case of aggregation, round to the closest element of 4. return position - position % 4; } @@ -2185,19 +1909,18 @@ class Waveform { if (useDataToUse && this.dataInUse) { xdata = this.dataInUse.x; } else if (this.xdata) { - xdata = this.xdata.data; + xdata = this.xdata.getData(); } let position; if (this.hasXWaveform()) { - // The x value HAS to be rescaled position = this.xdata.getIndexFromData(xval, xdata, this.xdata.getMonotoneousAscending(), roundingMethod); } else { position = Math.max(0, Math.min(this.getLength() - 1, roundingMethod((xval - this.xOffset) / this.xScale))); } - if (useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateX') { + if (useDataToUse && this.dataInUse && this.dataInUseType == "aggregateX") { // In case of aggregation, round to the closest element of 4. return position - position % 4; } @@ -2205,80 +1928,29 @@ class Waveform { return position; } - getIndexFromXY(xval, yval, useDataToUse = false, roundingMethod = Math.round, scaleX, scaleY) { + getIndexFromData(val, valCollection, isAscending, roundingMethod) { - let xdata, ydata; - - if (useDataToUse && this.dataInUse) { - - xdata = this.dataInUse.x; - ydata = this.dataInUse.y; - } else if (this.xdata) { - - xdata = this.xdata.data; - ydata = this.data; - } - - let position; - - if (this.isXMonotoneous()) { - // X lookup only - - if (this.hasXWaveform()) { - // The x value HAS to be rescaled - position = this.xdata.getIndexFromData(xval, xdata, this.xdata.getMonotoneousAscending(), roundingMethod); - } else { - position = Math.max(0, Math.min(this.getLength() - 1, roundingMethod((xval - this.xOffset) / this.xScale))); - } - } else if (!isNaN(yval)) { - - position = this.getIndexFromDataXY(xval, xdata, yval, ydata, scaleX, scaleY); - } else { - return; - } - - if (useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateX') { - // In case of aggregation, round to the closest element of 4. - return position - position % 4; + if (!this.isMonotoneous()) { + console.trace(); + throw "Impossible to get the index from a non-monotoneous wave !"; } - return position; - } - - getIndexFromData(val, valCollection, isAscending) { - val -= this.getShift(); val /= this.getScale(); - if (!this.isMonotoneous()) { - console.trace(); - throw 'Impossible to get the index from a non-monotoneous wave !'; - } - return binarySearch(val, valCollection, !isAscending); } - getIndexFromDataXY(valX, dataX, valY, dataY, scaleX = 1, scaleY = 1) { - - valX -= this.getXShift(); - valX /= this.getXScale(); - - valY -= this.getShift(); - valY /= this.getScale(); - - return euclidianSearch(valX, valY, dataX, dataY, scaleX, scaleY); - } - getReductionType() { return this.dataInUseType; } getXMin() { - return this.xdata ? this.xdata.getMin() : this.minX; + return this.minX * this.getXScale() + this.getXShift(); } getXMax() { - return this.xdata ? this.xdata.getMax() : this.maxX; + return this.maxX * this.getXScale() + this.getXShift(); } getYMin() { @@ -2298,11 +1970,12 @@ class Waveform { } getMinX() { - return this.getXMin(); + + return this.minX * this.getXScale() + this.getXShift(); } getMaxX() { - return this.getXMax(); + return this.maxX * this.getXScale() + this.getXShift(); } getMinY() { @@ -2346,11 +2019,12 @@ class Waveform { // this.minY = ( this.minY - this.getShift() ) * scale; // this.maxY = ( this.maxY - this.getShift() ) * scale; this.scale = scale; + return this; } setXShift(shift = 0) { - if (!this.hasXWaveform()) { + if (!this.hasXWaveform) { return this; } @@ -2362,7 +2036,7 @@ class Waveform { return this; } - getXShift(shift) { + getXShift(shift = 0) { if (!this.hasXWaveform) { return 0; @@ -2391,9 +2065,6 @@ class Waveform { } getLength() { - if (!this.data) { - return 0; - } return this.data.length; } @@ -2433,7 +2104,7 @@ class Waveform { return new Promise(function (resolver, rejector) { - var fit = new FitHost(Object.assign({}, { + var fit = new FitHost(extend({}, { dataY: self, dataX: self.getXWaveform(), @@ -2557,7 +2228,7 @@ class Waveform { requireMonotonicity() { if (!this.isMonotoneous()) { - throw 'The wave must be monotonic'; + throw "The wave must be monotonic"; } } @@ -2575,7 +2246,7 @@ class Waveform { invert(data) { - let d = data || this.data; + let d = dataY || this.data; d.reverse(); if (this.isMonotoneous()) { @@ -2613,11 +2284,11 @@ class Waveform { const l = this.getLength(); if (!options.xPosition) { - throw 'No position calculation method provided'; + throw "No position calculation method provided"; } if (!options.resampleToPx) { - throw 'No "resampleToPx" method was provided. Unit: px per point'; + throw "No \"resampleToPx\" method was provided. Unit: px per point"; } if (options.minX > options.maxX) { @@ -2700,22 +2371,19 @@ class Waveform { resampleMax = Math.max(resampleMax, dataY[i]); } - this.dataInUseType = 'resampled'; + this.dataInUseType = "resampled"; this.dataInUse = data; return dataMinMax; } interpolate(x) { - let xIndex; let yData = this.getDataY(); - - x = (x - this.getXShift()) / this.getXScale(); + let xIndex; if (this.xdata) { - let xData = this.xdata.getData(), - xIndex = binarySearch(x, xData, !this.xdata.getMonotoneousAscending()); - + let xData = this.xdata.getData(); + xIndex = binarySearch(x, xData, !this.xdata.getMonotoneousAscending()); if (xData[xIndex] == x) { return yData[xIndex]; } @@ -2727,10 +2395,21 @@ class Waveform { } } + interpolateIndex_X(index) { + + let yData = this.getDataY(); + if (this.xdata) { + let xData = this.xdata.getData(); + let indexStart = Math.floor(index); + + return (index - indexStart) * (xData[indexStart + 1] - xData[indexStart]) + xData[indexStart]; + } + } + getMonotoneousAscending() { if (!this.isMonotoneous()) { - return 'The waveform is not monotoneous'; + return "The waveform is not monotoneous"; } return this._monotoneousAscending; @@ -2903,10 +2582,10 @@ class Waveform { this._dataAggregating = aggregator({ - minX: this.getMinX(), - maxX: this.getMaxX(), - minY: this.getMinY(), - maxY: this.getMaxY(), + minX: this.minX, + maxX: this.maxX, + minY: this.minY, + maxY: this.maxY, data: this.data, xdata: this.xdata ? this.xdata.getData() : undefined, xScale: this.xScale, @@ -2917,7 +2596,6 @@ class Waveform { }).then(event => { this._dataAggregated = event.aggregates; - console.log(this._dataAggregated); this._dataAggregating = false; }); } @@ -2938,14 +2616,11 @@ class Waveform { } */ - if (pxWidth > 2147483647) { - pxWidth = 2147483647; - } var level = pow2ceil(pxWidth); if (this._dataAggregated[level]) { - this.dataInUseType = 'aggregate' + this._dataAggregationDirection; + this.dataInUseType = "aggregate" + this._dataAggregationDirection; this.dataInUse = this._dataAggregated[level]; return; } else if (this._dataAggregating) { @@ -2953,7 +2628,7 @@ class Waveform { return this._dataAggregating; } - this.dataInUseType = 'none'; + this.dataInUseType = "none"; this.dataInUse = { y: this.data, x: this.getXWaveform().data @@ -3082,7 +2757,7 @@ class Waveform { } getUnit() { - return this.unit || ''; + return this.unit || ""; } getXUnit() { @@ -3090,7 +2765,7 @@ class Waveform { return this.xdata.getUnit(); } - return this.xunit | ''; + return this.xunit | ""; } hasXUnit() { @@ -3103,7 +2778,7 @@ class Waveform { findLevels(level, options) { - options = Object.assign({ + options = extend({ box: 1, edge: 'both', @@ -3117,7 +2792,7 @@ class Waveform { var indices = []; var i = 0; - while (lvlIndex = this.findLevel(level, Object.assign({}, options, { + while (lvlIndex = this.findLevel(level, extend(true, {}, options, { rangeP: [lastLvlIndex, options.rangeP[1]] }))) { indices.push(lvlIndex); @@ -3135,7 +2810,7 @@ class Waveform { // Find the first level in the specified range findLevel(level, options) { - options = Object.assign({ + options = extend({ box: 1, edge: 'both', @@ -3157,7 +2832,7 @@ class Waveform { box++; } - if (options.direction == 'descending') { + if (options.direction == "descending") { i = options.rangeP[1], l = options.rangeP[0], increment = -1; } else { i = options.rangeP[0], l = options.rangeP[1], increment = +1; @@ -3165,7 +2840,7 @@ class Waveform { for (;; i += increment) { - if (options.direction == 'descending') { + if (options.direction == "descending") { if (i < l) { break; } @@ -3199,7 +2874,7 @@ class Waveform { for (j = i + (box - 1) / 2; j >= i - (box - 1) / 2; j--) { - if (this.data[j] >= level && this.data[j - 1] < level) { + if (this.data[j] >= level && this.data[j - 1] <= level) { // Find a crossing switch (options.rounding) { @@ -3226,7 +2901,7 @@ class Waveform { for (j = i + (box - 1) / 2; j >= i - (box - 1) / 2; j--) { - if (this.data[j] <= level && this.data[j - 1] > level) { + if (this.data[j] <= level && this.data[j - 1] >= level) { // Find a crossing switch (options.rounding) { @@ -3312,262 +2987,13 @@ class Waveform { this.setData(this.data); } - //////////////////////////////////////////////////////////// - ///// HANDLING ERRORS //////////////////////////////////// - //////////////////////////////////////////////////////////// - - setErrorBarX(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - xWave.setErrorBar(waveform); - return this; - } - - setErrorBarXBelow(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - xWave.setErrorBarBelow(waveform); - return this; - } - - setErrorBarXAbove(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - xWave.setErrorBarAbove(waveform); - return this; - } - - setErrorBoxX(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - xWave.setErrorBoxAbove(waveform); - xWave.setErrorBoxBelow(waveform); - return this; - } - - setErrorBoxXBelow(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - - xWave.setErrorBoxBelow(waveform); - return this; - } - - setErrorBoxXAbove(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - xWave.setErrorBoxAbove(waveform); - return this; - } - - setErrorBar(waveform, checkMinMax = true) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - this.errors.nb++; - this.errors.nb++; - this.errors.bars.bottom = waveform; - this.errors.bars.top = waveform; - - if (checkMinMax) { - this._setData(); - } - } - - setErrorBarBelow(waveform, checkMinMax = true) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - this.errors.nb++; - this.errors.bars.below = waveform; - - if (checkMinMax) { - this._setData(); - } - } - - setErrorBarAbove(waveform, checkMinMax = true) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - this.errors.nb++; - this.errors.bars.above = waveform; - - if (checkMinMax) { - this._setData(); - } - } - - setErrorBox(waveform, checkMinMax = true) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - this.errors.nb++; - this.errors.nb++; - this.errors.boxes.above = waveform; - this.errors.boxes.below = waveform; - - if (checkMinMax) { - this._setData(); - } - } - - setErrorBoxBelow(waveform, checkMinMax = true) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - this.errors.nb++; - this.errors.boxes.below = waveform; - - if (checkMinMax) { - this._setData(); - } - } - - setErrorBoxAbove(waveform, checkMinMax = true) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - this.errors.boxes.above = waveform; - if (checkMinMax) { - this._setData(); - } - } - - getMaxError(i, side = Waveform.ABOVE) { - - return Math.max(this.getMaxErrorType(i, side, Waveform.BOX), this.getMaxErrorType(i, side, Waveform.BAR)); - } - - getMaxErrorType(i, side = Waveform.ABOVE, type = Waveform.BOX) { - - let stack; - if (type == Waveform.BOX) { - stack = this.errors.boxes; - } else if (type == Waveform.BAR) { - stack = this.errors.bars; - } else { - throw 'Unknown type of error'; - } - - let waveform; - if (!(waveform = stack[side])) { - if (side == Waveform.ABOVE) { - if (stack[side] == Waveform.BELOW) { - waveform = stack.below; - } - } else { - if (stack[side] == Waveform.ABOVE) { - waveform = stack.above; - } - } - } - - if (!waveform) { - return 0; - } - - return waveform.getY(i); - } - - getErrorBarXBelow(index) { - return this.getErrorX(index, Waveform.BELOW, Waveform.BAR); - } - getErrorBarXAbove(index) { - return this.getErrorX(index, Waveform.ABOVE, Waveform.BAR); - } - getErrorBoxXBelow(index) { - return this.getErrorX(index, Waveform.BELOW, Waveform.BOX); - } - getErrorBoxXAbove(index) { - return this.getErrorX(index, Waveform.ABOVE, Waveform.BOX); - } - - getErrorBarYBelow(index) { - return this.getError(index, Waveform.BELOW, Waveform.BAR); - } - getErrorBarYAbove(index) { - return this.getError(index, Waveform.ABOVE, Waveform.BAR); - } - getErrorBoxYBelow(index) { - return this.getError(index, Waveform.BELOW, Waveform.BOX); - } - getErrorBoxYAbove(index) { - return this.getError(index, Waveform.ABOVE, Waveform.BOX); - } - - getErrorX(index, side = Waveform.ABOVE, type = Waveform.BAR) { - - if (!this.hasXWaveform()) { - return false; - } - - return this.xdata.getError(index, side, type); - } - - getError(index, side = Waveform.ABOVE, type = Waveform.BAR) { - - let errors = type == Waveform.BAR ? this.errors.bars : this.errors.boxes; - - if (!errors) { - return false; - } - - let wave; - if (wave = side == Waveform.ABOVE ? errors.above : errors.below) { - - if (wave == Waveform.ABOVE && side == Waveform.BELOW) { - wave = errors.above; - } else if (wave == Waveform.BELOW && side == Waveform.ABOVE) { - wave = errors.below; - } - - if (!wave) { - return false; - } - - return wave.getY(index); - } - } - - hasErrorBars() { +} - return this.errors.nb > 0 || this.hasXWaveform() && this.xdata.errors.nb > 0; - } +const MULTIPLY = Symbol(); +const ADD = Symbol(); +const SUBTRACT = Symbol(); +const DIVIDE = Symbol(); -} // http://stackoverflow.com/questions/26965171/fast-nearest-power-of-2-in-javascript function pow2ceil(v) { v--; @@ -3592,27 +3018,6 @@ function getIndexInterpolate(value, valueBefore, valueAfter, indexBefore, indexA return (value - valueBefore) / (valueAfter - valueBefore) * (indexAfter - indexBefore) + indexBefore; } -function euclidianSearch(targetX, targetY, haystackX, haystackY, scaleX = 1, scaleY = 1) { - - let distance = Number.MAX_VALUE, - distance_i; - - let index = -1; - - for (var i = 0, l = haystackX.length; i < l; i++) { - - distance_i = Math.pow((targetX - haystackX[i]) * scaleX, 2) + Math.pow((targetY - haystackY[i]) * scaleY, 2); - - if (distance_i < distance) { - - index = i; - distance = distance_i; - } - } - - return index; -} - function binarySearch(target, haystack, reverse) { let seedA = 0, @@ -3633,7 +3038,7 @@ function binarySearch(target, haystack, reverse) { while (true) { i++; if (i > 100) { - throw 'Error loop'; + throw "Error loop"; } seedInt = Math.floor((seedA + seedB) / 2); @@ -3678,20 +3083,6 @@ function binarySearch(target, haystack, reverse) { } } -Waveform.BELOW = Symbol(); -Waveform.ABOVE = Symbol(); - -Waveform.BOX = Symbol(); -Waveform.BAR = Symbol(); - -const MULTIPLY = Symbol(); -const ADD = Symbol(); -const SUBTRACT = Symbol(); -const DIVIDE = Symbol(); - - -//export default Waveform - /** * Default graph parameters * @name Graph~GraphOptionsDefault @@ -3806,7 +3197,7 @@ class Graph$1 extends EventEmitter { * Access directly the options of the graph using this public object. * @example graph.options.mouseActions.push( { } ); */ - this.options = extend({}, GraphOptionsDefault, options); + this.options = extend$1({}, GraphOptionsDefault, options); // Options declaration must be placed before the doDom operation // doDom is a private method. We bind it to this thanks to ES6 features @@ -4747,13 +4138,12 @@ class Graph$1 extends EventEmitter { let min = this.getBoundaryAxis(this.axis[axisvars[j]][i], 'min', usingZValues); let max = this.getBoundaryAxis(this.axis[axisvars[j]][i], 'max', usingZValues); - if (isFinite(min)) { - axis.setMinValueData(min); - } - if (isFinite(max)) { axis.setMaxValueData(max); } + if (isFinite(min)) { + axis.setMinValueData(min); + } } } } @@ -5674,7 +5064,7 @@ class Graph$1 extends EventEmitter { orthogonalProjectionSetup() { - this.options.zAxis = extend(true, { + this.options.zAxis = extend$1(true, { maxZ: 10, minZ: 0, shiftX: -25, @@ -5911,7 +5301,7 @@ class Graph$1 extends EventEmitter { // Avoid multiple creation of tracking lines // Creates a new shape called trackingLine, in the first layer (below everything) - this.trackingObject = this.newShape('line', extend(true, { + this.trackingObject = this.newShape('line', extend$1(true, { position: [{ y: 'min' }, { @@ -6829,7 +6219,7 @@ function refreshDrawingZone(graph) { shift[position][level] = Math.max(drawn, shift[position][level] || 0); }, false, false, true); - var shift2 = extend(true, {}, shift); + var shift2 = extend$1(true, {}, shift); // Applied to left and right graph._applyToAxes(function (axis, position) { @@ -7896,7 +7286,7 @@ class Legend { constructor(graph, options) { - this.options = extend({}, legendDefaults, options); + this.options = extend$1({}, legendDefaults, options); this.graph = graph; this.svg = document.createElementNS(this.graph.ns, 'g'); @@ -8587,7 +7977,7 @@ class Axis extends EventEmitter { this.unitModificationTimeTicks = [[1, [1, 2, 5, 10, 20, 30]], [60, [1, 2, 5, 10, 20, 30]], [3600, [1, 2, 6, 12]], [3600 * 24, [1, 2, 3, 4, 5, 10, 20, 40]]]; this.graph = graph; - this.options = extend(true, {}, defaults, overwriteoptions, options); + this.options = extend$1(true, {}, defaults, overwriteoptions, options); this.group = document.createElementNS(this.graph.ns, 'g'); this.hasChanged = true; @@ -9005,8 +8395,9 @@ class Axis extends EventEmitter { // 25.10.2017. This is to help in the case there's no autoscaling if (isNaN(this.getCurrentMin())) { - this.setCurrentMin(this.getMinValue()); - this.cache(); + //this.setCurrentMin( this.getMinValue() ); + //this.cache(); + } } @@ -9014,9 +8405,11 @@ class Axis extends EventEmitter { this.dataMax = max; // 25.10.2017. This is to help in the case there's no autoscaling + // 02.02.2018. Don't agree with this. Next time, put a link to show the use of this piece of code if (isNaN(this.getCurrentMax())) { - this.setCurrentMax(this.getMaxValue()); - this.cache(); + // this.setCurrentMax( this.getMaxValue() ); + //this.cache(); + } } @@ -9437,7 +8830,6 @@ class Axis extends EventEmitter { if (val === undefined || this.getForcedMin() !== false && (val < this.getForcedMin() || val === undefined)) { val = this.getMinValue(); } - this.currentAxisMin = val; if (this.options.logScale) { this.currentAxisMin = Math.max(1e-50, val); @@ -10131,6 +9523,7 @@ class Axis extends EventEmitter { // Ex 50 / (100) * (1000 - 700) + 700 //console.log( value, this.getCurrentMin(), this.getMaxPx(), this.getMinPx(), this.getCurrentInterval() ); + if (!this.options.logScale) { return (value - this.getCurrentMin()) / this.getCurrentInterval() * (this.getMaxPx() - this.getMinPx()) + this.getMinPx(); @@ -13206,7 +12599,9 @@ class Serie extends EventEmitter { setWaveform(waveform) { if (!(waveform instanceof Waveform)) { - throw 'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance'; + console.trace(); + console.error(waveform); + throw new Error('Cannot assign waveform to serie. Waveform is not of the proper Waveform instance'); } this.waveform = waveform; @@ -13737,15 +13132,15 @@ var ErrorBarMixin = { if (errorstyles.all) { - errorstyles[pairs[j][1]] = extend(true, {}, errorstyles.all); - errorstyles[pairs[j][2]] = extend(true, {}, errorstyles.all); + errorstyles[pairs[j][1]] = extend$1(true, {}, errorstyles.all); + errorstyles[pairs[j][2]] = extend$1(true, {}, errorstyles.all); } if (errorstyles[pairs[j][0]]) { //.x, .y - errorstyles[pairs[j][1]] = extend(true, {}, errorstyles[pairs[j][0]]); - errorstyles[pairs[j][2]] = extend(true, {}, errorstyles[pairs[j][0]]); + errorstyles[pairs[j][1]] = extend$1(true, {}, errorstyles[pairs[j][0]]); + errorstyles[pairs[j][2]] = extend$1(true, {}, errorstyles[pairs[j][0]]); } for (var k = 1; k <= 2; k++) { @@ -14000,25 +13395,6 @@ class SerieLine extends Serie { } } - setWaveform(waveform) { - - if (!(waveform instanceof Waveform)) { - throw 'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance'; - } - - this.waveform = waveform; - - this.minX = this.waveform.getXMin(); - this.maxX = this.waveform.getXMax(); - this.minY = this.waveform.getMin(); - this.maxY = this.waveform.getMax(); - - this.graph.updateDataMinMaxAxes(); - this.dataHasChanged(); - - return this; - } - /** * Sets the options of the serie * @see SerieLineDefaultOptions @@ -14027,7 +13403,7 @@ class SerieLine extends Serie { * @memberof SerieLine */ setOptions(options) { - this.options = extend(true, {}, SerieLine.prototype.defaults, options || {}); + this.options = extend$1(true, {}, SerieLine.prototype.defaults, options || {}); // Unselected style this.styles.unselected = { lineColor: this.options.lineColor, @@ -15312,7 +14688,7 @@ class SerieLine extends Serie { var s = this.styles[i]; if (s) { - this.styles[i] = extend(true, {}, this.styles.unselected, s); + this.styles[i] = extend$1(true, {}, this.styles.unselected, s); } } } @@ -15320,7 +14696,7 @@ class SerieLine extends Serie { extendStyle(styleTarget, styleOrigin) { var s = this.styles[styleTarget]; - this.styles[styleTarget] = extend(true, {}, this.styles[styleOrigin || 'unselected'], s || {}); + this.styles[styleTarget] = extend$1(true, {}, this.styles[styleOrigin || 'unselected'], s || {}); this.styles[styleTarget].markers.map(function (marker) { if (marker.dom) { @@ -15455,7 +14831,7 @@ class SerieLine extends Serie { this.styles[selectionType || 'unselected'].markers = families; if (applyToSelected) { - this.styles.selected.markers = extend(true, {}, families); + this.styles.selected.markers = extend$1(true, {}, families); } this._recalculateMarkerPoints(selectionType, families); @@ -16175,7 +15551,7 @@ class SerieBox extends Serie { setStyle(style, selectionType = 'unselected') { //console.log( style, selectionType ); - this.styles[selectionType] = extend({}, this.default().defaultStyle, this.styles.unselected, style); + this.styles[selectionType] = extend$1({}, this.default().defaultStyle, this.styles.unselected, style); this.styleHasChanged(selectionType); } @@ -18505,7 +17881,7 @@ class SerieDensityMap extends Serie { * @memberof SerieDensityMap */ setOptions(options) { - this.options = extend(true, {}, this.defaults(), options || {}); + this.options = extend$1(true, {}, this.defaults(), options || {}); // Unselected style return this; @@ -21254,20 +20630,20 @@ class ShapeLine extends Shape { } if (this.moving) { - + console.log(this._data); // If the pos2 is defined by a delta, no need to move them - if (pos.x) { + if (pos.x && !this._data.noX) { pos.deltaPosition('x', deltaX, this.getXAxis()); } - if (pos.y) { + if (pos.y && !this._data.noY) { pos.deltaPosition('y', deltaY, this.getYAxis()); } // If the pos2 is defined by a delta, no need to move them - if (pos2.x) { + if (pos2.x && !this._data.noX) { pos2.deltaPosition('x', deltaX, this.getXAxis()); } - if (pos2.y) { + if (pos2.y && !this._data.noY) { pos2.deltaPosition('y', deltaY, this.getYAxis()); } } @@ -21777,7 +21153,7 @@ class ShapeNMRIntegral extends Shape { } this.setHandles();*/ - this.ratioLabel && this.updateIntegralValue(this.ratioLabel) || this.updateLabels(); + this.serie.ratioLabel && this.updateIntegralValue(this.serie.ratioLabel) || this.updateLabels(); this.changed(); this.handleCondition = !this.xor(incrementation == -1, flipped); @@ -21788,19 +21164,19 @@ class ShapeNMRIntegral extends Shape { return true; } - updateIntegralValue(ratioLabel = this.ratioLabel, forceValue) { - + updateIntegralValue(ratioLabel = this.serie.ratioLabel, forceValue) { + console.log(ratioLabel); if (ratioLabel) { - this.ratioLabel = ratioLabel; + this.serie.ratioLabel = ratioLabel; } - if (forceValue !== undefined) { - this.ratioLabel = forceValue / this.sumVal; + if (!isNaN(forceValue) && !isNaN(this.sumVal) && this.sumVal) { + this.serie.ratioLabel = forceValue / this.sumVal; } this.setLabelText(ratioLabel ? (Math.round(100 * this.sumVal * ratioLabel) / 100).toPrecision(3) : 'N/A', 0); this.updateLabels(); - return this.ratioLabel; + return this.serie.ratioLabel; } getAxis() { @@ -21979,7 +21355,7 @@ class ShapeRectangle extends Shape { case 'sides': - extend(handles, { + extend$1(handles, { sides: { top: true, bottom: true, @@ -23078,7 +22454,7 @@ class PluginShape extends Plugin { let shapeProperties = this.options.properties; - extend(true, shapeInfo, this.options); + extend$1(true, shapeInfo, this.options); this.emit('beforeNewShape', e, shapeInfo); @@ -25001,7 +24377,7 @@ class PluginAxisSplitting extends Plugin { marginMin: this.options.axes.margins.low, marginMax: this.options.axes.margins.high }; - return extend(true, defaults, options); + return extend$1(true, defaults, options); } preDraw() { @@ -25175,7 +24551,7 @@ var SplitAxis = function (mixin) { super(graph, position, options); this.axes = []; this.position = position; - this.constructorOptions = extend(true, {}, defaultAxisConstructorOptions, options); + this.constructorOptions = extend$1(true, {}, defaultAxisConstructorOptions, options); this._splitVal = []; } diff --git a/dist/jsgraph-module.js.map b/dist/jsgraph-module.js.map index 7e6387996..21c80873d 100644 --- a/dist/jsgraph-module.js.map +++ b/dist/jsgraph-module.js.map @@ -1 +1 @@ -{"version":3,"file":null,"sources":["/Users/normanpellet/Documents/Web/graph/src/graph.position.js","/Users/normanpellet/Documents/Web/graph/src/graph.util.js","/Users/normanpellet/Documents/Web/graph/src/dependencies/eventEmitter/EventEmitter.js","/Users/normanpellet/Documents/Web/graph/src/util/fit_lm.js","/Users/normanpellet/Documents/Web/graph/src/util/data_aggregator.js","/Users/normanpellet/Documents/Web/graph/src/util/waveform.js","/Users/normanpellet/Documents/Web/graph/src/graph.core.js","/Users/normanpellet/Documents/Web/graph/src/graph.legend.js","/Users/normanpellet/Documents/Web/graph/src/graph.axis.js","/Users/normanpellet/Documents/Web/graph/src/graph.axis.x.js","/Users/normanpellet/Documents/Web/graph/src/graph.axis.y.js","/Users/normanpellet/Documents/Web/graph/src/graph.axis.x.bar.js","/Users/normanpellet/Documents/Web/graph/src/graph.axis.x.time.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.js","/Users/normanpellet/Documents/Web/graph/src/mixins/graph.mixin.errorbars.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.line.js","/Users/normanpellet/Documents/Web/graph/src/mixins/graph.mixin.serie3d.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.line.3d.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.bar.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.box.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.line.colored.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.scatter.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.zone.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.zone.3d.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.densitymap.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.contour.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.areaundercurve.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.line.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.arrow.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.ellipse.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.label.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.polyline.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.nmrintegral.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.rect.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.peakintegration2d.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.cross.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.peakboundariescenter.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.html.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.drag.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.shape.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.selectScatter.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.zoom.js","/Users/normanpellet/Documents/Web/graph/src/graph.lru.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.timeseriemanager.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.serielinedifference.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.axissplitting.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.makeTracesDifferent.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.peakpicking.js","/Users/normanpellet/Documents/Web/graph/src/graph.js"],"sourcesContent":["function _parsePx( px ) {\n if ( px && px.indexOf && px.indexOf( 'px' ) > -1 ) {\n return parseInt( px.replace( 'px', '' ) );\n }\n return false;\n}\n\nfunction isNumeric( n ) {\n return !isNaN( parseFloat( n ) ) && isFinite( n );\n}\n\n/**\n * Utility class to compute positioning\n * @class\n */\nclass Position {\n\n constructor( x, y, dx, dy ) {\n\n if ( typeof x == 'object' ) {\n this.x = x.x;\n this.y = x.y;\n this.dx = x.dx;\n this.dy = x.dy;\n } else {\n this.x = x;\n this.y = y;\n this.dx = dx;\n this.dy = dy;\n }\n }\n\n duplicate() {\n return new Position( this.x, this.y, this.dx, this.dy );\n }\n\n /**\n * Computes the position of the position\n * @param {Graph} graph - The graph for which the position has to be computed\n * @param {AxisX} xAxis - The x axis to consider (has to belong to the graph)\n * @param {AxisY} yAxis - The y axis to consider (has to belong to the graph)\n * @param {Serie} [serie] - For non-existing y value, use a serie to compute it automatically from the serie data\n * @return {Object} An object in the format ```{x: xPx, y: yPx}``` containing the position in pixels of the position\n */\n compute( graph, xAxis, yAxis, serie ) {\n\n if ( !graph || !xAxis || !yAxis || !graph.hasXAxis || !graph.hasYAxis ) {\n graph.throw();\n }\n\n if ( !graph.hasXAxis( xAxis ) ) {\n throw ( 'Graph does not contain the x axis that was used as a parameter' );\n }\n\n if ( !graph.hasYAxis( yAxis ) ) {\n throw ( 'Graph does not contain the x axis that was used as a parameter' );\n }\n\n return this._compute( graph, xAxis, yAxis, serie );\n }\n\n _compute( graph, xAxis, yAxis, serie ) {\n\n var relativeTo = this._relativeTo;\n if ( relativeTo ) {\n var relativeToComputed = relativeTo._compute( graph, xAxis, yAxis, serie );\n }\n\n var parsed,\n pos = {\n x: false,\n y: false\n };\n\n if ( !xAxis ) {\n xAxis = graph.getXAxis();\n }\n\n if ( !yAxis ) {\n yAxis = graph.getYAxis();\n }\n\n for ( var i in pos ) {\n\n var axis = i == 'x' ? xAxis : yAxis;\n var val = this[ i ];\n var dval = this[ 'd' + i ];\n\n if ( val === undefined && ( ( dval !== undefined && relativeTo === undefined ) || relativeTo === undefined ) ) {\n\n if ( i == 'x' ) {\n\n if ( dval === undefined ) {\n continue;\n }\n\n pos[ i ] = relativeTo ? relativeTo[ i ] : 0;\n\n } else if ( this.x !== undefined && serie ) {\n\n if ( _parsePx( this.x ) !== false ) {\n console.warn( 'You have defined x in px and not y. Makes no sense. Returning 0 for y' );\n pos[ i ] = 0;\n } else {\n\n var closest = serie.searchClosestValue( this.x );\n\n if ( !closest ) {\n console.warn( 'Could not find y position for x = ' + ( this.x ) + ' on serie \"' + serie.getName() + '\". Returning 0 for y.' );\n pos[ i ] = 0;\n } else {\n pos[ i ] = serie.getY( closest.yMin );\n }\n }\n }\n\n } else if ( val !== undefined ) {\n\n pos[ i ] = this.getPx( val, axis );\n }\n\n if ( dval !== undefined ) {\n\n var def = ( val !== undefined || relativeToComputed == undefined || relativeToComputed[ i ] == undefined ) ? pos[ i ] : ( relativeToComputed[ i ] );\n\n if ( i == 'y' && relativeToComputed && relativeToComputed.x !== undefined && relativeToComputed.y == undefined ) {\n\n if ( !serie ) {\n throw 'Error. No serie exists. Cannot find y value';\n return;\n }\n\n var closest = serie.searchClosestValue( relativeTo.x );\n if ( closest ) {\n def = serie.getY( closest.yMin );\n }\n\n //console.log( relativeTo.x, closest, serie.getY( closest.yMin ), def );\n }\n\n if ( !def ) {\n def = 0;\n }\n\n if ( ( parsed = _parsePx( dval ) ) !== false ) { // dx in px => val + 10px\n\n pos[ i ] = def + parsed; // return integer (will be interpreted as px)\n\n } else if ( ( parsed = this._parsePercent( dval ) ) !== false ) {\n\n pos[ i ] = def + this._getPositionPx( parsed, true, axis, graph ); // returns xx%\n\n } else if ( axis ) {\n\n pos[ i ] = def + axis.getRelPx( dval ); // px + unittopx\n\n }\n }\n }\n\n return pos;\n }\n\n _getPositionPx( value, x, axis, graph ) {\n\n var parsed;\n\n if ( ( parsed = _parsePx( value ) ) !== false ) {\n return parsed; // return integer (will be interpreted as px)\n }\n\n if ( ( parsed = this._parsePercent( value ) ) !== false ) {\n return parsed / 100 * ( x ? graph.getDrawingWidth() : graph.getDrawingHeight() );\n } else if ( axis ) {\n return axis.getPos( value );\n }\n }\n\n _parsePercent( percent ) {\n if ( percent && percent.indexOf && percent.indexOf( '%' ) > -1 ) {\n return percent;\n }\n return false;\n }\n\n /**\n * Computes the value in pixels of an amplitude (or a distance) for a certain axis\n * @param {Number} value - The value in axis unit\n * @param {Axis} Axis - The x axis to consider (has to belong to the graph)\n * @return {String} The value in pixels, e.g. \"20px\"\n */\n getDeltaPx( value, axis ) {\n var v;\n if ( ( v = _parsePx( value ) ) !== false ) {\n return ( v ) + 'px';\n } else {\n\n return ( axis.getRelPx( value ) ) + 'px';\n }\n }\n\n deltaPosition( mode, delta, axis ) {\n\n mode = mode == 'y' ? 'y' : 'x';\n var ref = this[ mode ],\n refd = this[ 'd' + mode ],\n refPx,\n deltaPx;\n\n if ( ref !== undefined ) {\n if ( ( refPx = _parsePx( ref ) ) !== false ) {\n\n if ( ( deltaPx = _parsePx( delta ) ) !== false ) {\n this[ mode ] = ( refPx + deltaPx ) + 'px';\n } else {\n this[ mode ] = ( refPx + axis.getRelPx( delta ) ) + 'px';\n }\n } else {\n\n ref = this.getValPosition( ref, axis );\n\n if ( ( deltaPx = _parsePx( delta ) ) !== false ) {\n this[ mode ] = ( ref + axis.getRelVal( deltaPx ) );\n } else {\n this[ mode ] = ( ref + delta );\n }\n }\n } else if ( refd !== undefined ) {\n\n if ( mode == 'y' && ref === undefined && !this._relativeTo ) { // This means that the shape is placed by the x value. Therefore, the dy is only a stand-off.\n // Therefore, we do nothing\n return;\n }\n\n if ( ( refPx = _parsePx( refd ) ) !== false ) {\n\n if ( ( deltaPx = _parsePx( delta ) ) !== false ) {\n this[ 'd' + mode ] = ( refPx + deltaPx ) + 'px';\n } else {\n this[ 'd' + mode ] = ( refPx + axis.getRelPx( delta ) ) + 'px';\n }\n } else {\n\n refd = this.getValPosition( refd, axis );\n\n if ( ( deltaPx = _parsePx( delta ) ) !== false ) {\n this[ 'd' + mode ] = ( refd + axis.getRelVal( deltaPx ) );\n } else {\n this[ 'd' + mode ] = ( refd + delta );\n }\n }\n\n }\n }\n\n getValPosition( rel, axis ) {\n\n if ( rel == 'max' ) {\n return axis.getMaxValue();\n }\n\n if ( rel == 'min' ) {\n return axis.getMinValue();\n }\n\n return rel;\n }\n\n /**\n * Computes a value in pixels\n * @param {Number} value - The value in axis unit\n * @param {Axis} axis - The x or y axis to consider (has to belong to the graph)\n * @param {Boolean} rel - Whether or not the value is a distance\n * @return {(Number|String)} The computed value\n */\n getPx( value, axis, rel ) {\n\n var parsed;\n\n if ( typeof value == 'function' ) {\n\n return value( axis, rel );\n\n } else if ( ( parsed = _parsePx( value ) ) !== false ) {\n\n return parsed; // return integer (will be interpreted as px)\n\n } else if ( ( parsed = this._parsePercent( value ) ) !== false ) {\n\n return parsed; // returns xx%\n\n } else if ( axis ) {\n\n if ( value == 'min' ) {\n\n return axis.getMinPx();\n\n } else if ( value == 'max' ) {\n\n return axis.getMaxPx();\n\n } else if ( rel ) {\n\n return axis.getRelPx( value );\n\n } else if ( isNumeric( value ) ) {\n\n return axis.getPos( value );\n }\n }\n }\n\n getPxRel( value, axis ) {\n return this.getPx( value, axis, true );\n }\n\n /**\n * Assigns the current position as relative to another. This is used when a position is used with \"dx\" or \"dy\" and not \"x\" or \"y\"\n * @param {Position} pos - The reference position\n * @return {Position} The current position\n */\n relativeTo( pos ) {\n this._relativeTo = Position.check( pos );\n return this;\n }\n\n /**\n * Checks if an object is a position. If not, creates a new Position instance with the ```pos``` object. If a new position is created, ```callback``` is fired with the position as a unique parameter. The return of the function, if not false, should be a ```Position``` instance which serves as the reference position.\n * @example Position.check( { x: 1, y: 2 }, function() { return someOtherPosition; } );\n * @param {(Object|Position)} pos - The position object or the object fed into the constructor\n * @param {Function} callback - The callback fired if a new position is created\n * @return {Position} The resulting position object\n */\n static check( pos, callback ) {\n if ( pos instanceof Position ) {\n return pos;\n }\n\n var posObject = new Position( pos );\n\n if ( pos && pos.relativeTo ) {\n const position = callback( pos.relativeTo );\n if ( position ) {\n posObject.relativeTo( position );\n }\n }\n\n return posObject;\n }\n}\n\nexport default Position;","/**\n * Easy set attribute method to apply to a SVG Element the attributes listed. Optional namespacing\n * @param {SVGElement} to - The SVG element to apply the attributes to\n * @param {Object} attr - A key/value hashmap of attributes\n * @param {String} [ ns = undefined ] - The namespace to use (with setAttributeNS). Default if without namespacing\n */\nexport function setAttributeTo( to, params, ns ) {\n var i;\n\n if ( ns ) {\n for ( i in params ) {\n to.setAttributeNS( ns, i, params[ i ] );\n }\n } else {\n for ( i in params ) {\n to.setAttribute( i, params[ i ] );\n }\n }\n}\n\n/**\n * Maps old-style events defined within the creation (i.e. { onMouseOver: function() }) to modern event listening .on(\"mouseover\")\n * The function will read any object and select the ones starting with \"on\"\n * @params {Object} options - An option object to read the events from\n * @param {Object} source - The source object to which the options belong\n * @example util.mapEventEmission( this.options, this );\n */\nexport function mapEventEmission( options, source ) {\n\n if ( !source ) {\n source = this;\n }\n\n var eventName;\n\n for ( var i in options ) {\n\n // Starts with onXXX\n if ( i.indexOf( 'on' ) == 0 && typeof options[ i ] == 'function' ) {\n eventName = i.substring( 2 );\n eventName = eventName.substring( 0, 1 ).toLowerCase() + eventName.substring( 1 );\n\n if ( source.on ) {\n\n ( function( j ) {\n\n source.on( eventName, function() {\n options[ j ].apply( source, arguments );\n } );\n\n } )( i );\n\n }\n }\n }\n}\n\n/**\n * @link http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript\n * @return {String} a random id\n */\nexport function guid() {\n //\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace( /[xy]/g, function( c ) {\n var r = Math.random() * 16 | 0,\n v = c == 'x' ? r : ( r & 0x3 | 0x8 );\n return v.toString( 16 );\n } );\n\n}\n\nexport function throwError( message ) {\n console.error( message );\n}\n\nexport function warn( message ) {\n console.warn( message );\n}\n\n/**\n * Checks if a variable is a numeric or not\n * @return {Boolean} true for a numeric value, false otherwise\n */\nexport function isNumeric( obj ) {\n return !Array.isArray( obj ) && ( obj - parseFloat( obj ) + 1 ) >= 0;\n}\n\n/**\n * @see http://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion\n * Converts an HSL color value to RGB. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSL_color_space.\n * Assumes h, s, and l are contained in the set [0, 1] and\n * returns r, g, and b in the set [0, 255].\n *\n * @param Number h The hue\n * @param Number s The saturation\n * @param Number l The lightness\n * @return Array The RGB representation\n */\nexport function hue2rgb( p, q, t ) {\n if ( t < 0 ) t += 1;\n if ( t > 1 ) t -= 1;\n if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;\n if ( t < 1 / 2 ) return q;\n if ( t < 2 / 3 ) return p + ( q - p ) * ( 2 / 3 - t ) * 6;\n return p;\n}\n\nexport function hslToRgb( h, s, l ) {\n var r, g, b;\n\n if ( s == 0 ) {\n r = g = b = l; // achromatic\n } else {\n\n var q = l < 0.5 ? l * ( 1 + s ) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb( p, q, h + 1 / 3 );\n g = hue2rgb( p, q, h );\n b = hue2rgb( p, q, h - 1 / 3 );\n }\n\n return [ Math.round( r * 255 ), Math.round( g * 255 ), Math.round( b * 255 ) ];\n}\n\nexport function saveDomAttributes( to, attributes, identification ) {\n\n if ( !to ) return;\n\n to._savedAttributesIds = to._savedAttributesIds || [];\n\n if ( to._savedAttributesIds.indexOf( identification ) > -1 ) {\n restoreDomAttributes( to, identification );\n }\n\n to._savedAttributes = to._savedAttributes || {};\n to._attributes = to._attributes || {};\n to._attributes[ identification ] = attributes;\n\n to._savedAttributesIds.push( identification );\n\n for ( var i in attributes ) {\n\n if ( !to._savedAttributes[ i ] ) {\n to._savedAttributes[ i ] = to.getAttribute( i );\n }\n\n to.setAttribute( i, attributes[ i ] );\n }\n\n}\n\nexport function hasSavedAttribute( dom, attr ) {\n return dom._savedAttributes && dom._savedAttributes[ attr ] !== undefined;\n}\n\nexport function overwriteDomAttribute( dom, attribute, newValue ) {\n if ( hasSavedAttribute( dom, attribute ) ) {\n dom._savedAttributes[ attribute ] = newValue;\n }\n}\n\nexport function restoreDomAttributes( to, identification ) {\n\n if ( !to || !to._savedAttributesIds ) {\n return;\n }\n\n to._savedAttributesIds.splice( to._savedAttributesIds.indexOf( identification ), 1 );\n delete to._attributes[ identification ];\n\n var attrs = {};\n\n for ( var i in to._savedAttributes ) {\n attrs[ i ] = to._savedAttributes[ i ];\n }\n\n for ( var i = 0, l = to._savedAttributesIds.length; i < l; i++ ) {\n\n for ( var j in to._attributes[ to._savedAttributesIds[ i ] ] ) {\n attrs[ j ] = to._attributes[ to._savedAttributesIds[ i ] ][ j ];\n }\n }\n\n for ( var j in attrs ) {\n to.setAttribute( j, attrs[ j ] );\n }\n\n}\n\n// https://davidwalsh.name/function-debounce\nexport function debounce( func, wait, immediate ) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n var later = function() {\n timeout = null;\n if ( !immediate ) func.apply( context, args );\n };\n var callNow = immediate && !timeout;\n clearTimeout( timeout );\n timeout = setTimeout( later, wait );\n if ( callNow ) func.apply( context, args );\n };\n}\n\nexport function SVGParser( svgString ) {\n\n var parser = new DOMParser();\n var doc = parser.parseFromString( svgString, 'image/svg+xml' );\n // returns a SVGDocument, which also is a Document.\n\n return doc;\n\n}\n\n// http://stackoverflow.com/questions/5276953/what-is-the-most-efficient-way-to-reverse-an-array-in-javascript\nexport function reverseArray( array ) {\n var left = null;\n var right = null;\n var length = array.length;\n for ( left = 0, right = length - 1; left < right; left += 1, right -= 1 ) {\n var temporary = array[ left ];\n array[ left ] = array[ right ];\n array[ right ] = temporary;\n }\n return array;\n}\n\n// jQuery.fn.offset\nexport function getOffset( el ) {\n var rect = el.getBoundingClientRect();\n return {\n top: rect.top,\n left: rect.left\n };\n}\n\n// jQuery.fn.css\nexport function setCSS( element, values ) {\n var style = element.style;\n for ( var i in values ) {\n style[ i ] = values[ i ];\n }\n}\n\nexport function ajaxGet( options ) {\n return new Promise( function( resolve, reject ) {\n var request = new XMLHttpRequest();\n request.open( options.type || 'GET', options.url, true );\n if ( options.json ) request.setRequestHeader( 'Accept', 'application/json' );\n request.onload = function() {\n if ( request.status === 200 ) {\n var response = request.responseText;\n if ( options.json ) response = JSON.parse( response );\n resolve( response );\n } else {\n reject( new Error( 'Request error: ' + request.status ) );\n }\n };\n request.onerror = function() {\n reject( new Error( 'Network error: ' + request.status ) );\n };\n request.send();\n } );\n}\n\n// https://raw.githubusercontent.com/justmoon/node-extend/888f153645115d1c6aa9a7e346e8e9cd9a83de9b/index.js\n// Copyright (c) 2014 Stefan Thomas\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\n\nvar isArray = function isArray( arr ) {\n if ( typeof Array.isArray === 'function' ) {\n return Array.isArray( arr );\n }\n\n return toStr.call( arr ) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject( obj ) {\n if ( !obj || toStr.call( obj ) !== '[object Object]' ) {\n return false;\n }\n\n var hasOwnConstructor = hasOwn.call( obj, 'constructor' );\n var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call( obj.constructor.prototype, 'isPrototypeOf' );\n // Not own constructor property must be Object\n if ( obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf ) {\n return false;\n }\n\n // Own properties are enumerated firstly, so to speed up,\n // if last one is own, then all properties are own.\n var key;\n for ( key in obj ) { /**/ }\n\n return typeof key === 'undefined' || hasOwn.call( obj, key );\n};\n\nexport function extend() {\n var options, name, src, copy, copyIsArray, clone;\n var target = arguments[ 0 ];\n var i = 1;\n var length = arguments.length;\n var deep = false;\n\n // Handle a deep copy situation\n if ( typeof target === 'boolean' ) {\n deep = target;\n target = arguments[ 1 ] || {};\n // skip the boolean and the target\n i = 2;\n } else if ( ( typeof target !== 'object' && typeof target !== 'function' ) || target == null ) {\n target = {};\n }\n\n for ( ; i < length; ++i ) {\n options = arguments[ i ];\n // Only deal with non-null/undefined values\n if ( options != null ) {\n // Extend the base object\n for ( name in options ) {\n src = target[ name ];\n copy = options[ name ];\n\n // Prevent never-ending loop\n if ( target !== copy ) {\n // Recurse if we're merging plain objects or arrays\n if ( deep && copy && ( isPlainObject( copy ) || ( copyIsArray = isArray( copy ) ) ) ) {\n if ( copyIsArray ) {\n copyIsArray = false;\n clone = src && isArray( src ) ? src : [];\n } else {\n clone = src && isPlainObject( src ) ? src : {};\n }\n\n // Never move original objects, clone them\n target[ name ] = extend( deep, clone, copy );\n\n // Don't bring in undefined values\n } else if ( typeof copy !== 'undefined' ) {\n target[ name ] = copy;\n }\n }\n }\n }\n }\n\n // Return the modified object\n return target;\n}\n\nexport default {};\n\nexport {\n isArray\n};\nexport {\n isPlainObject\n};\n\nexport function mix( baseClass, mixin ) {\n\n for ( let prop in mixin ) {\n\n if ( mixin.hasOwnProperty( prop ) ) {\n baseClass.prototype[ prop ] = mixin[ prop ];\n }\n }\n}\n\nexport function emptyDom( dom ) {\n while ( dom.firstChild ) {\n dom.removeChild( dom.firstChild );\n }\n}","/*!\n * EventEmitter v4.2.9 - git.io/ee\n * Oliver Caldwell\n * MIT license\n * @preserve\n */\n\n'use strict';\n\n/**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\nfunction EventEmitter() {}\n\n// Shortcuts to improve speed and size\nvar proto = EventEmitter.prototype;\n\n/**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\nfunction indexOfListener( listeners, listener ) {\n var i = listeners.length;\n while ( i-- ) {\n if ( listeners[ i ].listener === listener ) {\n return i;\n }\n }\n\n return -1;\n}\n\n/**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\nfunction alias( name ) {\n return function aliasClosure() {\n return this[ name ].apply( this, arguments );\n };\n}\n\n/**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\nproto.getListeners = function getListeners( evt ) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if ( evt instanceof RegExp ) {\n response = {};\n for ( key in events ) {\n if ( events.hasOwnProperty( key ) && evt.test( key ) ) {\n response[ key ] = events[ key ];\n }\n }\n } else {\n response = events[ evt ] || ( events[ evt ] = [] );\n }\n\n return response;\n};\n\n/**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\nproto.flattenListeners = function flattenListeners( listeners ) {\n var flatListeners = [];\n var i;\n\n for ( i = 0; i < listeners.length; i += 1 ) {\n flatListeners.push( listeners[ i ].listener );\n }\n\n return flatListeners;\n};\n\n/**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\nproto.getListenersAsObject = function getListenersAsObject( evt ) {\n var listeners = this.getListeners( evt );\n var response;\n\n if ( listeners instanceof Array ) {\n response = {};\n response[ evt ] = listeners;\n }\n\n return response || listeners;\n};\n\n/**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.addListener = function addListener( evt, listener ) {\n var listeners = this.getListenersAsObject( evt );\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for ( key in listeners ) {\n if ( listeners.hasOwnProperty( key ) && indexOfListener( listeners[ key ], listener ) === -1 ) {\n listeners[ key ].push( listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n } );\n }\n }\n\n return this;\n};\n\n/**\n * Alias of addListener\n */\nproto.on = alias( 'addListener' );\n\n/**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.addOnceListener = function addOnceListener( evt, listener ) {\n return this.addListener( evt, {\n listener: listener,\n once: true\n } );\n};\n\n/**\n * Alias of addOnceListener.\n */\nproto.once = alias( 'addOnceListener' );\n\n/**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.defineEvent = function defineEvent( evt ) {\n this.getListeners( evt );\n return this;\n};\n\n/**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.defineEvents = function defineEvents( evts ) {\n for ( var i = 0; i < evts.length; i += 1 ) {\n this.defineEvent( evts[ i ] );\n }\n return this;\n};\n\n/**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.removeListener = function removeListener( evt, listener ) {\n var listeners = this.getListenersAsObject( evt );\n var index;\n var key;\n\n for ( key in listeners ) {\n if ( listeners.hasOwnProperty( key ) ) {\n index = indexOfListener( listeners[ key ], listener );\n\n if ( index !== -1 ) {\n listeners[ key ].splice( index, 1 );\n }\n }\n }\n\n return this;\n};\n\n/**\n * Alias of removeListener\n */\nproto.off = alias( 'removeListener' );\n\n/**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.addListeners = function addListeners( evt, listeners ) {\n // Pass through to manipulateListeners\n return this.manipulateListeners( false, evt, listeners );\n};\n\n/**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.removeListeners = function removeListeners( evt, listeners ) {\n // Pass through to manipulateListeners\n return this.manipulateListeners( true, evt, listeners );\n};\n\n/**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.manipulateListeners = function manipulateListeners( remove, evt, listeners ) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if ( typeof evt === 'object' && !( evt instanceof RegExp ) ) {\n for ( i in evt ) {\n if ( evt.hasOwnProperty( i ) && ( value = evt[ i ] ) ) {\n // Pass the single listener straight through to the singular method\n if ( typeof value === 'function' ) {\n single.call( this, i, value );\n } else {\n // Otherwise pass back to the multiple function\n multiple.call( this, i, value );\n }\n }\n }\n } else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while ( i-- ) {\n single.call( this, evt, listeners[ i ] );\n }\n }\n\n return this;\n};\n\n/**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.removeEvent = function removeEvent( evt ) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if ( type === 'string' ) {\n // Remove all listeners for the specified event\n delete events[ evt ];\n } else if ( evt instanceof RegExp ) {\n // Remove all events matching the regex.\n for ( key in events ) {\n if ( events.hasOwnProperty( key ) && evt.test( key ) ) {\n delete events[ key ];\n }\n }\n } else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n};\n\n/**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\nproto.removeAllListeners = alias( 'removeEvent' );\n\n/**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.emitEvent = function emitEvent( evt, args ) {\n var listeners = this.getListenersAsObject( evt );\n var listener;\n var i;\n var key;\n var response;\n\n for ( key in listeners ) {\n if ( listeners.hasOwnProperty( key ) ) {\n i = listeners[ key ].length;\n\n while ( i-- ) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[ key ][ i ];\n\n if ( listener.once === true ) {\n this.removeListener( evt, listener.listener );\n }\n\n response = listener.listener.apply( this, args || [] );\n\n if ( response === this._getOnceReturnValue() ) {\n this.removeListener( evt, listener.listener );\n }\n }\n }\n }\n\n return this;\n};\n\n/**\n * Alias of emitEvent\n */\nproto.trigger = alias( 'emitEvent' );\n\n/**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.emit = function emit( evt ) {\n var args = Array.prototype.slice.call( arguments, 1 );\n return this.emitEvent( evt, args );\n};\n\n/**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.setOnceReturnValue = function setOnceReturnValue( value ) {\n this._onceReturnValue = value;\n return this;\n};\n\n/**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\nproto._getOnceReturnValue = function _getOnceReturnValue() {\n if ( this.hasOwnProperty( '_onceReturnValue' ) ) {\n return this._onceReturnValue;\n } else {\n return true;\n }\n};\n\n/**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\nproto._getEvents = function _getEvents() {\n return this._events || ( this._events = {} );\n};\n\nexport default EventEmitter;","class FitHost {\n\n constructor( options ) {\n\n this.DELTAP = 1e-6;\n this.BIGVAL = 9e99;\n this.WEIGHT = 1.0;\n\n this.setYData( options.dataY );\n this.setXData( options.dataX );\n this.setWeight( options.weight );\n this.setInitialParams( options.params );\n\n if ( options.subsetIndex ) {\n this.setSubset( ...options.subsetIndex );\n }\n\n this.setFunction( options.function );\n\n if ( options.progress ) {\n this.hookIteration( options.progress );\n }\n\n this.options = options;\n }\n\n //[ [ x1, y1 ], [ x2, y2 ] ]\n setYData( data ) { // Waveform instance\n this.data = data;\n }\n\n setXData( data ) { // Waveform instance\n this.dataX = data;\n }\n\n setWeight( weight ) { // Waveform instance\n this.weight = weight;\n }\n\n setInitialParams( params ) {\n this.parms = params;\n\n this.parms = this.parms.map( ( el ) => {\n if ( typeof el == 'function' ) {\n return el( this.data, this.dataX );\n } else {\n return el;\n }\n } );\n this.NPARMS = params.length;\n }\n\n setSubset( fromIndex, toIndex ) {\n if ( fromIndex !== undefined && toIndex !== undefined ) {\n this._from = fromIndex;\n this._to = toIndex;\n }\n }\n\n hookIteration( f ) {\n this._hookIteration = ( params ) => {\n let data = this.buildFit( params, 200 );\n f( data );\n };\n }\n\n setFunction( func ) {\n this._func = func;\n }\n\n init() {\n\n // Get data length\n if ( this._from !== undefined && this._to !== undefined ) {\n\n if ( this._from >= this._to ) {\n throw 'Impossible to fit negative subranges. The starting index must be lower than the ending index';\n }\n\n this.NPTS = this._to - this._from + 1;\n\n if ( this.data && this.data.getLength() <= this._to ) {\n throw 'Wave Y has not enough point to be fitted to subrange [' + this._from + ', ' + this._to + ']';\n }\n\n if ( this._from < 0 ) {\n throw 'Impossible to fit a subrange with negative indices';\n }\n\n } else {\n\n this.NPTS = this.data.getLength();\n this._from = 0;\n this._to = this.data.getLength() - 1;\n }\n\n if ( this.dataX && this.dataX.getLength() <= this._to ) {\n throw 'Wave X has not enough point to be fitted to subrange [' + this._from + ', ' + this._to + ']';\n }\n\n this.arrY = this.data.getDataY();\n\n if ( this.dataX ) {\n this.arrX = this.dataX.getDataY();\n } else {\n this.arrX = this.data.getDataX();\n }\n\n this.resid = new Array( this.NPTS ).fill( 0 );\n this.jac = new Array( this.NPTS ).fill( 0 );\n this.jac = this.jac.map( ( el ) => new Array( this.NPARMS ) );\n }\n\n fit() {\n\n this.log( 'Starting the fit with initial parameter list {' + this.parms.join() + '};' );\n new LM( this, this.NPARMS, this.NPTS, this._hookIteration );\n this.log( 'Fit successful. Output parameters {' + this.parms.join() + '};' );\n\n this._result = this.buildFit( this.parms, 200 );\n\n if ( this.options.done ) {\n this.options.done( this.parms, this._result );\n }\n\n return this._result;\n }\n\n func( x, param ) {\n return this._func( x, param );\n }\n\n computeResiduals() {\n var sumsq = 0;\n for ( var i = 0; i < this.NPTS; i++ ) {\n this.resid[ i ] = ( this.func( this.arrX[ i + this._from ], this.parms ) - this.arrY[ i + this._from ] ) * ( this.WEIGHT );\n sumsq += this.resid[ i ] * this.resid[ i ];\n }\n\n return sumsq;\n }\n\n log( message ) {\n if ( this.options.log ) {\n console.log( message );\n }\n }\n\n //------the four mandated interface methods------------\n nudge( dp ) {\n\n for ( var j = 0; j < this.NPARMS; j++ ) {\n this.parms[ j ] += dp[ j ];\n }\n return this.computeResiduals();\n }\n\n buildJacobian() {\n // Allows LM to compute a new Jacobian.\n // Uses current parms[] and two-sided finite difference.\n // If current parms[] is bad, returns false.\n var delta = new Array( this.NPARMS );\n var FACTOR = 0.5 / this.DELTAP;\n var d = 0;\n\n for ( var j = 0; j < this.NPARMS; j++ ) {\n for ( var k = 0; k < this.NPARMS; k++ )\n delta[ k ] = ( k == j ) ? this.DELTAP : 0.0;\n\n d = this.nudge( delta ); // resid at pplus\n if ( d == this.BIGVAL ) {\n throw 'Bad dBuildJacobian() exit 2';\n }\n\n for ( var i = 0; i < this.NPTS; i++ ) {\n this.jac[ i ][ j ] = this.getResidualElement( i );\n }\n\n for ( var k = 0; k < this.NPARMS; k++ ) {\n delta[ k ] = ( k == j ) ? -2 * this.DELTAP : 0.0;\n }\n\n d = this.nudge( delta ); // resid at pminus\n if ( d == this.BIGVAL ) {\n throw 'Bad dBuildJacobian(). exit 3';\n }\n\n for ( var i = 0; i < this.NPTS; i++ )\n this.jac[ i ][ j ] -= this.getResidualElement( i ); // fetches resid[]\n\n for ( var i = 0; i < this.NPTS; i++ )\n this.jac[ i ][ j ] *= FACTOR;\n\n for ( var k = 0; k < this.NPARMS; k++ )\n delta[ k ] = ( k == j ) ? this.DELTAP : 0.0;\n\n d = this.nudge( delta );\n if ( d == this.BIGVAL ) {\n throw 'Bad dBuildJacobian(). exit 4';\n }\n }\n return true;\n }\n\n getResidualElement( i ) {\n // Allows LM to see one element of the resid[] vector.\n return this.resid[ i ];\n }\n\n getJacobianElement( i, j ) {\n // Allows LM to see one element of the Jacobian matrix.\n return this.jac[ i ][ j ];\n }\n\n buildFit( parms, length ) {\n let x;\n\n if ( !length ) {\n x = this.arrX;\n } else {\n\n const xmin = ( this.dataX ).getMin( this._from, this._to );\n const xmax = ( this.dataX ).getMax( this._from, this._to );\n\n x = new Array( length ).fill( 0 ).map( ( el, index ) => index * ( xmax - xmin ) / ( length - 1 ) + xmin );\n }\n\n var fit = new Array( x.length );\n for ( var i = 0, l = x.length; i < l; i++ ) {\n fit[ i ] = this.func( x[ i ], this.parms );\n }\n\n let waveformResult = this.options.waveform;\n waveformResult.setData( fit, x );\n //waveformResult.setXWaveform( x );\n\n return waveformResult;\n }\n}\n\nclass LM {\n\n constructor( gH, gnadj, gnpnts, hook ) {\n\n this.LMITER = 100; // max number of L-M iterations\n this.LMBOOST = 2.0; // damping increase per failed step\n this.LMSHRINK = 0.10; // damping decrease per successful step\n this.LAMBDAZERO = 0.001; // initial damping\n this.LAMBDAMAX = 1E9; // max damping\n this.LMTOL = 1E-12; // exit tolerance\n this.BIGVAL = 9e99; // trouble flag\n\n this.sos;\n this.sosprev;\n this.lambda;\n\n this.myH = null; // overwritten by constructor\n this.nadj = 0; // overwritten by constructor\n this.npts = 0; // overwritten by constructor\n\n this.delta; // local parm change\n this.beta;\n this.alpha;\n this.amatrix;\n\n // Constructor sets up fields and drives iterations.\n this.myH = gH;\n this.nadj = gnadj;\n this.npts = gnpnts;\n\n this.delta = new Array( this.nadj ).fill( 0 );\n this.beta = new Array( this.nadj ).fill( 0 );\n\n this.alpha = new Array( this.nadj ).fill( 0 );\n this.amatrix = new Array( this.nadj ).fill( 0 );\n\n this.alpha = this.alpha.map( () => new Array( this.nadj ) );\n this.amatrix = this.amatrix.map( () => new Array( this.nadj ) );\n\n this.lambda = this.LAMBDAZERO;\n\n var niter = 0;\n var done = false;\n do {\n done = this.bLMiter();\n\n if ( hook ) {\n hook( this.myH.params );\n }\n\n niter++;\n }\n while ( !done && ( niter < this.LMITER ) );\n }\n\n bLMiter() {\n // Each call performs one LM iteration.\n // Returns true if done with iterations; false=wants more.\n // Global nadj, npts; needs nadj, myH to be preset.\n // Ref: M.Lampton, Computers in Physics v.11 pp.110-115 1997.\n for ( var k = 0; k < this.nadj; k++ )\n this.delta[ k ] = 0.0;\n this.sos = this.myH.nudge( this.delta );\n if ( this.sos == this.BIGVAL ) {\n console.error( ' bLMiter finds faulty initial nudge()' );\n return false;\n }\n this.sosprev = this.sos;\n\n this.myH.log( ' bLMiter..SumOfSquares= ' + this.sos );\n if ( !this.myH.buildJacobian() ) {\n console.error( ' bLMiter finds buildJacobian()=false' );\n return false;\n }\n\n for ( var k = 0; k < this.nadj; k++ ) // get downhill gradient beta\n {\n this.beta[ k ] = 0.0;\n for ( var i = 0; i < this.npts; i++ ) {\n this.beta[ k ] -= this.myH.getResidualElement( i ) * this.myH.getJacobianElement( i, k );\n }\n }\n\n for ( var k = 0; k < this.nadj; k++ ) // get curvature matrix alpha\n for ( var j = 0; j < this.nadj; j++ ) {\n this.alpha[ j ][ k ] = 0.0;\n for ( var i = 0; i < this.npts; i++ ) {\n this.alpha[ j ][ k ] += this.myH.getJacobianElement( i, j ) * this.myH.getJacobianElement( i, k );\n }\n }\n var rrise = 0;\n do // inner damping loop searches for one downhill step\n {\n for ( var k = 0; k < this.nadj; k++ ) { // copy and damp it\n for ( var j = 0; j < this.nadj; j++ ) {\n this.amatrix[ j ][ k ] = this.alpha[ j ][ k ] + ( ( j == k ) ? this.lambda : 0.0 );\n }\n }\n\n this.gaussj( this.amatrix, this.nadj ); // invert\n\n for ( var k = 0; k < this.nadj; k++ ) // compute delta[]\n {\n this.delta[ k ] = 0.0;\n for ( var j = 0; j < this.nadj; j++ )\n this.delta[ k ] += this.amatrix[ j ][ k ] * this.beta[ j ];\n }\n this.sos = this.myH.nudge( this.delta ); // try it out.\n if ( this.sos == this.BIGVAL ) {\n console.error( ' LMinner failed SOS step' );\n return false;\n }\n rrise = ( this.sos - this.sosprev ) / ( 1 + this.sos );\n if ( rrise <= 0.0 ) // good step!\n {\n this.lambda *= this.LMSHRINK; // shrink lambda\n break; // leave lmInner.\n }\n for ( var q = 0; q < this.nadj; q++ ) { // reverse course!\n this.delta[ q ] *= -1.0;\n }\n this.myH.nudge( this.delta ); // sosprev should still be OK\n if ( rrise < this.LMTOL ) { // finished but keep prev parms\n break; // leave inner loop\n }\n this.lambda *= this.LMBOOST; // else try more damping.\n } while ( this.lambda < this.LAMBDAMAX );\n return ( rrise > -this.LMTOL ) || ( this.lambda > this.LAMBDAMAX );\n }\n\n gaussj( a, N ) {\n // Inverts the double array a[N][N] by Gauss-Jordan method\n // M.Lampton UCB SSL (c)2003, 2005\n\n var det = 1.0,\n big, save;\n var i, j, k, L;\n var ik = new Array( 100 );\n var jk = new Array( 100 );\n\n for ( k = 0; k < N; k++ ) {\n big = 0.0;\n for ( i = k; i < N; i++ )\n for ( j = k; j < N; j++ ) // find biggest element\n if ( Math.abs( big ) <= Math.abs( a[ i ][ j ] ) ) {\n big = a[ i ][ j ];\n ik[ k ] = i;\n jk[ k ] = j;\n }\n if ( big == 0.0 ) return 0.0;\n i = ik[ k ];\n if ( i > k )\n for ( j = 0; j < N; j++ ) // exchange rows\n {\n save = a[ k ][ j ];\n a[ k ][ j ] = a[ i ][ j ];\n a[ i ][ j ] = -save;\n }\n j = jk[ k ];\n if ( j > k )\n for ( i = 0; i < N; i++ ) {\n save = a[ i ][ k ];\n a[ i ][ k ] = a[ i ][ j ];\n a[ i ][ j ] = -save;\n }\n for ( i = 0; i < N; i++ ) // build the inverse\n if ( i != k )\n a[ i ][ k ] = -a[ i ][ k ] / big;\n for ( i = 0; i < N; i++ )\n for ( j = 0; j < N; j++ )\n if ( ( i != k ) && ( j != k ) )\n a[ i ][ j ] += a[ i ][ k ] * a[ k ][ j ];\n for ( j = 0; j < N; j++ )\n if ( j != k )\n a[ k ][ j ] /= big;\n a[ k ][ k ] = 1.0 / big;\n det *= big; // bomb point\n } // end k loop\n for ( L = 0; L < N; L++ ) {\n k = N - L - 1;\n j = ik[ k ];\n if ( j > k )\n for ( i = 0; i < N; i++ ) {\n save = a[ i ][ k ];\n a[ i ][ k ] = -a[ i ][ j ];\n a[ i ][ j ] = save;\n }\n i = jk[ k ];\n if ( i > k )\n for ( j = 0; j < N; j++ ) {\n save = a[ k ][ j ];\n a[ k ][ j ] = -a[ i ][ j ];\n a[ i ][ j ] = save;\n }\n }\n return det;\n }\n}\n\nexport default FitHost;\n//module.export = FitHost","var dataAggregator;\n\nif (\n typeof URL === 'undefined' ||\n typeof URL.createObjectURL === 'undefined' ||\n typeof Blob === 'undefined' ||\n typeof Worker === 'undefined'\n) {\n dataAggregator = () => {};\n} else {\n var aggregatorWorker;\n var queue = {};\n\n let string = function() {\n\n onmessage = function( e ) {\n\n const data = e.data.data, // The initial data\n maxX = e.data.maxX,\n minX = e.data.minX,\n maxY = e.data.maxY,\n minY = e.data.minY,\n direction = e.data.direction;\n\n let numPoints = e.data.numPoints; // Total number of points in the slot\n let l = data.length; // Number of data in the original buffer\n let i = 0;\n let k = -4;\n let slots = [];\n let dataAggregatedX = [];\n let dataAggregatedY = [];\n let aggregationSum = [];\n let getX;\n let slotNumber;\n let lastAggregationX;\n let lastAggregation;\n let lastAggregationSum;\n let newAggregation;\n let newAggregationX;\n\n if ( e.data.xdata ) {\n\n getX = function getX( index ) {\n return e.data.xdata[ index ];\n };\n } else {\n getX = function getX( index ) {\n return index * e.data.xScale + e.data.xOffset;\n };\n }\n\n let aggregations = {};\n\n // Direction x\n if ( direction == 'x' ) {\n const dataPerSlot = numPoints / ( maxX - minX ); // Computed number of aggregation per slot\n\n for ( ; i < l; i++ ) {\n\n // dataPerSlot: 1 / 1000 ( compression by 1'000 )\n //console.log( dataPerSlot, getX( i ) );\n slotNumber = Math.floor( ( getX( i ) - minX ) * dataPerSlot );\n\n if ( slots[ k ] !== slotNumber ) {\n k += 4;\n slots[ k ] = slotNumber;\n\n let slotX = ( slotNumber + 0.5 ) / dataPerSlot + minX;\n\n dataAggregatedX[ k ] = slotX;\n dataAggregatedX[ k + 1 ] = slotX;\n dataAggregatedX[ k + 2 ] = slotX;\n dataAggregatedX[ k + 3 ] = slotX;\n\n dataAggregatedY[ k ] = data[ i ];\n dataAggregatedY[ k + 1 ] = data[ i ];\n dataAggregatedY[ k + 2 ] = data[ i ];\n dataAggregatedY[ k + 3 ] = data[ i ];\n aggregationSum[ k ] = 0;\n }\n\n dataAggregatedY[ k + 1 ] = Math.min( data[ i ], dataAggregatedY[ k + 1 ] );\n dataAggregatedY[ k + 2 ] = Math.max( data[ i ], dataAggregatedY[ k + 2 ] );\n dataAggregatedY[ k + 3 ] = data[ i ];\n aggregationSum[ k ] += data[ i ];\n }\n\n } else { // y\n\n const dataPerSlot = numPoints / ( maxY - minY ); // Computed number of aggregation per slot\n\n for ( ; i < l; i++ ) {\n\n // dataPerSlot: 1 / 1000 ( compression by 1'000 )\n //console.log( dataPerSlot, getX( i ) );\n slotNumber = Math.floor( ( data[ i ] - minY ) * dataPerSlot );\n\n if ( slots[ k ] !== slotNumber ) {\n k += 4;\n slots[ k ] = slotNumber;\n\n let slotY = ( slotNumber + 0.5 ) / dataPerSlot + minY;\n\n dataAggregatedY[ k ] = slotY;\n dataAggregatedY[ k + 1 ] = slotY;\n dataAggregatedY[ k + 2 ] = slotY;\n dataAggregatedY[ k + 3 ] = slotY;\n\n dataAggregatedX[ k ] = data[ i ];\n dataAggregatedX[ k + 1 ] = data[ i ];\n dataAggregatedX[ k + 2 ] = data[ i ];\n dataAggregatedX[ k + 3 ] = data[ i ];\n aggregationSum[ k ] = 0;\n\n }\n dataAggregatedX[ k + 1 ] = Math.min( getX( i ), dataAggregatedX[ k + 1 ] );\n dataAggregatedX[ k + 2 ] = Math.max( getX( i ), dataAggregatedX[ k + 2 ] );\n dataAggregatedX[ k + 3 ] = getX( i );\n aggregationSum[ k ] += getX( i );\n }\n\n }\n\n aggregations[ numPoints ] = {\n x: dataAggregatedX,\n y: dataAggregatedY,\n sums: aggregationSum\n };\n\n lastAggregation = dataAggregatedY;\n lastAggregationX = dataAggregatedX;\n lastAggregationSum = aggregationSum;\n\n while ( numPoints > 256 ) {\n\n numPoints /= 2;\n\n newAggregation = [];\n newAggregationX = [];\n\n k = 0;\n\n if ( direction == 'x' ) {\n\n for ( i = 0, l = lastAggregation.length - 8; i < l; i += 8 ) {\n\n newAggregationX[ k ] = ( lastAggregationX[ i ] + lastAggregationX[ i + 4 ] ) / 2;\n newAggregationX[ k + 1 ] = newAggregationX[ k ];\n newAggregationX[ k + 2 ] = newAggregationX[ k ];\n newAggregationX[ k + 3 ] = newAggregationX[ k ];\n\n newAggregation[ k ] = lastAggregation[ i ];\n newAggregation[ k + 1 ] = Math.min( lastAggregation[ i + 1 ], lastAggregation[ i + 5 ] );\n newAggregation[ k + 2 ] = Math.max( lastAggregation[ i + 2 ], lastAggregation[ i + 6 ] );\n newAggregation[ k + 3 ] = lastAggregation[ i + 7 ];\n\n aggregationSum[ k ] = ( lastAggregationSum[ i ] + lastAggregationSum[ i + 4 ] ) / 2;\n\n k += 4;\n }\n } else {\n\n for ( i = 0, l = lastAggregation.length - 8; i < l; i += 8 ) {\n\n newAggregation[ k ] = ( lastAggregation[ i ] + lastAggregation[ i + 4 ] ) / 2;\n newAggregation[ k + 1 ] = newAggregation[ k ];\n newAggregation[ k + 2 ] = newAggregation[ k ];\n newAggregation[ k + 3 ] = newAggregation[ k ];\n\n newAggregationX[ k ] = lastAggregationX[ i ];\n newAggregationX[ k + 1 ] = Math.min( lastAggregationX[ i + 1 ], lastAggregationX[ i + 5 ] );\n newAggregationX[ k + 2 ] = Math.max( lastAggregationX[ i + 2 ], lastAggregationX[ i + 6 ] );\n newAggregationX[ k + 3 ] = lastAggregationX[ i + 7 ];\n\n aggregationSum[ k ] = ( lastAggregationSum[ i ] + lastAggregationSum[ i + 4 ] ) / 2;\n\n k += 4;\n }\n }\n\n aggregations[ numPoints ] = {\n x: newAggregationX,\n y: newAggregation,\n sums: aggregationSum\n };\n\n lastAggregation = newAggregation;\n lastAggregationX = newAggregationX;\n lastAggregationSum = aggregationSum;\n\n aggregationSum = [];\n }\n\n postMessage( {\n aggregates: aggregations,\n _queueId: e.data._queueId\n } );\n };\n\n }.toString();\n\n string = string.replace( /^\\s*function\\s*\\(\\s*\\)\\s*\\{/, '' );\n string = string.replace( /}\\s*$/, '' );\n /*\n if ( typeof URL == \"undefined\" ) {\n module.exports = function() {};\n\n } else {\n */\n\n var workerUrl = URL.createObjectURL( new Blob(\n [ string ], {\n type: 'application/javascript'\n } ) );\n\n aggregatorWorker = new Worker( workerUrl );\n\n aggregatorWorker.onmessage = function( e ) {\n\n var id = e.data._queueId;\n delete e.data._queueId;\n queue[ id ]( e.data );\n delete queue[ id ];\n };\n\n dataAggregator = function( toOptimize ) {\n\n var requestId = Date.now();\n toOptimize._queueId = requestId;\n\n var prom = new Promise( ( resolver ) => {\n queue[ requestId ] = resolver;\n } );\n\n aggregatorWorker.postMessage( toOptimize );\n return prom;\n };\n\n}\n\nexport default dataAggregator;","import FitLM from './fit_lm.js';\nimport aggregator from './data_aggregator.js';\n\nclass Waveform {\n\n constructor( data = [], xOffset = 0, xScale = 1 ) {\n\n this.xOffset = xOffset;\n this.xScale = xScale;\n\n // Error bar handling\n this.errors = {\n\n nb: 0,\n\n bars: {\n above: null,\n below: null\n },\n\n boxes: {\n above: null,\n below: null\n }\n };\n\n this.setData( data );\n\n this.BELOW = Waveform.BELOW;\n this.ABOVE = Waveform.ABOVE;\n this.BOX = Waveform.BOX;\n this.BAR = Waveform.BAR;\n\n }\n\n /** [ [ x1, y1 ], [ x2, y2 ] ] */\n\n /*\n setDataXY( data ) {\n\n let newData = [ this._makeArray( data.length ), this._makeArray( data.length ) ],\n warnNaN = false;\n const nanable = this.isNaNAllowed();\n\n data.map( ( el, index ) => {\n\n if ( !nanable && ( el[ 0 ] !== el[ 0 ] || el[ 1 ] !== el[ 1 ] ) ) {\n warnNaN = true;\n }\n\n newData[ 0 ][ index ] = el[ 0 ];\n newData[ 1 ][ index ] = el[ 1 ];\n } );\n\n if ( warnNaN ) {\n this.warn( \"Trying to assign NaN values to a typed array that does not support NaNs. 0's will be used instead\" );\n }\n\n this._setData( ...newData );\n return this;\n }\n*/\n setData( data, dataX = null ) {\n\n /* First, we must treat the case of the array of array for backward compatibility */\n if ( Array.isArray( data[ 0 ] ) ) {\n let x = [];\n let y = [];\n data.forEach( ( el ) => {\n x.push( el[ 0 ] );\n y.push( el[ 1 ] );\n } );\n\n this.setXWaveform( x );\n data = y;\n }\n\n let newData = this._makeArray( data.length ),\n warnNaN = false;\n\n const nanable = this.isNaNAllowed();\n\n data.map( ( el, index ) => {\n\n if ( !nanable && Number.isNaN( el[ 0 ] ) || Number.isNaN( el[ 1 ] ) ) {\n warnNaN = true;\n }\n\n newData[ index ] = el;\n } );\n\n if ( warnNaN ) {\n this.warn( \"Trying to assign NaN values to a typed array that does not support NaNs. 0's will be used instead\" );\n }\n\n this._setData( newData );\n\n if ( dataX ) {\n this.setXWaveform( dataX );\n }\n return this;\n }\n\n getY( index, optimized = false ) {\n\n if ( optimized && this.dataInUse ) {\n return this.dataInUse.y[ index ] * this.getScale() + this.getShift();\n }\n\n return this.data[ index ] * this.getScale() + this.getShift();\n }\n\n /*\n flipXY() {\n let temp;\n temp = this.data.x;\n this.data.x = this.data.y;\n this.data.y = temp;\n\n this._setData( this.data.x, this.data.y );\n }*/\n\n setXWaveform( waveform ) {\n\n if ( !( waveform instanceof Waveform ) ) {\n\n if ( Array.isArray( waveform ) ) {\n waveform = new Waveform( waveform );\n } else {\n throw 'Cannot set X waveform. Data is not a valid array.';\n }\n }\n\n this.xdata = waveform;\n this.computeXMinMax();\n return this;\n }\n\n hasXWaveform() {\n return !!this.xdata;\n }\n\n getXWaveform() {\n\n if ( this.xdata ) {\n return this.xdata;\n }\n\n let wave = new Waveform(),\n xs = [];\n for ( var i = 0; i < this.getLength(); i += 1 ) {\n xs.push( this.getX( i ) );\n }\n\n wave.setData( xs );\n\n this.xdata = wave;\n return wave;\n }\n\n rescaleX( offset, scale ) {\n this.xScale = scale;\n this.xOffset = offset;\n this.computeXMinMax();\n return this;\n }\n\n getTypedArrayClass() {\n return this._typedArrayClass || false;\n }\n\n setTypedArrayClass( constructor ) {\n\n if ( this.getTypedArrayClass() && this.isNaNAllowed() && !this.isNaNAllowed( constructor ) ) {\n this.warn( 'NaN values are not allowed by the new constructor (' + constructor.name + ') while it was allowed by the previous one (' + this._typedArrayClass.name + ')' );\n }\n\n if ( this.getTypedArrayClass() && this.isUnsigned() && !this.isUnsigned( constructor ) ) {\n this.warn( 'You are switching from signed values to unsigned values. You may experience data corruption if there were some negative values.' );\n }\n\n this._typedArrayClass = constructor;\n\n if ( this.data ) {\n this._setData( ( constructor ).from( this.data ) );\n }\n\n if ( this.hasXWaveform() ) {\n this.getXWaveform().setTypedArrayClass( constructor );\n }\n\n }\n\n isNaNAllowed( constructor = this._typedArrayClass ) {\n\n // The following types accept NaNs\n return constructor == Array ||\n constructor == Float32Array ||\n constructor == Float64Array;\n }\n\n isUnsigned( constructor = this._typedArrayClass ) {\n\n // The following types accept unsigned numbers\n return constructor == Uint8Array ||\n constructor == Uint8ClampedArray ||\n constructor == Uint16Array ||\n constructor == Uint32Array;\n }\n\n recalculateMinMaxNewPoint( x, y ) {\n if ( x < this.minX || this.minX === undefined ) {\n this.minX = x;\n }\n\n if ( x > this.maxX || this.maxX === undefined ) {\n this.maxX = x;\n }\n\n if ( y < this.minY || this.minY === undefined ) {\n this.minY = y;\n }\n\n if ( y > this.maxY || this.maxY === undefined ) {\n this.maxY = y;\n }\n\n }\n\n prepend( x, y ) {\n\n if ( typeof x == 'function' ) {\n x = x( this );\n }\n\n if ( typeof y == 'function' ) {\n y = y( this );\n }\n\n if ( this.xdata ) {\n this.xdata.prepend( null, x );\n } else if ( x !== null ) {\n this.xdata = this.getXWaveform();\n this.xdata.prepend( null, x );\n } else {\n this.xOffset -= this.xScale;\n }\n\n this.data.unshift( y );\n this.recalculateMinMaxNewPoint( x, y );\n return this;\n }\n\n append( x, y ) {\n\n if ( !this.data ) {\n this.data = [];\n }\n\n if ( typeof x == 'function' ) {\n x = x( this );\n }\n\n if ( typeof y == 'function' ) {\n y = y( this );\n }\n\n if ( this.xdata ) {\n this.xdata.append( null, x );\n } else if ( x !== null ) {\n this.xdata = this.getXWaveform();\n this.xdata.append( null, x );\n }\n\n if ( this.monotoneous ) {\n if ( y >= this.data[ this.data.y ] && this.getMonotoneousAscending() === false ) {\n this.monotoneous = false;\n } else if ( y <= this.data[ this.data.y ] && this.getMonotoneousAscending() === true ) {\n this.monotoneous = false;\n }\n }\n\n if ( this.data.length == 1 || this._monotoneousAscending === undefined ) {\n\n this.monotoneous = true;\n\n if ( y == this.data[ 0 ] ) {\n this._monotoneousAscending = undefined;\n } else {\n this._monotoneousAscending = y > this.data[ 0 ];\n }\n }\n\n this.data.push( y );\n this.recalculateMinMaxNewPoint( x, y );\n\n return this;\n }\n\n _makeArray( length ) {\n\n const constructor = this.getTypedArrayClass();\n if ( constructor ) {\n return new( constructor )( length );\n }\n return new Array( length );\n }\n\n _setData( dataY = this.data ) {\n\n const l = dataY.length;\n let i = 1,\n monoDir = dataY[ 1 ] > dataY[ 0 ],\n minY = dataY[ 0 ],\n maxY = dataY[ 0 ];\n\n this._monotoneous = true;\n\n for ( ; i < l; i++ ) {\n if ( dataY[ i ] !== dataY[ i - 1 ] && monoDir !== ( dataY[ i ] > dataY[ i - 1 ] ) ) {\n this._monotoneous = false;\n }\n\n if ( dataY[ i ] === dataY[ i ] ) { // NaN support\n minY = Math.min( dataY[ i ], minY );\n maxY = Math.max( dataY[ i ], maxY );\n }\n }\n\n if ( this._monotoneous ) {\n this._monotoneousAscending = dataY[ 1 ] > dataY[ 0 ];\n }\n\n if ( this.hasErrorBars() ) { // If prefer to loop again here\n\n for ( i = 0; i < l; i++ ) {\n\n if ( dataY[ i ] === dataY[ i ] ) { // NaN support\n\n minY = Math.min( minY, dataY[ i ] - this.getMaxError( i, 'below' ) );\n maxY = Math.max( maxY, dataY[ i ] + this.getMaxError( i, 'above' ) );\n }\n }\n\n this.minY = minY;\n this.maxY = maxY;\n\n } else {\n this.minY = minY;\n this.maxY = maxY;\n }\n\n this.data = dataY;\n\n this.computeXMinMax();\n\n }\n\n computeXMinMax() {\n\n if ( !this.data ) {\n\n return;\n }\n\n if ( !this.xdata ) {\n\n const b1 = this.xOffset + this.xScale * this.getLength(),\n b2 = this.xOffset;\n\n this.minX = Math.min( b1, b2 );\n this.maxX = Math.max( b1, b2 );\n }\n\n }\n\n getDataInUse() {\n return this.dataInUse || this.data;\n }\n\n getIndexFromVal( val, useDataToUse = false, roundingMethod = Math.round ) {\n\n let data;\n\n if ( useDataToUse && this.dataInUse ) {\n data = this.dataInUse.y;\n } else {\n data = this.data;\n }\n\n let position;\n\n position = this.getIndexFromData( val, data, this.data.getMonotoneousAscending(), roundingMethod );\n\n if ( useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateY' ) { // In case of aggregation, round to the closest element of 4.\n return position - ( position % 4 );\n }\n\n return position;\n }\n\n getIndexFromX( xval, useDataToUse = false, roundingMethod = Math.round ) {\n\n let xdata;\n\n if ( useDataToUse && this.dataInUse ) {\n xdata = this.dataInUse.x;\n } else if ( this.xdata ) {\n xdata = this.xdata.data;\n }\n\n let position;\n\n if ( this.hasXWaveform() ) { // The x value HAS to be rescaled\n position = this.xdata.getIndexFromData( xval, xdata, this.xdata.getMonotoneousAscending(), roundingMethod );\n\n } else {\n position = Math.max( 0, Math.min( this.getLength() - 1, roundingMethod( ( xval - this.xOffset ) / ( this.xScale ) ) ) );\n }\n\n if ( useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateX' ) { // In case of aggregation, round to the closest element of 4.\n return position - ( position % 4 );\n }\n\n return position;\n }\n\n getIndexFromXY( xval, yval, useDataToUse = false, roundingMethod = Math.round, scaleX, scaleY ) {\n\n let xdata, ydata;\n\n if ( useDataToUse && this.dataInUse ) {\n\n xdata = this.dataInUse.x;\n ydata = this.dataInUse.y;\n\n } else if ( this.xdata ) {\n\n xdata = this.xdata.data;\n ydata = this.data;\n }\n\n let position;\n\n if ( this.isXMonotoneous() ) { // X lookup only\n\n if ( this.hasXWaveform() ) { // The x value HAS to be rescaled\n position = this.xdata.getIndexFromData( xval, xdata, this.xdata.getMonotoneousAscending(), roundingMethod );\n\n } else {\n position = Math.max( 0, Math.min( this.getLength() - 1, roundingMethod( ( xval - this.xOffset ) / ( this.xScale ) ) ) );\n }\n } else if ( !isNaN( yval ) ) {\n\n position = this.getIndexFromDataXY( xval, xdata, yval, ydata, scaleX, scaleY );\n\n } else {\n return;\n }\n\n if ( useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateX' ) { // In case of aggregation, round to the closest element of 4.\n return position - ( position % 4 );\n }\n\n return position;\n }\n\n getIndexFromData( val, valCollection, isAscending ) {\n\n let data, position;\n\n val -= this.getShift();\n val /= this.getScale();\n\n if ( !this.isMonotoneous() ) {\n console.trace();\n throw 'Impossible to get the index from a non-monotoneous wave !';\n }\n\n return binarySearch( val, valCollection, !isAscending );\n\n }\n\n getIndexFromDataXY( valX, dataX, valY, dataY, scaleX = 1, scaleY = 1 ) {\n\n let data, position;\n\n valX -= this.getXShift();\n valX /= this.getXScale();\n\n valY -= this.getShift();\n valY /= this.getScale();\n\n return euclidianSearch( valX, valY, dataX, dataY, scaleX, scaleY );\n }\n\n getReductionType() {\n return this.dataInUseType;\n }\n\n getXMin() {\n return ( this.xdata ? this.xdata.getMin() : this.minX );\n }\n\n getXMax() {\n return ( this.xdata ? this.xdata.getMax() : this.maxX );\n }\n\n getYMin() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getYMax() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getMin() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getMax() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getMinX() {\n return this.getXMin();\n }\n\n getMaxX() {\n return this.getXMax();\n }\n\n getMinY() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getMaxY() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getDataY() {\n return this.data;\n }\n\n getData( optimized ) {\n if ( !optimized || !this.dataInUse ) {\n return this.data;\n }\n return this.dataInUse.y;\n }\n\n setShift( shift = 0 ) {\n\n // We must update the min and the max of the y data\n //this.minY += ( shift - this.getShift() );\n //this.maxY += ( shift - this.getShift() );\n this.shift = shift;\n return this;\n }\n\n getShift() {\n return this.shift || 0;\n }\n\n getScale() {\n return this.scale || 1;\n }\n\n setScale( scale = 1 ) {\n\n // this.minY = ( this.minY - this.getShift() ) * scale;\n // this.maxY = ( this.maxY - this.getShift() ) * scale;\n this.scale = scale;\n }\n\n setXShift( shift = 0 ) {\n\n if ( !this.hasXWaveform() ) {\n return this;\n }\n\n // We must update the min and the max of the x data\n // That's important for when the data has already been set\n // this.minX += ( shift - this.getXShift() );\n // this.maxX += ( shift - this.getXShift() );\n this.getXWaveform().setShift( shift );\n return this;\n }\n\n getXShift( shift ) {\n\n if ( !this.hasXWaveform ) {\n return 0;\n }\n\n return this.getXWaveform().getShift();\n }\n\n setXScale( scale = 1 ) {\n\n if ( !this.hasXWaveform ) {\n return this;\n }\n\n this.getXWaveform().setScale( scale );\n return this;\n }\n\n getXScale() {\n\n if ( !this.hasXWaveform ) {\n return 1;\n }\n\n return this.getXWaveform().getScale();\n }\n\n getLength() {\n if ( !this.data ) {\n return 0;\n }\n return this.data.length;\n }\n\n getDataToUseFlat() {\n\n let l;\n let j = 0;\n let arr;\n\n if ( this.dataInUse ) {\n\n l = this.dataInUse.x.length;\n arr = new Array( l * 2 ).fill( 0 );\n\n for ( var i = 0; i < l; i += 1 ) {\n arr[ j ] = this.dataInUse.x[ i ];\n arr[ j + 1 ] = this.dataInUse.y[ i ];\n j += 2;\n }\n\n } else {\n\n l = this.getLength();\n arr = new Array( l * 2 ).fill( 0 );\n for ( var i = 0; i < l; i += 1 ) {\n arr[ j + 1 ] = this.data[ i ];\n arr[ j ] = this.getX( i );\n j += 2;\n }\n }\n\n return arr;\n }\n\n fit( options ) {\n\n var self = this;\n\n return new Promise( function( resolver, rejector ) {\n\n var fit = new FitLM( Object.assign( {}, {\n\n dataY: self,\n dataX: self.getXWaveform(),\n done: function( results ) {\n resolver( results );\n },\n waveform: new Waveform()\n\n }, options ) );\n\n fit.init();\n fit.fit();\n } );\n }\n\n getX( index, optimized ) {\n\n if ( optimized && this.dataInUse ) {\n return this.dataInUse.x[ index ] * this.getXScale() + this.getXShift();\n }\n\n if ( this.xdata ) {\n return this.xdata.data[ index ] * this.getXScale() + this.getXShift();\n } else {\n return this.xOffset + index * this.xScale;\n }\n }\n\n getXRaw( index, optimized ) {\n\n if ( optimized && this.dataInUse ) {\n return this.dataInUse.x[ index ];\n }\n\n if ( this.xdata ) {\n return this.xdata.data[ index ];\n } else {\n return index;\n }\n }\n\n _integrateP( from = 0, to = this.getLength() - 1 ) {\n\n from = Math.round( from );\n to = Math.round( to );\n\n if ( from > to ) {\n let temp = from;\n from = to;\n to = temp;\n }\n\n var l = to - from + 1;\n var sum = 0,\n delta;\n\n let deltaTot = 0;\n let diff;\n var arrY = this.getData();\n\n for ( ; from <= to; from++ ) {\n\n if ( arrY.length - 1 > from ) {\n diff = this.getX( from + 1 ) - this.getX( from );\n deltaTot += diff;\n sum += arrY[ from ] * diff;\n }\n }\n\n return [ sum, l, deltaTot ];\n }\n\n integrateP( from, to ) {\n var val = this._integrateP( from, to );\n return val[ 0 ];\n }\n\n integrate( fromX, toX ) {\n return this.integrateP( this.getIndexFromX( fromX ), this.getIndexFromX( toX ) );\n }\n\n average( p0 = 0, p1 = this.getLength() - 1 ) {\n return this.getAverageP( p0, p1 );\n }\n\n mean() {\n return this.average();\n }\n\n getAverageP( from, to ) {\n var sum = this._integrateP( from, to );\n return sum[ 0 ] / sum[ 2 ];\n }\n\n getAverageX( from, to ) {\n var sum = this._integrateX( from, to );\n return sum[ 0 ] / sum[ 2 ];\n }\n\n checkMonotonicity() {\n\n let i = 1,\n data = this.getData();\n const l = this.data.length;\n let dir = data[ 1 ] > data[ 0 ];\n\n for ( ; i < l; i++ ) {\n if ( data[ i ] !== data[ i - 1 ] && dir !== ( data[ i ] > data[ i - 1 ] ) ) {\n return this._monotoneous = false;\n }\n }\n\n this._monotoneousAscending = data[ 1 ] > data[ 0 ];\n return this._monotoneous = true;\n }\n\n requireXMonotonicity() {\n if ( this.xdata ) {\n this.xdata.requireMonotonicity();\n }\n }\n\n requireMonotonicity() {\n if ( !this.isMonotoneous() ) {\n throw 'The wave must be monotonic';\n }\n }\n\n isMonotoneous() {\n return !!this._monotoneous;\n }\n\n isXMonotoneous() {\n if ( this.xdata ) {\n return this.xdata.isMonotoneous();\n }\n // Offset and scale is always monotoneous\n return true;\n }\n\n invert( data ) {\n\n let d = data || this.data;\n d.reverse();\n\n if ( this.isMonotoneous() ) {\n this._monotoneousAscending = !this._monotoneousAscending;\n }\n\n return d;\n }\n\n resampleForDisplay( options ) { // Serie redrawing\n\n let i = 0;\n\n this.requireXMonotonicity();\n\n let inverting = false,\n dataY = this.getDataY(),\n data = {\n x: [],\n y: []\n },\n dataMinMax = [],\n resampleSum, resampleMin, resampleMax, resampleNum, resample_x_start, resample_x_px_start,\n x_px,\n doing_mean = false,\n firstPointIndex = 0,\n xval;\n\n const l = this.getLength();\n\n if ( !options.xPosition ) {\n throw 'No position calculation method provided';\n }\n\n if ( !options.resampleToPx ) {\n throw 'No \"resampleToPx\" method was provided. Unit: px per point';\n }\n\n if ( options.minX > options.maxX ) {\n let temp = options.minX;\n options.minX = options.maxX;\n options.maxX = temp;\n }\n\n if ( ( this.xdata && !this.xdata.getMonotoneousAscending() ) || ( !this.xdata && this.xScale < -0 ) ) {\n inverting = true;\n i = l;\n }\n\n for ( ; inverting ? i > 0 : i < l; inverting ? i-- : i++ ) {\n\n xval = this.getX( i );\n\n if ( options.minX > xval ) {\n\n firstPointIndex = i;\n continue;\n }\n\n x_px = options.xPosition( xval );\n\n if ( !doing_mean ) {\n\n if ( !firstPointIndex ) {\n\n firstPointIndex = i;\n } else {\n\n data.x.push( xval );\n data.y.push( dataY[ firstPointIndex ] );\n\n }\n\n while ( isNaN( dataY[ i ] ) ) {\n\n if ( inverting ) {\n i--;\n } else {\n i++;\n }\n }\n\n resampleSum = resampleMin = resampleMax = dataY[ firstPointIndex ];\n resampleNum = 1;\n resample_x_px_start = x_px;\n resample_x_start = xval;\n firstPointIndex = 0;\n\n doing_mean = true;\n\n continue;\n }\n\n if ( Math.abs( x_px - resample_x_px_start ) > options.resampleToPx || i == l || i == 0 || isNaN( dataY[ i ] ) ) {\n\n let xpos = ( resample_x_start + xval ) / 2;\n\n data.x.push( xpos );\n data.y.push( resampleSum / resampleNum );\n\n dataMinMax.push( xpos, resampleMin, resampleMax );\n\n if ( options.maxX !== undefined && xval > options.maxX ) {\n\n break;\n }\n\n doing_mean = false;\n\n continue;\n }\n\n resampleSum += dataY[ i ];\n resampleNum++;\n\n resampleMin = Math.min( resampleMin, dataY[ i ] );\n resampleMax = Math.max( resampleMax, dataY[ i ] );\n }\n\n this.dataInUseType = 'resampled';\n this.dataInUse = data;\n return dataMinMax;\n }\n\n interpolate( x ) {\n\n let xIndex;\n let yData = this.getDataY();\n\n x = ( x - this.getXShift() ) / this.getXScale();\n\n if ( this.xdata ) {\n let xData = this.xdata.getData(),\n xIndex = binarySearch( x, xData, !this.xdata.getMonotoneousAscending() );\n\n if ( xData[ xIndex ] == x ) {\n return yData[ xIndex ];\n }\n return ( x - xData[ xIndex ] ) / ( xData[ xIndex + 1 ] - xData[ xIndex ] ) * ( yData[ xIndex + 1 ] - yData[ xIndex ] ) + yData[ xIndex ];\n\n } else {\n xIndex = ( x - this.xOffset ) / ( this.xScale );\n let xIndexF = Math.floor( xIndex );\n return ( xIndex - xIndexF ) * ( yData[ xIndexF + 1 ] - yData[ xIndexF ] ) + yData[ xIndexF ];\n }\n\n }\n\n getMonotoneousAscending() {\n\n if ( !this.isMonotoneous() ) {\n return 'The waveform is not monotoneous';\n }\n\n return this._monotoneousAscending;\n }\n\n getXMonotoneousAscending() {\n if ( this.xdata ) {\n return this.xdata.getMonotoneousAscending();\n }\n\n return this.xScale > 0;\n }\n\n isXMonotoneousAscending() {\n return this.getXMonotoneousAscending( ...arguments );\n }\n\n divide( numberOrWave ) {\n return this._arithmetic( numberOrWave, DIVIDE );\n }\n\n divideBy() {\n return this.divide( ...arguments );\n }\n\n multiply( numberOrWave ) {\n return this._arithmetic( numberOrWave, MULTIPLY );\n }\n\n multiplyBy() {\n return this.multiply( ...arguments );\n }\n\n log() {\n return this.logBase( 10 );\n }\n\n ln() {\n return this.logBase( Math.E );\n }\n\n logBase( base ) {\n\n let logBase = Math.log( base );\n this.data.map( ( valY ) => {\n\n return Math.log( valY ) / logBase;\n } );\n }\n\n add( numberOrWave ) {\n return this._arithmetic( numberOrWave, ADD );\n }\n\n addBy() {\n return this.add( ...arguments );\n }\n\n subtract( numberOrWave ) {\n return this._arithmetic( numberOrWave, SUBTRACT );\n }\n\n subtractBy() {\n return this.subtract( ...arguments );\n }\n\n math( method ) {\n\n for ( var i = 0; i < this.getLength(); i++ ) {\n this.data[ i ] = method( this.getY( i ), this.getX( i ) );\n }\n\n this._setData( this.data );\n return this;\n }\n\n _arithmetic( numberOrWave, operator ) {\n\n if ( numberOrWave instanceof Waveform ) {\n return this._waveArithmetic( numberOrWave, operator );\n } else if ( typeof numberOrWave == 'number' ) {\n\n return this._numberArithmetic( numberOrWave, operator );\n }\n }\n\n _numberArithmetic( num, operation ) {\n\n let i = 0,\n l = this.getLength();\n\n if ( operation == MULTIPLY ) {\n\n for ( ; i < l; i++ ) {\n this.data[ i ] *= num;\n }\n\n this.minY *= num;\n this.maxY *= num;\n } else if ( operation == DIVIDE ) {\n\n for ( ; i < l; i++ ) {\n this.data[ i ] /= num;\n }\n\n this.minY /= num;\n this.maxY /= num;\n } else if ( operation == ADD ) {\n\n for ( ; i < l; i++ ) {\n this.data[ i ] += num;\n }\n\n this.minY += num;\n this.maxY += num;\n } else if ( operation == SUBTRACT ) {\n\n for ( ; i < l; i++ ) {\n this.data[ i ] -= num;\n }\n\n this.minY -= num;\n this.maxY -= num;\n }\n\n return this;\n }\n\n _waveArithmetic( wave, operation ) {\n\n let yDataThis = this.getDataY(),\n\n i = 0;\n const l = this.getLength();\n this.requireXMonotonicity();\n wave.requireXMonotonicity();\n\n if ( operation == MULTIPLY ) {\n\n for ( ; i < l; i++ ) {\n yDataThis[ i ] *= wave.interpolate( this.getX( i ) );\n }\n } else if ( operation == DIVIDE ) {\n\n for ( ; i < l; i++ ) {\n yDataThis[ i ] /= wave.interpolate( this.getX( i ) );\n }\n } else if ( operation == ADD ) {\n\n for ( ; i < l; i++ ) {\n yDataThis[ i ] += wave.interpolate( this.getX( i ) );\n }\n } else if ( operation == SUBTRACT ) {\n\n for ( ; i < l; i++ ) {\n yDataThis[ i ] -= wave.interpolate( this.getX( i ) );\n }\n }\n\n this._setData( yDataThis );\n return this;\n }\n\n aggregate( direction = 'x' ) {\n\n this._dataAggregating = {};\n this._dataAggregated = {};\n this._dataAggregationDirection = direction.toUpperCase();\n\n var pow2 = pow2floor( this.getLength() );\n\n this._dataAggregating = aggregator( {\n\n minX: this.getMinX(),\n maxX: this.getMaxX(),\n minY: this.getMinY(),\n maxY: this.getMaxY(),\n data: this.data,\n xdata: this.xdata ? this.xdata.getData() : undefined,\n xScale: this.xScale,\n xOffset: this.xOffset,\n numPoints: pow2,\n direction: direction\n\n } ).then( ( event ) => {\n\n this._dataAggregated = event.aggregates;\n console.log( this._dataAggregated );\n this._dataAggregating = false;\n } );\n\n }\n\n hasAggregation() {\n return !!this._dataAggregated;\n }\n\n selectAggregatedData( pxWidth ) {\n\n if ( pxWidth < 2 ) {\n return false;\n }\n /*\n console.log( direction, this._dataAggregationDirection );\n\n if( direction !== this._dataAggregationDirection ) {\n throw \"The data is not aggregated in that direction\";\n }\n */\n\n if ( pxWidth > 2147483647 ) {\n pxWidth = 2147483647;\n }\n var level = pow2ceil( pxWidth );\n\n if ( this._dataAggregated[ level ] ) {\n\n this.dataInUseType = 'aggregate' + this._dataAggregationDirection;\n this.dataInUse = this._dataAggregated[ level ];\n return;\n } else if ( this._dataAggregating ) {\n\n return this._dataAggregating;\n }\n\n this.dataInUseType = 'none';\n this.dataInUse = {\n y: this.data,\n x: this.getXWaveform().data\n };\n }\n\n duplicate( alsoDuplicateXWave ) {\n var newWaveform = new Waveform();\n newWaveform._setData( this.getDataY().slice() );\n newWaveform.rescaleX( this.xOffset, this.xShift );\n newWaveform.setShift( this.getShift() );\n newWaveform.setScale( this.getScale() );\n\n if ( this.xdata ) {\n if ( alsoDuplicateXWave ) {\n newWaveform.setXWaveform( this.xdata.duplicate() );\n } else {\n newWaveform.setXWaveform( this.xdata );\n }\n\n newWaveform.setXShift( this.getXShift() );\n newWaveform.setXScale( this.getXScale() );\n\n } else {\n newWaveform.xOffset = this.xOffset;\n newWaveform.xScale = this.xScale;\n }\n\n return newWaveform;\n }\n\n subrangeX( fromX, toX ) {\n\n if ( !this.xdata ) { // We can select the new range from there\n\n let fromP = this.getIndexFromX( fromX ),\n toP = this.getIndexFromX( toP );\n\n return new Waveform()\n .setData( this.data.slice( fromP, toP ) )\n .rescaleX( this.xOffset, this.xScale );\n\n } else {\n\n var waveform = new Waveform();\n\n for ( var i = 0, l = this.data.length; i < l; i++ ) {\n\n if ( this.data[ i ] >= fromX && this.data[ i ] < toX ) {\n\n waveform.append( this.dataX[ i ], this.data[ i ] );\n }\n }\n\n return waveform;\n }\n }\n\n findLocalMinMax( xRef, xWithin, type ) {\n\n let index = this.getIndexFromX( xRef ),\n indexPlus = this.getIndexFromX( xRef + xWithin ),\n indexMinus = this.getIndexFromX( xRef - xWithin );\n\n return this.findLocalMinMaxIndex( indexMinus, indexPlus, type );\n }\n\n findLocalMinMaxIndex( indexMinus, indexPlus, type ) {\n\n let tmp;\n\n if ( indexPlus < indexMinus ) {\n tmp = indexPlus;\n indexPlus = indexMinus;\n indexMinus = tmp;\n }\n\n let curr, currI;\n\n if ( type == 'max' ) {\n\n curr = Number.NEGATIVE_INFINITY;\n\n for ( var i = indexMinus; i <= indexPlus; i++ ) {\n\n if ( this.getY( i ) > curr ) {\n curr = this.getY( i );\n currI = i;\n }\n }\n } else {\n\n curr = Number.POSITIVE_INFINITY;\n\n for ( var i = indexMinus; i <= indexPlus; i++ ) {\n\n if ( this.getY( i ) < curr ) {\n curr = this.getY( i );\n currI = i;\n }\n }\n }\n\n if ( currI == indexMinus || currI == indexPlus ) {\n return false;\n }\n\n return this.getX( currI );\n }\n\n warn( text ) {\n if ( console ) {\n console.warn( text );\n }\n }\n\n setUnit( unit ) {\n this.unit = unit;\n return this;\n }\n\n setXUnit( unit ) {\n if ( this.hasXWaveform() ) {\n this.xdata.setUnit( unit );\n }\n\n this.xunit = unit;\n return this;\n }\n\n getUnit() {\n return this.unit || '';\n }\n\n getXUnit() {\n if ( this.hasXWaveform() ) {\n return this.xdata.getUnit();\n }\n\n return this.xunit | '';\n }\n\n hasXUnit() {\n return this.getXUnit().length > 0;\n }\n\n hasUnit() {\n return this.getUnit().length > 0;\n }\n\n findLevels( level, options ) {\n\n options = Object.assign( {\n\n box: 1,\n edge: 'both',\n rounding: 'before',\n rangeP: [ 0, this.getLength() ],\n\n }, options );\n\n var lastLvlIndex = options.rangeP[ 0 ];\n var lvlIndex;\n var indices = [];\n var i = 0;\n\n while ( ( lvlIndex = this.findLevel( level, Object.assign( {}, options, {\n rangeP: [ lastLvlIndex, options.rangeP[ 1 ] ]\n } ) ) ) ) {\n indices.push( lvlIndex );\n lastLvlIndex = Math.ceil( lvlIndex );\n\n i++;\n if ( i > 1000 ) {\n return;\n }\n }\n\n return indices;\n }\n\n // Find the first level in the specified range\n findLevel( level, options ) {\n\n options = Object.assign( {\n\n box: 1,\n edge: 'both',\n direction: 'ascending',\n rounding: 'before',\n rangeP: [ 0, this.getLength() ],\n\n }, options );\n\n if ( options.rangeX ) {\n options.rangeP = options.rangeX.map( this.getIndexFromX );\n }\n\n var value,\n below,\n i,\n j,\n l,\n increment;\n\n var box = options.box;\n\n if ( box % 2 == 0 ) {\n box++;\n }\n\n if ( options.direction == 'descending' ) {\n i = options.rangeP[ 1 ],\n l = options.rangeP[ 0 ],\n increment = -1;\n } else {\n i = options.rangeP[ 0 ],\n l = options.rangeP[ 1 ],\n increment = +1;\n }\n\n for ( ;; i += increment ) {\n\n if ( options.direction == 'descending' ) {\n if ( i < l ) {\n break;\n }\n } else {\n if ( i > l ) {\n break;\n }\n }\n\n if ( i < options.rangeP[ 0 ] + ( box - 1 ) / 2 ) {\n continue;\n }\n\n if ( i > options.rangeP[ 1 ] - ( box - 1 ) / 2 ) {\n break;\n }\n\n value = this.getAverageP( i - ( box - 1 ) / 2, i + ( box - 1 ) / 2 );\n\n if ( below === undefined ) {\n below = value < level;\n continue;\n }\n // Crossing up\n if ( value >= level && below ) {\n\n below = false;\n\n if ( options.edge == 'ascending' || options.edge == 'both' ) {\n // Found something\n\n for ( j = i + ( box - 1 ) / 2; j >= i - ( box - 1 ) / 2; j-- ) {\n\n if ( this.data[ j ] >= level && this.data[ j - 1 ] < level ) { // Find a crossing\n\n switch ( options.rounding ) {\n case 'before':\n return j - 1;\n break;\n\n case 'after':\n return j;\n break;\n\n case 'interpolate':\n return getIndexInterpolate( level, this.data[ j ], this.data[ j - 1 ], j, j - 1 );\n break;\n }\n }\n }\n }\n\n } else if ( value <= level && !below ) {\n\n below = true;\n\n if ( options.edge == 'descending' || options.edge == 'both' ) {\n\n for ( j = i + ( box - 1 ) / 2; j >= i - ( box - 1 ) / 2; j-- ) {\n\n if ( this.data[ j ] <= level && this.data[ j - 1 ] > level ) { // Find a crossing\n\n switch ( options.rounding ) {\n case 'before':\n return j - 1;\n break;\n\n case 'after':\n return j;\n break;\n\n case 'interpolate':\n return getIndexInterpolate( level, this.data[ j ], this.data[ j - 1 ], j, j - 1 );\n break;\n }\n\n }\n }\n }\n }\n }\n }\n\n normalize( mode ) {\n\n let factor,\n total,\n minValue,\n maxValue,\n ratio,\n i;\n\n if ( mode == 'max1' || mode == 'max100' ) {\n\n factor = 1;\n\n if ( mode == 'max100' ) {\n factor = 100;\n }\n\n maxValue = this.data[ 0 ];\n\n for ( i = 1; i < this.getLength(); i++ ) {\n\n if ( this.data[ i ] > maxValue ) {\n\n maxValue = this.data[ i ];\n }\n }\n\n for ( i = 0; i < this.getLength(); i++ ) {\n\n this.data[ i ] /= maxValue / factor;\n }\n\n } else if ( mode == 'sum1' ) {\n\n total = 0;\n\n for ( i = 0; i < this.getLength(); i++ ) {\n total += this.data[ i ];\n }\n\n for ( i = 0; i < this.getLength(); i++ ) {\n\n this.data[ i ] /= total;\n }\n\n } else if ( mode == 'max1min0' ) {\n\n maxValue = this.data[ 0 ],\n minValue = this.data[ 0 ];\n\n for ( i = 1; i < this.getLength(); i++ ) {\n if ( this.data[ i ] > maxValue ) {\n\n maxValue = this.data[ i ];\n\n } else if ( this.data[ i ] < minValue ) {\n\n minValue = this.data[ i ];\n\n }\n }\n\n ratio = 1 / ( maxValue - minValue );\n\n for ( i = 0; i < this.getLength(); i++ ) {\n\n this.data[ i ] = ( this.data[ i ] - minValue ) * ratio;\n }\n\n }\n\n this.setData( this.data );\n }\n\n ////////////////////////////////////////////////////////////\n ///// HANDLING ERRORS ////////////////////////////////////\n ////////////////////////////////////////////////////////////\n\n setErrorBarX( waveform ) {\n\n if ( Array.isArray( waveform ) ) {\n waveform = new Waveform( waveform );\n }\n\n var xWave = this.getXWaveform();\n xWave.setErrorBar( waveform );\n return this;\n }\n\n setErrorBarXBelow( waveform ) {\n\n if ( Array.isArray( waveform ) ) {\n waveform = new Waveform( waveform );\n }\n\n var xWave = this.getXWaveform();\n xWave.setErrorBarBelow( waveform );\n return this;\n }\n\n setErrorBarXAbove( waveform ) {\n\n if ( Array.isArray( waveform ) ) {\n waveform = new Waveform( waveform );\n }\n\n var xWave = this.getXWaveform();\n xWave.setErrorBarAbove( waveform );\n return this;\n }\n\n setErrorBoxX( waveform ) {\n\n if ( Array.isArray( waveform ) ) {\n waveform = new Waveform( waveform );\n }\n\n var xWave = this.getXWaveform();\n xWave.setErrorBoxAbove( waveform );\n xWave.setErrorBoxBelow( waveform );\n return this;\n }\n\n setErrorBoxXBelow( waveform ) {\n\n if ( Array.isArray( waveform ) ) {\n waveform = new Waveform( waveform );\n }\n\n var xWave = this.getXWaveform();\n\n xWave.setErrorBoxBelow( waveform );\n return this;\n }\n\n setErrorBoxXAbove( waveform ) {\n\n if ( Array.isArray( waveform ) ) {\n waveform = new Waveform( waveform );\n }\n\n var xWave = this.getXWaveform();\n xWave.setErrorBoxAbove( waveform );\n return this;\n }\n\n setErrorBar( waveform, checkMinMax = true ) {\n\n if ( Array.isArray( waveform ) ) {\n waveform = new Waveform( waveform );\n }\n this.errors.nb++;\n this.errors.nb++;\n this.errors.bars.bottom = waveform;\n this.errors.bars.top = waveform;\n\n if ( checkMinMax ) {\n this._setData();\n }\n }\n\n setErrorBarBelow( waveform, checkMinMax = true ) {\n\n if ( Array.isArray( waveform ) ) {\n waveform = new Waveform( waveform );\n }\n this.errors.nb++;\n this.errors.bars.below = waveform;\n\n if ( checkMinMax ) {\n this._setData();\n }\n }\n\n setErrorBarAbove( waveform, checkMinMax = true ) {\n\n if ( Array.isArray( waveform ) ) {\n waveform = new Waveform( waveform );\n }\n\n this.errors.nb++;\n this.errors.bars.above = waveform;\n\n if ( checkMinMax ) {\n this._setData();\n }\n }\n\n setErrorBox( waveform, checkMinMax = true ) {\n\n if ( Array.isArray( waveform ) ) {\n waveform = new Waveform( waveform );\n }\n this.errors.nb++;\n this.errors.nb++;\n this.errors.boxes.above = waveform;\n this.errors.boxes.below = waveform;\n\n if ( checkMinMax ) {\n this._setData();\n }\n }\n\n setErrorBoxBelow( waveform, checkMinMax = true ) {\n\n if ( Array.isArray( waveform ) ) {\n waveform = new Waveform( waveform );\n }\n this.errors.nb++;\n this.errors.boxes.below = waveform;\n\n if ( checkMinMax ) {\n this._setData();\n }\n }\n\n setErrorBoxAbove( waveform, checkMinMax = true ) {\n\n if ( Array.isArray( waveform ) ) {\n waveform = new Waveform( waveform );\n }\n\n this.errors.boxes.above = waveform;\n if ( checkMinMax ) {\n this._setData();\n }\n }\n\n getMaxError( i, side = Waveform.ABOVE ) {\n\n return Math.max( this.getMaxErrorType( i, side, Waveform.BOX ), this.getMaxErrorType( i, side, Waveform.BAR ) );\n }\n\n getMaxErrorType( i, side = Waveform.ABOVE, type = Waveform.BOX ) {\n\n let stack;\n if ( type == Waveform.BOX ) {\n stack = this.errors.boxes;\n } else if ( type == Waveform.BAR ) {\n stack = this.errors.bars;\n } else {\n throw 'Unknown type of error';\n }\n\n let waveform;\n if ( !( waveform = stack[ side ] ) ) {\n if ( side == Waveform.ABOVE ) {\n if ( stack[ side ] == Waveform.BELOW ) {\n waveform = stack.below;\n }\n } else {\n if ( stack[ side ] == Waveform.ABOVE ) {\n waveform = stack.above;\n }\n }\n }\n\n if ( !waveform ) {\n return 0;\n }\n\n return waveform.getY( i );\n }\n\n getErrorBarXBelow( index ) {\n return this.getErrorX( index, Waveform.BELOW, Waveform.BAR );\n }\n getErrorBarXAbove( index ) {\n return this.getErrorX( index, Waveform.ABOVE, Waveform.BAR );\n }\n getErrorBoxXBelow( index ) {\n return this.getErrorX( index, Waveform.BELOW, Waveform.BOX );\n }\n getErrorBoxXAbove( index ) {\n return this.getErrorX( index, Waveform.ABOVE, Waveform.BOX );\n }\n\n getErrorBarYBelow( index ) {\n return this.getError( index, Waveform.BELOW, Waveform.BAR );\n }\n getErrorBarYAbove( index ) {\n return this.getError( index, Waveform.ABOVE, Waveform.BAR );\n }\n getErrorBoxYBelow( index ) {\n return this.getError( index, Waveform.BELOW, Waveform.BOX );\n }\n getErrorBoxYAbove( index ) {\n return this.getError( index, Waveform.ABOVE, Waveform.BOX );\n }\n\n getErrorX( index, side = Waveform.ABOVE, type = Waveform.BAR ) {\n\n if ( !this.hasXWaveform() ) {\n return false;\n }\n\n return this.xdata.getError( index, side, type );\n }\n\n getError( index, side = Waveform.ABOVE, type = Waveform.BAR ) {\n\n let errors = type == Waveform.BAR ? this.errors.bars : this.errors.boxes;\n\n if ( !errors ) {\n return false;\n }\n\n let wave;\n if ( ( wave = ( side == Waveform.ABOVE ? errors.above : errors.below ) ) ) {\n\n if ( wave == Waveform.ABOVE && side == Waveform.BELOW ) {\n wave = errors.above;\n } else if ( wave == Waveform.BELOW && side == Waveform.ABOVE ) {\n wave = errors.below;\n }\n\n if ( !wave ) {\n return false;\n }\n\n return wave.getY( index );\n }\n }\n\n hasErrorBars() {\n\n return this.errors.nb > 0 || ( this.hasXWaveform() && this.xdata.errors.nb > 0 );\n }\n\n}\n// http://stackoverflow.com/questions/26965171/fast-nearest-power-of-2-in-javascript\nfunction pow2ceil( v ) {\n v--;\n var p = 2;\n while ( ( v >>= 1 ) ) {\n p <<= 1;\n }\n return p;\n}\n\nfunction pow2floor( v ) {\n\n var p = 1;\n\n while ( ( v >>= 1 ) ) {\n p <<= 1;\n\n }\n return p;\n}\n\nfunction getIndexInterpolate( value, valueBefore, valueAfter, indexBefore, indexAfter ) {\n return ( value - valueBefore ) / ( valueAfter - valueBefore ) * ( indexAfter - indexBefore ) + indexBefore;\n}\n\nfunction euclidianSearch( targetX, targetY, haystackX, haystackY, scaleX = 1, scaleY = 1 ) {\n\n let distance = Number.MAX_VALUE,\n distance_i;\n\n let index = -1;\n\n for ( var i = 0, l = haystackX.length; i < l; i++ ) {\n\n distance_i = ( ( ( ( targetX - haystackX[ i ] ) * scaleX ) ** 2 + ( ( targetY - haystackY[ i ] ) * scaleY ) ** 2 ) );\n\n if ( distance_i < distance ) {\n\n index = i;\n distance = distance_i;\n }\n }\n\n return index;\n}\n\nfunction binarySearch( target, haystack, reverse ) {\n\n let seedA = 0,\n length = haystack.length,\n seedB = ( length - 1 ),\n seedInt,\n i = 0,\n nanDirection = 1;\n\n if ( haystack[ seedA ] == target ) {\n return seedA;\n }\n\n if ( haystack[ seedB ] == target ) {\n return seedB;\n }\n\n while ( true ) {\n i++;\n if ( i > 100 ) {\n throw 'Error loop';\n }\n\n seedInt = Math.floor( ( seedA + seedB ) / 2 );\n\n // seedInt -= seedInt % 2; // Always looks for an x.\n\n while ( isNaN( haystack[ seedInt ] ) ) {\n\n if ( seedInt >= haystack.length - 1 ) {\n\n return haystack.length - 1;\n\n } else if ( seedInt <= 0 ) {\n\n return 0;\n }\n\n seedInt += nanDirection;\n }\n\n if ( seedInt == seedA || haystack[ seedInt ] == target || seedInt == seedB ) {\n return seedInt;\n }\n\n // console.log(seedA, seedB, seedInt, haystack[seedInt]);\n if ( haystack[ seedInt ] <= target ) {\n if ( reverse ) {\n seedB = seedInt;\n } else {\n seedA = seedInt;\n }\n } else if ( haystack[ seedInt ] > target ) {\n if ( reverse ) {\n seedA = seedInt;\n } else {\n seedB = seedInt;\n }\n } else {\n return false;\n }\n\n nanDirection *= -1;\n }\n}\n\nWaveform.BELOW = Symbol();\nWaveform.ABOVE = Symbol();\n\nWaveform.BOX = Symbol();\nWaveform.BAR = Symbol();\n\nconst MULTIPLY = Symbol();\nconst ADD = Symbol();\nconst SUBTRACT = Symbol();\nconst DIVIDE = Symbol();\n\n//module.exports = Waveform;\n\nexport default Waveform;\n//export default Waveform","import GraphPosition from './graph.position.js';\nimport * as util from './graph.util.js';\nimport EventEmitter from './dependencies/eventEmitter/EventEmitter.js';\nimport Waveform from './util/waveform.js';\n\n/**\n * Default graph parameters\n * @name Graph~GraphOptionsDefault\n * @name GraphOptions\n * @object\n * @static\n * @memberof Graph\n * @prop {String} title - Title of the graph\n * @prop {Number} paddingTop - The top padding\n * @prop {Number} paddingLeft - The left padding\n * @prop {Number} paddingRight - The right padding\n * @prop {Number} paddingBottom - The bottom padding\n * @prop {(Number|Boolean)} padding - A common padding value for top, bottom, left and right\n * @prop {Number} fontSize - The basic text size of the graphs\n * @prop {Number} fontFamily - The basic font family. Should be installed on the computer of the user\n * @prop {Object.} plugins - A list of plugins to import with their options\n * @prop {Object.} pluginAction - The default key combination to access those actions\n * @prop {Object.} mouseActions - Alias of pluginActions\n * @prop {Object.} keyActions - Defines what happens when keys are pressed\n * @prop {Object} wheel - Define the mouse wheel action\n * @prop {Object} dblclick - Define the double click action\n * @prop {Boolean} shapesUniqueSelection - true to allow only one shape to be selected at the time\n * @prop {Boolean} shapesUnselectOnClick - true to unselect all shapes on click\n */\nconst GraphOptionsDefault = {\n\n title: '',\n\n paddingTop: 30,\n paddingBottom: 5,\n paddingLeft: 20,\n paddingRight: 20,\n\n close: {\n left: true,\n right: true,\n top: true,\n bottom: true\n },\n\n closeColor: 'black',\n\n fontSize: 12,\n fontFamily: 'Myriad Pro, Helvetica, Arial',\n\n plugins: {},\n pluginAction: {},\n mouseActions: [],\n keyActions: [],\n wheel: {},\n dblclick: {},\n\n shapesUnselectOnClick: true,\n shapesUniqueSelection: true\n};\n\nconst defaultScatterStyle = {\n shape: 'circle',\n r: 4\n};\n\nvar _constructors = new Map();\n\n/**\n * Entry class of jsGraph that creates a new graph.\n * @extends EventEmitter\n * @tutorial basic\n */\nclass Graph extends EventEmitter {\n\n /**\n * Graph constructor\n * @param {(HTMLElement|String)} [wrapper ] - The DOM Wrapper element its ```id``` property. If you do not use the wrapper during the graph creation, use it with the @link{Graph.setWrapper} method\n * @param {GraphOptions} [ options ] - The options of the graph\n * @param {Object} [ axis ] - The list of axes\n * @param {Array} axis.left - The list of left axes\n * @param {Array} axis.bottom - The list of bottom axes\n * @param {Array} axis.top - The list of top axes\n * @param {Array} axis.right - The list of right axes\n * @example var graph = new Graph(\"someDomID\");\n * @example var graph = new Graph(\"someOtherDomID\", { title: 'Graph title', paddingRight: 100 } );\n */\n constructor( wrapper, options, axis ) {\n\n super();\n\n /*\n The unique ID of the graph\n @name Graph#uniqueid\n @type String\n */\n this._creation = util.guid();\n this._drawn = false;\n\n if ( wrapper === Object( wrapper ) && !( wrapper instanceof HTMLElement ) ) { // Wrapper is options\n axis = options;\n options = wrapper;\n wrapper = null;\n } else if ( typeof wrapper == 'string' ) {\n wrapper = document.getElementById( wrapper );\n } else if ( typeof wrapper.length == 'number' ) {\n wrapper = wrapper[ 0 ];\n }\n\n /**\n * @object\n * @memberof Graph\n * @name Graph#options\n * @type GraphOptions\n * @default {@link GraphOptionsDefault}\n * Access directly the options of the graph using this public object.\n * @example graph.options.mouseActions.push( { } );\n */\n this.options = util.extend( {}, GraphOptionsDefault, options );\n // Options declaration must be placed before the doDom operation\n\n // doDom is a private method. We bind it to this thanks to ES6 features\n ( doDom.bind( this ) )();\n\n if ( wrapper ) {\n this.setWrapper( wrapper );\n }\n\n this.prevented = false;\n\n this.axis = {\n left: [],\n top: [],\n bottom: [],\n right: []\n };\n\n this.shapes = [];\n this.shapesLocked = false;\n this.plugins = {};\n\n for ( var i in this.options.pluginAction ) {\n this.options.pluginAction.plugin = i;\n this.options.mouseActions.push( this.options.pluginAction );\n }\n\n this.selectedShapes = [];\n\n this.series = [];\n //this._dom = wrapper;\n this._axesHaveChanged = true;\n\n if ( this.options.hasOwnProperty( 'padding' ) && util.isNumeric( this.options.padding ) ) {\n this.options.paddingTop = this.options.paddingBottom = this.options.paddingLeft = this.options.paddingRight = this.options.padding;\n }\n\n this.currentAction = false;\n\n this.ns = Graph.ns;\n this.nsxlink = Graph.nsxlink;\n\n // Load all axes\n if ( axis ) {\n for ( var i in axis ) {\n for ( var j = 0, l = axis[ i ].length; j < l; j++ ) {\n\n switch ( i ) {\n\n case 'top':\n this.getTopAxis( j, axis[ i ][ j ] );\n break;\n case 'left':\n this.getLeftAxis( j, axis[ i ][ j ] );\n break;\n case 'right':\n this.getRightAxis( j, axis[ i ][ j ] );\n break;\n case 'bottom':\n this.getBottomAxis( j, axis[ i ][ j ] );\n break;\n\n default: // Do not do anything\n break;\n }\n }\n }\n }\n\n this._pluginsInit();\n\n }\n\n setWrapper( wrapper ) {\n\n if ( !wrapper ) {\n throw new Error( 'The wrapper DOM element was not found.' );\n }\n\n if ( !wrapper.appendChild ) {\n throw new Error( 'The wrapper appears to be an invalid HTMLElement' );\n }\n\n wrapper.style[ '-webkit-user-select' ] = 'none';\n wrapper.style[ '-moz-user-select' ] = 'none';\n wrapper.style[ '-o-user-select' ] = 'none';\n wrapper.style[ '-ms-user-select' ] = 'none';\n wrapper.style[ 'user-select' ] = 'none';\n\n wrapper.style.position = 'relative';\n wrapper.style.outline = 'none';\n\n // Why would that be necessary ?\n // wrapper.setAttribute( 'tabindex', 1 );\n\n this.wrapper = wrapper;\n\n // DOM\n\n if ( !this.height || !this.width ) {\n var wrapperStyle = getComputedStyle( wrapper );\n var w = parseInt( wrapperStyle.width, 10 );\n var h = parseInt( wrapperStyle.height, 10 );\n this.setSize( w, h );\n this._resize();\n }\n\n wrapper.appendChild( this.dom );\n\n _registerEvents( this );\n\n }\n /**\n * Returns the graph SVG wrapper element\n * @public\n * @return {SVGElement} The DOM element wrapping the graph\n */\n getDom() {\n return this.dom;\n }\n\n /**\n * Returns the unique id representing the graph\n * @public\n * @return {String} The unique ID of the graph\n */\n getId() {\n return this._creation;\n }\n\n /**\n * Returns the graph wrapper element passed during the graph creation\n * @public\n * @return {HTMLElement} The DOM element wrapping the graph\n */\n getWrapper() {\n return this.wrapper;\n }\n\n /**\n * Sets an option of the graph\n * @param {String} name - Option name\n * @param value - New option value\n * @returns {Graph} - Graph instance\n */\n setOption( name, val ) {\n this.options[ name ] = val;\n return this;\n }\n\n /**\n * Sets the title of the graph\n */\n setTitle( title ) {\n this.options.title = title;\n this.domTitle.textContent = title;\n }\n\n /**\n * Shows the title of the graph\n */\n displayTitle() {\n this.domTitle.setAttribute( 'display', 'inline' );\n }\n\n /**\n * Hides the title of the graph\n */\n hideTitle() {\n this.domTitle.setAttribute( 'display', 'none' );\n }\n\n hide() {\n if ( this.dom.style.display !== 'none' ) {\n this.dom.style.display = 'none';\n }\n }\n\n show() {\n if ( this.dom.style.display == 'none' ) {\n this.dom.style.display = 'initial';\n }\n }\n\n /**\n * Calls a repaint of the container. Used internally when zooming on the graph, or when .autoscaleAxes() is called (see {@link Graph#autoscaleAxes}).
\n * To be called after axes min/max are expected to have changed (e.g. after an axis.zoom( from, to )) has been called\n * @param {Boolean} onlyIfAxesHaveChanged - Triggers a redraw only if min/max values of the axes have changed.\n * @return {Boolean} if the redraw has been successful\n */\n redraw( onlyIfAxesHaveChanged, force ) {\n\n if ( !this.width || !this.height ) {\n return;\n }\n\n if ( !this.sizeSet ) {\n this._resize();\n this.executeRedrawSlaves();\n return true;\n\n } else {\n\n if ( !onlyIfAxesHaveChanged || force || haveAxesChanged( this ) || hasSizeChanged( this ) ) {\n this.executeRedrawSlaves();\n refreshDrawingZone( this );\n return true;\n }\n }\n\n this.executeRedrawSlaves( true );\n return false;\n }\n\n executeRedrawSlaves() {\n this._pluginsExecute( 'preDraw' );\n\n }\n\n /**\n * Draw the graph and the series. This method will only redraw what is necessary. You may trust its use when you have set new data to series, changed serie styles or called for a zoom on an axis.\n */\n draw( force ) {\n\n this.drawn = true;\n this.updateLegend( true );\n this.drawSeries( this.redraw( true, force ) );\n\n this._pluginsExecute( 'postDraw' );\n\n }\n\n /**\n * Prevents the graph, the series and the legend from redrawing automatically. Valid until {@link Graph#resumeUpdate} is called\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#resumeUpdate}\n * @see {@link Graph#doUpdate}\n * @since 1.16.19\n */\n delayUpdate() {\n this._lockUpdate = true;\n return this;\n }\n\n /**\n * Forces legend and graph update, even is {@link Graph#delayUpdate} has been called before.\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#delayUpdate}\n * @see {@link Graph#resumeUpdate}\n * @since 1.16.19\n */\n doUpdate() {\n if ( this.legend ) {\n this.legend.update();\n }\n this.draw();\n if ( this.legend ) {\n this.legend.update();\n }\n return this;\n }\n\n /**\n * Cancels the effect of {@link Graph#delayUpdate}, but does not redraw the graph automatically\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#delayUpdate}\n * @see {@link Graph#doUpdate}\n * @since 1.16.19\n */\n resumeUpdate() {\n this._lockUpdate = false;\n return this;\n }\n\n isDelayedUpdate() {\n return this._lockUpdate;\n }\n\n /**\n * Sets the total width of the graph\n * @param {Number} width - The new width of the graph\n * @param {Boolean} skipResize - true to defer graph repaint. Use {@link Graph#resize} to force repain later on. (Useful if many graph sizing operations are done successively)\n * @see Graph#setHeight\n * @see Graph#resize\n */\n setWidth( width, skipResize ) {\n this.width = width;\n if ( !skipResize ) {\n this._resize();\n }\n }\n\n /**\n * Sets the total height of the graph\n * @param {Number} height - The new height of the graph\n * @param {Boolean} skipResize - true to defer graph repaint. Use {@link Graph#resize} to force repain later on. (Useful if many graph sizing operations are done successively)\n * @see Graph#setWidth\n * @see Graph#resize\n */\n setHeight( height, skipResize ) {\n this.height = height;\n if ( !skipResize ) {\n this._resize();\n }\n }\n\n /**\n * Sets the new dimension of the graph and repaints it. If width and height are omitted, a simple refresh is done.\n * @param {Number} [ width ] - The new width of the graph\n * @param {Number} [ height ] - The new height of the graph\n * @see Graph#setWidth\n * @see Graph#setHeight\n * @return {Graph} The current graph\n */\n resize( w, h ) {\n if ( w && h ) {\n this.setSize( w, h );\n }\n\n this._resize();\n return this;\n }\n\n /**\n * Sets the new dimension of the graph without repainting it. Use {@link Graph#resize} to perform the actual resizing of the graph.\n * @param {Number} [ width ] - The new width of the graph\n * @param {Number} [ height ] - The new height of the graph\n * @see Graph#setWidth\n * @see Graph#setHeight\n * @see Graph#resize\n */\n setSize( w, h ) {\n this.setWidth( w, true );\n this.setHeight( h, true );\n this.getDrawingHeight();\n this.getDrawingWidth();\n }\n\n /**\n * Returns the width of the graph (set by setSize, setWidth or resize methods)\n * @return {Number} Width of the graph\n */\n getWidth() {\n return this.width;\n }\n\n /**\n * Returns the height of the graph (set by setSize, setHeight or resize methods)\n * @return {Number} Height of the graph\n */\n getHeight() {\n return this.height;\n }\n\n /**\n * Returns the top padding of the graph (space between the top of the svg container and the topmost axis)\n * @return {Number} paddingTop\n */\n getPaddingTop() {\n return this.options.paddingTop;\n }\n\n /**\n * Returns the left padding of the graph (space between the left of the svg container and the leftmost axis)\n * @return {Number} paddingTop\n */\n getPaddingLeft() {\n return this.options.paddingLeft;\n }\n\n /**\n * Returns the bottom padding of the graph (space between the bottom of the svg container and the bottommost axis)\n * @return {Number} paddingTop\n */\n getPaddingBottom() {\n return this.options.paddingBottom;\n }\n\n /**\n * Returns the right padding of the graph (space between the right of the svg container and the rightmost axis)\n * @return {Number} paddingRight\n */\n getPaddingRight() {\n return this.options.paddingRight;\n }\n\n /**\n * Returns the height of the drawable zone, including the space used by the axes\n * @param {Boolean} useCache - Use cached value. Useful if one is sure the graph hasn't changed dimension. Automatically called after a Graph.resize();\n * @returns {Number} Height of the graph\n */\n getDrawingHeight( useCache ) {\n if ( useCache && this.innerHeight ) {\n return this.innerHeight;\n }\n return ( this.innerHeight = ( this.height - this.options.paddingTop - this.options.paddingBottom ) );\n }\n\n /**\n * Returns the width of the drawable zone, including the space used by the axes\n * @param {Boolean} useCache - Use cached value. Useful if one is sure the graph hasn't changed dimension. Automatically called after a Graph.resize();\n * @returns {Number} Width of the graph\n */\n getDrawingWidth( useCache ) {\n if ( useCache && this.innerWidth ) {\n return this.innerWidth;\n }\n return ( this.innerWidth = ( this.width - this.options.paddingLeft - this.options.paddingRight ) );\n }\n\n /**\n * Caches the wrapper offset in the page.
\n * The position of the wrapper is used when processing most of mouse events and it is fetched via the jQuery function .offset().\n * If performance becomes a critical issue in your application, cacheOffset() should be used to store the offset position. It should be ensured that the graph doesn't move in the page. If one can know when the graph has moved, cacheOffset() should be called again to update the offset position.\n * @see Graph#uncacheOffset\n */\n cacheOffset() {\n this.offsetCached = util.getOffset( this.wrapper );\n }\n\n /**\n * Un-caches the wrapper offset value\n * @see Graph#cacheOffset\n */\n uncacheOffset() {\n this.offsetCached = false;\n }\n\n /**\n * Returns the x axis at a certain index. If any top axis exists and no bottom axis exists, returns or creates a top axis. Otherwise, creates or returns a bottom axis\n * Caution ! The options parameter will only be effective if an axis is created\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getXAxis( index, options ) {\n if ( this.axis.top.length > 0 && this.axis.bottom.length == 0 ) {\n return this.getTopAxis( index, options );\n }\n\n return this.getBottomAxis( index, options );\n }\n\n /**\n * Returns the y axis at a certain index. If any right axis exists and no left axis exists, returns or creates a right axis. Otherwise, creates or returns a left axis\n * Caution ! The options parameter will only be effective if an axis is created\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getYAxis( index, options ) {\n\n if ( this.axis.right.length > 0 && this.axis.left.length == 0 ) {\n return this.getRightAxis( index, options );\n }\n\n return this.getLeftAxis( index, options );\n }\n\n /**\n * Returns the top axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getTopAxis( index, options ) {\n return _getAxis( this, index, options, 'top' );\n }\n\n /**\n * Returns the bottom axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getBottomAxis( index, options ) {\n return _getAxis( this, index, options, 'bottom' );\n }\n\n /**\n * Returns the left axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getLeftAxis( index, options ) {\n return _getAxis( this, index, options, 'left' );\n }\n\n /**\n * Returns the right axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getRightAxis( index, options ) {\n return _getAxis( this, index, options, 'right' );\n }\n\n /**\n * Sets a bottom axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n */\n setXAxis( axis, index ) {\n this.setBottomAxis( axis, index );\n }\n\n /**\n * Sets a left axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n */\n setYAxis( axis, index ) {\n this.setLeftAxis( axis, index );\n }\n\n /**\n * Sets a left axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setTopAxis\n * @see Graph#setRightAxis\n * @see Graph#getLeftAxis\n * @see Graph#getYAxis\n */\n setLeftAxis( axis, index ) {\n index = index || 0;\n\n if ( this.axis.left[ index ] ) {\n this.axis.left[ index ].kill();\n }\n this.axis.left[ index ] = axis;\n }\n\n /**\n * Sets a right axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setLeftAxis\n * @see Graph#setTopAxis\n * @see Graph#getRightAxis\n * @see Graph#getYAxis\n */\n setRightAxis( axis, index ) {\n index = index || 0;\n\n if ( this.axis.right[ index ] ) {\n this.axis.right[ index ].kill();\n }\n this.axis.right[ index ] = axis;\n }\n\n /**\n * Sets a top axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setLeftAxis\n * @see Graph#setRightAxis\n * @see Graph#getBottomAxis\n * @see Graph#getXAxis\n */\n setTopAxis( axis, index ) {\n index = index || 0;\n\n if ( this.axis.top[ index ] ) {\n this.axis.top[ index ].kill();\n }\n this.axis.top[ index ] = axis;\n }\n\n /**\n * Sets a bottom axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setTopAxis\n * @see Graph#setLeftAxis\n * @see Graph#setRightAxis\n * @see Graph#getTopAxis\n * @see Graph#getXAxis\n */\n setBottomAxis( axis, index ) {\n index = index || 0;\n\n if ( this.axis.bottom[ index ] ) {\n this.axis.bottom[ index ].kill();\n }\n this.axis.bottom[ index ] = axis;\n }\n\n killAxis( axis, noRedraw = false, noSerieKill = false ) {\n\n var index;\n\n if ( axis.isX() ) {\n\n if ( ( index = this.axis.bottom.indexOf( axis ) ) > -1 ) {\n this.axis.bottom.splice( index, 1 );\n }\n\n if ( ( index = this.axis.top.indexOf( axis ) ) > -1 ) {\n this.axis.top.splice( index, 1 );\n }\n\n if ( !noSerieKill ) {\n this.series.forEach( ( serie ) => {\n\n if ( serie.getXAxis() == axis ) {\n serie.kill();\n }\n } );\n }\n }\n\n if ( axis.isY() ) {\n\n if ( ( index = this.axis.left.indexOf( axis ) ) > -1 ) {\n this.axis.left.splice( index, 1 );\n }\n\n if ( ( index = this.axis.right.indexOf( axis ) ) > -1 ) {\n this.axis.right.splice( index, 1 );\n }\n\n if ( !noSerieKill ) {\n this.series.forEach( ( serie ) => {\n\n if ( serie.getYAxis() == axis ) {\n serie.kill();\n }\n } );\n }\n }\n\n this.axisGroup.removeChild( axis.group ); // Removes all DOM\n this.groupPrimaryGrids.removeChild( axis.gridPrimary );\n this.groupSecondaryGrids.removeChild( axis.gridSecondary );\n\n if ( !noRedraw ) {\n this.draw( true );\n }\n }\n\n /**\n * Determines if an x axis belongs to the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasXAxis( axis ) {\n return this.hasTopAxis( axis ) || this.hasBottomAxis( axis );\n }\n\n /**\n * Determines if an x axis belongs to the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasYAxis( axis ) {\n return this.hasLeftAxis( axis ) || this.hasRightAxis( axis );\n }\n\n /**\n * Determines if an x axis belongs to top axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasTopAxis( axis ) {\n return this.hasAxis( axis, this.axis.top );\n }\n\n /**\n * Determines if an x axis belongs to bottom axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasBottomAxis( axis ) {\n return this.hasAxis( axis, this.axis.bottom );\n }\n\n /**\n * Determines if a y axis belongs to left axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasLeftAxis( axis ) {\n return this.hasAxis( axis, this.axis.left );\n }\n\n /**\n * Determines if a y axis belongs to right axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasRightAxis( axis ) {\n return this.hasAxis( axis, this.axis.right );\n }\n\n /**\n * Determines if an axis belongs to a list of axes\n * @param {Axis} axis - The axis instance to check\n * @param {Array} axisList - The list of axes to check\n * @private\n */\n hasAxis( axis, axisList ) {\n for ( var i = 0, l = axisList.length; i < l; i++ ) {\n if ( axisList[ i ] == axis ) {\n return true;\n }\n\n if ( axisList[ i ].hasAxis( axis ) ) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Autoscales the x and y axes of the graph.\n * Does not repaint the canvas\n * @return {Graph} The current graph instance\n */\n autoscaleAxes() {\n\n this._applyToAxes( 'setMinMaxToFitSeries', null, true, true );\n\n //this._applyToAxes( \"scaleToFitAxis\", [ this.getYAxis() ], false, true )\n // X is not always ascending...\n return this;\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoscale() {\n return this.autoscaleAxes( ...arguments );\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoScale() {\n return this.autoscaleAxes( ...arguments );\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoScaleAxes() {\n return this.autoscaleAxes( ...arguments );\n }\n\n // See #138\n /**\n * Autoscales a particular axis\n * @param {Axis} The axis to rescale\n * @return {Graph} The current graph instance\n */\n autoScaleAxis( axis ) {\n if ( !axis ) {\n return this;\n }\n\n axis.setMinMaxToFitSeries();\n return this;\n }\n\n /**\n * Sets the background color\n * @param {String} color - An SVG accepted color for the background\n * @return {Graph} The current graph instance\n */\n setBackgroundColor( color ) {\n\n this.rectEvent.setAttribute( 'fill', color );\n return this;\n }\n\n getAxisState() {\n\n var state = {};\n for ( var i in this.axis ) {\n state[ i ] = this.axis[ i ].map( function( axis ) {\n return [ axis.getCurrentMin(), axis.getCurrentMax() ];\n } );\n }\n return state;\n }\n\n setAxisState( state ) {\n\n var j, l;\n for ( var i in state ) {\n\n if ( !this.axis[ i ] ) {\n continue;\n }\n\n for ( j = 0, l = state[ i ].length; j < l; j++ ) {\n\n if ( !this.axis[ i ][ j ] ) {\n continue;\n }\n\n this.axis[ i ][ j ].setCurrentMin( state[ i ][ j ][ 0 ] );\n this.axis[ i ][ j ].setCurrentMax( state[ i ][ j ][ 1 ] );\n }\n }\n\n this.draw();\n }\n\n saveAxisState( savedName ) {\n this.savedAxisState = this.savedAxisState || {};\n this.savedAxisState[ savedName ] = this.getAxisState();\n return this;\n }\n\n recallAxisState( savedName ) {\n if ( this.savedAxisState[ savedName ] ) {\n this.recallAxisState( this.savedAxisState[ savedName ] );\n }\n return this;\n }\n\n _applyToAxis( type ) {\n\n switch ( type ) {\n\n case 'string':\n return function( type, func, params ) {\n // params.splice(1, 0, type);\n\n for ( var i = 0; i < this.axis[ type ].length; i++ ) {\n this.axis[ type ][ i ][ func ].apply( this.axis[ type ][ i ], params );\n }\n };\n\n case 'function':\n return function( type, func, params ) {\n for ( var i = 0; i < this.axis[ type ].length; i++ ) {\n func.call( this, this.axis[ type ][ i ], type, params );\n }\n };\n\n default:\n throw new Error( 'You must either execute a function or provide a string that registers a function' );\n }\n }\n\n /**\n * Calculates the minimal or maximal value of the axis. Currently, alias of getBoudaryAxisFromSeries\n */\n getBoundaryAxis( axis, minmax, usingZValues ) {\n\n var valSeries = this.getBoundaryAxisFromSeries( axis, minmax, usingZValues );\n // var valShapes = this.getBoundaryAxisFromShapes( axis, xy, minmax );\n return valSeries;\n //return Math[ minmax ]( valSeries, valShapes );\n\n }\n\n /**\n * Calculates the minimal or maximal value of the axis, based on the series that belong to it. The value is computed so that all series just fit in the value.\n * @memberof Graph.prototype\n * @param {Axis} axis - The axis for which the value should be computed\n * @param {minmax} minmax - The minimum or maximum to look for. \"min\" for the minimum, anything else for the maximum\n * @returns {Number} The minimimum or maximum of the axis based on its series\n */\n getBoundaryAxisFromSeries( axis, minmax, usingZValues ) {\n\n var min = minmax == 'min',\n val,\n func = axis.isX() ? [ 'getMinX', 'getMaxX' ] : [ 'getMinY', 'getMaxY' ],\n func2use = func[ min ? 0 : 1 ],\n infinity2use = min ? +Infinity : -Infinity,\n serie,\n series,\n serieValue,\n i,\n l;\n\n val = infinity2use;\n series = this.getSeriesFromAxis( axis );\n\n for ( i = 0, l = series.length; i < l; i++ ) {\n\n serie = series[ i ];\n\n if ( !serie.isShown() ) {\n continue;\n }\n\n serieValue = serie[ func2use ]( usingZValues );\n val = Math[ minmax ]( isNaN( val ) ? infinity2use : val, isNaN( serieValue ) ? infinity2use : serieValue );\n }\n\n return val;\n }\n\n /**\n * Returns all the series associated to an axis\n * @param {Axis} axis - The axis to which the series belong\n * @returns {Serie[]} An array containing the list of series that belong to the axis\n */\n getSeriesFromAxis( axis ) {\n var series = [],\n i = this.series.length - 1;\n\n for ( ; i >= 0; i-- ) {\n if ( this.series[ i ].getXAxis() == axis || this.series[ i ].getYAxis() == axis ) {\n series.push( this.series[ i ] );\n }\n }\n\n return series;\n }\n\n /**\n * Determines the maximum and minimum of each axes, based on {@link Graph#getBoundaryAxis}. It is usually called internally, but if the data of series has changed, called this function to make sure that minimum / maximum of the axes are properly updated.\n * @see Graph#getBoundaryAxis\n */\n updateDataMinMaxAxes( usingZValues ) {\n\n var axisvars = [ 'bottom', 'top', 'left', 'right' ],\n axis,\n j,\n l,\n i;\n\n for ( j = 0, l = axisvars.length; j < l; j++ ) {\n\n for ( i = this.axis[ axisvars[ j ] ].length - 1; i >= 0; i-- ) {\n\n axis = this.axis[ axisvars[ j ] ][ i ];\n\n // 25.10.2017. Wait a second, this cannot be real. Even hidden axes must have min max values.\n // The data can be displayed while the axis is hidden\n // I assume this was added to cover another bug, but another approach must be chosen\n if ( !axis.isShown() ) {\n // continue;\n }\n\n //console.log( axisvars[ j ], this.getBoundaryAxisFromSeries( this.axis[ axisvars[ j ] ][ i ], xy, 'min'), this.getBoundaryAxisFromSeries( this.axis[ axisvars[ j ] ][ i ], xy, 'max') );\n\n let min = this.getBoundaryAxis( this.axis[ axisvars[ j ] ][ i ], 'min', usingZValues );\n let max = this.getBoundaryAxis( this.axis[ axisvars[ j ] ][ i ], 'max', usingZValues );\n\n if ( isFinite( min ) ) {\n axis.setMinValueData( min );\n }\n\n if ( isFinite( max ) ) {\n axis.setMaxValueData( max );\n }\n }\n }\n\n }\n\n /**\n * Function that is called from {@link Graph#_applyToAxes}\n * @function\n * @name AxisCallbackFunction\n * @param {Axis} axis - The axis of the function\n * @param {String} type - The type of the axis (left,right,top,bottom)\n * @param params - The params passed in the _applyToAxis function.\n * @see Graph#_applyToAxes\n */\n\n /**\n * Applies a function to axes. The function will be executed once for every axis.\n * If func is a string, the internal function belonging to the axis will be called, with the params array flattened out (in this case, params must be an array).\n * If func is a function, the function will be called with the axis, its type and params as parameters. See {@link AxisCallbackFunction} for more details.\n * @param {(AxisCallbackFunction|String)} func - The function or function name to execute\n * @param params - Extra parameters to pass to the function\n * @param {Boolean} topbottom=false - True to apply to function to top and bottom axes\n * @param {Boolean} leftright=false - True to apply to function to left and right axes\n */\n _applyToAxes( func, params, tb, lr ) {\n\n var ax = [],\n i = 0,\n l;\n\n if ( tb || tb == undefined ) {\n ax.push( 'top' );\n ax.push( 'bottom' );\n }\n if ( lr || lr == undefined ) {\n ax.push( 'left' );\n ax.push( 'right' );\n }\n\n for ( l = ax.length; i < l; i++ ) {\n this._applyToAxis( typeof func ).call( this, ax[ i ], func, params );\n }\n }\n\n /**\n * Axes can be dependant of one another (for instance for unit conversions)\n * Finds and returns all the axes that are linked to a specific axis. Mostly used internally.\n * @param {Axis} axis - The axis that links one or multiple other dependant axes\n * @returns {Axis[]} The list of axes linked to the axis passed as parameter\n */\n findAxesLinkedTo( axis ) {\n\n var axes = [];\n this._applyToAxes( function( a ) {\n\n if ( a.linkedToAxis && a.linkedToAxis.axis == axis ) {\n axes.push( a );\n }\n }, {}, axis instanceof this.getConstructor( 'graph.axis.x' ), axis instanceof this.getConstructor( 'graph.axis.y' ) );\n\n return axes;\n }\n\n _axisHasChanged() {\n this._axesHaveChanged = true;\n }\n\n /**\n * Creates a new serie.\n * If the a serie with the same name exists, returns this serie with update options.\n * The type of the serie is used to fetch the corresponding registered constructor registered with the name \"graph.serie.\", e.g \"line\" will fetch the \"graph.serie.line\" prototype (built-in)
\n * Built-in series types are \"line\", \"contour\", \"zone\" and \"scatter\".\n * @param {String} name - The name of the serie (unique)\n * @param {Object} options - The serie options\n * @param {Type} type - The type of the serie.\n * @returns {Serie} The newly created serie\n */\n newSerie( name, options, type ) {\n\n let serie;\n\n if ( typeof options !== 'object' && !type ) {\n type = options;\n options = {};\n }\n\n if ( !type ) {\n type = Graph.SERIE_LINE;\n }\n\n if ( ( serie = this.getSerie( name ) ) ) {\n return serie;\n }\n\n if ( !( serie = makeSerie( this, name, options, type ) ) ) {\n return;\n }\n\n this.series.push( serie );\n this.emit( 'newSerie', serie );\n return serie;\n }\n\n /**\n * Looks for an existing serie by name or by index and returns it.\n * The index of the serie follows the creation sequence (0 for the first one, 1 for the second one, ...)\n * @param {(String|Number)} name - The name or the index of the serie\n * @returns {Serie}\n */\n getSerie( name ) {\n\n if ( typeof name == 'number' ) {\n return this.series[ name ] || false;\n }\n\n if ( typeof name == 'function' ) {\n name = name();\n }\n\n var i = 0,\n l = this.series.length;\n\n for ( ; i < l; i++ ) {\n\n if ( this.series[ i ].getName() == name || this.series[ i ] == name ) {\n\n return this.series[ i ];\n\n }\n }\n\n return false;\n }\n\n /**\n * Returns all the series\n * @returns {Serie[]} An array of all the series\n */\n getSeries() {\n return this.series;\n }\n\n /**\n * Returns all the series that correspond to one or multiple types\n * @param {...Symbol} type - The serie types to select\n * @returns {Serie[]} An array of all the series\n * @example graph.allSeries( Graph.SERIE_LINE, Graph.SERIE_ZONE );\n */\n allSeries( ...types ) {\n\n return this.series.filter( ( serie ) => {\n return types.include( serie.getType() );\n } );\n }\n\n /**\n * Draws a specific serie\n * @param {Serie} serie - The serie to redraw\n * @param {Boolean} force - Forces redraw even if no data has changed\n */\n drawSerie( serie, force ) {\n\n if ( !serie.draw ) {\n throw new Error( 'Serie has no method draw' );\n }\n\n serie.draw( force );\n }\n\n /**\n * Redraws all visible series\n * @param {Boolean} force - Forces redraw even if no data has changed\n */\n drawSeries( force ) {\n\n if ( !this.width || !this.height ) {\n return;\n }\n\n var i = this.series.length - 1;\n for ( ; i >= 0; i-- ) {\n if ( this.series[ i ].isShown() ) {\n this.drawSerie( this.series[ i ], force );\n }\n }\n }\n\n /**\n * @alias Graph#removeSeries\n */\n resetSeries() {\n this.removeSeries();\n }\n\n /**\n * @alias Graph#removeSeries\n */\n\n killSeries() {\n this.resetSeries();\n }\n\n /**\n * Removes all series from the graph\n */\n removeSeries() {\n while ( this.series[ 0 ] ) {\n this.series[ 0 ].kill( true );\n }\n this.series = [];\n\n if ( this.legend ) {\n this.legend.update();\n }\n }\n\n /**\n * Selects a serie. Only one serie per graph can be selected.\n * @param {Serie} serie - The serie to select\n * @param {String} selectName=\"selected\" - The name of the selection\n */\n selectSerie( serie, selectName ) {\n\n if ( !( typeof serie == 'object' ) ) {\n serie = this.getSerie( serie );\n }\n\n if ( this.selectedSerie == serie && this.selectedSerie.selectionType == selectName ) {\n return;\n }\n\n if ( this.selectedSerie !== serie && this.selectedSerie ) {\n this.unselectSerie( this.selectedSerie );\n }\n\n this.selectedSerie = serie;\n this.triggerEvent( 'onSelectSerie', serie );\n\n serie.select( selectName || 'selected' );\n }\n\n /**\n * Returns the selected serie\n * @returns {(Serie|undefined)} The selected serie\n */\n getSelectedSerie() {\n return this.selectedSerie;\n }\n\n /**\n * Unselects a serie\n * @param {Serie} serie - The serie to unselect\n */\n unselectSerie( serie ) {\n\n if ( !serie.unselect ) {\n return;\n }\n\n serie.unselect();\n this.selectedSerie = false;\n this.triggerEvent( 'onUnselectSerie', serie );\n }\n\n /**\n * Returns all the shapes associated to a serie. Shapes can (but don't have to) be associated to a serie. The position of the shape can then be relative to the same axes as the serie.\n * @param {Serie} serie - The serie containing the shapes\n * @returns {Shape[]} An array containing a list of shapes associated to the serie\n */\n getShapesOfSerie( serie ) {\n\n var shapes = [];\n var i = this.shapes.length - 1;\n\n for ( ; i >= 0; i-- ) {\n\n if ( this.shapes[ i ].getSerie() == serie ) {\n shapes.push( this.shapes[ i ] );\n }\n }\n\n return shapes;\n }\n makeToolbar( toolbarData ) {\n\n var constructor = this.getConstructor( 'graph.toolbar' );\n if ( constructor ) {\n return this.toolbar = new constructor( this, toolbarData );\n } else {\n return util.throwError( 'No constructor exists for toolbar' );\n }\n }\n\n /**\n * Returns all shapes from the graph\n */\n getShapes() {\n return this.shapes || [];\n }\n\n /**\n * Creates a new shape. jsGraph will look for the registered constructor \"graph.shape.\".\n * @param {String} shapeType - The type of the shape\n * @param {Object} [shapeData] - The options passed to the shape creator\n * @param {Boolean} [mute=false] - true to create the shape quietly\n * @param {Object} [shapeProperties] - The native object containing the shape properties in the jsGraph format (caution when using it)\n * @returns {Shape} The created shape\n * @see Graph#getConstructor\n */\n newShape( shapeType, shapeData, mute = false, shapeProperties ) {\n\n this.prevent( false );\n\n if ( !mute ) {\n\n this.emit( 'beforeNewShape', shapeData );\n\n if ( this.prevent( false ) ) {\n return false;\n }\n }\n\n // Backward compatibility\n if ( typeof shapeType == 'object' ) {\n mute = shapeData;\n shapeData = shapeType;\n shapeType = shapeData.type;\n }\n\n shapeData = shapeData || {};\n shapeData._id = util.guid();\n\n var constructor;\n if ( typeof shapeType == 'function' ) {\n constructor = shapeType;\n } else {\n constructor = this.getConstructor( 'graph.shape.' + shapeType );\n }\n\n if ( !constructor ) {\n return util.throwError( 'No constructor for this shape' );\n }\n\n var shape = new constructor( this, shapeData );\n\n if ( !shape ) {\n return util.throwError( 'Failed to construct shape.' );\n }\n\n shape.type = shapeType;\n shape.graph = this;\n shape._data = shapeData;\n\n if ( shapeData.properties !== undefined ) {\n shape.setProperties( shapeData.properties );\n }\n\n shape.init( this, shapeProperties );\n\n if ( shapeData.props !== undefined ) {\n for ( var i in shapeData.props ) {\n shape.setProp( i, shapeData.props[ i ] );\n }\n }\n\n if ( shapeData.position ) {\n\n for ( var i = 0, l = shapeData.position.length; i < l; i++ ) {\n shape.setPosition( new GraphPosition( shapeData.position[ i ] ), i );\n }\n }\n\n /* Setting shape properties */\n if ( shapeData.fillColor !== undefined ) {\n shape.setFillColor( shapeData.fillColor );\n }\n\n if ( shapeData.fillOpacity !== undefined ) {\n shape.setFillOpacity( shapeData.fillOpacity );\n }\n\n if ( shapeData.strokeColor !== undefined ) {\n shape.setStrokeColor( shapeData.strokeColor );\n }\n\n if ( shapeData.strokeWidth !== undefined ) {\n shape.setStrokeWidth( shapeData.strokeWidth );\n }\n\n if ( shapeData.layer !== undefined ) {\n shape.setLayer( shapeData.layer );\n }\n\n if ( shapeData.locked == true ) {\n shape.lock();\n }\n\n if ( shapeData.movable == true ) {\n shape.movable();\n }\n\n if ( shapeData.selectable == true ) {\n shape.selectable();\n }\n\n if ( shapeData.resizable == true ) {\n shape.resizable();\n }\n\n if ( shapeData.attributes !== undefined ) {\n shape.setProp( 'attributes', shapeData.attributes );\n }\n\n if ( shapeData.handles !== undefined ) {\n shape.setProp( 'handles', shapeData.handles );\n }\n\n if ( shapeData.selectOnMouseDown !== undefined ) {\n shape.setProp( 'selectOnMouseDown', true );\n }\n\n if ( shapeData.selectOnClick !== undefined ) {\n shape.setProp( 'selectOnClick', true );\n }\n\n if ( shapeData.transforms !== undefined && Array.isArray( shapeData.transforms ) ) {\n\n shapeData.transforms.forEach( ( {\n\n type,\n value\n\n } ) => {\n\n shape.addTransform( type, value );\n\n } );\n }\n\n if ( shapeData.highlightOnMouseOver !== undefined ) {\n shape.setProp( 'highlightOnMouseOver', true );\n }\n\n if ( shapeData.labelEditable ) {\n shape.setProp( 'labelEditable', shapeData.labelEditable );\n }\n\n if ( shapeData.labels && !shapeData.label ) {\n shapeData.label = shapeData.labels;\n }\n\n if ( shapeData.label !== undefined ) {\n\n if ( !Array.isArray( shapeData.label ) ) {\n shapeData.label = [ shapeData.label ];\n }\n\n for ( var i = 0, l = shapeData.label.length; i < l; i++ ) {\n\n shape.showLabel( i );\n shape.setLabelText( shapeData.label[ i ].text, i );\n shape.setLabelPosition( shapeData.label[ i ].position, i );\n shape.setLabelColor( shapeData.label[ i ].color || 'black', i );\n shape.setLabelSize( shapeData.label[ i ].size, i );\n shape.setLabelAngle( shapeData.label[ i ].angle || 0, i );\n shape.setLabelBaseline( shapeData.label[ i ].baseline || 'no-change', i );\n shape.setLabelAnchor( shapeData.label[ i ].anchor || 'start', i );\n shape.setLabelBackgroundColor( shapeData.label[ i ].backgroundColor || 'transparent', i );\n shape.setLabelBackgroundOpacity( shapeData.label[ i ].backgroundOpacity || 1, i );\n\n }\n }\n\n if ( shapeData.serie ) {\n shape.setSerie( this.getSerie( shapeData.serie ) );\n }\n shape.createHandles();\n shape.applyStyle();\n\n this.shapes.push( shape );\n\n if ( !mute ) {\n this.emit( 'newShape', shape, shapeData );\n }\n\n return shape;\n }\n\n /**\n * Creates a new position. Arguments are passed to the position constructor\n * @param {...*} varArgs\n * @see Position\n */\n newPosition( varArgs ) {\n\n return new GraphPosition( ...arguments );\n\n // 18 September 2016 Norman: What is that ?\n //Array.prototype.unshift.call( arguments, null );\n //return new( Function.prototype.bind.apply( GraphPosition, arguments ) )();\n }\n\n /**\n * Redraws all shapes. To be called if their definitions have changed\n */\n redrawShapes() {\n\n //this.graphingZone.removeChild(this.shapeZone);\n for ( var i = 0, l = this.shapes.length; i < l; i++ ) {\n this.shapes[ i ].redraw();\n }\n //this.graphingZone.insertBefore(this.shapeZone, this.axisGroup);\n }\n\n /**\n * Removes all shapes from the graph\n */\n removeShapes() {\n for ( var i = 0, l = this.shapes.length; i < l; i++ ) {\n if ( this.shapes[ i ] && this.shapes[ i ].kill ) {\n this.shapes[ i ].kill( true );\n }\n }\n this.shapes = [];\n }\n\n /**\n * Selects a shape\n * @param {Shape} shape - The shape to select\n * @param {Boolean} mute - Select the shape quietly\n */\n selectShape( shape, mute ) {\n\n // Already selected. Returns false\n\n if ( !shape ) {\n return;\n }\n\n if ( this.selectedShapes.indexOf( shape ) > -1 ) {\n return false;\n }\n\n if ( !shape.isSelectable() ) {\n return false;\n }\n\n if ( !mute ) {\n this.emit( 'beforeShapeSelect', shape );\n }\n\n if ( this.prevent( false ) ) {\n return;\n }\n\n if ( this.selectedShapes.length > 0 && this.options.shapesUniqueSelection ) { // Only one selected shape at the time\n\n this.unselectShapes( mute );\n }\n\n shape._select( mute );\n this.selectedShapes.push( shape );\n\n if ( !mute ) {\n this.emit( 'shapeSelect', shape );\n }\n }\n\n getSelectedShapes() {\n return this.selectedShapes;\n }\n\n /**\n * Unselects a shape\n * @param {Shape} shape - The shape to unselect\n * @param {Boolean} mute - Unselect the shape quietly\n */\n unselectShape( shape, mute ) {\n\n if ( this.selectedShapes.indexOf( shape ) == -1 ) {\n return;\n }\n\n if ( !mute ) {\n this.emit( 'beforeShapeUnselect', shape );\n }\n\n if ( this.cancelUnselectShape ) {\n this.cancelUnselectShape = false;\n return;\n }\n\n shape._unselect();\n\n this.selectedShapes.splice( this.selectedShapes.indexOf( shape ), 1 );\n\n if ( !mute ) {\n this.emit( 'shapeUnselect', shape );\n }\n\n }\n\n /**\n * Unselects all shapes\n * @param {Boolean} [ mute = false ] - Mutes all unselection events\n * @return {Graph} The current graph instance\n */\n unselectShapes( mute ) {\n\n while ( this.selectedShapes[ 0 ] ) {\n this.unselectShape( this.selectedShapes[ 0 ], mute );\n }\n\n return this;\n }\n\n _removeShape( shape ) {\n this.shapes.splice( this.shapes.indexOf( shape ), 1 );\n }\n\n appendShapeToDom( shape ) {\n\n if ( shape.isHTML() ) {\n this.wrapper.insertBefore( shape._dom, this.dom );\n }\n\n this.getLayer( shape.getLayer(), 'shape' ).appendChild( shape.group );\n }\n\n removeShapeFromDom( shape ) {\n\n if ( shape.isHTML() ) {\n this.wrapper.removeChild( shape._dom );\n }\n\n this.getLayer( shape.getLayer(), 'shape' ).removeChild( shape.group );\n }\n\n appendSerieToDom( serie ) {\n this.getLayer( serie.getLayer(), 'serie' ).appendChild( serie.groupMain );\n }\n\n removeSerieFromDom( serie ) {\n this.getLayer( serie.getLayer(), 'serie' ).removeChild( serie.groupMain );\n }\n\n getLayer( layer, mode ) {\n\n if ( !this.layers[ layer ] ) {\n\n this.layers[ layer ] = [];\n\n this.layers[ layer ][ 0 ] = document.createElementNS( Graph.ns, 'g' );\n this.layers[ layer ][ 0 ].setAttribute( 'data-layer', layer );\n this.layers[ layer ][ 1 ] = document.createElementNS( Graph.ns, 'g' );\n this.layers[ layer ][ 2 ] = document.createElementNS( Graph.ns, 'g' );\n\n this.layers[ layer ][ 0 ].appendChild( this.layers[ layer ][ 1 ] );\n this.layers[ layer ][ 0 ].appendChild( this.layers[ layer ][ 2 ] );\n\n var i = 1,\n prevLayer;\n\n while ( !( prevLayer = this.layers[ layer - i ] ) && layer - i >= 0 ) {\n i++;\n }\n\n if ( !prevLayer ) {\n\n this.plotGroup.insertBefore( this.layers[ layer ][ 0 ], this.plotGroup.firstChild );\n\n } else if ( prevLayer.nextSibling ) {\n\n this.plotGroup.insertBefore( this.layers[ layer ][ 0 ], prevLayer.nextSibling );\n\n } else {\n\n this.plotGroup.appendChild( this.layers[ layer ][ 0 ] );\n\n }\n }\n\n return this.layers[ layer ][ mode == 'shape' ? 2 : 1 ];\n\n }\n\n focus() {\n this.wrapper.focus();\n }\n\n elementMoving( movingElement ) {\n this.bypassHandleMouse = movingElement;\n }\n\n stopElementMoving( element ) {\n\n if ( element && element == this.bypassHandleMouse ) {\n this.bypassHandleMouse = false;\n } else if ( !element ) {\n this.bypassHandleMouse = false;\n }\n }\n\n _makeClosingLines() {\n\n this.closingLines = {};\n var els = [ 'top', 'bottom', 'left', 'right' ],\n i = 0,\n l = 4;\n for ( ; i < l; i++ ) {\n var line = document.createElementNS( Graph.ns, 'line' );\n line.setAttribute( 'stroke', this.options.closeColor );\n line.setAttribute( 'shape-rendering', 'crispEdges' );\n line.setAttribute( 'stroke-linecap', 'square' );\n line.setAttribute( 'display', 'none' );\n this.closingLines[ els[ i ] ] = line;\n this.graphingZone.appendChild( line );\n }\n }\n\n isActionAllowed( e, action ) {\n\n if ( action.type !== e.type && ( action.type !== undefined || e.type !== 'mousedown' ) && !( ( e.type === 'wheel' || e.type === 'mousewheel' ) && action.type == 'mousewheel' ) ) {\n return;\n }\n\n if ( action.enabled && ( typeof action.enabled == 'function' ? !action.enabled( this ) : !action.enabled ) ) {\n return;\n }\n\n if ( action.key ) {\n\n if ( action.key !== e.keyCode ) {\n\n let keyCheck = {\n 'backspace': 8,\n 'enter': 13,\n 'tab': 9,\n 'shift': 16,\n 'ctrl': 17,\n 'alt': 18,\n 'pause': 19,\n 'escape': 27,\n 'up': 33,\n 'down': 34,\n 'left': 37,\n 'right': 39\n };\n\n if ( keyCheck[ action.key ] !== e.keyCode ) {\n return;\n }\n }\n }\n\n if ( action.shift === undefined ) {\n action.shift = false;\n }\n\n if ( action.ctrl === undefined ) {\n action.ctrl = false;\n }\n\n if ( action.meta === undefined ) {\n action.meta = false;\n }\n\n if ( action.alt === undefined ) {\n action.alt = false;\n }\n\n return ( e.shiftKey == action.shift && e.ctrlKey == action.ctrl && e.metaKey == action.meta && e.altKey == action.alt );\n }\n\n forcePlugin( plugin ) {\n this.forcedPlugin = plugin;\n }\n\n unforcePlugin() {\n this.forcedPlugin = false;\n }\n\n _pluginsExecute( funcName, ...args ) {\n\n //\t\t\tArray.prototype.splice.apply(args, [0, 0, this]);\n\n for ( var i in this.plugins ) {\n\n if ( this.plugins[ i ] && this.plugins[ i ][ funcName ] ) {\n\n this.plugins[ i ][ funcName ].apply( this.plugins[ i ], args );\n\n }\n }\n }\n\n _pluginExecute( which, func, args ) {\n\n //Array.prototype.splice.apply( args, [ 0, 0, this ] );\n if ( !which ) {\n return;\n }\n\n if ( this.plugins[ which ] && this.plugins[ which ][ func ] ) {\n\n this.plugins[ which ][ func ].apply( this.plugins[ which ], args );\n return true;\n }\n\n }\n\n pluginYieldActiveState() {\n this.activePlugin = false;\n }\n\n _serieExecute( serie, func, args ) {\n\n if ( typeof serie !== 'object' ) {\n serie = this.getSerie( serie );\n }\n\n if ( typeof serie[ func ] == 'function' ) {\n serie.apply( serie, args );\n }\n }\n _pluginsInit() {\n\n var constructor, pluginName, pluginOptions;\n\n for ( var i in this.options.plugins ) {\n\n pluginName = i;\n pluginOptions = this.options.plugins[ i ];\n\n constructor = this.getConstructor( 'graph.plugin.' + pluginName );\n\n if ( constructor ) {\n\n //var options = util.extend( true, {}, constructor.defaults(), pluginOptions );\n this.plugins[ pluginName ] = new constructor( pluginOptions );\n\n util.mapEventEmission( this.plugins[ pluginName ].options, this.plugins[ pluginName ] );\n this.plugins[ pluginName ].init( this, pluginOptions );\n\n } else {\n util.throwError( 'Plugin \"' + pluginName + '\" has not been registered' );\n }\n }\n }\n\n /**\n * Returns an initialized plugin\n * @param {String} pluginName\n * @returns {Plugin} The plugin which name is \n */\n getPlugin( pluginName ) {\n var plugin = this.plugins[ pluginName ];\n\n if ( !plugin ) {\n return util.throwError( 'Plugin \"' + pluginName + '\" has not been loaded or properly registered' );\n }\n\n return plugin;\n }\n triggerEvent() {\n var func = arguments[ 0 ];\n /*,\n args = Array.prototype.splice.apply( arguments, [ 0, 1 ] );\n */\n if ( typeof this.options[ func ] == 'function' ) {\n return this.options[ func ].apply( this, arguments );\n }\n }\n\n /**\n * Creates a legend. Only one legend is allowed per graph\n * @param {Object} options - The legend options\n */\n makeLegend( options ) {\n\n if ( this.legend ) {\n return this.legend;\n }\n\n var constructor = this.getConstructor( 'graph.legend' );\n if ( constructor ) {\n this.legend = new constructor( this, options );\n } else {\n return util.throwError( 'Graph legend is not available as it has not been registered' );\n }\n\n return this.legend;\n }\n\n /**\n * Redraws the legend if it exists\n * @param {Boolean} [ onlyIfRequired = false ] ```true``` to redraw the legend only when it actually needs to be updated\n * @return {Graph} The graph instance\n */\n updateLegend( onlyIfRequired = false ) {\n\n if ( !this.legend ) {\n return;\n }\n\n this.legend.update( onlyIfRequired );\n return this;\n }\n\n /**\n * @returns {Legend} The legend item\n */\n getLegend() {\n if ( !this.legend ) {\n return;\n }\n\n return this.legend;\n\n }\n\n requireLegendUpdate() {\n\n if ( !this.legend ) {\n return;\n }\n\n this.legend.requireDelayedUpdate();\n }\n\n orthogonalProjectionSetup() {\n\n this.options.zAxis = util.extend( true, {\n maxZ: 10,\n minZ: 0,\n shiftX: -25,\n shiftY: -15,\n xAxis: this.getXAxis(),\n yAxis: this.getYAxis()\n } );\n }\n\n orthogonalProjectionUpdate() {\n\n if ( !this.zAxis ) {\n this.zAxis = {\n g: document.createElementNS( Graph.ns, 'g' ),\n l: document.createElementNS( Graph.ns, 'line' )\n };\n\n this.zAxis.g.appendChild( this.zAxis.l );\n this.groupGrids.appendChild( this.zAxis.g );\n }\n\n let refAxisX = this.options.zAxis.xAxis;\n let refAxisY = this.options.zAxis.yAxis;\n\n var x0 = refAxisX.getMinPx();\n var y0 = refAxisY.getMinPx();\n\n var dx = refAxisX.getZProj( this.options.zAxis.maxZ );\n var dy = refAxisY.getZProj( this.options.zAxis.maxZ );\n\n this.zAxis.l.setAttribute( 'stroke', 'black' );\n this.zAxis.l.setAttribute( 'x1', x0 );\n this.zAxis.l.setAttribute( 'x2', x0 + dx );\n this.zAxis.l.setAttribute( 'y1', y0 );\n this.zAxis.l.setAttribute( 'y2', y0 + dy );\n\n this.updateDataMinMaxAxes( true );\n\n var sort = this.series.map( ( serie ) => {\n return [ serie.getZPos(), serie ];\n } );\n\n sort.sort( ( sa, sb ) => {\n return sb[ 0 ] - sa[ 0 ];\n } );\n\n let i = 0;\n sort.forEach( s => {\n s[ 1 ].setLayer( i );\n this.appendSerieToDom( s[ 1 ] );\n i++;\n } );\n\n this.drawSeries( true );\n }\n\n /**\n * Kills the graph\n **/\n kill() {\n this.wrapper.removeChild( this.dom );\n }\n _removeSerie( serie ) {\n this.series.splice( this.series.indexOf( serie ), 1 );\n this._pluginsExecute( 'serieRemoved', serie );\n }\n contextListen( target, menuElements, callback ) {\n\n if ( this.options.onContextMenuListen ) {\n return this.options.onContextMenuListen( target, menuElements, callback );\n }\n }\n lockShapes() {\n this.shapesLocked = true;\n\n // Removes the current actions of the shapes\n for ( var i = 0, l = this.shapes.length; i < l; i++ ) {\n this.shapes[ i ].moving = false;\n this.shapes[ i ].resizing = false;\n }\n }\n unlockShapes() {\n //\t\tconsole.log('unlock');\n this.shapesLocked = false;\n }\n prevent( arg ) {\n var curr = this.prevented;\n if ( arg != -1 ) {\n this.prevented = ( arg == undefined ) || arg;\n }\n return curr;\n }\n _getXY( e ) {\n\n var x = e.clientX,\n y = e.clientY;\n\n var pos = this.offsetCached || util.getOffset( this.wrapper );\n\n x -= pos.left;\n y -= pos.top;\n\n return {\n x: x,\n y: y\n };\n }\n _resize() {\n\n if ( !this.width || !this.height ) {\n return;\n }\n\n this.getDrawingWidth();\n this.getDrawingHeight();\n\n this.sizeSet = true;\n this.dom.setAttribute( 'width', this.width );\n this.dom.setAttribute( 'height', this.height );\n this.domTitle.setAttribute( 'x', this.width / 2 );\n\n this._sizeChanged = true;\n\n if ( this.drawn ) {\n this.requireLegendUpdate();\n this.draw( true );\n }\n\n }\n\n updateGraphingZone() {\n util.setAttributeTo( this.graphingZone, {\n 'transform': 'translate(' + this.options.paddingLeft + ', ' + this.options.paddingTop + ')'\n } );\n\n this._sizeChanged = true;\n }\n\n // We have to proxy the methods in case they are called anonymously\n getDrawingSpaceWidth() {\n return () => this.drawingSpaceWidth;\n }\n\n getDrawingSpaceHeight() {\n return () => this.drawingSpaceHeight;\n }\n\n getDrawingSpaceMinX() {\n return () => this.drawingSpaceMinX;\n }\n\n getDrawingSpaceMinY() {\n return () => this.drawingSpaceMinY;\n }\n\n getDrawingSpaceMaxX() {\n return () => this.drawingSpaceMaxX;\n }\n\n getDrawingSpaceMaxY() {\n return () => this.drawingSpaceMaxY;\n }\n\n /**\n * Enables the line tracking\n * @param {Object|Boolean} options - Defines the tracking behavior. If a boolean, simply enables or disables the existing tracking.\n */\n trackingLine( options ) {\n\n var self = this;\n\n if ( typeof options === 'boolean' ) {\n\n if ( this.options.trackingLine ) {\n this.options.trackingLine.enable = options;\n }\n return;\n }\n\n if ( options ) {\n this.options.trackingLine = options;\n }\n\n options.series = options.series || [];\n options.enable = options.enable === undefined ? true : !!options.enable;\n\n // Individual tracking\n if ( options.mode == 'individual' ) {\n\n if ( options.series ) {\n\n if ( !Array.isArray( options.series ) ) {\n\n if ( options.series == 'all' ) {\n\n options.series = this.series.map( ( serie ) => ( {\n serie: serie\n } ) );\n\n } else {\n\n options.series = [ options.series ];\n }\n }\n\n options.series.forEach( ( sOptions ) => {\n\n if ( typeof sOptions.serie !== 'object' ) {\n\n if ( typeof sOptions !== 'object' ) {\n throw new Error( 'Misuse of the trackingLine() method. Each serie must be an object with the serie property: { series: [ { serie: jsGraphSerie, options: { ... someOptions } } ] }' );\n }\n\n sOptions.serie = this.getSerie( sOptions.serie );\n }\n\n if ( !sOptions.serie ) {\n return;\n }\n\n self.addSerieToTrackingLine( sOptions.serie, sOptions );\n\n } );\n }\n } else {\n\n options.series.forEach( ( serie ) => {\n serie.serie.disableTracking();\n } );\n }\n\n if ( options.noLine ) {\n return;\n }\n\n if ( !this.trackingObject ) { // Avoid multiple creation of tracking lines\n\n // Creates a new shape called trackingLine, in the first layer (below everything)\n this.trackingObject = this.newShape( 'line', util.extend( true, {\n position: [ {\n y: 'min'\n }, {\n y: 'max'\n } ],\n stroke: 'black',\n layer: -1\n }, options.trackingLineShapeOptions ) );\n }\n\n this.trackingObject.draw();\n\n return this.trackingObject;\n }\n\n addSerieToTrackingLine( serie, options ) {\n\n if ( !this.options.trackingLine ) {\n\n this.trackingLine( {\n mode: 'individual'\n } );\n }\n\n this.options.trackingLine.series.forEach( ( serieO, index ) => {\n if ( serieO.serie == serie ) {\n this.options.trackingLine.series.splice( index, 1 );\n }\n } );\n\n this.options.trackingLine.series.push( Object.assign( {\n serie: serie\n }, options ) );\n\n serie.enableTracking( ( serie, index, x, y ) => {\n\n if ( this.options.trackingLine.enable ) {\n\n if ( index ) {\n\n if ( this.trackingObject ) {\n\n this.trackingObject.show();\n this.trackingObject.getPosition( 0 ).x = index.trueX; //serie.getData()[ 0 ][ index.closestIndex * 2 ];\n this.trackingObject.getPosition( 1 ).x = index.trueX; //serie.getData()[ 0 ][ index.closestIndex * 2 ];\n this.trackingObject.redraw();\n }\n\n serie._trackingLegend = _trackingLegendSerie( this, {\n serie: serie\n }, x, y, serie._trackingLegend, options.textMethod ? options.textMethod : ( output ) => {\n\n for ( var i in output ) {\n return output[ i ].serie.serie.getName() + ': ' + output[ i ].serie.serie.getYAxis().valueToHtml( output[ i ].yValue );\n }\n\n }, index.trueX );\n\n if ( serie._trackingLegend ) {\n serie._trackingLegend.style.display = 'block';\n }\n }\n }\n }, ( serie ) => {\n\n if ( this.trackingObject ) {\n this.trackingObject.hide();\n }\n\n if ( serie.trackingShape ) {\n serie.trackingShape.hide();\n }\n\n if ( serie._trackingLegend ) {\n serie._trackingLegend.style.display = 'none';\n }\n\n serie._trackingLegend = _trackingLegendSerie( this, {\n\n serie: serie\n\n }, false, false, serie._trackingLegend, false, false );\n\n } );\n\n }\n\n /**\n * Pass here the katex.render method to be used later\n * @param {Function} renderer - katexRendered - renderer\n * @return {Graph} The current graph instance\n */\n setKatexRenderer( renderer ) {\n this._katexRenderer = renderer;\n }\n\n hasKatexRenderer() {\n return !!this._katexRenderer;\n }\n\n renderWithKatex( katexValue, katexElement ) {\n\n if ( this._katexRenderer ) {\n\n if ( katexElement ) {\n katexElement.removeChild( katexElement.firstChild );\n } else {\n katexElement = document.createElementNS( Graph.ns, 'foreignObject' );\n }\n\n let div = document.createElement( 'div' );\n\n katexElement.appendChild( div );\n this._katexRenderer( katexValue, div );\n\n return katexElement;\n }\n\n return false;\n }\n\n /**\n * Returns a graph created from a schema\n * @param {Object} schema - The schema (see https://github.com/cheminfo/json-chart/blob/master/chart-schema.json)\n * @param {HTMLElement} wrapper - The wrapping element\n * @returns {Graph} Newly created graph\n */\n static fromJSON( schema, wrapper ) {\n\n let graph,\n options = {},\n axes = {\n left: [],\n top: [],\n right: [],\n bottom: []\n },\n style;\n\n if ( schema.title ) {\n options.title = schema.title;\n }\n\n if ( schema.axis ) {\n\n schema.axis.forEach( function( schemaAxis ) {\n\n if ( !schemaAxis.type ) {\n util.throwError( 'Axis type is required (top, bottom, left or right)' );\n }\n\n var axisOptions = {};\n if ( schemaAxis.label ) {\n axisOptions.labelValue = schemaAxis.label;\n }\n\n if ( schemaAxis.unit !== undefined ) {\n axisOptions.unit = schemaAxis.unit;\n }\n\n if ( schemaAxis.unitWrapperAfter !== undefined ) {\n axisOptions.unitWrapperAfter = schemaAxis.unitWrapperAfter;\n }\n\n if ( schemaAxis.unitWrapperBefore !== undefined ) {\n axisOptions.unitWrapperBefore = schemaAxis.unitWrapperBefore;\n }\n\n if ( schemaAxis.min !== undefined ) {\n axisOptions.forcedMin = schemaAxis.min;\n }\n\n if ( schemaAxis.max !== undefined ) {\n axisOptions.forcedMax = schemaAxis.max;\n }\n\n if ( schemaAxis.flip !== undefined ) {\n axisOptions.flipped = schemaAxis.flip;\n }\n\n axes[ schemaAxis.type ].push( axisOptions );\n schemaAxis._jsGraphIndex = axes[ schemaAxis.type ].length - 1;\n\n } );\n }\n\n graph = new Graph( wrapper, options, axes );\n\n if ( schema.width ) {\n graph.setWidth( schema.width );\n }\n\n if ( schema.height ) {\n graph.setHeight( schema.width );\n }\n\n graph._resize();\n\n if ( schema.data ) {\n\n schema.data.forEach( function( schemaSerie ) {\n\n var serieType = schemaSerie.type,\n serie,\n serieOptions = {},\n serieAxis;\n\n let waveform;\n\n switch ( schemaSerie.type ) {\n\n case 'bar':\n util.throwError( 'Bar charts not supported' );\n serieType = false;\n break;\n\n case 'color':\n serieType = Graph.SERIE_LINE_COLORED;\n break;\n\n case 'scatter':\n serieType = Graph.SERIE_SCATTER;\n break;\n\n case 'box':\n serieType = Graph.SERIE_BOX;\n\n if ( schemaSerie.orientation == 'x' || schemaSerie.orientation == 'y' ) {\n serieOptions.orientation = schemaSerie.orientation;\n }\n break;\n\n default:\n serieType = Graph.SERIE_LINE;\n break;\n }\n\n if ( serieType !== Graph.SERIE_BOX ) {\n waveform = Graph.newWaveform();\n }\n\n if ( !serieType ) {\n util.throwError( 'No valid serie type was found' );\n return;\n }\n\n serie = graph.newSerie( schemaSerie.id || schemaSerie.label || util.guid(), serieOptions, serieType );\n\n if ( schemaSerie.lineStyle ) {\n\n let lineStyle;\n\n if ( Array.isArray( lineStyle ) ) {\n lineStyle = {\n unselected: lineStyle\n };\n }\n\n Object.entries( lineStyle ).forEach( ( [ styleName, style ] ) => {\n\n var styleSerie = {};\n\n switch ( serieType ) {\n\n case Graph.SERIE_LINE:\n if ( style.lineWidth !== undefined ) {\n styleSerie.lineWidth = style.lineWidth;\n }\n\n if ( style.color !== undefined ) {\n styleSerie.lineColor = style.color;\n }\n\n if ( style.lineStyle ) {\n styleSerie.lineStyle = style.lineStyle;\n }\n\n serie.setStyle( styleSerie, styleName );\n break;\n }\n } );\n }\n\n let defaultStyle = {};\n let defaultStyles = {};\n\n if ( schemaSerie.defaultStyle ) {\n defaultStyle = schemaSerie.defaultStyle;\n }\n\n if ( schemaSerie.defaultStyles ) {\n defaultStyles = schemaSerie.defaultStyles;\n }\n\n if ( schemaSerie.styles ) {\n\n let individualStyles;\n\n if ( Array.isArray( schemaSerie.styles ) ) {\n individualStyles = {\n unselected: schemaSerie.styles\n };\n } else {\n individualStyles = schemaSerie.styles;\n }\n\n let styleNames = new Set( Object.keys( defaultStyles ).concat( Object.keys( individualStyles ) ) );\n\n styleNames.forEach( ( styleName ) => {\n\n var styleSerie = {};\n let style = [],\n styles;\n\n if ( individualStyles && individualStyles[ styleName ] ) {\n\n style = individualStyles[ styleName ];\n\n if ( !Array.isArray( style ) ) {\n style = [ style ];\n }\n\n styles = style.map( function( eachStyleElement ) {\n\n switch ( serieType ) {\n\n case Graph.SERIE_LINE:\n\n return {\n type: eachStyleElement.shape,\n zoom: eachStyleElement.zoom,\n strokeWidth: eachStyleElement.lineWidth,\n strokeColor: eachStyleElement.lineColor,\n fillColor: eachStyleElement.color,\n points: eachStyleElement.points\n };\n\n break;\n\n case Graph.SERIE_BOX:\n\n return eachStyleElement;\n\n break;\n\n case Graph.SERIE_SCATTER:\n return eachStyleElement;\n\n break;\n }\n } );\n }\n\n switch ( serieType ) {\n\n case Graph.SERIE_LINE:\n\n serie.setMarkers( styles, styleName );\n break;\n\n case Graph.SERIE_SCATTER:\n serie.setStyle( Object.assign( {}, defaultScatterStyle, defaultStyle, defaultStyles[ styleName ] || {} ), styles, styleName );\n break;\n\n case Graph.SERIE_BOX:\n\n serie.setStyle( styles[ 0 ], styleName || 'unselected' );\n break;\n }\n } );\n }\n\n if ( schemaSerie.color && serieType == Graph.SERIE_LINE_COLORED ) {\n serie.setColors( schemaSerie.color );\n }\n\n if ( serieType !== Graph.SERIE_BOX ) {\n waveform.setData( schemaSerie.y, schemaSerie.x );\n }\n\n if ( !serie ) {\n return;\n }\n\n let errorBarsXAbove = [],\n errorBarsXBelow = [],\n errorBarsYAbove = [],\n errorBarsYBelow = [],\n\n errorBoxesXAbove = [],\n errorBoxesXBelow = [],\n errorBoxesYAbove = [],\n errorBoxesYBelow = [];\n\n if ( waveform !== undefined ) {\n var errors = [];\n if ( schemaSerie.errorX ) {\n\n for ( var i = 0, l = schemaSerie.errorX.length; i < l; i++ ) {\n\n if ( Array.isArray( schemaSerie.errorX[ i ] ) ) {\n\n errorBarsXAbove.push( schemaSerie.errorX[ i ][ 0 ] );\n errorBarsXBelow.push( schemaSerie.errorX[ i ][ 1 ] );\n } else {\n errorBarsXAbove.push( schemaSerie.errorX[ i ] );\n errorBarsXBelow.push( schemaSerie.errorX[ i ] );\n }\n }\n\n } else if ( schemaSerie.errorBarX || schemaSerie.errorBoxX ) {\n\n if ( schemaSerie.errorBarX ) {\n\n for ( var i = 0, l = schemaSerie.errorBarX.length; i < l; i++ ) {\n\n if ( Array.isArray( schemaSerie.errorBarX[ i ] ) ) {\n\n errorBarsXAbove.push( schemaSerie.errorBarX[ i ][ 0 ] );\n errorBarsXBelow.push( schemaSerie.errorBarX[ i ][ 1 ] );\n } else {\n errorBarsXAbove.push( schemaSerie.errorBarX[ i ] );\n errorBarsXBelow.push( schemaSerie.errorBarX[ i ] );\n }\n }\n }\n\n if ( schemaSerie.errorBoxX ) {\n\n for ( var i = 0, l = schemaSerie.errorBoxX.length; i < l; i++ ) {\n\n if ( Array.isArray( schemaSerie.errorBoxX[ i ] ) ) {\n\n errorBoxesXAbove.push( schemaSerie.errorBoxX[ i ][ 0 ] );\n errorBoxesXBelow.push( schemaSerie.errorBoxX[ i ][ 1 ] );\n } else {\n errorBoxesXAbove.push( schemaSerie.errorBoxX[ i ] );\n errorBoxesXBelow.push( schemaSerie.errorBoxX[ i ] );\n }\n }\n }\n }\n\n if ( schemaSerie.errorY ) {\n\n for ( var i = 0, l = schemaSerie.errorY.length; i < l; i++ ) {\n\n if ( Array.isArray( schemaSerie.errorY[ i ] ) ) {\n\n errorBarsYAbove.push( schemaSerie.errorY[ i ][ 0 ] );\n errorBarsYBelow.push( schemaSerie.errorY[ i ][ 1 ] );\n } else {\n errorBarsYAbove.push( schemaSerie.errorY[ i ] );\n errorBarsYBelow.push( schemaSerie.errorY[ i ] );\n }\n }\n } else if ( schemaSerie.errorBarY || schemaSerie.errorBoxY ) {\n\n if ( schemaSerie.errorBarY ) {\n\n for ( var i = 0, l = schemaSerie.errorBarY.length; i < l; i++ ) {\n\n if ( Array.isArray( schemaSerie.errorBarY[ i ] ) ) {\n\n errorBarsYAbove.push( schemaSerie.errorBarY[ i ][ 0 ] );\n errorBarsYBelow.push( schemaSerie.errorBarY[ i ][ 1 ] );\n } else {\n errorBarsYAbove.push( schemaSerie.errorBarY[ i ] );\n errorBarsYBelow.push( schemaSerie.errorBarY[ i ] );\n }\n }\n }\n\n if ( schemaSerie.errorBoxY ) {\n\n for ( var i = 0, l = schemaSerie.errorBoxY.length; i < l; i++ ) {\n\n if ( Array.isArray( schemaSerie.errorBoxY[ i ] ) ) {\n\n errorBoxesYAbove.push( schemaSerie.errorBoxY[ i ][ 0 ] );\n errorBoxesYBelow.push( schemaSerie.errorBoxY[ i ][ 1 ] );\n } else {\n errorBoxesYAbove.push( schemaSerie.errorBoxY[ i ] );\n errorBoxesYBelow.push( schemaSerie.errorBoxY[ i ] );\n }\n }\n }\n }\n\n style = {};\n if ( errorBarsXAbove.length > 0 ) {\n waveform.setErrorBarXAbove( Graph.newWaveform( errorBarsXAbove ) );\n style.right = {};\n }\n if ( errorBarsXBelow.length > 0 ) {\n waveform.setErrorBarXAbove( Graph.newWaveform( errorBarsXAbove ) );\n style.left = {};\n }\n if ( errorBarsYAbove.length > 0 ) {\n waveform.setErrorBarXAbove( Graph.newWaveform( errorBarsYAbove ) );\n style.top = {};\n }\n if ( errorBarsYBelow.length > 0 ) {\n waveform.setErrorBarXAbove( Graph.newWaveform( errorBarsYAbove ) );\n style.bottom = {};\n }\n\n serie.setErrorBarStyle( style );\n\n style = {};\n if ( errorBoxesXAbove.length > 0 ) {\n waveform.setErrorBoxXAbove( Graph.newWaveform( errorBoxesXAbove ) );\n style.right = {};\n }\n if ( errorBoxesXBelow.length > 0 ) {\n waveform.setErrorBoxXBelow( Graph.newWaveform( errorBoxesXBelow ) );\n style.left = {};\n }\n if ( errorBoxesYAbove.length > 0 ) {\n waveform.setErrorBoxAbove( Graph.newWaveform( errorBoxesYAbove ) );\n style.top = {};\n }\n if ( errorBoxesYBelow.length > 0 ) {\n waveform.setErrorBoxBelow( Graph.newWaveform( errorBoxesYBelow ) );\n style.bottom = {};\n }\n serie.setErrorBoxStyle( style );\n }\n\n if ( schema.axis ) {\n serieAxis = schema.axis[ schemaSerie.xAxis ];\n\n if ( !serieAxis || ( serieAxis.type !== 'top' && serieAxis.type !== 'bottom' ) ) {\n util.warn( 'No x axis found. Setting automatically' );\n serie.setXAxis( graph.getXAxis( 0 ) );\n } else {\n if ( serieAxis.type == 'top' ) {\n serie.setXAxis( graph.getTopAxis( serieAxis._jsGraphIndex ) );\n } else if ( serieAxis.type == 'bottom' ) {\n serie.setXAxis( graph.getBottomAxis( serieAxis._jsGraphIndex ) );\n }\n }\n\n serieAxis = schema.axis[ schemaSerie.yAxis ];\n\n if ( !serieAxis || ( serieAxis.type !== 'left' && serieAxis.type !== 'right' ) ) {\n util.warn( 'No y axis found. Setting automatically' );\n serie.setYAxis( graph.getYAxis( 0 ) );\n } else {\n if ( serieAxis.type == 'left' ) {\n serie.setYAxis( graph.getLeftAxis( serieAxis._jsGraphIndex ) );\n } else if ( serieAxis.type == 'right' ) {\n serie.setYAxis( graph.getRightAxis( serieAxis._jsGraphIndex ) );\n }\n }\n\n } else {\n util.warn( 'No axes found. Setting automatically' );\n serie.autoAxis();\n }\n\n switch ( serieType ) {\n\n case Graph.SERIE_BOX:\n\n serie.setData( schemaSerie.boxes );\n\n break;\n\n default:\n case Graph.SERIE_SCATTER:\n case Graph.SERIE_LINE_COLORED:\n case Graph.SERIE_LINE:\n\n serie.setWaveform( waveform );\n\n break;\n }\n } );\n\n }\n\n graph.autoscaleAxes();\n graph.draw();\n\n return graph;\n }\n\n exportToSchema() {\n\n let schema = {};\n\n schema.title = this.options.title;\n\n schema.width = this.getWidth();\n schema.height = this.getHeight();\n\n let axesPositions = [ 'top', 'bottom', 'left', 'right' ];\n let axesExport = [];\n let allaxes = {\n x: [],\n y: []\n };\n\n axesPositions.map( ( axisPosition ) => {\n\n if ( !this.axis[ axisPosition ] ) {\n return;\n }\n\n axesExport = axesExport.concat( this.axis[ axisPosition ].map( ( axis ) => {\n return {\n\n type: axisPosition,\n label: axis.options.label,\n unit: axis.options.unit,\n min: axis.options.forcedMin,\n max: axis.options.forcedMax,\n flip: axis.options.flipped\n\n };\n } ) );\n\n if ( axisPosition == 'top' || axisPosition == 'bottom' ) {\n allaxes.x = allaxes.x.concat( this.axis[ axisPosition ] );\n } else {\n allaxes.y = allaxes.y.concat( this.axis[ axisPosition ] );\n }\n } );\n\n schema.axis = axesExport;\n\n let seriesExport = [];\n\n let toType = ( type ) => {\n switch ( type ) {\n\n case Graph.SERIE_LINE:\n return 'line';\n break;\n\n case Graph.SERIE_BAR:\n return 'bar';\n break;\n\n case Graph.SERIE_LINE_COLORED:\n return 'color';\n break;\n\n case Graph.SERIE_SCATTER:\n return 'scatter';\n break;\n }\n };\n\n let exportData = ( serie, x ) => {\n\n let data = [];\n\n switch ( serie.getType() ) {\n\n case Graph.SERIE_LINE:\n\n for ( var i = 0; i < serie.data.length; i++ ) {\n\n for ( var j = 0; j < serie.data[ i ].length - 1; j += 2 ) {\n\n data.push( serie.data[ i ][ j + ( ( x && serie.isFlipped() || !x && !serie.isFlipped() ) ? 1 : 0 ) ] );\n }\n }\n break;\n\n case Graph.SERIE_SCATTER:\n\n for ( var j = 0; j < serie.data.length - 1; j += 2 ) {\n\n data.push( serie.data[ i + ( ( x && serie.isFlipped() || !x && !serie.isFlipped() ) ? 1 : 0 ) ] );\n }\n\n break;\n }\n\n return data;\n };\n\n schema.data = seriesExport.concat( this.series.map( ( serie ) => {\n\n let style = [];\n let linestyle = [];\n\n if ( serie.getType() == Graph.SERIE_LINE ) {\n\n for ( var stylename in serie.styles ) {\n linestyle.push( {\n styleName: stylename,\n color: serie.styles[ stylename ].lineColor,\n lineWidth: serie.styles[ stylename ].lineWidth,\n lineStyle: serie.styles[ stylename ].lineStyle,\n } );\n\n let styleObj = {\n styleName: stylename,\n styles: []\n };\n style.push( styleObj );\n\n styleObj.styles = styleObj.styles.concat( ( serie.styles[ stylename ].markers || [] ).map( ( markers ) => {\n return {\n shape: markers.type,\n zoom: markers.zoom,\n lineWidth: markers.strokeWidth,\n lineColor: markers.strokeColor,\n color: markers.fillColor,\n points: markers.points\n };\n } ) );\n\n }\n }\n\n return {\n label: serie.getLabel(),\n id: serie.getName(),\n type: toType( serie.getType() ),\n x: exportData( serie, true ),\n y: exportData( serie, false ),\n xAxis: allaxes.x.indexOf( serie.getXAxis() ),\n yAxis: allaxes.y.indexOf( serie.getYAxis() ),\n style: style,\n lineStyle: linestyle\n };\n } ) );\n\n return schema;\n }\n\n /**\n * Registers a constructor to jsGraph. Constructors are used on a later basis by jsGraph to create series, shapes or plugins\n * @param {String} constructorName - The name of the constructor\n * @param {Function} constructor - The constructor method\n * @see Graph.getConstructor\n * @static\n */\n static registerConstructor( constructorName, constructor ) {\n\n if ( _constructors.has( constructorName ) ) {\n return util.throwError( 'Constructor ' + constructor + ' already exists.' );\n }\n\n _constructors.set( constructorName, constructor );\n }\n\n /**\n * Returns a registered constructor\n * @param {String} constructorName - The constructor name to look for\n * @param {Boolean} [softFail = false ] - Fails silently if the constructor doesn't exist, and returns false\n * @returns {Function} The registered constructor\n * @throws Error\n * @see Graph.registerConstructor\n * @static\n */\n static getConstructor( constructorName, softFail = false ) {\n\n if ( !_constructors.has( constructorName ) ) {\n\n if ( softFail ) {\n return false;\n }\n\n return util.throwError( 'Constructor \"' + constructorName + \"\\\" doesn't exist\" );\n }\n\n return _constructors.get( constructorName );\n }\n\n static newWaveform() {\n return new Waveform( ...arguments );\n }\n\n static waveform() {\n return new Waveform( ...arguments );\n }\n}\n\n// Adds getConstructor to the prototype. Cannot do that in ES6 classes\nGraph.prototype.getConstructor = Graph.getConstructor;\n\nfunction makeSerie( graph, name, options, type ) {\n\n var constructor = graph.getConstructor( type, true );\n if ( !constructor && typeof type == 'string' ) {\n constructor = graph.getConstructor( 'graph.serie.' + type, true );\n }\n\n if ( constructor ) {\n\n var serie = new constructor( graph, name, options );\n //serie.init( graph, name, options );\n graph.appendSerieToDom( serie );\n\n } else {\n\n return util.throwError( 'No constructor exists for the serie type provided. Use Graph.registerConstructor( name, constructor ) first is you use your own series' );\n\n }\n\n return serie;\n}\n\nfunction getAxisLevelFromSpan( span, level ) {\n\n for ( var i = 0, l = level.length; i < l; i++ ) {\n\n var possible = true;\n for ( var k = 0, m = level[ i ].length; k < m; k++ ) {\n\n if ( !( ( span[ 0 ] < level[ i ][ k ][ 0 ] && span[ 1 ] < level[ i ][ k ][ 0 ] ) || ( ( span[ 0 ] > level[ i ][ k ][ 1 ] && span[ 1 ] > level[ i ][ k ][ 1 ] ) ) ) ) {\n possible = false;\n }\n }\n\n if ( possible ) {\n\n level[ i ].push( span );\n return i;\n }\n }\n\n level.push( [ span ] );\n return ( level.length - 1 );\n}\n\nfunction refreshDrawingZone( graph ) {\n\n var i, j, l, xy, min, max, axis;\n var shift = {\n top: [],\n bottom: [],\n left: [],\n right: []\n };\n\n var levels = {\n top: [],\n bottom: [],\n left: [],\n right: []\n };\n\n graph._painted = true;\n // Apply to top and bottom\n\n graph._applyToAxes( function( axis, position ) {\n\n if ( !axis.isShown() ) {\n axis.hideGroup();\n return;\n } else {\n axis.showGroup();\n }\n\n if ( axis.floating ) {\n return;\n }\n\n var level = getAxisLevelFromSpan( axis.getSpan(), levels[ position ] );\n axis.setLevel( level );\n\n shift[ position ][ level ] = Math.max( axis.getAxisPosition(), ( shift[ position ][ level ] || 0 ) );\n\n }, false, true, false );\n\n var shiftTop = shift.top.reduce( function( prev, curr ) {\n return prev + curr;\n }, 0 );\n\n var shiftBottom = shift.bottom.reduce( function( prev, curr ) {\n return prev + curr;\n }, 0 );\n\n graph.drawingSpaceHeight = graph.getDrawingHeight() - shiftTop - shiftBottom;\n\n [ shift.top, shift.bottom ].map( function( arr ) {\n arr.reduce( function( prev, current, index ) {\n arr[ index ] = prev + current;\n return prev + current;\n }, 0 );\n } );\n\n // Apply to top and bottom\n graph._applyToAxes( function( axis, position ) {\n\n if ( !axis.isShown() || axis.floating ) {\n return;\n }\n\n axis.setShift( shift[ position ][ axis.getLevel() ] );\n\n }, false, true, false );\n\n // Applied to left and right\n graph._applyToAxes( function( axis, position ) {\n\n if ( !axis.isShown() ) {\n axis.hideGroup();\n // Don't return here. We need to go through the draw method as the axis must be assigned minPx and maxPx values.\n // This is because some series can still be visible although the axis isn't.\n } else {\n axis.showGroup();\n }\n\n axis.setMinPx( shiftTop );\n axis.setMaxPx( graph.getDrawingHeight( true ) - shiftBottom );\n\n if ( axis.floating ) {\n return;\n }\n\n // First we need to draw it in order to determine the width to allocate\n // graph is done to accomodate 0 and 100000 without overlapping any element in the DOM (label, ...)\n\n // Let's not draw dependant axes yet\n let drawn = ( !axis.linkedToAxis ) ? axis.draw() : 0;\n\n if ( !axis.isShown() ) {\n return;\n }\n // Get axis position gives the extra shift that is common\n var level = getAxisLevelFromSpan( axis.getSpan(), levels[ position ] );\n axis.setLevel( level );\n shift[ position ][ level ] = Math.max( drawn, shift[ position ][ level ] || 0 );\n\n }, false, false, true );\n\n var shift2 = util.extend( true, {}, shift );\n\n // Applied to left and right\n graph._applyToAxes( function( axis, position ) {\n\n if ( !axis.isShown() || axis.floating ) {\n return;\n }\n\n shift2[ position ][ axis.getLevel() ] = Math.max( shift[ position ][ axis.getLevel() ], axis.equalizePosition( shift[ position ][ axis.getLevel() ] ) );\n\n }, false, false, true );\n\n shift = shift2;\n\n var shiftLeft = shift.left.reduce( function( prev, curr ) {\n return prev + curr;\n }, 0 );\n\n var shiftRight = shift.right.reduce( function( prev, curr ) {\n return prev + curr;\n }, 0 );\n\n graph.drawingSpaceWidth = graph.getDrawingWidth() - shiftLeft - shiftRight;\n\n [ shift.left, shift.right ].map( function( arr ) {\n arr.reduce( function( prev, current, index ) {\n arr[ index ] = prev + current;\n return prev + current;\n }, 0 );\n } );\n\n // Apply to left and right\n graph._applyToAxes( ( axis, position ) => {\n\n if ( !axis.isShown() || axis.floating ) {\n return;\n }\n axis.setShift( shift[ position ][ axis.getLevel() ] );\n\n }, false, false, true );\n\n // Apply to top and bottom\n graph._applyToAxes( function( axis, position ) {\n\n if ( !axis.isShown() ) {\n // return;\n }\n\n axis.setMinPx( shiftLeft );\n axis.setMaxPx( graph.getDrawingWidth( true ) - shiftRight );\n\n if ( axis.floating ) {\n return;\n }\n\n if ( !axis.linkedToAxis ) {\n axis.draw();\n }\n\n }, false, true, false );\n\n // Floating axes\n graph._applyToAxes( function( axis ) {\n\n if ( !axis.floating ) {\n return;\n }\n\n var floatingAxis = axis.getFloatingAxis();\n var floatingValue = axis.getFloatingValue();\n var floatingPx = floatingAxis.getPx( floatingValue );\n\n axis.setShift( floatingPx );\n\n if ( !axis.linkedToAxis ) {\n axis.draw();\n }\n\n }, false, true, true );\n\n _closeLine( graph, 'right', graph.getDrawingWidth( true ), graph.getDrawingWidth( true ), shiftTop, graph.getDrawingHeight( true ) - shiftBottom );\n _closeLine( graph, 'left', 0, 0, shiftTop, graph.getDrawingHeight( true ) - shiftBottom );\n _closeLine( graph, 'top', shiftLeft, graph.getDrawingWidth( true ) - shiftRight, 0, 0 );\n _closeLine( graph, 'bottom', shiftLeft, graph.getDrawingWidth( true ) - shiftRight, graph.getDrawingHeight( true ) - shiftBottom, graph.getDrawingHeight( true ) - shiftBottom );\n\n graph.clipRect.setAttribute( 'y', shiftTop );\n graph.clipRect.setAttribute( 'x', shiftLeft );\n graph.clipRect.setAttribute( 'width', graph.getDrawingWidth() - shiftLeft - shiftRight );\n graph.clipRect.setAttribute( 'height', graph.getDrawingHeight() - shiftTop - shiftBottom );\n\n graph.rectEvent.setAttribute( 'y', shiftTop + graph.getPaddingTop() );\n graph.rectEvent.setAttribute( 'x', shiftLeft + graph.getPaddingLeft() );\n\n graph.rectEvent.setAttribute( 'width', graph.drawingSpaceWidth );\n graph.rectEvent.setAttribute( 'height', graph.drawingSpaceHeight );\n\n graph.drawingSpaceMinX = shiftLeft + graph.getPaddingLeft(); // + \"px\";\n graph.drawingSpaceMinY = shiftTop + graph.getPaddingTop(); // + \"px\";\n graph.drawingSpaceMaxX = graph.getDrawingWidth() - shiftRight + graph.getPaddingLeft(); // + \"px\";\n graph.drawingSpaceMaxY = graph.getDrawingHeight() - shiftBottom + graph.getPaddingTop(); // + \"px\";\n\n // Apply to top and bottom\n graph._applyToAxes( function( axis, position ) {\n\n if ( !axis.isShown() ) {\n return;\n }\n\n axis.drawLines();\n\n }, false, true, true );\n\n /*\n\tgraph.shapeZoneRect.setAttribute('x', shift[1]);\n\tgraph.shapeZoneRect.setAttribute('y', shift[2]);\n\tgraph.shapeZoneRect.setAttribute('width', graph.getDrawingWidth() - shift[2] - shift[3]);\n\tgraph.shapeZoneRect.setAttribute('height', graph.getDrawingHeight() - shift[1] - shift[0]);\n*/\n graph.shift = shift;\n graph.redrawShapes(); // Not sure this should be automatic here. The user should be clever.\n}\n\nfunction _handleKey( graph, event, type ) {\n\n var self = graph;\n console.log( event, type );\n if ( graph.forcedPlugin ) {\n\n graph.activePlugin = graph.forcedPlugin;\n graph._pluginExecute( graph.activePlugin, type, [ graph, event ] );\n return;\n }\n\n checkKeyActions( graph, event, [ graph, event ], type );\n}\n\n// Similar to checkMouseActions\nfunction checkKeyActions( graph, e, parameters, methodName ) {\n\n var keyComb = graph.options.keyActions,\n i, l;\n\n for ( i = 0, l = keyComb.length; i < l; i++ ) {\n\n if ( keyComb[ i ].plugin ) { // Is it a plugin ?\n\n if ( graph.forcedPlugin == keyComb[ i ].plugin || graph.isActionAllowed( e, keyComb[ i ] ) ) {\n\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n\n graph.activePlugin = keyComb[ i ].plugin; // Lease the mouse action to the current action\n graph._pluginExecute( keyComb[ i ].plugin, methodName, parameters );\n\n e.preventDefault();\n e.stopPropagation();\n\n return true;\n }\n\n } else if ( keyComb[ i ].callback && graph.isActionAllowed( e, keyComb[ i ] ) ) {\n\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n keyComb[ i ].callback.apply( graph, parameters );\n return true;\n\n }\n\n if ( keyComb[ i ].removeSelectedShape && graph.isActionAllowed( e, keyComb[ i ] ) ) {\n\n e.preventDefault();\n e.stopPropagation();\n\n graph.selectedShapes.map( ( shape ) => {\n\n shape.kill( keyComb[ i ].keepInDom );\n } );\n }\n\n /* else if ( keyComb[ i ].series ) {\n\n var series;\n if ( keyComb[ i ].series === 'all' ) {\n series = graph.series;\n }\n\n if ( !Array.isArray( keyComb[ i ].series ) ) {\n series = [ series ];\n }\n\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n\n for ( var j = 0; j < series.length; i++ ) {\n graph._serieExecute( series[ i ], methodName, parameters );\n }\n return true;\n }*/\n\n }\n\n return false;\n\n}\n\nfunction doDom() {\n\n // Create SVG element, set the NS\n this.dom = document.createElementNS( Graph.ns, 'svg' );\n this.dom.setAttributeNS( 'http://www.w3.org/2000/xmlns/', 'xmlns:xlink', 'http://www.w3.org/1999/xlink' );\n //this.dom.setAttributeNS(this.ns, 'xmlns:xlink', this.nsxml);\n util.setAttributeTo( this.dom, {\n 'xmlns': Graph.ns,\n 'font-family': this.options.fontFamily,\n 'font-size': this.options.fontSize\n } );\n\n try {\n util.setAttributeTo( this.dom, {\n 'data-jsgraph-version': __VERSION__\n } );\n } catch ( e ) {\n // ignore\n }\n\n this.defs = document.createElementNS( Graph.ns, 'defs' );\n this.dom.appendChild( this.defs );\n\n this.groupEvent = document.createElementNS( Graph.ns, 'g' );\n\n this.rectEvent = document.createElementNS( Graph.ns, 'rect' );\n util.setAttributeTo( this.rectEvent, {\n 'pointer-events': 'fill',\n 'fill': 'transparent'\n } );\n this.groupEvent.appendChild( this.rectEvent );\n\n this.dom.appendChild( this.groupEvent );\n\n // Handling graph title\n this.domTitle = document.createElementNS( Graph.ns, 'text' );\n this.setTitle( this.options.title );\n util.setAttributeTo( this.domTitle, {\n 'text-anchor': 'middle',\n 'y': 20\n } );\n this.groupEvent.appendChild( this.domTitle );\n //\n\n this.graphingZone = document.createElementNS( Graph.ns, 'g' );\n this.updateGraphingZone();\n\n this.groupEvent.appendChild( this.graphingZone );\n\n /* this.shapeZoneRect = document.createElementNS(this.ns, 'rect');\n //this.shapeZoneRect.setAttribute('pointer-events', 'fill');\n this.shapeZoneRect.setAttribute('fill', 'transparent');\n this.shapeZone.appendChild(this.shapeZoneRect);\n*/\n this.axisGroup = document.createElementNS( Graph.ns, 'g' );\n this.graphingZone.appendChild( this.axisGroup );\n\n this.groupGrids = document.createElementNS( Graph.ns, 'g' );\n\n // With the z stacking, this should probably be removed\n //this.groupGrids.setAttribute( 'clip-path', 'url(#_clipplot' + this._creation + ')' );\n\n this.groupPrimaryGrids = document.createElementNS( Graph.ns, 'g' );\n this.groupSecondaryGrids = document.createElementNS( Graph.ns, 'g' );\n\n this.axisGroup.appendChild( this.groupGrids );\n\n this.groupGrids.appendChild( this.groupSecondaryGrids );\n this.groupGrids.appendChild( this.groupPrimaryGrids );\n\n this.plotGroup = document.createElementNS( Graph.ns, 'g' );\n this.graphingZone.appendChild( this.plotGroup );\n\n // 5 September 2014. I encountered a case here shapeZone must be above plotGroup\n /*this.shapeZone = document.createElementNS( this.ns, 'g' );\n this.graphingZone.appendChild( this.shapeZone );\n*/\n\n this.layers = [];\n\n this._makeClosingLines();\n\n this.clip = document.createElementNS( Graph.ns, 'clipPath' );\n this.clip.setAttribute( 'id', '_clipplot' + this._creation );\n this.defs.appendChild( this.clip );\n\n this.clipRect = document.createElementNS( Graph.ns, 'rect' );\n this.clip.appendChild( this.clipRect );\n this.clip.setAttribute( 'clipPathUnits', 'userSpaceOnUse' );\n\n this.markerArrow = document.createElementNS( this.ns, 'marker' );\n this.markerArrow.setAttribute( 'viewBox', '0 0 10 10' );\n this.markerArrow.setAttribute( 'id', 'arrow' + this._creation );\n this.markerArrow.setAttribute( 'refX', '6' );\n this.markerArrow.setAttribute( 'refY', '5' );\n this.markerArrow.setAttribute( 'markerUnits', 'strokeWidth' );\n this.markerArrow.setAttribute( 'markerWidth', '8' );\n this.markerArrow.setAttribute( 'markerHeight', '6' );\n this.markerArrow.setAttribute( 'orient', 'auto' );\n //this.markerArrow.setAttribute('fill', 'context-stroke');\n //this.markerArrow.setAttribute('stroke', 'context-stroke');\n\n var pathArrow = document.createElementNS( Graph.ns, 'path' );\n pathArrow.setAttribute( 'd', 'M 0 0 L 10 5 L 0 10 z' );\n //pathArrow.setAttribute( 'fill', 'context-stroke' );\n this.markerArrow.appendChild( pathArrow );\n\n this.defs.appendChild( this.markerArrow );\n\n // Horionzal split marker for axis\n this.markerHorizontalSplit = document.createElementNS( Graph.ns, 'marker' );\n this.markerHorizontalSplit.setAttribute( 'viewBox', '0 0 6 8' );\n this.markerHorizontalSplit.setAttribute( 'id', 'horionzalsplit_' + this.getId() );\n this.markerHorizontalSplit.setAttribute( 'refX', '3' );\n this.markerHorizontalSplit.setAttribute( 'refY', '4' );\n this.markerHorizontalSplit.setAttribute( 'markerUnits', 'strokeWidth' );\n this.markerHorizontalSplit.setAttribute( 'markerWidth', '6' );\n this.markerHorizontalSplit.setAttribute( 'markerHeight', '8' );\n\n var path = document.createElementNS( Graph.ns, 'line' );\n path.setAttribute( 'x1', '0' );\n path.setAttribute( 'y1', '8' );\n\n path.setAttribute( 'x2', '6' );\n path.setAttribute( 'y2', '0' );\n\n path.setAttribute( 'stroke', 'black' );\n this.markerHorizontalSplit.appendChild( path );\n\n this.defs.appendChild( this.markerHorizontalSplit );\n\n // Vertical split marker for axis\n this.markerVerticalSplit = document.createElementNS( Graph.ns, 'marker' );\n this.markerVerticalSplit.setAttribute( 'viewBox', '0 0 8 6' );\n this.markerVerticalSplit.setAttribute( 'id', 'verticalsplit_' + this.getId() );\n this.markerVerticalSplit.setAttribute( 'refX', '4' );\n this.markerVerticalSplit.setAttribute( 'refY', '3' );\n this.markerVerticalSplit.setAttribute( 'markerUnits', 'strokeWidth' );\n this.markerVerticalSplit.setAttribute( 'markerWidth', '8' );\n this.markerVerticalSplit.setAttribute( 'markerHeight', '6' );\n\n var path = document.createElementNS( Graph.ns, 'line' );\n\n path.setAttribute( 'x1', '0' );\n path.setAttribute( 'y1', '0' );\n\n path.setAttribute( 'x2', '8' );\n path.setAttribute( 'y2', '6' );\n\n path.setAttribute( 'stroke', 'black' );\n this.markerVerticalSplit.appendChild( path );\n this.defs.appendChild( this.markerVerticalSplit );\n\n this.vertLineArrow = document.createElementNS( Graph.ns, 'marker' );\n this.vertLineArrow.setAttribute( 'viewBox', '0 0 10 10' );\n this.vertLineArrow.setAttribute( 'id', 'verticalline' + this._creation );\n this.vertLineArrow.setAttribute( 'refX', '0' );\n this.vertLineArrow.setAttribute( 'refY', '5' );\n this.vertLineArrow.setAttribute( 'markerUnits', 'strokeWidth' );\n this.vertLineArrow.setAttribute( 'markerWidth', '20' );\n this.vertLineArrow.setAttribute( 'markerHeight', '10' );\n this.vertLineArrow.setAttribute( 'orient', 'auto' );\n //this.vertLineArrow.setAttribute('fill', 'context-stroke');\n //this.vertLineArrow.setAttribute('stroke', 'context-stroke');\n this.vertLineArrow.setAttribute( 'stroke-width', '1px' );\n\n var pathVertLine = document.createElementNS( Graph.ns, 'path' );\n pathVertLine.setAttribute( 'd', 'M 0 -10 L 0 10' );\n pathVertLine.setAttribute( 'stroke', 'black' );\n\n this.vertLineArrow.appendChild( pathVertLine );\n\n this.defs.appendChild( this.vertLineArrow );\n\n // Removed with z stacking ?\n // this.plotGroup.setAttribute( 'clip-path', 'url(#_clipplot' + this._creation + ')' );\n\n this.bypassHandleMouse = false;\n}\n\nfunction _registerEvents( graph ) {\n var self = graph;\n\n if ( !graph.wrapper ) {\n throw 'No wrapper exists. Cannot register the events.';\n }\n\n graph.dom.setAttribute( 'tabindex', 0 );\n\n graph.dom.addEventListener( 'keydown', e => {\n _handleKey( graph, e, 'keydown' );\n } );\n\n graph.dom.addEventListener( 'keypress', e => {\n _handleKey( graph, e, 'keypress' );\n } );\n\n graph.dom.addEventListener( 'keyup', e => {\n _handleKey( graph, e, 'keyup' );\n } );\n // Not sure this has to be prevented\n\n // August 17th, 2017: I extended the graph.groupEvent to the more general graph.dom to make the zoom plugin more\n // intuitive. Let us see if it breaks another example...\n graph.dom.addEventListener( 'mousemove', e => {\n //e.preventDefault();\n var coords = graph._getXY( e );\n _handleMouseMove( graph, coords.x, coords.y, e );\n\n } );\n\n graph.dom.addEventListener( 'mouseleave', e => {\n\n _handleMouseLeave( graph );\n\n } );\n\n graph.groupEvent.addEventListener( 'mousedown', e => {\n\n graph.focus();\n\n // e.preventDefault();\n if ( e.which == 3 || e.ctrlKey ) {\n return;\n }\n\n var coords = graph._getXY( e );\n _handleMouseDown( graph, coords.x, coords.y, e );\n\n } );\n\n graph.dom.addEventListener( 'mouseup', e => {\n\n graph.emit( 'mouseUp', e );\n var coords = graph._getXY( e );\n\n _handleMouseUp( graph, coords.x, coords.y, e );\n\n } );\n\n graph.wrapper.addEventListener( 'mouseup', e => {\n e.stopPropagation();\n } );\n\n graph.dom.addEventListener( 'dblclick', e => {\n\n graph.emit( 'dblClick', e );\n var coords = graph._getXY( e );\n\n _handleDblClick( graph, coords.x, coords.y, e );\n } );\n\n graph.groupEvent.addEventListener( 'click', e => {\n\n // Cancel right click or Command+Click\n if ( e.which == 3 || e.ctrlKey ) {\n return;\n }\n\n // e.preventDefault();\n var coords = graph._getXY( e );\n\n if ( !graph.prevent( false ) ) {\n _handleClick( graph, coords.x, coords.y, e );\n }\n\n //}, 200 );\n } );\n\n graph.groupEvent.addEventListener( 'mousewheel', e => {\n\n var deltaY = e.wheelDeltaY || e.wheelDelta || -e.deltaY;\n var coords = graph._getXY( e );\n _handleMouseWheel( graph, deltaY, coords.x, coords.y, e );\n\n return false;\n } );\n\n graph.groupEvent.addEventListener( 'wheel', e => {\n\n var coords = graph._getXY( e );\n var deltaY = e.wheelDeltaY || e.wheelDelta || -e.deltaY;\n _handleMouseWheel( graph, deltaY, coords.x, coords.y, e );\n\n return false;\n } );\n}\n\nfunction _handleMouseDown( graph, x, y, e ) {\n\n var self = graph;\n\n if ( graph.forcedPlugin ) {\n\n graph.activePlugin = graph.forcedPlugin;\n graph._pluginExecute( graph.activePlugin, 'onMouseDown', [ graph, x, y, e ] );\n return;\n }\n\n if ( graph.activePlugin ) {\n graph.activePlugin = false;\n }\n\n checkMouseActions( graph, e, [ graph, x, y, e ], 'onMouseDown' );\n}\n\nfunction _handleMouseMove( graph, x, y, e ) {\n\n if ( graph.bypassHandleMouse ) {\n graph.bypassHandleMouse.handleMouseMove( e );\n return;\n }\n\n if ( graph.activePlugin && graph._pluginExecute( graph.activePlugin, 'onMouseMove', [ graph, x, y, e ] ) ) {\n return;\n }\n\n //\t\t\treturn;\n\n graph._applyToAxes( 'handleMouseMove', [ x - graph.options.paddingLeft, e ], true, false );\n graph._applyToAxes( 'handleMouseMove', [ y - graph.options.paddingTop, e ], false, true );\n\n if ( !graph.activePlugin ) {\n var index;\n\n // Takes care of the tracking line\n if ( graph.options.trackingLine && graph.options.trackingLine.enable && graph.options.trackingLine.snapToSerie ) {\n\n if ( graph.options.trackingLine.mode == 'common' ) {\n\n var snapToSerie = graph.options.trackingLine.snapToSerie;\n index = snapToSerie.handleMouseMove( false, true );\n\n if ( this.trackingObject ) {\n\n if ( !index ) {\n\n graph.trackingObject.hide();\n\n } else {\n\n graph.trackingObject.show();\n\n graph.trackingObject.getPosition( 0 ).x = index.xClosest;\n graph.trackingObject.getPosition( 1 ).x = index.xClosest;\n graph.trackingObject.redraw();\n\n var x = snapToSerie.getXAxis().getPx( index.xClosest ) + graph.options.paddingLeft;\n }\n }\n\n var series = graph.options.trackingLine.series;\n\n // Gets a default value\n if ( !series ) {\n\n series = graph.getSeries().map( function( serie ) {\n return {\n serie: serie,\n withinPx: 20,\n withinVal: -1\n };\n } );\n }\n\n graph._trackingLegend = _trackingLegendSerie( graph, series, x, y, graph._trackingLegend, graph.options.trackingLine.textMethod, index.xClosest );\n }\n }\n }\n // End takes care of the tracking line\n\n if ( graph.options.onMouseMoveData ) {\n var results = {};\n\n for ( var i = 0; i < graph.series.length; i++ ) {\n\n results[ graph.series[ i ].getName() ] = graph.series[ i ].handleMouseMove( false, true );\n\n }\n\n graph.options.onMouseMoveData.call( graph, e, results );\n }\n\n checkMouseActions( graph, e, [ graph, x, y, e ], 'onMouseMove' );\n\n}\n\nfunction checkMouseActions( graph, e, parameters, methodName ) {\n\n var keyComb = graph.options.mouseActions,\n i, l, executed = false;\n\n for ( i = 0, l = keyComb.length; i < l; i++ ) {\n\n if ( keyComb[ i ].plugin ) { // Is it a plugin ?\n\n if ( graph.forcedPlugin == keyComb[ i ].plugin || graph.isActionAllowed( e, keyComb[ i ] ) ) {\n\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n\n // Lease the mouse action to the current action\n // 25.10.2017: Except for mousewheel. See #111\n if ( e.type !== 'wheel' && e.type !== 'mousewheel' ) {\n graph.activePlugin = keyComb[ i ].plugin;\n }\n\n graph._pluginExecute( keyComb[ i ].plugin, methodName, parameters );\n executed = true;\n continue;\n }\n\n } else if ( keyComb[ i ].callback && graph.isActionAllowed( e, keyComb[ i ] ) ) {\n\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n\n keyComb[ i ].callback.apply( graph, parameters );\n executed = true;\n continue;\n\n } else if ( keyComb[ i ].series ) {\n\n var series;\n if ( keyComb[ i ].series === 'all' ) {\n series = graph.series;\n }\n\n if ( !Array.isArray( keyComb[ i ].series ) ) {\n series = [ series ];\n }\n\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n\n for ( var j = 0; j < series.length; i++ ) {\n graph._serieExecute( series[ i ], methodName, parameters );\n }\n executed = true;\n continue;\n }\n }\n\n return executed;\n}\n\nvar _trackingLegendSerie = function( graph, serie, x, y, legend, textMethod, xValue ) {\n\n var justCreated = false;\n\n if ( !Array.isArray( serie ) ) {\n serie = [ serie ];\n }\n\n var output = [];\n\n if ( !legend && graph.options.trackingLine.legend ) {\n justCreated = true;\n legend = _makeTrackingLegend( graph );\n }\n\n serie.map( ( serie ) => {\n\n var index = serie.serie.handleMouseMove( xValue, false );\n\n if ( !index || !textMethod ) {\n\n if ( serie.serie.trackingShape ) {\n serie.serie.trackingShape.hide();\n }\n\n return legend;\n }\n\n // Should we display the dot ?\n if (\n ( serie.withinPx > 0 && Math.abs( x - graph.options.paddingLeft - serie.serie.getXAxis().getPx( index.xClosest ) ) - serie.withinPx > 1e-14 ) ||\n ( serie.withinVal > 0 && Math.abs( serie.serie.getXAxis().getVal( x - graph.options.paddingLeft ) - index.xClosest ) - serie.withinVal > serie.serie.getXAxis().getVal( x - graph.options.paddingLeft ) / 100000 )\n ) {\n\n if ( serie.serie.trackingShape ) {\n serie.serie.trackingShape.hide();\n }\n\n } else {\n\n output[ serie.serie.getName() ] = {\n\n yValue: index.xClosest,\n xValue: index.yClosest,\n serie: serie,\n index: index\n\n };\n\n let serieShape;\n if ( graph.options.trackingLine && graph.options.trackingLine.serieShape ) {\n serieShape = graph.options.trackingLine.serieShape;\n } else {\n serieShape = {\n shape: 'ellipse',\n properties: {\n rx: [ serie.serie.getLineWidth() * 3 + 'px' ],\n ry: [ serie.serie.getLineWidth() * 3 + 'px' ]\n }\n };\n }\n\n if ( !serie.serie.trackingShape ) {\n\n serie.serie.trackingShape = graph.newShape( serieShape.shape, {\n fillColor: serie.serie.getLineColor(),\n strokeColor: 'White',\n strokeWidth: serie.serie.getLineWidth()\n },\n true,\n serieShape.properties\n )\n .setSerie( serie.serie )\n .forceParentDom( serie.serie.groupMain )\n .draw();\n\n ( serieShape.onCreated && serieShape.onCreated( serie.serie.trackingShape ) );\n\n serie.serie.trackingShape.on( 'changed', () => {\n\n ( serieShape.onChanged && serieShape.onChanged( serie.serie.trackingShape ) );\n\n } );\n }\n\n serie.serie.trackingShape.show();\n serie.serie.trackingShape.getPosition( 0 ).x = index.xClosest;\n\n if ( serieShape.magnet ) {\n\n let magnetOptions = serieShape.magnet,\n val = magnetOptions.within,\n minmaxpos;\n\n if ( magnetOptions.withinPx ) {\n val = serie.serie.getXAxis().getRelVal( magnetOptions.withinPx );\n }\n\n if ( ( minmaxpos = serie.serie.findLocalMinMax( index.xClosest, val, magnetOptions.mode ) ) ) {\n\n serie.serie.trackingShape.getPosition( 0 ).x = minmaxpos;\n }\n }\n\n serie.serie.trackingShape.redraw();\n }\n\n } ); // End map\n\n if ( !graph.options.trackingLine.legend ) {\n return;\n }\n\n if ( Object.keys( output ).length == 0 || !textMethod ) {\n legend.style.display = 'none';\n } else {\n\n if ( legend.style.display == 'none' || justCreated ) {\n\n forceTrackingLegendMode( graph, legend, x, y, true );\n } else {\n _trackingLegendMove( graph, legend, x, y );\n }\n\n legend.style.display = 'block';\n var txt = textMethod( output, xValue, x, y );\n\n legend.innerHTML = txt;\n\n //legend.innerHTML = textMethod( output, xValue, x, y );\n\n }\n\n return legend;\n\n};\n\nvar forceTrackingLegendMode = function( graph, legend, toX, toY, skip ) {\n\n var ratio = 0,\n start = Date.now(),\n h = legend.offsetHeight,\n startX = parseInt( legend.style.marginLeft.replace( 'px', '' ) || 0 ),\n startY = parseInt( legend.style.marginTop.replace( 'px', '' ) || 0 );\n\n toX = ( toX > graph.getWidth() / 2 ) ? ( ( toX - toX % 10 - 20 ) - legend.offsetWidth ) : ( toX - toX % 10 + 30 );\n toY = ( toY - toY % 10 + h / 2 );\n\n if ( skip ) {\n legend.style.marginLeft = ( toX ) + 'px';\n legend.style.marginTop = ( toY ) + 'px';\n return;\n }\n\n function next() {\n\n var progress = ( Date.now() - start ) / 200;\n if ( progress > 1 ) {\n progress = 1;\n }\n\n legend.style.marginLeft = ( ( toX - startX ) * progress + startX ) + 'px';\n legend.style.marginTop = ( ( toY - startY ) * progress + startY ) + 'px';\n\n if ( progress < 1 ) {\n window.requestAnimationFrame( next );\n }\n }\n\n window.requestAnimationFrame( next );\n};\n\nvar _trackingLegendMove = util.debounce( forceTrackingLegendMode, 50 );\n\nfunction _makeTrackingLegend( graph ) {\n\n var group = document.createElement( 'div' );\n group.setAttribute( 'class', 'trackingLegend' );\n group.style.position = 'absolute';\n group.style.borderRadius = '4px';\n group.style.boxShadow = '1px 1px 3px 0px rgba(100,100,100,0.6)';\n group.style.border = '2px solid #333333';\n group.style.backgroundColor = 'rgba(255, 255, 255, 0.5 )';\n group.style.pointerEvents = 'none';\n group.style.paddingTop = '5px';\n group.style.paddingBottom = '5px';\n group.style.paddingLeft = '10px';\n group.style.paddingRight = '10px';\n\n graph.getWrapper().insertBefore( group, graph.getDom() );\n\n return group;\n}\n\nfunction _handleDblClick( graph, x, y, e ) {\n //\tvar _x = x - graph.options.paddingLeft;\n //\tvar _y = y - graph.options.paddingTop;\n var pref = graph.options.dblclick;\n checkMouseActions( graph, e, [ x, y, e ], 'onDblClick' );\n /*\n if ( !pref || !pref.type ) {\n return;\n }\n\n switch ( pref.type ) {\n\n case 'plugin':\n\n var plugin;\n\n if ( ( plugin = graph.plugins[ pref.plugin ] ) ) {\n\n plugin.onDblClick( graph, x, y, pref.options, e );\n }\n\n break;\n }*/\n}\n\nfunction _handleMouseUp( graph, x, y, e ) {\n\n if ( graph.bypassHandleMouse ) {\n graph.bypassHandleMouse.handleMouseUp( e );\n graph.activePlugin = false;\n return;\n }\n\n graph._pluginExecute( graph.activePlugin, 'onMouseUp', [ graph, x, y, e ] );\n graph.activePlugin = false;\n}\n\nfunction _handleClick( graph, x, y, e ) {\n\n graph.emit( 'click', [ graph, x, y, e ] );\n // Not on a shape\n checkMouseActions( graph, e, [ x, y, e ], 'onClick' );\n\n if ( !e.target.jsGraphIsShape && !graph.prevent( false ) && graph.options.shapesUnselectOnClick ) {\n\n graph.unselectShapes();\n }\n\n}\n\nfunction _getAxis( graph, num, options, pos ) {\n\n var options = options || {};\n var inst;\n\n var _availableAxes = {\n\n def: {\n x: graph.getConstructor( 'graph.axis.x' ),\n y: graph.getConstructor( 'graph.axis.y' )\n },\n\n time: {\n x: graph.getConstructor( 'graph.axis.x.time' )\n },\n\n bar: {\n x: graph.getConstructor( 'graph.axis.x.bar' )\n }\n };\n\n switch ( options.type ) {\n\n case 'time':\n var axisInstance = _availableAxes.time;\n break;\n\n case 'bar':\n var axisInstance = _availableAxes.bar;\n break;\n\n case 'broken':\n var axisInstance = _availableAxes.broken;\n break;\n\n default:\n var axisInstance = _availableAxes.def;\n break;\n }\n\n switch ( pos ) {\n\n case 'top':\n case 'bottom':\n inst = axisInstance.x;\n break;\n\n case 'left':\n case 'right':\n inst = axisInstance.y;\n break;\n }\n\n num = num || 0;\n\n if ( typeof num == 'object' ) {\n options = num;\n num = 0;\n }\n\n if ( !graph.axis[ pos ][ num ] ) {\n\n graph.axis[ pos ][ num ] = new inst( graph, pos, options );\n graph.axis[ pos ][ num ].init( graph, options );\n }\n\n return graph.axis[ pos ][ num ];\n}\n\nfunction _closeLine( graph, mode, x1, x2, y1, y2 ) {\n\n if ( graph.options.close === false ) {\n return;\n }\n\n var l = 0;\n\n graph.axis[ mode ].map( function( g ) {\n\n if ( g.isDisplayed() && !g.floating ) {\n l++;\n }\n } );\n\n if ( ( graph.options.close === true || graph.options.close[ mode ] ) && l == 0 ) {\n\n graph.closingLines[ mode ].setAttribute( 'display', 'block' );\n graph.closingLines[ mode ].setAttribute( 'x1', x1 );\n graph.closingLines[ mode ].setAttribute( 'x2', x2 );\n graph.closingLines[ mode ].setAttribute( 'y1', y1 );\n graph.closingLines[ mode ].setAttribute( 'y2', y2 );\n\n } else {\n\n graph.closingLines[ mode ].setAttribute( 'display', 'none' );\n }\n}\n\nfunction _handleMouseWheel( graph, delta, coordX, coordY, e ) {\n if ( checkMouseActions( graph, e, [ delta, e, coordX, coordY ], 'onMouseWheel' ) ) {\n e.preventDefault();\n e.stopPropagation();\n }\n}\n\nfunction _handleMouseLeave( graph ) {\n if ( graph.options.handleMouseLeave ) {\n graph.options.handleMouseLeave.call( graph );\n }\n}\n\nfunction haveAxesChanged( graph ) {\n var temp = graph._axesHaveChanged;\n graph._axesHaveChanged = false;\n return temp;\n}\n\nfunction hasSizeChanged( graph ) {\n var temp = graph._sizeChanged;\n graph._sizeChanged = false;\n return temp;\n}\n\n// Constants\nGraph.SERIE_LINE = Symbol();\nGraph.SERIE_SCATTER = Symbol();\nGraph.SERIE_CONTOUR = Symbol();\nGraph.SERIE_BAR = Symbol();\nGraph.SERIE_BOX = Symbol();\nGraph.SERIE_ZONE = Symbol();\nGraph.SERIE_LINE_COLORED = Symbol();\nGraph.SERIE_ZONE = Symbol();\nGraph.SERIE_DENSITYMAP = Symbol();\nGraph.SERIE_LINE_3D = Symbol();\nGraph.SERIE_ZONE_3D = Symbol();\n\nGraph.TICKS_OUTSIDE = Symbol();\nGraph.TICKS_INSIDE = Symbol();\nGraph.TICKS_CENTERED = Symbol();\n\nGraph.ns = 'http://www.w3.org/2000/svg';\nGraph.nsxlink = 'http://www.w3.org/1999/xlink';\n\nexport default Graph;","import GraphPosition from './graph.position.js';\nimport * as util from './graph.util.js';\n\n/**\n * Default legend configuration\n * @name LegendOptionsDefault\n * @object\n * @static\n * @prop {Boolean} frame - true to display a frame around the legend\n * @prop {Number} frameWidth - The width of the frame stroke\n * @prop {String} frameColor - The stroke color of the frame\n * @prop {String} backgroundColor - The background color of the frame\n * @prop {Number} paddingLeft - The left padding\n * @prop {Number} paddingRight - The right padding\n * @prop {Number} paddingTop - The top padding\n * @prop {Number} paddingBottom - The bottom padding\n * @prop {Boolean} shapesToggleable - true to toggle the shapes linked to serie with its status (shown or hidden)\n * @prop {Boolean} isSerieHideable - true to allow series to be hidden through the legend\n * @prop {Boolean} isSerieSelectable - true to allow series to be selected through the legend\n */\nvar legendDefaults = {\n\n backgroundColor: 'rgba(255, 255, 255, 0.8)',\n frame: true,\n frameWidth: 1,\n frameColor: 'black',\n paddingTop: 10,\n paddingLeft: 10,\n paddingBottom: 10,\n paddingRight: 10,\n color: 'black',\n frameRounding: 0,\n\n movable: false,\n\n shapesToggleable: true,\n isSerieHideable: true,\n isSerieSelectable: true\n\n};\n\n/**\n * Legend constructor. You should not call this method directly, but rather use {@link graph.makeLegend}\n * @example var legend = graph.makeLegend( { backgroundColor: 'rgba(255, 255, 255, 0.8)',\n * frame: true,\n * frameWidth: 1,\n * frameColor: 'black',\n * paddingTop: 10,\n * paddingLeft: 10,\n * paddingBottom: 10,\n * paddingRight: 10,\n * frameRounding: 3,\n *\n * movable: false,\n *\n * shapesToggleable: true,\n * isSerieHideable: true,\n * isSerieSelectable: true\n * } );\n */\nclass Legend {\n\n constructor( graph, options ) {\n\n this.options = util.extend( {}, legendDefaults, options );\n\n this.graph = graph;\n this.svg = document.createElementNS( this.graph.ns, 'g' );\n this.subG = document.createElementNS( this.graph.ns, 'g' );\n\n this.groups = [];\n this.rect = document.createElementNS( this.graph.ns, 'rect' );\n this.rectBottom = document.createElementNS( this.graph.ns, 'rect' );\n\n this.rect.setAttribute( 'x', 0 );\n this.rect.setAttribute( 'y', 0 );\n\n this.rectBottom.setAttribute( 'x', 0 );\n this.rectBottom.setAttribute( 'y', 0 );\n\n this.series = false;\n\n this.svg.setAttribute( 'display', 'none' );\n this.pos = {\n x: undefined,\n y: undefined,\n transformX: 0,\n transformY: 0\n };\n\n this.setEvents();\n\n this.eyeId = util.guid();\n this.eyeCrossedId = util.guid();\n\n var eyeClosed = util.SVGParser( '' );\n // var eyeClosed = util.SVGParser('');\n\n /* var eyeClosed = document.createElementNS( this.graph.ns, \"symbol\");\n eyeClosed.setAttribute('id', this.eyeId );\n eyeClosed.setAttribute(\"viewBox\", '0 0 100 100');\n\n var rect = document.createElementNS( this.graph.ns, \"rect\" );\n rect.setAttribute('width', 100 );\n rect.setAttribute('height', 100 );\n rect.setAttribute('x', 0 );\n rect.setAttribute('y', 0 );\n rect.setAttribute('fill', 'black');\n eyeClosed.appendChild( rect );\n */\n var eye = util.SVGParser( '' );\n\n this.svg.appendChild( document.adoptNode( eye.documentElement.firstChild ) );\n this.svg.appendChild( document.adoptNode( eyeClosed.documentElement.firstChild ) );\n\n this.svg.appendChild( this.subG );\n\n this.applyStyle();\n }\n\n /**\n * Sets the position of the legend\n * @param {Position} position - the position to set the legend to versus the graph main axes ({@link Graph#getXAxis} and {@link Graph#getYAxis})\n * @param {String} alignToX - \"right\" or \"left\". References the legend right or left boundary using the position parameter\n * @param {String} alignToY - \"top\" or \"bottom\". References the legend top or bottom boundary using the position parameter\n * @example legend.setPosition( { x: 'max', y: '0px' }, 'right', 'top' ); // The rightmost side of the legend will at the maximum value of the axis, and will be positioned at the top\n */\n setPosition( position, alignToX, alignToY ) {\n\n if ( !position ) {\n return;\n }\n\n this.position = position;\n this.alignToX = alignToX || 'left';\n this.alignToY = alignToY || 'top';\n\n }\n\n setDraggable( bln ) {\n this.options.movable = bln;\n\n }\n\n setAutoPosition( position ) {\n\n if ( [ 'bottom', 'left', 'top', 'right' ].indexOf( ( position = position.toLowerCase() ) ) > -1 ) {\n this.autoPosition = position;\n return this;\n }\n\n this.requireDelayedUpdate();\n this.autoPosition = false;\n }\n\n autoPosition() {\n return this.setAutoPosition( ...arguments );\n }\n\n buildLegendBox() {\n\n var series = this.series || this.graph.getSeries(),\n posX = 0,\n posY = this.options.paddingTop;\n\n if ( !this.autoPosition ) {\n this.graph.graphingZone.appendChild( this.getDom() );\n } else {\n this.graph.getDom().appendChild( this.getDom() );\n }\n\n for ( var i = 0, l = series.length; i < l; i++ ) {\n\n if ( series[ i ].excludedFromLegend && !this.series ) {\n continue;\n }\n\n if ( this.autoPosition == 'bottom' || this.autoPosition == 'top' ) {\n\n var bbox = getBBox( this.groups[ i ] );\n\n if ( posX + bbox.width > this.graph.getDrawingWidth() - this.options.paddingRight ) {\n posY += 16;\n posX = 0;\n }\n }\n\n this.groups[ i ].setAttribute( 'transform', 'translate( ' + posX + ', ' + posY + ')' );\n\n if ( this.autoPosition == 'bottom' || this.autoPosition == 'top' ) {\n\n posX += bbox.width + 10;\n posY += 0;\n\n } else {\n\n posX = 0;\n posY += 16;\n }\n }\n\n var bbox = getBBox( this.subG );\n\n /* Independant on box position */\n this.width = bbox.width + this.options.paddingRight + this.options.paddingLeft;\n this.height = bbox.height + this.options.paddingBottom + this.options.paddingTop;\n\n this.rect.setAttribute( 'width', this.width );\n this.rect.setAttribute( 'height', this.height );\n this.rect.setAttribute( 'fill', 'none' );\n this.rect.setAttribute( 'pointer-events', 'fill' );\n\n this.rect.setAttribute( 'display', 'none' );\n\n if ( this.options.movable ) {\n this.rectBottom.style.cursor = 'move';\n }\n\n this.rectBottom.setAttribute( 'width', this.width );\n this.rectBottom.setAttribute( 'height', this.height );\n\n this.rectBottom.setAttribute( 'x', bbox.x - this.options.paddingLeft );\n this.rectBottom.setAttribute( 'y', bbox.y - this.options.paddingTop );\n /* End independant on box position */\n\n this.position = this.position || {};\n\n switch ( this.autoPosition ) {\n\n case 'bottom':\n this.position.y = this.graph.getHeight() + 'px';\n // Try to center with respect to the drawing space, not the full graph. It's useful when the graph is fairly asymmetric (i.e. multiple axes on 1 side)\n this.position.x = ( ( this.graph.drawingSpaceWidth - this.width ) / 2 + this.graph.drawingSpaceMinX ) + 'px';\n this.alignToY = 'bottom';\n this.alignToX = false;\n break;\n\n case 'left':\n this.position.x = '6px';\n this.position.y = ( ( this.graph.getHeight() - this.height ) / 2 ) + 'px';\n this.alignToX = 'left';\n this.alignToY = false;\n break;\n\n case 'right':\n this.position.x = this.graph.getWidth() + 'px';\n this.position.y = ( ( this.graph.getHeight() - this.height ) / 2 ) + 'px';\n this.alignToX = 'right';\n this.alignToY = false;\n break;\n\n case 'top':\n this.position.x = ( ( this.graph.drawingSpaceWidth - this.width ) / 2 + this.graph.drawingSpaceMinX ) + 'px';\n this.position.y = '10px';\n this.alignToY = 'top';\n this.alignToX = false;\n break;\n }\n\n if ( this.autoPosition ) {\n switch ( this.autoPosition ) {\n\n case 'bottom':\n this.graph.options.paddingBottom = this.height + 10;\n break;\n\n case 'left':\n this.graph.options.paddingLeft = this.width + 5;\n break;\n\n case 'right':\n this.graph.options.paddingRight = this.width + 10;\n break;\n\n case 'top':\n this.graph.options.paddingTop = this.height + 14;\n break;\n }\n\n this.graph.updateGraphingZone();\n this.graph.getDrawingHeight();\n this.graph.getDrawingWidth();\n // this.graph.redraw( false );\n\n }\n\n this.bbox = bbox;\n }\n\n calculatePosition() {\n\n var pos = GraphPosition.check( this.position );\n let poscoords = pos.compute( this.graph, this.graph.getXAxis(), this.graph.getYAxis() );\n\n if ( !poscoords ) {\n return;\n }\n\n if ( pos.y == 'max' ) {\n poscoords.y += this.graph.getPaddingTop();\n }\n\n if ( pos.x == 'max' ) {\n poscoords.x -= this.graph.getPaddingRight();\n }\n\n if ( this.alignToX == 'right' ) {\n poscoords.x -= this.width;\n poscoords.x -= this.bbox.x;\n\n } else {\n //poscoords.x -= this.bbox.x;\n }\n\n if ( this.alignToY == 'bottom' ) {\n poscoords.y -= this.height;\n poscoords.y -= this.bbox.y;\n\n } else {\n\n poscoords.y -= this.bbox.y;\n }\n\n this.pos.transformX = poscoords.x;\n this.pos.transformY = poscoords.y;\n\n this._setPosition();\n\n }\n\n /**\n * Updates the legend position and content\n */\n update( onlyIfRequired ) {\n\n if ( this.graph.isDelayedUpdate() || ( !this._requiredUpdate && onlyIfRequired ) ) {\n return;\n }\n\n this._requiredUpdate = false;\n\n var self = this;\n\n this.applyStyle();\n\n while ( this.subG.hasChildNodes() ) {\n this.subG.removeChild( this.subG.lastChild );\n }\n\n this.svg.insertBefore( this.rectBottom, this.svg.firstChild );\n\n var series = this.series || this.graph.getSeries(),\n line,\n text,\n g;\n\n if ( series.length > 0 ) {\n this.svg.setAttribute( 'display', 'block' );\n } else {\n return;\n }\n\n if ( this.autoPosition == 'bottom' || this.autoPosition == 'top' ) {\n var fullWidth = this.graph.getDrawingWidth();\n }\n\n var posX, posY;\n\n for ( var i = 0, l = series.length; i < l; i++ ) {\n\n if ( series[ i ].excludedFromLegend && !this.series ) {\n continue;\n }\n\n ( function( j ) {\n\n var g, line, text, xPadding = 0;\n\n if ( this.autoPosition == 'bottom' || this.autoPosition == 'top' ) {\n var fullWidth = this.graph.getDrawingWidth();\n }\n\n g = document.createElementNS( self.graph.ns, 'g' );\n var rect = document.createElementNS( self.graph.ns, 'rect' );\n\n self.subG.appendChild( g );\n\n g.appendChild( rect );\n\n var line = series[ j ].getSymbolForLegend();\n var marker = series[ j ].getMarkerForLegend();\n var text = series[ j ].getTextForLegend();\n\n var dx = 35;\n\n if ( this.isHideable() ) {\n dx += 20;\n\n var eyeUse = document.createElementNS( self.graph.ns, 'use' );\n eyeUse.setAttributeNS( 'http://www.w3.org/1999/xlink', 'xlink:href', '#' + ( series[ i ].isShown() ? this.eyeId : this.eyeCrossedId ) );\n eyeUse.setAttribute( 'width', 15 );\n eyeUse.setAttribute( 'height', 15 );\n eyeUse.setAttribute( 'x', 35 );\n eyeUse.setAttribute( 'y', -8 );\n\n eyeUse.addEventListener( 'click', function( e ) {\n e.stopPropagation();\n\n var id;\n if ( series[ j ].isShown() ) {\n series[ j ].hide( self.options.hideShapesOnHideSerie );\n id = self.eyeCrossedId;\n } else {\n series[ j ].show( self.options.hideShapesOnHideSerie );\n id = self.eyeId;\n }\n\n eyeUse.setAttributeNS( 'http://www.w3.org/1999/xlink', 'xlink:href', '#' + id );\n\n } );\n\n }\n\n text.setAttribute( 'transform', 'translate(' + dx + ', 3)' );\n\n text.setAttribute( 'color', this.options.color );\n\n if ( line ) {\n g.appendChild( line );\n }\n\n if ( series[ j ].getType() == 'scatter' ) {\n line.setAttribute( 'transform', 'translate( 20, 0 )' );\n }\n\n if ( marker ) {\n g.appendChild( marker );\n }\n\n if ( eyeUse ) {\n g.appendChild( eyeUse );\n }\n\n g.appendChild( text );\n\n var bbox = getBBox( g );\n\n rect.setAttribute( 'x', bbox.x );\n rect.setAttribute( 'y', bbox.y );\n rect.setAttribute( 'width', bbox.width );\n rect.setAttribute( 'height', bbox.height );\n rect.setAttribute( 'fill', 'none' );\n rect.setAttribute( 'pointer-events', 'fill' );\n\n self.groups[ j ] = g;\n\n g.addEventListener( 'click', function( e ) {\n\n var serie = series[ j ];\n\n if ( !serie.isShown() ) {\n return;\n }\n\n if ( self.isSelectable() && !serie.isSelected() ) {\n\n self.graph.selectSerie( serie );\n } else {\n\n self.graph.unselectSerie( serie );\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n } );\n\n } ).call( this, i );\n }\n\n this.svg.appendChild( this.rect );\n this.buildLegendBox();\n this.calculatePosition();\n\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be hidden or not\n */\n isHideable() {\n return this.options.isSerieHideable;\n }\n\n notHideable() {\n this.options.isSerieHideable = false;\n return this;\n }\n\n hideable() {\n this.options.isSerieHideable = true;\n return this;\n }\n\n set seriesHideable( hideable ) {\n this.options.isSerieHideable = !!hideable;\n }\n\n /**\n * @type {Boolean}\n */\n get seriesHideable() {\n return this.options.isSerieHideable;\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be selected or not\n */\n isSelectable() {\n return this.options.isSerieSelectable;\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be t or not\n */\n isToggleShapes() {\n return this.options.shapesToggleable;\n }\n\n /**\n * @return {SVGGroupElement} The SVG group element wrapping the legend\n */\n getDom() {\n return this.svg;\n }\n\n setEvents() {\n\n var self = this;\n var pos = this.pos;\n\n var mousedown = function( e ) {\n\n e.stopPropagation();\n console.log( 'down' );\n if ( self.options.movable ) {\n pos.x = e.clientX;\n pos.y = e.clientY;\n\n e.preventDefault();\n self.mousedown = true;\n self.graph.elementMoving( self );\n\n self.rect.setAttribute( 'display', 'block' );\n }\n };\n\n var mousemove = function( e ) {\n self.handleMouseMove( e );\n };\n\n this.svg.addEventListener( 'mousedown', mousedown );\n this.svg.addEventListener( 'click', function( e ) {\n e.stopPropagation();\n } );\n this.svg.addEventListener( 'dblclick', function( e ) {\n e.stopPropagation();\n } );\n this.svg.addEventListener( 'mousemove', mousemove );\n //this.rect.addEventListener( 'mousemove', mousemove );\n }\n\n handleMouseUp( e ) {\n\n e.stopPropagation();\n e.preventDefault();\n this.mousedown = false;\n this.rect.setAttribute( 'display', 'none' );\n this.graph.elementMoving( false );\n }\n\n handleMouseMove( e ) {\n\n if ( !this.mousedown ) {\n return;\n }\n\n var pos = this.pos;\n\n var deltaX = e.clientX - pos.x;\n var deltaY = e.clientY - pos.y;\n\n pos.transformX += deltaX;\n pos.transformY += deltaY;\n\n pos.x = e.clientX;\n pos.y = e.clientY;\n\n e.stopPropagation();\n e.preventDefault();\n\n this._setPosition();\n }\n\n _setPosition() {\n\n var pos = this.pos;\n if ( !isNaN( pos.transformX ) && !isNaN( pos.transformY ) && pos.transformX !== false && pos.transformY !== false ) {\n this.svg.setAttribute( 'transform', 'translate(' + pos.transformX + ', ' + pos.transformY + ')' );\n }\n }\n\n /**\n * Re-applies the legend style\n */\n applyStyle() {\n\n if ( this.options.frame ) {\n this.rectBottom.setAttribute( 'stroke', this.options.frameColor );\n this.rectBottom.setAttribute( 'stroke-width', this.options.frameWidth + 'px' );\n this.rectBottom.setAttribute( 'rx', this.options.frameRounding );\n this.rectBottom.setAttribute( 'ry', this.options.frameRounding );\n }\n\n this.rectBottom.setAttribute( 'fill', this.options.backgroundColor );\n\n }\n\n /**\n * Re-applies the legend style\n * @param {...(GraphSerie|GraphSerie[])} a serie or an array of series\n */\n fixSeries() {\n var series = [];\n\n if ( arguments[ 0 ] === false ) {\n this.series = false;\n this.update();\n return;\n }\n\n for ( var i = 0, l = arguments.length; i < l; i++ ) {\n if ( Array.isArray( arguments[ i ] ) ) {\n series = series.concat( arguments[ i ] );\n } else {\n series.push( arguments[ i ] );\n }\n }\n\n this.update();\n this.series = series;\n }\n\n fixSeriesAdd( serie ) {\n this.series = this.series || [];\n this.series.push( serie );\n }\n\n requireDelayedUpdate() {\n this._requiredUpdate = true;\n }\n\n}\n\nfunction getBBox( svgElement ) {\n // Firefox throws when trying to call getBBox() on elements\n // that are not yet rendered.\n try {\n return svgElement.getBBox();\n } catch ( e ) {\n return {\n height: 0,\n width: 0,\n x: 0,\n y: 0\n };\n }\n}\n\nexport default Legend;","import Graph from './graph.core.js';\nimport EventEmitter from './dependencies/eventEmitter/EventEmitter.js';\nimport * as util from './graph.util.js';\n\n/**\n * Default graph parameters\n * @name AxisOptionsDefault\n * @object\n * @static\n * @memberof Axis\n * @prop {Boolean} display - Whether to display or not the axis\n * @prop {Boolean} flipped - Flips the axis (maximum and minimum will be inverted)\n * @prop {Numner} axisDataSpacing.min - The spacing of the at the bottom of the axis. The value is multiplied by the (max - min) values given by the series (0.1 means 10% of the serie width / height).\n * @prop {Number} axisDataSpacing.max - The spacing of the at the top of the axis. The value is multiplied by the (max - min) values given by the series (0.1 means 10% of the serie width / height).\n * @prop {String} unitModification - Used to change the units of the axis in a defined way. Currently, \"time\" and \"time:min.sec\" are supported. They will display the value in days, hours, minutes and seconds and the data should be expressed in seconds.\n * @prop {Boolean} primaryGrid - Whether or not to display the primary grid (on the main ticks)\n * @prop {Boolean} secondaryGrid - Whether or not to display the secondary grid (on the secondary ticks)\n * @prop {Number} tickPosition - Sets the position of the ticks with regards to the axis ( 1 = inside, 2 = centered, 3 = outside ).\n * @prop {Number} nbTicksPrimary - The number of primary ticks to use (approximately)\n * @prop {Number} nbTicksSecondary - The number of secondary ticks to use (approximately)\n * @prop {Number} ticklabelratio - Scaling factor on the labels under each primary ticks\n * @prop {Number} exponentialFactor - Scales the labels under each primary ticks by 10^(exponentialFactor)\n * @prop {Number} exponentialLabelFactor - Scales the axis label by 10^(exponentialFactor)\n * @prop {Boolean} logScale - Display the axis in log scale (base 10)\n * @prop {(Number|Boolean)} forcedMin - Use a number to force the minimum value of the axis (becomes independant of its series)\n * @prop {(Number|Boolean)} forcedMax - Use a number to force the maximum value of the axis (becomes independant of its series)\n */\nconst defaults = {\n lineAt: false,\n display: true,\n flipped: false,\n axisDataSpacing: {\n min: 0.1,\n max: 0.1\n },\n unitModification: false,\n primaryGrid: true,\n secondaryGrid: true,\n\n primaryGridColor: '#f0f0f0',\n secondaryGridColor: '#f0f0f0',\n\n primaryGridWidth: 1,\n secondaryGridWidth: 1,\n\n hideWhenNoSeriesShown: false,\n shiftToZero: false,\n tickPosition: 1,\n nbTicksPrimary: 3,\n nbTicksSecondary: 10,\n ticklabelratio: 1,\n exponentialFactor: 0,\n exponentialLabelFactor: 0,\n logScale: false,\n forcedMin: false,\n forcedMax: false,\n\n span: [ 0, 1 ],\n marginMin: 0,\n marginMax: 0,\n\n scientificScale: false,\n scientificScaleExponent: false,\n engineeringScale: false,\n\n unitInTicks: false,\n unit: false,\n unitWrapperBefore: '',\n unitWrapperAfter: '',\n\n splitMarks: false,\n\n tickLabelOffset: 0,\n\n useKatexForLabel: false\n};\n\n/**\n * Axis constructor. Usually not instanced directly, but for custom made axes, that's possible\n * @class Axis\n * @static\n * @augments EventEmitter\n * @example function myAxis() {};\n * myAxis.prototype = new Graph.getConstructor(\"axis\");\n * graph.setBottomAxis( new myAxis( { } ) );\n */\nclass Axis extends EventEmitter {\n\n constructor() {\n\n super();\n }\n\n init( graph, options, overwriteoptions ) {\n\n this.unitModificationTimeTicks = [\n [ 1, [ 1, 2, 5, 10, 20, 30 ] ],\n [ 60, [ 1, 2, 5, 10, 20, 30 ] ],\n [ 3600, [ 1, 2, 6, 12 ] ],\n [ 3600 * 24, [ 1, 2, 3, 4, 5, 10, 20, 40 ] ]\n ];\n\n this.graph = graph;\n this.options = util.extend( true, {}, defaults, overwriteoptions, options );\n\n this.group = document.createElementNS( this.graph.ns, 'g' );\n this.hasChanged = true;\n\n this.rectEvent = document.createElementNS( this.graph.ns, 'rect' );\n this.rectEvent.setAttribute( 'pointer-events', 'fill' );\n this.rectEvent.setAttribute( 'fill', 'transparent' );\n this.group.appendChild( this.rectEvent );\n\n this.graph.axisGroup.appendChild( this.group ); // Adds to the main axiszone\n\n // Lines at a certain value\n this._lines = [];\n\n this.line = document.createElementNS( this.graph.ns, 'line' );\n this.line.setAttribute( 'stroke', 'black' );\n this.line.setAttribute( 'shape-rendering', 'crispEdges' );\n this.line.setAttribute( 'stroke-linecap', 'square' );\n this.groupTicks = document.createElementNS( this.graph.ns, 'g' );\n this.groupTickLabels = document.createElementNS( this.graph.ns, 'g' );\n\n this.group.appendChild( this.groupTicks );\n this.group.appendChild( this.groupTickLabels );\n this.group.appendChild( this.line );\n\n this.label = document.createElementNS( this.graph.ns, 'text' );\n\n this.labelTspan = document.createElementNS( this.graph.ns, 'tspan' ); // Contains the main label\n this.preunit = ''; //document.createElementNS( this.graph.ns, 'tspan' ); // Contains the scaling unit\n this.unitTspan = document.createElementNS( this.graph.ns, 'tspan' ); // Contains the unit\n this.expTspan = document.createElementNS( this.graph.ns, 'tspan' ); // Contains the exponent (x10)\n this.expTspanExp = document.createElementNS( this.graph.ns, 'tspan' ); // Contains the exponent value\n\n this.label.appendChild( this.labelTspan );\n //this.label.appendChild( this.preunitTspan );\n this.label.appendChild( this.unitTspan );\n this.label.appendChild( this.expTspan );\n this.label.appendChild( this.expTspanExp );\n\n this.expTspan.setAttribute( 'dx', 6 );\n this.expTspanExp.setAttribute( 'dy', -5 );\n this.expTspanExp.setAttribute( 'font-size', '0.8em' );\n\n this.label.setAttribute( 'text-anchor', 'middle' );\n\n this.setTickPosition( this.options.tickPosition );\n\n this.gridLinePath = {\n primary: '',\n secondary: ''\n };\n\n this.gridPrimary = document.createElementNS( this.graph.ns, 'path' );\n this.gridSecondary = document.createElementNS( this.graph.ns, 'path' );\n\n this.graph.groupPrimaryGrids.appendChild( this.gridPrimary );\n this.graph.groupSecondaryGrids.appendChild( this.gridSecondary );\n\n this.setGridLinesStyle();\n\n this.group.appendChild( this.label );\n\n this.groupSeries = document.createElementNS( this.graph.ns, 'g' );\n this.group.appendChild( this.groupSeries );\n\n this.widthHeightTick = 0;\n\n this.ticks = {};\n this.ticksLabels = [];\n this.tickScaling = {\n 1: 3,\n 2: 2,\n 3: 1,\n 4: 0.5\n };\n\n this.currentTick = {};\n this.lastCurrentTick = {};\n\n this.series = [];\n this.totalDelta = 0;\n this.currentAction = false;\n\n this.group.addEventListener( 'mousemove', ( e ) => {\n e.preventDefault();\n var coords = this.graph._getXY( e );\n this.handleMouseMoveLocal( coords.x, coords.y, e );\n\n for ( var i = 0, l = this.series.length; i < l; i++ ) {\n this.series[ i ].handleMouseMove( false, true );\n }\n } );\n\n this.labels = [];\n this.group.addEventListener( 'click', ( e ) => {\n e.preventDefault();\n var coords = this.graph._getXY( e );\n this.addLabel( this.getVal( coords.x - this.graph.getPaddingLeft() ) );\n } );\n\n //this.clip = document.createElementNS( this.graph.ns, 'clipPath' );\n //this.clip.setAttribute( 'id', '_clip' + this.axisRand );\n //this.graph.defs.appendChild( this.clip );\n /*\n this.clipRect = document.createElementNS( this.graph.ns, 'rect' );\n this.clip.appendChild( this.clipRect );\n this.clip.setAttribute( 'clipPathUnits', 'userSpaceOnUse' );\n */\n this.gridPrimary.setAttribute( 'clip-path', 'url(#_clipplot' + this.graph._creation + ')' );\n this.gridSecondary.setAttribute( 'clip-path', 'url(#_clipplot' + this.graph._creation + ')' );\n this.graph._axisHasChanged( this );\n }\n\n handleMouseMoveLocal() {}\n\n /**\n * Hides the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n hide() {\n this.options.display = false;\n return this;\n }\n\n /**\n * Shows the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n show() {\n this.options.display = true;\n return this;\n }\n\n /**\n * Shows or hides the axis\n * @memberof Axis\n * @param {Boolean} display - true to display the axis, false to hide it\n * @return {Axis} The current axis\n */\n setDisplay( bool ) {\n this.options.display = !!bool;\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Boolean} A boolean indicating the displayed state of the axis\n */\n isDisplayed() {\n\n if ( !this.options.hideWhenNoSeriesShown ) {\n return this.options.display;\n }\n\n return this.graph.getSeriesFromAxis( this ).reduce( ( accumulator, serie ) => {\n return accumulator || serie.isShown();\n }, false );\n }\n\n isShown() {\n\n return this.isDisplayed( ...arguments );\n }\n\n hideGroup() {\n if ( this._hidden ) {\n return;\n }\n this._hidden = true;\n this.group.setAttribute( 'display', 'none' );\n }\n\n showGroup() {\n if ( !this._hidden ) {\n return;\n }\n this._hidden = false;\n this.group.setAttribute( 'display', 'initial' );\n }\n\n kill( noRedraw, noSerieKill ) {\n this.graph.killAxis( this, noRedraw, noSerieKill );\n }\n /**\n * Forces the appearence of a straight perpendicular line at value 0\n * @param {Array} atValues - An array of x or y values where the lines are displayed\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setLineAt( atValues ) {\n this.options.lineAt = atValues;\n return this;\n }\n\n // Used to adapt the 0 of the axis to the zero of another axis that has the same direction\n\n /**\n * Aligns ```thisValue``` of the axis to ```foreignValue``` of another axis\n * @param {(Axis|Boolean)} axis - The axis with which the 0 should be aligned. Use \"false\" to deactivate the adapt to 0 mode.\n * @param {Number} thisValue - The value of the current axis that should be aligned\n * @param {Number} foreignValue - The value of the reference axis that should be aligned\n * @param {String} preference - \"min\" or \"max\". Defined the boundary that should behave the more normally\n * @memberof Axis\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n adaptTo( axis, thisValue, foreignValue, preference ) {\n\n if ( !axis ) {\n this.options.adaptTo = false;\n return this;\n }\n\n this.options.adaptTo = {\n axis: axis,\n thisValue: thisValue,\n foreignValue: foreignValue,\n preference: preference\n };\n\n this.adapt();\n\n return this;\n }\n\n /**\n * Adapts maximum and minimum of the axis if options.adaptTo is defined\n * @memberof Axis\n * @returns {Axis} The current axis\n * @since 1.13.2\n */\n adapt() {\n\n if ( !this.options.adaptTo ) {\n return;\n }\n\n var axis = this.options.adaptTo.axis,\n current = this.options.adaptTo.thisValue,\n foreign = this.options.adaptTo.foreignValue;\n\n if ( axis.currentAxisMin === undefined || axis.currentAxisMax === undefined ) {\n axis.setMinMaxToFitSeries();\n }\n\n if ( ( this.options.forcedMin !== false && this.options.forcedMax == false ) || ( this.options.adaptTo.preference !== 'max' ) ) {\n\n if ( this.options.forcedMin !== false ) {\n this.currentAxisMin = this.options.forcedMin;\n } else {\n this.currentAxisMin = this._zoomed ? this.getCurrentMin() : this.getMinValue() - ( current - this.getMinValue() ) * ( this.options.axisDataSpacing.min * ( axis.getCurrentMax() - axis.getCurrentMin() ) / ( foreign - axis.getCurrentMin() ) );\n }\n\n if ( this.currentAxisMin == current ) {\n this.currentAxisMin -= this.options.axisDataSpacing.min * this.getInterval();\n }\n\n var use = this.options.forcedMin !== false ? this.options.forcedMin : this.currentAxisMin;\n this.currentAxisMax = ( current - use ) * ( axis.getCurrentMax() - axis.getCurrentMin() ) / ( foreign - axis.getCurrentMin() ) + use;\n\n } else {\n\n if ( this.options.forcedMax !== false ) {\n this.currentAxisMax = this.options.forcedMax;\n } else {\n this.currentAxisMax = this._zoomed ? this.getCurrentMax() : this.getMaxValue() + ( this.getMaxValue() - current ) * ( this.options.axisDataSpacing.max * ( axis.getCurrentMax() - axis.getCurrentMin() ) / ( axis.getCurrentMax() - foreign ) );\n }\n\n if ( this.currentAxisMax == current ) {\n this.currentAxisMax += this.options.axisDataSpacing.max * this.getInterval();\n }\n\n var use = this.options.forcedMax !== false ? this.options.forcedMax : this.currentAxisMax;\n\n this.currentAxisMin = ( current - use ) * ( axis.getCurrentMin() - axis.getCurrentMax() ) / ( foreign - axis.getCurrentMax() ) + use;\n }\n\n this.graph._axisHasChanged( this );\n }\n\n // Floating axis. Adapts axis position orthogonally to another axis at a defined value. Not taken into account for margins\n\n /**\n * Makes the axis floating (not aligned to the right or the left anymore). You need to specify another axis (perpendicular) and a value at which this axis should be located\n * @param {Axis} axis - The axis on which the current axis should be aligned to\n * @param {Number} value - The value on which the current axis should be aligned\n * @memberof Axis\n * @return {Axis} The current axis\n * @example graph.getYAxis().setFloat( graph.getBottomAxis(), 0 ); // Alignes the y axis with the origin of the bottom axis\n */\n setFloating( axis, value ) {\n\n this.floating = true;\n this.floatingAxis = axis;\n this.floatingValue = value;\n\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Axis} The axis referencing the floating value of the current axis\n */\n getFloatingAxis() {\n return this.floatingAxis;\n }\n\n /**\n * @memberof Axis\n * @return {Axis} The value to which the current axis is aligned to\n */\n getFloatingValue() {\n return this.floatingValue;\n }\n\n /**\n * Sets the axis data spacing\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} min - The spacing at the axis min value\n * @param {Number} [ max = min ] - The spacing at the axis max value. If omitted, will be equal to the \"min\" parameter\n * @return {Axis} The current axis\n */\n setAxisDataSpacing( val1, val2 ) {\n this.options.axisDataSpacing.min = val1;\n this.options.axisDataSpacing.max = val2 || val1;\n return this;\n }\n\n dataSpacing() {\n return this.setAxisDataSpacing( ...arguments );\n }\n\n /**\n * Sets the axis data spacing at the minimum of the axis\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} min - The spacing at the axis min value\n * @return {Axis} The current axis\n */\n setAxisDataSpacingMin( val ) {\n this.options.axisDataSpacing.min = val;\n }\n\n /**\n * Sets the axis data spacing at the maximum of the axis\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} max - The spacing at the axis max value\n * @return {Axis} The current axis\n */\n setAxisDataSpacingMax( val ) {\n this.options.axisDataSpacing.max = val;\n }\n\n setMinPx( px ) {\n\n this.minPx = px;\n this.setMinMaxFlipped();\n }\n\n setMaxPx( px ) {\n\n this.maxPx = px;\n this.setMinMaxFlipped();\n }\n\n /**\n * @memberof Axis\n * @return {Number} The position in px of the bottom of the axis\n */\n getMinPx() {\n return this.minPxFlipped;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The position in px of the top of the axis\n */\n getMaxPx() {\n return this.maxPxFlipped;\n }\n\n getMathMaxPx() {\n return this.maxPx;\n }\n\n getMathMinPx() {\n return this.minPx;\n }\n\n // Returns the true minimum of the axis. Either forced in options or the one from the data\n\n /**\n * Retrieves the minimum possible value of the axis. Can be set by \"forcedMin\", \"adapt0ToAxis\" or by the values of the series the axis contains. Does not take into account any zooming.\n * @memberof Axis\n * @return {Number} The minimum possible value of the axis\n */\n getMinValue() {\n return this.options.forcedMin !== false ? this.options.forcedMin : this.dataMin;\n }\n\n /**\n * Retrieves the maximum possible value of the axis. Can be set by \"forcedMax\", \"adapt0ToAxis\" or by the values of the series the axis contains. Does not take into account any zooming.\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getMaxValue() {\n return this.options.forcedMax !== false ? this.options.forcedMax : this.dataMax;\n }\n\n setMinValueData( min ) {\n this.dataMin = min;\n\n // 25.10.2017. This is to help in the case there's no autoscaling\n if ( isNaN( this.getCurrentMin() ) ) {\n this.setCurrentMin( this.getMinValue() );\n this.cache();\n\n }\n }\n\n setMaxValueData( max ) {\n this.dataMax = max;\n\n // 25.10.2017. This is to help in the case there's no autoscaling\n if ( isNaN( this.getCurrentMax() ) ) {\n this.setCurrentMax( this.getMaxValue() );\n this.cache();\n\n }\n }\n\n /**\n * Retrieves the maximum possible value of the axis based only on the data. Does not take into account the possible axis forcing\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getDataMax() {\n return this.dataMax;\n }\n\n /**\n * Retrieves the minimum possible value of the axis based only on the data. Does not take into account the possible axis forcing\n * @memberof Axis\n * @return {Number} The minimum possible value of the axis\n */\n getDataMin() {\n return this.dataMin;\n }\n\n /**\n * Forces the minimum value of the axis (no more dependant on the serie values)\n * @memberof Axis\n * @param {Number} min - The minimum value of the axis\n * @param {Boolean} noRescale - ```true``` to prevent the axis to rescale to set this minimum. Rescales anyway if current min is lower than the value. Defaults to ```false```\n * @return {Axis} The current axis\n */\n forceMin( min, noRescale = false ) {\n this.options.forcedMin = min;\n this.setCurrentMin( noRescale ? this.getCurrentMin() : undefined );\n this.graph._axisHasChanged( this );\n return this;\n }\n\n /**\n * Forces the maximum value of the axis (no more dependant on the serie values).\n * @memberof Axis\n * @param {Number} max - The maximum value of the axis\n * @param {Boolean} noRescale - ```true``` to prevent the axis to rescale to set this maximum. Rescales anyway if current max is higher than the value\n * @return {Axis} The current axis\n */\n forceMax( max, noRescale = false ) {\n this.options.forcedMax = max;\n this.setCurrentMax( noRescale ? this.getCurrentMax() : undefined );\n this.graph._axisHasChanged( this );\n return this;\n }\n\n /**\n * Retrieves the forced minimum of the axis\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getForcedMin() {\n return this.options.forcedMin;\n }\n\n /**\n * Retrieves the forced minimum of the axis\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getForcedMax() {\n return this.options.forcedMax;\n }\n\n /**\n * Forces the min and max values of the axis to the min / max values of another axis\n * @param {Axis} axis - The axis from which the min / max values are retrieved.\n * @memberof Axis\n * @return {Axis} The current axis\n */\n forceToAxis( axis ) {\n if ( axis.getMaxValue && axis.getMinValue ) {\n this.options.forcedMin = axis.getMinValue();\n this.options.forcedMax = axis.getMaxValue();\n }\n\n return this;\n }\n\n getNbTicksPrimary() {\n return this.options.nbTicksPrimary;\n }\n\n setNbTicksPrimary( nb ) {\n this.options.nbTicksPrimary = nb;\n }\n\n getNbTicksSecondary() {\n return this.options.nbTicksSecondary;\n }\n\n setNbTicksSecondary( nb ) {\n this.options.nbTicksSecondary = nb;\n return this;\n }\n\n handleMouseMove( px ) {\n this.mouseVal = this.getVal( px );\n }\n\n handleMouseWheel( delta, e, baseline ) {\n\n delta = Math.min( 0.2, Math.max( -0.2, delta ) );\n\n if ( baseline == 'min' ) {\n baseline = this.getMinValue();\n } else if ( baseline == 'max' ) {\n baseline = this.getMaxValue();\n } else if ( !baseline ) {\n baseline = 0;\n }\n\n this._doZoomVal(\n ( ( this.getCurrentMax() - baseline ) * ( 1 + delta ) ) + baseline, ( ( this.getCurrentMin() - baseline ) * ( 1 + delta ) ) + baseline\n );\n\n this.graph.draw();\n //\tthis.graph.drawSeries(true);\n\n }\n\n set zoomLock( bln ) {\n this._zoomLocked = bln;\n }\n\n get zoomLock() {\n return this._zoomLocked || false;\n }\n\n /**\n * Performs a zoom on the axis, without redraw afterwards\n * @param {Number} val1 - The new axis minimum\n * @param {Number} val2 - The new axis maximum\n * @memberof Axis\n * @return {Axis} The current axis\n * @example\n * graph.getBottomAxis().zoom( 50, 70 ); // Axis boundaries will be 50 and 70 after next redraw\n * graph.redraw();\n * @example\n * graph.getBottomAxis().forceMin( 0 ).forceMax( 100 ).zoom( 50, 70 ); // Axis boundaries will be 50 and 70 after next redraw\n * graph.draw();\n * graph.autoscaleAxes(); // New bottom axis boundaries will be 0 and 100, not 50 and 70 !\n * graph.draw();\n */\n zoom( val1, val2, forceLock ) {\n\n if ( !forceLock && this.zoomLock ) {\n return;\n }\n\n return this._doZoomVal( val1, val2, true );\n }\n\n _doZoomVal( val1, val2, mute ) {\n\n return this._doZoom( this.getPx( val1 ), this.getPx( val2 ), val1, val2, mute );\n }\n\n _doZoom( px1, px2, val1, val2, mute ) {\n\n //if(this.options.display || 1 == 1) {\n var val1 = val1 !== undefined ? val1 : this.getVal( px1 );\n var val2 = val2 !== undefined ? val2 : this.getVal( px2 );\n\n this.setCurrentMin( Math.min( val1, val2 ) );\n this.setCurrentMax( Math.max( val1, val2 ) );\n\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n\n this._zoomed = true;\n\n this.adapt();\n\n this._hasChanged = true;\n\n // New method\n if ( !mute ) {\n this.emit( 'zoom', [ this.currentAxisMin, this.currentAxisMax, this ] );\n }\n\n return this;\n }\n\n getSerieShift() {\n return this._serieShift;\n }\n\n getSerieScale() {\n return this._serieScale;\n }\n\n getMouseVal() {\n return this.mouseVal;\n }\n\n getUnitPerTick( px, nbTick, valrange ) {\n\n var pxPerTick = px / nbTicks; // 1000 / 100 = 10 px per tick\n if ( !nbTick ) {\n nbTick = px / 10;\n } else {\n nbTick = Math.min( nbTick, px / 10 );\n }\n\n // So now the question is, how many units per ticks ?\n // Say, we have 0.0004 unit per tick\n var unitPerTick = valrange / nbTick;\n\n switch ( this.options.unitModification ) {\n\n case 'time':\n case 'time:min.sec':\n {\n\n //const max = this.getModifiedValue( this.getMaxValue() );/*,\n /*units = [\n [ 60, 'min' ],\n [ 3600, 'h' ],\n [ 3600 * 24, 'd' ]\n ];*/\n\n let i, l, k, m;\n let breaked = false;\n for ( i = 0, l = this.unitModificationTimeTicks.length; i < l; i++ ) {\n for ( k = 0, m = this.unitModificationTimeTicks[ i ][ 1 ].length; k < m; k++ ) {\n if ( unitPerTick < this.unitModificationTimeTicks[ i ][ 0 ] * this.unitModificationTimeTicks[ i ][ 1 ][ k ] ) {\n breaked = true;\n break;\n }\n }\n if ( breaked ) {\n break;\n }\n }\n\n //i and k contain the good variable;\n if ( i !== this.unitModificationTimeTicks.length ) {\n unitPerTickCorrect = this.unitModificationTimeTicks[ i ][ 0 ] * this.unitModificationTimeTicks[ i ][ 1 ][ k ];\n } else {\n unitPerTickCorrect = 1;\n }\n\n break;\n }\n default:\n {\n\n // We take the log\n var decimals = Math.floor( Math.log( unitPerTick ) / Math.log( 10 ) );\n /*\n \t\t\t\t\tExample:\n \t\t\t\t\t\t13'453 => Math.log10() = 4.12 => 4\n \t\t\t\t\t\t0.0000341 => Math.log10() = -4.46 => -5\n \t\t\t\t*/\n\n var numberToNatural = unitPerTick * Math.pow( 10, -decimals );\n\n /*\n \t\t\t\t\tExample:\n \t\t\t\t\t\t13'453 (4) => 1.345\n \t\t\t\t\t\t0.0000341 (-5) => 3.41\n \t\t\t\t*/\n\n this.decimals = -decimals;\n\n var possibleTicks = [ 1, 2, 5, 10 ];\n var closest = false;\n for ( let i = possibleTicks.length - 1; i >= 0; i-- ) {\n if ( !closest || ( Math.abs( possibleTicks[ i ] - numberToNatural ) < Math.abs( closest - numberToNatural ) ) ) {\n closest = possibleTicks[ i ];\n }\n }\n\n // Ok now closest is the number of unit per tick in the natural number\n /*\n \t\t\t\t\tExample:\n \t\t\t\t\t\t13'453 (4) (1.345) => 1\n \t\t\t\t\t\t0.0000341 (-5) (3.41) => 5\n \t\t\t\t*/\n\n // Let's scale it back\n var unitPerTickCorrect = closest * Math.pow( 10, decimals );\n\n /*\n \t\t\t\t\tExample:\n \t\t\t\t\t\t13'453 (4) (1.345) (1) => 10'000\n \t\t\t\t\t\t0.0000341 (-5) (3.41) (5) => 0.00005\n \t\t\t\t*/\n break;\n }\n }\n\n var nbTicks = valrange / unitPerTickCorrect;\n\n var pxPerTick = px / nbTick;\n return [ unitPerTickCorrect, nbTicks, pxPerTick ];\n }\n\n /**\n * Resets the min and max of the serie to fit the series it contains\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setMinMaxToFitSeries( noNotify ) {\n\n var interval = this.getInterval();\n\n if ( this.options.logScale ) {\n\n this.currentAxisMin = Math.max( 1e-50, this.getMinValue() * 0.9 );\n this.currentAxisMax = Math.max( 1e-50, this.getMaxValue() * 1.1 );\n\n } else {\n\n this.currentAxisMin = this.getMinValue();\n this.currentAxisMax = this.getMaxValue();\n\n if ( this.getForcedMin() === false ) {\n this.currentAxisMin -= ( this.options.axisDataSpacing.min * interval );\n }\n\n if ( this.getForcedMax() === false ) {\n this.currentAxisMax += ( this.options.axisDataSpacing.max * interval );\n }\n }\n\n if ( isNaN( this.currentAxisMin ) || isNaN( this.currentAxisMax ) ) {\n this.currentAxisMax = undefined;\n this.currentAxisMin = undefined;\n }\n\n this.cache();\n\n this._zoomed = false;\n\n this.adapt();\n\n if ( !noNotify ) {\n this.graph._axisHasChanged( this );\n }\n\n this.emit( 'zoomOutFull', [ this.currentAxisMin, this.currentAxisMax, this ] );\n\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Number} the maximum interval ( max - min ) of the axis ( not nessarily the current one )\n */\n getInterval() {\n return this.getMaxValue() - this.getMinValue();\n }\n\n /**\n * @memberof Axis\n * @return {Number} the maximum interval ( max - min ) of the axis ( not nessarily the current one )\n */\n getCurrentInterval() {\n return this.cachedInterval;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The current minimum value of the axis\n */\n getCurrentMin() {\n return this.cachedCurrentMin;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The current maximum value of the axis\n */\n getCurrentMax() {\n return this.cachedCurrentMax;\n }\n\n /**\n * Caches the current axis minimum\n * @memberof Axis\n */\n cacheCurrentMin() {\n this.cachedCurrentMin = this.currentAxisMin == this.currentAxisMax ? ( this.options.logScale ? this.currentAxisMin / 10 : this.currentAxisMin - 1 ) : this.currentAxisMin;\n }\n\n /**\n * Caches the current axis maximum\n * @memberof Axis\n */\n cacheCurrentMax() {\n this.cachedCurrentMax = this.currentAxisMax == this.currentAxisMin ? ( this.options.logScale ? this.currentAxisMax * 10 : this.currentAxisMax + 1 ) : this.currentAxisMax;\n }\n\n /**\n * Caches the current interval\n * @memberof Axis\n */\n cacheInterval() {\n this.cachedInterval = this.cachedCurrentMax - this.cachedCurrentMin;\n }\n\n cache() {\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n }\n\n /**\n * Sets the current minimum value of the axis. If lower that the forced value, the forced value is used\n * @memberof Axis\n * @param {Number} val - The new minimum value\n * @return {Axis} The current axis\n */\n setCurrentMin( val ) {\n\n if ( val === undefined || ( this.getForcedMin() !== false && ( val < this.getForcedMin() || val === undefined ) ) ) {\n val = this.getMinValue();\n }\n\n this.currentAxisMin = val;\n if ( this.options.logScale ) {\n this.currentAxisMin = Math.max( 1e-50, val );\n }\n\n this.cacheCurrentMin();\n this.cacheInterval();\n\n this.graph._axisHasChanged( this );\n return this;\n }\n\n /**\n * Sets the current maximum value of the axis. If higher that the forced value, the forced value is used\n * @memberof Axis\n * @param {Number} val - The new maximum value\n * @return {Axis} The current axis\n */\n setCurrentMax( val ) {\n\n if ( val === undefined || ( this.getForcedMax() !== false && ( val > this.getForcedMax() || val === undefined ) ) ) {\n val = this.getMaxValue();\n }\n\n this.currentAxisMax = val;\n\n if ( this.options.logScale ) {\n this.currentAxisMax = Math.max( 1e-50, val );\n }\n\n this.cacheCurrentMax();\n this.cacheInterval();\n\n this.graph._axisHasChanged( this );\n }\n\n /**\n * Sets the flipping state of the axis. If enabled, the axis is descending rather than ascending.\n * @memberof Axis\n * @param {Boolean} flip - The new flipping state of the axis\n * @return {Axis} The current axis\n */\n flip( flip ) {\n this.options.flipped = flip;\n this.setMinMaxFlipped();\n return this;\n }\n /*\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n var maxPx = this.maxPx - interval * this.options.span[ 0 ];\n var minPx = this.maxPx - interval * this.options.span[ 1 ];\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n\n // this.minPx = minPx;\n //this.maxPx = maxPx;\n }\n */\n /**\n * @memberof Axis\n * @return {Boolean} The current flipping state of the axis\n */\n isFlipped() {\n return this.options.flipped;\n }\n\n _draw() { // Redrawing of the axis\n\n var self = this;\n // var visible;\n\n // this.drawInit();\n\n if ( this.currentAxisMin === undefined || this.currentAxisMax === undefined ) {\n this.setMinMaxToFitSeries( true ); // We reset the min max as a function of the series\n }\n\n // this.cache();\n\n // this.setSlaveAxesBoundaries();\n\n // The data min max is stored in this.dataMin, this.dataMax\n\n //var widthPx = this.maxPx - this.minPx;\n var widthPx = Math.abs( this.getMaxPx() - this.getMinPx() );\n var valrange = this.getCurrentInterval();\n\n /* Number of px per unit */\n /* Example: width: 1000px\n\t\t\t/* \t\t\t10 - 100 => 11.11\n\t\t\t/*\t\t\t0 - 2 => 500\n\t\t\t/*\t\t\t0 - 0.00005 => 20'000'000\n\t\t\t*/\n\n if ( !this.isShown() ) {\n this.line.setAttribute( 'display', 'none' );\n return 0;\n }\n\n this.line.setAttribute( 'display', 'block' );\n\n if ( this.options.scientificScale == true ) {\n\n if ( this.options.scientificScaleExponent ) {\n\n this.scientificExponent = this.options.scientificScaleExponent;\n } else {\n this.scientificExponent = Math.floor( Math.log( Math.max( Math.abs( this.getCurrentMax() ), Math.abs( this.getCurrentMin() ) ) ) / Math.log( 10 ) );\n }\n } else {\n this.scientificExponent = 0;\n }\n\n /************************************/\n /*** DRAWING LABEL ******************/\n /************************************/\n\n this.gridLinePath.primary = '';\n this.gridLinePath.secondary = '';\n\n /*\n var label;\n if ( label = this.getLabel() ) {\n // Sets the label\n this.labelTspan.textContent = label;\n }\n*/\n let letter;\n if ( !this.options.useKatexForLabel || !this.graph.hasKatexRenderer() ) {\n\n if ( this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && ( this.scientificExponent = this.getEngineeringExponent( this.scientificExponent ) ) && ( letter = this.getExponentGreekLetter( this.scientificExponent ) ) ) {\n\n this.preunit = letter;\n this.unitTspan.setAttribute( 'dx', 0 );\n\n } else if ( this.scientificExponent !== 0 && !isNaN( this.scientificExponent ) ) {\n\n if ( this.options.engineeringScale ) {\n this.scientificExponent = this.getEngineeringExponent( this.scientificExponent );\n }\n\n this.preunit = '';\n\n this.expTspan.setAttribute( 'display', 'visible' );\n this.expTspanExp.setAttribute( 'display', 'visible' );\n\n this.expTspan.textContent = 'x10';\n this.expTspanExp.textContent = this.scientificExponent;\n\n } else {\n\n if ( !this.options.unit ) {\n this.unitTspan.setAttribute( 'display', 'none' );\n }\n\n this.preunit = '';\n this.expTspan.setAttribute( 'display', 'none' );\n this.expTspanExp.setAttribute( 'display', 'none' );\n }\n\n this.writeUnit();\n\n } else {\n\n let string = this.getLabel();\n /*,\n domEl;*/\n\n if ( this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && ( this.scientificExponent = this.getEngineeringExponent( this.scientificExponent ) ) && ( letter = this.getExponentGreekLetter( this.scientificExponent ) ) ) {\n\n string += letter;\n this.preunitTspan.innerHTML = letter;\n this.preunitTspan.setAttribute( 'display', 'visible' );\n this.unitTspan.setAttribute( 'dx', 0 );\n\n string += ' ' + letter + ' ' + this.options.unit;\n\n } else if ( this.scientificExponent !== 0 && !isNaN( this.scientificExponent ) ) {\n\n if ( this.options.engineeringScale ) {\n this.scientificExponent = this.getEngineeringExponent( this.scientificExponent );\n }\n string += ' \\\\cdot 10^' + this.scientificExponent + ' ' + this.options.unit;\n\n }\n\n this.katexElement = this.graph.renderWithKatex( string, this.katexElement );\n }\n\n if ( !this.options.hideTicks ) {\n\n this.resetTicksLength();\n\n if ( this.linkedToAxis ) { // px defined, linked to another axis\n\n this.linkedToAxis.deltaPx = 10;\n var widthHeight = this.drawLinkedToAxisTicksWrapper( widthPx, valrange );\n\n } else if ( !this.options.logScale ) {\n // So the setting is: How many ticks in total ? Then we have to separate it\n\n var widthHeight = this.drawLinearTicksWrapper( widthPx, valrange );\n\n } else {\n\n var widthHeight = this.drawLogTicks();\n\n }\n } else {\n var widthHeight = 0;\n }\n\n this.removeUselessTicks();\n this.removeUselessTickLabels();\n\n this.gridPrimary.setAttribute( 'd', this.gridLinePath.primary );\n this.gridSecondary.setAttribute( 'd', this.gridLinePath.secondary );\n\n // Looks for axes linked to this current axis\n var axes = this.graph.findAxesLinkedTo( this );\n axes.forEach( function( axis ) {\n\n if ( !axis.linkedToAxis ) {\n return;\n }\n axis.setMinPx( self.getMinPx() );\n axis.setMaxPx( self.getMaxPx() );\n\n axis.draw();\n\n } );\n\n /************************************/\n /*** DRAW CHILDREN IMPL SPECIFIC ****/\n /************************************/\n\n // this.drawSpecifics();\n\n return widthHeight;\n }\n\n drawLines() {\n\n if ( this.options.lineAt && Array.isArray( this.options.lineAt ) ) {\n\n this.options.lineAt.forEach( ( val, index ) => {\n\n if ( !isNaN( val ) && this.getCurrentMin() <= val && this.getCurrentMax() >= val ) {\n\n this._lines[ index ] = this._drawLine( val, this._lines[ index ] );\n\n } else {\n this._hideLine( this._lines[ index ] );\n }\n\n } );\n }\n\n }\n\n writeUnit() {\n if ( this.options.unit ) {\n\n this.unitTspan.setAttribute( 'display', 'visible' );\n this.unitTspan.setAttribute( 'dx', 5 );\n\n this.expTspan.setAttribute( 'display', 'none' );\n this.expTspanExp.setAttribute( 'display', 'none' );\n this.unitTspan.innerHTML = ( this.options.unitWrapperBefore + this.preunit + this.options.unit + this.options.unitWrapperAfter ).replace( /\\^([-+0-9]*)(.*)/g, \"$1$2\" );\n\n } else {\n this.unitTspan.setAttribute( 'display', 'none' );\n }\n }\n\n getExponentGreekLetter( val ) {\n\n switch ( val ) {\n\n case 3:\n {\n return 'k';\n }\n\n case 6:\n {\n return 'M';\n }\n case 9:\n {\n return 'G';\n }\n case 12:\n {\n return 'T';\n }\n case 15:\n {\n return 'E';\n }\n case -3:\n {\n return 'm';\n }\n case -6:\n {\n return 'μ';\n }\n case -9:\n {\n return 'n';\n }\n case -12:\n {\n return 'p';\n\n }\n case -15:\n {\n return 'f';\n }\n default:\n {\n return '';\n }\n }\n\n }\n\n drawLinearTicksWrapper( widthPx, valrange ) {\n\n let tickPrimaryUnit;\n\n if ( this.options.primaryTickUnit ) {\n\n tickPrimaryUnit = this.options.primaryTickUnit;\n\n } else {\n\n tickPrimaryUnit = this.getUnitPerTick( widthPx, this.getNbTicksPrimary(), valrange )[ 0 ];\n\n if ( this.options.maxPrimaryTickUnit && this.options.maxPrimaryTickUnit < tickPrimaryUnit ) {\n tickPrimaryUnit = this.options.maxPrimaryTickUnit;\n } else if ( this.options.minPrimaryTickUnit && this.options.minPrimaryTickUnit > tickPrimaryUnit ) {\n tickPrimaryUnit = this.options.minPrimaryTickUnit;\n }\n\n }\n\n // We need to get here the width of the ticks to display the axis properly, with the correct shift\n return this.drawTicks( tickPrimaryUnit, this.secondaryTicks() );\n }\n\n forcePrimaryTickUnit( primaryInterval ) {\n this.options.primaryTickUnit = primaryInterval;\n }\n\n forcePrimaryTickUnitMax( value ) {\n this.options.maxPrimaryTickUnit = value;\n }\n\n forcePrimaryTickUnitMin( value ) {\n this.options.minPrimaryTickUnit = value;\n }\n\n getPrimaryTickUnit() {\n return this.incrTick;\n }\n\n setTickLabelRatio( tickRatio ) {\n this.options.ticklabelratio = tickRatio;\n }\n\n doesHideWhenNoSeriesShown() {\n return this.options.hideWhenNoSeriesShown;\n }\n\n draw() {\n\n this._widthLabels = 0;\n var drawn = this._draw();\n this._widthLabels += drawn;\n return drawn;\n }\n\n drawTicks( primary, secondary ) {\n\n var unitPerTick = primary,\n min = this.getCurrentMin(),\n max = this.getCurrentMax(),\n secondaryIncr,\n incrTick,\n subIncrTick,\n loop = 0;\n\n if ( secondary ) {\n secondaryIncr = unitPerTick / secondary;\n }\n\n incrTick = this.options.shiftToZero ? this.dataMin - Math.ceil( ( this.dataMin - min ) / unitPerTick ) * unitPerTick : Math.floor( min / unitPerTick ) * unitPerTick;\n this.incrTick = primary;\n\n while ( incrTick <= max ) {\n\n loop++;\n if ( loop > 200 ) {\n break;\n }\n\n if ( secondary ) {\n\n subIncrTick = incrTick + secondaryIncr;\n this.subIncrTick = subIncrTick;\n //widthHeight = Math.max(widthHeight, this.drawTick(subIncrTick, 1));\n var loop2 = 0;\n\n while ( subIncrTick < incrTick + unitPerTick ) {\n loop2++;\n if ( loop2 > 100 ) {\n break;\n }\n\n if ( subIncrTick < min || subIncrTick > max ) {\n subIncrTick += secondaryIncr;\n continue;\n }\n\n this.drawTickWrapper( subIncrTick, false, Math.abs( subIncrTick - incrTick - unitPerTick / 2 ) < 1e-4 ? 2 : 3 );\n\n subIncrTick += secondaryIncr;\n }\n }\n\n if ( incrTick < min || incrTick > max ) {\n incrTick += primary;\n continue;\n }\n\n this.drawTickWrapper( incrTick, true, 1 );\n incrTick += primary;\n }\n\n this.widthHeightTick = this.getMaxSizeTick();\n return this.widthHeightTick;\n }\n\n nextTick( level, callback ) {\n\n this.ticks[ level ] = this.ticks[ level ] || [];\n this.lastCurrentTick[ level ] = this.lastCurrentTick[ level ] || 0;\n this.currentTick[ level ] = this.currentTick[ level ] || 0;\n\n if ( this.currentTick[ level ] >= this.ticks[ level ].length ) {\n var tick = document.createElementNS( this.graph.ns, 'line' );\n this.groupTicks.appendChild( tick );\n this.ticks[ level ].push( tick );\n\n callback( tick );\n }\n\n var tick = this.ticks[ level ][ this.currentTick[ level ] ];\n\n if ( this.currentTick[ level ] >= this.lastCurrentTick[ level ] ) {\n tick.setAttribute( 'display', 'visible' );\n }\n\n this.currentTick[ level ]++;\n\n return tick;\n }\n\n nextTickLabel( callback ) {\n\n this.ticksLabels = this.ticksLabels || [];\n this.lastCurrentTickLabel = this.lastCurrentTickLabel || 0;\n this.currentTickLabel = this.currentTickLabel || 0;\n\n if ( this.currentTickLabel >= this.ticksLabels.length ) {\n\n var tickLabel = document.createElementNS( this.graph.ns, 'text' );\n this.groupTickLabels.appendChild( tickLabel );\n this.ticksLabels.push( tickLabel );\n callback( tickLabel );\n }\n\n var tickLabel = this.ticksLabels[ this.currentTickLabel ];\n\n if ( this.currentTickLabel >= this.lastCurrentTickLabel ) {\n tickLabel.setAttribute( 'display', 'visible' );\n }\n\n this.currentTickLabel++;\n\n return tickLabel;\n }\n\n removeUselessTicks() {\n\n for ( var j in this.currentTick ) {\n\n for ( var i = this.currentTick[ j ]; i < this.ticks[ j ].length; i++ ) {\n this.ticks[ j ][ i ].setAttribute( 'display', 'none' );\n }\n\n this.lastCurrentTick[ j ] = this.currentTick[ j ];\n this.currentTick[ j ] = 0;\n }\n }\n\n removeUselessTickLabels() {\n\n for ( var i = this.currentTickLabel; i < this.ticksLabels.length; i++ ) {\n this.ticksLabels[ i ].setAttribute( 'display', 'none' );\n }\n\n this.lastCurrentTickLabel = this.currentTickLabel;\n this.currentTickLabel = 0;\n\n }\n /*\n doGridLine() {\n var gridLine = document.createElementNS( this.graph.ns, 'line' );\n this.groupGrids.appendChild( gridLine );\n return gridLine;\n };*/\n\n nextGridLine( primary, x1, x2, y1, y2 ) {\n\n if ( !( ( primary && this.options.primaryGrid ) || ( !primary && this.options.secondaryGrid ) ) ) {\n return;\n }\n\n this.gridLinePath[ primary ? 'primary' : 'secondary' ] += 'M ' + x1 + ' ' + y1 + ' L ' + x2 + ' ' + y2;\n }\n\n setGridLineStyle( gridLine, primary ) {\n\n gridLine.setAttribute( 'shape-rendering', 'crispEdges' );\n gridLine.setAttribute( 'stroke', primary ? this.getPrimaryGridColor() : this.getSecondaryGridColor() );\n gridLine.setAttribute( 'stroke-width', primary ? this.getPrimaryGridWidth() : this.getSecondaryGridWidth() );\n gridLine.setAttribute( 'stroke-opacity', primary ? this.getPrimaryGridOpacity() : this.getSecondaryGridOpacity() );\n\n var dasharray;\n if ( ( dasharray = primary ? this.getPrimaryGridDasharray() : this.getSecondaryGridDasharray() ) ) {\n gridLine.setAttribute( 'stroke-dasharray', dasharray );\n }\n\n }\n\n setGridLinesStyle() {\n this.setGridLineStyle( this.gridPrimary, true );\n this.setGridLineStyle( this.gridSecondary, false );\n return this;\n }\n\n resetTicksLength() {}\n\n secondaryTicks() {\n return this.options.nbTicksSecondary;\n }\n\n drawLogTicks() {\n var min = this.getCurrentMin(),\n max = this.getCurrentMax();\n var incr = Math.min( min, max );\n var max = Math.max( min, max );\n\n if ( incr < 1e-50 ) {\n incr = 1e-50;\n }\n\n if ( Math.log( incr ) - Math.log( max ) > 20 ) {\n max = Math.pow( 10, ( Math.log( incr ) * 20 ) );\n }\n\n var optsMain = {\n fontSize: '1.0em',\n exponential: true,\n overwrite: false\n };\n\n if ( incr < 0 ) {\n incr = 0;\n }\n\n var pow = incr == 0 ? 0 : Math.floor( Math.log( incr ) / Math.log( 10 ) );\n var incr = 1,\n val;\n while ( ( val = incr * Math.pow( 10, pow ) ) < max ) {\n if ( incr == 1 ) { // Superior power\n if ( val > min )\n this.drawTickWrapper( val, true, 1, optsMain );\n }\n if ( incr == 10 ) {\n incr = 1;\n pow++;\n } else {\n\n if ( incr != 1 && val > min ) {\n\n this.drawTickWrapper( val, false, 2, {\n overwrite: '',\n fontSize: '0.6em'\n } );\n\n }\n\n incr++;\n }\n }\n\n this.widthHeightTick = this.getMaxSizeTick();\n return this.widthHeightTick;\n }\n\n drawTickWrapper( value, label, level, options ) {\n\n //var pos = this.getPos( value );\n\n this.drawTick( value, level, options );\n }\n\n /**\n * Used to scale the master axis into the slave axis\n * @function SlaveAxisScalingFunction\n * @param {Number} val - The master value to convert into a slave value\n * @returns undefined\n */\n\n /**\n * Makes this axis a slave. This can be used to show the same data with different units, specifically when a conversion function exists from axis -> slaveAxis but not in reverse. This axis should actually have no series.\n * @param {Axis} axis - The master axis\n * @param {SlaveAxisScalingFunction} scalingFunction - The scaling function used to map masterValue -> slaveValue\n * @param {Number} decimals - The number of decimals to round the value to\n * @memberof Axis\n * @return {Number} The width or height used by the axis (used internally)\n */\n linkToAxis( axis, scalingFunction, decimals ) {\n\n this.linkedToAxis = {\n axis: axis,\n scalingFunction: scalingFunction,\n decimals: decimals || 1\n };\n\n }\n\n drawLinkedToAxisTicksWrapper( widthPx, valrange ) {\n\n var opts = this.linkedToAxis,\n px = 0,\n val,\n t,\n l,\n delta2;\n\n // Redrawing the main axis ? Why ?\n //opts.axis.draw();\n\n if ( !opts.deltaPx ) {\n opts.deltaPx = 10;\n }\n\n do {\n\n val = opts.scalingFunction( opts.axis.getVal( px + this.getMinPx() ) );\n\n if ( opts.decimals ) {\n this.decimals = opts.decimals;\n }\n\n t = this.drawTick( val, 1, {}, px + this.getMinPx() );\n\n if ( !t ) {\n console.error( val, px, this.getMinPx() );\n throw new Error( 'Unable to draw tick. Please report the test-case' );\n }\n\n l = String( t[ 1 ].textContent ).length * 8;\n delta2 = Math.round( l / 5 ) * 5;\n\n if ( delta2 > opts.deltaPx ) {\n opts.deltaPx = delta2;\n // this.drawInit();\n this.drawLinkedToAxisTicksWrapper( widthPx, valrange );\n return;\n }\n\n px += opts.deltaPx;\n\n } while ( px < widthPx );\n }\n\n /**\n * Transform a value into pixels, according to the axis scaling. The value is referenced to the drawing wrapper, not the the axis minimal value\n * @param {Number} value - The value to translate into pixels\n * @memberof Axis\n * @return {Number} The value transformed into pixels\n */\n getPos( value ) {\n return this.getPx( value );\n }\n\n /**\n * @alias Axis~getPos\n */\n getPx( value ) {\n // if(this.getMaxPx() == undefined)\n // console.log(this);\n //console.log(this.getMaxPx(), this.getMinPx(), this.getCurrentInterval());\n // Ex 50 / (100) * (1000 - 700) + 700\n\n //console.log( value, this.getCurrentMin(), this.getMaxPx(), this.getMinPx(), this.getCurrentInterval() );\n if ( !this.options.logScale ) {\n\n return ( value - this.getCurrentMin() ) / ( this.getCurrentInterval() ) * ( this.getMaxPx() - this.getMinPx() ) + this.getMinPx();\n } else {\n // 0 if value = min\n // 1 if value = max\n\n if ( value < 0 )\n return;\n\n var value = ( ( Math.log( value ) - Math.log( this.getCurrentMin() ) ) / ( Math.log( this.getCurrentMax() ) - Math.log( this.getCurrentMin() ) ) ) * ( this.getMaxPx() - this.getMinPx() ) + this.getMinPx();\n\n return value;\n }\n }\n\n /**\n * @alias Axis~getPos\n */\n getRoundedPx( value ) {\n // if(this.getMaxPx() == undefined)\n // console.log(this);\n //console.log(this.getMaxPx(), this.getMinPx(), this.getCurrentInterval());\n // Ex 50 / (100) * (1000 - 700) + 700\n\n //console.log( value, this.getCurrentMin(), this.getMaxPx(), this.getMinPx(), this.getCurrentInterval() );\n return Math.round( this.getPx( value ) * 10 ) / 10;\n }\n\n /**\n * Transform a pixel position (referenced to the graph zone, not to the axis minimum) into a value, according to the axis scaling.\n * @param {Number} pixels - The number of pixels to translate into a value\n * @memberof Axis\n * @return {Number} The axis value corresponding to the pixel position\n */\n getVal( px ) {\n\n if ( !this.options.logScale ) {\n\n return ( px - this.getMinPx() ) / ( this.getMaxPx() - this.getMinPx() ) * this.getCurrentInterval() + this.getCurrentMin();\n\n } else {\n\n return Math.exp( ( px - this.getMinPx() ) / ( this.getMaxPx() - this.getMinPx() ) * ( Math.log( this.getCurrentMax() ) - Math.log( this.getCurrentMin() ) ) + Math.log( this.getCurrentMin() ) );\n }\n }\n\n /**\n * Transform a delta value into pixels\n * @param {Number} value - The value to translate into pixels\n * @return {Number} The value transformed into pixels\n * @example graph.getBottomAxis().forceMin( 20 ).forceMax( 50 ).getRelPx( 2 ); // Returns how many pixels will be covered by 2 units. Let's assume 600px of width, it's ( 2 / 30 ) * 600 = 40px\n */\n getRelPx( delta ) {\n\n return ( delta / this.getCurrentInterval() ) * ( this.getMaxPx() - this.getMinPx() );\n }\n\n /**\n * Transform a delta pixels value into value\n * @param {Number} pixels - The pixel to convert into a value\n * @return {Number} The delta value corresponding to delta pixels\n * @see Axis~getRelPx\n * @example graph.getBottomAxis().forceMin( 20 ).forceMax( 50 ).getRelVal( 40 ); // Returns 2 (for 600px width)\n */\n getRelVal( px ) {\n return px / ( this.getMaxPx() - this.getMinPx() ) * this.getCurrentInterval();\n }\n\n valueToText( value ) {\n\n if ( this.scientificExponent ) {\n\n value /= Math.pow( 10, this.scientificExponent );\n return value.toFixed( 1 );\n\n } else {\n\n value = value * Math.pow( 10, this.getExponentialFactor() ) * Math.pow( 10, this.getExponentialLabelFactor() );\n if ( this.options.shiftToZero ) {\n value -= this.dataMin;\n }\n if ( this.options.ticklabelratio ) {\n value *= this.options.ticklabelratio;\n }\n if ( this.options.unitModification ) {\n value = this.modifyUnit( value, this.options.unitModification );\n return value;\n }\n\n var dec = this.decimals - this.getExponentialFactor() - this.getExponentialLabelFactor();\n\n if ( isNaN( value ) ) {\n return '';\n }\n\n if ( dec > 0 ) {\n value = value.toFixed( dec );\n } else {\n value = value.toFixed( 0 );\n }\n\n if ( this.options.unitInTicks && this.options.unit ) {\n value += ' ' + this.options.unit;\n }\n\n return value;\n }\n }\n\n /**\n * Computes a value and returns it in HTML formatting\n * @memberof Axis\n * @param {Number} value - The value to compute\n * @param {Boolean} noScaling - Does not display scaling\n * @param {Boolean} noUnits - Does not display units\n * @return {String} An HTML string containing the computed value\n * @example graph.getXAxis().setUnit( \"m\" ).setUnitDecade( true ).setScientific( true );\n * graph.getXAxis().valueToHtml( 3500 ); // Returns \"3.5 km\"\n * @see Axis#valueToText\n */\n valueToHtml( value, noScaling, noUnits ) {\n\n var text = this.valueToText( value );\n var letter;\n\n if ( this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && ( this.scientificExponent = this.getEngineeringExponent( this.scientificExponent ) ) && ( letter = this.getExponentGreekLetter( this.scientificExponent ) ) ) {\n\n text += letter;\n\n } else if ( this.scientificExponent !== 0 && !isNaN( this.scientificExponent ) && !noScaling ) {\n text += 'x10';\n text += '' + this.scientificExponent + '';\n }\n\n if ( this.options.unit && !noUnits ) {\n\n text += this.options.unit.replace( /\\^([-+0-9]*)/g, '$1' );\n }\n\n return text;\n }\n\n getModifiedValue( value ) {\n if ( this.options.ticklabelratio ) {\n value *= this.options.ticklabelratio;\n }\n\n if ( this.options.shiftToZero ) {\n value -= this.getMinValue() * ( this.options.ticklabelratio || 1 );\n }\n\n return value;\n }\n\n modifyUnit( value, mode ) {\n\n var text = '';\n var incr = this.incrTick;\n var umin;\n\n switch ( mode ) {\n\n case 'time': // val must be in seconds => transform in hours / days / months\n var max = this.getModifiedValue( this.getMaxValue() ),\n units = [\n [ 60, 'min' ],\n [ 3600, 'h' ],\n [ 3600 * 24, 'd' ]\n ];\n\n if ( max < 3600 ) { // to minutes\n umin = 0;\n } else if ( max < 3600 * 24 ) {\n umin = 1;\n } else if ( max < 3600 * 24 * 30 ) {\n umin = 2;\n }\n\n if ( !units[ umin ] ) {\n return false;\n }\n\n value = value / units[ umin ][ 0 ];\n var valueRounded = Math.floor( value );\n text = valueRounded + units[ umin ][ 1 ];\n\n // Addind lower unit for precision\n umin--;\n while ( incr < 1 * units[ umin + 1 ][ 0 ] && umin > -1 ) {\n\n value = ( value - valueRounded ) * units[ umin + 1 ][ 0 ] / units[ umin ][ 0 ];\n valueRounded = Math.round( value );\n text += ' ' + valueRounded + units[ umin ][ 1 ];\n umin--;\n }\n\n break;\n\n case 'time:min.sec':\n value = value / 60;\n var valueRounded = Math.floor( value );\n var s = ( Math.round( ( value - valueRounded ) * 60 ) + '' );\n s = s.length == 1 ? '0' + s : s;\n text = valueRounded + '.' + s;\n break;\n\n default:\n break;\n }\n\n return text;\n }\n\n getExponentialFactor() {\n return this.options.exponentialFactor;\n }\n\n setExponentialFactor( value ) {\n this.options.exponentialFactor = value;\n }\n\n setExponentialLabelFactor( value ) {\n this.options.exponentialLabelFactor = value;\n }\n\n getExponentialLabelFactor() {\n return this.options.exponentialLabelFactor;\n }\n\n /**\n * Sets the label of the axis\n * @param {Number} label - The label to display under the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setLabel( label ) {\n this.options.labelValue = label;\n return this;\n }\n\n setLabelFont( font ) {\n this.options.labelFont = font;\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {String} The label value\n */\n getLabel() {\n return this.options.labelValue;\n }\n\n setSpan( _from, _to ) {\n\n this.options.span = [ _from, _to ];\n return this;\n }\n\n getSpan() {\n return this.options.span;\n }\n\n setLevel( level ) {\n this._level = level;\n return this;\n }\n\n getLevel() {\n return this._level;\n }\n\n setShift( shift ) {\n this.shift = shift;\n }\n\n getShift() {\n return this.shift;\n }\n\n /**\n * Changes the tick position\n * @param {Number} pos - The new position ( \"outside\", \"centered\" or \"inside\" )\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setTickPosition( pos ) {\n switch ( pos ) {\n case 3:\n case 'outside':\n case Graph.TICKS_OUTSIDE:\n {\n pos = 3;\n break;\n }\n\n case 2:\n case 'centered':\n case Graph.TICKS_CENTERED:\n {\n pos = 2;\n break;\n }\n\n case 1:\n case 'inside':\n case Graph.TICKS_INSIDE:\n default:\n {\n pos = 1;\n break;\n }\n }\n\n this.options.tickPosition = pos;\n\n switch ( this.options.tickPosition ) {\n case 3:\n this.tickPx1 = -2;\n this.tickPx2 = 0;\n break;\n\n case 2:\n this.tickPx1 = -1;\n this.tickPx2 = 1;\n break;\n\n default:\n case 1:\n this.tickPx1 = 0;\n this.tickPx2 = 2;\n break;\n }\n\n return this;\n }\n\n /**\n * Displays or hides the axis grids\n * @param {Boolean} on - true to enable the grids, false to disable them\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setGrids( on ) {\n this.options.primaryGrid = on;\n this.options.secondaryGrid = on;\n return this;\n }\n\n /**\n * Displays or hides the axis primary grid\n * @param {Boolean} on - true to enable the grids, false to disable it\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setPrimaryGrid( on ) {\n this.options.primaryGrid = on;\n return this;\n }\n\n /**\n * Displays or hides the axis secondary grid\n * @param {Boolean} on - true to enable the grids, false to disable it\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setSecondaryGrid( on ) {\n this.options.secondaryGrid = on;\n return this;\n }\n\n /**\n * Enables primary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n primaryGridOn() {\n return this.setPrimaryGrid( true );\n }\n\n /**\n * Disables primary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n primaryGridOff() {\n return this.setPrimaryGrid( false );\n }\n\n /**\n * Enables secondary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n secondaryGridOn() {\n return this.setSecondaryGrid( true );\n }\n\n /**\n * Disables secondary grid\n * @return {Axis} The current axis\n */\n secondaryGridOff() {\n return this.setSecondaryGrid( false );\n }\n\n /**\n * Enables all the grids\n * @return {Axis} The current axis\n */\n gridsOn() {\n return this.setGrids( true );\n }\n\n /**\n * Disables all the grids\n * @return {Axis} The current axis\n */\n gridsOff() {\n return this.setGrids( false );\n }\n\n /**\n * @alias Axis#gridsOff\n */\n turnGridsOff() {\n return this.gridsOff( ...arguments );\n }\n\n /**\n * @alias Axis#gridsOn\n */\n turnGridsOn() {\n return this.gridsOn( ...arguments );\n }\n\n /**\n * Sets the axis color\n * @memberof Axis\n * @param {String} color - The color to set the axis\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setAxisColor( color ) {\n this.options.axisColor = color;\n return this;\n }\n\n /**\n * Gets the axis color\n * @memberof Axis\n * @return {String} The color of the axis\n * @since 1.13.2\n */\n getAxisColor() {\n return this.options.axisColor || 'black';\n }\n\n setTickLabelOffset( offsetValue ) {\n this.options.tickLabelOffset = offsetValue;\n return this;\n }\n\n /**\n * Sets the color of the main ticks\n * @memberof Axis\n * @param {String} color - The new color of the primary ticks\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setPrimaryTicksColor( color ) {\n this.options.primaryTicksColor = color;\n return this;\n }\n\n /**\n * Gets the color of the main ticks\n * @memberof Axis\n * @return {String} The color of the primary ticks\n * @since 1.13.2\n */\n getPrimaryTicksColor() {\n return this.options.primaryTicksColor || 'black';\n }\n\n /**\n * Sets the color of the secondary ticks\n * @memberof Axis\n * @param {String} color - The new color of the secondary ticks\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setSecondaryTicksColor( color ) {\n this.options.secondaryTicksColor = color;\n return this;\n }\n\n /**\n * Gets the color of the secondary ticks\n * @memberof Axis\n * @return {String} The color of the secondary ticks\n * @since 1.13.2\n */\n getSecondaryTicksColor() {\n return this.options.secondaryTicksColor || 'black';\n }\n\n /**\n * Sets the color of the tick labels\n * @memberof Axis\n * @param {String} color - The new color of the tick labels\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setTicksLabelColor( color ) {\n this.options.ticksLabelColor = color;\n if ( Array.isArray( this.ticksLabels ) ) {\n this.ticksLabels.forEach( ( tick ) => {\n tick.setAttribute( 'fill', color );\n } );\n }\n return this;\n }\n\n /**\n * Gets the color of the tick labels\n * @memberof Axis\n * @return {String} The color of the tick labels\n * @since 1.13.2\n */\n getTicksLabelColor() {\n return this.options.ticksLabelColor || 'black';\n }\n\n /**\n * Sets the color of the primary grid\n * @memberof Axis\n * @param {String} color - The primary grid color\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridColor( color ) {\n this.options.primaryGridColor = color;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the color of the primary grid\n * @memberof Axis\n * @return {String} color - The primary grid color\n * @since 1.13.3\n */\n getPrimaryGridColor() {\n return this.options.primaryGridColor;\n }\n\n /**\n * Sets the color of the primary grid\n * @memberof Axis\n * @param {String} color - The primary grid color\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridColor( color ) {\n this.options.secondaryGridColor = color;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the color of the secondary grid\n * @memberof Axis\n * @return {String} color - The secondary grid color\n * @since 1.13.3\n */\n getSecondaryGridColor() {\n return this.options.secondaryGridColor;\n }\n\n /**\n * Sets the width of the primary grid lines\n * @memberof Axis\n * @param {Number} width - The width of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridWidth( width ) {\n this.options.primaryGridWidth = width;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the width of the primary grid lines\n * @memberof Axis\n * @return {Number} width - The width of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridWidth() {\n return this.options.primaryGridWidth;\n }\n\n /**\n * Sets the width of the secondary grid lines\n * @memberof Axis\n * @param {Number} width - The width of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridWidth( width ) {\n this.options.secondaryGridWidth = width;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the width of the secondary grid lines\n * @memberof Axis\n * @return {Number} width - The width of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridWidth() {\n return this.options.secondaryGridWidth;\n }\n\n /**\n * Sets the opacity of the primary grid lines\n * @memberof Axis\n * @param {Number} opacity - The opacity of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridOpacity( opacity ) {\n this.options.primaryGridOpacity = opacity;\n return this;\n }\n\n /**\n * Gets the opacity of the primary grid lines\n * @memberof Axis\n * @return {Number} opacity - The opacity of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridOpacity() {\n return this.options.primaryGridOpacity;\n }\n\n /**\n * Sets the opacity of the secondary grid lines\n * @memberof Axis\n * @param {Number} opacity - The opacity of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridOpacity( opacity ) {\n this.options.secondaryGridOpacity = opacity;\n return this;\n }\n\n /**\n * Gets the opacity of the secondary grid lines\n * @memberof Axis\n * @return {Number} opacity - The opacity of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridOpacity() {\n return this.options.secondaryGridOpacity;\n }\n\n /**\n * Sets the dasharray of the primary grid lines\n * @memberof Axis\n * @param {String} dasharray - The dasharray of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridDasharray( dasharray ) {\n this.options.primaryGridDasharray = dasharray;\n return this;\n }\n\n /**\n * Gets the dasharray of the primary grid lines\n * @memberof Axis\n * @return {String} dasharray - The dasharray of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridDasharray() {\n return this.options.primaryGridDasharray;\n }\n\n /**\n * Sets the dasharray of the secondary grid lines\n * @memberof Axis\n * @param {String} dasharray - The dasharray of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridDasharray( dasharray ) {\n this.options.secondaryGridDasharray = dasharray;\n return this;\n }\n\n /**\n * Gets the dasharray of the secondary grid lines\n * @memberof Axis\n * @return {String} dasharray - The dasharray of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridDasharray() {\n return this.options.secondaryGridDasharray;\n }\n\n /**\n * Sets the color of the label\n * @memberof Axis\n * @param {String} color - The new color of the label\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setLabelColor( color ) {\n this.options.labelColor = color;\n return this;\n }\n\n /**\n * Gets the color of the label\n * @memberof Axis\n * @return {String} The color of the label\n * @since 1.13.2\n */\n getLabelColor() {\n return this.options.labelColor;\n }\n\n setTickContent( dom, val, options ) {\n if ( !options ) options = {};\n\n if ( options.overwrite || !options.exponential ) {\n\n dom.textContent = options.overwrite || this.valueToText( val );\n\n } else {\n var log = Math.round( Math.log( val ) / Math.log( 10 ) );\n var unit = Math.floor( val * Math.pow( 10, -log ) );\n\n dom.textContent = ( unit != 1 ) ? unit + 'x10' : '10';\n var tspan = document.createElementNS( this.graph.ns, 'tspan' );\n tspan.textContent = log;\n tspan.setAttribute( 'font-size', '0.7em' );\n tspan.setAttribute( 'dy', -5 );\n dom.appendChild( tspan );\n }\n\n if ( options.fontSize ) {\n dom.setAttribute( 'font-size', options.fontSize );\n }\n }\n\n /**\n * @memberof Axis\n * @returns {Boolean} true if it is an x axis, false otherwise\n */\n isX() {\n return false;\n }\n\n /**\n * @memberof Axis\n * @returns {Boolean} true if it is an y axis, false otherwise\n */\n isY() {\n return false;\n }\n\n /**\n * Sets the unit of the axis\n * @param {String} unit - The unit of the axis\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setUnit( unit ) {\n this.options.unit = unit;\n return this;\n }\n\n /**\n * Places the unit in every tick\n * @param {Boolean} bool - ```true``` to place the unit, ```false``` otherwise\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 2.0.44\n */\n setUnitInTicks( bool ) {\n this.options.unitInTicks = bool;\n return this;\n }\n\n /**\n * Sets characters wrapping the unit\n * @param {String} before - The string to insert before\n * @param {String} after - The string to insert after\n * @return {Axis} The current axis\n * @memberof Axis\n * @example axis.setUnitWrapper(\"[\", \"]\").setUnit('m'); // Will display [m]\n * @since 1.13.3\n */\n setUnitWrapper( before, after ) {\n this.options.unitWrapperBefore = before;\n this.options.unitWrapperAfter = after;\n return this;\n }\n\n /**\n * Allows the unit to scale with thousands\n * @param {Boolean} on - Enables this mode\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setUnitDecade( on ) {\n this.options.unitDecade = on;\n return this;\n }\n\n /**\n * Enable the scientific mode for the axis values. This way, big numbers can be avoided, e.g. \"1000000000\" would be displayed 1 with 109 or \"G\" shown on near the axis unit.\n * @param {Boolean} on - Enables the scientific mode\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setScientific( on ) {\n this.options.scientificScale = on;\n return this;\n }\n\n /**\n * In the scientific mode, forces the axis to take a specific power of ten. Useful if you want to show kilometers instead of meters for example. In this case you would use \"3\" as a value.\n * @param {Number} scientificScaleExponent - Forces the scientific scale to take a defined power of ten\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n * @see Axis#setScientific\n */\n setScientificScaleExponent( scientificScaleExponent ) {\n this.options.scientificScaleExponent = scientificScaleExponent;\n return this;\n }\n\n /**\n * The engineer scaling is similar to the scientific scaling ({@link Axis#setScientificScale}) but allowing only mupltiples of 3 to be used to scale the axis (for instance, go from grams to kilograms while skipping decagrams and hexagrams)\n * @param {Boolean} engineeringScaling - true to turn on the engineering scaling\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n * @see Axis#setScientific\n */\n setEngineering( engineeringScaling ) { //bool\n this.options.scientificScale = engineeringScaling;\n this.options.engineeringScale = engineeringScaling;\n return this;\n }\n\n /**\n * Calculates the closest engineering exponent from a scientific exponent\n * @param {Number} scientificExponent - The exponent of 10 based on which the axis will be scaled\n * @return {Number} The appropriate engineering exponent\n * @memberof Axis\n * @since 1.13.3\n * @private\n */\n getEngineeringExponent( scientificExponent ) {\n\n if ( scientificExponent > 0 ) {\n scientificExponent -= ( scientificExponent % 3 );\n } else {\n scientificExponent -= ( 3 - ( -scientificExponent ) % 3 ) % 3;\n }\n\n return scientificExponent;\n }\n\n /**\n * Enables log scaling\n * @param {Boolean} logScale - ```true``` to enable the log scaling, ```false``` to disable it\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setLogScale( log ) {\n this.options.logScale = log;\n return this;\n }\n\n isZoomed() {\n return !( this.currentAxisMin == this.getMinValue() || this.currentAxisMax == this.getMaxValue() );\n }\n\n hasAxis() {\n return false;\n }\n\n getType() {\n return null;\n }\n\n useKatexForLabel( use = true ) {\n this.options.useKatexForLabel = use;\n return this;\n }\n\n}\n\n/**\n * @alias Axis#getVal\n */\nAxis.prototype.getValue = Axis.prototype.getVal;\n\n/**\n * @alias Axis#getRelPx\n */\nAxis.prototype.getDeltaPx = Axis.prototype.getRelPx;\n\nexport default Axis;","import Axis from './graph.axis.js';\n\n/**\n * Generic constructor of a y axis\n * @augments Axis\n */\nclass AxisX extends Axis {\n\n constructor( graph, topbottom, options = {} ) {\n\n super( graph, topbottom, options );\n this.top = topbottom == 'top';\n }\n\n /**\n * @private\n * Returns the position of the axis, used by refreshDrawingZone in core module\n */\n getAxisPosition() {\n\n if ( !this.options.display ) {\n return 0;\n }\n\n let size;\n\n if ( this.options.tickLabelOffset == 0 ) { // Normal mode, no offset\n size = ( this.options.tickPosition == 1 ? 8 : 20 );\n size += this.graph.options.fontSize * 1;\n } else { // With an offset, and ticks inside, axis position is actually 0. Otherwise, it's the heights of the ticks\n size = ( this.options.tickPosition == 1 ? 0 : 12 );\n }\n\n if ( this.getLabel() ) {\n size += this.graph.options.fontSize;\n }\n\n return size;\n }\n\n /**\n * @returns {Boolean} always ```true```\n */\n isX() {\n return true;\n }\n\n /**\n * @returns {Boolean} always ```false```\n */\n isY() {\n return false;\n }\n\n /**\n * @private\n * Used to set the x position of the axis\n */\n setShift( shift ) {\n\n this.shift = shift;\n if ( this.getShift() === undefined || !this.graph.getDrawingHeight() ) {\n return;\n }\n\n this.group.setAttribute( 'transform', 'translate(0 ' + ( this.floating ? this.getShift() : ( this.top ? this.shift : ( this.graph.getDrawingHeight() - this.shift ) ) ) + ')' );\n }\n\n /**\n * Caclulates the maximum tick height\n * @return {Number} The maximum tick height\n */\n getMaxSizeTick() {\n return ( this.top ? -1 : 1 ) * ( ( this.options.tickPosition == 1 ) ? 10 : 10 );\n }\n\n /**\n * Draws a tick. Mostly used internally but it can be useful if you want to make your own axes\n * @param {Number} value - The value in axis unit to place the tick\n * @param {Number} level - The importance of the tick\n * @param {Object} options - Further options to be passed to ```setTickContent```\n * @param {Number} forcedPos - Forces the position of the tick (for axis dependency)\n */\n drawTick( value, level, options, forcedPos ) {\n\n var self = this,\n val;\n\n val = forcedPos || this.getPos( value );\n\n if ( val == undefined || isNaN( val ) ) {\n return;\n }\n\n var tick = this.nextTick( level, function( tick ) {\n\n tick.setAttribute( 'y1', ( self.top ? 1 : -1 ) * self.tickPx1 * self.tickScaling[ level ] );\n tick.setAttribute( 'y2', ( self.top ? 1 : -1 ) * self.tickPx2 * self.tickScaling[ level ] );\n\n if ( level == 1 ) {\n tick.setAttribute( 'stroke', self.getPrimaryTicksColor() );\n } else {\n tick.setAttribute( 'stroke', self.getSecondaryTicksColor() );\n }\n\n } );\n\n // tick.setAttribute( 'shape-rendering', 'crispEdges' );\n tick.setAttribute( 'x1', val );\n tick.setAttribute( 'x2', val );\n\n this.nextGridLine( level == 1, val, val, 0, this.graph.getDrawingHeight() );\n\n // this.groupTicks.appendChild( tick );\n if ( level == 1 ) {\n var tickLabel = this.nextTickLabel( ( tickLabel ) => {\n\n tickLabel.setAttribute( 'y', ( self.top ? -1 : 1 ) * ( ( self.options.tickPosition == 1 ? 8 : 20 ) + ( self.top ? 10 : 0 ) ) + this.options.tickLabelOffset );\n tickLabel.setAttribute( 'text-anchor', 'middle' );\n if ( self.getTicksLabelColor() !== 'black' ) {\n tickLabel.setAttribute( 'fill', self.getTicksLabelColor() );\n }\n tickLabel.style.dominantBaseline = 'hanging';\n } );\n\n tickLabel.setAttribute( 'x', val );\n this.setTickContent( tickLabel, value, options );\n\n }\n // this.ticks.push( tick );\n\n return [ tick, tickLabel ];\n }\n\n drawLabel() {\n // Place label correctly\n\n if ( this.getLabelColor() !== 'black' ) {\n this.label.setAttribute( 'fill', this.getLabelColor() );\n }\n\n if ( this.options.labelFont ) {\n this.label.setAttribute( 'font-family', this.options.labelFont );\n }\n\n this.label.setAttribute( 'text-anchor', 'middle' );\n this.label.setAttribute( 'style', 'display: initial;' );\n this.label.setAttribute( 'x', Math.abs( this.getMaxPx() + this.getMinPx() ) / 2 );\n this.label.setAttribute( 'y', ( this.top ? -1 : 1 ) * ( ( this.options.tickPosition == 1 ? 10 : 25 ) + this.graph.options.fontSize ) );\n this.labelTspan.textContent = this.getLabel();\n\n }\n\n draw() {\n var tickWidth = super.draw( ...arguments );\n this.drawSpecifics();\n\n return tickWidth;\n }\n /**\n * Paints the label, the axis line and anything else specific to x axes\n */\n drawSpecifics() {\n\n // Adjusts group shift\n //this.group.setAttribute('transform', 'translate(0 ' + this.getShift() + ')');\n\n this.drawLabel();\n\n this.line.setAttribute( 'x1', this.getMinPx() );\n this.line.setAttribute( 'x2', this.getMaxPx() );\n this.line.setAttribute( 'y1', 0 );\n this.line.setAttribute( 'y2', 0 );\n\n this.line.setAttribute( 'stroke', this.getAxisColor() );\n\n if ( !this.top ) {\n\n this.labelTspan.style.dominantBaseline = 'hanging';\n this.expTspan.style.dominantBaseline = 'hanging';\n this.expTspanExp.style.dominantBaseline = 'hanging';\n\n this.unitTspan.style.dominantBaseline = 'hanging';\n // this.preunitTspan.style.dominantBaseline = 'hanging';\n\n }\n\n var span = this.getSpan();\n this.line.setAttribute( 'marker-start', ( !this.options.splitMarks || span[ 0 ] == 0 ? '' : 'url(#horionzalsplit_' + this.graph.getId() + ')' ) );\n this.line.setAttribute( 'marker-end', ( !this.options.splitMarks || span[ 1 ] == 1 ? '' : 'url(#horionzalsplit_' + this.graph.getId() + ')' ) );\n\n }\n\n /**\n * @private\n */\n _drawLine( pos, line ) {\n\n let px = this.getPx( pos );\n\n if ( !line ) {\n line = document.createElementNS( this.graph.ns, 'line' );\n } else {\n line.setAttribute( 'display', 'initial' );\n }\n\n line.setAttribute( 'x1', px );\n line.setAttribute( 'x2', px );\n\n line.setAttribute( 'y1', 0 );\n line.setAttribute( 'y2', this.graph.drawingSpaceHeight );\n\n line.setAttribute( 'stroke', 'black' );\n this.group.appendChild( line );\n\n return line;\n }\n\n _hideLine( line ) {\n if ( !line ) {\n return;\n }\n line.setAttribute( 'display', 'none' );\n }\n\n /**\n * @private\n */\n handleMouseMoveLocal( x ) { // handleMouseMoveLocal( x, y, e )\n x -= this.graph.getPaddingLeft();\n this.mouseVal = this.getVal( x );\n }\n\n /**\n * Caches the minimum px and maximum px position of the axis. Includes axis spans and flipping. Mostly used internally\n */\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n\n if ( isNaN( interval ) ) {\n return;\n }\n\n var maxPx = interval * this.options.span[ 1 ] + this.minPx - this.options.marginMax;\n var minPx = interval * this.options.span[ 0 ] + this.minPx + this.options.marginMin;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n\n }\n\n getZProj( zValue ) {\n return zValue * this.graph.options.zAxis.shiftX;\n }\n\n}\n\nexport default AxisX;","import Axis from './graph.axis.js';\n\n/**\n * Generic constructor of a y axis\n * @extends Axis\n */\nclass AxisY extends Axis {\n\n constructor( graph, leftright, options ) {\n\n super( graph, leftright, options );\n this.leftright = leftright;\n this.left = leftright == 'left';\n\n }\n\n /**\n * @private\n */\n setAxisPosition( shift ) {\n this.shiftPosition = shift;\n }\n\n getAxisPosition() {\n return this.shiftPosition || 0;\n }\n\n getAdditionalWidth() {\n let pos = 0;\n if ( this.getLabel() ) {\n pos += this.graph.options.fontSize;\n }\n\n if ( this.isShown() ) {\n pos += Math.abs( this.tickMargin );\n }\n return pos;\n }\n\n /**\n * @returns {Boolean} always ```false```\n */\n isX() {\n return false;\n }\n\n /**\n * @returns {Boolean} always ```true```\n */\n isY() {\n return true;\n }\n\n /**\n * @private\n */\n resetTicksLength() {\n this.longestTick = [ false, 0 ];\n }\n\n /**\n * @private\n */\n getMaxSizeTick() { // Gives an extra margin of 5px\n return ( this.longestTick && this.longestTick[ 0 ] ? this.longestTick[ 0 ].getComputedTextLength() + 5 : 0 ); //(this.left ? 10 : 0);\n }\n\n draw() {\n\n this.tickMargin = ( this.left ? -5 - this.tickPx1 * this.tickScaling[ 1 ] : 2 - this.tickPx1 * this.tickScaling[ 1 ] );\n var tickWidth = super.draw( ...arguments );\n tickWidth += this.getAdditionalWidth();\n this.drawSpecifics( tickWidth );\n\n this.fullwidthlabel = tickWidth;\n\n return tickWidth;\n }\n\n equalizePosition( width ) {\n\n this.placeLabel( this.left ? -width : width );\n\n if ( this.getLabel() ) {\n return width + this.graph.options.fontSize;\n }\n\n return 0;\n }\n\n /**\n * @private\n */\n drawTick( value, level, options, forcedPos ) {\n let pos,\n tick,\n tickLabel;\n\n pos = forcedPos || this.getPos( value );\n\n if ( pos == undefined || isNaN( pos ) ) {\n return;\n }\n\n tick = this.nextTick( level, ( tick ) => {\n\n tick.setAttribute( 'x1', ( this.left ? 1 : -1 ) * this.tickPx1 * this.tickScaling[ level ] );\n tick.setAttribute( 'x2', ( this.left ? 1 : -1 ) * this.tickPx2 * this.tickScaling[ level ] );\n\n if ( level == 1 ) {\n tick.setAttribute( 'stroke', this.getPrimaryTicksColor() );\n } else {\n tick.setAttribute( 'stroke', this.getSecondaryTicksColor() );\n }\n\n } );\n\n tick.setAttribute( 'y1', pos );\n tick.setAttribute( 'y2', pos );\n\n this.nextGridLine( level == 1, 0, this.graph.getDrawingWidth(), pos, pos );\n\n // this.groupTicks.appendChild( tick );\n if ( level == 1 ) {\n tickLabel = this.nextTickLabel( ( tickLabel ) => {\n\n tickLabel.setAttribute( 'x', this.tickMargin + this.options.tickLabelOffset );\n if ( this.getTicksLabelColor() !== 'black' ) {\n tickLabel.setAttribute( 'fill', this.getTicksLabelColor() );\n }\n\n if ( this.left ) {\n tickLabel.setAttribute( 'text-anchor', 'end' );\n } else {\n tickLabel.setAttribute( 'text-anchor', 'start' );\n }\n tickLabel.style.dominantBaseline = 'central';\n\n } );\n\n tickLabel.setAttribute( 'y', pos );\n this.setTickContent( tickLabel, value, options );\n\n if ( String( tickLabel.textContent ).length >= this.longestTick[ 1 ] ) {\n this.longestTick[ 0 ] = tickLabel;\n this.longestTick[ 1 ] = String( tickLabel.textContent ).length;\n\n }\n }\n }\n\n drawLabel() {\n\n if ( this.getLabelColor() !== 'black' ) {\n this.label.setAttribute( 'fill', this.getLabelColor() );\n }\n\n this.label.setAttribute( 'dominant-baseline', !this.left ? 'auto' : 'auto' );\n this.labelTspan.textContent = this.getLabel();\n }\n\n placeLabel( y ) {\n this.label.setAttribute( 'transform', 'translate(' + y + ', ' + ( Math.abs( this.getMaxPx() + this.getMinPx() ) / 2 ) + ') rotate(-90)' );\n }\n\n /**\n * @private\n */\n drawSpecifics() {\n // Place label correctly\n //this.label.setAttribute('x', (this.getMaxPx() - this.getMinPx()) / 2);\n /*\n if ( !this.left ) {\n\n this.labelTspan.style.dominantBaseline = 'hanging';\n this.expTspan.style.dominantBaseline = 'hanging';\n this.expTspanExp.style.dominantBaseline = 'hanging';\n\n this.unitTspan.style.dominantBaseline = 'hanging';\n this.preunitTspan.style.dominantBaseline = 'hanging';\n }\n*/\n this.line.setAttribute( 'y1', this.getMinPx() );\n this.line.setAttribute( 'y2', this.getMaxPx() );\n this.line.setAttribute( 'x1', 0 );\n this.line.setAttribute( 'x2', 0 );\n\n this.line.setAttribute( 'stroke', this.getAxisColor() );\n\n var span = this.getSpan();\n this.line.setAttribute( 'marker-start', ( !this.options.splitMarks || span[ 0 ] == 0 ? '' : 'url(#verticalsplit_' + this.graph.getId() + ')' ) );\n this.line.setAttribute( 'marker-end', ( !this.options.splitMarks || span[ 1 ] == 1 ? '' : 'url(#verticalsplit_' + this.graph.getId() + ')' ) );\n }\n\n /**\n * @private\n */\n setShift( shift ) {\n\n this.shift = shift;\n\n if ( !this.shift || !this.graph.getWidth() ) {\n return;\n }\n\n let xshift = this.shift;\n xshift = this.floating ? xshift : ( this.isLeft() ? xshift : this.graph.getWidth() - this.graph.getPaddingRight() - this.graph.getPaddingLeft() - xshift );\n this.group.setAttribute( 'transform', 'translate( ' + xshift + ' 0 )' );\n this.drawLabel();\n }\n\n /**\n * @private\n */\n isLeft() {\n return this.left;\n }\n\n /**\n * @private\n */\n isRight() {\n return !this.left;\n }\n\n /**\n * @private\n */\n isFlipped() {\n return !this.options.flipped;\n }\n\n /**\n * @private\n */\n _drawLine( pos, line ) {\n\n let px = this.getPx( pos );\n\n if ( !line ) {\n line = document.createElementNS( this.graph.ns, 'line' );\n } else {\n line.setAttribute( 'display', 'initial' );\n }\n\n line.setAttribute( 'y1', px );\n line.setAttribute( 'y2', px );\n\n line.setAttribute( 'x1', 0 );\n line.setAttribute( 'x2', this.graph.drawingSpaceWidth );\n\n line.setAttribute( 'stroke', 'black' );\n this.group.appendChild( line );\n\n return line;\n }\n\n _hideLine( line ) {\n if ( !line ) {\n return;\n }\n\n line.setAttribute( 'display', 'none' );\n }\n\n /**\n * @private\n */\n handleMouseMoveLocal( x, y ) {\n y -= this.graph.getPaddingTop();\n this.mouseVal = this.getVal( y );\n }\n\n /**\n * Scales the axis with respect to the series contained in an x axis\n * @param {Axis} [ axis = graph.getXAxis() ] - The X axis to use as a reference\n * @param {Serie} [ excludeSerie ] - A serie to exclude\n * @param {Number} [ start = xaxis.getCurrentMin() ] - The start of the boundary\n * @param {Number} [ end = xaxis.getCurrentMax() ] - The end of the boundary\n * @param {Boolean} [ min = true ] - Adapt the min\n * @param {Boolean} [ max = true ] - Adapt the max\n * @returns {Axis} The current axis\n */\n scaleToFitAxis( axis, excludeSerie, start, end, min, max ) {\n //console.log( axis instanceof GraphAxis );\n if ( !axis || !axis.isX() ) {\n axis = this.graph.getXAxis();\n }\n\n if ( isNaN( start ) ) {\n start = axis.getCurrentMin();\n }\n\n if ( isNaN( end ) ) {\n end = axis.getCurrentMax();\n }\n\n if ( min === undefined ) {\n min = true;\n }\n\n if ( max === undefined ) {\n max = true;\n }\n\n if ( typeof excludeSerie == 'number' ) {\n end = start;\n start = excludeSerie;\n excludeSerie = false;\n }\n\n var maxV = -Infinity,\n minV = Infinity,\n j = 0;\n\n for ( var i = 0, l = this.graph.series.length; i < l; i++ ) {\n\n if ( !this.graph.series[ i ].isShown() ) {\n continue;\n }\n\n if ( this.graph.series[ i ] == excludeSerie ) {\n continue;\n }\n\n if ( !( this.graph.series[ i ].getXAxis() == axis ) || ( this.graph.series[ i ].getYAxis() !== this ) ) {\n continue;\n }\n\n j++;\n\n maxV = max ? Math.max( maxV, this.graph.series[ i ].getMax( start, end ) ) : 0;\n minV = min ? Math.min( minV, this.graph.series[ i ].getMin( start, end ) ) : 0;\n }\n\n if ( j == 0 ) {\n\n this.setMinMaxToFitSeries(); // No point was found\n\n } else {\n\n // If we wanted originally to resize min and max. Otherwise we use the current value\n minV = min ? minV : this.getCurrentMin();\n maxV = max ? maxV : this.getCurrentMax();\n\n var interval = maxV - minV;\n\n minV -= ( this.options.axisDataSpacing.min * interval );\n maxV += ( this.options.axisDataSpacing.max * interval );\n\n this._doZoomVal( minV, maxV );\n }\n\n return this;\n }\n\n /**\n * Caches the minimum px and maximum px position of the axis. Includes axis spans and flipping. Mostly used internally\n * @return {Axis} The current axis instance\n */\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n\n if ( isNaN( interval ) ) {\n return;\n }\n\n var maxPx = this.maxPx - interval * this.options.span[ 0 ] - this.options.marginMin;\n var minPx = this.maxPx - interval * this.options.span[ 1 ] + this.options.marginMax;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n\n }\n\n getZProj( zValue ) {\n return zValue * this.graph.options.zAxis.shiftY;\n }\n\n}\n\nexport default AxisY;","import AxisX from './graph.axis.x.js';\n\n/**\n * Generic constructor of a y axis\n * @class AxisXBar\n * @augments Axis\n */\nclass AxisXBar extends AxisX {\n\n constructor( graph, topbottom, options = {} ) {\n super( graph, topbottom, options );\n }\n\n /**\n * @param {Object[]} categories - Categories array\n * @param {(String|Number)} categories[].title - The title of the category (to be dispalyed)\n * @param {(String|Number)} categories[].name - The name of the category (to indentify series)\n * @returns {AxisBar} The current axis instance\n */\n set categories( categories ) {\n this._barCategories = categories;\n return this;\n }\n\n draw() {\n\n var self = this,\n tickLabel,\n elements = this._barCategories;\n\n this.forceMin( 0 );\n this.forceMax( 1 );\n\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n\n if ( !elements ) {\n return;\n }\n\n if ( !Array.isArray( elements ) ) {\n elements = [ elements ];\n }\n\n // this.drawInit();\n\n //var widthPerElement = width / elements.length;\n for ( var i = 0; i <= elements.length; i++ ) {\n this.drawTick( i / elements.length, 2 );\n\n if ( i < elements.length ) {\n tickLabel = this.nextTickLabel( function( tickLabel ) {\n\n tickLabel.setAttribute( 'y', ( self.top ? -1 : 1 ) * ( ( self.options.tickPosition == 1 ? 8 : 20 ) + ( self.top ? 10 : 0 ) ) );\n tickLabel.setAttribute( 'text-anchor', 'middle' );\n if ( self.getTicksLabelColor() !== 'black' ) {\n tickLabel.setAttribute( 'fill', self.getTicksLabelColor() );\n }\n tickLabel.style.dominantBaseline = 'hanging';\n\n } );\n\n tickLabel.setAttribute( 'x', this.getPos( ( i + 0.5 ) / elements.length ) );\n tickLabel.textContent = elements[ i ].title;\n }\n\n }\n\n this.drawSpecifics();\n return this;\n }\n\n /**\n * Sets the series automatically\n * @returns {AxisBar} The current axis instance\n */\n autoSeries() {\n\n let series = [];\n for ( let serie of this.graph.series ) {\n if ( serie.getXAxis() == this ) {\n series.push( serie );\n }\n }\n\n this.setSeries( ...series );\n return this;\n }\n\n /**\n * Sets the series that should belong to the axis\n * @param {...(Series|Number|String)} series - List of series identified either by their instance, or their index (string or number)\n * @returns {AxisBar} The current axis instance\n */\n setSeries() {\n\n var self = this;\n this.series = arguments;\n\n Array.prototype.map.call( this.series, function( serie, index ) {\n\n if ( !( typeof serie == 'object' ) ) {\n serie = self.graph.getSerie( serie );\n }\n\n if ( serie.setCategoryConfig ) {\n serie.setCategoryConfig( index, self._barCategories, self.series.length );\n }\n } );\n\n this._getUsedCategories();\n\n return this;\n }\n\n _getUsedCategories() {\n\n let categories = {},\n total = 0;\n\n Array.prototype.map.call( this.series, ( serie ) => {\n let usedCategories = serie.getUsedCategories();\n for ( let cat of usedCategories ) {\n\n if ( !categories.hasOwnProperty( cat ) ) {\n categories[ cat ] = 1;\n total += 1;\n }\n\n categories[ cat ]++;\n total++;\n }\n } );\n\n let accumulator = 0;\n for ( let i in categories ) {\n let temp = categories[ i ];\n categories[ i ] = accumulator;\n accumulator += temp;\n }\n\n let dispatchedCategories = {};\n\n Array.prototype.map.call( this.series, ( serie ) => {\n\n let scategories = serie.getUsedCategories(),\n indices = {};\n\n scategories.forEach( ( cat ) => {\n\n dispatchedCategories[ cat ] = dispatchedCategories[ cat ] || 0.5;\n indices[ cat ] = ( categories[ cat ] + dispatchedCategories[ cat ] ) / total;\n dispatchedCategories[ cat ]++;\n } );\n\n serie.setDataIndices( indices, total );\n\n } );\n\n }\n\n getType() {\n return 'category';\n }\n}\n\nexport default AxisXBar;","import Axis from './graph.axis.js';\nimport * as util from './graph.util.js';\n\nvar axisFormat = [\n\n {\n\n threshold: 20,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 seconds\n increment: 1,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n },\n\n {\n\n threshold: 50,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 2 seconds\n increment: 2,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n },\n\n {\n\n threshold: 100,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 5 seconds\n increment: 5,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n },\n\n {\n\n threshold: 600,\n increments: {\n\n 1: {\n increment: 10, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 seconds\n increment: 30,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n },\n\n { // One day\n\n threshold: 1000,\n increments: {\n\n 1: { // 1h\n increment: 1,\n unit: 'h',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 minutes\n increment: 10,\n unit: 'i',\n format: 'MM\"min\"'\n }\n }\n },\n\n { // One day\n\n threshold: 1500,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 1,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 3000,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 2,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 8000,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 10,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 26400,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 20,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 86400,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 1,\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 200000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 2, // One day on the first axis\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 6, // One day on the first axis\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 1400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 12, // One day on the first axis\n unit: 'h',\n format: 'HH\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 6400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n },\n\n { // One day\n\n threshold: 12400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 2, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n },\n\n { // One day\n\n threshold: 86400000 * 0.5,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 7, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n },\n\n { // One day\n\n threshold: 86400000 * 0.8,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 15, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n },\n\n { // One month\n\n threshold: 86400000 * 1,\n increments: {\n\n 1: {\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 3, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n },\n\n { // One month\n\n threshold: 86400000 * 2,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 4, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n },\n\n { // One month\n\n threshold: 86400000 * 10,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 6, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n },\n\n { // One month\n\n threshold: 86400000 * 12,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 1, // One day on the first axis\n unit: 'y',\n format: 'yyyy'\n }\n }\n },\n\n];\n\n/*\n * Date Format 1.2.3\n * (c) 2007-2009 Steven Levithan \n * MIT license\n *\n * Includes enhancements by Scott Trenda \n * and Kris Kowal \n *\n * Accepts a date, a mask, or a date and a mask.\n * Returns a formatted version of the given date.\n * The date defaults to the current date/time.\n * The mask defaults to dateFormat.masks.default.\n */\n\nvar dateFormat = ( function() {\n var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\\1?|[WLloSZ]|\"[^\"]*\"|'[^']*'/g,\n timezone = /\\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\\d{4})?)\\b/g,\n timezoneClip = /[^-+\\dA-Z]/g,\n pad = function( val, len ) {\n val = String( val );\n len = len || 2;\n while ( val.length < len ) val = '0' + val;\n return val;\n },\n getWeek = function( d, f ) {\n var onejan = new Date( d[ f + 'FullYear' ](), 0, 1 );\n return Math.ceil( ( ( ( d - onejan ) / 86400000 ) + onejan[ f + 'Day' ]() + 1 ) / 7 );\n };\n\n // Regexes and supporting functions are cached through closure\n return function( date, mask, utc ) {\n var dF = dateFormat;\n\n // You can't provide utc if you skip other args (use the \"UTC:\" mask prefix)\n if ( arguments.length == 1 && Object.prototype.toString.call( date ) == '[object String]' && !/\\d/.test( date ) ) {\n mask = date;\n date = undefined;\n }\n\n // Passing date through Date applies Date.parse, if necessary\n date = date ? new Date( date ) : new Date();\n if ( isNaN( date ) ) throw SyntaxError( 'invalid date:' + date );\n\n mask = String( dF.masks[ mask ] || mask || dF.masks.default );\n\n // Allow setting the utc argument via the mask\n if ( mask.slice( 0, 4 ) == 'UTC:' ) {\n mask = mask.slice( 4 );\n utc = true;\n }\n\n var _ = utc ? 'getUTC' : 'get',\n d = date[ _ + 'Date' ](),\n D = date[ _ + 'Day' ](),\n m = date[ _ + 'Month' ](),\n y = date[ _ + 'FullYear' ](),\n H = date[ _ + 'Hours' ](),\n M = date[ _ + 'Minutes' ](),\n s = date[ _ + 'Seconds' ](),\n L = date[ _ + 'Milliseconds' ](),\n o = utc ? 0 : date.getTimezoneOffset(),\n flags = {\n d: d,\n dd: pad( d ),\n ddd: dF.i18n.dayNames[ D ],\n dddd: dF.i18n.dayNames[ D + 7 ],\n m: m + 1,\n mm: pad( m + 1 ),\n mmm: dF.i18n.monthNames[ m ],\n mmmm: dF.i18n.monthNames[ m + 12 ],\n yy: String( y ).slice( 2 ),\n yyyy: y,\n h: H % 12 || 12,\n hh: pad( H % 12 || 12 ),\n H: H,\n HH: pad( H ),\n M: M,\n MM: pad( M ),\n s: s,\n ss: pad( s ),\n l: pad( L, 3 ),\n L: pad( L > 99 ? Math.round( L / 10 ) : L ),\n t: H < 12 ? 'a' : 'p',\n tt: H < 12 ? 'am' : 'pm',\n T: H < 12 ? 'A' : 'P',\n TT: H < 12 ? 'AM' : 'PM',\n Z: utc ? 'UTC' : ( String( date ).match( timezone ) || [ '' ] ).pop().replace( timezoneClip, '' ),\n o: ( o > 0 ? '-' : '+' ) + pad( Math.floor( Math.abs( o ) / 60 ) * 100 + Math.abs( o ) % 60, 4 ),\n S: [ 'th', 'st', 'nd', 'rd' ][ d % 10 > 3 ? 0 : ( d % 100 - d % 10 != 10 ) * d % 10 ],\n W: getWeek( date, _ ),\n };\n\n return mask.replace( token, function( $0 ) {\n return $0 in flags ? flags[ $0 ] : $0.slice( 1, $0.length - 1 );\n } );\n };\n} )();\n\n// Some common format strings\ndateFormat.masks = {\n 'default': 'ddd mmm dd yyyy HH:MM:ss',\n shortDate: 'm/d/yy',\n mediumDate: 'mmm d, yyyy',\n longDate: 'mmmm d, yyyy',\n fullDate: 'dddd, mmmm d, yyyy',\n shortTime: 'h:MM TT',\n mediumTime: 'h:MM:ss TT',\n longTime: 'h:MM:ss TT Z',\n isoDate: 'yyyy-mm-dd',\n isoTime: 'HH:MM:ss',\n isoDateTime: \"yyyy-mm-dd'T'HH:MM:ss\",\n isoUtcDateTime: \"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'\"\n};\n\n// Internationalization strings\ndateFormat.i18n = {\n dayNames: [\n 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',\n 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'\n ],\n monthNames: [\n 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',\n 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'\n ]\n};\n\n/* END DATE FORMAT */\n\nfunction getClosestIncrement( value, basis ) {\n return Math.round( value / basis ) * basis;\n}\n\nfunction roundDate( date, format ) {\n\n switch ( format.unit ) {\n\n case 's': // Round at n hour\n\n date.setSeconds( getClosestIncrement( date.getSeconds(), format.increment ) );\n date.setMilliseconds( 0 );\n\n break;\n\n case 'i': // Round at n hour\n\n date.setMinutes( getClosestIncrement( date.getMinutes(), format.increment ) );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n\n break;\n\n case 'h': // Round at n hour\n\n date.setHours( getClosestIncrement( date.getHours(), format.increment ) );\n\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n\n break;\n\n case 'd':\n\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n date.setHours( 0 );\n\n date.setDate( getClosestIncrement( date.getDate(), format.increment ) );\n\n break;\n\n case 'm':\n\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n date.setHours( 0 );\n date.setDate( 1 );\n\n date.setMonth( getClosestIncrement( date.getMonth(), format.increment ) );\n\n break;\n\n case 'y':\n\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n date.setHours( 0 );\n date.setDate( 1 );\n date.setMonth( 0 );\n\n //date.setYear( getClosest( date.getDate(), format.increment ) );\n\n break;\n\n default:\n {\n throw new Error( 'Date format not recognized' );\n }\n }\n\n return date;\n}\n\nfunction incrementDate( date, format ) {\n\n switch ( format.unit ) {\n\n case 's':\n\n date.setSeconds( date.getSeconds() + format.increment );\n date.setMilliseconds( 0 );\n\n break;\n\n case 'i':\n\n date.setMinutes( date.getMinutes() + format.increment );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n\n break;\n\n case 'h': // Round at n hour\n\n date.setHours( date.getHours() + format.increment );\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n\n break;\n\n case 'd':\n\n date.setDate( date.getDate() + format.increment );\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n date.setHours( 0 );\n\n break;\n\n case 'm':\n\n date.setMonth( date.getMonth() + format.increment );\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n date.setHours( 0 );\n date.setDate( 1 );\n\n break;\n\n case 'y':\n\n date.setFullYear( date.getFullYear() + format.increment );\n\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n date.setHours( 0 );\n date.setDate( 1 );\n date.setMonth( 0 );\n\n break;\n\n default:\n {\n throw new Error( 'Date format not recognized' );\n }\n }\n\n return date;\n}\n\nfunction getGroup( axis, level, number ) {\n\n if ( axis.groups[ level ][ number ] ) {\n axis.groups[ level ][ number ].group.setAttribute( 'display', 'block' );\n return axis.groups[ level ][ number ];\n }\n\n var g = {\n\n group: document.createElementNS( axis.graph.ns, 'g' ),\n text: document.createElementNS( axis.graph.ns, 'text' )\n };\n\n var line = document.createElementNS( axis.graph.ns, 'line' );\n\n line.setAttribute( 'stroke', 'black' );\n line.setAttribute( 'y1', 0 );\n switch ( level ) {\n\n case 2:\n\n line.setAttribute( 'y2', 6 );\n g.text.setAttribute( 'y', 15 );\n\n g.line = line;\n\n g.group.appendChild( g.line );\n break;\n\n default:\n case 1:\n\n line.setAttribute( 'y2', 20 );\n g.text.setAttribute( 'y', 10 );\n\n g.line1 = line;\n g.line2 = line.cloneNode();\n\n g.group.appendChild( g.line1 );\n g.group.appendChild( g.line2 );\n\n break;\n }\n\n g.text.setAttribute( 'text-anchor', 'middle' );\n g.text.setAttribute( 'dominant-baseline', 'middle' );\n\n g.group.appendChild( g.text );\n\n axis.getWrapper( level ).appendChild( g.group );\n\n return axis.groups[ level ][ number ] = g;\n}\n\nfunction hideGroups( axis, level, from ) {\n\n for ( ; from < axis.groups[ level ].length; from++ ) {\n\n hideGroup( axis.groups[ level ][ from ] );\n }\n}\n\nfunction hideGroup( group ) {\n group.group.setAttribute( 'display', 'none' );\n}\n\nfunction getDateText( date, format ) {\n\n return dateFormat( date, format );\n}\n\nfunction renderGroup( level, group, text, minPx, maxPx, x1, x2 ) {\n\n switch ( level ) {\n\n case 2:\n\n if ( x1 < minPx || x1 > maxPx ) {\n\n hideGroup( group );\n return;\n }\n\n group.line.setAttribute( 'x1', x1 );\n group.line.setAttribute( 'x2', x1 );\n group.text.setAttribute( 'x', x1 );\n group.text.textContent = text;\n\n break;\n\n default:\n case 1:\n\n var x1B = Math.max( minPx, Math.min( maxPx, x1 ) ),\n x2B = Math.max( minPx, Math.min( maxPx, x2 ) );\n\n if ( isNaN( x2B ) || isNaN( x1B ) ) {\n return;\n }\n\n group.line1.setAttribute( 'x1', x1B );\n group.line2.setAttribute( 'x1', x2B );\n\n group.line1.setAttribute( 'x2', x1B );\n group.line2.setAttribute( 'x2', x2B );\n\n group.text.setAttribute( 'x', ( x1B + x2B ) / 2 );\n\n while ( text.length * 8 > x2B - x1B ) {\n\n text = text.substr( 0, text.length - 2 ) + '.';\n\n if ( text.length == 1 ) {\n text = '';\n break;\n }\n }\n\n group.text.textContent = text;\n break;\n }\n}\n\nclass GraphTimeAxis extends Axis {\n\n constructor() {\n\n super( ...arguments );\n }\n\n init( graph, options ) {\n\n super.init( graph, options );\n\n this.wrapper = {\n 1: document.createElementNS( graph.ns, 'g' ),\n 2: document.createElementNS( graph.ns, 'g' )\n };\n this.groups = {\n 1: [],\n 2: []\n };\n\n var rect = document.createElementNS( graph.ns, 'rect' );\n rect.setAttribute( 'fill', '#c0c0c0' );\n rect.setAttribute( 'stroke', '#808080' );\n rect.setAttribute( 'height', '20' );\n rect.setAttribute( 'x', '0' );\n rect.setAttribute( 'y', '0' );\n\n this.rect = rect;\n\n this.wrapper[ 1 ].appendChild( this.rect );\n\n // this.init( graph, options );\n\n this.group.appendChild( this.wrapper[ 1 ] );\n this.group.appendChild( this.wrapper[ 2 ] );\n\n this.wrapper[ 1 ].setAttribute( 'transform', 'translate( 0, 25 )' );\n this.wrapper[ 2 ].setAttribute( 'transform', 'translate( 0, 00 )' );\n }\n\n draw() { // Redrawing of the axis\n\n //this.drawInit();\n\n this.cacheCurrentMax();\n this.cacheCurrentMin();\n\n if ( this.currentAxisMin == undefined || this.currentAxisMax == undefined ) {\n this.setMinMaxToFitSeries( true ); // We reset the min max as a function of the series\n\n }\n\n this.line.setAttribute( 'x1', this.getMinPx() );\n this.line.setAttribute( 'x2', this.getMaxPx() );\n this.line.setAttribute( 'y1', 0 );\n this.line.setAttribute( 'y2', 0 );\n\n var widthPx = this.maxPx - this.minPx;\n var widthTime = this.getCurrentInterval();\n\n var timePerPx = widthTime / widthPx;\n\n var maxVal = this.getCurrentMax();\n var minVal = this.getCurrentMin();\n\n this.rect.setAttribute( 'width', widthPx );\n this.rect.setAttribute( 'x', this.minPx );\n\n if ( !maxVal || !minVal ) {\n return 0;\n }\n\n var currentFormat;\n\n for ( i = 0; i < axisFormat.length; i++ ) {\n\n if ( axisFormat[ i ].threshold > timePerPx ) {\n currentFormat = axisFormat[ i ];\n\n break;\n }\n\n }\n\n if ( !currentFormat ) {\n currentFormat = axisFormat[ axisFormat.length - 1 ];\n }\n\n var xVal1,\n xVal2,\n level = 0,\n dateFirst,\n currentDate,\n text,\n group,\n i;\n\n for ( level = 1; level <= 2; level++ ) {\n\n if ( !util.isNumeric( minVal ) ) {\n hideGroups( this, level, 0 );\n break;\n }\n\n dateFirst = new Date( minVal );\n\n currentDate = roundDate( dateFirst, currentFormat.increments[ level ] );\n\n i = 0;\n\n do {\n /** @ignore */\n text = getDateText( currentDate, currentFormat.increments[ level ].format );\n group = getGroup( this, level, i );\n\n xVal1 = this.getPx( currentDate.getTime() );\n currentDate = incrementDate( currentDate, currentFormat.increments[ level ] );\n xVal2 = this.getPx( currentDate.getTime() );\n\n renderGroup( level, group, text, this.getMinPx(), this.getMaxPx(), xVal1, xVal2 );\n\n i++;\n if ( i > 100 ) {\n break;\n }\n } while ( currentDate.getTime() < maxVal );\n\n hideGroups( this, level, i );\n }\n\n }\n\n isX() {\n return true;\n }\n\n getWrapper( level ) {\n return this.wrapper[ level ];\n }\n\n setShift( shift ) {\n this.shift = shift;\n this.group.setAttribute( 'transform', 'translate(0 ' + ( this.top ? this.shift : ( this.graph.getDrawingHeight() - this.shift ) ) + ')' );\n }\n\n getAxisPosition() {\n return 60;\n }\n\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n var maxPx = interval * this.options.span[ 1 ] + this.minPx;\n var minPx = interval * this.options.span[ 0 ] + this.minPx;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n }\n\n}\n\nexport default GraphTimeAxis;","import EventEmitter from '../dependencies/eventEmitter/EventEmitter.js';\nimport * as util from '../graph.util.js';\n\nimport Waveform from '../util/waveform.js';\n\n/**\n * Serie class to be extended\n * @static\n */\nclass Serie extends EventEmitter {\n\n static\n default () {\n\n return {\n redrawShapesAfterDraw: false\n };\n }\n\n constructor( graph, name, options ) {\n\n super( ...arguments );\n this.graph = graph;\n this.name = name;\n this.options = Object.assign( {}, Serie.default(), this.constructor.default(), options );\n\n //if( new.target.default ) {\n //console.log( new.target.default() );\n //}\n\n }\n\n draw() {}\n\n beforeDraw() {}\n\n afterDraw() {\n\n if ( this.options.redrawShapesAfterDraw ) {\n this.graph.getShapesOfSerie( this ).forEach( ( shape ) => {\n shape.redraw();\n } );\n }\n\n this.emit( 'draw' );\n }\n\n /**\n * Sets data to the serie\n * @memberof Serie\n * @param {(Object|Array|Array[])} data - The data of the serie\n * @param {Boolean} [ oneDimensional=false ] - In some cases you may need to force the 1D type. This is required when one uses an array or array to define the data (see examples)\n * @param{String} [ type=float ] - Specify the type of the data. Use int to save memory (half the amount of bytes allocated to the data).\n * @example serie.setData( [ [ x1, y1 ], [ x2, y2 ], ... ] );\n * @example serie.setData( [ x1, y1, x2, y2, ... ] ); // Faster\n * @example serie.setData( [ [ x1, y1, x2, y2, ..., xn, yn ] , [ xm, ym, x(m + 1), y(m + 1), ...] ], true ) // 1D array with a gap in the middle\n * @example serie.setData( { x: x0, dx: spacing, y: [ y1, y2, y3, y4 ] } ); // Data with equal x separation. Fastest way\n */\n setData( data, oneDimensional, type ) {\n\n if ( data instanceof Waveform ) {\n return this.setWaveform( data );\n }\n\n throw 'Setting data other than waveforms in not supported by default. You must implemented this method in the inherited class.';\n }\n\n _addData( type, howmany ) {\n return [];\n }\n\n /**\n * Removes all the data from the serie, without redrawing\n * @returns {Serie} The current serie\n */\n clearData() {\n this.setData( new Waveform() );\n return this;\n }\n\n /**\n * Returns the data in its current form\n * @returns {Array.<(Float64Array|Int32Array)>} An array containing the data chunks. Has only one member if the data has no gaps\n * @memberof Serie\n */\n getData() {\n return this.data;\n }\n\n /**\n * Sets the options of the serie (no extension of default options)\n * @param {Object} options - The options of the serie\n * @memberof Serie\n */\n setOptions( options ) {\n this.options = options || {};\n }\n\n /**\n * Sets the options of the serie (no extension of default options)\n * @param {String} name - The option name\n * @param value - The option value\n * @memberof Serie\n * @example serie.setOption('selectableOnClick', true );\n */\n setOption( name, value ) {\n this.options[ name ] = value;\n }\n\n /**\n * Removes the serie from the graph. The method doesn't perform any axis autoscaling or repaint of the graph. This should be done manually.\n * @return {Serie} The current serie instance\n * @memberof Serie\n */\n kill( noLegendUpdate ) {\n\n this.graph.removeSerieFromDom( this );\n this.graph._removeSerie( this );\n\n if ( this.graph.legend && !noLegendUpdate ) {\n\n this.graph.legend.update();\n }\n\n this.graph = undefined;\n return this;\n }\n\n /**\n * Hides the serie\n * @memberof Serie\n * @param {Boolean} [ hideShapes = false ] - true to hide the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n hide( hideShapes, mute = false ) {\n\n this.hidden = true;\n this.groupMain.setAttribute( 'display', 'none' );\n\n this.getSymbolForLegend().setAttribute( 'opacity', 0.5 );\n this.getTextForLegend().setAttribute( 'opacity', 0.5 );\n\n this.hideImpl();\n\n if ( hideShapes ) {\n var shapes = this.graph.getShapesOfSerie( this );\n for ( var i = 0, l = shapes.length; i < l; i++ ) {\n shapes[ i ].hide();\n }\n }\n\n if ( !mute ) {\n this.emit( 'hide' );\n }\n\n if ( this.getXAxis().doesHideWhenNoSeriesShown() || this.getYAxis().doesHideWhenNoSeriesShown() ) {\n this.graph.draw( true );\n }\n\n return this;\n }\n\n /**\n * Shows the serie\n * @memberof Serie\n * @param {Boolean} [showShapes=false] - true to show the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n show( showShapes, mute = false ) {\n\n this.hidden = false;\n this.groupMain.setAttribute( 'display', 'block' );\n\n this.getSymbolForLegend().setAttribute( 'opacity', 1 );\n this.getTextForLegend().setAttribute( 'opacity', 1 );\n\n this.showImpl();\n\n this.draw( true );\n\n if ( showShapes ) {\n var shapes = this.graph.getShapesOfSerie( this );\n for ( var i = 0, l = shapes.length; i < l; i++ ) {\n shapes[ i ].show();\n }\n }\n\n if ( !mute ) {\n this.emit( 'show' );\n }\n\n if ( this.getXAxis().doesHideWhenNoSeriesShown() || this.getYAxis().doesHideWhenNoSeriesShown() ) {\n this.graph.draw( true );\n }\n return this;\n }\n\n hideImpl() {}\n showImpl() {}\n\n /**\n * Toggles the display of the serie (effectively, calls .show() and .hide() alternatively on each call)\n * @memberof Serie\n * @param {Boolean} [hideShapes=false] - true to hide the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n toggleDisplay() {\n\n if ( !this.isShown() ) {\n this.show();\n } else {\n this.hide();\n }\n\n return this;\n }\n\n /**\n * Determines if the serie is currently visible\n * @memberof Serie\n * @returns {Boolean} The current visibility status of the serie\n */\n isShown() {\n return !this.hidden;\n }\n\n /**\n * Checks that axes assigned to the serie have been defined and have proper values\n * @memberof Serie\n */\n axisCheck() {\n\n if ( !this.getXAxis() || !this.getYAxis() ) {\n throw 'No axis exist for this serie. Check that they were properly assigned';\n }\n\n if (\n isNaN( this.getXAxis().getCurrentMin() ) ||\n isNaN( this.getXAxis().getCurrentMax() ) ||\n isNaN( this.getYAxis().getCurrentMin() ) ||\n isNaN( this.getYAxis().getCurrentMax() )\n ) {\n throw 'Axis min and max values are not defined. Try autoscaling';\n }\n }\n /**\n * Returns the x position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The x position in px corresponding to the x value\n */\n getX( val ) {\n return ( val = this.getXAxis().getPx( val ) ) - val % 0.2;\n }\n\n /**\n * Returns the y position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The y position in px corresponding to the y value\n */\n getY( val ) {\n return ( val = this.getYAxis().getPx( val ) ) - val % 0.2;\n }\n\n /**\n * Returns the selection state of the serie. Generic for most serie types\n * @memberof Serie\n * @returns {Boolean} true if the serie is selected, false otherwise\n */\n isSelected() {\n return this.selected || ( this.selectionType !== 'unselected' );\n }\n\n _checkX( val ) {\n this.minX = Math.min( this.minX, val );\n this.maxX = Math.max( this.maxX, val );\n }\n\n _checkY( val ) {\n this.minY = Math.min( this.minY, val );\n this.maxY = Math.max( this.maxY, val );\n }\n\n /**\n * Getter for the serie name\n * @memberof Serie\n * @returns {String} The serie name\n */\n getName() {\n return this.name;\n }\n\n /* AXIS */\n\n /**\n * Assigns axes automatically, based on {@link Graph#getXAxis} and {@link Graph#getYAxis}.\n * @memberof Serie\n * @returns {Serie} The current serie\n */\n autoAxis() {\n\n if ( this.isFlipped() ) {\n\n this.setXAxis( this.graph.getYAxis() );\n this.setYAxis( this.graph.getXAxis() );\n\n } else {\n\n this.setXAxis( this.graph.getXAxis() );\n this.setYAxis( this.graph.getYAxis() );\n }\n\n // After axes have been assigned, the graph axes should update their min/max\n this.graph.updateDataMinMaxAxes();\n return this;\n }\n\n autoAxes() {\n return this.autoAxis( ...arguments );\n }\n\n /**\n * Assigns an x axis to the serie\n * @memberof Serie\n * @param {Axis|Number} axis - The axis to use as an x axis. If an integer, {@link Graph#getXAxis} or {@link Graph#getYAxis} will be used\n * @returns {Serie} The current serie\n * @example serie.setXAxis( graph.getTopAxis( 1 ) ); // Assigns the second top axis to the serie\n */\n setXAxis( axis ) {\n\n if ( typeof axis == 'number' ) {\n this.xaxis = this.isFlipped() ? this.graph.getYAxis( axis ) : this.graph.getXAxis( axis );\n } else {\n this.xaxis = axis;\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Assigns an y axis to the serie\n * @memberof Serie\n * @param {Axis|Number} axis - The axis to use as an y axis. If an integer, {@link Graph#getXAxis} or {@link Graph#getYAxis} will be used\n * @returns {Serie} The current serie\n * @example serie.setYAxis( graph.getLeftAxis( 4 ) ); // Assigns the 5th left axis to the serie\n */\n setYAxis( axis ) {\n if ( typeof axis == 'number' ) {\n this.xaxis = this.isFlipped() ? this.graph.getXAxis( axis ) : this.graph.getYAxis( axis );\n } else {\n this.yaxis = axis;\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Assigns two axes to the serie\n * @param {GraphAxis} axis1 - First axis to assign to the serie (x or y)\n * @param {GraphAxis} axis2 - Second axis to assign to the serie (y or x)\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setAxes() {\n\n for ( var i = 0; i < 2; i++ ) {\n\n if ( arguments[ i ] ) {\n this[ ( arguments[ i ].isX() ? 'setXAxis' : 'setYAxis' ) ]( arguments[ i ] );\n }\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * @returns {GraphAxis} The x axis assigned to the serie\n * @memberof Serie\n */\n getXAxis() {\n return this.xaxis;\n }\n\n /**\n * @returns {GraphAxis} The y axis assigned to the serie\n * @memberof Serie\n */\n getYAxis() {\n return this.yaxis;\n }\n\n /* */\n\n /* DATA MIN MAX */\n\n /**\n * @returns {Number} Lowest x value of the serie's data\n * @memberof Serie\n */\n getMinX() {\n return this.minX;\n }\n\n /**\n * @returns {Number} Highest x value of the serie's data\n * @memberof Serie\n */\n getMaxX() {\n return this.maxX;\n }\n\n /**\n * @returns {Number} Lowest y value of the serie's data\n * @memberof Serie\n */\n getMinY() {\n return this.minY;\n }\n\n /**\n * @returns {Number} Highest y value of the serie's data\n * @memberof Serie\n */\n getMaxY() {\n return this.maxY;\n }\n\n getWaveform() {\n return this.waveform;\n }\n\n getWaveforms() {\n return [ this.waveform ];\n }\n\n setWaveform( waveform ) {\n\n if ( !( waveform instanceof Waveform ) ) {\n throw 'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance';\n }\n\n this.waveform = waveform;\n\n this.minX = this.waveform.getXMin();\n this.maxX = this.waveform.getXMax();\n this.minY = this.waveform.getMin();\n this.maxY = this.waveform.getMax();\n\n this.graph.updateDataMinMaxAxes();\n this.dataHasChanged();\n\n return this;\n }\n\n /**\n * Computes and returns a line SVG element with the same line style as the serie, or width 20px\n * @returns {SVGElement}\n * @memberof Serie\n */\n getSymbolForLegend() {\n\n if ( !this.lineForLegend ) {\n\n var line = document.createElementNS( this.graph.ns, 'line' );\n this.applyLineStyle( line );\n\n line.setAttribute( 'x1', 5 );\n line.setAttribute( 'x2', 25 );\n line.setAttribute( 'y1', 0 );\n line.setAttribute( 'y2', 0 );\n\n line.setAttribute( 'cursor', 'pointer' );\n\n this.lineForLegend = line;\n }\n\n return this.lineForLegend;\n\n }\n\n /**\n * Explicitely applies the line style to the SVG element returned by {@link Serie#getSymbolForLegend}\n * @see Serie#getSymbolForLegend\n * @returns {SVGElement}\n * @memberof Serie\n */\n setLegendSymbolStyle() {\n this.applyLineStyle( this.getSymbolForLegend() );\n }\n\n /**\n * @alias Serie#setLegendSymbolStyle\n * @memberof Serie\n */\n updateStyle() {\n this.setLegendSymbolStyle();\n this.graph.updateLegend();\n }\n\n /**\n * Computes and returns a text SVG element with the label of the serie as a text, translated by 35px\n * @returns {SVGElement}\n * @memberof Serie\n * @see Serie#getLabel\n */\n getTextForLegend() {\n\n if ( !this.textForLegend ) {\n\n var text = document.createElementNS( this.graph.ns, 'text' );\n text.setAttribute( 'cursor', 'pointer' );\n text.textContent = this.getLabel();\n\n this.textForLegend = text;\n }\n\n return this.textForLegend;\n }\n\n /**\n * @returns {Number} The current index of the serie\n * @memberof Serie\n */\n getIndex() {\n return this.graph.series.indexOf( this );\n }\n\n /**\n * @returns {String} The label or, alternatively - the name of the serie\n * @memberof Serie\n */\n getLabel() {\n return this.options.label || this.name;\n }\n\n /**\n * Sets the label of the serie. Note that this does not automatically updates the legend\n * @param {String} label - The new label of the serie\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setLabel( label ) {\n this.options.label = label;\n\n if ( this.textForLegend ) {\n this.textForLegend.textContent = label;\n }\n\n this.graph.requireLegendUpdate();\n return this;\n }\n\n /* FLIP */\n\n /**\n * Assigns the flipping value of the serie. A flipped serie will have inverted axes. However this method does not automatically re-assigns the axes of the serie. Call {@link Serie#autoAxis} to re-assign the axes automatically, or any other axis setting method.\n * @param {Boolean} [flipped=false] - true to flip the serie\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setFlip( flipped ) {\n this.options.flip = flipped;\n return this;\n }\n\n /**\n * @returns {Boolean} true if the serie is flipped, false otherwise\n * @memberof Serie\n */\n getFlip() {\n return this.options.flip;\n }\n\n /**\n * @alias Serie#getFlip\n * @memberof Serie\n */\n isFlipped() {\n return this.options.flip;\n }\n\n /**\n * Sets the layer onto which the serie should be displayed. This method does not trigger a graph redraw.\n * @memberof Serie\n * @param {Number} layerIndex=1 - The index of the layer into which the serie will be drawn\n * @returns {Serie} The current serie\n */\n setLayer( layerIndex ) {\n let newLayer = parseInt( layerIndex ) || 1;\n\n if ( newLayer !== this.options.layer ) {\n this.options.layer = newLayer;\n this.graph.appendSerieToDom( this );\n }\n\n return this;\n }\n\n /**\n * Sets the layer onto which the serie should be displayed. This method does not trigger a graph redraw.\n * @memberof Serie\n * @returns {Nunber} The index of the layer into which the serie will be drawn\n */\n getLayer() {\n return this.options.layer || 1;\n }\n\n setStyle( style, selectionType = 'unselected' ) {\n this.styles[ selectionType ] = style;\n this.styleHasChanged( selectionType );\n\n }\n\n /**\n * Notifies jsGraph that the style of the serie has changed and needs to be redrawn on the next repaint\n * @param {String} selectionType - The selection for which the style may have changed\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n styleHasChanged( selectionType = 'unselected' ) {\n this._changedStyles = this._changedStyles || {};\n\n if ( selectionType === false ) {\n for ( var i in this._changedStyles ) {\n this._changedStyles[ i ] = false;\n }\n\n } else {\n this._changedStyles[ selectionType || 'unselected' ] = true;\n }\n\n this.graph.requireLegendUpdate();\n return this;\n }\n\n /**\n * Checks if the style has changed for a selection type\n * @param {String} selectionType - The selection for which the style may have changed\n * @returns {Boolean} true if the style has changed\n * @private\n * @memberof Serie\n */\n hasStyleChanged( selectionType ) {\n this._changedStyles = this._changedStyles || {};\n return this._changedStyles[ selectionType || 'unselected' ];\n }\n\n /**\n * Notifies jsGraph that the data of the serie has changed\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n dataHasChanged( arg ) {\n this._dataHasChanged = arg === undefined || arg;\n return this;\n }\n\n /**\n * Checks if the data has changed\n * @returns {Boolean} true if the data has changed\n * @private\n * @memberof Serie\n */\n hasDataChanged() {\n return this._dataHasChanged;\n }\n\n /**\n * Set a key/value arbitrary information to the serie. It is particularly useful if you have this serie has a reference through an event for instance, and you want to retrieve data associated to it\n * @param {String} prop - The property\n * @param value - The value\n * @returns {Serie} The current serie\n * @see Serie#getInfo\n * @memberof Serie\n */\n setInfo( prop, value ) {\n this.infos = this.infos || {};\n this.infos[ prop ] = value;\n return this;\n }\n\n /**\n * Retrives an information value from its key\n * @param {String} prop - The property\n * @returns The value associated to the prop parameter\n * @see Serie#setInfo\n * @memberof Serie\n */\n getInfo( prop, value ) {\n return ( this.infos || {} )[ prop ];\n }\n\n /**\n * @deprecated\n * @memberof Serie\n */\n setAdditionalData( data ) {\n this.additionalData = data;\n return this;\n }\n\n /**\n * @deprecated\n * @memberof Serie\n */\n getAdditionalData() {\n return this.additionalData;\n }\n\n /**\n * Flags the serie as selected\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n select() {\n this.selected = true;\n return this;\n }\n\n /**\n * Flags the serie as unselected\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n unselect() {\n this.selected = false;\n return this;\n }\n\n /**\n * Allows mouse tracking of the serie\n * @memberof Serie\n * @returns {Serie} The current serie\n * @param {Function} hoverCallback - Function to be called when the mouse enters the serie area\n * @param {Function} outCallback - Function to be called when the mouse exits the serie area\n * @private\n */\n enableTracking( hoverCallback, outCallback ) {\n this._tracker = true;\n this._trackingCallback = hoverCallback;\n this._trackingOutCallback = outCallback;\n\n return this;\n }\n\n /**\n * Disables mouse tracking of the serie\n * @memberof Serie\n * @returns {Serie} The current serie\n * @private\n */\n disableTracking() {\n\n if ( this._trackerDom ) {\n this._trackerDom.remove();\n this._trackerDom = null;\n }\n\n this._tracker = false;\n this._trackingCallback = null;\n return this;\n }\n\n /**\n * Allows mouse tracking of the serie\n * @memberof Serie\n * @param {Object} options - The tracking line options\n * @returns {Serie} The current serie\n */\n allowTrackingLine( options ) {\n\n options = options || {};\n this.graph.addSerieToTrackingLine( this, options );\n }\n\n getMarkerForLegend() {\n return false;\n }\n\n get type() {\n return this._type;\n }\n\n getType() {\n return this._type;\n }\n\n set excludedFromLegend( bln ) {\n this._excludedFromLegend = bln;\n }\n\n get excludedFromLegend() {\n return !!this._excludedFromLegend;\n }\n\n setDataIndices( categories, nb ) {\n this.categoryIndices = categories;\n this.nbCategories = nb;\n }\n\n hasErrors() {\n if ( !this.waveform ) {\n return false;\n }\n\n return this.waveform.hasErrorBars();\n }\n}\n\nexport default Serie;","import * as util from '../graph.util.js';\n\nvar ErrorBarMixin = {\n /*\n doErrorDraw: function( orientation, error, originVal, originPx, xpx, ypx ) {\n\n if ( !( error instanceof Array ) ) {\n error = [ error ];\n }\n\n var functionName = orientation == 'y' ? 'getY' : 'getX';\n var bars = orientation == 'y' ? [ 'top', 'bottom' ] : [ 'left', 'right' ];\n var j;\n\n if ( isNaN( xpx ) || isNaN( ypx ) ) {\n return;\n }\n\n for ( var i = 0, l = error.length; i < l; i++ ) {\n\n if ( error[ i ] instanceof Array ) { // TOP\n\n j = bars[ 0 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal + error[ i ][ 0 ] ), originPx, j );\n\n j = bars[ 1 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal - error[ i ][ 1 ] ), originPx, j );\n\n } else {\n\n j = bars[ 0 ];\n\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal + error[ i ] ), originPx, j );\n j = bars[ 1 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal - error[ i ] ), originPx, j );\n }\n }\n },\n */\n\n /*\n makeError: function( orientation, type, coord, origin, quadOrientation ) {\n\n var method;\n switch ( this.errorstyles[ level ].type ) {\n case 'bar':\n method = \"makeBar\";\n break;\n\n case 'box':\n method = \"makeBox\";\n break;\n }\n\n return this[ method + orientation.toUpperCase() ]( coord, origin, this.errorstyles[ level ][ quadOrientation ] );\n\n },*/\n\n makeBarY: function( coordY, origin, style ) {\n if ( !coordY || style === undefined ) {\n return;\n }\n var width = !util.isNumeric( style.width ) ? 10 : style.width;\n return ' V ' + coordY + ' m -' + ( width / 2 ) + ' 0 h ' + ( width ) + ' m -' + ( width / 2 ) + ' 0 V ' + origin + ' ';\n },\n\n makeBoxY: function( coordY, origin, style ) {\n if ( !coordY || style === undefined ) {\n return;\n }\n return ' m 5 0 V ' + coordY + ' h -10 V ' + origin + ' m 5 0 ';\n },\n\n makeBarX: function( coordX, origin, style ) {\n if ( !coordX || style === undefined ) {\n return;\n }\n var height = !util.isNumeric( style.width ) ? 10 : style.width;\n return ' H ' + coordX + ' m 0 -' + ( height / 2 ) + ' v ' + ( height ) + ' m 0 -' + ( height / 2 ) + ' H ' + origin + ' ';\n },\n\n makeBoxX: function( coordX, origin, style ) {\n if ( !coordX || style === undefined ) {\n return;\n }\n return ' v 5 H ' + coordX + ' v -10 H ' + origin + ' v 5 ';\n },\n /*\n check: function( index, valY, valX ) {\n\n var dx, dy;\n\n if ( ( this.getType() == Graph.SERIE_LINE || this.getType() == Graph.SERIE_SCATTER ) ) {\n\n if ( !( dx = this.data[ index * 2 ] ) || !( dy = this.data[ index * 2 + 1 ] ) ) { //\n return;\n }\n }\n\n if ( dx === undefined ) {\n return;\n }\n\n for ( var i = 0, l = valY.length; i < l; i++ ) {\n\n if ( Array.isArray( valY[ i ] ) ) {\n\n if ( !isNaN( valY[ i ][ 0 ] ) ) {\n this._checkY( dy + valY[ i ][ 0 ] );\n }\n\n if ( !isNaN( valY[ i ][ 1 ] ) ) {\n this._checkY( dy - valY[ i ][ 1 ] );\n }\n\n } else {\n\n if ( !isNaN( valY[ i ] ) ) {\n this._checkY( dy + valY[ i ] );\n this._checkY( dy - valY[ i ] );\n }\n }\n }\n\n for ( var i = 0, l = valX.length; i < l; i++ ) {\n\n if ( Array.isArray( valX[ i ] ) ) {\n\n if ( !isNaN( valX[ i ][ 0 ] ) ) {\n this._checkX( dx - valX[ i ][ 0 ] );\n }\n\n if ( !isNaN( valX[ i ][ 1 ] ) ) {\n this._checkX( dx + valX[ i ][ 1 ] );\n }\n\n } else {\n\n if ( !isNaN( valY[ i ] ) ) {\n this._checkX( dx - valX[ i ] );\n this._checkX( dx + valX[ i ] );\n }\n }\n }\n\n },\n */\n\n /**\n *\n * @example serie.setErrorStyle( [ { type: 'bar', x: {} }, { type: 'box', top: { strokeColor: 'green', fillColor: 'olive' }, bottom: { strokeColor: 'red', fillColor: \"#800000\" } } ] );\n */\n setErrorBarStyle: function( errorstyle ) {\n\n this.errorbarStyle = this._setErrorStyle( errorstyle );\n return this;\n },\n\n setErrorBoxStyle: function( errorstyle ) {\n\n this.errorboxStyle = this._setErrorStyle( errorstyle );\n return this;\n },\n\n _setErrorStyle( errorstyles = {} ) {\n\n var styles = [];\n var pairs = [\n [ 'y', 'top', 'bottom' ],\n [ 'x', 'left', 'right' ]\n ];\n\n var makePath = ( style ) => {\n\n style.dom = document.createElementNS( this.graph.ns, 'path' );\n style.dom.setAttribute( 'fill', style.fillColor || 'none' );\n style.dom.setAttribute( 'stroke', style.strokeColor || 'black' );\n style.dom.setAttribute( 'stroke-opacity', style.strokeOpacity || 1 );\n style.dom.setAttribute( 'fill-opacity', style.fillOpacity || 1 );\n style.dom.setAttribute( 'stroke-width', style.strokeWidth || 1 );\n\n this.groupMain.appendChild( style.dom );\n };\n // i is bar or box\n\n var styles = {};\n\n if ( typeof errorstyles == 'string' ) {\n errorstyles = {};\n }\n\n for ( var j = 0, l = pairs.length; j < l; j++ ) {\n\n if ( errorstyles.all ) {\n\n errorstyles[ pairs[ j ][ 1 ] ] = util.extend( true, {}, errorstyles.all );\n errorstyles[ pairs[ j ][ 2 ] ] = util.extend( true, {}, errorstyles.all );\n\n }\n\n if ( errorstyles[ pairs[ j ][ 0 ] ] ) { //.x, .y\n\n errorstyles[ pairs[ j ][ 1 ] ] = util.extend( true, {}, errorstyles[ pairs[ j ][ 0 ] ] );\n errorstyles[ pairs[ j ][ 2 ] ] = util.extend( true, {}, errorstyles[ pairs[ j ][ 0 ] ] );\n\n }\n\n for ( var k = 1; k <= 2; k++ ) {\n\n if ( errorstyles[ pairs[ j ][ k ] ] ) {\n\n styles[ pairs[ j ][ k ] ] = errorstyles[ pairs[ j ][ k ] ];\n makePath( styles[ pairs[ j ][ k ] ] );\n }\n }\n }\n\n return styles;\n },\n\n errorDrawInit: function() {\n var error;\n // var pathError = \"M 0 0 \";\n\n if ( this.errorboxStyle ) {\n\n this.errorboxStyle.paths = {\n top: '',\n bottom: '',\n left: '',\n right: ''\n };\n }\n\n if ( this.errorbarStyle ) {\n\n this.errorbarStyle.paths = {\n top: '',\n bottom: '',\n left: '',\n right: ''\n };\n }\n },\n\n errorAddPoint: function( index, dataX, dataY, xpx, ypx ) {\n\n /* eslint-disable no-cond-assign */\n let error;\n if ( error = this.waveform.getErrorBarXBelow( index ) ) {\n this.errorbarStyle.paths.left += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.left += this.makeBarX( this.getX( dataX - error ), xpx, this.errorbarStyle.left );\n }\n\n if ( error = this.waveform.getErrorBarXAbove( index ) ) {\n this.errorbarStyle.paths.right += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.right += this.makeBarX( this.getX( dataX + error ), xpx, this.errorbarStyle.right );\n }\n\n if ( error = this.waveform.getErrorBarYBelow( index ) ) {\n this.errorbarStyle.paths.bottom += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.bottom += this.makeBarY( this.getY( dataY - error ), ypx, this.errorbarStyle.bottom );\n }\n\n if ( error = this.waveform.getErrorBarYAbove( index ) ) {\n this.errorbarStyle.paths.top += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.top += this.makeBarY( this.getY( dataY + error ), ypx, this.errorbarStyle.top );\n }\n\n if ( error = this.waveform.getErrorBoxXBelow( index ) ) {\n this.errorboxStyle.paths.left += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.left += this.makeBoxX( this.getX( dataX - error ), xpx, this.errorboxStyle.left );\n }\n\n if ( error = this.waveform.getErrorBoxXAbove( index ) ) {\n this.errorboxStyle.paths.right += ' M ' + xpx + ' ' + ypx;\n\n this.errorboxStyle.paths.right += this.makeBoxX( this.getX( dataX + error ), xpx, this.errorboxStyle.right );\n }\n\n if ( error = this.waveform.getErrorBoxYBelow( index ) ) {\n this.errorboxStyle.paths.bottom += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.bottom += this.makeBoxY( this.getY( dataY - error ), ypx, this.errorboxStyle.bottom );\n }\n\n if ( error = this.waveform.getErrorBoxYAbove( index ) ) {\n this.errorboxStyle.paths.top += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.top += this.makeBoxY( this.getY( dataY + error ), ypx, this.errorboxStyle.top );\n }\n /* eslint-enable */\n\n },\n\n errorAddPointBarChart: function( j, posY, xpx, ypx ) {\n var error;\n if ( this.error && ( error = this.error[ j ] ) ) {\n this.doErrorDraw( 'y', error, posY, ypx, xpx, ypx );\n }\n },\n\n errorDraw: function() {\n\n if ( this.errorbarStyle ) {\n\n for ( var j in this.errorbarStyle.paths ) {\n\n if ( this.errorbarStyle[ j ] && this.errorbarStyle[ j ].dom ) {\n this.errorbarStyle[ j ].dom.setAttribute( 'd', this.errorbarStyle.paths[ j ] );\n }\n }\n }\n\n if ( this.errorboxStyle ) {\n\n for ( var j in this.errorboxStyle.paths ) {\n\n if ( this.errorboxStyle[ j ] && this.errorboxStyle[ j ].dom ) {\n this.errorboxStyle[ j ].dom.setAttribute( 'd', this.errorboxStyle.paths[ j ] );\n }\n }\n }\n }\n};\n\nexport default ErrorBarMixin;","import Graph from '../graph.core.js';\nimport Serie from './graph.serie.js';\n\nimport * as util from '../graph.util.js';\nimport ErrorBarMixin from '../mixins/graph.mixin.errorbars.js';\nimport Waveform from '../util/waveform.js';\n\n/**\n * Serie line\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends Serie\n */\nclass SerieLine extends Serie {\n\n static\n default () {\n /**\n * @name SerieLineDefaultOptions\n * @object\n * @static\n * @memberof SerieLine\n */\n return {\n\n lineColor: 'black',\n lineStyle: 1,\n flip: false,\n label: '',\n lineWidth: 1,\n markers: false,\n trackMouse: false,\n trackMouseLabel: false,\n trackMouseLabelRouding: 1,\n lineToZero: false,\n selectableOnClick: false,\n markersIndependant: false,\n overflowX: false,\n overflowY: false\n };\n }\n\n constructor( graph, name, options ) {\n\n super( ...arguments );\n\n this.selectionType = 'unselected';\n this.markerFamilies = {};\n\n util.mapEventEmission( this.options, this ); // Register events\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n lineWidth: this.options.lineWidth,\n markers: this.options.markers\n };\n\n this.styles.selected = {\n lineWidth: 3\n };\n\n this.extendStyles();\n this.markersDom = new Map();\n\n this.shown = true;\n\n this.data = [];\n this._isMinOrMax = {\n x: {\n min: false,\n max: false\n },\n y: {\n min: false,\n max: false\n }\n };\n\n // Optimize is no markerPoints => save loops\n // this.markerPoints = {};\n\n this.groupLines = document.createElementNS( this.graph.ns, 'g' );\n this.domMarker = document.createElementNS( this.graph.ns, 'path' );\n this.domMarker.style.cursor = 'pointer';\n\n this.groupMain = document.createElementNS( this.graph.ns, 'g' );\n this.additionalData = {};\n\n this.marker = document.createElementNS( this.graph.ns, 'circle' );\n this.marker.setAttribute( 'fill', 'black' );\n this.marker.setAttribute( 'r', 3 );\n this.marker.setAttribute( 'display', 'none' );\n\n this.markerLabel = document.createElementNS( this.graph.ns, 'text' );\n this.markerLabelSquare = document.createElementNS( this.graph.ns, 'rect' );\n this.markerLabelSquare.setAttribute( 'fill', 'white' );\n this.domMarkerHover = {};\n this.domMarkerSelect = {};\n this.markerHovered = 0;\n this.groupMarkerSelected = document.createElementNS( this.graph.ns, 'g' );\n\n this.markerPoints = {};\n\n //this.scale = 1;\n //this.shift = 0;\n this.lines = [];\n\n this.groupMain.appendChild( this.groupLines );\n\n this.groupMain.appendChild( this.marker );\n\n this.groupMain.appendChild( this.groupMarkerSelected );\n this.groupMain.appendChild( this.markerLabelSquare );\n this.groupMain.appendChild( this.markerLabel );\n\n this.groupMarkers = document.createElementNS( this.graph.ns, 'g' );\n this.groupMain.appendChild( this.groupMarkers );\n\n this.independantMarkers = [];\n\n if ( this.initExtended1 ) {\n this.initExtended1();\n }\n\n this.groupLines.addEventListener( 'click', ( e ) => {\n\n if ( this.options.selectableOnClick ) {\n\n if ( this.isSelected() ) {\n\n this.graph.unselectSerie( this );\n\n } else {\n this.graph.selectSerie( this );\n }\n }\n } );\n\n if ( this.options.markers ) {\n this.setMarkers( this.options.markers, 'unselected' );\n }\n\n }\n\n setWaveform( waveform ) {\n\n if ( !( waveform instanceof Waveform ) ) {\n throw 'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance';\n }\n\n this.waveform = waveform;\n\n this.minX = this.waveform.getXMin();\n this.maxX = this.waveform.getXMax();\n this.minY = this.waveform.getMin();\n this.maxY = this.waveform.getMax();\n\n this.graph.updateDataMinMaxAxes();\n this.dataHasChanged();\n\n return this;\n }\n\n /**\n * Sets the options of the serie\n * @see SerieLineDefaultOptions\n * @param {Object} options - A object containing the options to set\n * @return {SerieLine} The current serie\n * @memberof SerieLine\n */\n setOptions( options ) {\n this.options = util.extend( true, {}, SerieLine.prototype.defaults, ( options || {} ) );\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n markers: this.options.markers\n };\n\n this.applyLineStyles();\n return this;\n }\n\n onMouseOverMarker( e, index ) {\n\n var toggledOn = this.toggleMarker( index, true, true );\n\n if ( this.options.onMouseOverMarker ) {\n\n this.options.onMouseOverMarker(\n index,\n this.infos ? ( this.infos[ index ] || false ) : false, [ this.waveform.getX( index ), this.waveform.getY( index ) ] );\n }\n }\n\n onMouseOutMarker( e, index ) {\n this.markersOffHover();\n\n if ( this.options.onMouseOutMarker ) {\n this.options.onMouseOutMarker(\n index,\n this.infos ? ( this.infos[ index ] || false ) : false, [ this.waveform.getX( index ), this.waveform.getY( index ) ]\n );\n }\n }\n\n /**\n * Selects one of the markers of the serie\n * @param {Number} index - The point index to select (starting at 0)\n * @param {Boolean} [force = undefined] - Forces state of the marker. true forces selection, false forces deselection. undefined toggles the state of the marker\n * @param {Boolean} [hover = false] - true to set the selection in mode \"hover\" (will disappear on mouse out of the marker). false to set the selection in mode \"select\" (will disappear when another marker is selected)\n * @returns {Boolean} The new state of the marker\n * @memberof SerieLine\n */\n toggleMarker( index, force, hover ) {\n\n let i = index;\n\n var _on;\n if ( typeof force === 'undefined' ) {\n _on = !hover ? !this.domMarkerSelect[ index ] : !this.domMarkerHover[ index ];\n }\n var el = this[ 'domMarker' + ( hover ? 'Hover' : 'Select' ) ];\n\n if ( _on || force === true ) {\n\n if ( !el[ index ] ) {\n\n var dom = document.createElementNS( this.graph.ns, 'path' );\n\n this.setMarkerStyleTo( dom, this.markerFamilies[ this.selectionType ][ this.getMarkerCurrentFamily( i ) ] );\n this[ 'domMarker' + ( hover ? 'Hover' : 'Select' ) ][ index ] = dom;\n this.groupMarkerSelected.appendChild( dom );\n\n } else {\n dom = el[ index ];\n }\n\n let x = this.getX( this.waveform.getX( i ) ),\n y = this.getY( this.waveform.getY( i ) );\n\n dom.setAttribute( 'd', 'M ' + x + ' ' + y + ' ' + this.getMarkerPath( this.markerFamilies[ this.selectionType ][ this.getMarkerCurrentFamily( i ) ], 1 ) );\n\n if ( hover ) {\n this.markerHovered++;\n }\n\n } else if ( !_on || force === false ) {\n\n if ( ( hover && this.domMarkerHover[ index ] && !this.domMarkerSelect[ index ] ) || this.domMarkerSelect[ index ] ) {\n\n if ( !el[ index ] ) {\n return;\n }\n\n this.groupMarkerSelected.removeChild( el[ index ] );\n\n delete el[ index ];\n\n if ( hover )\n this.markerHovered--;\n }\n\n }\n\n return _on;\n }\n\n /**\n * Toggles off markers that have the hover mode \"on\"\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n markersOffHover() {\n\n for ( var i in this.domMarkerHover ) {\n this.toggleMarker( i.split( ',' ), false, true );\n }\n return this;\n }\n\n /**\n * Toggles off markers that have the select mode \"on\"\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n markersOffSelect() {\n\n for ( var i in this.domMarkerSelect ) {\n this.toggleMarker( i.split( ',' ), false, false );\n }\n return this;\n }\n\n onClickOnMarker( e, index ) {\n\n var toggledOn = this.toggleMarker( index );\n\n if ( toggledOn && this.options.onSelectMarker ) {\n this.options.onSelectMarker( index, this.infos ? ( this.infos[ index[ 0 ] ] || false ) : false );\n }\n\n if ( !toggledOn && this.options.onUnselectMarker ) {\n this.options.onUnselectMarker( index, this.infos ? ( this.infos[ index[ 0 ] ] || false ) : false );\n }\n\n if ( this.options.onToggleMarker ) {\n this.options.onToggleMarker( index, this.infos ? ( this.infos[ index[ 0 ] ] || false ) : false, toggledOn );\n }\n }\n\n _getMarkerIndexFromEvent( e ) {\n var px = this.graph._getXY( e );\n\n // return this.searchIndexByPxXY( ( px.x ), ( px.y ) );\n return this.searchIndexByPxXY( ( px.x - this.graph.getPaddingLeft() ), ( px.y - this.graph.getPaddingTop() ) );\n }\n\n onMouseWheel() {}\n\n /**\n * Cleans the DOM from the serie internal object (serie and markers). Mostly used internally when a new {@link Serie#setData} is called\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n empty() {\n\n for ( var i = 0, l = this.lines.length; i < l; i++ ) {\n this.groupLines.removeChild( this.lines[ i ] );\n }\n this.lines = [];\n\n return this;\n }\n\n /**\n * Applies a selection to the serie\n * @param {String} [ selectionType = \"selected\" ] - The selection name\n * @returns {SerieLine} The current serie\n * @see SerieLine#unselect\n * @memberof SerieLine\n */\n select( selectionType ) {\n\n selectionType = selectionType || 'selected';\n\n this.selected = selectionType !== 'unselected';\n\n if ( this.areMarkersShown() || this.areMarkersShown( selectionType ) ) {\n this.selectionType = selectionType;\n\n this.draw( true ); // Drawing is absolutely required here\n this.applyLineStyles();\n } else {\n this.selectionType = selectionType;\n this.applyLineStyles();\n }\n\n this.applyLineStyle( this.getSymbolForLegend() );\n return this;\n }\n\n /**\n * Removes the selection to the serie. Effectively, calls {@link SerieLine#select}(\"unselected\").\n * @returns {SerieLine} The current serie\n * @see SerieLine#select\n * @memberof SerieLine\n */\n unselect() {\n\n this.selected = false;\n\n return this.select( 'unselected' );\n }\n\n /**\n * Degrades the data of the serie. This option is used for big data sets that have monotoneously increasing (or decreasing) x values.\n * For example, a serie containing 1'000'000 points, displayed over 1'000px, will have 1'000 points per pixel. Often it does not make sense to display more than 2-3 points per pixel.\n * degrade( pxPerPoint ) allows a degradation of the serie, based on a a number of pixel per point. It computes the average of the data that would be displayed over each pixel range\n * Starting from jsGraph 2.0, it does not calculate the minimum and maximum and creates the zone serie anymore\n * @return {SerieLine} The current serie instance\n * @example serie.degrade( 0.5 ); // Will display 2 points per pixels\n * @memberof SerieLine\n */\n degrade( pxPerP ) {\n\n this.degradationPx = pxPerP;\n return this;\n }\n\n drawInit( force ) {\n\n var data, xData;\n\n try {\n this.axisCheck();\n } catch ( e ) {\n console.warn( e );\n return false;\n }\n\n this.currentLineId = 0;\n this.counter = 0;\n this._drawn = true;\n this.currentLine = '';\n\n // Degradation\n\n if ( this.waveform ) {\n\n if ( this.degradationPx ) {\n\n this.waveform.resampleForDisplay( {\n\n resampleToPx: this.degradationPx,\n xPosition: this.getXAxis().getPx.bind( this.getXAxis() ),\n minX: this.getXAxis().getCurrentMin(),\n maxX: this.getXAxis().getCurrentMax()\n\n } );\n\n this._dataToUse = [ this.waveform.getDataToUseFlat() ];\n\n } else if ( this.waveform.hasAggregation() ) {\n\n let xaxis = this.getXAxis(),\n numberOfPointsInTotal = this.graph.getDrawingWidth() * ( xaxis.getDataMax() - xaxis.getDataMin() ) / ( xaxis.getCurrentMax() - xaxis.getCurrentMin() ),\n promise = this.waveform.selectAggregatedData( numberOfPointsInTotal );\n\n if ( promise instanceof Promise ) {\n\n promise.then( () => {\n\n this.draw( force );\n\n } );\n\n return false;\n\n } else if ( promise === false ) {\n\n return false;\n\n } else {\n\n this._dataToUse = this.waveform.getDataToUseFlat();\n }\n\n }\n\n // this._dataToUse = this.waveform.getDataToUseFlat();\n\n } else {\n\n this._dataToUse = this.data;\n this._xDataToUse = this.xData;\n }\n\n return true;\n }\n\n removeLinesGroup() {\n this._afterLinesGroup = this.groupLines.nextSibling;\n this.groupMain.removeChild( this.groupLines );\n }\n\n insertLinesGroup() {\n\n if ( !this._afterLinesGroup ) {\n throw 'Could not find group after lines to insertion.';\n }\n\n this.groupMain.insertBefore( this.groupLines, this._afterLinesGroup );\n this._afterLinesGroup = false;\n }\n\n removeExtraLines() {\n\n var i = this.currentLineId,\n l = this.lines.length;\n\n for ( ; i < l; i++ ) {\n this.groupLines.removeChild( this.lines[ i ] );\n }\n\n this.lines.splice( this.currentLineId, l - ( this.currentLineId ) );\n this.currentLineId = 0;\n }\n\n /**\n * Draws the serie\n * @memberof SerieLine\n */\n draw( force ) { // Serie redrawing\n\n super.draw( ...arguments );\n\n if ( !this.getXAxis() || !this.getYAxis() ) {\n throw 'No axes were defined for this serie';\n }\n\n if ( force || this.hasDataChanged() ) {\n if ( !this.drawInit( force ) ) {\n return;\n }\n\n var data = this._dataToUse,\n xData = this._xDataToUse,\n slotToUse = this._slotToUse;\n\n this.removeLinesGroup();\n this.eraseMarkers();\n\n this.lookForMaxima = true;\n this.lookForMinima = false;\n\n this.markerFamily = this.markerFamilies[ this.selectionType || 'unselected' ];\n\n this.pos0 = this.getYAxis().getPos( 0 );\n\n if ( this.hasErrors() ) {\n this.errorDrawInit();\n }\n\n this._draw();\n\n if ( this.hasErrors() ) {\n this.errorDraw();\n }\n\n this.removeExtraLines();\n this.insertMarkers();\n this.insertLinesGroup();\n }\n\n // Unhovers everything\n for ( var i in this.domMarkerHover ) {\n this.toggleMarker( i.split( ',' ), false, true );\n }\n\n // Deselects everything\n for ( var i in this.domMarkerSelect ) {\n this.toggleMarker( i.split( ',' ), false, false );\n }\n\n this.applyLineStyle( this.getSymbolForLegend() );\n\n if ( this.hasStyleChanged( this.selectionType ) ) {\n this.updateStyle();\n }\n\n this.dataHasChanged( false );\n super.afterDraw();\n\n }\n\n _draw() {\n\n let self = this,\n waveform = this.waveform,\n data,\n x,\n y,\n lastX = false,\n lastY = false,\n xpx,\n ypx,\n xpx2,\n ypx2,\n xAxis = this.getXAxis(),\n yAxis = this.getYAxis(),\n xMin = xAxis.getCurrentMin(),\n yMin = yAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n yMax = yAxis.getCurrentMax();\n\n if ( !waveform ) {\n return;\n }\n\n data = waveform.getData( true );\n\n // Y crossing\n let yLeftCrossingRatio,\n yLeftCrossing,\n yRightCrossingRatio,\n yRightCrossing,\n xTopCrossingRatio,\n xTopCrossing,\n xBottomCrossingRatio,\n xBottomCrossing,\n\n /*xshift = waveform.getXShift(),\n xscale = wave.getXScale(),*/\n yshift = waveform.getShift(),\n yscale = waveform.getScale();\n\n let pointOutside = false;\n let lastPointOutside = false;\n let pointOnAxis;\n\n let _monotoneous = this.isMonotoneous(),\n _markersShown = this.markersShown();\n\n let i = 0,\n l = waveform.getLength();\n\n this.currentLine = '';\n\n if ( waveform.isXMonotoneous() ) {\n\n if ( waveform.isXMonotoneousAscending() ) {\n\n i = waveform.getIndexFromX( xMin, true ) || 0;\n l = waveform.getIndexFromX( xMax, true );\n\n if ( l === false ) {\n l = waveform.getLength();\n }\n\n } else {\n\n i = waveform.getIndexFromX( xMax, true ) || 0;\n l = waveform.getIndexFromX( xMin, true );\n\n if ( l === false ) {\n l = waveform.getLength();\n }\n }\n\n l += 2;\n if ( l > data.length ) {\n l = data.length;\n }\n }\n\n for ( ; i < l; i += 1 ) {\n\n x = waveform.getX( i, true );\n y = data[ i ] * yscale + yshift;\n\n if ( x != x || y != y ) { // NaN checks\n this._createLine();\n continue;\n }\n\n if ( ( !this.options.overflowX && x < xMin && lastX < xMin ) || ( !this.options.overflowX && x > xMax && lastX > xMax ) || ( ( ( !this.options.overflowY && y < yMin && lastY < yMin ) || ( !this.options.overflowY && y > yMax && lastY > yMax ) ) && !this.options.lineToZero ) ) {\n lastX = x;\n lastY = y;\n lastPointOutside = true;\n continue;\n }\n\n this.counter2 = i;\n\n if ( _markersShown ) {\n this.getMarkerCurrentFamily( this.counter2 );\n }\n\n xpx2 = this.getX( x );\n ypx2 = this.getY( y );\n //xpx2 = 0;\n //ypx2 = 0;\n\n if ( xpx2 == xpx && ypx2 == ypx ) {\n continue;\n }\n\n if ( xpx2 != xpx2 || ypx2 != ypx2 ) { // NaN checks\n if ( this.counter > 0 ) {\n\n this._createLine();\n }\n continue;\n }\n\n if ( !_monotoneous ) {\n\n pointOutside = ( !this.options.overflowX && ( x < xMin || x > xMax ) ) || ( !this.options.overflowY && ( y < yMin || y > yMax ) );\n\n } else {\n pointOutside = !this.options.overflowY && ( y < yMin || y > yMax );\n }\n\n if ( this.options.lineToZero ) {\n pointOutside = ( x < xMin || x > xMax );\n\n if ( pointOutside ) {\n continue;\n }\n } else {\n\n if ( pointOutside || lastPointOutside ) {\n\n if ( ( lastX === false || lastY === false ) && !lastPointOutside ) {\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n\n } else {\n\n pointOnAxis = [];\n // Y crossing\n yLeftCrossingRatio = ( x - xMin ) / ( x - lastX );\n yLeftCrossing = y - yLeftCrossingRatio * ( y - lastY );\n yRightCrossingRatio = ( x - xMax ) / ( x - lastX );\n yRightCrossing = y - yRightCrossingRatio * ( y - lastY );\n\n // X crossing\n xTopCrossingRatio = ( y - yMin ) / ( y - lastY );\n xTopCrossing = x - xTopCrossingRatio * ( x - lastX );\n xBottomCrossingRatio = ( y - yMax ) / ( y - lastY );\n xBottomCrossing = x - xBottomCrossingRatio * ( x - lastX );\n\n if ( yLeftCrossingRatio < 1 && yLeftCrossingRatio > 0 && yLeftCrossing !== false && yLeftCrossing < yMax && yLeftCrossing > yMin ) {\n pointOnAxis.push( [ xMin, yLeftCrossing ] );\n }\n\n if ( yRightCrossingRatio < 1 && yRightCrossingRatio > 0 && yRightCrossing !== false && yRightCrossing < yMax && yRightCrossing > yMin ) {\n pointOnAxis.push( [ xMax, yRightCrossing ] );\n }\n\n if ( xTopCrossingRatio < 1 && xTopCrossingRatio > 0 && xTopCrossing !== false && xTopCrossing < xMax && xTopCrossing > xMin ) {\n pointOnAxis.push( [ xTopCrossing, yMin ] );\n }\n\n if ( xBottomCrossingRatio < 1 && xBottomCrossingRatio > 0 && xBottomCrossing !== false && xBottomCrossing < xMax && xBottomCrossing > xMin ) {\n pointOnAxis.push( [ xBottomCrossing, yMax ] );\n }\n\n if ( pointOnAxis.length > 0 ) {\n\n if ( !pointOutside ) { // We were outside and now go inside\n\n if ( pointOnAxis.length > 1 ) {\n console.error( 'Programmation error. Please e-mail me.' );\n console.log( pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY );\n }\n\n this._createLine();\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n this._addPoint( xpx2, ypx2, lastX, lastY, false, false, true );\n\n } else if ( !lastPointOutside ) { // We were inside and now go outside\n\n if ( pointOnAxis.length > 1 ) {\n console.error( 'Programmation error. Please e-mail me.' );\n console.log( pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY );\n }\n\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n\n } else {\n\n // No crossing: do nothing\n if ( pointOnAxis.length == 2 ) {\n this._createLine();\n\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n this._addPoint( this.getX( pointOnAxis[ 1 ][ 0 ] ), this.getY( pointOnAxis[ 1 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n }\n\n }\n } else if ( !pointOutside ) {\n\n this._addPoint( xpx2, ypx2, lastX, lastY, i, false, false );\n } // else {\n // Norman:\n // This else case is not the sign of a bug. If yLeftCrossing == 0 or 1 for instance, pointOutside or lastPointOutside will be true\n // However, there's no need to draw anything because the point is on the axis and will already be covered.\n // 28 Aug 2015\n\n /*\n if ( lastPointOutside !== pointOutside ) {\n console.error( \"Programmation error. A crossing should have been found\" );\n console.log( yLeftCrossing, yLeftCrossingRatio, yMax, yMin );\n console.log( yRightCrossing, yRightCrossingRatio, yMax, yMin );\n console.log( xTopCrossing, xTopCrossingRatio, xMax, xMin );\n console.log( xBottomCrossing, xBottomCrossingRatio, xMax, xMin );\n console.log( pointOutside, lastPointOutside )\n\n }\n */\n // }\n }\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n\n lastPointOutside = pointOutside;\n\n continue;\n }\n\n }\n\n this._addPoint( xpx2, ypx2, x, y, i, false, true );\n\n //this.detectPeaks( x, y );\n\n xpx = xpx2;\n ypx = ypx2;\n\n lastX = x;\n lastY = y;\n }\n\n this._createLine();\n\n if ( this._tracker ) {\n\n if ( this._trackerDom ) {\n this._trackerDom.remove();\n }\n\n var cloned = this.groupLines.cloneNode( true );\n this.groupMain.appendChild( cloned );\n\n for ( i = 0, l = cloned.children.length; i < l; i++ ) {\n\n cloned.children[ i ].setAttribute( 'stroke', 'transparent' );\n cloned.children[ i ].setAttribute( 'stroke-width', '25px' );\n cloned.children[ i ].setAttribute( 'pointer-events', 'stroke' );\n }\n\n this._trackerDom = cloned;\n\n this.groupMain.addEventListener( 'mousemove', ( e ) => {\n var coords = this.graph._getXY( e ),\n ret = this.handleMouseMove( false, false );\n\n this._trackingCallback( this, ret, coords.x, coords.y );\n } );\n\n this.groupMain.addEventListener( 'mouseleave', ( e ) => {\n this._trackingOutCallback( this );\n } );\n }\n\n return this;\n\n }\n\n kill() {\n super.kill();\n }\n\n /**\n * @param {Number} k - Index of the point for which we should get the family\n * @memberof SerieLine\n */\n getMarkerCurrentFamily( k ) {\n\n if ( !this.markerPoints || !this.markerPoints[ this.selectionType ] ) {\n return;\n }\n\n var family;\n\n for ( var z = 0; z < this.markerPoints[ this.selectionType ].length; z++ ) {\n if ( this.markerPoints[ this.selectionType ][ z ][ 0 ] <= k ) { // This one is a possibility !\n if ( this.markerPoints[ this.selectionType ][ z ][ 1 ] >= k ) { // Verify that it's in the boundary\n this.markerCurrentFamily = this.markerPoints[ this.selectionType ][ z ][ 2 ];\n family = this.markerFamilies[ this.selectionType ][ this.markerCurrentFamily ];\n }\n } else {\n break;\n }\n }\n\n if ( !family ) {\n return false;\n }\n this.getMarkerDom( family );\n return this.markerCurrentFamily;\n }\n\n setMarkerStyleTo( dom, family ) {\n\n if ( !dom || !family ) {\n console.trace();\n throw 'Cannot set marker style. DOM does not exist.';\n }\n\n dom.setAttribute( 'fill', family.fillColor || 'transparent' );\n dom.setAttribute( 'stroke', family.strokeColor || this.getLineColor() );\n dom.setAttribute( 'stroke-width', family.strokeWidth || 1 );\n }\n\n /**\n * Hides the tracking marker (see the trackMouse option)\n * @memberof SerieLine\n */\n hideTrackingMarker() {\n this.marker.setAttribute( 'display', 'none' );\n this.markerLabel.setAttribute( 'display', 'none' );\n this.markerLabelSquare.setAttribute( 'display', 'none' );\n }\n\n _addPoint( xpx, ypx, x, y, j, move, allowMarker ) {\n\n /*if( ! this.currentLineId ) {\n throw \"No current line\"\n }* @memberof SerieLine\n*/\n\n if ( xpx !== xpx || ypx !== ypx ) {\n return;\n }\n\n if ( this.counter == 0 ) {\n this.currentLine = 'M ';\n } else {\n\n if ( this.options.lineToZero || move ) {\n this.currentLine += 'M ';\n } else {\n this.currentLine += 'L ';\n }\n }\n\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += ypx;\n this.currentLine += ' ';\n\n if ( this.options.lineToZero && this.pos0 !== undefined ) {\n\n this.currentLine += 'L ';\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += this.pos0;\n this.currentLine += ' ';\n\n }\n\n if ( this.hasErrors() ) {\n this.errorAddPoint( j, x, y, xpx, ypx );\n }\n\n if ( !this.markerPoints ) {\n this.counter++;\n\n return;\n }\n\n if ( this.markersShown() && allowMarker !== false && this.markerFamily ) {\n drawMarkerXY(\n this,\n this.markerFamily[ this.markerCurrentFamily ],\n xpx,\n ypx,\n this.markersDom.get( this.markerFamily[ this.markerCurrentFamily ] )\n );\n }\n\n this.counter++;\n\n }\n\n // Returns the DOM\n _createLine() {\n\n var i = this.currentLineId++,\n line;\n\n // Creates a line if needed\n if ( this.lines[ i ] ) {\n line = this.lines[ i ];\n } else {\n\n line = document.createElementNS( this.graph.ns, 'path' );\n this.applyLineStyle( line );\n this.groupLines.appendChild( line );\n this.lines[ i ] = line;\n }\n\n if ( this.counter == 0 ) {\n line.setAttribute( 'd', '' );\n } else {\n line.setAttribute( 'd', this.currentLine );\n }\n\n this.currentLine = 'M ';\n this.counter = 0;\n\n return line;\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyles() {\n\n for ( var i = 0; i < this.lines.length; i++ ) {\n this.applyLineStyle( this.lines[ i ] );\n }\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyle( line ) {\n\n line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute( 'stroke-width', this.getLineWidth() );\n if ( this.getLineDashArray() ) {\n line.setAttribute( 'stroke-dasharray', this.getLineDashArray() );\n } else {\n line.removeAttribute( 'stroke-dasharray' );\n }\n line.setAttribute( 'fill', 'none' );\n //\tline.setAttribute('shape-rendering', 'optimizeSpeed');\n }\n\n /**\n * Updates the current style (lines + legend) of the serie. Use this method if you have explicitely changed the options of the serie\n * @example var opts = { lineColor: 'red' };\n * var s = graph.newSerie( \"name\", opts ).setData( someData );\n * opts.lineColor = 'green';\n * s.updateStyle(); // Sets the lineColor to green\n * s.draw(); // Would also do the same thing, but recalculates the whole serie display (including (x,y) point pairs)\n * @memberof SerieLine\n */\n updateStyle() {\n this.applyLineStyles();\n this.setLegendSymbolStyle();\n\n this.styleHasChanged( false );\n }\n\n // Revised August 2014. Ok\n getMarkerPath( family, add ) {\n\n var z = family.zoom || 1,\n add = add || 0,\n el = [];\n\n switch ( family.type ) {\n\n case 2:\n el = [ 'm', -2, -2, 'l', 4, 4, 'm', -4, 0, 'l', 4, -4 ];\n break;\n\n case 3:\n el = [ 'm', -2, 0, 'l', 4, 0, 'm', -2, -2, 'l', 0, 4 ];\n break;\n\n case 4:\n el = [ 'm', -1, -1, 'l', 2, 0, 'l', -1, 2, 'z' ];\n break;\n\n default:\n case 1:\n el = [ 'm', -2, -2, 'l', 4, 0, 'l', 0, 4, 'l', -4, 0, 'z' ];\n break;\n\n }\n\n if ( ( z == 1 || !z ) && !add ) {\n return el.join( ' ' );\n }\n\n var num = 'number';\n\n if ( !el ) {\n return;\n }\n\n for ( var i = 0, l = el.length; i < l; i++ ) {\n\n if ( typeof el[ i ] == num ) {\n\n el[ i ] *= ( z + add );\n }\n }\n\n return el.join( ' ' );\n\n }\n\n // Revised August 2014. Ok\n getMarkerDom( family ) {\n\n var self = this;\n\n if ( !this.markersDom.has( family ) ) {\n\n var dom = document.createElementNS( this.graph.ns, 'path' );\n this.setMarkerStyleTo( dom, family );\n this.markersDom.set( family, {\n dom: dom,\n path: ''\n } );\n\n dom.addEventListener( 'mouseover', function( e ) {\n var closest = self._getMarkerIndexFromEvent( e );\n self.onMouseOverMarker( e, closest );\n } );\n\n dom.addEventListener( 'mouseout', function( e ) {\n var closest = self._getMarkerIndexFromEvent( e );\n self.onMouseOutMarker( e, closest );\n } );\n\n dom.addEventListener( 'click', function( e ) {\n var closest = self._getMarkerIndexFromEvent( e );\n self.onClickOnMarker( e, closest );\n } );\n\n }\n\n return family.dom;\n }\n\n // In case markers are not grouped in families but independant\n getMarkerDomIndependent( index, family ) {\n\n if ( !this.independantMarkers[ index ] ) {\n\n var dom = document.createElementNS( this.graph.ns, 'path' );\n this.setMarkerStyleTo( dom, family );\n\n dom.addEventListener( 'mouseover', ( e ) => {\n\n this.onMouseOverMarker( e, index );\n\n } );\n\n dom.addEventListener( 'mouseout', ( e ) => {\n\n this.onMouseOutMarker( e, index );\n\n } );\n\n dom.addEventListener( 'click', ( e ) => {\n\n this.onClickOnMarker( e, index );\n\n } );\n\n this.independantMarkers[ index ] = dom;\n }\n\n this.groupMarkers.appendChild( this.independantMarkers[ index ] );\n\n return this.independantMarkers[ index ];\n }\n\n /**\n * Searches the closest point pair (x,y) to the a pair of pixel position\n * @param {Number} x - The x position in pixels (from the left)\n * @param {Number} y - The y position in pixels (from the left)\n * @returns {Number} Index in the data array of the closest (x,y) pair to the pixel position passed in parameters\n * @memberof SerieLine\n */\n searchIndexByPxXY( x, y ) {\n\n var oldDist = false,\n xyindex = false,\n dist;\n\n var xData = this._xDataToUse,\n p_x,\n p_y;\n\n for ( var k = 0, m = this.waveform.getLength(); k < m; k += 1 ) {\n\n p_x = this.waveform.getX( k );\n p_y = this.waveform.getY( k );\n\n dist = Math.pow( ( this.getX( p_x ) - x ), 2 ) + Math.pow( ( this.getY( p_y ) - y ), 2 );\n //console.log(x, y, dist, this.data[i][k], this.data[i][k + 1]);\n\n if ( !oldDist || dist < oldDist ) {\n oldDist = dist;\n xyindex = k;\n }\n }\n\n return xyindex;\n }\n\n /**\n * Performs a binary search to find the closest point index to an x value. For the binary search to work, it is important that the x values are monotoneous.\n * @param {Number} valX - The x value to search for\n * @returns {Object} Index in the data array of the closest (x,y) pair to the pixel position passed in parameters\n * @memberof SerieLine\n */\n searchClosestValue( valX, valY ) {\n\n if ( this.waveform ) {\n\n const indexX = this.waveform.getIndexFromXY( valX, valY, undefined, undefined, this.getXAxis().getRelPx( 1 ), this.getYAxis().getRelPx( 1 ) );\n\n let returnObj = {};\n\n let direction;\n\n if ( valX > this.waveform.getX( indexX ) ) {\n direction = 0;\n } else {\n direction = 1;\n }\n\n Object.assign( returnObj, {\n indexMin: indexX + direction,\n indexMax: indexX + direction + 1,\n indexClosest: indexX,\n xMin: this.waveform.getX( indexX + direction ),\n xMax: this.waveform.getX( indexX + direction + 1 ),\n yMin: this.waveform.getY( indexX + direction ),\n yMax: this.waveform.getY( indexX + direction + 1 ),\n xClosest: this.waveform.getX( indexX ),\n yClosest: this.waveform.getY( indexX ),\n xExact: valX\n } );\n return returnObj;\n }\n\n }\n\n handleMouseMove( xValue, doMarker, yValue ) {\n\n var valX = xValue || this.getXAxis().getMouseVal(),\n valY = yValue || this.getYAxis().getMouseVal(),\n xMinIndex,\n xMin,\n yMin,\n xMax,\n yMax;\n\n var value = this.searchClosestValue( valX, valY );\n\n if ( !value ) {\n return;\n }\n\n var ratio, intY;\n\n if ( value.xMax == value.xMin ) {\n intY = value.yMin;\n } else {\n\n //ratio = ( valX - value.xMin ) / ( value.xMax - value.xMin );\n //intY = ( ( 1 - ratio ) * value.yMin + ratio * value.yMax );\n }\n\n if ( doMarker && this.options.trackMouse ) {\n\n if ( value.xMin == undefined ) {\n\n return false;\n\n } else {\n\n if ( !this.marker ) {\n return;\n }\n\n var x = this.getX( this.getFlip() ? value.yClosest : value.xClosest );\n var y = this.getY( this.getFlip() ? value.xClosest : value.yClosest );\n\n if ( isNaN( x ) || isNaN( y ) ) {\n return;\n }\n\n this.marker.setAttribute( 'display', 'block' );\n this.marker.setAttribute( 'cx', x );\n this.marker.setAttribute( 'cy', y );\n\n this.markerLabel.setAttribute( 'display', 'block' );\n this.markerLabelSquare.setAttribute( 'display', 'block' );\n\n switch ( this.options.trackMouseLabel ) {\n\n case false:\n\n break;\n\n default:\n this.markerLabel.textContent = this.options.trackMouseLabel\n .replace( '', valX.toFixed( this.options.trackMouseLabelRouding ) )\n .replace( '', intY.toFixed( this.options.trackMouseLabelRouding ) );\n break;\n }\n\n this.markerLabel.setAttribute( 'x', x + 5 );\n this.markerLabel.setAttribute( 'y', y - 5 );\n\n this.markerLabelSquare.setAttribute( 'x', x + 5 );\n this.markerLabelSquare.setAttribute( 'y', y - 5 - this.graph.options.fontSize );\n this.markerLabelSquare.setAttribute( 'width', this.markerLabel.getComputedTextLength() + 2 );\n this.markerLabelSquare.setAttribute( 'height', this.graph.options.fontSize + 2 );\n }\n }\n\n return {\n xBefore: value.xMin,\n xAfter: value.xMax,\n yBefore: value.yMin,\n yAfter: value.yMax,\n trueX: value.xExact,\n indexClosest: value.indexClosest,\n interpolatedY: intY,\n\n xClosest: value.xClosest,\n yClosest: value.yClosest\n };\n }\n /**\n * Gets the maximum value of the y values between two x values. The x values must be monotoneously increasing\n * @param {Number} startX - The start of the x values\n * @param {Number} endX - The end of the x values\n * @returns {Number} Maximal y value in between startX and endX\n * @memberof SerieLine\n */\n getMax( start, end ) {\n\n var start2 = Math.min( start, end ),\n end2 = Math.max( start, end ),\n v1 = this.searchClosestValue( start2 ),\n v2 = this.searchClosestValue( end2 ),\n i, j, max = -Infinity,\n initJ, maxJ;\n\n // console.log( start2, end2, v1, v2 );\n\n if ( !v1 ) {\n start2 = this.minX;\n v1 = this.searchClosestValue( start2 );\n }\n\n if ( !v2 ) {\n end2 = this.maxX;\n v2 = this.searchClosestValue( end2 );\n }\n\n if ( !v1 || !v2 ) {\n return -Infinity;\n }\n\n for ( i = v1.dataIndex; i <= v2.dataIndex; i++ ) {\n initJ = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n maxJ = i == v2.dataIndex ? v2.xBeforeIndexArr : this.data[ i ].length;\n\n for ( j = initJ; j <= maxJ; j += 2 ) {\n max = Math.max( max, this.data[ i ][ j + 1 ] );\n }\n }\n\n return max;\n }\n\n /**\n * Gets the minimum value of the y values between two x values. The x values must be monotoneously increasing\n * @param {Number} startX - The start of the x values\n * @param {Number} endX - The end of the x values\n * @returns {Number} Maximal y value in between startX and endX\n * @memberof SerieLine\n */\n getMin( start, end ) {\n\n var start2 = Math.min( start, end ),\n end2 = Math.max( start, end ),\n v1 = this.searchClosestValue( start2 ),\n v2 = this.searchClosestValue( end2 ),\n i, j, min = Infinity,\n initJ, maxJ;\n\n if ( !v1 ) {\n start2 = this.minX;\n v1 = this.searchClosestValue( start2 );\n }\n\n if ( !v2 ) {\n end2 = this.maxX;\n v2 = this.searchClosestValue( end2 );\n }\n\n if ( !v1 || !v2 ) {\n return Infinity;\n }\n\n for ( i = v1.dataIndex; i <= v2.dataIndex; i++ ) {\n initJ = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n maxJ = i == v2.dataIndex ? v2.xBeforeIndexArr : this.data[ i ].length;\n\n for ( j = initJ; j <= maxJ; j += 2 ) {\n min = Math.min( min, this.data[ i ][ j + 1 ] );\n }\n }\n\n return min;\n }\n\n /* LINE STYLE * @memberof SerieLine\n */\n\n setStyle( style, selectionType = 'unselected' ) {\n\n this.styles[ selectionType ] = style;\n this.styleHasChanged( selectionType );\n\n }\n\n setLineStyle( number, selectionType = 'unselected', applyToSelected ) {\n\n this.styles[ selectionType ] = this.styles[ selectionType ] || {};\n this.styles[ selectionType ].lineStyle = number;\n\n if ( applyToSelected ) {\n this.setLineStyle( number, 'selected' );\n }\n\n this.styleHasChanged( selectionType );\n\n return this;\n }\n\n getLineStyle( selectionType ) {\n return this.getStyle( selectionType ).lineStyle;\n }\n\n getLineDashArray( selectionType = this.selectionType || 'unselected' ) {\n\n switch ( this.getStyle( selectionType ).lineStyle ) {\n\n case 2:\n return '1, 1';\n break;\n case 3:\n return '2, 2';\n break;\n case 4:\n return '3, 3';\n break;\n case 5:\n return '4, 4';\n break;\n case 6:\n return '5, 5';\n break;\n\n case 7:\n return '5 2';\n break;\n case 8:\n return '2 5';\n break;\n\n case 9:\n return '4 2 4 4';\n break;\n case 10:\n return '1,3,1';\n break;\n case 11:\n return '9 2';\n break;\n case 12:\n return '2 9';\n break;\n\n case 1:\n case false:\n return false;\n break;\n\n default:\n return this.styles[ selectionType ].lineStyle;\n break;\n }\n\n this.styleHasChanged( selectionType );\n\n }\n\n getStyle( selectionType = this.selectionType || 'unselected' ) {\n return this.styles[ selectionType ];\n }\n\n extendStyles() {\n for ( var i in this.styles ) {\n\n var s = this.styles[ i ];\n if ( s ) {\n this.styles[ i ] = util.extend( true, {}, this.styles.unselected, s );\n }\n }\n }\n\n extendStyle( styleTarget, styleOrigin ) {\n var s = this.styles[ styleTarget ];\n\n this.styles[ styleTarget ] = util.extend( true, {}, this.styles[ styleOrigin || 'unselected' ], s || {} );\n\n this.styles[ styleTarget ].markers.map( function( marker ) {\n if ( marker.dom ) {\n marker.dom = '';\n }\n } );\n\n this._recalculateMarkerPoints( styleTarget, this.styles[ styleTarget ].markers );\n this.styleHasChanged( styleTarget );\n }\n\n /* * @memberof SerieLine\n */\n\n setLineWidth( width, selectionType, applyToSelected ) {\n\n selectionType = selectionType || 'unselected';\n this.styles[ selectionType ] = this.styles[ selectionType ] || {};\n this.styles[ selectionType ].lineWidth = width;\n\n if ( applyToSelected ) {\n this.setLineWidth( width, 'selected' );\n }\n\n this.styleHasChanged( selectionType );\n\n return this;\n }\n\n getLineWidth( selectionType ) {\n\n return this.getStyle( selectionType ).lineWidth || 1;\n }\n\n /* LINE COLOR * @memberof SerieLine\n */\n setLineColor( color, selectionType, applyToSelected ) {\n\n selectionType = selectionType || 'unselected';\n this.styles[ selectionType ] = this.styles[ selectionType ] || {};\n this.styles[ selectionType ].lineColor = color;\n\n if ( applyToSelected ) {\n this.setLineColor( color, 'selected' );\n }\n\n this.styleHasChanged( selectionType );\n\n return this;\n }\n\n getLineColor( selectionType ) {\n\n return this.getStyle( selectionType ).lineColor || 'black';\n }\n\n /* * @memberof SerieLine\n */\n\n /* MARKERS * @memberof SerieLine\n */\n showMarkers( selectionType, redraw ) {\n selectionType = selectionType || 'unselected';\n this.styles[ selectionType ] = this.styles[ selectionType ] || {};\n this.styles[ selectionType ].showMarkers = true;\n\n if ( redraw && this._drawn ) {\n this.draw( true );\n } else {\n this.styleHasChanged( selectionType );\n }\n\n return this;\n }\n\n hideMarkers( selectionType, redraw ) {\n\n selectionType = selectionType || 'unselected';\n this.styles[ selectionType ].showMarkers = false;\n\n if ( redraw && this._drawn ) {\n this.draw( true );\n } else {\n this.styleHasChanged( selectionType );\n }\n return this;\n }\n\n markersShown( selectionType ) {\n return this.getStyle( selectionType ).showMarkers !== false;\n }\n\n areMarkersShown() {\n return this.markersShown.apply( this, arguments );\n }\n\n isMarkersShown() {\n return this.markersShown.apply( this, arguments );\n }\n\n // Multiple markers\n setMarkers( families, selectionType, applyToSelected ) {\n // Family has to be an object\n // Family looks like\n /*\n\t\t\t\t{\n\t\t\t\t\ttype: 1,\n\t\t\t\t\tzoom: 1,\n\t\t\t\t\tstrokeWidth: 1,\n\t\t\t\t\tstrokeColor: '',\n\t\t\t\t\tfillColor: '',\n points: []\n\t\t\t\t}\n\t\t\t* @memberof SerieLine\n*/\n\n this.styles[ selectionType || 'unselected' ] = this.styles[ selectionType || 'unselected' ] || {};\n\n this.showMarkers( selectionType, false );\n\n if ( !Array.isArray( families ) && typeof families == 'object' ) {\n families = [ families ];\n } else if ( !families ) {\n\n families = [ {\n type: 1,\n zoom: 1,\n points: 'all'\n } ];\n }\n\n this.styles[ selectionType || 'unselected' ].markers = families;\n\n if ( applyToSelected ) {\n this.styles.selected.markers = util.extend( true, {}, families );\n }\n\n this._recalculateMarkerPoints( selectionType, families );\n this.styleHasChanged( selectionType );\n this.dataHasChanged( true ); // Data has not really changed, but marker placing is performed during the draw method\n return this;\n }\n\n setMarkersPoints( points, family, selectionType ) {\n this._extendMarkers( 'points', points, family, selectionType, true );\n }\n\n setMarkersColor( color, family, selectionType ) {\n this._extendMarkers( 'color', color, family, selectionType );\n }\n\n setMarkersType( type, family, selectionType ) {\n this._extendMarkers( 'type', type, family, selectionType );\n }\n\n setMarkersZoom( zoom, family, selectionType ) {\n this._extendMarkers( 'zoom', zoom, family, selectionType );\n }\n\n setMarkersStrokeColor( strokeColor, family, selectionType ) {\n this._extendMarkers( 'strokeColor', strokeColor, family, selectionType );\n }\n\n setMarkersStrokeWidth( strokeWidth, family, selectionType ) {\n this._extendMarkers( 'strokeWidth', strokeWidth, family, selectionType );\n }\n\n setMarkersFillColor( fillColor, family, selectionType ) {\n this._extendMarkers( 'fillColor', fillColor, family, selectionType );\n }\n\n _extendMarkers( type, value, family, selectionType, recalculatePoints ) {\n\n family = family || 0;\n selectionType = selectionType || 'unselected';\n\n if ( !this.styles[ selectionType ] || !this.styles[ selectionType ].markers ) {\n return;\n }\n\n this.styles[ selectionType ].markers[ family ][ type ] = value;\n\n if ( recalculatePoints ) {\n this._recalculateMarkerPoints( selectionType, this.styles[ selectionType ].markers );\n }\n\n if ( !this.markersDom[ this.styles[ selectionType ].markers[ family ] ] ) { // DOM doesn't exist yet.\n return;\n }\n\n this.setMarkerStyleTo( this.markersDom[ this.styles[ selectionType ].markers[ family ] ].dom, this.styles[ selectionType ].markers[ family ] );\n\n }\n\n _recalculateMarkerPoints( selectionType, families ) {\n\n var markerPoints = [];\n // Overwriting any other undefined families\n markerPoints.push( [ 0, Infinity, null ] );\n\n for ( var i = 0, k = families.length; i < k; i++ ) {\n\n families[ i ].markerPath = this.getMarkerPath( families[ i ] );\n\n if ( !families[ i ].points ) {\n families[ i ].points = 'all';\n }\n\n if ( !Array.isArray( families[ i ].points ) ) {\n families[ i ].points = [ families[ i ].points ];\n }\n\n for ( var j = 0, l = families[ i ].points.length; j < l; j++ ) {\n\n if ( families[ i ].points[ j ] == 'all' ) {\n\n markerPoints.push( [ 0, Infinity, i ] );\n\n } else if ( !Array.isArray( families[ i ].points[ j ] ) ) {\n\n markerPoints.push( [ families[ i ].points[ j ], families[ i ].points[ j ], i ] );\n //markerPoints.push( [ family[ i ].points[ j ] + 1, null ] );\n } else {\n\n markerPoints.push( [ families[ i ].points[ j ][ 0 ], families[ i ].points[ j ][ 1 ], i ] );\n\n }\n }\n }\n\n this.markerFamilies[ selectionType || 'unselected' ] = families;\n\n // Let's sort if by the first index.\n markerPoints.sort( function( a, b ) {\n return ( a[ 0 ] - b[ 0 ] ) || ( a[ 2 ] == null ? -1 : 1 );\n } );\n\n this.markerPoints[ selectionType || 'unselected' ] = markerPoints;\n }\n\n insertMarkers( selectionType ) {\n\n if ( !this.markerFamilies || !this.markerFamilies[ selectionType || this.selectionType ] || this.options.markersIndependant ) {\n return;\n }\n\n for ( var i = 0, l = this.markerFamilies[ selectionType || this.selectionType ].length; i < l; i++ ) {\n\n if ( !this.markersDom.has( this.markerFamilies[ selectionType || this.selectionType ][ i ] ) ) {\n continue;\n }\n\n let dom =\n this\n .markersDom\n .get( this.markerFamilies[ selectionType || this.selectionType ][ i ] );\n\n dom.dom\n .setAttribute(\n 'd',\n dom.path );\n\n this.groupMarkers.appendChild( dom.dom );\n this.currentMarkersSelectionType = this.selectionType;\n }\n }\n\n getMarkerForLegend() {\n\n if ( !this.markerPoints || !this.markerPoints[ this.selectionType ] ) {\n return;\n }\n\n if ( !this.markerForLegend ) {\n\n var marker = document.createElementNS( this.graph.ns, 'path' );\n this.setMarkerStyleTo( marker, this.markerFamilies[ this.selectionType ][ 0 ] );\n\n marker.setAttribute( 'd', 'M 14 0 ' + this.getMarkerPath( this.markerFamilies[ this.selectionType ][ 0 ] ) );\n\n this.markerForLegend = marker;\n }\n\n return this.markerForLegend;\n }\n\n eraseMarkers() {\n\n var self = this;\n\n if ( this.options.markersIndependant ) {\n\n for ( var i in this.independantMarkers ) {\n self.groupMarkers.removeChild( this.independantMarkers[ i ] );\n }\n\n this.independantMarkers = {};\n\n } else if ( this.currentMarkersSelectionType ) {\n\n this.markersDom.forEach( function( el ) {\n\n if ( !el.dom ) {\n return;\n }\n\n if ( el.dom.parentNode !== self.groupMarkers ) {\n return;\n }\n\n self.groupMarkers.removeChild( el.dom );\n el.path = '';\n } );\n\n this.currentMarkersSelectionType = false;\n }\n\n }\n\n isMonotoneous() {\n if ( this.waveform ) {\n return this.waveform.isMonotoneous();\n }\n\n return !!this.xmonotoneous;\n }\n\n findLocalMinMax( xRef, xWithin, type ) {\n\n if ( !this.waveform ) {\n return false;\n }\n\n return this.waveform.findLocalMinMax( xRef, xWithin, type );\n }\n\n}\n\nfunction drawMarkerXY( graph, family, x, y, markerDom ) {\n\n if ( !family ) {\n return;\n }\n\n if ( graph.options.markersIndependant ) {\n var dom = graph.getMarkerDomIndependent( graph.counter2, family );\n var p = 'M ' + x + ' ' + y + ' ';\n p += family.markerPath + ' ';\n\n dom.setAttribute( 'd', p );\n }\n\n markerDom.path = markerDom.path || '';\n markerDom.path += 'M ' + x + ' ' + y + ' ';\n markerDom.path += family.markerPath + ' ';\n}\n\nutil.mix( SerieLine, ErrorBarMixin );\n\nexport default SerieLine;","var Serie3DMixin = {\n\n /**\n * Returns the x position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The x position in px corresponding to the x value\n */\n getX: function( val ) {\n return ( ( val = this.getXAxis().getPx( val ) ) - val % 0.2 ) + this.getXAxis().getZProj( this.options.zpos );\n },\n\n /**\n * Returns the y position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie3DMixin\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The y position in px corresponding to the y value\n */\n getY: function( val ) {\n return ( ( val = this.getYAxis().getPx( val ) ) - val % 0.2 ) + this.getYAxis().getZProj( this.options.zpos );\n },\n\n getZPos: function() {\n return this.options.zpos;\n },\n\n /**\n * @returns {Number} Lowest x value of the serie's data\n * @memberof Serie\n */\n getMinX: function( useZValues ) {\n if ( !useZValues ) {\n return this.minX;\n }\n\n return getZCorrectedValue( this, true, true );\n },\n\n /**\n * @returns {Number} Highest x value of the serie's data\n * @memberof Serie\n */\n getMaxX: function( useZValues ) {\n\n if ( !useZValues ) {\n return this.maxX;\n }\n return getZCorrectedValue( this, true, false );\n },\n\n /**\n * @returns {Number} Lowest y value of the serie's data\n * @memberof Serie\n */\n getMinY: function( useZValues ) {\n\n if ( !useZValues ) {\n return this.minY;\n }\n return getZCorrectedValue( this, false, true );\n },\n\n /**\n * @returns {Number} Highest y value of the serie's data\n * @memberof Serie\n */\n getMaxY: function( useZValues ) {\n\n if ( !useZValues ) {\n return this.maxY;\n }\n return getZCorrectedValue( this, false, false );\n }\n\n};\n\nfunction getZCorrectedValue( serie, x, min ) {\n\n let i, l, data, val, valFinal;\n let wf = serie.getWaveforms();\n\n for ( let wave of wf ) {\n\n i = 0;\n l = wave.getLength();\n data = wave.getData();\n\n for ( ; i < l; i += 1 ) {\n\n if ( x ) {\n val = serie.getXAxis().getVal( serie.getX( wave.getX( i, true ) ) );\n } else {\n val = serie.getYAxis().getVal( serie.getY( data[ i ] ) );\n }\n\n if ( i == 0 ) {\n valFinal = val;\n } else {\n\n if ( min ) {\n valFinal = Math.min( valFinal, val );\n } else {\n valFinal = Math.max( valFinal, val );\n }\n }\n }\n }\n return valFinal;\n}\n\nexport default Serie3DMixin;","import Graph from '../graph.core.js';\nimport Serie from './graph.serie.line.js';\nimport Waveform from '../util/waveform.js';\nimport Serie3DMixin from '../mixins/graph.mixin.serie3d.js';\nimport * as util from '../graph.util.js';\n\n/**\n * Serie line with 3D projection\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends SerieLine\n */\nclass SerieLine3D extends Serie {\n\n static defaults() {\n return {\n zpos: 0\n };\n }\n constructor( graph, name, options ) {\n super( ...arguments );\n\n }\n\n /**\n * Sets the z-position\n * @memberof SerieLine3D\n * @param {Number} zPos - The position in the z axis\n */\n setZPos( zPos ) {\n this.options.zpos = zPos;\n return this;\n }\n\n setz() {\n return this.setZPos( ...arguments );\n }\n}\n\nutil.mix( SerieLine3D, Serie3DMixin );\nexport default SerieLine3D;","import * as util from '../graph.util.js';\nimport Serie from './graph.serie.line.js';\nimport ErrorBarMixin from '../mixins/graph.mixin.errorbars.js';\n\n/**\n * Represents a bar serie.\n Needs to be used exclusively with a bar axis ({@link AxisXBar}).\n Supports error bars, line color, line width, fill color, fill opacity.\n * @example graph.newSerie(\"serieName\", { fillColor: 'red', fillOpacity: 0.2 }, \"bar\" );\n * @extends Serie\n */\nclass SerieBar extends Serie {\n\n constructor( graph, name, options ) {\n\n super( ...arguments );\n\n this.groupMain = document.createElementNS( this.graph.ns, 'g' );\n\n this.pathDom = document.createElementNS( this.graph.ns, 'path' );\n this.groupMain.appendChild( this.pathDom );\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n lineWidth: this.options.lineWidth,\n fillColor: this.options.fillColor,\n fillOpacity: this.options.fillOpacity,\n markers: this.options.markers\n };\n\n }\n\n /**\n * Sets the data of the bar serie\n * @param {Object} data\n * @example serie.setData( { \"cat1\": val1, \"cat2\": val2, \"cat4\": val4 } );\n * @return {SerieBar} The current serie instance\n */\n setData( data ) {\n\n this.data = data;\n this.minY = Number.MAX_SAFE_INTEGER;\n this.maxY = Number.MIN_SAFE_INTEGER;\n\n for ( var i in this.data ) {\n this._checkY( this.data[ i ] );\n }\n\n return this;\n }\n\n /**\n * Sets the fill color\n */\n setFillColor( fillColor, selectionType, applyToSelected ) {\n\n selectionType = selectionType || 'unselected';\n this.styles[ selectionType ] = this.styles[ selectionType ] || {};\n this.styles[ selectionType ].fillColor = fillColor;\n\n if ( applyToSelected ) {\n this.setFillColor( fillColor, 'selected' );\n }\n\n this.styleHasChanged( selectionType );\n\n return this;\n }\n\n /**\n * Returns the fill color\n */\n getFillColor( selectionType ) {\n return this.getStyle( selectionType ).fillColor;\n }\n\n /*\n * @memberof SerieBar\n */\n setFillOpacity( opacity, selectionType, applyToSelected ) {\n\n selectionType = selectionType || 'unselected';\n this.styles[ selectionType ] = this.styles[ selectionType ] || {};\n this.styles[ selectionType ].fillOpacity = opacity;\n\n if ( applyToSelected ) {\n this.setLineWidth( opacity, 'selected' );\n }\n\n this.styleHasChanged( selectionType );\n\n return this;\n }\n\n getFillOpacity( selectionType ) {\n\n return this.getStyle( selectionType ).fillOpacity || 1;\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n */\n applyLineStyles() {\n this.applyLineStyle( this.pathDom );\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieBar\n */\n applyLineStyle( line ) {\n\n line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute( 'stroke-width', this.getLineWidth() );\n if ( this.getLineDashArray() ) {\n line.setAttribute( 'stroke-dasharray', this.getLineDashArray() );\n } else {\n line.removeAttribute( 'stroke-dasharray' );\n }\n line.setAttribute( 'fill', this.getFillColor() );\n line.setAttribute( 'fill-opacity', this.getFillOpacity() || 1 );\n }\n\n draw() {\n\n var path = '';\n var categoryNumber,\n position;\n\n if ( this.error ) {\n this.errorDrawInit();\n }\n\n for ( var i in this.data ) {\n\n if ( !this.categoryIndices[ i ] ) {\n continue;\n }\n\n path += 'M ' +\n this.getXAxis().getPos( this.categoryIndices[ i ] ) +\n ' ' +\n this.getYAxis().getPos( 0 ) +\n ' V ' +\n this.getYAxis().getPos( this.data[ i ] ) +\n ' h ' +\n this.getXAxis().getDeltaPx( 1 / this.nbCategories ) +\n ' V ' +\n this.getYAxis().getPos( 0 );\n\n if ( this.error ) {\n this.errorAddPointBarChart( i, this.data[ i ], this.getXAxis().getPos( this.categoryIndices[ i ] + 0.5 / this.nbCategories ), this.getYAxis().getPos( this.data[ i ] ) );\n }\n }\n\n if ( this.error ) {\n this.errorDraw();\n }\n\n this.pathDom.setAttribute( 'd', path );\n this.applyLineStyles();\n }\n\n // Markers now allowed\n setMarkers() {}\n\n getUsedCategories() {\n return Object.keys( this.data );\n }\n\n}\n\nexport default SerieBar;","import Serie from './graph.serie.js';\nimport {\n extend,\n guid,\n throwError,\n emptyDom\n}\nfrom '../graph.util.js';\n\n/**\n * @static\n * @extends Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\nclass SerieBox extends Serie {\n\n static\n default () {\n return {\n orientation: 'y',\n maxBoxWidth: 20,\n\n defaultStyle: {\n\n meanLineColor: 'rgb( 100, 0, 0 )',\n meanLineWidth: 2,\n\n boxAboveLineWidth: 1,\n boxAboveLineColor: 'rgb( 0, 0, 0 )',\n boxAboveFillColor: 'transparent',\n boxAboveFillOpacity: 1,\n boxBelowLineWidth: 1,\n boxBelowLineColor: 'rgb( 0, 0, 0 )',\n boxBelowFillColor: 'transparent',\n boxBelowFillOpacity: 1,\n\n barAboveLineColor: 'rgba( 0, 0, 0, 1 )',\n barAboveLineWidth: 1,\n barBelowLineColor: 'rgba( 0, 0, 0, 1 )',\n barBelowLineWidth: 1,\n\n outlierLineWidth: 1,\n outlierLineColor: 'rgb( 255, 255, 255 )',\n outlierFillColor: 'rgb( 0, 0, 0 )',\n outlierFillOpacity: 1\n }\n };\n }\n\n constructor( graph, name, options ) {\n\n super( ...arguments );\n\n this.groupMain = document.createElementNS( this.graph.ns, 'g' );\n\n this.pathDom = document.createElementNS( this.graph.ns, 'path' );\n this.groupMain.appendChild( this.pathDom );\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = this.options.defaultStyle;\n\n }\n\n /**\n * Sets the data of the bar serie\n * @param {Object} data\n * @example serie.setData( [ { x: 'cat', Q2: valMean, Q1: valBoxMin, Q3: valBoxMax, whiskers: [ val1, val2 ], outliers: [ ...yList ] } ] );\n * @return {SerieBar} The current serie instance\n */\n setData( data, noRescale ) {\n\n this.data = data;\n\n if ( !Array.isArray( data ) ) {\n return;\n }\n\n let axisref, axisval, methodref, methodval, blnX;\n\n if ( this.options.orientation == 'y' ) {\n axisref = this.getXAxis();\n axisval = this.getYAxis();\n methodref = this._checkX.bind( this );\n methodval = this._checkY.bind( this );\n blnX = true;\n\n this.minY = data[ 0 ].Q2;\n this.maxY = data[ 0 ].Q2;\n this.maxX = data[ 0 ].x;\n this.minX = data[ 0 ].x;\n\n } else {\n axisref = this.getYAxis();\n axisval = this.getXAxis();\n methodref = this._checkY.bind( this );\n methodval = this._checkX.bind( this );\n blnX = false;\n\n this.minX = data[ 0 ].Q2;\n this.maxX = data[ 0 ].Q2;\n this.maxY = data[ 0 ].y;\n this.minY = data[ 0 ].y;\n\n }\n\n if ( noRescale ) {\n methodref = function() {};\n methodval = function() {};\n }\n\n if ( !axisref || !axisval ) {\n throwError( 'Error in setting data of the box serie. The X and Y axes must be set beforehand' );\n }\n\n for ( var i in this.data ) {\n\n if ( blnX ) {\n methodref( this.data[ i ].x );\n this.data[ i ].pos = this.data[ i ].x;\n } else {\n methodref( this.data[ i ].y );\n this.data[ i ].pos = this.data[ i ].y;\n }\n\n if ( this.data[ i ].Q3 ) {\n\n methodval( this.data[ i ].Q3 );\n\n }\n\n if ( this.data[ i ].Q1 ) {\n methodval( this.data[ i ].Q1 );\n }\n\n if ( this.data[ i ].whiskers ) {\n\n if ( Array.isArray( this.data[ i ].whiskers ) ) {\n\n if ( this.data[ i ].whiskers.length > 0 ) {\n methodval( this.data[ i ].whiskers[ 0 ] );\n }\n\n if ( this.data[ i ].whiskers.length > 1 ) {\n methodval( this.data[ i ].whiskers[ 1 ] );\n }\n\n } else {\n methodval( this.data[ i ].whiskers );\n this.data[ i ].whiskers = [ this.data[ i ].whiskers ];\n }\n\n } else {\n this.data[ i ].whiskers = [];\n }\n\n if ( Array.isArray( this.data[ i ].outliers ) ) {\n this.data[ i ].outliers.map( ( val ) => methodval( val ) );\n } else {\n this.data[ i ].outliers = [];\n }\n }\n\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n _style( type, styleValue, selectionType = 'unselected', applyToSelected = false ) {\n this.styles[ selectionType ] = this.styles[ selectionType ] || {};\n this.styles[ selectionType ][ type ] = styleValue;\n\n if ( applyToSelected ) {\n this._set( type, styleValue, 'selected' );\n }\n\n this.styleHasChanged( selectionType );\n return this;\n }\n\n _gstyle( type, selectionType ) {\n return this.getStyle( selectionType )[ type ];\n }\n\n /**\n * Retrives a selection object\n * @param {String} [ selectionType = \"unselected\" ] - The selection type\n * @returns {Object} The selection object\n */\n getStyle( selectionType = 'unselected' ) {\n\n return this.styles[ selectionType ] || {};\n }\n\n /**\n * Sets the mean line color\n * @param {String} color - The mean line color\n * @returns {SerieBox} The current serie instance\n */\n setMeanLineColor() {\n return this._style( 'meanLineColor', ...arguments );\n }\n\n /**\n * Returns the mean line color\n * @return {String} The mean line color\n */\n getMeanLineColor() {\n return this._gstyle( 'meanLineColor', ...arguments );\n }\n\n setStyle( style, selectionType = 'unselected' ) {\n //console.log( style, selectionType );\n this.styles[ selectionType ] = extend( {}, this.default().defaultStyle, this.styles.unselected, style );\n this.styleHasChanged( selectionType );\n }\n\n /**\n * Sets the mean line width\n * @param {Number} width - The line width\n * @returns {SerieBox} The current serie instance\n */\n setMeanLineWidth() {\n return this._style( 'meanLineWidth', ...arguments );\n }\n\n /**\n * Returns the mean line width\n * @return {Number} The mean line width\n */\n getMeanLineWidth() {\n return this._gstyle( 'meanLineWidth', ...arguments );\n }\n\n /**\n * Sets the box line color\n * @param {Number} color - The color of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveLineColor() {\n return this._style( 'boxAboveLineColor', ...arguments );\n }\n\n /**\n * Returns the box line color\n * @return {String} The line color of the box above the median\n */\n getBoxAboveLineColor() {\n return this._gstyle( 'boxAboveLineColor', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {Number} color - The color of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowLineColor() {\n return this._style( 'boxBelowLineColor', ...arguments );\n }\n\n /**\n * Returns the fill color\n * @return {String} The line color of the box below the median\n */\n getBoxBelowLineColor() {\n return this._gstyle( 'boxBelowLineColor', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The contour width of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveLineWidth() {\n return this._style( 'boxAboveLineWidth', ...arguments );\n }\n\n /**\n * Returns the line width of the box above the median\n * @return {Number} The line width of the box above the median\n */\n getBoxAboveLineWidth() {\n return this._gstyle( 'boxAboveLineWidth', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The contour width of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowLineWidth() {\n return this._style( 'boxBelowLineWidth', ...arguments );\n }\n\n /**\n * Returns the line width of the box below the median\n * @return {Number} The line width of the box below the median\n */\n getBoxBelowLineWidth() {\n return this._gstyle( 'boxBelowLineWidth', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The fill color of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveFillColor() {\n return this._style( 'boxAboveFillColor', ...arguments );\n }\n\n /**\n * Returns the fill color of the box above the median\n * @return {String} The fill color of the box above the median\n */\n getBoxAboveFillColor() {\n return this._gstyle( 'boxAboveFillColor', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The fill color of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowFillColor() {\n return this._style( 'boxBelowFillColor', ...arguments );\n }\n\n /**\n * Returns the fill color of the box below the median\n * @return {String} The fill color of the box below the median\n */\n getBoxBelowFillColor() {\n return this._gstyle( 'boxBelowFillColor', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {Number} opacity - The fill opacity of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveFillOpacity() {\n return this._style( 'boxAboveFillOpacity', ...arguments );\n }\n\n /**\n * Returns the fill opacity of the box above the median\n * @return {Number} The fill opacity of the box above the median\n */\n getBoxAboveFillOpacity() {\n return this._gstyle( 'boxAboveFillOpacity', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {Number} opacity - The fill opacity of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowFillOpacity() {\n return this._style( 'boxBelowFillOpacity', ...arguments );\n }\n\n /**\n * Returns the fill opacity of the box below the median\n * @return {Number} The fill opacity of the box below the median\n */\n getBoxBelowFillOpacity() {\n return this._gstyle( 'boxBelowFillOpacity', ...arguments );\n }\n\n /**\n * Sets the whisker color\n * @param {String} color - The line color of the whisker above the median\n * @returns {SerieBox} The current serie instance\n */\n setBarAboveLineColor() {\n return this._style( 'barAboveLineColor', ...arguments );\n }\n\n /**\n * Returns the line color of the whisker above the median\n * @return {String} The line color of the whisker above the median\n */\n getBarAboveLineColor() {\n return this._gstyle( 'barAboveLineColor', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The line color of the whisker below the median\n * @returns {SerieBox} The current serie instance\n */\n setBarBelowLineColor() {\n return this._style( 'barBelowLineColor', ...arguments );\n }\n\n /**\n * Returns the line color of the whisker below the median\n * @return {String} The line color of the whisker below the median\n */\n getBarBelowLineColor() {\n return this._gstyle( 'barBelowLineColor', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The line width of the whisker above the median\n * @returns {SerieBox} The current serie instance\n */\n setBarAboveLineWidth() {\n return this._style( 'barAboveLineWidth', ...arguments );\n }\n\n /**\n * Returns the line width of the whisker above the median\n * @return {Number} The line width of the whisker above the median\n */\n getBarAboveLineWidth() {\n return this._gstyle( 'barAboveLineWidth', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The line width of the whisker below the median\n * @returns {SerieBox} The current serie instance\n */\n setBarBelowLineWidth() {\n return this._style( 'barBelowLineWidth', ...arguments );\n }\n\n /**\n * Returns the line width of the whisker below the median\n * @return {Number} The line width of the whisker below the median\n */\n getBarBelowLineWidth() {\n return this._gstyle( 'barBelowLineWidth', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The outlier stroke color\n * @returns {SerieBox} The current serie instance\n */\n setOutlierLineColor() {\n return this._style( 'outlierLineColor', ...arguments );\n }\n\n /**\n * Returns the line color of the outliers\n * @return {String} The line color of the outliers\n */\n getOutlierLineColor() {\n return this._gstyle( 'outlierLineColor', ...arguments );\n }\n\n /**\n * Sets the stroke width\n * @param {Number} width - The outlier stroke width\n * @returns {SerieBox} The current serie instance\n */\n setOutlierLineWidth() {\n return this._style( 'outlierLineWidth', ...arguments );\n }\n\n /**\n * Returns the line width of the outliers\n * @return {Number} The line width of the outliers\n */\n getOutlierLineWidth() {\n return this._gstyle( 'outlierLineWidth', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The outlier fill color\n * @returns {SerieBox} The current serie instance\n */\n setOutlierFillColor() {\n return this._style( 'outlierFillColor', ...arguments );\n }\n\n /**\n * Returns the fill color of the outliers\n * @return {String} The fill color of the outliers\n */\n getOutlierFillColor() {\n return this._gstyle( 'outlierFillColor', ...arguments );\n }\n\n /**\n * Sets the outlier fill opacity\n * @param {Number} opacity - The outlier fill opacity\n * @returns {SerieBox} The current serie instance\n */\n setOutlierFillOpacity() {\n return this._style( 'outlierFillOpacity', ...arguments );\n }\n\n /**\n * Returns the fill opacity of the outliers\n * @return {Number} The fill opacity of the outliers\n */\n getOutlierFillOpacity() {\n return this._gstyle( 'outlierFillOpacity', ...arguments );\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n * @returns {SerieBox} The current serie instance\n */\n applyLineStyles() {\n this.applyLineStyle( this.pathDom );\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieBar\n */\n applyLineStyle( line ) {\n\n line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute( 'stroke-width', this.getLineWidth() );\n line.removeAttribute( 'stroke-dasharray' );\n line.setAttribute( 'fill', this.getFillColor() );\n line.setAttribute( 'fill-opacity', this.getFillOpacity() || 1 );\n }\n\n draw() {\n\n if ( !this.data ) {\n return;\n }\n\n let position;\n let axis = this.options.orientation == 'y' ? this.getYAxis() : this.getXAxis();\n let axis2 = this.options.orientation == 'y' ? this.getXAxis() : this.getYAxis();\n let boxOtherDimension; // width or height of the box\n let useCategories = false;\n let mean, boxAbove, boxBelow, barAbove, barBelow, outliers, posAbove, posBelow;\n let categoryNumber;\n\n emptyDom( this.groupMain );\n\n if ( axis2.getType() == 'category' ) {\n\n boxOtherDimension = axis2.getRelPx( 0.8 / ( this.nbCategories ) );\n useCategories = true;\n\n } else {\n // Get all the spacing and determine the smallest one\n boxOtherDimension = this.options.maxBoxWidth;\n // console.log( boxOtherDimension );\n for ( var i = 0, l = this.data.length; i < l - 1; i++ ) {\n\n // console.log( Math.abs( axis.getPx( this.data[ i + 1 ].pos ) - axis.getPx( this.data[ i ].pos ) ), axis.getPx( this.data[ i + 1 ].pos ), axis.getPx( this.data[ i ].pos ) );\n boxOtherDimension = Math.min( boxOtherDimension, Math.abs( axis2.getPx( this.data[ i + 1 ].pos ) - axis2.getPx( this.data[ i ].pos ) ) );\n }\n // console.log( boxOtherDimension );\n }\n\n for ( var i = 0, l = this.data.length; i < l; i++ ) {\n\n if ( axis2.getType() == 'category' ) {\n\n let cat = this.options.orientation == 'y' ? this.data[ i ].x : this.data[ i ].y;\n\n if ( !this.categoryIndices.hasOwnProperty( cat ) ) {\n\n if ( Array.isArray( this._linkedToScatterSeries ) ) {\n for ( let scatter_serie of this._linkedToScatterSeries ) {\n\n if ( scatter_serie.categoryIndices.hasOwnProperty( cat ) ) {\n\n position = [ axis2.getPos( scatter_serie.categoryIndices[ cat ] ) + 1.2 * boxOtherDimension / 2 ];\n\n if ( this.options.orientation == 'y' ) {\n axis = scatter_serie.getYAxis();\n } else {\n axis = scatter_serie.getXAxis();\n }\n\n break;\n }\n }\n }\n } else {\n\n position = [ axis2.getPos( this.categoryIndices[ cat ] ) + 1.2 * boxOtherDimension / 2 ];\n\n }\n\n } else {\n\n position = [ axis2.getPos( this.options.orientation == 'y' ? this.data[ i ].x : this.data[ i ].y ), boxOtherDimension ];\n\n }\n\n mean = axis.getPos( this.data[ i ].Q2 );\n boxAbove = axis.getPos( this.data[ i ].Q3 );\n boxBelow = axis.getPos( this.data[ i ].Q1 );\n\n this.data[ i ].whiskers.map( ( val ) => {\n\n if ( val < this.data[ i ].Q1 ) {\n barBelow = axis.getPos( val );\n } else {\n barAbove = axis.getPos( val );\n }\n } );\n\n outliers = this.data[ i ].outliers.map( ( val ) => axis.getPos( val ) );\n\n var lineMean = document.createElementNS( this.graph.ns, 'line' );\n\n this.applyMeanStyle( lineMean );\n\n var rectAbove = document.createElementNS( this.graph.ns, 'rect' );\n var rectBelow = document.createElementNS( this.graph.ns, 'rect' );\n\n if ( this.options.orientation == 'y' ) {\n\n rectAbove.setAttribute( 'width', boxOtherDimension );\n rectAbove.setAttribute( 'x', position[ 0 ] - boxOtherDimension / 2 );\n\n rectBelow.setAttribute( 'width', boxOtherDimension );\n rectBelow.setAttribute( 'x', position[ 0 ] - boxOtherDimension / 2 );\n\n lineMean.setAttribute( 'x1', position[ 0 ] - boxOtherDimension / 2 );\n lineMean.setAttribute( 'x2', position[ 0 ] + boxOtherDimension / 2 );\n lineMean.setAttribute( 'y1', mean );\n lineMean.setAttribute( 'y2', mean );\n\n } else {\n\n rectAbove.setAttribute( 'height', boxOtherDimension );\n rectAbove.setAttribute( 'y', position[ 0 ] - boxOtherDimension / 2 );\n\n rectBelow.setAttribute( 'height', boxOtherDimension );\n rectBelow.setAttribute( 'y', position[ 0 ] - boxOtherDimension / 2 );\n\n lineMean.setAttribute( 'y1', position[ 0 ] - boxOtherDimension / 2 );\n lineMean.setAttribute( 'y2', position[ 0 ] + boxOtherDimension / 2 );\n lineMean.setAttribute( 'x1', mean );\n lineMean.setAttribute( 'x2', mean );\n }\n\n this.boxPos( rectAbove, mean, boxAbove, this.options.orientation == 'x' );\n this.boxPos( rectBelow, mean, boxBelow, this.options.orientation == 'x' );\n\n this.applyBoxStyle( rectAbove, rectBelow );\n\n var whiskerAbove = document.createElementNS( this.graph.ns, 'line' );\n var whiskerBelow = document.createElementNS( this.graph.ns, 'line' );\n\n if ( this.options.orientation == 'y' ) {\n\n if ( barAbove !== undefined ) {\n whiskerAbove.setAttribute( 'y1', boxAbove );\n whiskerAbove.setAttribute( 'y2', barAbove );\n whiskerAbove.setAttribute( 'x1', position[ 0 ] );\n whiskerAbove.setAttribute( 'x2', position[ 0 ] );\n }\n\n if ( barBelow !== undefined ) {\n whiskerBelow.setAttribute( 'y1', boxBelow );\n whiskerBelow.setAttribute( 'y2', barBelow );\n whiskerBelow.setAttribute( 'x1', position[ 0 ] );\n whiskerBelow.setAttribute( 'x2', position[ 0 ] );\n }\n\n } else {\n\n if ( barAbove !== undefined ) {\n whiskerAbove.setAttribute( 'x1', boxAbove );\n whiskerAbove.setAttribute( 'x2', barAbove );\n whiskerAbove.setAttribute( 'y1', position[ 0 ] );\n whiskerAbove.setAttribute( 'y2', position[ 0 ] );\n }\n\n if ( barBelow !== undefined ) {\n whiskerBelow.setAttribute( 'x1', boxBelow );\n whiskerBelow.setAttribute( 'x2', barBelow );\n whiskerBelow.setAttribute( 'y1', position[ 0 ] );\n whiskerBelow.setAttribute( 'y2', position[ 0 ] );\n }\n }\n\n outliers.map( ( outliervalue ) => {\n\n let outlier = document.createElementNS( this.graph.ns, 'circle' );\n\n outlier.setAttribute( 'r', 2 );\n\n if ( this.options.orientation == 'y' ) {\n\n outlier.setAttribute( 'cx', position[ 0 ] );\n outlier.setAttribute( 'cy', outliervalue );\n\n } else {\n\n outlier.setAttribute( 'cy', position[ 0 ] );\n outlier.setAttribute( 'cx', outliervalue );\n }\n\n this.setOutlierStyle( outlier );\n\n this.groupMain.appendChild( outlier );\n } );\n\n if ( barAbove !== undefined ) {\n this.groupMain.appendChild( whiskerAbove );\n }\n\n if ( barBelow !== undefined ) {\n this.groupMain.appendChild( whiskerBelow );\n }\n\n if ( boxAbove !== undefined ) {\n this.groupMain.appendChild( rectAbove );\n }\n\n if ( boxBelow !== undefined ) {\n this.groupMain.appendChild( rectBelow );\n }\n\n this.groupMain.appendChild( lineMean );\n\n this.applyWhiskerStyle( whiskerAbove, whiskerBelow );\n }\n }\n\n applyBoxStyle( above, below ) {\n\n above.setAttribute( 'stroke', this.getBoxAboveLineColor() );\n above.setAttribute( 'stroke-width', this.getBoxAboveLineWidth() );\n\n if ( this.getBoxAboveFillColor() !== undefined ) {\n above.setAttribute( 'fill', this.getBoxAboveFillColor() );\n }\n if ( this.getBoxAboveFillOpacity() !== undefined ) {\n above.setAttribute( 'fill-opacity', this.getBoxAboveFillOpacity() );\n }\n\n below.setAttribute( 'stroke', this.getBoxBelowLineColor() );\n below.setAttribute( 'stroke-width', this.getBoxBelowLineWidth() );\n\n if ( this.getBoxBelowFillColor() !== undefined ) {\n below.setAttribute( 'fill', this.getBoxBelowFillColor() );\n }\n if ( this.getBoxAboveFillOpacity() !== undefined ) {\n below.setAttribute( 'fill-opacity', this.getBoxBelowFillOpacity() );\n }\n }\n\n applyWhiskerStyle( above, below ) {\n\n above.setAttribute( 'stroke', this.getBarAboveLineColor() );\n above.setAttribute( 'stroke-width', this.getBarAboveLineWidth() );\n\n below.setAttribute( 'stroke', this.getBarBelowLineColor() );\n below.setAttribute( 'stroke-width', this.getBarBelowLineWidth() );\n }\n\n applyMeanStyle( line ) {\n\n line.setAttribute( 'stroke', this.getMeanLineColor() );\n line.setAttribute( 'stroke-width', this.getMeanLineWidth() );\n }\n\n setOutlierStyle( outlier ) {\n\n outlier.setAttribute( 'stroke', this.getOutlierLineColor() );\n outlier.setAttribute( 'stroke-width', this.getOutlierLineWidth() );\n\n if ( this.getBoxBelowFillColor() !== undefined ) {\n outlier.setAttribute( 'fill', this.getOutlierFillColor() );\n }\n if ( this.getBoxAboveFillOpacity() !== undefined ) {\n outlier.setAttribute( 'fill-opacity', this.getOutlierFillOpacity() );\n }\n }\n /**\n * Returns the index of a category based on its name\n * @param {String} name - The name of the category\n */\n getCategoryIndex( name ) {\n\n if ( !this.categories ) {\n throw new Error( 'No categories were defined. Probably axis.setSeries was not called' );\n }\n\n for ( var i = 0; i < this.categories.length; i++ ) {\n\n if ( this.categories[ i ].name == name ) {\n return i;\n }\n }\n\n return false;\n }\n\n // Markers now allowed\n setMarkers() {}\n\n boxPos( box, mean, extremity, blnX ) {\n\n if ( mean > extremity ) {\n\n box.setAttribute( blnX ? 'x' : 'y', extremity );\n box.setAttribute( blnX ? 'width' : 'height', mean - extremity );\n\n } else {\n\n box.setAttribute( blnX ? 'x' : 'y', mean );\n box.setAttribute( blnX ? 'width' : 'height', extremity - mean );\n }\n }\n\n getUsedCategories() {\n let xymode = this.options.orientation == 'y' ? 'x' : 'y';\n\n let categories = this.data.map( ( d ) => d[ xymode ] );\n\n if ( Array.isArray( this._linkedToScatterSeries ) ) {\n this._linkedToScatterSeries.map( ( scatter_serie ) => {\n\n scatter_serie.getUsedCategories().map( ( scatter_serie_cat ) => {\n let index;\n if ( ( index = categories.indexOf( scatter_serie_cat ) ) > -1 ) {\n categories.splice( index, 1 );\n }\n\n } );\n } );\n\n }\n\n return categories;\n }\n\n linkToScatterSerie( ...series ) {\n this._linkedToScatterSeries = series;\n }\n}\n\nexport default SerieBox;","import SerieLine from './graph.serie.line.js';\nimport * as util from '../graph.util.js';\nimport ErrorBarMixin from '../mixins/graph.mixin.errorbars.js';\n\n/**\n * Colored serie line\n * @example graph.newSerie( name, options, \"color\" );\n * @see Graph#newSerie\n * @augments SerieLine\n */\nclass SerieLineColor extends SerieLine {\n\n constructor( graph, name, options ) {\n\n super( ...arguments );\n this.lines = this.lines || {};\n }\n\n setColors( colors ) {\n this.colors = colors;\n }\n\n _draw() {\n\n var self = this,\n data = this._dataToUse,\n toBreak,\n i = 0,\n j,\n k,\n m,\n x,\n y,\n k,\n o,\n lastX = false,\n lastY = false,\n xpx,\n ypx,\n xpx2,\n ypx2,\n xAxis = this.getXAxis(),\n yAxis = this.getYAxis(),\n xMin = xAxis.getCurrentMin(),\n yMin = yAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n yMax = yAxis.getCurrentMax();\n\n // Y crossing\n var yLeftCrossingRatio,\n yLeftCrossing,\n yRightCrossingRatio,\n yRightCrossing,\n xTopCrossingRatio,\n xTopCrossing,\n xBottomCrossingRatio,\n xBottomCrossing;\n\n var incrXFlip = 0;\n var incrYFlip = 1;\n\n var pointOutside = false;\n var lastPointOutside = false;\n var pointOnAxis;\n\n this.eraseLines();\n\n if ( this.isFlipped() ) {\n incrXFlip = 1;\n incrYFlip = 0;\n }\n\n this.currentLine = '';\n m = this.waveform.getLength();\n\n for ( j = 0; j < m; j += 2 ) {\n\n x = this.waveform.getX( j );\n y = this.waveform.getY( j );\n\n if ( ( x < xMin && lastX < xMin ) || ( x > xMax && lastX > xMax ) || ( ( ( y < yMin && lastY < yMin ) || ( y > yMax && lastY > yMax ) ) && !this.options.lineToZero ) ) {\n lastX = x;\n lastY = y;\n lastPointOutside = true;\n continue;\n }\n\n this.counter2 = j;\n\n if ( this.markersShown() ) {\n this.getMarkerCurrentFamily( this.counter2 );\n }\n\n xpx2 = this.getX( x );\n ypx2 = this.getY( y );\n\n if ( xpx2 == xpx && ypx2 == ypx ) {\n continue;\n }\n\n pointOutside = ( x < xMin || y < yMin || x > xMax || y > yMax );\n /*\n if ( this.options.lineToZero ) {\n pointOutside = ( x < xMin || x > xMax );\n\n if ( pointOutside ) {\n continue;\n }\n } else {\n\n if ( pointOutside || lastPointOutside ) {\n\n if ( ( lastX === false || lastY === false ) && !lastPointOutside ) {\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n\n } else {\n\n pointOnAxis = [];\n // Y crossing\n yLeftCrossingRatio = ( x - xMin ) / ( x - lastX );\n yLeftCrossing = y - yLeftCrossingRatio * ( y - lastY );\n yRightCrossingRatio = ( x - xMax ) / ( x - lastX );\n yRightCrossing = y - yRightCrossingRatio * ( y - lastY );\n\n // X crossing\n xTopCrossingRatio = ( y - yMin ) / ( y - lastY );\n xTopCrossing = x - xTopCrossingRatio * ( x - lastX );\n xBottomCrossingRatio = ( y - yMax ) / ( y - lastY );\n xBottomCrossing = x - xBottomCrossingRatio * ( x - lastX );\n\n if ( yLeftCrossingRatio < 1 && yLeftCrossingRatio > 0 && yLeftCrossing !== false && yLeftCrossing < yMax && yLeftCrossing > yMin ) {\n pointOnAxis.push( [ xMin, yLeftCrossing ] );\n }\n\n if ( yRightCrossingRatio < 1 && yRightCrossingRatio > 0 && yRightCrossing !== false && yRightCrossing < yMax && yRightCrossing > yMin ) {\n pointOnAxis.push( [ xMax, yRightCrossing ] );\n }\n\n if ( xTopCrossingRatio < 1 && xTopCrossingRatio > 0 && xTopCrossing !== false && xTopCrossing < xMax && xTopCrossing > xMin ) {\n pointOnAxis.push( [ xTopCrossing, yMin ] );\n }\n\n if ( xBottomCrossingRatio < 1 && xBottomCrossingRatio > 0 && xBottomCrossing !== false && xBottomCrossing < xMax && xBottomCrossing > xMin ) {\n pointOnAxis.push( [ xBottomCrossing, yMax ] );\n }\n\n if ( pointOnAxis.length > 0 ) {\n\n if ( !pointOutside ) { // We were outside and now go inside\n\n if ( pointOnAxis.length > 1 ) {\n console.error( \"Programmation error. Please e-mail me.\" );\n console.log( pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY );\n }\n\n this._createLine();\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n this._addPoint( xpx2, ypx2, lastX, lastY, false, false, true );\n\n } else if ( !lastPointOutside ) { // We were inside and now go outside\n\n if ( pointOnAxis.length > 1 ) {\n console.error( \"Programmation error. Please e-mail me.\" );\n console.log( pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY );\n }\n\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n\n } else {\n\n // No crossing: do nothing\n if ( pointOnAxis.length == 2 ) {\n this._createLine();\n\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n this._addPoint( this.getX( pointOnAxis[ 1 ][ 0 ] ), this.getY( pointOnAxis[ 1 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n }\n\n }\n } else if ( !pointOutside ) {\n this._addPoint( xpx2, ypx2, lastX, lastY, j, false, false );\n }\n }\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n\n lastPointOutside = pointOutside;\n\n continue;\n }\n\n }*/\n\n if ( isNaN( xpx2 ) || isNaN( ypx2 ) ) {\n if ( this.counter > 0 ) {\n\n // this._createLine();\n }\n continue;\n }\n\n var color = this.colors[ j ];\n\n this._addPoint( xpx2, ypx2, x, y, xpx, ypx, lastX, lastY, j, color, false, true );\n\n xpx = xpx2;\n ypx = ypx2;\n\n lastX = x;\n lastY = y;\n }\n\n this.latchLines();\n\n if ( this._tracker ) {\n\n if ( this._trackerDom ) {\n this._trackerDom.remove();\n }\n\n var cloned = this.groupLines.cloneNode( true );\n this.groupMain.appendChild( cloned );\n\n for ( var i = 0, l = cloned.children.length; i < l; i++ ) {\n\n cloned.children[ i ].setAttribute( 'stroke', 'transparent' );\n cloned.children[ i ].setAttribute( 'stroke-width', '25px' );\n cloned.children[ i ].setAttribute( 'pointer-events', 'stroke' );\n }\n\n self._trackerDom = cloned;\n\n self.groupMain.addEventListener( 'mousemove', function( e ) {\n var coords = self.graph._getXY( e ),\n ret = self.handleMouseMove( false, false );\n self._trackingCallback( self, ret, coords.x, coords.y );\n } );\n\n self.groupMain.addEventListener( 'mouseleave', function( e ) {\n self._trackingOutCallback( self );\n } );\n }\n return this;\n\n }\n\n _addPoint( xpx, ypx, x, y, xpxbefore, ypxbefore, xbefore, ybefore, j, color, move, allowMarker ) {\n\n if ( xpxbefore === undefined || ypxbefore === undefined ) {\n return;\n }\n\n if ( isNaN( xpx ) || isNaN( ypx ) ) {\n return;\n }\n\n if ( color._rgb ) {\n color = 'rgba(' + color._rgb[ 0 ] + ',' + color._rgb[ 1 ] + ',' + color._rgb[ 2 ] + ',' + ( color._rgb[ 3 ] || 1 ) + ')';\n }\n\n var line = this.lines[ color ];\n if ( !line ) {\n line = this.lines[ color ] = {\n object: document.createElementNS( this.graph.ns, 'path' ),\n path: '',\n color: color\n };\n line.object.setAttribute( 'stroke', color );\n line.color = color;\n // this.applyLineStyle( line );\n this.groupLines.appendChild( line.object );\n }\n\n line.path += 'M ' + xpxbefore + ' ' + ypxbefore + ' L ' + xpx + ' ' + ypx;\n\n if ( this.hasErrors() ) {\n this.errorAddPoint( j, x, y, xpx, ypx );\n }\n\n /*if ( this.markersShown() && allowMarker !== false ) {\n drawMarkerXY( this, this.markerFamilies[ this.selectionType ][ this.markerCurrentFamily ], xpx, ypx );\n }*/\n }\n\n removeExtraLines() {\n\n }\n\n // Returns the DOM\n latchLines() {\n\n for ( var i in this.lines ) {\n this.lines[ i ].object.setAttribute( 'd', this.lines[ i ].path );\n }\n }\n\n // Returns the DOM\n eraseLines() {\n\n for ( var i in this.lines ) {\n this.lines[ i ].path = '';\n this.lines[ i ].object.setAttribute( 'd', '' );\n }\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyle( line ) {\n\n //line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute( 'stroke-width', this.getLineWidth() );\n if ( this.getLineDashArray() ) {\n line.setAttribute( 'stroke-dasharray', this.getLineDashArray() );\n } else {\n line.removeAttribute( 'stroke-dasharray' );\n }\n line.setAttribute( 'fill', 'none' );\n //\tline.setAttribute('shape-rendering', 'optimizeSpeed');\n }\n}\n\nexport default SerieLineColor;","import Serie from './graph.serie.js';\nimport * as util from '../graph.util.js';\nimport ErrorBarMixin from '../mixins/graph.mixin.errorbars.js';\n\nconst defaults = {};\n\nvar type = 'scatter';\n\n/**\n * @static\n * @augments Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\nclass SerieScatter extends Serie {\n\n constructor( graph, name, options ) {\n\n super( ...arguments );\n this.id = Math.random() + Date.now();\n this.shapes = []; // Stores all shapes\n this.shown = true;\n this.data = [];\n\n this.shapesDetails = [];\n this.shapes = [];\n\n this._type = type;\n\n util.mapEventEmission( this.options, this );\n\n this._isMinOrMax = {\n x: {\n min: false,\n max: false\n },\n y: {\n min: false,\n max: false\n }\n };\n\n this.groupPoints = document.createElementNS( this.graph.ns, 'g' );\n this.groupMain = document.createElementNS( this.graph.ns, 'g' );\n\n this.additionalData = {};\n\n this.selectedStyleGeneral = {};\n this.selectedStyleModifiers = {};\n\n this.groupPoints.addEventListener( 'mouseover', ( e ) => {\n var id = parseInt( e.target.parentElement.getAttribute( 'data-shapeid' ) );\n this.emit( 'mouseover', id, this.waveform.getX( id ), this.waveform.getY( id ) );\n } );\n\n this.groupPoints.addEventListener( 'mouseout', ( e ) => {\n var id = parseInt( e.target.parentElement.getAttribute( 'data-shapeid' ) );\n this.emit( 'mouseout', id, this.waveform.getX( id ), this.waveform.getY( id ) );\n } );\n\n this.minX = Number.MAX_VALUE;\n this.minY = Number.MAX_VALUE;\n this.maxX = Number.MIN_VALUE;\n this.maxY = Number.MIN_VALUE;\n\n this.groupMain.appendChild( this.groupPoints );\n this.currentAction = false;\n\n if ( this.initExtended1 ) {\n this.initExtended1();\n }\n\n this.styles = {};\n this.styles.unselected = {};\n this.styles.selected = {};\n\n this.styles.unselected.default = {\n shape: 'circle',\n cx: 0,\n cy: 0,\n r: 3,\n stroke: 'transparent',\n fill: 'black'\n };\n\n this.styles.selected.default = {\n shape: 'circle',\n cx: 0,\n cy: 0,\n r: 4,\n stroke: 'transparent',\n fill: 'black'\n };\n\n }\n\n /**\n * Applies for x as the category axis\n * @example serie.setDataCategory( { x: \"someName\", y: Waveform } );\n */\n setDataCategory( data ) {\n\n let minY = +Infinity;\n let maxY = -Infinity;\n\n for ( let dataCategory of data ) {\n\n this._checkY( dataCategory.y.getMaxY() );\n this._checkY( dataCategory.y.getMinY() );\n\n }\n\n this.data = data;\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n return this;\n }\n\n /**\n * Removes all DOM points\n * @private\n */\n empty() {\n\n while ( this.groupPoints.firstChild ) {\n this.groupPoints.removeChild( this.groupPoints.firstChild );\n }\n }\n\n getSymbolForLegend() {\n\n if ( this.symbol ) {\n return this.symbol;\n }\n\n var g = document.createElementNS( this.graph.ns, 'g' );\n g.setAttribute( 'data-shapeid', -1 );\n var shape = this.doShape( g, this.styles.unselected.default );\n\n var style = this.getStyle( 'unselected', -1, true );\n\n for ( var i in style[ -1 ] ) {\n if ( i == 'shape' ) {\n continue;\n }\n shape.setAttribute( i, style[ -1 ][ i ] );\n }\n\n return g;\n\n }\n\n /**\n * Sets style to the scatter points\n * First argument is the style applied by default to all points\n * Second argument is an array of modifiers that allows customization of any point of the scatter plot. Data for each elements of the array will augment allStyles, so be sure to reset the style if needed.\n * All parameters - except shape - will be set as parameters to the DOM element of the shape\n *\n * @example\n * var modifiers = [];\n * modifiers[ 20 ] = { shape: 'circle', r: 12, fill: 'rgba(0, 100, 255, 0.3)', stroke: 'rgb(0, 150, 255)' };\n * serie.setStyle( { shape: 'circle', r: 2, fill: 'rgba(255, 0, 0, 0.3)', stroke: 'rgb(255, 100, 0)' }, modifiers ); // Will modify scatter point n°20\n *\n * @param {Object} allStyles - The general style for all markers\n * @param {Object} [ modifiers ] - The general style for all markers\n * @param {String} [ selectionMode=\"unselected\" ] - The selection mode to which this style corresponds. Default is unselected\n *\n */\n setStyle( all, modifiers, mode = 'unselected' ) {\n\n if ( typeof modifiers == 'string' ) {\n mode = modifiers;\n modifiers = false;\n }\n\n /*\n if( ! this.styles[ mode ] ) {\n\n }\n\n if ( mode !== \"selected\" && mode !== \"unselected\" ) {\n throw \"Style mode is not correct. Should be selected or unselected\";\n }\n*/\n\n this.styles[ mode ] = this.styles[ mode ] || {};\n this.styles[ mode ].all = all;\n this.styles[ mode ].modifiers = modifiers;\n\n this.styleHasChanged( mode );\n\n return this;\n }\n\n /**\n * Redraws the serie\n * @private\n * @param {force} Boolean - Forces redraw even if the data hasn't changed\n */\n draw( force ) { // Serie redrawing\n\n if ( !force && !this.hasDataChanged() && !this.hasStyleChanged( 'unselected' ) ) {\n return;\n }\n\n var x,\n y,\n xpx,\n ypx,\n j = 0,\n k,\n m,\n currentLine,\n max;\n\n var isCategory = this.getXAxis().getType() == 'category';\n\n this._drawn = true;\n\n this.dataHasChanged( false );\n this.styleHasChanged( false );\n this.groupMain.removeChild( this.groupPoints );\n\n var keys = [];\n\n j = 0;\n k = 0;\n\n if ( this.hasErrors() ) {\n this.errorDrawInit();\n }\n\n if ( isCategory ) {\n\n let k = 0;\n\n for ( ; j < this.data.length; j++ ) {\n\n if ( !this.categoryIndices.hasOwnProperty( this.data[ j ].x ) ) {\n continue;\n }\n\n if ( this.error ) {\n // this.errorAddPoint( j, position[ 0 ] + position[ 1 ] / 2, 0, this.getX( position[ 0 ] + position[ 1 ] / 2 ), ypx );\n }\n\n for ( var n = 0, l = this.data[ j ].y.getLength(); n < l; n++ ) {\n\n //let xpos = i / ( l - 1 ) * ( position[ 1 ] ) + position[ 0 ];\n\n ypx = this.getY( this.data[ j ].y.getY( n ) );\n xpx = this.getX( n / ( l - 1 ) * ( 0.8 / this.nbCategories ) + this.categoryIndices[ this.data[ j ].x ] + 0.1 / this.nbCategories );\n n++;\n\n this.shapesDetails[ k ] = this.shapesDetails[ k ] || [];\n this.shapesDetails[ k ][ 0 ] = xpx;\n this.shapesDetails[ k ][ 1 ] = ypx;\n keys.push( k );\n k++;\n }\n }\n } else {\n\n for ( ; j < this.waveform.getLength(); j++ ) {\n\n if (\n this.waveform.getX( j ) < this.getXAxis().getCurrentMin() ||\n this.waveform.getX( j ) > this.getXAxis().getCurrentMax() ||\n this.waveform.getY( j ) < this.getYAxis().getCurrentMin() ||\n this.waveform.getY( j ) > this.getYAxis().getCurrentMax()\n ) {\n\n if ( this.shapes[ j ] ) {\n this.shapes[ j ].setAttribute( 'display', 'none' );\n }\n continue;\n }\n\n if ( this.shapes[ j ] ) {\n this.shapes[ j ].setAttribute( 'display', 'initial' );\n }\n\n xpx = this.getX( this.waveform.getX( j ) );\n ypx = this.getY( this.waveform.getY( j ) );\n\n if ( this.hasErrors() ) {\n this.errorAddPoint( j, this.waveform.getX( j ), this.waveform.getY( j ), xpx, ypx );\n }\n\n this.shapesDetails[ j ] = this.shapesDetails[ j ] || [];\n this.shapesDetails[ j ][ 0 ] = xpx;\n this.shapesDetails[ j ][ 1 ] = ypx;\n keys.push( j );\n\n //this.shapes[ j / 2 ] = this.shapes[ j / 2 ] || undefined;\n }\n }\n\n if ( this.hasErrors() ) {\n this.errorDraw();\n }\n\n // This will automatically create the shapes\n this.applyStyle( 'unselected', keys );\n\n this.groupMain.appendChild( this.groupPoints );\n }\n\n _addPoint( xpx, ypx, k ) {\n\n let shape;\n let g = document.createElementNS( this.graph.ns, 'g' );\n g.setAttribute( 'transform', 'translate(' + xpx + ', ' + ypx + ')' );\n g.setAttribute( 'data-shapeid', k );\n\n if ( this.extraStyle && this.extraStyle[ k ] ) {\n\n shape = this.doShape( g, this.extraStyle[ k ] );\n\n } else if ( this.stdStylePerso ) {\n\n shape = this.doShape( g, this.stdStylePerso );\n\n } else {\n\n shape = this.doShape( g, this.stdStyle );\n }\n\n this.shapes[ k ] = shape;\n this.groupPoints.appendChild( g );\n }\n\n doShape( group, shape ) {\n var el = document.createElementNS( this.graph.ns, shape.shape );\n group.appendChild( el );\n return el;\n }\n\n getStyle( selection, index, noSetPosition ) {\n\n var selection = selection || 'unselected';\n var indices;\n\n var styles = {};\n\n if ( typeof index == 'number' ) {\n indices = [ index ];\n } else if ( Array.isArray( index ) ) {\n indices = index;\n }\n\n var shape, index, modifier, style, j; // loop variables\n var styleAll;\n\n if ( this.styles[ selection ].all !== undefined ) {\n\n styleAll = this.styles[ selection ].all;\n\n if ( typeof styleAll == 'function' ) {\n\n styleAll = styleAll();\n\n } else if ( styleAll === false ) {\n\n styleAll = {};\n\n }\n }\n\n var i = 0,\n l = indices.length;\n\n for ( ; i < l; i++ ) {\n\n index = indices[ i ];\n shape = this.shapes[ index ];\n\n if ( ( modifier = this.styles[ selection ].modifiers ) && ( typeof modifier == 'function' || modifier[ index ] ) ) {\n\n if ( typeof modifier == 'function' ) {\n\n style = modifier( index, shape );\n\n } else if ( modifier[ index ] ) {\n\n style = modifier[ index ];\n\n }\n\n styles[ index ] = Object.assign( {}, styleAll, style );\n\n } else if ( styleAll !== undefined ) {\n\n styles[ index ] = styleAll;\n\n } else {\n\n styles[ index ] = this.styles[ selection ].default;\n\n }\n\n if ( !styles[ index ] ) {\n styles[ index ] = styleAll;\n }\n\n if ( !shape ) { // Shape doesn't exist, let's create it\n\n if ( !styles[ index ].shape ) {\n console.error( style );\n throw 'No shape was defined with this style.';\n }\n\n var g = document.createElementNS( this.graph.ns, 'g' );\n g.setAttribute( 'data-shapeid', index );\n this.shapes[ index ] = this.doShape( g, styles[ index ] );\n this.groupPoints.appendChild( g );\n shape = this.shapes[ index ];\n }\n\n if ( !noSetPosition ) {\n shape.parentNode.setAttribute( 'transform', 'translate(' + this.shapesDetails[ index ][ 0 ] + ', ' + this.shapesDetails[ index ][ 1 ] + ')' );\n }\n\n }\n\n return styles;\n }\n\n applyStyle( selection, index, noSetPosition ) {\n\n var i, j;\n var styles = this.getStyle( selection, index, noSetPosition );\n\n for ( i in styles ) {\n\n for ( j in styles[ i ] ) {\n\n if ( j !== 'shape' ) {\n\n if ( styles[ i ][ j ] ) {\n\n this.shapes[ i ].setAttribute( j, styles[ i ][ j ] );\n\n } else {\n\n this.shapes[ i ].removeAttribute( j );\n\n }\n\n }\n\n }\n\n }\n\n }\n\n unselectPoint( index ) {\n this.selectPoint( index, false );\n }\n\n selectPoint( index, setOn, selectionType ) {\n\n if ( this.shapesDetails[ index ][ 2 ] && this.shapesDetails[ index ][ 2 ] == selectionType ) {\n return;\n }\n\n if ( typeof setOn == 'string' ) {\n selectionType = setOn;\n setOn = undefined;\n }\n\n if ( Array.isArray( index ) ) {\n return this.selectPoints( index );\n }\n\n if ( this.shapes[ index ] && this.shapesDetails[ index ] ) {\n\n if ( ( this.shapesDetails[ index ][ 2 ] || setOn === false ) && setOn !== true ) {\n\n var selectionStyle = this.shapesDetails[ index ][ 2 ];\n this.shapesDetails[ index ][ 2 ] = false;\n\n var allStyles = this.getStyle( selectionStyle, index, true );\n for ( var i in allStyles[ index ] ) {\n this.shapes[ index ].removeAttribute( i );\n }\n\n this.applyStyle( 'unselected', index, true );\n\n } else {\n\n selectionType = selectionType || 'selected';\n this.shapesDetails[ index ][ 2 ] = selectionType;\n\n this.applyStyle( selectionType, index, true );\n\n }\n\n }\n\n }\n\n getUsedCategories() {\n\n if ( typeof this.data[ 0 ] == 'object' ) {\n return this.data.map( ( d ) => d.x );\n }\n\n return [];\n }\n\n}\n\nutil.mix( SerieScatter, ErrorBarMixin );\n\nexport default SerieScatter;","import Serie from './graph.serie.js';\nimport Waveform from '../util/waveform.js';\nimport {\n extend,\n guid\n} from '../graph.util.js';\n\n/**\n * @static\n * @extends Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\nclass SerieZone extends Serie {\n\n static\n default () {\n return {\n fillColor: 'rgba( 0, 0, 0, 0.1 )',\n lineColor: 'rgba( 0, 0, 0, 1 )',\n lineWidth: '1px'\n };\n }\n constructor( graph, name, options ) {\n super( ...arguments );\n\n this.selectionType = 'unselected';\n this.id = guid();\n\n this.groupZones = document.createElementNS( this.graph.ns, 'g' );\n this.groupMain = document.createElementNS( this.graph.ns, 'g' );\n this.lineZone = document.createElementNS( this.graph.ns, 'path' );\n this.lineZone.setAttribute( 'stroke', 'black' );\n this.lineZone.setAttribute( 'stroke-width', '1px' );\n\n this.groupMain.appendChild( this.groupZones );\n this.groupZones.appendChild( this.lineZone );\n\n this.applyLineStyle( this.lineZone );\n this.styleHasChanged();\n\n this.clip = document.createElementNS( this.graph.ns, 'clipPath' );\n this.clipId = guid();\n this.clip.setAttribute( 'id', this.clipId );\n\n this.graph.defs.appendChild( this.clip );\n\n }\n\n /**\n * Assigns a collection of waveforms that make up the zone\n * The waveforms will appended one after the other, without break\n * @param {...Waveform} waveforms - The collection of waveforms\n * @return {SerieZone} - The current serie zone instance\n * @memberof SerieZone\n */\n setWaveform( ...waveforms ) {\n this.waveforms = waveforms;\n\n this.waveforms = this.waveforms.map( ( wave ) => {\n\n if ( !( wave instanceof Waveform ) ) {\n return new Waveform( wave );\n } else {\n return wave;\n }\n } );\n\n this.minX = this.waveforms[ 0 ].getXMin();\n this.maxX = this.waveforms[ 0 ].getXMax();\n this.minY = this.waveforms[ 0 ].getMin();\n this.maxY = this.waveforms[ 0 ].getMax();\n\n this.waveforms.map( ( wave ) => {\n\n this.minX = Math.min( wave.getXMin(), this.minX );\n this.maxX = Math.max( wave.getXMin(), this.maxX );\n this.minY = Math.min( wave.getMin(), this.minY );\n this.maxY = Math.max( wave.getMax(), this.maxY );\n } );\n\n this.graph.updateDataMinMaxAxes();\n this.dataHasChanged();\n return this;\n }\n\n setWaveforms() {\n return this.setWaveform( ...arguments );\n }\n\n getWaveforms() {\n return this.waveforms;\n }\n\n setMinMaxWaveforms( min, max ) {\n this.waveforms = [ min, max.reverse() ];\n return this;\n }\n\n /**\n * Removes all the dom concerning this serie from the drawing zone\n */\n empty() {\n\n while ( this.group.firstChild ) {\n this.group.removeChild( this.group.firstChild );\n }\n }\n\n /**\n * Redraws the serie\n * @private\n *\n * @param {force} Boolean - Forces redraw even if the data hasn't changed\n */\n draw( force ) { // Serie redrawing\n\n if ( force || this.hasDataChanged() ) {\n\n if ( !this.waveforms ) {\n return;\n }\n\n let\n dataX = 0,\n dataY = 0,\n xpx = 0,\n ypx = 0,\n j = 0,\n line = '',\n buffer,\n move = false;\n\n const xminpx = this.getXAxis().getMinPx(),\n xmaxpx = this.getXAxis().getMaxPx(),\n yminpx = this.getYAxis().getMinPx(),\n ymaxpx = this.getYAxis().getMaxPx();\n\n const xmin = this.getXAxis().getCurrentMin(),\n xmax = this.getXAxis().getCurrentMax(),\n ymin = this.getYAxis().getCurrentMin(),\n ymax = this.getYAxis().getCurrentMax();\n\n //this.clipRect.setAttribute( \"x\", Math.min( xmin, xmax ) );\n //this.clipRect.setAttribute( \"y\", Math.min( ymin, ymax ) );\n //this.clipRect.setAttribute( \"width\", Math.abs( xmax - xmin ) );\n //this.clipRect.setAttribute( \"height\", Math.abs( ymax - ymin ) );\n\n this.groupMain.removeChild( this.groupZones );\n\n for ( let waveform of this.waveforms ) {\n\n for ( j = 0; j < waveform.getLength(); j += 1 ) {\n dataX = waveform.getX( j, true );\n dataY = waveform.getY( j, true );\n\n // The y axis in screen coordinate is inverted vs cartesians\n if ( dataY[ j ] < ymin ) {\n ypx = this.getY( ymin );\n } else if ( dataY[ j ] > ymax ) {\n ypx = this.getY( ymax );\n }\n\n if ( dataX !== dataX ) {\n continue;\n }\n\n if ( dataY !== dataY ) {\n // Let's make a new line\n\n if ( line.length == 0 ) {\n continue;\n }\n\n line += 'L ' + xpx + ', ' + this.getY( waveform.getMinY() );\n move = true;\n continue;\n }\n\n ypx = this.getY( dataY );\n xpx = this.getX( dataX );\n\n if ( dataX < xmin || dataX > xmax ) {\n buffer = [ dataX, dataY[ j ], xpx, ypx ];\n continue;\n }\n\n if ( move ) {\n line += ' M ' + xpx + ', ' + this.getY( waveform.getMinY() ) + ' ';\n move = false;\n }\n\n if ( line.length > 0 ) {\n line += ' L ';\n }\n\n if ( buffer ) {\n line += buffer[ 2 ] + ',' + buffer[ 3 ] + ' ';\n buffer = false;\n } else {\n line += xpx + ',' + ypx + ' ';\n }\n }\n }\n\n if ( line !== '' ) {\n this.lineZone.setAttribute( 'd', 'M ' + line + ' z' );\n } else {\n this.lineZone.setAttribute( 'd', '' );\n }\n this.groupMain.appendChild( this.groupZones );\n }\n\n if ( this.hasStyleChanged( this.selectionType ) ) {\n this.applyLineStyle( this.lineZone );\n this.styleHasChanged( false );\n }\n\n }\n\n /**\n * Applies the computed style to the DOM element fed as a parameter\n * @private\n *\n * @param {SVGLineElement} line - The line to which the style has to be applied to\n */\n applyLineStyle( line ) {\n\n line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute( 'stroke-width', this.getLineWidth() );\n line.setAttribute( 'fill', this.getFillColor() );\n line.setAttribute( 'fill-opacity', this.getFillOpacity() );\n line.setAttribute( 'stroke-opacity', this.getLineOpacity() );\n }\n\n /**\n * Sets the line width\n *\n * @param {Number} width - The line width\n * @returns {SerieZone} - The current serie\n */\n setLineWidth( width ) {\n this.options.lineWidth = width;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line width\n *\n * @returns {Number} - The line width\n */\n getLineWidth() {\n return this.options.lineWidth;\n }\n\n /**\n * Sets the line opacity\n *\n * @param {Number} opacity - The line opacity\n * @returns {SerieZone} - The current serie\n */\n setLineOpacity( opacity ) {\n this.options.lineOpacity = opacity;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line opacity\n *\n * @returns {Number} - The line opacity\n */\n getLineOpacity() {\n return this.options.lineOpacity;\n }\n\n /**\n * Sets the line color\n *\n * @param {String} color - The line color\n * @returns {SerieZone} - The current serie\n */\n setLineColor( color ) {\n this.options.lineColor = color;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line width\n *\n * @returns {Number} - The line width\n */\n getLineColor() {\n return this.options.lineColor;\n }\n\n /**\n * Sets the fill opacity\n *\n * @param {Number} opacity - The fill opacity\n * @returns {SerieZone} - The current serie\n */\n setFillOpacity( opacity ) {\n this.options.fillOpacity = opacity;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the fill opacity\n *\n * @returns {Number} - The fill opacity\n */\n getFillOpacity() {\n return this.options.fillOpacity;\n }\n\n /**\n * Sets the fill color\n *\n * @param {Number} width - The line width\n * @returns {Number} - The line width\n */\n setFillColor( color ) {\n this.options.fillColor = color;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the fill color\n *\n * @returns {Number} - The fill color\n */\n getFillColor() {\n return this.options.fillColor;\n }\n\n}\n\nexport default SerieZone;","import Graph from '../graph.core.js';\nimport Serie from './graph.serie.zone.js';\nimport Waveform from '../util/waveform.js';\nimport Serie3DMixin from '../mixins/graph.mixin.serie3d.js';\nimport * as util from '../graph.util.js';\n\n/**\n * Serie line with 3D projection\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends SerieLine\n */\nclass SerieZone3D extends Serie {\n\n static\n default () {\n return {\n zpos: 0\n };\n }\n constructor( graph, name, options ) {\n super( ...arguments );\n }\n\n /**\n * Sets the z-position\n * @memberof SerieZone3D\n * @param {Number} zPos - The position in the z axis\n */\n setZPos( zPos ) {\n this.options.zpos = zPos;\n return this;\n }\n\n setz() {\n return this.setZPos( ...arguments );\n }\n}\n\nutil.mix( SerieZone3D, Serie3DMixin );\nexport default SerieZone3D;","import Serie from './graph.serie.js';\nimport * as util from '../graph.util.js';\n\n/**\n * Density map serie\n * @example graph.newSerie( name, options, \"densitymap\" );\n * @see Graph#newSerie\n * @augments Serie\n */\nclass SerieDensityMap extends Serie {\n\n constructor( graph, name, options ) {\n\n super( ...arguments );\n util.mapEventEmission( this.options, this ); // Register events\n\n this.groupMain = document.createElementNS( this.graph.ns, 'g' );\n\n this.rects = [];\n this.paths = [];\n\n this.recalculateBinsOnDraw = false;\n }\n /**\n * Sets the data of the serie. Careful, only one format allowed for now.\n * @memberof SerieDensityMap\n * @param {Array} data - A vector containing 2-elements arrays\n * @return {SerieDensityMap} The current instance\n * @example serie.setData( [ [ x1, y1 ], [ x2, y2 ], ..., [ xn, yn ] ] );\n */\n setData( data ) {\n\n this.minX = this.maxX = this.minY = this.maxY = 0;\n var i = 0,\n l = data.length;\n this.data = data;\n\n this.minX = Number.POSITIVE_INFINITY;\n this.minY = Number.POSITIVE_INFINITY;\n this.maxX = Number.NEGATIVE_INFINITY;\n this.maxY = Number.NEGATIVE_INFINITY;\n\n for ( i = 0; i < l; i++ ) {\n this._checkX( data[ i ][ 0 ] );\n this._checkY( data[ i ][ 1 ] );\n }\n\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n\n return this;\n\n }\n\n /**\n * Calculates the bins from the (x,y) dataset\n * @memberof SerieDensityMap\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} numX - The number of x bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @param {Number} numY - The number of y bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n calculateDensity( fromX, deltaX, numX, fromY, deltaY, numY ) {\n\n var densitymap = [],\n i,\n l = this.data.length,\n indexX, indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n for ( i = 0; i < l; i++ ) {\n indexX = ~~( ( this.data[ i ][ 0 ] - fromX ) / deltaX );\n indexY = ~~( ( this.data[ i ][ 1 ] - fromY ) / deltaY );\n\n if ( indexX > numX || indexY > numY || indexX < 0 || indexY < 0 ) {\n continue;\n }\n\n densitymap[ indexX ] = densitymap[ indexX ] || [];\n densitymap[ indexX ][ indexY ] = densitymap[ indexX ][ indexY ] + 1 || 1;\n\n binMin = densitymap[ indexX ][ indexY ] < binMin ? densitymap[ indexX ][ indexY ] : binMin;\n binMax = densitymap[ indexX ][ indexY ] > binMax ? densitymap[ indexX ][ indexY ] : binMax;\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = numX;\n this.maxIndexY = numY;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = numX;\n this.numY = numY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Sets the density map from a precalculated data set\n * @memberof SerieDensityMap\n * @param {Array} densitymap - A 2D-array containing the map\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n setDensityMap( densitymap, fromX, deltaX, numX, fromY, deltaY, numY ) {\n\n var i,\n j,\n l = this.data.length,\n indexX, indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n for ( i = 0; i < densitymap.length; i++ ) {\n\n for ( j = 0; j < densitymap[ i ].length; j++ ) {\n binMin = densitymap[ i ][ j ] < binMin ? densitymap[ i ][ j ] : binMin;\n binMax = densitymap[ i ][ j ] > binMax ? densitymap[ i ][ j ] : binMax;\n }\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = densitymap.length;\n this.maxIndexY = densitymap[ 0 ].length;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = this.maxIndexX;\n this.numY = this.maxIndexY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Calculates the bins from the (x,y) dataset using bin weighing\n * Will assign a set of (x,y) to the 4 neighbouring bins according to its exact position\n * @memberof SerieDensityMap\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} numX - The number of x bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @param {Number} numY - The number of y bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n calculateDensityWeighted( fromX, deltaX, numX, fromY, deltaY, numY ) {\n\n var densitymap = [],\n i,\n l = this.data.length,\n indexX, indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n var compX, compY;\n var exactX, exactY;\n var indexXLow, indexXHigh, indexYLow, indexYHigh;\n\n for ( i = 0; i < l; i++ ) {\n exactX = ( ( this.data[ i ][ 0 ] - fromX ) / deltaX ) - 0.5;\n exactY = ( ( this.data[ i ][ 1 ] - fromY ) / deltaY ) - 0.5;\n\n indexX = Math.floor( exactX );\n indexY = Math.floor( exactY );\n\n indexXLow = indexX; //Math.floor( exactX );\n indexYLow = indexY; //Math.floor( exactY );\n\n indexXHigh = indexX + 1; //Math.ceil( exactX );\n indexYHigh = indexY + 1; //Math.ceil( exactY );\n\n compX = ( 1 - ( exactX - indexX ) );\n compY = ( 1 - ( exactY - indexY ) );\n\n //console.log( exactY, indexY );\n //console.log( compY, indexYLow, indexYHigh );\n if ( indexX > numX || indexY > numY || indexX < 0 || indexY < 0 ) {\n continue;\n }\n\n densitymap[ indexXLow ] = densitymap[ indexXLow ] || [];\n densitymap[ indexXHigh ] = densitymap[ indexXHigh ] || [];\n\n densitymap[ indexXLow ][ indexYLow ] = densitymap[ indexXLow ][ indexYLow ] || 0;\n densitymap[ indexXHigh ][ indexYLow ] = densitymap[ indexXHigh ][ indexYLow ] || 0;\n densitymap[ indexXLow ][ indexYHigh ] = densitymap[ indexXLow ][ indexYHigh ] || 0;\n densitymap[ indexXHigh ][ indexYHigh ] = densitymap[ indexXHigh ][ indexYHigh ] || 0;\n\n densitymap[ indexXLow ][ indexYLow ] += compX * compY;\n densitymap[ indexXHigh ][ indexYLow ] += ( 1 - compX ) * compY;\n densitymap[ indexXLow ][ indexYHigh ] += compX * ( 1 - compY );\n densitymap[ indexXHigh ][ indexYHigh ] += ( 1 - compX ) * ( 1 - compY );\n\n // A loop would be nicer, but would it be faster ?\n binMin = densitymap[ indexXLow ][ indexYLow ] < binMin ? densitymap[ indexXLow ][ indexYLow ] : binMin;\n binMax = densitymap[ indexXLow ][ indexYLow ] > binMax ? densitymap[ indexXLow ][ indexYLow ] : binMax;\n binMin = densitymap[ indexXHigh ][ indexYLow ] < binMin ? densitymap[ indexXHigh ][ indexYLow ] : binMin;\n binMax = densitymap[ indexXHigh ][ indexYLow ] > binMax ? densitymap[ indexXHigh ][ indexYLow ] : binMax;\n binMin = densitymap[ indexXLow ][ indexYHigh ] < binMin ? densitymap[ indexXLow ][ indexYHigh ] : binMin;\n binMax = densitymap[ indexXLow ][ indexYHigh ] > binMax ? densitymap[ indexXLow ][ indexYHigh ] : binMax;\n binMin = densitymap[ indexXHigh ][ indexYHigh ] < binMin ? densitymap[ indexXHigh ][ indexYHigh ] : binMin;\n binMax = densitymap[ indexXHigh ][ indexYHigh ] > binMax ? densitymap[ indexXHigh ][ indexYHigh ] : binMax;\n\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = numX;\n this.maxIndexY = numY;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = numX;\n this.numY = numY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Calculates the density map based on the minimum and maximum values found in the data array\n * @memberof SerieDensityMap\n * @param {Number} [ numX = 400 ] - The number of x bins\n * @param {Number} [ numY = numX ] - The number of y bins\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n autoBins( numX, numY ) {\n\n this.numX = numX || 400;\n this.numY = numY || this.numX;\n\n this.calculateDensity(\n this.minX, ( this.maxX - this.minX ) / numX, numX,\n this.minY, ( this.maxY - this.minY ) / numY, numY\n );\n\n this.recalculateBinsOnDraw = false;\n\n return this;\n }\n\n /**\n * Only calculates the density map upon redraw based on the current state of the graph. In this mode, a fixed number of pixels per bin is used to calculate the number of bins and fed into\n * the calculation of the density map. In this method, the color map spans on the full scale of the density map values (i.e. a subrange cannot be defined, like you would do using {@link SerieDensityMap#setColorMapBinBoundaries}).\n * @memberof SerieDensityMap\n * @param {Number} pxPerBinX - The number of x bins per pixels. Should be an integer, but technically it doesn't have to\n * @param {Number} pxPerBinY - The number of y bins per pixels. Should be an integer, but technically it doesn't have to\n * @param {Boolean} weightedDensityMap - Whether jsGraph should use weighted density mapping or not\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n setPxPerBin( pxPerBinX, pxPerBinY, weightedDensityMap ) {\n\n if ( pxPerBinX ) {\n this.calculationDensityMap( {\n from: 'min',\n to: 'max',\n pxPerBin: pxPerBinX,\n weighted: weightedDensityMap\n } );\n }\n\n if ( pxPerBinY ) {\n this.calculationDensityMap( false, {\n from: 'min',\n to: 'max',\n pxPerBin: pxPerBinY,\n weighted: weightedDensityMap\n } );\n }\n\n return this;\n }\n\n /**\n * Sets bins in the ```x``` or ```y``` direction based on a from value, a to value and a number of bins.\n * @memberof SerieDensityMap\n * @param {String} mode - ```x``` or ```y```\n * @param {Number} from - The from value of the bin for the calculation with ```calculateDensityMap```\n * @param {Number} to - The to value\n * @param {Number} num - The number of bins\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n setBinsFromTo( mode, from, to, num ) {\n\n this.densityMapCalculation = this.densityMapCalculation || {};\n\n this.densityMapCalculation[ mode ] = {\n from: from,\n to: to,\n numBins: num\n };\n this.calculationDensityMap();\n return this;\n }\n\n calculationDensityMap( x, y ) {\n\n this.method = this.calculateDensityAdvanced;\n this.densityMapCalculation = this.densityMapCalculation || {};\n\n if ( x ) {\n this.densityMapCalculation.x = x;\n }\n\n if ( y ) {\n this.densityMapCalculation.y = y;\n }\n }\n\n calculateDensityAdvanced() {\n\n var results = {\n x: {\n from: 0,\n num: 0,\n delta: 0,\n weighing: false\n },\n\n y: {\n from: 0,\n num: 0,\n delta: 0,\n weighing: false\n }\n };\n\n var widthValues = {\n x: this.graph.drawingSpaceWidth,\n y: this.graph.drawingSpaceHeight\n };\n var axisGetter = {\n x: this.getXAxis,\n y: this.getYAxis\n };\n\n var weighing = false;\n\n for ( var i in this.densityMapCalculation ) {\n\n if ( this.densityMapCalculation[ i ].weighted ) {\n weighing = true;\n results[ i ].weighing = true;\n }\n\n if ( this.densityMapCalculation[ i ].pxPerBin ) {\n\n // In value\n\n var from = ( this.densityMapCalculation[ i ].from == 'min' ) ? axisGetter[ i ].call( this ).getCurrentMin() : this.densityMapCalculation[ i ].from;\n var to = this.densityMapCalculation[ i ].to == 'max' ? axisGetter[ i ].call( this ).getCurrentMax() : this.densityMapCalculation[ i ].to;\n\n // In px\n var dimension = Math.abs( axisGetter[ i ].call( this ).getRelPx( to - from ) );\n results[ i ].num = Math.ceil( widthValues[ i ] / this.densityMapCalculation[ i ].pxPerBin );\n\n //console.log( from, from - axisGetter[ i ].call( this ).getRelVal( ( results[i ].num * this.densityMapCalculation[ i ].pxPerBin - dimension ) / 2 ), ( results[i ].num * this.densityMapCalculation[ i ].pxPerBin - dimension ) / 2 );\n results[ i ].from = from - Math.abs( axisGetter[ i ].call( this ).getRelVal( ( ( results[ i ].num ) * this.densityMapCalculation[ i ].pxPerBin - dimension ) / 2 ) );\n results[ i ].delta = Math.abs( axisGetter[ i ].call( this ).getRelVal( this.densityMapCalculation[ i ].pxPerBin ) );\n\n } else {\n\n results[ i ].num = this.densityMapCalculation[ i ].numBins || 400;\n results[ i ].from = ( this.densityMapCalculation[ i ].from == 'min' ) ? axisGetter[ i ].call( this ).getCurrentMin() : this.densityMapCalculation[ i ].from;\n results[ i ].delta = ( this.densityMapCalculation[ i ].to ) ? ( ( this.densityMapCalculation[ i ].to == 'max' ? axisGetter[ i ].call( this ).getCurrentMax() : this.densityMapCalculation[ i ].to ) - results[ i ].from ) / ( results[ i ].num ) : this.densityMapCalculate[ i ].delta;\n\n }\n\n // console.log( axisGetter[ i ].call( this ).getCurrentMin(), axisGetter[ i ].call( this ).getCurrentMax(), )\n }\n //console.log( this.getYAxis().getCurrentMin(), this.getYAxis().getCurrentMax(), this.graph.drawingSpaceHeight );\n\n //console.log( this.densityMapCalculation );\n\n ( weighing ? this.calculateDensityWeighted : this.calculateDensity ).call( this,\n results.x.from, results.x.delta, results.x.num,\n results.y.from, results.y.delta, results.y.num\n );\n }\n\n /**\n * Selects a subrange of bins for the color mapping. There is no need to recalculate the color map after calling this method\n * @memberof SerieDensityMap\n * @param {Number} binMin - The minimum bin value\n * @param {Number} binMax - The maximum bin value\n * @return {SerieDensityMap} The current instance\n * @example // In this case, all bins with values below binMin * 2 (the middle scale) will be rendered with the first color of the color map\n * serie.setColorMapBinBoundaries( serie.binMin * 2, serie.binMax );\n */\n setColorMapBinBoundaries( min, max ) {\n this.colorMapMin = min;\n this.colorMapMax = max;\n return this;\n }\n\n /**\n * Calls {@link SerieDensityMap#setColorMapBinBoundaries} using the minimum and maximum bin values calculated by {@link SerieDensityMap#calculateDensity}. This function must be called, since colorMinMap and colorMaxMap are not set automatically when the density map is calculated.\n * @memberof SerieDensityMap\n * @param {Number} binMin - The minimum bin value\n * @param {Number} binMax - The maximum bin value\n * @return {SerieDensityMap} The current instance\n */\n autoColorMapBinBoundaries() {\n this.colorMapMin = this.binMin;\n this.colorMapMax = this.binMax;\n return this;\n }\n\n /**\n * Allows the use of a callback to determine the color map min and max value just before the density map is redrawn. This is very useful when the density map is recalculate before redraw, such as in the case where bins per pixels are used\n * @memberof SerieDensityMap\n * @param {(String|Function)} callback - The callback function to call. Should return an array with two elements ```[ colorMapMin, colorMapMax ]```. This parameter can also take the value ```auto```, in which case ```autoColorMapBinBoundaries``` will be called before redraw\n * @return {SerieDensityMap} The current instance\n */\n onRedrawColorMapBinBoundaries( callback ) {\n this.callbackColorMapMinMax = callback;\n return this;\n }\n\n /**\n * Generates a color map based on a serie of HSL(A) values.\n * @summary Colors can scale linearly, logarithmically (enhances short range differences) or exponentially (enhances long range differences).\n * One word of advice though. SVG being not canvas, jsGraph has to create a path for each color value of the color map. In other words, if you're asking for 16-bit coloring (65536 values), 65536 SVG paths will be created and your browser will start to suffer from it.\n * As of now, all the colors in colorStops will be places at equal distances from each other between colorMapMin and colorMapMax set by {@link autoColorMapBinBoundaries} or {@link setColorMapBinBoundaries}\n * @memberof SerieDensityMap\n * @param {Array} colorStops - An array of objects, each having the following format: { h: [ 0-360], s: 0-1, l: 0-1, a: 0-1}\n * @param {Number} numColors - The number of colors to compute.\n * @param {String} [ method = \"linear\" ] - The method to use to calculate the density map: linear, exp, or log\n * @return {SerieDensityMap} The current instance\n */\n colorMapHSL( colorStops, numColors, method ) {\n\n method = method || 'linear';\n\n var methods = {\n 'exp': function( value ) {\n return ( Math.exp( value / numColors * 1 ) - Math.exp( 0 ) ) / ( Math.exp( 1 ) - Math.exp( 0 ) );\n },\n 'log': function( value ) {\n return ( Math.log( value + 1 ) - Math.log( 1 ) ) / ( Math.log( numColors + 1 ) - Math.log( 1 ) );\n },\n 'linear': function( value ) {\n return ( value - 0 ) / ( numColors - 0 );\n }\n };\n\n var k = 0,\n colorMap = [],\n opacities = [];\n\n var color = {\n h: null,\n s: null,\n l: null,\n a: null\n };\n\n var ratio, first;\n\n var slices = colorStops.length - 1;\n\n for ( var i = 0; i <= numColors; i++ ) {\n\n ratio = methods[ method ]( i );\n\n first = Math.floor( ratio * slices );\n\n if ( first == colorStops.length - 1 ) { // Handle 1\n first = slices - 1;\n }\n\n ratio = ( ratio - first / ( slices ) ) / ( 1 / ( slices ) );\n\n for ( var j in color ) {\n color[ j ] = ( colorStops[ first + 1 ][ j ] - colorStops[ first ][ j ] ) * ratio + colorStops[ first ][ j ];\n }\n\n colorMap[ k ] = 'hsl(' + color.h + ', ' + Math.round( color.s * 100 ) + '%, ' + Math.round( color.l * 100 ) + '%)'; //this.HSVtoRGB( color.h, color.s, color.v );\n opacities[ k ] = color.a;\n k++;\n }\n\n this.opacities = opacities;\n this.colorMap = colorMap;\n this.colorMapNum = numColors;\n return this;\n }\n\n /**\n * Calls {@link SerieDensityMap#colorMapHSV} using 100 colors.\n * @memberof SerieDensityMap\n * @param {Array} colorStops - An array of objects, each having the following format: { h: [ 0-360], s: 0-1, l: 0-1, a: 0-1}\n * @param {String} [ method = \"linear\" ] - The method to use to calculate the density map: linear, exp or log\n * @return {SerieDensityMap} The current instance\n */\n autoColorMapHSL( colorStops, method = 'linear' ) {\n this.colorMapHSV( colorStops, 100, method );\n return this;\n }\n\n /* byteToHex( b ) {\n return hexChar[ ( b >> 4 ) & 0x0f ] + hexChar[ b & 0x0f ];\n }\n */\n /*\n HSVtoRGB( h, s, v ) {\n var r, g, b, i, f, p, q, t;\n if ( arguments.length === 1 ) {\n s = h.s, v = h.v, h = h.h;\n }\n i = Math.floor( h * 6 );\n f = h * 6 - i;\n p = v * ( 1 - s );\n q = v * ( 1 - f * s );\n t = v * ( 1 - ( 1 - f ) * s );\n switch ( i % 6 ) {\n case 0:\n r = v, g = t, b = p;\n break;\n case 1:\n r = q, g = v, b = p;\n break;\n case 2:\n r = p, g = v, b = t;\n break;\n case 3:\n r = p, g = q, b = v;\n break;\n case 4:\n r = t, g = p, b = v;\n break;\n case 5:\n r = v, g = p, b = q;\n break;\n }\n return \"#\" + this.byteToHex( Math.floor( r * 255 ) ) + this.byteToHex( Math.floor( g * 255 ) ) + this.byteToHex( Math.floor( b * 255 ) );\n }\n */\n\n /**\n * Returns the color index (```[ 0 - 1 ]```) for a certain value, based on colorMapMin and colorMapMax.\n * @memberof SerieDensityMap\n * @param {Number} binValue - The value of the bin\n * @return {Number} The color index\n */\n getColorIndex( binValue ) {\n\n return Math.max( 0, Math.min( this.colorMapNum, Math.floor( ( binValue - this.colorMapMin ) / ( this.colorMapMax - this.colorMapMin ) * this.colorMapNum ) ) );\n }\n\n /**\n * Draws the serie\n * @memberof SerieDensityMap\n * @private\n */\n draw() {\n\n var colorIndex;\n\n if ( this.method ) {\n this.method();\n }\n\n if ( !this.callbackColorMapMinMax || this.colorMapMin == undefined || this.colorMapMax == undefined || this.callbackColorMapMinMax == 'auto' ) {\n\n this.autoColorMapBinBoundaries();\n } else {\n var val = this.callbackColorMapMinMax( this.binMin, this.binMax );\n\n this.setColorMapBinBoundaries( val[ 0 ], val[ 1 ] );\n }\n\n var deltaXPx = this.getXAxis().getRelPx( this.deltaX ),\n deltaYPx = this.getYAxis().getRelPx( this.deltaY );\n\n for ( var i = 0; i < this.paths.length; i++ ) {\n this.paths[ i ] = '';\n }\n\n for ( var i = 0; i < this.maxIndexX; i++ ) {\n\n for ( var j = 0; j < this.maxIndexY; j++ ) {\n\n if ( this.densitymap[ i ] == undefined || this.densitymap[ i ][ j ] == undefined ) {\n continue;\n }\n\n colorIndex = this.getColorIndex( this.densitymap[ i ][ j ] );\n if ( !this.paths[ colorIndex ] ) {\n this.paths[ colorIndex ] = '';\n }\n\n this.paths[ colorIndex ] += ' M ' + this.getXAxis().getPx( i * this.deltaX + this.fromX ) + ' ' + this.getYAxis().getPx( j * this.deltaY + this.fromY ) + ' h ' + deltaXPx + ' v ' + deltaYPx + ' h -' + deltaXPx + ' z';\n\n }\n }\n /*\n this.maxIndexX = indexX;\n this.maxIndexY = indexY;*/\n\n this.drawRects();\n }\n\n /**\n * Draws the rectangles\n * @memberof SerieDensityMap\n * @private\n */\n drawRects() {\n\n for ( var i = 0; i < this.paths.length; i++ ) {\n\n if ( !this.rects[ i ] ) {\n this.rects[ i ] = document.createElementNS( this.graph.ns, 'path' );\n this.rects[ i ].setAttribute( 'shape-rendering', 'crispEdges' );\n\n }\n\n if ( this.paths[ i ] !== undefined ) {\n this.rects[ i ].setAttribute( 'd', this.paths[ i ] );\n this.rects[ i ].setAttribute( 'fill', this.colorMap[ i ] );\n this.rects[ i ].setAttribute( 'fill-opacity', this.opacities[ i ] );\n }\n this.groupMain.appendChild( this.rects[ i ] );\n }\n\n }\n\n /**\n * Sets the options of the serie\n * @see SerieDensityMapDefaultOptions\n * @param {Object} options - A object containing the options to set\n * @return {SerieDensityMap} The current serie\n * @memberof SerieDensityMap\n */\n setOptions( options ) {\n this.options = util.extend( true, {}, this.defaults(), ( options || {} ) );\n // Unselected style\n\n return this;\n }\n}\n\nexport default SerieDensityMap;","import SerieLine from './graph.serie.line.js';\nimport * as util from '../graph.util.js';\n\n/**\n * Constructor for the contour serie. Do not use this constructor directly, but use the {@link Graph#newSerie} method\n * @private\n * @extends Serie\n * @example graph.newSerie( name, options, \"contour\" );\n * @see Graph#newSerie\n */\nclass SerieContour extends SerieLine {\n\n constructor( graph, name, options ) {\n super( ...arguments );\n\n this.negativeDelta = 0;\n this.positiveDelta = 0;\n\n this.negativeThreshold = 0;\n this.positiveThreshold = 0;\n\n this.groupMain.setAttribute( 'clip-path', 'url(#_clipplot' + graph._creation + ')' );\n }\n\n /**\n * Sets the contour lines\n * @memberof SerieContour.prototype\n * @param {Object} data - The object data\n * @param {Number} data.minX - The minimum x value\n * @param {Number} data.maxX - The maximum x value\n * @param {Number} data.minY - The minimum y value\n * @param {Number} data.maxY - The maximum y value\n * @param {Object[]} data.segments - The segments making up the contour lines\n * @param {Number[]} data.segments.lines - An array of alternating (x1,y1,x2,y2) quadruplet\n * @param {Number} data.segments.zValue - The corresponding z-value of this array\n * @return {Serie} The current serie\n */\n setData( data, arg, type ) {\n\n var z = 0;\n var x, dx, arg = arg || '2D',\n type = type || 'float',\n i, l = data.length,\n j, k,\n arr, datas = [];\n\n if ( !( data instanceof Array ) ) {\n\n if ( typeof data == 'object' ) {\n // Def v2\n this.minX = data.minX;\n this.minY = data.minY;\n this.maxX = data.maxX;\n this.maxY = data.maxY;\n\n data = data.segments;\n l = data.length;\n }\n }\n\n for ( i = 0; i < l; i++ ) {\n k = data[ i ].lines.length;\n arr = this._addData( type, k );\n\n for ( j = 0; j < k; j += 2 ) {\n\n arr[ j ] = data[ i ].lines[ j ];\n this._checkX( arr[ j ] );\n arr[ j + 1 ] = data[ i ].lines[ j + 1 ];\n this._checkY( arr[ j + 1 ] );\n }\n\n datas.push( {\n lines: arr,\n zValue: data[ i ].zValue\n } );\n }\n this.data = datas;\n this.graph.updateDataMinMaxAxes();\n\n this.dataHasChanged( true );\n\n return this;\n }\n\n /**\n * Draws the serie if the data has changed\n * @memberof SerieContour.prototype\n * @param {Boolean} force - Forces redraw even if the data hasn't changed\n * @return {Serie} The current serie\n */\n draw( force ) {\n\n if ( force || this.hasDataChanged() ) {\n\n this.currentLine = 0;\n var x, y, xpx, ypx, xpx2, ypx2, i = 0,\n l = this.data.length,\n j = 0,\n k, m, currentLine, domLine, arr;\n this.minZ = Infinity;\n this.maxZ = -Infinity;\n\n var next = this.groupLines.nextSibling;\n this.groupMain.removeChild( this.groupLines );\n this.zValues = {};\n\n var incrXFlip = 0;\n var incrYFlip = 1;\n if ( this.getFlip() ) {\n incrXFlip = 0;\n incrYFlip = 1;\n }\n\n var minY = this.getYAxis().getCurrentMin();\n var minX = this.getXAxis().getCurrentMin();\n\n var maxX = this.getXAxis().getCurrentMax();\n var maxY = this.getYAxis().getCurrentMax();\n\n this.counter = 0;\n this.currentLineId = 0;\n\n for ( ; i < l; i++ ) {\n this.currentLine = '';\n j = 0;\n k = 0;\n\n for ( arr = this.data[ i ].lines, m = arr.length; j < m; j += 4 ) {\n\n var lastxpx, lastypx;\n\n if ( ( arr[ j + incrXFlip ] < minX && arr[ j + 2 + incrXFlip ] < minX ) || ( arr[ j + incrYFlip ] < minY && arr[ j + 2 + incrYFlip ] < minY ) || ( arr[ j + incrYFlip ] > maxY && arr[ j + 2 + incrYFlip ] > maxY || ( arr[ j + incrXFlip ] > maxX && arr[ j + 2 + incrXFlip ] > maxX ) ) ) {\n continue;\n }\n\n xpx2 = this.getX( arr[ j + incrXFlip ] );\n ypx2 = this.getY( arr[ j + incrYFlip ] );\n\n xpx = this.getX( arr[ j + 2 + incrXFlip ] );\n ypx = this.getY( arr[ j + 2 + incrYFlip ] );\n\n if ( xpx == xpx2 && ypx == ypx2 ) {\n continue;\n }\n\n /*\tif( j > 0 && ( lastxpx !== undefined && lastypx !== undefined && Math.abs( xpx2 - lastxpx ) <= 30 && Math.abs( ypx2 - lastypx ) <= 30 ) ) {\n \t\t\t\t\t\tcurrentLine += \"L\";\n \t\t\t\t\t} else {\n \t\t\t\t\t\tcurrentLine += \"M\";\n \t\t\t\t\t}\n */\n\n this.currentLine += 'M ';\n this.currentLine += xpx2;\n this.currentLine += ' ';\n this.currentLine += ypx2;\n\n this.currentLine += 'L ';\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += ypx;\n\n this.counter++;\n\n lastxpx = xpx;\n lastypx = ypx;\n\n k++;\n }\n\n this.currentLine += ' z';\n\n domLine = this._createLine();\n domLine.setAttribute( 'data-zvalue', this.data[ i ].zValue );\n\n this.zValues[ this.data[ i ].zValue ] = {\n dom: domLine\n };\n\n this.minZ = Math.min( this.minZ, this.data[ i ].zValue );\n this.maxZ = Math.max( this.maxZ, this.data[ i ].zValue );\n }\n\n i++;\n\n for ( i = this.currentLine + 1; i < this.lines.length; i++ ) {\n this.groupLines.removeChild( this.lines[ i ] );\n this.lines.splice( i, 1 );\n }\n\n i = 0;\n\n for ( ; i < l; i++ ) {\n this.setColorTo( this.lines[ i ], this.data[ i ].zValue, this.minZ, this.maxZ );\n }\n\n this.onMouseWheel( 0, {\n shiftKey: false\n } );\n this.groupMain.insertBefore( this.groupLines, next );\n\n } else if ( this.hasStyleChanged( this.selectionType ) ) {\n\n for ( ; i < l; i++ ) {\n this.setColorTo( this.lines[ i ], this.data[ i ].zValue, this.minZ, this.maxZ );\n }\n\n }\n\n }\n\n onMouseWheel( delta, e, fixed, positive ) {\n\n delta /= 250;\n\n if ( fixed !== undefined ) {\n\n if ( !positive ) {\n this.negativeThreshold = -fixed * this.minZ;\n this.negativeDelta = -Math.pow( Math.abs( ( this.negativeThreshold / ( -this.minZ ) ) ), 1 / 3 );\n }\n\n if ( positive ) {\n this.positiveThreshold = fixed * this.maxZ;\n this.positiveDelta = Math.pow( this.positiveThreshold / ( this.maxZ ), 1 / 3 );\n }\n\n } else {\n\n if ( ( !e.shiftKey ) || !this.options.hasNegative ) {\n\n this.positiveDelta = Math.min( 1, Math.max( 0, this.positiveDelta + Math.min( 0.1, Math.max( -0.1, delta ) ) ) );\n this.positiveThreshold = this.maxZ * ( Math.pow( this.positiveDelta, 3 ) );\n\n } else {\n\n this.negativeDelta = Math.min( 0, Math.max( -1, this.negativeDelta + Math.min( 0.1, Math.max( -0.1, delta ) ) ) );\n this.negativeThreshold = -this.minZ * ( Math.pow( this.negativeDelta, 3 ) );\n\n }\n\n }\n\n if ( isNaN( this.positiveDelta ) ) {\n this.positiveDelta = 0;\n }\n\n if ( isNaN( this.negativeDelta ) ) {\n this.negativeDelta = 0;\n }\n\n for ( var i in this.zValues ) {\n\n this.zValues[ i ].dom.setAttribute( 'display', ( ( i >= 0 && i >= this.positiveThreshold ) || ( i <= 0 && i <= this.negativeThreshold ) ) ? 'block' : 'none' );\n\n }\n\n if ( this._shapeZoom ) {\n\n if ( !this.options.hasNegative ) {\n this._shapeZoom.hideHandleNeg();\n } else {\n\n this._shapeZoom.setHandleNeg( -( Math.pow( this.negativeDelta, 3 ) ), this.minZ );\n this._shapeZoom.showHandleNeg();\n }\n\n this._shapeZoom.setHandlePos( ( Math.pow( this.positiveDelta, 3 ) ), this.maxZ );\n }\n }\n\n /**\n * Sets rainbow colors based on hsl format\n * @memberof SerieContour.prototype\n * @param {Object} colors\n * @param {Object} colors.fromPositive\n * @param {Number} colors.fromPositive.h\n * @param {Number} colors.fromPositive.s\n * @param {Number} colors.fromPositive.l\n\n * @param {Object} colors.toPositive\n * @param {Number} colors.toPositive.h\n * @param {Number} colors.toPositive.s\n * @param {Number} colors.toPositive.l\n\n\n * @param {Object} colors.fromNegative\n * @param {Number} colors.fromNegative.h\n * @param {Number} colors.fromNegative.s\n * @param {Number} colors.fromNegative.l\n\n\n * @param {Object} colors.toNegative\n * @param {Number} colors.toNegative.h\n * @param {Number} colors.toNegative.s\n * @param {Number} colors.toNegative.l\n * @return {Serie} The current serie\n */\n setDynamicColor( colors ) {\n this.lineColors = colors;\n\n this.styleHasChanged();\n }\n\n setNegative( bln ) {\n this.options.hasNegative = bln;\n\n if ( bln ) {\n this.negativeThreshold = 0;\n }\n }\n\n setColorTo( line, zValue, min, max ) {\n\n if ( !this.lineColors ) {\n return;\n }\n\n var hsl = {\n h: 0,\n s: 0,\n l: 0\n };\n\n for ( var i in hsl ) {\n\n if ( zValue > 0 ) {\n hsl[ i ] = this.lineColors.fromPositive[ i ] + ( ( this.lineColors.toPositive[ i ] - this.lineColors.fromPositive[ i ] ) * ( zValue / max ) );\n } else {\n hsl[ i ] = this.lineColors.fromNegative[ i ] + ( ( this.lineColors.toNegative[ i ] - this.lineColors.fromNegative[ i ] ) * ( zValue / min ) );\n }\n }\n\n hsl.h /= 360;\n\n var rgb = util.hslToRgb( hsl.h, hsl.s, hsl.l );\n\n line.setAttribute( 'stroke', 'rgb(' + rgb.join() + ')' );\n }\n\n getSymbolForLegend() {\n\n if ( !this.lineForLegend ) {\n\n var line = document.createElementNS( this.graph.ns, 'ellipse' );\n\n line.setAttribute( 'cx', 7 );\n line.setAttribute( 'cy', 0 );\n line.setAttribute( 'rx', 8 );\n line.setAttribute( 'ry', 3 );\n\n line.setAttribute( 'cursor', 'pointer' );\n this.lineForLegend = line;\n\n }\n\n this.applyLineStyle( this.lineForLegend, this.maxZ );\n\n return this.lineForLegend;\n }\n\n applyLineStyle( line, overwriteValue ) {\n line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute( 'stroke-width', this.getLineWidth() + ( this.isSelected() ? 2 : 0 ) );\n if ( this.getLineDashArray() ) {\n line.setAttribute( 'stroke-dasharray', this.getLineDashArray() );\n }\n line.setAttribute( 'fill', 'none' );\n\n this.setColorTo( line, ( ( overwriteValue !== undefined ) ? overwriteValue : line.getAttribute( 'data-zvalue' ) ), this.minZ, this.maxZ );\n // line.setAttribute('shape-rendering', 'optimizeSpeed');\n\n this.hasStyleChanged( false );\n }\n\n setShapeZoom( shape ) {\n this._shapeZoom = shape;\n }\n\n}\n\nexport default SerieContour;","import GraphPosition from '../graph.position.js';\nimport * as util from '../graph.util.js';\nimport EventEmitter from '../dependencies/eventEmitter/EventEmitter.js';\n\n/**\n * Shape class that should be extended\n * @class Shape\n * @static\n */\nclass Shape extends EventEmitter {\n\n constructor() {\n super();\n }\n\n /**\n * Initializes the shape\n * @param {Graph} graph - The graph containing the shape\n * @param {Object} properties - The properties object (not copied)\n * @return {Shape} The current shape\n */\n init( graph, properties ) {\n\n var self = this;\n\n this.graph = graph;\n this.properties = properties || {};\n this.handles = [];\n this.options = this.options || {};\n\n this.group = document.createElementNS( this.graph.ns, 'g' );\n\n this.group.setAttribute( 'clip-path', 'url(#_clipplot' + graph._creation + ')' );\n\n this._selected = false;\n this.createDom();\n\n if ( this._dom ) {\n this._dom.jsGraphIsShape = this;\n }\n\n this.group.jsGraphIsShape = this;\n\n this.classes = [];\n this.transforms = [];\n\n if ( this._data.masker ) {\n\n var maskPath = document.createElementNS( this.graph.ns, 'mask' );\n this.maskingId = Math.random();\n maskPath.setAttribute( 'id', this.maskingId );\n\n this.maskDomWrapper = document.createElementNS( this.graph.ns, 'rect' );\n this.maskDomWrapper.setAttribute( 'fill', 'white' );\n maskPath.appendChild( this.maskDomWrapper );\n\n var maskDom = this._dom.cloneNode();\n maskPath.appendChild( maskDom );\n\n this.maskDom = maskDom;\n\n this.graph.defs.appendChild( maskPath );\n }\n\n if ( this.group ) {\n\n if ( this._dom && !this.isHTML() ) {\n this.group.appendChild( this._dom );\n }\n\n this.group.addEventListener( 'mouseover', function( e ) {\n\n self.handleMouseOver( e );\n\n } );\n\n this.group.addEventListener( 'mouseout', function( e ) {\n\n self.handleMouseOut( e );\n\n } );\n\n this.group.addEventListener( 'mousedown', function( e ) {\n\n self.graph.focus();\n\n self.handleMouseDown( e );\n } );\n\n this.group.addEventListener( 'click', this.handleClick.bind( this ) );\n\n this.group.addEventListener( 'dblclick', function( e ) {\n\n //e.preventDefault();\n // e.stopPropagation();\n\n self.handleDblClick( e );\n } );\n }\n\n //\t\t\tthis.group.appendChild(this.rectEvent);\n\n this.initImpl();\n\n this.graph.emit( 'shapeNew', this );\n\n return this;\n }\n\n /**\n * Implentation of the init method. To be extended if necessary on extended Shape classes\n */\n initImpl() {}\n\n /**\n * @return {Object} The shape's underlying data object\n */\n getData() {\n return this._data;\n }\n\n /**\n * @returns {String} The type of the shape\n */\n getType() {\n return this.type;\n }\n\n /**\n * Removes the shape from the DOM and unlinks it from the graph\n */\n kill( keepDom ) {\n\n if ( this._inDom && !keepDom ) {\n this.graph.removeShapeFromDom( this );\n }\n\n if ( !keepDom ) {\n this.graph._removeShape( this );\n }\n\n this.graph.stopElementMoving( this );\n this.graph.emit( 'shapeRemoved', this );\n this.emit( 'removed', this );\n\n this._inDom = false;\n }\n\n /**\n * Hides the shape\n * @return {Shape} The current shape\n */\n hide() {\n\n if ( this.hidden ) {\n return this;\n }\n\n this.hidden = true;\n if ( !this.isHTML() ) {\n this.group.style.display = 'none';\n } else {\n this._dom.style.display = 'none';\n }\n return this;\n }\n\n /**\n * Returns whether the shape is hidden or not\n * @return {Boolean} true if the shape is hidden, false otherwise\n */\n isHidden() {\n return this.hidden;\n }\n\n /**\n * Returns whether the shape is visible or not\n * @return {Boolean} true if the shape is visible, false if it is hidden\n */\n isVisible() {\n return !this.hidden;\n }\n\n /**\n * Shows the shape\n * @return {Shape} The current shape\n */\n show() {\n\n if ( !this.hidden ) {\n return this;\n }\n\n this.hidden = false;\n if ( !this.isHTML() ) {\n this.group.style.display = 'initial';\n } else {\n this._dom.style.display = 'initial';\n }\n\n this.redraw();\n return this;\n\n }\n\n /**\n * Adds a class to the shape DOM\n * @param {String} className - The class to add\n * @return {Shape} The current shape\n */\n addClass( className ) {\n this.classes = this.classes || [];\n if ( this.classes.indexOf( className ) == -1 ) {\n this.classes.push( className );\n }\n this.makeClasses();\n return this;\n }\n\n /**\n * Removes a class from the shape DOM\n * @param {String} className - The class to remove\n * @return {Shape} The current shape\n */\n removeClass( className ) {\n this.classes.splice( this.classes.indexOf( className ), 1 );\n this.makeClasses();\n return this;\n }\n\n /**\n * Builds the classes\n * @private\n * @return {Shape} The current shape\n */\n makeClasses() {\n\n if ( this._dom ) {\n this._dom.setAttribute( 'class', this.classes.join( ' ' ) );\n }\n\n return this;\n }\n\n /**\n * Triggers a ```shapeChanged``` event on the graph and a ```changed``` event on the shape\n * @return {Shape} The current shape\n */\n changed( event, parameters ) {\n\n if ( event ) {\n this.graph.emit( event, this, parameters );\n this.emit( event, this, parameters );\n }\n\n this.emit( 'changed', this, parameters );\n this.graph.emit( 'shapeChanged', this, parameters );\n return this;\n }\n\n /**\n * Creates an event receptacle with the coordinates of the shape bounding box\n * @return {Shape} The current shape\n */\n setEventReceptacle() {\n\n if ( !this.rectEvent ) {\n this.rectEvent = document.createElementNS( this.graph.ns, 'rect' );\n this.rectEvent.setAttribute( 'pointer-events', 'fill' );\n this.rectEvent.setAttribute( 'fill', 'transparent' );\n this.group.appendChild( this.rectEvent );\n this.rectEvent.jsGraphIsShape = this;\n }\n\n var box = this.group.getBBox();\n this.rectEvent.setAttribute( 'x', box.x );\n this.rectEvent.setAttribute( 'y', box.y - 10 );\n this.rectEvent.setAttribute( 'width', box.width );\n this.rectEvent.setAttribute( 'height', box.height + 20 );\n\n }\n\n /**\n * Assigns a serie to the shape\n * @param {Serie} The serie that owns the shape\n * @return {Shape} The current shape\n */\n setSerie( serie ) {\n\n if ( !serie ) {\n return;\n }\n\n this.serie = serie;\n\n if ( !serie.getXAxis || !serie.getYAxis ) {\n console.error( serie );\n throw 'Serie does not implement the getXAxis or getYAxis method';\n }\n this.xAxis = serie.getXAxis();\n this.yAxis = serie.getYAxis();\n return this;\n }\n\n /**\n * @return {Serie} The serie associated to the shape\n */\n getSerie() {\n return this.serie;\n }\n\n /**\n * Assigns the shape to the default x and y axes of the graph, only if they don't exist yet\n * @return {Shape} The current shape\n * @see Graph#getXAxis\n * @see Graph#getYAxis\n */\n autoAxes() {\n\n if ( !this.xAxis ) {\n this.xAxis = this.graph.getXAxis();\n }\n\n if ( !this.yAxis ) {\n this.yAxis = this.graph.getYAxis();\n }\n\n return this;\n }\n\n /**\n * Assigns the shape to an x axis\n * @param {XAxis} The X axis related to the shape\n * @return {Shape} The current shape\n */\n setXAxis( axis ) {\n this.xAxis = axis;\n return this;\n }\n\n /**\n * Assigns the shape to an y axis\n * @param {YAxis} The Y axis related to the shape\n * @return {Shape} The current shape\n */\n setYAxis( axis ) {\n this.yAxis = axis;\n }\n\n /**\n * Returns the x axis associated to the shape. If non-existent, assigns it automatically\n * @return {XAxis} The x axis associated to the shape.\n */\n getXAxis() {\n\n if ( !this.xAxis ) {\n this.autoAxes();\n }\n\n return this.xAxis;\n }\n\n /**\n * Returns the y axis associated to the shape. If non-existent, assigns it automatically\n * @return {YAxis} The y axis associated to the shape.\n */\n getYAxis() {\n\n if ( !this.yAxis ) {\n this.autoAxes();\n }\n\n return this.yAxis;\n }\n\n /**\n * Sets the layer of the shape\n * @param {Number} layer - The layer number (1 being the lowest)\n * @return {Shape} The current shape\n * @see Shape#getLayer\n */\n setLayer( layer ) {\n this.setProp( 'layer', layer );\n return this;\n }\n\n /**\n * Returns the layer on which the shape is placed\n * @return {Number} The layer number (1 being the lowest layer)\n */\n getLayer() {\n var layer = this.getProp( 'layer' );\n\n if ( layer !== undefined ) {\n return layer;\n }\n\n return 1;\n }\n\n /**\n * Initial drawing of the shape. Adds it to the DOM and creates the labels. If the shape was already in the DOM, the method simply recreates the labels and reapplies the shape style, unless ```force``` is set to ```true```\n * @param {Boolean} force - Forces adding the shape to the DOM (useful if the shape has changed layer)\n * @param {Boolean} preventRedraw - Prevents the redraw method\n * @return {Shape} The current shape\n */\n draw( force, preventRedraw ) {\n\n if ( !this._inDom || force ) {\n\n this.appendToDom();\n this._inDom = true;\n }\n\n this.makeLabels();\n\n if ( !preventRedraw ) {\n this.redraw();\n }\n\n this.applyStyle();\n\n return this;\n }\n\n /**\n * Redraws the shape. Repositions it, applies the style and updates the labels\n * @return {Shape} The current shape\n */\n redraw() {\n\n if ( this.hidden ) {\n return this;\n }\n\n this.position = this.applyPosition();\n\n this.redrawImpl();\n if ( !this.position ) {\n this.updateLabels();\n return this;\n }\n\n this.updateLabels();\n this._applyTransforms();\n return this;\n }\n\n /**\n * Implementation of the redraw method. Extended Shape classes should override this method\n */\n redrawImpl() {}\n\n /**\n * Sets all dumpable properties of the shape\n * @param {Object} properties - The properties object\n * @return {Shape} The current shape\n */\n setProperties( properties ) {\n this.properties = properties;\n\n if ( !Array.isArray( this.properties.position ) ) {\n this.properties.position = [ this.properties.position ];\n }\n var self = this;\n for ( var i = 0, l = this.properties.position.length; i < l; i++ ) {\n\n var pos = GraphPosition.check( this.properties.position[ i ], function( relativeTo ) {\n return self.getRelativePosition( relativeTo );\n } );\n\n this.properties.position[ i ] = pos;\n }\n\n this.emit( 'propertiesChanged' );\n return this;\n }\n\n getRelativePosition( relativePosition ) {\n\n var result;\n if ( ( result = /position([0-9]*)/.exec( relativePosition ) ) !== null ) {\n return this.getPosition( result[ 1 ] );\n } else if ( ( result = /labelPosition([0-9]*)/.exec( relativePosition ) ) !== null ) {\n return this.getLabelPosition( result[ 1 ] );\n }\n\n }\n\n /**\n * Gets all dumpable properties of the shape\n * @return {Object} properties - The properties object\n */\n getProperties( properties ) {\n return this.properties;\n }\n\n /**\n * Sets a property to the shape that is remembered and can be later reexported (or maybe reimported)\n * @param {String} prop - The property to save\n * @param val - The value to save\n * @param [ index = 0 ] - The index of the property array to save the property\n * @return {Shape} The current shape\n */\n setProp( prop, val, index ) {\n this.properties = this.properties || {};\n this.properties[ prop ] = this.properties[ prop ] || [];\n this.properties[ prop ][ index || 0 ] = val;\n this.emit( 'propertyChanged', prop );\n return this;\n }\n\n /**\n * Returns a property of the shape\n * @param {String} prop - The property to retrieve\n * @param [ index = 0 ] - The index of the property array\n */\n getProp( prop, index ) {\n return ( this.properties[ prop ] || [] )[ index || 0 ];\n }\n\n /**\n * Returns all the properties of the shape\n * @param {String} prop - The property to retrieve\n */\n getProps( prop, index ) {\n return ( this.properties[ prop ] || [] );\n }\n\n /**\n * Adds a property to the property array\n * @param {String} prop - The property to add\n * @param val - The value to save\n */\n addProp( prop, value ) {\n this.properties[ prop ] = this.properties[ prop ] || [];\n this.properties[ prop ].push( value );\n }\n\n /**\n * Resets the property array\n * @param {String} prop - The property to reset\n */\n resetProp( prop ) {\n this.properties[ prop ] = [];\n }\n\n /**\n * Sets a DOM property to the shape\n */\n setDom( prop, val, noForce ) {\n if ( this._dom ) {\n\n if ( !noForce || !util.hasSavedAttribute( this._dom, prop ) ) {\n this._dom.setAttribute( prop, val );\n }\n }\n }\n\n /**\n * Sets a DOM property to the shape group\n */\n setDomGroup( prop, val ) {\n if ( this.group ) {\n this.group.setAttribute( prop, val );\n }\n }\n\n /**\n * Saves the stroke color\n * @return {Shape} The current shape\n */\n setStrokeColor( color ) {\n this.setProp( 'strokeColor', color );\n this.overwriteSavedProp( 'stroke', color );\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the stroke color\n * @return {String} The stroke color of the shape\n */\n getStrokeColor() {\n return this.getProp( 'strokeColor' );\n }\n\n /**\n * Saves the fill color\n * @param {String} color - The filling color\n * @return {Shape} The current shape\n */\n setFillColor( color ) {\n\n this.setProp( 'fillColor', color );\n this.overwriteSavedProp( 'fill', color );\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the fill color\n * @return {String} The fill color of the shape\n */\n getFillColor() {\n return this.getProp( 'fillColor' );\n }\n\n /**\n * Saves the opacity of the filling color of the shape\n * @param {Number} opacity - The filling opacity (0 to 1)\n * @return {Shape} The current shape\n */\n setFillOpacity( opacity ) {\n this.setProp( 'fillOpacity', opacity );\n this.overwriteSavedProp( 'fill-opacity', opacity );\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Saves the stroke width\n * @param {String} width - The stroke width\n * @return {Shape} The current shape\n */\n setStrokeWidth( width ) {\n this.setProp( 'strokeWidth', width );\n this.overwriteSavedProp( 'stroke-width', width );\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the stroke width\n * @return {String} The stroke width of the shape\n */\n getStrokeWidth() {\n return this.getProp( 'strokeWidth' );\n }\n\n /**\n * Saves the stroke dash array\n * @param {String} dasharray - The dasharray string\n * @example shape.setStrokeDasharray(\"5,5,1,4\");\n * shape.applyStyle();\n * @return {Shape} The current shape\n */\n setStrokeDasharray( dasharray ) {\n this.setProp( 'strokeDasharray', dasharray );\n this.overwriteSavedProp( 'stroke-dasharray', dasharray );\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Sets any extra attributes to the DOM element of the shape\n * @param {Object} attributes - An extra attribute array to apply to the shape DOM\n * @example shape.setAttributes( { \"data-bindable\" : true } );\n * shape.applyStyle();\n * @return {Shape} The current shape\n */\n setAttributes( attributes ) {\n this.setProp( 'attributes', attributes );\n return this;\n }\n\n overwriteSavedProp( prop, newValue ) {\n util.overwriteDomAttribute( this._dom, prop, newValue );\n }\n\n /**\n * Adds an extra attribute to the shape\n * @param {String} attributeName - The name of the attribute\n * @param {String} attributeValue - The value of the attribute\n * @return {Shape} The current shape\n */\n addAttribute( attributeName, attributeValue ) {\n var added = {};\n added[ attributeName ] = attributeValue;\n this.addProp( 'attributes', added );\n return this;\n }\n\n /**\n * Adds a transform property to the shape.\n * @param {String} type - The transform type (\"rotate\", \"transform\" or \"scale\")\n * @param {String} args - The arguments following the transform\n * @return {Shape} The current shape\n */\n addTransform( type, args ) {\n this.addProp( 'transforms', {\n type: type,\n arguments: Array.isArray( args ) ? args : [ args ]\n } );\n return this;\n }\n\n /**\n * Resets the transforms\n * @see Shape#addTransform\n * @return {Shape} The current shape\n */\n resetTransforms() {\n this.resetProp( 'transforms' );\n return this;\n }\n\n /**\n * Sets the text of the label\n * @param {String} text - The text of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelText( text, index = 0 ) {\n this.setProp( 'labelText', text, index );\n return this;\n }\n\n /**\n * Sets the text of the label\n * @param {String} data - Some additional HTML tags that will be set to the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelData( data, text, index = 0 ) {\n this.setProp( 'labelData', text, index );\n return this;\n }\n\n /**\n * Returns the text of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {String} The text of the label\n */\n getLabelText( text, index = 0 ) {\n return this.getProp( 'labelText', index );\n }\n\n /**\n * Displays a hidden label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n displayLabel( index = 0 ) {\n this.setProp( 'labelVisible', true, index );\n return this;\n }\n\n /**\n * Hides a displayed label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n hideLabel( index = 0 ) {\n this.setProp( 'labelVisible', false, index );\n return this;\n }\n\n /**\n * Sets the color of the label\n * @param {String} color - The color of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelColor( color, index = 0 ) {\n this.setProp( 'labelColor', color, index );\n return this;\n }\n\n /**\n * Sets the font size of the label\n * @param {String} size - The font size (in px) of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelFontSize( size, index = 0 ) {\n this.setProp( 'labelFontSize', size, index );\n return this;\n }\n\n /**\n * Returns the position of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Position} The current position of the label\n */\n getLabelPosition( index = 0 ) {\n return this.getProp( 'labelPosition', index );\n }\n\n /**\n * Sets the position of the label\n * @param {Position} position - The position of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelPosition( position, index ) {\n\n var self;\n var pos = GraphPosition.check( position, function( relativeTo ) {\n return self.getRelativePosition( relativeTo );\n } );\n\n this.setProp( 'labelPosition', pos, index || 0 );\n return this;\n }\n\n /**\n * Sets the angle of the label\n * @param {Number} angle - The angle of the label in degrees (0 to 360°)\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelAngle( angle, index ) {\n this.setProp( 'labelAngle', angle, index || 0 );\n return this;\n }\n\n /**\n * Sets the baseline of the label, which affects its y position with respect to the text direction. For text along the x direction, different baselines will reference differently the text to the ```y``` coordinate.\n * @param {String} baseline - The baseline of the label. Most common baselines are ```no-change```, ```central```, ```middle``` and ```hanging```. You will find an explanation of those significations on the [corresponding MDN article]{@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/dominant-baseline}\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBaseline( baseline, index ) {\n this.setProp( 'labelBaseline', baseline, index || 0 );\n return this;\n }\n\n /**\n * Sets the anchoring of the label.\n * @param {String} anchor - The anchor of the label. Values can be ```start```, ```middle```, ```end``` or ```inherit```.\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelAnchor( anchor, index ) {\n this.setProp( 'labelAnchor', anchor, index || 0 );\n return this;\n }\n\n /**\n * Sets the anchoring of the label.\n * @param {String} size - The font size in px\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelSize( size, index ) {\n this.setProp( 'labelSize', size, index || 0 );\n return this;\n }\n\n /**\n * Sets the color of the stroke of the label.\n * @param {String} color - The color of the stroke\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelStrokeColor( color, index ) {\n this.setProp( 'labelStrokeColor', color, index || 0 );\n return this;\n }\n\n /**\n * Sets the width of the stroke of the label.\n * @param {Number} width - The width of the stroke\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelStrokeWidth( width, index ) {\n this.setProp( 'labelStrokeWidth', width, index || 0 );\n return this;\n }\n\n /**\n * Sets the color of the background of the label.\n * @param {String} color - The color of the background\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBackgroundColor( color, index ) {\n this.setProp( 'labelBackgroundColor', color, index || 0 );\n return this;\n }\n\n /**\n * Sets the opacity of the background of the label.\n * @param {Number} opacity - The opacity of the background, between 0 and 1\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBackgroundOpacity( opacity, index ) {\n this.setProp( 'labelBackgroundOpacity', opacity, index || 0 );\n return this;\n }\n\n /**\n * Applies the generic style to the shape. This is a method that applies to most shapes, hence should not be overridden. However if you create a bundle of shapes that extend another one, you may use it to set common style properties to all your shapes.\n * @return {Shape} The current shape\n */\n applyGenericStyle() {\n\n this.setDom( 'fill', this.getProp( 'fillColor' ), true );\n this.setDom( 'fill-opacity', this.getProp( 'fillOpacity' ), true );\n this.setDom( 'stroke', this.getProp( 'strokeColor' ), true );\n this.setDom( 'stroke-width', this.getProp( 'strokeWidth' ), true );\n this.setDom( 'stroke-dasharray', this.getProp( 'strokeDasharray' ), true );\n\n var attributes = this.getProps( 'attributes' );\n for ( var j = 0, l = attributes.length; j < l; j++ ) {\n\n for ( var i in attributes[ j ] ) {\n this.setDom( i, typeof attributes[ j ][ i ] == 'function' ? attributes[ j ][ i ].call( this, i ) : attributes[ j ][ i ], true );\n }\n\n }\n\n this._applyTransforms();\n\n return this;\n }\n\n /**\n * Applies the style to the shape. This method can be extended to apply specific style to the shapes\n * @return {Shape} The current shape\n */\n applyStyle() {\n\n return this.applyGenericStyle();\n }\n\n /**\n * Returns a computed position object\n * @param {(Number|Position)} [ index = 0 ] - The index of the position to compute\n * @param {Position} relToPosition - A base position from which to compute the position (useful for dx values)\n * @return {Object} The computed position object in the format { x: x_in_px, y: y_in_px }\n */\n calculatePosition( index ) {\n\n var position;\n\n position = ( index instanceof GraphPosition ) ? index : this.getPosition( index );\n\n if ( !position ) {\n return;\n }\n\n if ( position && position.compute ) {\n return position.compute( this.graph, this.getXAxis(), this.getYAxis(), this.getSerie() );\n }\n\n this.graph.throw();\n }\n\n /**\n * Returns a stored position object\n * @param {Number} [ index = 0 ] - The index of the position to compute\n * @return {Position} The position at the proper index, or undefined\n */\n getPosition( index ) {\n\n var pos = this.getProp( 'position', ( index || 0 ) );\n this.setProp( 'position', ( pos = GraphPosition.check( pos ) ), index );\n return pos;\n }\n\n /**\n * Sets a position object\n * @param {Position} position - The position object to store\n * @param {Number} [ index = 0 ] - The index of the position to store\n * @return {Shape} The current shape\n */\n setPosition( position, index ) {\n\n var self = this;\n var pos = GraphPosition.check( position, function( relativeTo ) {\n return self.getRelativePosition( relativeTo );\n } );\n\n return this.setProp( 'position', pos, ( index || 0 ) );\n }\n\n /**\n * Sorts the positions\n * @param {Function} sortFunction - Function passed into the ```Array.sort``` method\n * @return {Position} The current shape\n */\n sortPositions( sortFunction ) {\n this.getProps( 'position' ).sort( sortFunction );\n return this;\n }\n\n /**\n * Applies the style to the shape. This method can be extended to apply specific style to the shapes\n * @private\n * @return {Shape} The current shape\n */\n _applyTransforms() {\n\n var transforms = this.getProp( 'transforms' ),\n transformString = '';\n\n if ( !transforms ) {\n return;\n }\n transforms = Array.isArray( transforms ) ? transforms : [ transforms ];\n\n if ( transforms.length == 0 ) {\n return;\n }\n\n for ( var i = 0; i < transforms.length; i++ ) {\n\n transformString += transforms[ i ].type + '(';\n\n switch ( transforms[ i ].type ) {\n\n case 'translate':\n\n let transform = transforms[ i ].arguments[ 0 ].compute( this.graph, this.getXAxis(), this.getYAxis(), this.getSerie() );\n\n transformString += transform.x;\n transformString += ', ';\n transformString += transform.y;\n break;\n\n case 'rotate':\n\n transformString += transforms[ i ].arguments[ 0 ];\n transformString += ', ';\n\n if ( transforms[ i ].arguments.length == 1 ) {\n var p = this.computePosition( 0 );\n transformString += p.x + ', ' + p.y;\n\n } else {\n\n transformString += GraphPosition.getDeltaPx( transforms[ i ].arguments[ 1 ], this.getXAxis() ).replace( 'px', '' );\n transformString += ', ';\n transformString += GraphPosition.getDeltaPx( transforms[ i ].arguments[ 2 ], this.getYAxis() ).replace( 'px', '' );\n }\n\n break;\n }\n\n transformString += ') ';\n }\n\n this.setDomGroup( 'transform', transformString );\n return this;\n }\n\n /**\n * Creates all the labels\n * @private\n * @returns {Shape} The current shape\n */\n makeLabels() {\n\n this._labels = this._labels || [];\n this._labelsBackground = this._labelsBackground || [];\n\n this._labels.map( ( label ) => {\n this.group.removeChild( label );\n } );\n\n this._labelsBackground.map( ( bg ) => {\n this.group.removeChild( bg );\n } );\n\n this._labels = [];\n this._labelsBackground[ i ] = [];\n\n var i = 0;\n\n while ( this.getProp( 'labelText', i ) !== undefined ) {\n\n if ( !this._labels[ i ] ) {\n\n this._labels[ i ] = document.createElementNS( this.graph.ns, 'text' );\n this._labels[ i ].setAttribute( 'data-label-i', i );\n this._labels[ i ].jsGraphIsShape = this;\n\n this._labelsBackground[ i ] = document.createElementNS( this.graph.ns, 'rect' );\n this._labelsBackground[ i ].setAttribute( 'data-label-i', i );\n this._labelsBackground[ i ].jsGraphIsShape = this;\n\n this.group.appendChild( this._labelsBackground[ i ] );\n this.group.appendChild( this._labels[ i ] );\n\n this._labels[ i ].addEventListener( 'dblclick', ( e ) => {\n e.stopPropagation();\n\n this.labelDblClickListener( e );\n } );\n\n this._labelsBackground[ i ].addEventListener( 'dblclick', ( e ) => {\n e.stopPropagation();\n\n this.labelDblClickListener( e );\n } );\n\n }\n\n i++;\n }\n\n this.updateLabels();\n\n return this;\n }\n\n /**\n * Determines if the label is editable\n * @param {Number} labelIndex - The index of the label\n * @return {Boolean} ```true``` if the label is editable, ```false``` otherwise\n */\n isLabelEditable( labelIndex ) {\n return this.getProp( 'labelEditable', labelIndex || 0 );\n }\n\n /**\n * Applies the label data to the dom object\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {Shape} The current shape\n */\n updateLabels() {\n\n var self = this;\n this._labels = this._labels || [];\n\n for ( var i = 0, l = this._labels.length; i < l; i++ ) {\n this._applyLabelData( i );\n }\n\n }\n\n /**\n * Applies the label data to the dom object\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {Shape} The current shape\n */\n _applyLabelData( labelIndex ) {\n\n labelIndex = labelIndex || 0;\n\n /** Sets the position */\n\n var visible = this.getProp( 'labelVisible', labelIndex );\n\n if ( visible === false ) {\n this._labels[ labelIndex ].setAttribute( 'display', 'none' );\n this._labelsBackground[ labelIndex ].setAttribute( 'display', 'none' );\n return;\n } else {\n this._labels[ labelIndex ].setAttribute( 'display', 'initial' );\n this._labelsBackground[ labelIndex ].setAttribute( 'display', 'initial' );\n }\n\n var position = this.calculatePosition( GraphPosition.check( this.getProp( 'labelPosition', labelIndex ) ) );\n\n if ( isNaN( position.x ) || isNaN( position.y ) || position.y === false || position.x === false ) {\n /*console.warn( \"Cannot compute positioning for labelIndex \" + labelIndex + \" with text \" + this.getProp( \"labelText\", labelIndex ) );\n console.log( this, this._labels );\n console.trace();*/\n return;\n\n }\n\n if ( position.x != 'NaNpx' && !isNaN( position.x ) && position.x !== 'NaN' && position.x !== false ) {\n\n this._labels[ labelIndex ].setAttribute( 'x', position.x );\n this._labels[ labelIndex ].setAttribute( 'y', position.y );\n }\n\n /** Sets the angle */\n var currAngle = this.getProp( 'labelAngle', labelIndex ) || 0;\n if ( currAngle != 0 ) {\n\n var x = this._labels[ labelIndex ].getAttribute( 'x' ),\n y = this._labels[ labelIndex ].getAttribute( 'y' );\n\n this._labels[ labelIndex ].setAttribute( 'transform', 'rotate(' + currAngle + ' ' + x + ' ' + y + ')' );\n // this._labelsBackground[ labelIndex ].setAttribute( 'transform', 'rotate(' + currAngle + ' ' + x + ' ' + y + ')' );\n }\n\n let labelData = this.getProp( 'labelHTMLData', labelIndex ) || {};\n\n for ( var i in labelData ) {\n\n this._labels[ labelIndex ].setAttribute( i, labelData[ i ] );\n this._labelsBackground[ labelIndex ].setAttribute( i, labelData[ i ] );\n }\n\n /** Sets the baseline */\n this._labels[ labelIndex ].setAttribute( 'dominant-baseline', this.getProp( 'labelBaseline', labelIndex ) || 'no-change' );\n\n /** Sets the text */\n this._labels[ labelIndex ].textContent = this.getProp( 'labelText', labelIndex );\n\n /** Sets the color */\n this._labels[ labelIndex ].setAttribute( 'fill', this.getProp( 'labelColor', labelIndex ) || 'black' );\n\n /** Sets the size */\n this._labels[ labelIndex ].setAttribute( 'font-size', this.getProp( 'labelSize', labelIndex ) + 'px' || '12px' );\n\n /** Sets the anchor */\n this._labels[ labelIndex ].setAttribute( 'text-anchor', this._getLabelAnchor( labelIndex ) );\n\n /** Sets the stroke */\n this._labels[ labelIndex ].setAttribute( 'stroke', this.getProp( 'labelStrokeColor', labelIndex ) || 'black' );\n\n /** Sets the stroke */\n this._labels[ labelIndex ].setAttribute( 'stroke-width', this.getProp( 'labelStrokeWidth', labelIndex ) || 0 + 'px' );\n\n this._labels[ labelIndex ].setAttribute( 'stroke-location', 'outside' );\n\n let rect = this._labels[ labelIndex ].getBBox();\n\n this._labelsBackground[ labelIndex ].setAttribute( 'x', rect.x );\n this._labelsBackground[ labelIndex ].setAttribute( 'y', rect.y );\n this._labelsBackground[ labelIndex ].setAttribute( 'width', rect.width );\n this._labelsBackground[ labelIndex ].setAttribute( 'height', rect.height );\n\n this._labelsBackground[ labelIndex ].setAttribute( 'fill', this.getProp( 'labelBackgroundColor' ) || 'transparent' );\n this._labelsBackground[ labelIndex ].setAttribute( 'fill-opacity', this.getProp( 'labelBackgroundOpacity' ) || 1 );\n\n return this;\n }\n\n /**\n * Temporarily empties the labels, until the next rendering.\n * This is used when the shape should not be displayed\n * @returns {Shape} The current shape instance\n */\n emptyLabels() {\n\n for ( var i = 0, l = this._labels.length; i < l; i++ ) {\n /** Sets the baseline */\n this._labels[ i ].textContent = '';\n }\n\n return this;\n }\n\n /**\n * Returns the anchor of the label\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {String} The anchor in SVG string\n */\n _getLabelAnchor( labelIndex ) {\n var anchor = this.getProp( 'labelAnchor', labelIndex );\n switch ( anchor ) {\n case 'middle':\n case 'start':\n case 'end':\n return anchor;\n break;\n\n case 'right':\n return 'end';\n break;\n\n case 'left':\n return 'start';\n break;\n\n default:\n return 'start';\n break;\n }\n }\n\n /**\n * Returns the shape selection status\n * @returns {Boolean} true is the shape is selected, false otherwise\n */\n isSelected() {\n return this._selectStatus || false;\n }\n\n /**\n * Sets or queries whether the shape can have handles. Even if the property is set to false, the getter can return true if the property ```statichandles``` is true (used when handles never disappear)\n * @param {Boolean} setter - If used, defined if the shape has handles or not\n * @returns {Boolean} true is the shape has handles, false otherwise\n * @example Shape.hasHandles( true ); // Sets that the shape has handles\n * @example Shape.hasHandles( false ); // Sets that the shape has no handles\n * @example Shape.hasHandles( ); // Queries the shape to determine if it has handles or not. Also returns true if handles are static\n */\n hasHandles( setter ) {\n\n if ( setter !== undefined ) {\n this.setProp( 'handles', setter );\n }\n\n return !!this.getProp( 'handles' ) || !!this.getProp( 'staticHandles' );\n }\n\n /**\n * Adds shape handles\n * @private\n * @return {Shape} The current shape\n */\n addHandles() {\n\n if ( this.isLocked() ) {\n return;\n }\n\n if ( !this.handlesInDom ) {\n\n this.handlesInDom = true;\n\n for ( var i = 1; i < this.handles.length; i++ ) {\n\n if ( this.handles[ i ] ) {\n this.group.appendChild( this.handles[ i ] );\n }\n }\n }\n\n return this;\n }\n\n /**\n * Remove shape handles\n * @private\n * @return {Shape} The current shape\n */\n removeHandles() {\n\n this.hideHandles();\n this.handles = [];\n }\n\n /**\n * Hide shape handles\n * @private\n * @return {Shape} The current shape\n */\n hideHandles() {\n\n if ( !this.handlesInDom ) {\n return this;\n }\n\n for ( var i = 1; i < this.handles.length; i++ ) {\n this.group.removeChild( this.handles[ i ] );\n }\n\n this.handlesInDom = false;\n return this;\n }\n\n /**\n * @protected\n * @return {Boolean} ```true``` if the handles are in the DOM\n */\n areHandlesInDom() {\n\n return this.handlesInDom;\n }\n\n /**\n * Selects the shape. Should only be called from jsGraph main instance\n * @private\n * @param {Boolean} [ mute = false ] - Mutes the method (no event emission)\n * @returns {Shape} the current shape\n */\n _select( mute ) {\n\n if ( !this.isSelectable() ) {\n return false;\n }\n\n // Put on the stack\n this.appendToDom();\n //this.graph.appendShapeToDom( this ); // Put the shape on top of the stack !\n\n this._selectStatus = true;\n\n this.applySelectedStyle();\n\n if ( this.hasHandles() && !this.hasStaticHandles() ) {\n\n this.addHandles();\n this.setHandles();\n\n }\n\n if ( !mute ) {\n this.graph.emit( 'shapeSelected', this );\n }\n }\n\n applySelectedStyle() {\n\n if ( !this._selectStatus ) {\n return;\n }\n\n var style = this.getSelectStyle();\n var style2 = {};\n for ( var i in style ) {\n if ( typeof style[ i ] == 'function' ) {\n style2[ i ] = style[ i ].call( this );\n } else {\n style2[ i ] = style[ i ];\n }\n }\n\n util.saveDomAttributes( this._dom, style2, 'select' );\n }\n\n /**\n * Unselects the shape. Should only be called from jsGraph main instance\n * @private\n * @param {Boolean} [ mute = false ] - Mutes the method (no event emission)\n * @returns {Shape} the current shape\n */\n _unselect( mute ) {\n\n this._selectStatus = false;\n\n util.restoreDomAttributes( this._dom, 'select' );\n\n if ( this.hasHandles() && !this.hasStaticHandles() ) {\n this.hideHandles();\n }\n\n if ( !mute ) {\n this.graph.emit( 'shapeUnselected', this );\n }\n }\n\n /**\n * Returns the special style of the shape when it is selected.\n * @see Shape#setSelectStyle\n * @param {Object} The SVG attributes to apply to the shape\n */\n getSelectStyle() {\n return this.selectStyle;\n }\n\n /**\n * Defines the style that is applied to the shape when it is selected. The style extends the default style of the shape\n * @param {Object} [ attr = {} ] - The SVG attributes to apply to the shape\n * @example rectangle.setSelectStyle( { fill: 'red' } );\n * @returns {Shape} the current shape\n */\n setSelectStyle( attr ) {\n this.selectStyle = attr;\n this.applySelectedStyle(); // Maybe the shape is already selected\n return this;\n }\n\n /**\n * Assigns static handles to the shape. In this mode, handles will not disappear\n * @param {Boolean} staticHandles - true to enable static handles, false to disable them.\n * @returns {Shape} the current shape\n */\n setStaticHandles( staticHandles ) {\n this.setProp( 'staticHandles', staticHandles );\n }\n\n /**\n * @returns {Boolean} ```true``` if the shape has static handles, ```false``` otherwise\n */\n hasStaticHandles( staticHandles ) {\n return !!this.getProp( 'staticHandles' );\n }\n\n /**\n * Creates the handles for the shape\n * @param {Number} nb - The number of handles\n * @param {String} type - The type of SVG shape to use\n * @param {Object} [ attr = {} ] - The SVG attributes to apply to the handles\n * @param {Function} [ callbackEach ] - An additional callback the user can provide to further personalize the handles\n * @returns {Shape} the current shape\n * @private\n */\n _createHandles( nb, type, attr, callbackEach ) {\n\n if ( this.handles && this.handles.length > 0 ) {\n return;\n }\n\n var self = this;\n\n for ( var i = 1, l = nb; i <= l; i++ ) {\n\n ( ( j ) => {\n\n var self = this;\n\n var handle = document.createElementNS( self.graph.ns, type );\n handle.jsGraphIsShape = true;\n\n if ( attr ) {\n for ( var k in attr ) {\n handle.setAttribute( k, attr[ k ] );\n }\n }\n\n handle\n .addEventListener( 'mousedown', ( e ) => {\n\n if ( self.isResizable() ) {\n\n e.preventDefault();\n e.stopPropagation();\n\n self.graph.emit( 'beforeShapeResize', self );\n this.emit( 'beforeShapeResize' );\n\n if ( !self.graph.prevent( false ) ) {\n\n self.resizing = true;\n self.handleSelected = j;\n self.handleMouseDown( e );\n }\n }\n\n } );\n\n if ( callbackEach ) {\n callbackEach( self.handles[ j ] );\n }\n\n self.handles[ j ] = handle;\n\n } ).call( this, i );\n\n }\n\n return this.handles;\n }\n\n /**\n * Creates the handles for the shape. Should be implemented by the children shapes classes.\n */\n createHandles() {\n\n if ( this.hasStaticHandles() ) {\n this.addHandles();\n this.setHandles();\n }\n\n }\n\n /**\n * Handles mouse down event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseDownImpl() {}\n\n /**\n * Handles the mouse move event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseMoveImpl() {}\n\n /**\n * Handles mouse up event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseUpImpl() {}\n\n /**\n * Called when the shape is created\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleCreateImpl() {}\n\n /**\n * Handles mouse down events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDownImpl} method.prototype\n */\n handleMouseDown( e ) {\n\n //this.handleSelected = false;\n\n if ( this.isLocked() ) {\n return;\n }\n\n if ( this.isMovable() || this.isResizable() ) {\n\n this.graph.elementMoving( this );\n }\n\n if ( this.getProp( 'selectOnMouseDown' ) ) {\n this.graph.selectShape( this );\n }\n\n if ( this.isMovable() ) {\n if ( !this.resizing ) {\n\n this.graph.emit( 'beforeShapeMove', self );\n\n if ( !this.graph.prevent( false ) ) {\n\n this.moving = true;\n this.moved = false;\n }\n }\n }\n\n this._mouseCoords = this.graph._getXY( e );\n return this.handleMouseDownImpl( e, this._mouseCoords );\n }\n\n /**\n * Handles mouse click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDownClick} method\n * @private\n */\n handleClick( e ) {\n\n this.graph.emit( 'shapeClicked', this );\n this.emit( 'shapeClicked' );\n\n if ( !this.isSelectable() ) {\n return false;\n }\n\n if ( !e.shiftKey ) {\n this.graph.unselectShapes();\n }\n\n if ( this.getProp( 'selectOnClick' ) ) {\n\n this.graph.selectShape( this );\n }\n }\n\n /**\n * Handles mouse click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseUpImpl} method\n * @private\n */\n handleMouseMove( e ) {\n //console.log( this.resizinh, this.moving, this.isSelected(), this._mouseCoords );\n if ( ( this.resizing || this.moving ) && !this.isSelected() ) {\n this.graph.selectShape( this );\n }\n\n this.graph.emit( 'beforeShapeMouseMove', this );\n this.emit( 'beforeShapeMouseMove' );\n\n if ( this.graph.prevent( false ) || !this._mouseCoords ) {\n return false;\n }\n\n this.moved = true;\n var coords = this.graph._getXY( e );\n var\n deltaX = this.getXAxis().getRelVal( coords.x - this._mouseCoords.x ),\n deltaY = this.getYAxis().getRelVal( coords.y - this._mouseCoords.y );\n\n if ( deltaX != 0 || deltaY !== 0 ) {\n this.preventUnselect = true;\n }\n\n this._mouseCoords = coords;\n\n var ret = this.handleMouseMoveImpl( e, deltaX, deltaY, coords.x - this._mouseCoords.x, coords.y - this._mouseCoords.y );\n\n return ret;\n\n }\n\n /**\n * Handles mouse up events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseUpImpl} method\n * @private\n */\n handleMouseUp( e ) {\n\n if ( this.moving && this.moved ) {\n\n this.graph.emit( 'shapeMoved', this );\n this.emit( 'shapeMoved' );\n\n }\n\n if ( this.handleSelected || this.resize ) {\n\n this.graph.emit( 'shapeResized', this );\n this.emit( 'shapeResized' );\n\n }\n\n this.moving = false;\n this.resizing = false;\n this.handleSelected = false;\n this.graph.elementMoving( false );\n\n return this.handleMouseUpImpl( e );\n }\n\n /**\n * Handles double click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDblClickImpl} method\n * @private\n */\n handleDblClick( e ) {\n\n }\n\n /**\n * Handles mouse over events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseOverImpl} method\n * @private\n */\n handleMouseOver() {\n\n if ( this.getProp( 'highlightOnMouseOver' ) ) {\n\n if ( !this.moving && !this.resizing ) {\n this.highlight();\n }\n }\n\n this.graph.emit( 'shapeMouseOver', this );\n }\n\n /**\n * Handles mouse out events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseOutImpl} method\n * @private\n */\n handleMouseOut() {\n\n if ( this.getProp( 'highlightOnMouseOver' ) ) {\n this.unHighlight();\n }\n\n this.graph.emit( 'shapeMouseOut', this );\n }\n\n /*\n * Updated July 1st, 2015\n */\n\n /**\n * Locks the shape (prevents selection, resizing and moving)\n * @return {Shape} The current shape\n */\n lock() {\n this.setProp( 'locked', true );\n return this;\n }\n\n /**\n * Unlocks the shape (prevents selection, resizing and moving)\n * @return {Shape} The current shape\n */\n unlock() {\n this.setProp( 'locked', false );\n return this;\n }\n\n /**\n * @return {Boolean} True if the shape is locked, false otherwise\n */\n isLocked() {\n return this.getProp( 'locked' ) || this.graph.shapesLocked;\n }\n\n /**\n * Makes the shape moveable\n * @return {Shape} The current shape\n */\n movable( bln ) {\n this.setProp( 'movable', true );\n }\n\n /**\n * Makes the shape non-moveable\n * @return {Shape} The current shape\n */\n unmovable() {\n this.setProp( 'movable', false );\n return false;\n }\n\n /**\n * @return {Boolean} True if the shape is movable, false otherwise\n */\n isMovable() {\n return this.getProp( 'movable' );\n }\n\n /**\n * Makes the shape resizable\n * @return {Shape} The current shape\n */\n resizable() {\n this.setProp( 'resizable', true );\n }\n\n /**\n * Makes the shape non-resizable\n * @return {Shape} The current shape\n */\n unresizable() {\n this.setProp( 'resizable', false );\n }\n\n /**\n * @return {Boolean} True if the shape is resizable, false otherwise\n */\n isResizable() {\n return this.getProp( 'resizable' );\n }\n\n /**\n * Makes the shape selectable\n * @return {Shape} The current shape\n */\n selectable() {\n this.setProp( 'selectable', true );\n }\n\n /**\n * Makes the shape non-selectable\n * @return {Shape} The current shape\n */\n unselectable() {\n this.graph.unselectShape( this );\n this.setProp( 'selectable', false );\n }\n\n /**\n * @return {Boolean} True if the shape is selectable, false otherwise\n */\n isSelectable() {\n return this.getProp( 'selectable' );\n }\n\n /**\n * Highlights the shape with attributes\n * @returns {Shape} The current shape\n * @param {Object} [ attributes ] - A hashmap of attributes to apply. If omitted, {@link Shape#getHighlightAttributes} will be called\n * @param {String} [ saveDomName=highlight ] - The name to which the current shape attributes will be saved to be recovered later with the {@link Shape#unHighlight} method\n * @example shape.highlight( { fill: 'red', 'fill-opacity': 0.5 } );\n * @see Shape#unHighlight\n */\n highlight( attributes, saveDomName ) {\n\n if ( !attributes ) {\n attributes = this.getHighlightAttributes();\n }\n\n if ( !saveDomName ) {\n saveDomName = 'highlight';\n }\n\n util.saveDomAttributes( this._dom, attributes, saveDomName );\n this.highlightImpl();\n return this;\n }\n\n /**\n * Removes the highlight properties from the same\n * @returns {Shape} The current shape\n * @param {String} [ saveDomName=highlight ] - The name to which the current shape attributes will be saved to be recovered later with the {@link Shape#unHighlight} method\n * @see Shape#highlight\n */\n unHighlight( saveDomName ) {\n\n if ( !saveDomName ) {\n saveDomName = 'highlight';\n }\n\n util.restoreDomAttributes( this._dom, saveDomName );\n this.unHighlightImpl();\n return this;\n }\n\n highlightImpl() {}\n unHighlightImpl() {}\n\n /**\n * @returns {Object} The attributes taken by the shape when highlighted\n * @see Shape#highlight\n */\n getHighlightAttributes() {\n return this._highlightAttributes;\n }\n\n /**\n * Sets the attributes the shape will take when highlighted\n * @param {Object} [ attributes ] - A hashmap of attributes to apply when the shape is highlighted\n * @returns {Shape} The current shape\n * @see Shape#highlight\n */\n setHighlightAttributes( attributes ) {\n this._highlightAttributes = attributes;\n return this;\n }\n\n /**\n * Returns the masking id of the shape. Returns null if the shape does not behave as a mask\n * @returns {String} The ```id``` attribute of the shape\n */\n getMaskingID() {\n return this.maskingId;\n }\n\n /**\n * Masks the current shape with another shape passed as the first parameter of the method\n * @param {Shape} maskingShape - The shape used to mask the current shape\n * @return {Shape} The current shape\n */\n maskWith( maskingShape ) {\n\n const maskingId = maskingShape.getMaskingID();\n\n if ( maskingId ) {\n\n this._dom.setAttribute( 'mask', 'url(#' + maskingId + ')' );\n\n } else {\n\n this._dom.removeAttribute( 'mask' );\n }\n }\n\n /**\n * Manually updates the mask of the shape. This is needed because the shape needs to be surrounded by a white rectangle (because transparent is treated as black and will not render the shape)\n * This method will work well for rectangles but should be overridden for other shapes\n * @return {Shape} The current shape\n * @todo Explore a way to make it compatible for all kinds of shapes. Maybe the masker position should span the whole graph...\n */\n updateMask() {\n return;\n if ( !this.maskDom ) {\n return; // eslint-disable-line no-useless-return\n }\n\n var position = {\n x: 'min',\n y: 'min'\n };\n var position2 = {\n x: 'max',\n y: 'max'\n };\n\n position = this._getPosition( position );\n position2 = this._getPosition( position2 );\n\n this.maskDomWrapper.setAttribute( 'x', Math.min( position.x, position2.x ) );\n this.maskDomWrapper.setAttribute( 'y', Math.min( position.y, position2.y ) );\n\n this.maskDomWrapper.setAttribute( 'width', Math.abs( position2.x - position.x ) );\n this.maskDomWrapper.setAttribute( 'height', Math.abs( position2.y - position.y ) );\n\n for ( var i = 0; i < this._dom.attributes.length; i++ ) {\n this.maskDom.setAttribute( this._dom.attributes[ i ].name, this._dom.attributes[ i ].value );\n }\n\n this.maskDom.setAttribute( 'fill', 'black' );\n\n return this;\n }\n\n labelDblClickListener( e ) {\n\n var i = parseInt( e.target.getAttribute( 'data-label-i' ) );\n\n var self = this;\n\n if ( isNaN( i ) ) {\n return;\n }\n\n if ( !this.isLabelEditable( i ) ) {\n return;\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n var shapeLabel = document.createElement( 'input' );\n shapeLabel.setAttribute( 'type', 'text' );\n shapeLabel.setAttribute( 'value', self.getProp( 'labelText', i ) );\n\n self.graph.wrapper.prepend( shapeLabel );\n shapeLabel.select();\n\n util.setCSS( shapeLabel, {\n position: 'absolute',\n marginTop: ( parseInt( e.target.getAttribute( 'y' ).replace( 'px', '' ) ) + this.graph.getPaddingTop() - 10 ) + 'px',\n marginLeft: ( parseInt( e.target.getAttribute( 'x' ).replace( 'px', '' ) ) + this.graph.getPaddingLeft() - 50 ) + 'px',\n textAlign: 'center',\n width: '100px'\n } );\n\n const previousValue = self.getLabelText( i );\n\n const blurEvent = function() {\n\n self.setLabelText( shapeLabel.value, i );\n self._labels[ i ].textContent = shapeLabel.value;\n\n const nextValue = shapeLabel.value;\n\n shapeLabel.remove();\n shapeLabel.removeEventListener( 'blur', blurEvent );\n shapeLabel = false;\n\n self.changed( 'shapeLabelChanged', {\n previousValue: previousValue,\n nextValue: nextValue\n } );\n };\n\n shapeLabel.addEventListener( 'blur', blurEvent );\n\n shapeLabel.addEventListener( 'keyup', function( e ) {\n\n if ( e.keyCode === 13 ) {\n blurEvent();\n }\n } );\n shapeLabel.addEventListener( 'keypress', function( e ) {\n e.stopPropagation();\n } );\n shapeLabel.addEventListener( 'keydown', function( e ) {\n e.stopPropagation();\n } );\n shapeLabel.focus();\n\n }\n\n /**\n * Appends the shape DOM to its parent\n * @private\n * @return {Shape} The current shape\n */\n appendToDom() {\n\n if ( this._forcedParentDom ) {\n\n this._forcedParentDom.appendChild( this.group );\n } else {\n this.graph.appendShapeToDom( this );\n }\n return this;\n }\n\n /**\n * Forces the DOM parent (instead of the normal layer)\n * @return {Shape} The current shape\n */\n forceParentDom( dom ) {\n\n this._forcedParentDom = dom;\n\n return this;\n }\n\n isHTML() {\n return false;\n }\n}\n\n/**\n * @alias Shape#calculatePosition\n */\nShape.prototype.computePosition = Shape.prototype.calculatePosition;\n\n/**\n * @alias Shape#displayLabel\n */\nShape.prototype.showLabel = Shape.prototype.displayLabel;\n\n/**\n * @alias Shape#kill\n */\nShape.prototype.remove = Shape.prototype.kill;\n\nexport default Shape;","import Shape from './graph.shape.js';\n\n/**\n * Displays a surface under a line serie\n * @extends GraphShape\n */\nclass ShapeSurfaceUnderCurve extends Shape {\n\n createDom() {\n this._dom = document.createElementNS( this.graph.ns, 'path' );\n }\n\n createHandles() {\n\n this._createHandles( 2, 'line', {\n 'stroke-width': '3',\n 'stroke': 'transparent',\n 'pointer-events': 'stroke',\n 'cursor': 'ew-resize'\n } );\n\n }\n\n handleMouseMoveImpl( e, deltaX, deltaY ) {\n\n if ( this.isLocked() ) {\n return;\n }\n\n if ( this.moving ) {\n\n this.getPosition( 0 ).deltaPosition( 'x', deltaX, this.getXAxis() );\n this.getPosition( 1 ).deltaPosition( 'x', deltaX, this.getXAxis() );\n\n } else if ( this.serie && this.handleSelected ) {\n\n this.resizingPosition = this.handleSelected == 1 ? this.getPosition( 0 ) : this.getPosition( 1 );\n\n var value = this.serie.searchClosestValue( this.getXAxis().getVal( this.graph._getXY( e ).x - this.graph.getPaddingLeft() ) );\n\n if ( !value ) {\n return;\n }\n\n if ( this.resizingPosition.x != value.xMin ) {\n this.preventUnselect = true;\n }\n\n this.resizingPosition.x = value.xMin;\n\n } else if ( this.handleSelected ) {\n\n this.resizingPosition = this.handleSelected == 1 ? this.getPosition( 0 ) : this.getPosition( 1 );\n this.resizingPosition.deltaPosition( 'x', deltaX, this.getXAxis() );\n }\n\n this.applyPosition();\n }\n /*\n redrawImpl: function() {\n //var doDraw = this.setPosition();\n //\tthis.setDom('fill', 'url(#' + 'patternFill' + this.graph._creation + ')')\n\n if ( this.position != this.doDraw ) {\n this.group.setAttribute( \"visibility\", this.position ? \"visible\" : 'hidden' );\n this.doDraw = this.position;\n }\n },\n */\n applyPosition() {\n\n if ( !this.serie ) {\n return;\n }\n\n var posXY = this.computePosition( 0 ),\n posXY2 = this.computePosition( 1 ),\n w = Math.abs( posXY.x - posXY2.x ),\n x = Math.min( posXY.x, posXY2.x );\n\n // this.reversed = x == posXY2.x;\n\n if ( w < 2 || x + w < 0 || x > this.graph.getDrawingWidth() ) {\n this.setDom( 'd', '' );\n return false;\n }\n\n var v1 = this.serie.searchClosestValue( this.getPosition( 0 ).x ),\n v2 = this.serie.searchClosestValue( this.getPosition( 1 ).x ),\n v3,\n i,\n j,\n init,\n max,\n k,\n x,\n y,\n firstX,\n firstY,\n currentLine,\n maxY = 0,\n minY = Number.MAX_VALUE;\n\n if ( !v1 || !v2 ) {\n return false;\n }\n\n if ( v1.xBeforeIndex > v2.xBeforeIndex ) {\n v3 = v1;\n v1 = v2;\n v2 = v3;\n\n //this.handleSelected = ( this.handleSelected == 1 ) ? 2 : 1;\n }\n\n this.counter = 0;\n\n for ( i = v1.dataIndex; i <= v2.dataIndex; i++ ) {\n this.currentLine = '';\n init = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n max = i == v2.dataIndex ? v2.xBeforeIndexArr : this.serie.data[ i ].length;\n k = 0;\n\n if ( init == max ) {\n max++;\n }\n\n for ( j = init; j <= max; j += 2 ) {\n\n x = this.serie.getX( this.serie.data[ i ][ j + 0 ] );\n y = this.serie.getY( this.serie.data[ i ][ j + 1 ] );\n\n maxY = Math.max( this.serie.data[ i ][ j + 1 ], maxY );\n minY = Math.min( this.serie.data[ i ][ j + 1 ], minY );\n\n if ( j == init ) {\n this.firstX = x;\n this.firstY = y;\n }\n\n if ( k > 0 ) {\n this.currentLine += ' L ' + x + ' ' + y + ' ';\n } else {\n this.currentLine += ' M ' + x + ' ' + y + ' ';\n }\n\n //this.serie._addPoint( x, y, false, this.currentLine );\n k++;\n\n }\n\n this.lastX = x;\n this.lastY = y;\n\n if ( !this.firstX || !this.firstY || !this.lastX || !this.lastY ) {\n return;\n }\n\n this.currentLine += ' V ' + this.getYAxis().getPx( 0 ) + ' H ' + this.firstX + ' z';\n this.setDom( 'd', this.currentLine );\n }\n\n this.maxY = this.serie.getY( maxY );\n this.setHandles();\n\n this.changed();\n\n return true;\n }\n\n setHandles() {\n\n if ( !this.firstX ) {\n return;\n }\n\n var posXY = this.computePosition( 0 ),\n posXY2 = this.computePosition( 1 );\n\n if ( posXY.x < posXY2.x ) {\n\n this.handles[ 1 ].setAttribute( 'x1', this.firstX );\n this.handles[ 1 ].setAttribute( 'x2', this.firstX );\n\n this.handles[ 2 ].setAttribute( 'x1', this.lastX );\n this.handles[ 2 ].setAttribute( 'x2', this.lastX );\n\n } else {\n\n this.handles[ 1 ].setAttribute( 'x1', this.lastX );\n this.handles[ 1 ].setAttribute( 'x2', this.lastX );\n\n this.handles[ 2 ].setAttribute( 'x1', this.firstX );\n this.handles[ 2 ].setAttribute( 'x2', this.firstX );\n\n }\n this.handles[ 1 ].setAttribute( 'y1', this.getYAxis().getMaxPx() );\n this.handles[ 1 ].setAttribute( 'y2', this.serie.getY( 0 ) );\n\n this.handles[ 2 ].setAttribute( 'y1', this.getYAxis().getMaxPx() );\n this.handles[ 2 ].setAttribute( 'y2', this.serie.getY( 0 ) );\n }\n}\n\nexport default ShapeSurfaceUnderCurve;","import GraphShape from './graph.shape.js';\n\n/**\n * Represents a line\n * @extends Shape\n * @see Graph#newShape\n */\nclass ShapeLine extends GraphShape {\n\n constructor( graph, options ) {\n super( graph, options );\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElementNS( this.graph.ns, 'line' );\n\n if ( !this.getStrokeColor() ) {\n this.setStrokeColor( 'black' );\n }\n\n if ( !this.getStrokeWidth() ) {\n this.setStrokeWidth( 1 );\n }\n\n }\n\n /**\n * Creates the handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {\n\n this._createHandles( 2, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n } );\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n var position = this.calculatePosition( 0 );\n var position2 = this.calculatePosition( 1 );\n\n if ( !position || !position.x || !position.y ) {\n return;\n }\n\n this.setDom( 'x2', position.x );\n this.setDom( 'y2', position.y );\n\n this.setDom( 'y1', position2.y );\n this.setDom( 'x1', position2.x );\n\n this.currentPos2x = position2.x;\n this.currentPos2y = position2.y;\n\n this.currentPos1x = position.x;\n this.currentPos1y = position.y;\n\n return true;\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl( e, deltaX, deltaY, deltaXPx, deltaYPx ) {\n\n if ( this.isLocked() ) {\n return;\n }\n\n var pos = this.getPosition( 0 );\n var pos2 = this.getPosition( 1 );\n\n var posToChange;\n if ( this.handleSelected == 1 ) {\n\n posToChange = pos;\n\n } else if ( this.handleSelected == 2 ) {\n\n posToChange = pos2;\n }\n\n if ( posToChange ) {\n\n if ( !this._data.vertical ) {\n posToChange.deltaPosition( 'x', deltaX, this.getXAxis() );\n }\n\n if ( !this._data.horizontal ) {\n posToChange.deltaPosition( 'y', deltaY, this.getYAxis() );\n }\n }\n\n if ( this.moving ) {\n\n // If the pos2 is defined by a delta, no need to move them\n if ( pos.x ) {\n pos.deltaPosition( 'x', deltaX, this.getXAxis() );\n }\n if ( pos.y ) {\n pos.deltaPosition( 'y', deltaY, this.getYAxis() );\n }\n\n // If the pos2 is defined by a delta, no need to move them\n if ( pos2.x ) {\n pos2.deltaPosition( 'x', deltaX, this.getXAxis() );\n }\n if ( pos2.y ) {\n pos2.deltaPosition( 'y', deltaY, this.getYAxis() );\n }\n\n }\n\n if ( this._data.forcedCoords ) {\n\n var forced = this._data.forcedCoords;\n\n if ( forced.y !== undefined ) {\n\n if ( typeof forced.y == 'function' ) {\n pos2.y = pos.y = forced.y( this );\n } else {\n pos2.y = forced.y;\n pos.y = forced.y;\n }\n }\n\n if ( forced.x !== undefined ) {\n\n if ( typeof forced.x == 'function' ) {\n pos2.x = pos.x = forced.x( this );\n } else {\n pos2.x = forced.x;\n pos.x = forced.x;\n }\n }\n }\n\n if ( this.rectEvent ) {\n this.setEventReceptacle();\n }\n\n this.redraw();\n this.changed();\n this.setHandles();\n\n return true;\n }\n\n /**\n * Sets the handle position\n * @private\n */\n setHandles() {\n\n if ( !this.areHandlesInDom() ) {\n return;\n }\n\n if ( isNaN( this.currentPos1x ) ) {\n return;\n }\n\n this.handles[ 1 ].setAttribute( 'x', this.currentPos1x );\n this.handles[ 1 ].setAttribute( 'y', this.currentPos1y );\n\n this.handles[ 2 ].setAttribute( 'x', this.currentPos2x );\n this.handles[ 2 ].setAttribute( 'y', this.currentPos2y );\n }\n\n /**\n * Creates an line receptacle with the coordinates of the line, but continuous and thicker\n * @return {Shape} The current shape\n */\n setEventReceptacle() {\n\n if ( !this.currentPos1x ) {\n return;\n }\n\n if ( !this.rectEvent ) {\n this.rectEvent = document.createElementNS( this.graph.ns, 'line' );\n this.rectEvent.setAttribute( 'pointer-events', 'stroke' );\n this.rectEvent.setAttribute( 'stroke', 'transparent' );\n this.rectEvent.jsGraphIsShape = this;\n this.group.appendChild( this.rectEvent );\n }\n\n this.rectEvent.setAttribute( 'x1', this.currentPos1x );\n this.rectEvent.setAttribute( 'y1', this.currentPos1y );\n this.rectEvent.setAttribute( 'x2', this.currentPos2x );\n this.rectEvent.setAttribute( 'y2', this.currentPos2y );\n this.rectEvent.setAttribute( 'stroke-width', this.getProp( 'strokeWidth' ) + 2 );\n }\n}\n\nexport default ShapeLine;","import ShapeLine from './graph.shape.line.js';\n\n/**\n * Displays an arrow\n * @extends GraphShapeLine\n */\nclass ShapeArrow extends ShapeLine {\n\n constructor( graph ) {\n\n super( graph );\n\n }\n\n createDom() {\n\n this._dom = document.createElementNS( this.graph.ns, 'line' );\n this._dom.setAttribute( 'marker-end', 'url(#arrow' + this.graph._creation + ')' );\n\n this.createHandles( this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n } );\n\n this.setStrokeColor( 'black' );\n this.setStrokeWidth( 1 );\n }\n}\n\nexport default ShapeArrow;","import * as util from '../graph.util.js';\nimport Shape from './graph.shape.js';\n\n/**\n * Displays an ellipse\n * @extends Shape\n */\nclass ShapeEllipse extends Shape {\n\n constructor( graph, options ) {\n super( graph, options );\n }\n\n createDom() {\n this._dom = document.createElementNS( this.graph.ns, 'ellipse' );\n }\n\n applyPosition() {\n\n var pos = this.computePosition( 0 );\n\n this.setDom( 'cx', pos.x || 0 );\n this.setDom( 'cy', pos.y || 0 );\n\n let posR = this.graph.newPosition( {\n\n dx: this.getProp( 'rx' ),\n dy: this.getProp( 'ry' ) || this.getProp( 'rx' )\n\n } );\n\n let posComputed = this.calculatePosition( posR );\n\n this.setDom( 'rx', Math.abs( posComputed.x ) || 0 );\n this.setDom( 'ry', Math.abs( posComputed.y ) || 0 );\n return true;\n }\n\n setR( rx, ry ) {\n this.setProp( 'rx', rx );\n this.setProp( 'ry', ry );\n return this;\n }\n\n handleMouseUpImpl() {\n this.triggerChange();\n }\n\n handleMouseMoveImpl( e, deltaX, deltaY, deltaXPx, deltaYPx ) {\n\n }\n}\n\nexport default ShapeEllipse;","import GraphShape from './graph.shape.js';\n\n/**\n * Blank shape used to display label\n * Use myShapelabel.setLabelText(); and associated methods\n * @extend GraphShape\n */\nclass ShapeLabel extends GraphShape {\n\n constructor( graph, options ) {\n\n super( graph, options );\n }\n\n createDom() {\n return false;\n }\n\n applyPosition() {\n return true;\n }\n}\n\nexport default ShapeLabel;","import Shape from './graph.shape.js';\n\n/**\n * Represents a line that extends the Shape class. Used by the plugin {@link PluginSerieLineDifference}\n * @extends Shape\n * @see Graph#newShape\n */\nclass ShapePolyline extends Shape {\n\n constructor( graph, options ) {\n super( graph, options );\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElementNS( this.graph.ns, 'path' );\n\n if ( !this.getStrokeColor() ) {\n this.setStrokeColor( 'black' );\n }\n\n if ( this.getStrokeWidth() == undefined ) {\n this.setStrokeWidth( 1 );\n }\n }\n\n /**\n * No handles for the polyline\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {}\n\n /**\n * Force the points of the polyline already computed in pixels\n * @param {String} a SVG string to be used in the ```d``` attribute of the path.\n * @return {ShapePolyline} The current polyline instance\n */\n setPointsPx( points ) {\n this.setProp( 'pxPoints', points );\n return this;\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n let pxPoints;\n let pos = this.computePosition( 0 );\n\n if ( ( pxPoints = this.getProp( 'pxPoints' ) ) ) {\n\n pxPoints = ' M ' + pos.x + ' ' + pos.y + ' ' + pxPoints;\n this.setDom( 'd', pxPoints );\n\n } else if ( this.points ) {\n\n var xAxis, yAxis;\n\n if ( this.serie ) {\n\n xAxis = this.serie.getXAxis();\n yAxis = this.serie.getYAxis();\n\n } else if ( this.xAxis && this.yAxis ) {\n\n xAxis = this.xAxis;\n yAxis = this.yAxis;\n }\n\n this.setDom( 'd', 'M ' + this.points.map( function( p ) {\n return xAxis.getPx( p[ 0 ] ) + ', ' + yAxis.getPx( p[ 1 ] );\n } ).join( ' L ' ) );\n }\n\n this.changed();\n return true;\n }\n}\n\nexport default ShapePolyline;","import Shape from './graph.shape.js';\nimport GraphPosition from '../graph.position.js';\n\n/**\n * Displays an integral with NMR style\n * @extends ShapeSurfaceUnderCurve\n */\nclass ShapeNMRIntegral extends Shape {\n\n constructor( graph, options ) {\n\n super( graph, options );\n\n this.nbHandles = 2;\n }\n\n createDom() {\n this._dom = document.createElementNS( this.graph.ns, 'path' );\n this._domShadow = document.createElementNS( this.graph.ns, 'path' );\n this._domShadow.jsGraphIsShape = this;\n this._dom.setAttribute( 'pointer-events', 'stroke' );\n this._domShadow.setAttribute( 'pointer-events', 'stroke' );\n this._domShadow.setAttribute( 'stroke-width', '12' );\n this._domShadow.setAttribute( 'fill', 'transparent' );\n this._domShadow.setAttribute( 'stroke', 'transparent' );\n this.group.appendChild( this._domShadow );\n }\n\n initImpl() {\n this.setFillColor( 'transparent' );\n this.setStrokeColor( 'black' );\n }\n\n createHandles() {\n\n this._createHandles( 2, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white'\n } );\n\n this.handles[ 1 ].setAttribute( 'fill', 'red' );\n }\n\n xor( a, b ) {\n return ( a && !b ) || ( !a && b );\n }\n\n applyPosition() {\n\n let\n x,\n y,\n xVal,\n yVal,\n axis = this.getAxis(),\n points = [];\n\n let currentLine = '',\n baseLine = this.getProp( 'baseLine', 0 ) || 300,\n ratio;\n\n if ( !this.serie ) {\n throw 'No serie exists for this shape';\n }\n /*\n this.sortPositions( ( a, b ) => {\n return a.x - b.x;\n } );\n\n */\n let pos1 = this.getPosition( 0 );\n let pos2 = this.getPosition( 1 );\n\n if ( ( pos1.x < this.serie.getXAxis().getCurrentMin() && pos2.x < this.serie.getXAxis().getCurrentMin() ) || ( pos1.x > this.serie.getXAxis().getCurrentMax() && pos2.x > this.serie.getXAxis().getCurrentMax() ) ) {\n this.setDom( 'd', '' );\n this._domShadow.setAttribute( 'd', '' );\n\n this.hideLabel( 0 );\n return false;\n }\n\n this.showLabel( 0 );\n\n let sum = 0;\n\n let j;\n let waveform = this.serie.getWaveform();\n\n if ( !waveform ) {\n return;\n }\n\n let index1 = waveform.getIndexFromX( pos1[ axis ], true, Math.floor ),\n index2 = waveform.getIndexFromX( pos2[ axis ], true, Math.ceil ),\n index3,\n flipped = false;\n\n if ( index1 == index2 ) { // At least one px please !\n if ( waveform.getReductionType() == 'aggregate' ) {\n index2 += 4; // Aggregated state\n } else {\n index2++; // Non aggregated state\n }\n }\n\n if ( index2 < index1 ) {\n index3 = index1;\n index1 = index2;\n index2 = index3;\n flipped = true;\n }\n\n let firstX, firstY, firstXVal, firstYVal, lastX, lastXVal, lastY, lastYVal;\n let data = waveform.getDataInUse();\n\n let condition, incrementation;\n\n let normalSums = true;\n if ( waveform.getReductionType() == 'aggregate' ) {\n normalSums = false;\n }\n\n if (\n ( waveform.getXMonotoneousAscending() && // Ascending\n 1 == 1 ) ||\n ( !waveform.getXMonotoneousAscending() && // Ascending\n 1 == 2 )\n ) {\n\n j = index2;\n condition = true;\n incrementation = -1;\n\n } else {\n\n j = index1;\n condition = false;\n incrementation = 1;\n }\n\n for ( ; condition ? j >= index1 : j <= index2; j += incrementation ) {\n\n xVal = waveform.getX( j, true );\n yVal = waveform.getY( j, true );\n\n x = this.serie.getX( xVal );\n y = this.serie.getY( yVal );\n\n /*\n if ( ! normalSums && j % 4 == 0 && j >= index1 && data.sums ) { // Sums are located every 4 element\n\n sum += data.sums[ j ];// * ( waveform.getX( j, true ) - waveform.getX( j - 3, true ) ); // y * (out-in)\n\n } else if( normalSums ) {\n */\n sum += waveform.getY( j, true ); // * ( waveform.getX( j, true ) - waveform.getX( j - 1, true ) ); // y * (out-in)\n //}\n\n if ( !firstX ) {\n\n firstX = x;\n firstY = y;\n firstXVal = waveform.getX( j );\n firstYVal = waveform.getY( j );\n }\n\n if ( lastX == undefined ) {\n\n lastX = x;\n lastY = y;\n lastXVal = waveform.getX( j );\n lastYVal = waveform.getY( j );\n continue;\n }\n\n if ( x == lastX && y == lastY ) {\n //continue;\n }\n\n lastX = x;\n lastY = y;\n //console.log( data, data[ j ] );\n\n points.push( [ x, y, sum ] );\n lastXVal = xVal;\n }\n\n lastXVal = false;\n lastYVal = false;\n lastX = false;\n lastY = false;\n\n if ( sum == 0 ) {\n sum = 1;\n }\n\n this._sumVal = waveform.integrate( pos1.x, pos2.x );\n\n if ( !this.ratio ) {\n // 150px / unit\n ratio = 200 / sum;\n\n } else {\n // Already existing\n ratio = this.ratio * ( this.sumVal / sum );\n }\n let py;\n\n if ( points.length == 0 ) {\n return;\n }\n\n for ( var i = 0, l = points.length; i < l; i++ ) {\n\n py = baseLine - ( points[ i ][ 2 ] ) * ratio;\n\n if ( i > 0 && ( ( points[ i - 1 ][ 2 ] > sum / 2 && points[ i ][ 2 ] <= sum / 2 ) || ( points[ i - 1 ][ 2 ] < sum / 2 && points[ i ][ 2 ] >= sum / 2 ) ) ) {\n\n let pos = baseLine - ( points[ i - 1 ][ 2 ] + points[ i ][ 2 ] ) / 2 * ratio;\n\n this.setPosition( {\n x: points[ i ][ 0 ] + 'px',\n y: pos + 'px'\n\n }, 3 );\n\n this.setLabelPosition( this.getPosition( 3 ), 0 );\n }\n\n currentLine += ' L ' + points[ i ][ 0 ] + ', ' + py + ' ';\n\n this.lastPointX = points[ i ][ 0 ];\n this.lastPointY = py;\n }\n\n this.points = points;\n this._sum = sum;\n\n if ( this.serie.isFlipped() ) {\n currentLine = ' M ' + baseLine + ', ' + firstX + ' ' + currentLine;\n } else {\n currentLine = ' M ' + firstX + ', ' + baseLine + ' ' + currentLine;\n }\n\n this.firstPointX = firstX;\n this.firstPointY = baseLine;\n\n this.setDom( 'd', currentLine );\n this._domShadow.setAttribute( 'd', currentLine );\n\n this.firstX = firstX;\n this.firstY = firstY;\n /*\n if ( this._selected ) {\n this.select();\n }\n\n this.setHandles();*/\n\n ( this.ratioLabel && this.updateIntegralValue( this.ratioLabel ) ) || this.updateLabels();\n\n this.changed();\n this.handleCondition = !this.xor( incrementation == -1, flipped );\n this.setHandles();\n\n this.updateIntegralValue();\n\n return true;\n }\n\n updateIntegralValue( ratioLabel = this.ratioLabel, forceValue ) {\n\n if ( ratioLabel ) {\n this.ratioLabel = ratioLabel;\n }\n\n if ( forceValue !== undefined ) {\n this.ratioLabel = forceValue / this.sumVal;\n }\n\n this.setLabelText( ratioLabel ? ( Math.round( 100 * this.sumVal * ratioLabel ) / 100 ).toPrecision( 3 ) : 'N/A', 0 );\n this.updateLabels();\n return this.ratioLabel;\n }\n\n getAxis() {\n return this._data.axis || 'x';\n }\n\n /**\n * User to screen coordinate transform. In (unit)/(px), (unit) being the unit of the integral (x * y)\n * @type {Number}\n */\n set ratio( r ) {\n this._ratio = r;\n }\n\n get ratio() {\n return this._ratio;\n }\n\n get sum() {\n return this._sum;\n }\n\n get sumVal() {\n return this._sumVal;\n }\n\n selectStyle() {\n this.setDom( 'stroke-width', '2px' );\n }\n\n selectHandles() {} // Cancel areaundercurve\n\n setHandles() {\n\n if ( this.points == undefined ) {\n return;\n }\n\n if ( !this.isSelected() ) {\n return;\n }\n\n this.addHandles();\n\n if ( this.handleCondition ) {\n\n this.handles[ 1 ].setAttribute( 'x', this.firstPointX );\n this.handles[ 1 ].setAttribute( 'y', this.firstPointY );\n this.handles[ 2 ].setAttribute( 'x', this.lastPointX );\n this.handles[ 2 ].setAttribute( 'y', this.lastPointY );\n\n } else {\n\n this.handles[ 2 ].setAttribute( 'x', this.firstPointX );\n this.handles[ 2 ].setAttribute( 'y', this.firstPointY );\n this.handles[ 1 ].setAttribute( 'x', this.lastPointX );\n this.handles[ 1 ].setAttribute( 'y', this.lastPointY );\n\n }\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl( e, deltaX, deltaY, deltaXPx, deltaYPx ) {\n\n if ( this.isLocked() ) {\n return;\n }\n\n var pos = this.getPosition( 0 );\n var pos2 = this.getPosition( 1 );\n\n var posToChange;\n\n if ( this.handleSelected == 1 ) {\n\n posToChange = pos;\n\n } else if ( this.handleSelected == 2 ) {\n\n posToChange = pos2;\n }\n\n if ( posToChange ) {\n\n if ( !this._data.vertical ) {\n posToChange.deltaPosition( 'x', deltaX, this.getXAxis() );\n }\n }\n\n if ( this.moving ) {\n\n // If the pos2 is defined by a delta, no need to move them\n if ( pos.x ) {\n pos.deltaPosition( 'x', deltaX, this.getXAxis() );\n }\n\n // If the pos2 is defined by a delta, no need to move them\n if ( pos2.x ) {\n pos2.deltaPosition( 'x', deltaX, this.getXAxis() );\n }\n }\n\n if ( this.rectEvent ) {\n this.setEventReceptacle();\n }\n\n this.redraw();\n this.changed();\n\n return true;\n }\n}\n\nexport default ShapeNMRIntegral;","import GraphShape from './graph.shape.js';\nimport * as util from '../graph.util.js';\n\n/**\n * Represents a rectangle that extends the Shape class\n * @class ShapeRectangle\n * @augments Shape\n * @see Graph#newShape\n */\nclass ShapeRectangle extends GraphShape {\n\n constructor( graph, options ) {\n super( graph, options );\n\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n this._dom = document.createElementNS( this.graph.ns, 'rect' );\n\n if ( !this.getStrokeColor() ) {\n this.setStrokeColor( 'black' );\n }\n\n if ( !this.getStrokeWidth() ) {\n this.setStrokeWidth( 1 );\n }\n\n if ( !this.getFillColor() ) {\n this.setFillColor( 'transparent' );\n }\n\n return this;\n }\n\n /**\n * Creates the Handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {\n if ( !this.hasHandles() ) {\n return;\n }\n\n /*\n this._data.handles = this._data.handles || {\n type: 'corners'\n };\n */\n\n var handles = this.getProp( 'handles' );\n\n if ( typeof handles != 'object' ) {\n handles = {};\n }\n\n if ( !handles.type ) {\n handles.type = 'corners';\n }\n\n switch ( handles.type ) {\n\n case 'sides':\n\n util.extend( handles, {\n sides: {\n top: true,\n bottom: true,\n left: true,\n right: true\n }\n } );\n\n var j = 0;\n for ( var i in handles.sides ) {\n if ( handles.sides[ i ] ) {\n j++;\n }\n }\n\n this._createHandles( j, 'g' ).map( function( g ) {\n\n var r = document.createElementNS( self.graph.ns, 'rect' );\n r.setAttribute( 'x', '-3' );\n r.setAttribute( 'width', '6' );\n r.setAttribute( 'y', '-6' );\n r.setAttribute( 'height', '12' );\n r.setAttribute( 'stroke', 'black' );\n r.setAttribute( 'fill', 'white' );\n r.setAttribute( 'cursor', 'pointer' );\n\n g.appendChild( r );\n\n } );\n\n var j = 1;\n\n for ( var i in handles.sides ) {\n if ( handles.sides[ i ] ) {\n this.handles[ i ] = this[ 'handle' + j ];\n this.sides[ j ] = i;\n j++;\n }\n }\n\n break;\n\n case 'corners':\n this._createHandles( 4, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white'\n } );\n\n if ( this.handles ) {\n this.handles[ 2 ].setAttribute( 'cursor', 'nesw-resize' );\n this.handles[ 4 ].setAttribute( 'cursor', 'nesw-resize' );\n\n this.handles[ 1 ].setAttribute( 'cursor', 'nwse-resize' );\n this.handles[ 3 ].setAttribute( 'cursor', 'nwse-resize' );\n }\n\n break;\n\n case 'seamlessX':\n\n this._createHandles( 2, 'rect', {\n transform: 'translate(-3 -3)',\n stroke: 'transparent',\n fill: 'transparent',\n width: '20px',\n cursor: 'ew-resize'\n } );\n\n break;\n }\n\n super.createHandles();\n\n return this;\n }\n\n /**\n * Updates the position\n * @memberof ShapeRectangle\n * @private\n * @return {Shape} The current shape\n */\n applyPosition() {\n\n var pos = this.computePosition( 0 ),\n pos2 = this.computePosition( 1 ),\n x,\n y,\n width,\n height;\n\n if ( pos.x < pos2.x ) {\n x = pos.x;\n width = pos2.x - pos.x;\n } else {\n x = pos2.x;\n width = pos.x - pos2.x;\n }\n\n if ( pos.y < pos2.y ) {\n y = pos.y;\n height = pos2.y - pos.y;\n } else {\n y = pos2.y;\n height = pos.y - pos2.y;\n }\n\n this.currentX = x;\n this.currentY = y;\n this.currentW = width;\n this.currentH = height;\n\n if ( !isNaN( x ) && !isNaN( y ) && x !== false && y !== false ) {\n\n this.setDom( 'width', width );\n this.setDom( 'height', height );\n this.setDom( 'x', x );\n this.setDom( 'y', y );\n\n this.setHandles();\n this.updateMask();\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Implements mouse move event\n * @private\n * @return {Shape} The current shape\n */\n handleMouseMoveImpl( e, deltaX, deltaY, deltaXPx, deltaYPx ) {\n\n var handles = this.getProp( 'handles' );\n\n if ( !this.moving && !this.handleSelected ) {\n return;\n }\n\n var pos = this.getPosition( 0 );\n var pos2 = this.getPosition( 1 );\n\n var invX = this.getXAxis().isFlipped(),\n invY = this.getYAxis().isFlipped(),\n posX = pos.x,\n posY = pos.y,\n pos2X = pos2.x,\n pos2Y = pos2.y;\n\n if ( this.moving ) {\n\n pos.deltaPosition( 'x', deltaX, this.getXAxis() );\n pos.deltaPosition( 'y', deltaY, this.getYAxis() );\n\n pos2.deltaPosition( 'x', deltaX, this.getXAxis() );\n pos2.deltaPosition( 'y', deltaY, this.getYAxis() );\n\n } else {\n\n switch ( handles.type ) {\n\n case 'seamlessX':\n // Do nothing for now\n\n switch ( this.handleSelected ) {\n\n case 1:\n pos.deltaPosition( 'x', deltaX, this.getXAxis() );\n break;\n\n case 2:\n pos2.deltaPosition( 'x', deltaX, this.getXAxis() );\n break;\n }\n\n break;\n\n case 'sides':\n // Do nothing for now\n\n switch ( this.sides[ this.handleSelected ] ) {\n\n case 'left':\n pos.deltaPosition( 'x', deltaX, this.getXAxis() );\n break;\n\n case 'right':\n pos2.deltaPosition( 'x', deltaX, this.getXAxis() );\n break;\n\n case 'top':\n pos.deltaPosition( 'y', deltaY, this.getYAxis() );\n break;\n\n case 'bottom':\n pos2.deltaPosition( 'y', deltaY, this.getYAxis() );\n break;\n\n }\n\n break;\n\n case 'corners':\n default:\n\n if ( this.handleSelected == 1 ) {\n\n pos.deltaPosition( 'x', deltaX, this.getXAxis() );\n pos.deltaPosition( 'y', deltaY, this.getYAxis() );\n\n } else if ( this.handleSelected == 2 ) {\n\n pos2.deltaPosition( 'x', deltaX, this.getXAxis() );\n pos.deltaPosition( 'y', deltaY, this.getYAxis() );\n\n } else if ( this.handleSelected == 3 ) {\n\n pos2.deltaPosition( 'y', deltaY, this.getYAxis() );\n pos2.deltaPosition( 'x', deltaX, this.getXAxis() );\n\n } else if ( this.handleSelected == 4 ) {\n\n pos.deltaPosition( 'x', deltaX, this.getXAxis() );\n pos2.deltaPosition( 'y', deltaY, this.getYAxis() );\n\n }\n\n break;\n\n }\n }\n\n this.redraw();\n this.changed();\n this.setHandles();\n\n return true;\n\n }\n\n /**\n * Places handles properly\n * @private\n * @return {Shape} The current shape\n */\n setHandles() {\n\n if ( this.isLocked() || ( !this.isSelectable() && !this._staticHandles ) ) {\n return;\n }\n\n if ( !this.handlesInDom ) {\n return;\n }\n\n var pos = this.computePosition( 0 );\n var pos2 = this.computePosition( 1 );\n\n var handles = this.getProp( 'handles' );\n\n switch ( handles.type ) {\n\n case 'seamlessX':\n\n if ( this.handles[ 1 ] ) {\n this.handles[ 1 ].setAttribute( 'transform', 'translate(-10) translate(' + pos.x + ')' );\n this.handles[ 1 ].setAttribute( 'height', Math.abs( ( pos2.y - pos.y ) ) );\n this.handles[ 1 ].setAttribute( 'y', Math.min( pos2.y, pos.y ) );\n }\n\n if ( this.handles[ 2 ] ) {\n this.handles[ 2 ].setAttribute( 'transform', 'translate(-10) translate(' + pos2.x + ')' );\n this.handles[ 2 ].setAttribute( 'height', Math.abs( ( pos2.y - pos.y ) ) );\n this.handles[ 2 ].setAttribute( 'y', Math.min( pos2.y, pos.y ) );\n }\n\n break;\n\n case 'sides':\n\n if ( this.handles.left ) {\n this.handles.left.setAttribute( 'transform', 'translate(' + this.currentX + ' ' + ( this.currentY + this.currentH / 2 ) + ')' );\n }\n\n if ( this.handles.right ) {\n this.handles.right.setAttribute( 'transform', 'translate( ' + ( this.currentX + this.currentW ) + ' ' + ( this.currentY + this.currentH / 2 ) + ')' );\n }\n\n if ( this.handles.top ) {\n this.handles.top.setAttribute( 'transform', 'translate( ' + ( this.currentX + this.currentW / 2 ) + ' ' + this.currentY + ')' );\n }\n\n if ( this.handles.bottom ) {\n this.handles.bottom.setAttribute( 'transform', 'translate( ' + ( this.currentX + this.currentW / 2 ) + ' ' + ( this.currentY + this.currentH ) + ')' );\n }\n\n break;\n\n case 'corners':\n default:\n\n this.handles[ 1 ].setAttribute( 'x', pos.x );\n this.handles[ 1 ].setAttribute( 'y', pos.y );\n\n this.handles[ 2 ].setAttribute( 'x', pos2.x );\n this.handles[ 2 ].setAttribute( 'y', pos.y );\n\n this.handles[ 3 ].setAttribute( 'x', pos2.x );\n this.handles[ 3 ].setAttribute( 'y', pos2.y );\n\n this.handles[ 4 ].setAttribute( 'x', pos.x );\n this.handles[ 4 ].setAttribute( 'y', pos2.y );\n\n break;\n\n }\n\n }\n\n}\n\nexport default ShapeRectangle;","import ShapeRect from './graph.shape.rect.js';\n\nclass ShapePeakIntegration2D extends ShapeRect {\n\n constructor( graph, options ) {\n\n super( graph, options );\n this.nbHandles = 4;\n }\n\n createDom() {\n\n this._dom = document.createElementNS( this.graph.ns, 'rect' );\n this._dom.element = this;\n\n this.createHandles( this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n } );\n }\n\n redrawImpl() {\n\n this.setPosition();\n this.setHandles();\n this.setBindableToDom( this._dom );\n }\n\n}\n\nexport default ShapePeakIntegration2D;","import Shape from './graph.shape.js';\n\n/**\n * Displays a cross\n * @extends Shape\n */\nclass ShapeCross extends Shape {\n\n constructor( graph, options ) {\n super( graph, options );\n this.nbHandles = 1;\n }\n\n /**\n * Width of the cross, also available from the constructor\n * @type {Number} width\n */\n get width() {\n return this.options.width || 10;\n }\n\n set width( l ) {\n this.options.width = l;\n }\n\n createDom() {\n\n this._dom = document.createElementNS( this.graph.ns, 'path' );\n this._dom.setAttribute( 'd', 'M -' + ( this.width / 2 ) + ' 0 h ' + ( this.width ) + ' m -' + ( this.width / 2 ) + ' -' + ( this.width / 2 ) + ' v ' + ( this.width ) + '' );\n\n }\n\n createHandles() {\n\n this._createHandles( this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n } );\n\n }\n applyPosition() {\n\n var position = this.calculatePosition( 0 );\n if ( !position || !position.x || !position.y ) {\n return;\n }\n\n this.setDom( 'transform', 'translate( ' + position.x + ', ' + position.y + ')' );\n\n this.currentPos1x = position.x;\n this.currentPos1y = position.y;\n\n return true;\n }\n\n redrawImpl() {\n\n this.setHandles();\n }\n\n handleCreateImpl() {\n\n }\n\n handleMouseDownImpl( e ) {\n\n this.moving = true;\n\n return true;\n }\n\n handleMouseUpImpl() {\n\n this.triggerChange();\n return true;\n }\n\n handleMouseMoveImpl( e, deltaX, deltaY, deltaXPx, deltaYPx ) {\n\n if ( this.isLocked() ) {\n return;\n }\n\n var pos = this.getFromData( 'pos' );\n\n if ( this.moving ) {\n\n pos.x = this.graph.deltaPosition( pos.x, deltaX, this.getXAxis() );\n pos.y = this.graph.deltaPosition( pos.y, deltaY, this.getYAxis() );\n }\n\n this.redrawImpl();\n\n return true;\n\n }\n\n setHandles() {\n\n if ( !this.areHandlesInDom() ) {\n return;\n }\n\n if ( isNaN( this.currentPos1x ) ) {\n return;\n }\n\n this.handles[ 1 ].setAttribute( 'x', this.currentPos1x );\n this.handles[ 1 ].setAttribute( 'y', this.currentPos1y );\n }\n\n selectStyle() {\n this.setDom( 'stroke', 'red' );\n this.setDom( 'stroke-width', '2' );\n }\n}\n\nexport default ShapeCross;","import ShapeLine from './graph.shape.line.js';\n\n/**\n * Shows a horizontal line with three little vertical bars. Very useful to demonstrate a peak start, end and middle value\n * @extends ShapeLine\n */\nclass ShapePeakBoundaries extends ShapeLine {\n\n constructor( graph ) {\n super( graph );\n this.lineHeight = 6;\n }\n\n createDom() {\n\n this._dom = document.createElementNS( this.graph.ns, 'line' );\n this.line1 = document.createElementNS( this.graph.ns, 'line' );\n this.line2 = document.createElementNS( this.graph.ns, 'line' );\n this.line3 = document.createElementNS( this.graph.ns, 'line' );\n\n this.rectBoundary = document.createElementNS( this.graph.ns, 'path' );\n\n this.rectBoundary.setAttribute( 'fill', 'transparent' );\n this.rectBoundary.setAttribute( 'stroke', 'none' );\n this.rectBoundary.setAttribute( 'pointer-events', 'fill' );\n\n this.rectBoundary.jsGraphIsShape = true;\n\n this.group.appendChild( this.rectBoundary );\n this.group.appendChild( this.line1 );\n this.group.appendChild( this.line2 );\n this.group.appendChild( this.line3 );\n this._dom.element = this;\n }\n\n createHandles() {\n this._createHandles( 3, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n } );\n }\n\n redrawImpl() {\n\n this.line1.setAttribute( 'stroke', this.getStrokeColor() );\n this.line2.setAttribute( 'stroke', this.getStrokeColor() );\n this.line3.setAttribute( 'stroke', this.getStrokeColor() );\n\n this.line1.setAttribute( 'stroke-width', this.getStrokeWidth() );\n this.line2.setAttribute( 'stroke-width', this.getStrokeWidth() );\n this.line3.setAttribute( 'stroke-width', this.getStrokeWidth() );\n\n this.setHandles();\n this.redrawLines();\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Redraws the vertical lines according to the positions.\n * Position 0 is the left line, position 1 is the right line and position 2 is the center line\n * @returns {ShapePeakBoundaries} The shape instance\n */\n redrawLines() {\n\n var posLeft = this.computePosition( 0 );\n var posRight = this.computePosition( 1 );\n var posCenter = this.computePosition( 2 );\n\n if ( posLeft.x && posRight.x && posCenter.x && this.posYPx ) {\n\n var height = this.lineHeight;\n this.rectBoundary.setAttribute( 'd', 'M ' + posLeft.x + ' ' + ( this.posYPx - height ) + ' v ' + ( 2 * height ) + ' H ' + posRight.x + ' v ' + ( -2 * height ) + 'z' );\n this.line1.setAttribute( 'x1', posLeft.x );\n this.line1.setAttribute( 'x2', posLeft.x );\n\n this.line2.setAttribute( 'x1', posRight.x );\n this.line2.setAttribute( 'x2', posRight.x );\n\n this.line3.setAttribute( 'x1', posCenter.x );\n this.line3.setAttribute( 'x2', posCenter.x );\n\n this._dom.setAttribute( 'x1', posLeft.x );\n this._dom.setAttribute( 'x2', posRight.x );\n\n this.redrawY( height );\n }\n\n return this;\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Redraws the vertical positions of the shape\n * @returns {ShapePeakBoundaries} The shape instance\n */\n redrawY() {\n\n if ( !this.posYPx ) {\n return this;\n }\n\n var height = this.lineHeight;\n\n this.line1.setAttribute( 'y1', this.posYPx - height );\n this.line1.setAttribute( 'y2', this.posYPx + height );\n\n this.line2.setAttribute( 'y1', this.posYPx - height );\n this.line2.setAttribute( 'y2', this.posYPx + height );\n\n this.line3.setAttribute( 'y1', this.posYPx - height );\n this.line3.setAttribute( 'y2', this.posYPx + height );\n\n this._dom.setAttribute( 'y1', this.posYPx );\n this._dom.setAttribute( 'y2', this.posYPx );\n\n return this;\n }\n\n setHandles() {\n\n if ( !this.posYPx ) {\n return;\n }\n\n var posLeft = this.computePosition( 0 );\n var posRight = this.computePosition( 1 );\n var posCenter = this.computePosition( 2 );\n\n if ( posLeft.x && posRight.x && posCenter.x ) {\n\n this.handles[ 1 ].setAttribute( 'x', posLeft.x );\n this.handles[ 1 ].setAttribute( 'y', this.posYPx );\n\n this.handles[ 2 ].setAttribute( 'x', posRight.x );\n this.handles[ 2 ].setAttribute( 'y', this.posYPx );\n\n this.handles[ 3 ].setAttribute( 'x', posCenter.x );\n this.handles[ 3 ].setAttribute( 'y', this.posYPx );\n }\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Sets the y position of the shape\n * @param {Number} y - The y position in px\n * @returns {ShapePeakBoundaries} The shape instance\n */\n setY( y ) {\n this.posYPx = y;\n return this;\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Sets the height of the peak lines\n * @param {Number} height - The height of the lines in px\n * @returns {ShapePeakBoundaries} The shape instance\n */\n setLineHeight( height ) {\n this.lineHeihgt = height;\n }\n\n handleMouseMoveImpl( e, deltaX, deltaY ) {\n\n if ( this.isLocked() ) {\n return;\n }\n\n var posLeft = this.getPosition( 0 );\n var posRight = this.getPosition( 1 );\n var posCenter = this.getPosition( 2 );\n\n switch ( this.handleSelected ) {\n\n case 1: // left\n posLeft.deltaPosition( 'x', deltaX, this.getXAxis() );\n\n if ( Math.abs( posCenter.x - posRight.x ) > Math.abs( posRight.x - posLeft.x ) || Math.abs( posCenter.x - posLeft.x ) > Math.abs( posRight.x - posLeft.x ) ) {\n posCenter.x = posLeft.x + ( posRight.x - posLeft.x ) * 0.1;\n }\n break;\n\n case 2: // left\n\n posRight.deltaPosition( 'x', deltaX, this.getXAxis() );\n\n if ( Math.abs( posCenter.x - posRight.x ) > Math.abs( posRight.x - posLeft.x ) || Math.abs( posCenter.x - posLeft.x ) > Math.abs( posRight.x - posLeft.x ) ) {\n posCenter.x = posRight.x + ( posLeft.x - posRight.x ) * 0.1;\n }\n\n break;\n\n case 3: // left\n\n posCenter.deltaPosition( 'x', deltaX, this.getXAxis() );\n\n if ( Math.abs( posCenter.x - posRight.x ) > Math.abs( posRight.x - posLeft.x ) || Math.abs( posCenter.x - posLeft.x ) > Math.abs( posRight.x - posLeft.x ) ) {\n return;\n }\n\n break;\n\n }\n\n this.setLabelPosition( {\n y: this.getLabelPosition( 0 ).y,\n x: posCenter.x\n } );\n\n this.updateLabels();\n this.redrawLines();\n this.setHandles();\n }\n\n applyPosition() {\n\n this.redrawLines();\n return true;\n }\n\n}\n\nexport default ShapePeakBoundaries;","import {\n isNumeric\n} from '../graph.util.js';\nimport GraphShape from './graph.shape.js';\n\n/**\n * Represents a line\n * @extends Shape\n * @see Graph#newShape\n */\nclass ShapeHTML extends GraphShape {\n\n constructor( graph, options ) {\n super( graph, options );\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElement( 'div' );\n // this._dom.setAttribute( \"requiredExtensions\", \"http://www.w3.org/1999/xhtml\" );\n\n this._dom.setAttribute( 'style', 'position: absolute' );\n let div = document.createElement( 'div' );\n this._dom.appendChild( div );\n this.div = div;\n }\n\n /**\n * Creates the handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {\n\n }\n\n setHeight( height ) {\n this.setProp( 'height', height );\n }\n\n setWidth( width ) {\n this.setProp( 'width', width );\n }\n\n setContent( content ) {\n this.setProp( 'content', content );\n }\n\n setRenderer( method ) {\n this._renderer = method;\n }\n\n redraw() {\n\n if ( this._renderer ) {\n this._renderer( this.div );\n } else {\n this.div.innerHTML = this.getProp( 'content' );\n }\n\n super.redraw( ...arguments );\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n var position = this.calculatePosition( 0 );\n\n if ( !position || !isNumeric( position.x ) || !isNumeric( position.y ) ) {\n return;\n }\n this._dom.style.left = position.x + 'px';\n this._dom.style.top = position.y + 'px';\n\n this.currentPosX = position.x;\n this.currentPosY = position.y;\n\n return true;\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl( e, deltaX, deltaY, deltaXPx, deltaYPx ) {\n\n return true;\n }\n\n /**\n * Sets the handle position\n * @private\n */\n setHandles() {\n\n }\n\n isHTML() {\n return true;\n }\n}\n\nexport default ShapeHTML;","import EventEmitter from '../dependencies/eventEmitter/EventEmitter.js';\n\n/**\n * Represents a plugin\n * @interface\n */\nclass Plugin extends EventEmitter {\n\n static\n default () {\n return {};\n }\n\n constructor( options ) {\n super( ...arguments );\n\n this.options = Object.assign( {}, Plugin.default(), this.constructor.default(), options );\n }\n\n /**\n * Init function called by jsGraph on load\n */\n init( graph ) {\n this.graph = graph;\n }\n\n /**\n * Handles the mousedown event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseDown() {}\n\n /**\n * Handles the mouseup event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseUp() {}\n\n /**\n * Handles the mousemove event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseMove() {}\n}\n\nexport default Plugin;","import Plugin from './graph.plugin.js';\n\n/**\n * Constructor for the drag plugin. Do not use this constructor directly.\n * @class PluginDrag\n * @implements Plugin\n */\nclass PluginDrag extends Plugin {\n\n static\n default () {\n return {\n\n dragX: true,\n dragY: true,\n persistanceX: false,\n persistanceY: false\n\n };\n }\n\n /**\n * @private\n */\n init( graph ) {\n\n this.graph = graph;\n this.time = null;\n this.totaltime = 2000;\n }\n\n /**\n * @private\n */\n onMouseDown( graph, x, y, e, target ) {\n this._draggingX = x;\n this._draggingY = y;\n\n this._lastDraggingX = this._draggingX;\n this._lastDraggingY = this._draggingY;\n\n this.stopAnimation = true;\n\n this.moved = false;\n\n return true;\n }\n\n /**\n * @memberof PluginDrag\n * @private\n */\n onMouseMove( graph, x, y, e, target ) {\n\n var deltaX = x - this._draggingX;\n var deltaY = y - this._draggingY;\n\n if ( this.options.dragX ) {\n graph._applyToAxes( function( axis ) {\n axis.setCurrentMin( axis.getVal( axis.getMinPx() - deltaX ) );\n axis.setCurrentMax( axis.getVal( axis.getMaxPx() - deltaX ) );\n }, false, true, false );\n }\n\n if ( this.options.dragY ) {\n\n graph._applyToAxes( function( axis ) {\n axis.setCurrentMin( axis.getVal( axis.getMinPx() - deltaY ) );\n axis.setCurrentMax( axis.getVal( axis.getMaxPx() - deltaY ) );\n }, false, false, true );\n }\n\n this._lastDraggingX = this._draggingX;\n this._lastDraggingY = this._draggingY;\n\n this._draggingX = x;\n this._draggingY = y;\n\n this.moved = true;\n\n this.time = Date.now();\n\n this.emit( 'dragging' );\n\n graph.draw( true );\n\n }\n\n onMouseUp( graph, x, y, e, target ) {\n\n var dt = ( Date.now() - this.time );\n\n if ( x == this._lastDraggingX || y == this._lastDraggingY ) {\n\n if ( this.moved ) {\n this.emit( 'dragged' );\n }\n\n return;\n }\n\n this.speedX = ( x - this._lastDraggingX ) / dt;\n this.speedY = ( y - this._lastDraggingY ) / dt;\n\n if ( isNaN( this.speedX ) || isNaN( this.speedY ) ) {\n this.emit( 'dragged' );\n return;\n }\n\n graph._applyToAxes( function( axis ) {\n axis._pluginDragMin = axis.getCurrentMin();\n axis._pluginDragMax = axis.getCurrentMax();\n }, false, true, true );\n\n this.stopAnimation = false;\n this.accelerationX = -this.speedX / this.totaltime;\n this.accelerationY = -this.speedY / this.totaltime;\n\n if ( this.options.persistanceX || this.options.persistanceY ) {\n\n this._persistanceMove( graph );\n\n } else {\n\n this.emit( 'dragged' );\n }\n\n }\n\n _persistanceMove( graph ) {\n\n var self = this;\n\n if ( self.stopAnimation ) {\n self.emit( 'dragged' );\n return;\n }\n\n window.requestAnimationFrame( function() {\n\n var dt = Date.now() - self.time;\n var dx = ( 0.5 * self.accelerationX * dt + self.speedX ) * dt;\n var dy = ( 0.5 * self.accelerationY * dt + self.speedY ) * dt;\n\n if ( self.options.persistanceX ) {\n\n graph._applyToAxes( function( axis ) {\n\n axis.setCurrentMin( -axis.getRelVal( dx ) + axis._pluginDragMin );\n axis.setCurrentMax( -axis.getRelVal( dx ) + axis._pluginDragMax );\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n\n }, false, true, false );\n }\n\n if ( self.options.persistanceY ) {\n\n graph._applyToAxes( function( axis ) {\n\n axis.setCurrentMin( -axis.getRelVal( dy ) + axis._pluginDragMin );\n axis.setCurrentMax( -axis.getRelVal( dy ) + axis._pluginDragMax );\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n\n }, false, false, true );\n }\n\n graph.draw();\n\n if ( dt < self.totaltime ) {\n self.emit( 'dragging' );\n self._persistanceMove( graph );\n } else {\n self.emit( 'dragged' );\n }\n\n } );\n\n }\n}\n\nexport default PluginDrag;","import Plugin from './graph.plugin.js';\nimport * as util from '../graph.util.js';\n\n/**\n * @class PluginShape\n * @implements Plugin\n */\nclass PluginShape extends Plugin {\n\n constructor() {\n super( ...arguments );\n }\n\n static\n default () {\n return {};\n }\n\n /**\n * Init method\n * @private\n */\n init( graph, options ) {\n\n super.init( graph, options );\n this.shapeType = options.type;\n }\n\n /**\n * Sets the shape that is created by the plugin\n * @param {String} shapeType - The type of the shape\n */\n setShape( shapeType ) {\n this.shapeInfo.shapeType = shapeType;\n }\n\n /**\n * @private\n */\n onMouseDown( graph, x, y, e, target ) {\n\n if ( !this.shapeType && !this.options.url ) {\n return;\n }\n\n var self = this,\n selfPlugin = this;\n\n var xVal, yVal;\n\n this.count = this.count || 0;\n\n x -= graph.getPaddingLeft();\n y -= graph.getPaddingTop();\n\n xVal = graph.getXAxis().getVal( x );\n yVal = graph.getYAxis().getVal( y );\n\n var shapeInfo = {\n\n position: [ {\n x: xVal,\n y: yVal\n }, {\n x: xVal,\n y: yVal\n } ],\n\n onChange: function( newData ) {\n graph.triggerEvent( 'onAnnotationChange', newData );\n },\n\n locked: false,\n selectable: true,\n resizable: true,\n movable: true\n };\n\n let shapeProperties = this.options.properties;\n\n util.extend( true, shapeInfo, this.options );\n\n this.emit( 'beforeNewShape', e, shapeInfo );\n\n if ( this.graph.prevent( false ) ) {\n return;\n }\n\n var shape = graph.newShape( shapeInfo.type, shapeInfo, false, shapeProperties );\n\n this.emit( 'createdShape', e, shape );\n\n if ( shape ) {\n self.currentShape = shape;\n self.currentShapeEvent = e;\n }\n\n graph.once( 'mouseUp', () => {\n console.log( this.currentShape );\n if ( !this.currentShape ) { // The mouse has moved\n self.emit( 'newShape', e, shape );\n }\n } );\n }\n\n /**\n * @private\n */\n onMouseMove( graph, x, y, e ) {\n\n if ( this.currentShape ) {\n console.log( 'mv' );\n this.count++;\n\n var shape = this.currentShape;\n\n this.currentShape = false;\n\n if ( graph.selectedSerie && !shape.serie ) {\n shape.setSerie( graph.selectedSerie );\n }\n\n shape.resizing = true;\n\n if ( shape.options && shape.options.onCreate ) {\n shape.options.onCreate.call( shape );\n }\n\n shape.draw();\n graph.selectShape( shape );\n shape.handleMouseDown( this.currentShapeEvent, true );\n shape.handleSelected = this.options.handleSelected || 1;\n shape.handleMouseMove( e, true );\n }\n }\n\n /**\n * @private\n */\n onMouseUp() {\n\n if ( this.currentShape ) {\n // No need to kill it as it hasn't been actually put in the dom right now\n\n // Norman 30 July 2017: Yes but it's added in the jsGraph stack. We need to remove it. See #176\n // From now on killing the shape will result in removing it from the stack as well.\n this.currentShape.kill();\n this.currentShape = false;\n }\n }\n\n}\n\nexport default PluginShape;","import * as util from '../graph.util.js';\nimport Plugin from './graph.plugin.js';\n\n/**\n * @extends Plugin\n */\nclass PluginSelectScatter extends Plugin {\n\n constructor() {\n super( ...arguments );\n }\n\n static\n default () {\n return {};\n }\n /**\n * Init method\n * @private\n */\n init( graph, options ) {\n\n this._path = document.createElementNS( graph.ns, 'path' );\n\n util.setAttributeTo( this._path, {\n 'display': 'none',\n 'fill': 'rgba(0,0,0,0.1)',\n 'stroke': 'rgba(0,0,0,1)',\n 'shape-rendering': 'crispEdges',\n 'x': 0,\n 'y': 0,\n 'height': 0,\n 'width': 0,\n 'd': ''\n } );\n\n this.graph = graph;\n\n graph.dom.appendChild( this._path );\n }\n\n /**\n * Assigns the scatter serie that should be selected to the plugin\n * @param {ScatterSerie} serie - The serie\n * @return {PluginSelectScatter} The current plugin instance\n */\n setSerie( serie ) {\n this.serie = serie;\n }\n\n /**\n * @private\n */\n onMouseDown( graph, x, y, e, mute ) {\n\n if ( !this.serie ) {\n return;\n }\n\n this.path = 'M ' + x + ' ' + y + ' ';\n this.currentX = x;\n this.currentY = y;\n\n this.xs = [ this.serie.getXAxis().getVal( x - graph.getPaddingLeft() ) ];\n this.ys = [ this.serie.getYAxis().getVal( y - graph.getPaddingTop() ) ];\n this._path.setAttribute( 'd', '' );\n this._path.setAttribute( 'display', 'block' );\n\n }\n\n /**\n * @private\n */\n onMouseMove( graph, x, y, e, mute ) {\n\n if ( Math.pow( ( x - this.currentX ), 2 ) + Math.pow( ( y - this.currentY ), 2 ) > 25 ) {\n\n this.path += ' L ' + x + ' ' + y + ' ';\n this.currentX = x;\n this.currentY = y;\n\n this.xs.push( this.serie.getXAxis().getVal( x - graph.getPaddingLeft() ) );\n this.ys.push( this.serie.getYAxis().getVal( y - graph.getPaddingTop() ) );\n\n this._path.setAttribute( 'd', this.path + ' z' );\n\n this.findPoints();\n }\n }\n\n /**\n * @private\n */\n findPoints() {\n\n var data = this.serie.waveform;\n var selected = [];\n var counter = 0,\n j2;\n for ( var i = 0, l = data.getLength(); i < l; i += 1 ) {\n\n counter = 0;\n for ( var j = 0, k = this.xs.length; j < k; j += 1 ) {\n\n if ( j == k - 1 ) {\n j2 = 0;\n } else {\n j2 = j + 1;\n }\n\n if ( ( ( this.ys[ j ] < data.getY( i ) && this.ys[ j2 ] > data.getY( i ) ) || ( this.ys[ j ] > data.getY( i ) && this.ys[ j2 ] < data.getY( i ) ) ) ) {\n\n if ( data.getX( i ) > ( ( data.getY( i ) - this.ys[ j ] ) / ( this.ys[ j2 ] - this.ys[ j ] ) ) * ( this.xs[ j2 ] - this.xs[ j ] ) + this.xs[ j ] ) {\n counter++;\n }\n }\n }\n\n if ( counter % 2 == 1 ) {\n selected.push( i );\n this.serie.selectPoint( i, true, 'selected' );\n } else {\n this.serie.unselectPoint( i );\n }\n\n }\n\n this.selected = selected;\n this.emit( 'selectionProcess', selected );\n }\n\n /**\n * @private\n */\n onMouseUp( graph, x, y, e ) {\n this._path.setAttribute( 'display', 'none' );\n this.emit( 'selectionEnd', this.selected );\n }\n\n}\n\nexport default PluginSelectScatter;","import * as util from '../graph.util.js';\nimport Plugin from './graph.plugin.js';\n\n/**\n * @class PluginZoom\n * @implements Plugin\n */\nclass PluginZoom extends Plugin {\n\n constructor() {\n super( ...arguments );\n }\n\n static\n default () {\n\n return {\n 'axes': 'all'\n };\n }\n\n /**\n * Init method\n * @private\n */\n init( graph, options ) {\n\n this._zoomingGroup = document.createElementNS( graph.ns, 'g' );\n this._zoomingSquare = document.createElementNS( graph.ns, 'rect' );\n this._zoomingSquare.setAttribute( 'display', 'none' );\n\n util.setAttributeTo( this._zoomingSquare, {\n 'display': 'none',\n 'fill': 'rgba(171,12,12,0.2)',\n 'stroke': 'rgba(171,12,12,1)',\n 'shape-rendering': 'crispEdges',\n 'x': 0,\n 'y': 0,\n 'height': 0,\n 'width': 0,\n 'pointer-events': 'none'\n } );\n\n this.graph = graph;\n graph.groupEvent.appendChild( this._zoomingGroup );\n this._zoomingGroup.appendChild( this._zoomingSquare );\n }\n\n /**\n * @private\n */\n onMouseDown( graph, x, y, e, mute ) {\n\n var zoomMode = this.options.zoomMode;\n\n if ( !zoomMode ) {\n return;\n }\n\n this._zoomingMode = zoomMode;\n\n if ( x === undefined ) {\n this._backedUpZoomMode = this._zoomingMode;\n this._zoomingMode = 'y';\n x = 0;\n }\n\n if ( y === undefined ) {\n this._backedUpZoomMode = this._zoomingMode;\n this._zoomingMode = 'x';\n y = 0;\n }\n\n this._zoomingXStart = x;\n this._zoomingYStart = y;\n this.x1 = x - graph.getPaddingLeft();\n this.y1 = y - graph.getPaddingTop();\n\n this._zoomingSquare.setAttribute( 'width', 0 );\n this._zoomingSquare.setAttribute( 'height', 0 );\n this._zoomingSquare.setAttribute( 'display', 'block' );\n\n switch ( this._zoomingMode ) {\n\n case 'x':\n this._zoomingSquare.setAttribute( 'y', graph.options.paddingTop );\n this._zoomingSquare.setAttribute( 'height', graph.getDrawingHeight() - graph.shift.bottom );\n break;\n\n case 'y':\n this._zoomingSquare.setAttribute( 'x', graph.options.paddingLeft /* + this.shift[1]*/ );\n this._zoomingSquare.setAttribute( 'width', graph.getDrawingWidth() /* - this.shift[1] - this.shift[2]*/ );\n break;\n\n case 'forceY2':\n\n this.y2 = graph.getYAxis().getPx( this.options.forcedY ) + graph.options.paddingTop;\n\n break;\n\n }\n\n if ( this.options.onZoomStart && !mute ) {\n this.options.onZoomStart( graph, x, y, e, mute );\n }\n }\n\n /**\n * @private\n */\n onMouseMove( graph, x, y, e, mute ) {\n\n //\tthis._zoomingSquare.setAttribute('display', 'none');\n\n //\tthis._zoomingSquare.setAttribute('transform', 'translate(' + Math.random() + ', ' + Math.random() + ') scale(10, 10)');\n switch ( this._zoomingMode ) {\n\n case 'xy':\n this._zoomingSquare.setAttribute( 'x', Math.min( this._zoomingXStart, x ) );\n this._zoomingSquare.setAttribute( 'y', Math.min( this._zoomingYStart, y ) );\n this._zoomingSquare.setAttribute( 'width', Math.abs( this._zoomingXStart - x ) );\n this._zoomingSquare.setAttribute( 'height', Math.abs( this._zoomingYStart - y ) );\n\n break;\n\n case 'forceY2':\n this._zoomingSquare.setAttribute( 'y', Math.min( this._zoomingYStart, this.y2 ) );\n this._zoomingSquare.setAttribute( 'height', Math.abs( this._zoomingYStart - this.y2 ) );\n this._zoomingSquare.setAttribute( 'x', Math.min( this._zoomingXStart, x ) );\n this._zoomingSquare.setAttribute( 'width', Math.abs( this._zoomingXStart - x ) );\n\n break;\n\n case 'x':\n this._zoomingSquare.setAttribute( 'x', Math.min( this._zoomingXStart, x ) );\n this._zoomingSquare.setAttribute( 'width', Math.abs( this._zoomingXStart - x ) );\n\n break;\n\n case 'y':\n this._zoomingSquare.setAttribute( 'y', Math.min( this._zoomingYStart, y ) );\n this._zoomingSquare.setAttribute( 'height', Math.abs( this._zoomingYStart - y ) );\n break;\n\n }\n\n if ( this.options.onZoomMove && !mute ) {\n\n this.options.onZoomMove( graph, x, y, e, mute );\n }\n //\t\tthis._zoomingSquare.setAttribute('display', 'block');\n\n }\n\n /**\n * @private\n */\n onMouseUp( graph, x, y, e, mute ) {\n var self = this;\n this.removeZone();\n\n var _x = x - graph.options.paddingLeft;\n var _y = y - graph.options.paddingTop;\n\n this.emit( 'beforeZoom', {\n graph: graph,\n x: x,\n y: y,\n e: e,\n mute: mute\n } );\n\n if ( graph.prevent( false ) ) {\n\n // This doesn't work !\n //graph.prevent( true ); // Cancel future click event\n return;\n }\n\n if ( ( x - this._zoomingXStart == 0 && this._zoomingMode != 'y' ) || ( y - this._zoomingYStart == 0 && this._zoomingMode != 'x' ) ) {\n return;\n }\n\n if ( this.options.transition || this.options.smooth ) {\n\n let modeX = false,\n modeY = false;\n\n if ( this._zoomingMode == 'x' || this._zoomingMode == 'xy' || this._zoomingMode == 'forceY2' ) {\n\n this.fullX = false;\n this.toAxes( function( axis ) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min( axis.getVal( _x ), axis.getVal( self.x1 ) );\n axis._pluginZoomMaxFinal = Math.max( axis.getVal( _x ), axis.getVal( self.x1 ) );\n }, false, true, false );\n\n modeX = true;\n\n }\n\n if ( this._zoomingMode == 'y' || this._zoomingMode == 'xy' ) {\n\n this.fullY = false;\n this.toAxes( function( axis ) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min( axis.getVal( _y ), axis.getVal( self.y1 ) );\n axis._pluginZoomMaxFinal = Math.max( axis.getVal( _y ), axis.getVal( self.y1 ) );\n\n }, false, false, true );\n\n modeY = true;\n }\n\n if ( this._zoomingMode == 'forceY2' ) {\n\n this.fullY = false;\n this.toAxes( function( axis ) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min( axis.getVal( self.y2 ), axis.getVal( self.y1 ) );\n axis._pluginZoomMaxFinal = Math.max( axis.getVal( self.y2 ), axis.getVal( self.y1 ) );\n\n }, false, false, true );\n\n modeY = true;\n }\n\n this.transition( modeX, modeY, 'zoomEnd' );\n\n } else {\n\n switch ( this._zoomingMode ) {\n case 'x':\n this.fullX = false;\n this.toAxes( '_doZoom', [ _x, this.x1 ], true, false );\n break;\n case 'y':\n this.fullY = false;\n this.toAxes( '_doZoom', [ _y, this.y1 ], false, true );\n break;\n case 'xy':\n this.fullX = false;\n this.fullY = false;\n this.toAxes( '_doZoom', [ _x, this.x1 ], true, false );\n this.toAxes( '_doZoom', [ _y, this.y1 ], false, true );\n break;\n\n case 'forceY2':\n\n this.fullX = false;\n this.fullY = false;\n\n this.toAxes( '_doZoom', [ _x, this.x1 ], true, false );\n this.toAxes( '_doZoom', [ this.y1, this.y2 ], false, true );\n\n break;\n }\n\n // graph.prevent( true ); // WHat are you doing ??\n graph.draw();\n\n if ( this._backedUpZoomMode ) {\n this._zoomingMode = this._backedUpZoomMode;\n }\n\n this.emit( 'zoomed' );\n\n graph.pluginYieldActiveState();\n\n }\n\n }\n\n /**\n * @private\n */\n removeZone() {\n\n this._zoomingSquare.setAttribute( 'display', 'none' );\n }\n\n /**\n * @private\n */\n onMouseWheel( delta, e, coordX, coordY, options ) {\n\n if ( !options ) {\n options = {};\n }\n\n if ( !options.baseline ) {\n options.baseline = 0;\n }\n\n let baseline = options.baseline;\n\n if ( options.baseline == 'mousePosition' ) {\n baseline = this.graph.getYAxis().getVal( coordY );\n console.log( baseline );\n }\n\n /*var serie;\n if ( ( serie = this.graph.getSelectedSerie() ) ) {\n\n if ( serie.getYAxis().handleMouseWheel( delta, e ) ) {\n return;\n }\n }*/\n\n var doX = ( options.direction == 'x' );\n var doY = !( options.direction !== 'y' );\n\n this.toAxes( 'handleMouseWheel', [ delta, e, baseline ], doX, doY );\n\n this.graph.drawSeries();\n\n }\n\n /**\n * @private\n */\n onDblClick( x, y, e, pref, mute ) {\n\n var graph = this.graph;\n this.emit( 'beforeDblClick', {\n graph: graph,\n x: x,\n y: y,\n pref: pref,\n e: e,\n mute: mute\n } );\n\n if ( graph.prevent( false ) ) {\n return;\n }\n\n if ( this.options.transition || this.options.smooth ) {\n\n var modeX = false,\n modeY = false;\n\n if ( pref.mode == 'xtotal' || pref.mode == 'total' ) {\n\n this.toAxes( function( axis ) {\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getMinValue() - ( axis.options.axisDataSpacing.min * axis.getInterval() );\n axis._pluginZoomMaxFinal = axis.getMaxValue() + ( axis.options.axisDataSpacing.max * axis.getInterval() );\n\n }, false, true, false );\n\n modeX = true;\n\n }\n\n if ( pref.mode == 'ytotal' || pref.mode == 'total' ) {\n\n this.toAxes( function( axis ) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getMinValue() - ( axis.options.axisDataSpacing.min * axis.getInterval() );\n axis._pluginZoomMaxFinal = axis.getMaxValue() + ( axis.options.axisDataSpacing.max * axis.getInterval() );\n\n }, false, false, true );\n\n modeY = true;\n\n }\n\n let x, y;\n\n if ( pref.mode == 'gradualX' || pref.mode == 'gradualY' || pref.mode == 'gradual' || pref.mode == 'gradualXY' ) {\n\n x = false,\n y = false;\n\n if ( pref.mode == 'gradualX' || pref.mode == 'gradual' || pref.mode == 'gradualXY' ) {\n x = true;\n modeX = true;\n }\n\n if ( pref.mode == 'gradualY' || pref.mode == 'gradual' || pref.mode == 'gradualXY' ) {\n y = true;\n modeY = true;\n }\n\n this.toAxes( function( axis ) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getCurrentMin() - ( axis.getCurrentMax() - axis.getCurrentMin() );\n axis._pluginZoomMaxFinal = axis.getCurrentMax() + ( axis.getCurrentMax() - axis.getCurrentMin() );\n\n }, false, x, y );\n\n }\n\n this.transition( modeX, modeY, 'dblClick' );\n return;\n }\n\n var xAxis = this.graph.getXAxis(),\n yAxis = this.graph.getYAxis();\n\n if ( pref.mode == 'xtotal' ) {\n\n this.toAxes( 'setMinMaxToFitSeries', null, true, false );\n this.fullX = true;\n this.fullY = false;\n\n } else if ( pref.mode == 'ytotal' ) {\n\n this.toAxes( 'setMinMaxToFitSeries', null, false, true );\n this.fullX = false;\n this.fullY = true;\n\n } else if ( pref.mode == 'total' ) {\n\n this.toAxes( 'setMinMaxToFitSeries', null, true, true );\n\n this.fullX = true;\n this.fullY = true;\n // Nothing to do here\n /* this.graph._applyToAxes( function( axis ) {\n\n axis.emit( 'zoom', axis.currentAxisMin, axis.currentAxisMax, axis );\n\n }, null, true, true );\n*/\n } else {\n\n x -= this.graph.options.paddingLeft;\n y -= this.graph.options.paddingTop;\n\n var\n xMin = xAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n xActual = xAxis.getVal( x ),\n diffX = xMax - xMin,\n\n yMin = yAxis.getCurrentMin(),\n yMax = yAxis.getCurrentMax(),\n yActual = yAxis.getVal( y ),\n diffY = yMax - yMin;\n\n if ( pref.mode == 'gradualXY' || pref.mode == 'gradualX' ) {\n\n var ratio = ( xActual - xMin ) / ( xMax - xMin );\n xMin = Math.max( xAxis.getMinValue() - xAxis.getInterval() * xAxis.options.axisDataSpacing.min, xMin - diffX * ratio );\n xMax = Math.min( xAxis.getMaxValue() + xAxis.getInterval() * xAxis.options.axisDataSpacing.max, xMax + diffX * ( 1 - ratio ) );\n xAxis.setCurrentMin( xMin );\n xAxis.setCurrentMax( xMax );\n\n if ( xAxis.options.onZoom ) {\n xAxis.options.onZoom( xMin, xMax );\n }\n\n xAxis.cacheCurrentMin();\n xAxis.cacheCurrentMax();\n xAxis.cacheInterval();\n\n }\n\n if ( pref.mode == 'gradualXY' || pref.mode == 'gradualY' ) {\n\n var ratio = ( yActual - yMin ) / ( yMax - yMin );\n yMin = Math.max( yAxis.getMinValue() - yAxis.getInterval() * yAxis.options.axisDataSpacing.min, yMin - diffY * ratio );\n yMax = Math.min( yAxis.getMaxValue() + yAxis.getInterval() * yAxis.options.axisDataSpacing.max, yMax + diffY * ( 1 - ratio ) );\n yAxis.setCurrentMin( yMin );\n yAxis.setCurrentMax( yMax );\n\n if ( yAxis.options.onZoom ) {\n yAxis.options.onZoom( yMin, yMax );\n }\n\n yAxis.cacheCurrentMin();\n yAxis.cacheCurrentMax();\n yAxis.cacheInterval();\n\n }\n\n }\n\n graph.pluginYieldActiveState();\n\n this.graph.draw();\n /*\n this.emit( \"dblClick\", {\n graph: graph,\n x: x,\n y: y,\n pref: pref,\n e: e,\n mute: mute\n } );\n\n if ( this.options.onDblClick && !mute ) {\n this.options.onDblClick( graph, x, y, e, mute );\n }*/\n\n }\n\n transition( modeX, modeY, eventName ) {\n\n var self = this,\n maxTime = 500;\n\n if ( !self.gradualUnzoomStart ) {\n self.gradualUnzoomStart = Date.now();\n }\n\n window.requestAnimationFrame( function() {\n\n var dt = Date.now() - self.gradualUnzoomStart;\n\n if ( dt > maxTime ) {\n dt = maxTime;\n }\n var progress = Math.sin( dt / maxTime * Math.PI / 2 );\n\n self.toAxes( function( axis ) {\n\n axis.setCurrentMin( axis._pluginZoomMin + ( axis._pluginZoomMinFinal - axis._pluginZoomMin ) * progress );\n axis.setCurrentMax( axis._pluginZoomMax + ( axis._pluginZoomMaxFinal - axis._pluginZoomMax ) * progress );\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n\n }, false, modeX, modeY );\n\n self.graph.draw();\n\n if ( dt < maxTime ) {\n\n self.transition( modeX, modeY, eventName );\n self.emit( 'zooming' );\n\n } else {\n\n self.emit( 'zoomed' );\n self.graph.pluginYieldActiveState();\n\n if ( eventName ) {\n self.emit( eventName );\n }\n self.gradualUnzoomStart = 0;\n\n }\n\n } );\n }\n\n isFullX() {\n return this.fullX;\n }\n\n isFullY() {\n return this.fullY;\n }\n\n toAxes( func, params, tb, lr ) {\n\n var axes = this.options.axes;\n\n if ( !axes || ( axes == 'serieSelected' && !this.graph.getSelectedSerie() ) ) {\n axes = 'all';\n }\n\n switch ( axes ) {\n\n case 'all':\n this.graph._applyToAxes.apply( this.graph, arguments );\n break;\n\n case 'serieSelected':\n\n var serie = this.graph.getSelectedSerie();\n if ( serie ) {\n\n if ( tb ) {\n\n if ( typeof func == 'string' ) {\n serie.getXAxis()[ func ].apply( serie.getXAxis(), params );\n } else {\n func.apply( serie.getXAxis(), params );\n }\n }\n\n if ( lr ) {\n\n if ( typeof func == 'string' ) {\n serie.getYAxis()[ func ].apply( serie.getYAxis(), params );\n } else {\n func.apply( serie.getYAxis(), params );\n }\n\n }\n }\n\n break;\n\n default:\n\n if ( !Array.isArray( axes ) ) {\n axes = [ axes ];\n }\n\n for ( let axis of axes ) {\n\n if ( axis.isX() && tb ) { // Not the best check\n\n if ( typeof func == 'string' ) {\n axis[ func ].apply( axis, params );\n } else {\n func.apply( axis, params );\n }\n\n } else if ( axis.isY() && lr ) { // Not the best check\n\n if ( typeof func == 'string' ) {\n axis[ func ].apply( axis, params );\n } else {\n func.apply( axis, params );\n }\n\n }\n }\n break;\n }\n }\n\n}\n\nexport default PluginZoom;","var memory = {},\n memoryHead = {},\n memoryCount = {},\n memoryLimit = {};\n\nfunction emptyMemory( store ) {\n memory[ store ] = {};\n memoryCount[ store ] = 0;\n}\n\nfunction createStoreMemory( store, limit ) {\n limit = limit || 50;\n if ( !memory[ store ] ) {\n memory[ store ] = {};\n memoryCount[ store ] = 0;\n }\n\n memoryLimit[ store ] = limit;\n}\n\nfunction getFromMemory( store, index ) {\n var obj, head;\n\n if ( memory[ store ] && memory[ store ][ index ] ) {\n\n head = memoryHead[ store ];\n\n obj = memory[ store ][ index ];\n obj.prev = head;\n obj.next = head.next;\n head.next.prev = obj;\n head.next = obj;\n\n memoryHead[ store ] = obj;\n return obj.data;\n }\n}\n\nfunction storeInMemory( store, index, data ) {\n\n var toStore, toDelete, head;\n if ( memory[ store ] && memoryCount[ store ] !== undefined && memoryLimit[ store ] ) {\n head = memoryHead[ store ];\n\n if ( memory[ store ][ index ] ) {\n\n getFromMemory( store, index );\n memory[ store ][ index ].data.data = data;\n memory[ store ][ index ].data.timeout = Date.now();\n\n } else {\n\n toStore = {\n data: {\n data: data,\n timeout: Date.now()\n }\n };\n\n if ( typeof head == 'undefined' ) {\n toStore.prev = toStore;\n toStore.next = toStore;\n } else {\n toStore.prev = head.prev;\n toStore.next = head.next;\n head.next.prev = toStore;\n head.next = toStore;\n }\n\n memoryHead[ store ] = toStore;\n memory[ store ][ index ] = toStore;\n memoryCount[ store ]++;\n }\n\n // Remove oldest one\n if ( memoryCount[ store ] > memoryLimit[ store ] && head ) {\n toDelete = head.next;\n head.next.next.prev = head;\n head.next = head.next.next;\n toDelete.next.next = undefined;\n toDelete.next.prev = undefined;\n memoryCount[ store ]--;\n }\n\n return data;\n }\n}\n\nexport function create( store, limitMemory ) {\n createStoreMemory( store, limitMemory );\n}\n\nexport function get( store, index ) {\n var result;\n if ( ( result = getFromMemory( store, index ) ) != undefined ) {\n return result;\n }\n}\n\nexport function store( store, index, value ) {\n storeInMemory( store, index, value );\n return value;\n}\n\nexport function empty( store ) {\n emptyMemory( store );\n}\n\nexport function exist( store ) {\n return ( memory[ store ] );\n}\n\nexport default get;","import Graph from '../graph.core.js';\nimport LRU from '../graph.lru.js';\nimport Plugin from './graph.plugin.js';\nimport * as util from '../graph.util.js';\n\n/**\n * @class PluginTimeSerieManager\n * @implements Plugin\n */\nclass PluginTimeSerieManager extends Plugin {\n\n constructor() {\n\n super( ...arguments );\n\n this.series = [];\n this.plugins = [];\n this.currentSlots = {};\n\n this.requestLevels = new Map();\n this.update = ( noRecalculate, force ) => {\n\n this.series.forEach( function( serie ) {\n\n this.updateSerie( serie, noRecalculate );\n\n } );\n\n if ( !noRecalculate ) {\n this.recalculateSeries( force );\n }\n };\n\n }\n\n static\n default () {\n\n return {\n\n LRUName: 'PluginTimeSerieManager',\n intervals: [ 1000, 15000, 60000, 900000, 3600000, 8640000 ],\n maxParallelRequests: 3,\n optimalPxPerPoint: 2,\n nbPoints: 1000,\n url: ''\n };\n }\n\n /**\n * Init method\n * @private\n * @memberof PluginTimeSerieManager\n */\n init( graph, options ) {\n this.graph = graph;\n LRU.create( this.options.LRUName, 200 );\n this.requestsRunning = 0;\n\n }\n\n setURL( url ) {\n this.options.url = url;\n return this;\n }\n\n setAvailableIntervals() {\n this.options.intervals = arguments;\n }\n\n newSerie( serieName, serieOptions, serieType, dbElements, noZoneSerie ) {\n var s = this.graph.newSerie( serieName, serieOptions, serieType );\n\n this.currentSlots[ serieName ] = {\n min: 0,\n max: 0,\n interval: 0\n };\n\n s.on( 'hide', function() {\n\n if ( s._zoneSerie ) {\n\n s._zoneSerie.hide();\n }\n } );\n\n s.on( 'show', function() {\n\n if ( s._zoneSerie ) {\n s._zoneSerie.show();\n }\n } );\n\n s.setInfo( 'timeSerieManagerDBElements', dbElements );\n\n if ( !noZoneSerie ) {\n s._zoneSerie = this.graph.newSerie( serieName + '_zone', {}, Graph.SERIE_ZONE );\n }\n\n this.series.push( s );\n return s;\n }\n\n registerPlugin( plugin, event ) {\n\n var index;\n if ( ( index = this.plugins.indexOf( plugin ) ) > -1 ) {\n\n for ( var i = 1; i < arguments.length; i++ ) {\n plugin.removeListener( arguments[ i ], this.update );\n }\n }\n\n for ( var i = 1; i < arguments.length; i++ ) {\n plugin.on( arguments[ i ], this.update );\n }\n }\n\n updateSerie( serie, noRecalculate ) {\n\n var self = this;\n var from = serie.getXAxis().getCurrentMin();\n var to = serie.getXAxis().getCurrentMax();\n var priority = 1;\n\n var optimalInterval = this.getOptimalInterval( to - from );\n var optimalIntervalIndex = this.options.intervals.indexOf( optimalInterval );\n var interval;\n\n this.cleanRegister( optimalIntervalIndex );\n\n for ( var i = optimalIntervalIndex; i <= optimalIntervalIndex + 1; i++ ) {\n\n interval = this.options.intervals[ i ];\n var startSlotId = self.computeSlotID( from, interval );\n var endSlotId = self.computeSlotID( to, interval );\n\n var intervalMultipliers = [\n [ 2, 5, 6 ],\n [ 1, 2, 4 ],\n [ 0, 1, 3 ]\n ];\n\n intervalMultipliers.forEach( function( multiplier ) {\n\n var firstSlotId = startSlotId - multiplier[ 0 ] * ( endSlotId - startSlotId );\n var lastSlotId = endSlotId + multiplier[ 0 ] * ( endSlotId - startSlotId );\n\n var slotId = firstSlotId;\n\n while ( slotId <= lastSlotId ) {\n\n if ( self.computeTimeMin( slotId, interval ) > Date.now() ) {\n break;\n }\n\n self.register( serie, slotId, interval, interval == optimalInterval ? multiplier[ 1 ] : multiplier[ 2 ], true, noRecalculate );\n slotId++;\n }\n\n } );\n\n }\n\n this.processRequests();\n }\n\n cleanRegister( interval ) {\n\n if ( !this.requestLevels ) {\n return;\n }\n\n this.requestLevels.forEach( ( levelArray ) => {\n\n levelArray.forEach( ( levelElement, levelIndex ) => {\n\n if ( levelElement[ 4 ] < interval ) {\n levelArray.splice( levelIndex, 1 );\n }\n } );\n\n } );\n }\n\n register( serie, slotId, interval, priority, noProcess, noRecalculate ) {\n\n var id = this.computeUniqueID( serie, slotId, interval );\n\n var data = LRU.get( this.options.LRUName, id );\n\n if ( !data || ( this.computeTimeMax( slotId, interval ) > Date.now() && data.timeout < ( Date.now() - ( noRecalculate ? 5000 : 100000 ) ) ) && priority == 1 ) {\n\n this.request( serie, slotId, interval, priority, id, noProcess );\n }\n }\n\n request( serie, slotId, interval, priority, slotName, noProcess ) {\n\n for ( var i in this.requestLevels ) {\n\n if ( i == priority ) {\n continue;\n }\n\n if ( this.requestLevels[ i ][ slotName ] ) {\n\n if ( this.requestLevels[ i ][ slotName ][ 0 ] !== 1 ) { // If the request is not pending\n\n delete this.requestLevels[ i ][ slotName ];\n\n } else {\n this.requestLevels[ i ][ slotName ][ 5 ] = priority;\n }\n\n }\n }\n\n if ( this.requestLevels[ priority ] && this.requestLevels[ priority ][ slotName ] ) {\n return;\n }\n\n this.requestLevels[ priority ] = this.requestLevels[ priority ] || {};\n this.requestLevels[ priority ][ slotName ] = [ 0, slotName, serie.getName(), slotId, interval, priority, serie.getInfo( 'timeSerieManagerDBElements' ) ];\n\n if ( !noProcess ) {\n this.processRequests();\n }\n }\n\n processRequests() {\n\n if ( this.requestsRunning >= this.options.maxParallelRequests ) {\n return;\n }\n\n var self = this,\n currentLevelChecking = 1,\n requestToMake;\n\n while ( true ) {\n\n for ( var i in this.requestLevels[ currentLevelChecking ] ) {\n\n if ( this.requestLevels[ currentLevelChecking ][ i ][ 0 ] == 1 ) { // Running request\n continue;\n }\n\n requestToMake = this.requestLevels[ currentLevelChecking ][ i ];\n break;\n }\n\n if ( requestToMake ) {\n break;\n }\n\n currentLevelChecking++;\n\n if ( currentLevelChecking > 10 ) {\n return;\n }\n\n }\n\n this.requestsRunning++;\n\n if ( !requestToMake ) {\n return;\n }\n\n requestToMake[ 0 ] = 1;\n\n util.ajaxGet( {\n\n url: this.getURL( requestToMake ),\n method: 'GET',\n json: true\n\n } ).done( function( data ) {\n\n if ( data.status == 1 ) { // Success\n\n self.requestsRunning--;\n\n delete self.requestLevels[ currentLevelChecking ][ i ];\n\n LRU.store( self.options.LRUName, requestToMake[ 1 ], data.data ); // Element 1 is the unique ID\n self.processRequests();\n\n if ( requestToMake[ 5 ] == 1 && Object.keys( self.requestLevels[ 1 ] ).length == 0 ) {\n\n self.recalculateSeries( true );\n }\n }\n\n } );\n }\n\n computeTimeMax( slotId, interval ) {\n return ( slotId + 1 ) * ( interval * this.options.nbPoints );\n }\n\n computeTimeMin( slotId, interval ) {\n return ( slotId ) * ( interval * this.options.nbPoints );\n }\n\n getURL( requestElements ) {\n\n var url = this.options.url\n .replace( '', requestElements[ 2 ] )\n .replace( '', this.computeTimeMin( requestElements[ 3 ], requestElements[ 4 ] ) )\n .replace( '', this.computeTimeMax( requestElements[ 3 ], requestElements[ 4 ] ) )\n .replace( '', requestElements[ 4 ] );\n\n var dbElements = requestElements[ 6 ] || {};\n\n for ( var i in dbElements ) {\n url = url.replace( '<' + i + '>', dbElements[ i ] );\n }\n\n return url;\n }\n\n getOptimalInterval( totalspan ) {\n\n var optimalInterval = ( this.options.optimalPxPerPoint || 1 ) * totalspan / this.graph.getDrawingWidth(),\n diff = Infinity,\n optimalIntervalAmongAvailable;\n\n this.options.intervals.forEach( function( interval ) {\n\n var newDiff = Math.min( diff, Math.abs( interval - optimalInterval ) );\n if ( diff !== newDiff ) {\n\n optimalIntervalAmongAvailable = interval;\n diff = newDiff;\n }\n } );\n\n return optimalIntervalAmongAvailable || 1000;\n }\n\n computeUniqueID( serie, slotId, interval ) {\n var extra = '';\n var info = serie.getInfo( 'timeSerieManagerDBElements' );\n for ( var i in info ) {\n extra += ';' + i + ':' + info[ i ];\n }\n\n return serie.getName() + ';' + slotId + ';' + interval + extra;\n }\n\n computeSlotID( time, interval ) {\n return Math.floor( time / ( interval * this.options.nbPoints ) );\n }\n\n computeSlotTime( slotId, interval ) {\n return slotId * ( interval * this.options.nbPoints );\n }\n\n getZoneSerie( serie ) {\n return serie._zoneSerie;\n }\n\n updateZoneSerie( serieName ) {\n\n var serie = this.graph.getSerie( serieName );\n\n if ( !serie ) {\n return;\n }\n\n if ( !serie._zoneSerie ) {\n return;\n }\n\n serie._zoneSerie.setXAxis( serie.getXAxis() );\n serie._zoneSerie.setYAxis( serie.getYAxis() );\n serie._zoneSerie.setFillColor( serie.getLineColor() );\n serie._zoneSerie.setLineColor( serie.getLineColor() );\n serie._zoneSerie.setFillOpacity( 0.2 );\n serie._zoneSerie.setLineOpacity( 0.3 );\n }\n\n recalculateSeries( force ) {\n\n var self = this;\n\n if ( this.locked ) {\n return;\n }\n\n this.changed = false;\n\n this.series.map( function( serie ) {\n self.recalculateSerie( serie, force );\n } );\n\n /*if ( this.changed ) {\n self.graph._applyToAxes( \"scaleToFitAxis\", [ this.graph.getXAxis(), false, undefined, undefined, false, true ], false, true );\n }\n */\n this.changed = false;\n //self.graph.autoscaleAxes();\n\n self.graph.draw();\n }\n\n recalculateSerie( serie, force ) {\n\n var from = serie.getXAxis().getCurrentMin(),\n to = serie.getXAxis().getCurrentMax(),\n interval = this.getOptimalInterval( to - from );\n\n var startSlotId = this.computeSlotID( from, interval );\n var endSlotId = this.computeSlotID( to, interval );\n\n var data = [];\n var dataMinMax = [];\n\n if ( !force && interval == this.currentSlots[ serie.getName() ].interval && this.currentSlots[ serie.getName() ].min <= startSlotId && this.currentSlots[ serie.getName() ].max >= endSlotId ) {\n return;\n }\n\n startSlotId -= 2;\n endSlotId += 2;\n\n this.currentSlots[ serie.getName() ].min = startSlotId;\n this.currentSlots[ serie.getName() ].max = endSlotId;\n this.currentSlots[ serie.getName() ].interval = interval;\n\n var slotId = startSlotId;\n\n while ( slotId <= endSlotId ) {\n\n const lruData = LRU.get( this.options.LRUName, this.computeUniqueID( serie, slotId, interval ) );\n if ( lruData ) {\n\n data = data.concat( lruData.data.mean );\n dataMinMax = dataMinMax.concat( lruData.data.minmax );\n\n } else {\n\n this.recalculateSerieUpwards( serie, slotId, interval, data, dataMinMax );\n }\n\n slotId++;\n }\n\n this.changed = true;\n\n serie.setData( data );\n\n if ( serie._zoneSerie ) {\n serie._zoneSerie.setData( dataMinMax );\n }\n }\n\n setIntervalCheck( interval ) {\n\n if ( this.interval ) {\n clearInterval( this.interval );\n }\n\n this.update( true, true );\n this.interval = setInterval( () => {\n this.update( true, false );\n }, interval );\n }\n\n recalculateSerieUpwards( serie, downSlotId, downInterval, data, dataMinMax ) {\n\n var intervals = this.options.intervals.slice( 0 );\n intervals.sort();\n\n var nextInterval = intervals[ intervals.indexOf( downInterval ) + 1 ] || -1;\n if ( nextInterval < 0 ) {\n return [];\n }\n\n var newSlotTime = this.computeSlotTime( downSlotId, downInterval );\n var newSlotTimeEnd = this.computeSlotTime( downSlotId + 1, downInterval );\n var newSlotId = this.computeSlotID( newSlotTime, nextInterval ),\n start = false;\n\n const lruData = LRU.get( this.options.LRUName, this.computeUniqueID( serie, newSlotId, nextInterval ) );\n if ( lruData ) {\n\n for ( var i = 0, l = lruData.data.mean.length; i < l; i += 2 ) {\n\n if ( lruData.data.mean[ i ] < newSlotTime ) {\n continue;\n\n } else if ( start === false ) {\n start = i;\n }\n\n if ( lruData.data.mean[ i ] >= newSlotTimeEnd ) {\n\n data = data.concat( lruData.data.mean.slice( start, i ) );\n dataMinMax = data.concat( lruData.data.minmax.slice( start, i ) );\n\n return;\n }\n }\n }\n\n return this.recalculateSerieUpwards( serie, newSlotId, nextInterval, data, dataMinMax );\n }\n\n lockRedraw() {\n this.locked = true;\n }\n\n unlockRedraw() {\n this.locked = false;\n }\n\n isRedrawLocked() {\n return !!this.locked;\n }\n}\n\nexport default PluginTimeSerieManager;","import Plugin from './graph.plugin.js';\n\n/**\n * @class PluginSerieLineDifference\n * @implements Plugin\n */\nclass PluginSerieLineDifference extends Plugin {\n\n constructor() {\n super( ...arguments );\n }\n\n static\n default () {\n return {\n\n positiveStyle: {\n\n fillColor: 'green',\n fillOpacity: 0.2,\n strokeWidth: 0\n },\n\n negativeStyle: {\n fillColor: 'red',\n fillOpacity: 0.2,\n strokeWidth: 0\n },\n\n from: 0,\n to: 0\n };\n }\n\n /**\n * Init method\n * @private\n */\n init( graph, options ) {\n this.graph = graph;\n\n this.pathsPositive = [];\n this.pathsNegative = [];\n\n this.positivePolyline = this.graph.newShape( 'polyline' ).draw();\n\n this.positivePolyline.\n setFillColor( this.options.positiveStyle.fillColor ).\n setFillOpacity( this.options.positiveStyle.fillOpacity ).\n setStrokeWidth( this.options.positiveStyle.strokeWidth ).\n applyStyle();\n\n this.negativePolyline = this.graph.newShape( 'polyline' ).draw();\n\n this.negativePolyline.\n setFillColor( this.options.negativeStyle.fillColor ).\n setFillOpacity( this.options.negativeStyle.fillOpacity ).\n setStrokeWidth( this.options.negativeStyle.strokeWidth ).\n applyStyle();\n }\n\n /**\n * Assigns the two series for the shape. Postive values are defined when ```serieTop``` is higher than ```serieBottom```.\n * @param {SerieLine} serieTop - The top serie\n * @param {SerieLine} serieBottom - The bottom serie\n */\n setSeries( serieTop, serieBottom ) {\n this.serie1 = serieTop;\n this.serie2 = serieBottom;\n }\n\n /**\n * Assigns the boundaries\n */\n setBoundaries( from, to ) {\n this.options.from = from;\n this.options.to = to;\n }\n\n /**\n * @returns the starting value used to draw the zone\n */\n getFrom() {\n return this.options.from;\n }\n\n /**\n * @returns the ending value used to draw the zone\n */\n getTo() {\n return this.options.to;\n }\n\n /**\n * Calculates and draws the zone series\n * @returns {Plugin} The current plugin instance\n */\n draw() {\n\n var self = this;\n var s1 = this.serie1.searchClosestValue( this.getFrom() );\n var i1, j1, i2, j2, y, y2, crossing;\n\n var top = [];\n var bottom = [];\n\n var bottomBroken;\n\n if ( !s1 ) {\n i1 = 0;\n j1 = 0;\n } else {\n\n i1 = s1.dataIndex;\n j1 = s1.xAfterIndex * 2;\n }\n\n y = this.interpolate( this.serie1, this.getFrom() );\n top.push( this.getFrom() ); // x\n top.push( y ); // y\n\n y = this.interpolate( this.serie2, this.getFrom() );\n bottom.push( this.getFrom() ); // x\n bottom.push( y ); // y\n\n var s2;\n\n var order;\n\n function nextSet() {\n\n if ( order === true ) {\n self.pathsPositive.push( [ top, bottom ] );\n } else if ( order === false ) {\n self.pathsNegative.push( [ top, bottom ] );\n }\n\n top = [];\n bottom = [];\n order = undefined;\n }\n var ended;\n for ( ; i1 < this.serie1.data.length; i1++ ) {\n\n for ( ; j1 < this.serie1.data[ i1 ].length; j1 += 2 ) {\n\n if ( this.serie1.data[ i1 ][ j1 ] > this.getTo() ) { // FINISHED !\n\n y = this.interpolate( this.serie1, this.getTo() );\n y2 = this.interpolate( this.serie2, this.getTo() );\n\n crossing = this.computeCrossing(\n top[ top.length - 2 ], top[ top.length - 1 ],\n this.getTo(), y,\n bottom[ bottom.length - 2 ], bottom[ bottom.length - 1 ],\n this.getTo(), y2\n );\n\n if ( crossing ) {\n\n top.push( crossing.x );\n top.push( crossing.y );\n bottom.push( crossing.x );\n bottom.push( crossing.y );\n nextSet();\n top.push( crossing.x );\n top.push( crossing.y );\n bottom.push( crossing.x );\n bottom.push( crossing.y );\n\n order = this.serie1.data[ i1 ][ j1 + 1 ] > this.serie2.data[ i2 ][ j2 + 1 ];\n }\n\n top.push( this.getTo() ); // x\n top.push( y ); // y\n\n bottom.push( this.getTo() ); // x\n bottom.push( y2 ); // y\n\n ended = true;\n break;\n }\n\n if ( !s2 ) {\n s2 = this.serie2.searchClosestValue( this.serie1.data[ i1 ][ j1 ] ); // Finds the first point\n\n if ( s2 ) {\n i2 = s2.dataIndex;\n j2 = s2.xBeforeIndex * 2;\n\n // TODO: Add here first points\n\n y = this.interpolate( this.serie2, this.serie1.data[ i1 ][ j1 ] );\n\n top.push( this.serie1.data[ i1 ][ j1 ] ); // x\n top.push( this.serie1.data[ i1 ][ j1 + 1 ] ); // y\n\n bottom.push( this.serie1.data[ i1 ][ j1 ] ); // x\n bottom.push( y ); // y\n\n order = this.serie1.data[ i1 ][ j1 + 1 ] > y;\n\n } else {\n continue;\n }\n }\n\n bottomBroken = false;\n\n crossing = this.computeCrossing(\n top[ top.length - 2 ], top[ top.length - 1 ],\n this.serie1.data[ i1 ][ j1 ], this.serie1.data[ i1 ][ j1 + 1 ],\n bottom[ bottom.length - 2 ], bottom[ bottom.length - 1 ],\n this.serie2.data[ i2 ][ j2 ], this.serie2.data[ i2 ][ j2 + 1 ]\n );\n\n if ( crossing ) {\n\n top.push( crossing.x );\n top.push( crossing.y );\n bottom.push( crossing.x );\n bottom.push( crossing.y );\n nextSet();\n top.push( crossing.x );\n top.push( crossing.y );\n bottom.push( crossing.x );\n bottom.push( crossing.y );\n\n order = this.serie1.data[ i1 ][ j1 + 1 ] > this.serie2.data[ i2 ][ j2 + 1 ];\n }\n\n while ( this.serie2.data[ i2 ][ j2 ] < this.serie1.data[ i1 ][ j1 ] ) {\n\n bottom.push( this.serie2.data[ i2 ][ j2 ] );\n bottom.push( this.serie2.data[ i2 ][ j2 + 1 ] );\n\n j2 += 2;\n if ( j2 == this.serie2.data[ i2 ].length ) {\n bottomBroken = this.serie2.data[ i2 ][ j2 - 2 ];\n i2++;\n j2 = 0;\n break;\n }\n\n crossing = this.computeCrossing(\n top[ top.length - 2 ], top[ top.length - 1 ],\n this.serie1.data[ i1 ][ j1 ], this.serie1.data[ i1 ][ j1 + 1 ],\n bottom[ bottom.length - 2 ], bottom[ bottom.length - 1 ],\n this.serie2.data[ i2 ][ j2 ], this.serie2.data[ i2 ][ j2 + 1 ]\n );\n\n if ( crossing ) {\n\n top.push( crossing.x );\n top.push( crossing.y );\n bottom.push( crossing.x );\n bottom.push( crossing.y );\n nextSet();\n top.push( crossing.x );\n top.push( crossing.y );\n bottom.push( crossing.x );\n bottom.push( crossing.y );\n\n order = this.serie1.data[ i1 ][ j1 + 1 ] > this.serie2.data[ i2 ][ j2 + 1 ];\n }\n\n }\n\n if ( bottomBroken === false ) {\n top.push( this.serie1.data[ i1 ][ j1 ] );\n top.push( this.serie1.data[ i1 ][ j1 + 1 ] );\n } else {\n\n top.push( bottomBroken );\n top.push( this.interpolate( this.serie1, bottomBroken ) );\n\n s2 = false;\n j1 -= 2;\n nextSet();\n }\n\n }\n\n if ( ended ) {\n nextSet();\n break;\n }\n // End of X\n\n y = this.interpolate( this.serie2, top[ top.length - 2 ] );\n if ( y ) {\n bottom.push( top[ top.length - 2 ] );\n bottom.push( y );\n }\n\n nextSet();\n\n j1 = 0;\n s2 = false;\n }\n\n var d = this.pathsPositive.reduce( makePaths, '' );\n this.positivePolyline.setPointsPx( d ).redraw();\n\n var d = this.pathsNegative.reduce( makePaths, '' );\n this.negativePolyline.setPointsPx( d ).redraw();\n\n //pathsBottom.map( function( map ) { makePaths( map, self.options.negativeStyle ); } );\n\n function makePaths( d, path ) {\n\n for ( var i = 0; i < path[ 0 ].length; i += 2 ) {\n if ( i == 0 ) {\n d += 'M ';\n }\n d += ' ' + Math.round( self.serie1.getXAxis().getPx( path[ 0 ][ i ] ) ) + ', ' + Math.round( self.serie1.getYAxis().getPx( path[ 0 ][ i + 1 ] ) );\n if ( i < path[ 0 ].length - 2 ) {\n d += ' L ';\n }\n }\n\n for ( var i = path[ 1 ].length - 2; i >= 0; i -= 2 ) {\n d += ' L ' + Math.round( self.serie2.getXAxis().getPx( path[ 1 ][ i ] ) ) + ', ' + Math.round( self.serie2.getYAxis().getPx( path[ 1 ][ i + 1 ] ) );\n if ( i == 0 ) {\n d += ' z ';\n }\n }\n return d;\n }\n\n }\n\n /**\n * Finds the interpolated y value at point ```valX``` of the serie ```serie```\n * @returns {(Number|Boolean)} The interpolated y value is possible, ```false``` otherwise\n * @param {Serie} serie - The serie for which the y value should be computed\n * @param {Number} valX - The x value\n */\n interpolate( serie, valX ) {\n\n var value = serie.searchClosestValue( valX );\n\n if ( !value ) {\n return false;\n }\n\n if ( value.xMax == undefined ) {\n return value.yMin;\n }\n\n if ( value.xMin == undefined ) {\n return value.yMax;\n }\n\n var ratio = ( valX - value.xMin ) / ( value.xMax - value.xMin );\n return ( ( 1 - ratio ) * value.yMin + ratio * value.yMax );\n }\n\n /**\n * Finds the crossing point between two vector and returns it, or ```false``` if it is not within the x boundaries\n * @returns {(Object|Boolean)} An object containing the crossing point in the following format: ```{ x: xCrossing, y: yCrossing }``` or ```false``` if no crossing point can be found\n * @param {Number} x11 - First x point of the first vector\n * @param {Number} y11 - First y point of the first vector\n * @param {Number} x12 - Second x point of the first vector\n * @param {Number} y12 - Second y point of the first vector\n * @param {Number} x21 - First x point of the second vector\n * @param {Number} y21 - First y point of the second vector\n * @param {Number} y22 - Second x point of the second vector\n * @param {Number} y22 - Second y point of the second vector\n */\n computeCrossing( x11, y11, x12, y12, x21, y21, x22, y22 ) {\n var a1 = ( y12 - y11 ) / ( x12 - x11 );\n var a2 = ( y22 - y21 ) / ( x22 - x21 );\n\n var b1 = y12 - a1 * x12;\n var b2 = y22 - a2 * x22;\n\n if ( x11 == x12 || x21 == x22 ) {\n\n return false;\n }\n\n if ( a1 == a2 ) {\n return {\n x: x11,\n y1: y11,\n y2: y11\n };\n }\n\n var x = ( b1 - b2 ) / ( a2 - a1 );\n\n if ( x > x12 || x < x11 || x < x21 || x > x22 ) {\n return false;\n }\n\n return {\n x: x,\n y: a1 * x + b1\n };\n }\n\n /**\n * @returns The positive polyline\n */\n getPositivePolyline() {\n return this.positivePolyline;\n }\n\n /**\n * @returns The negative polyline\n */\n getNegativePolyline() {\n return this.negativePolyline;\n }\n\n}\n\nexport default PluginSerieLineDifference;","import Graph from '../graph.core.js';\nimport AxisX from '../graph.axis.x.js';\nimport AxisY from '../graph.axis.y.js';\nimport * as util from '../graph.util.js';\nimport SerieLine from '../series/graph.serie.line.js';\nimport SerieScatter from '../series/graph.serie.scatter.js';\nimport Plugin from './graph.plugin.js';\nimport Axis from '../graph.axis.js';\n\nclass SerieLineExtended extends SerieLine {\n\n constructor() {\n super( ...arguments );\n this.subSeries = [];\n }\n\n setData() {\n super.setData( ...arguments );\n this.subSeries.map( ( sub ) => {\n sub.data = this.data;\n } );\n return this;\n }\n\n draw() {\n this.eraseMarkers();\n return this;\n }\n\n getSymbolForLegend() {\n if ( !this.subSeries[ 0 ] ) {\n return false;\n }\n\n return this.subSeries[ 0 ].getSymbolForLegend();\n }\n\n getMarkerForLegend() {\n if ( !this.subSeries[ 0 ] ) {\n return false;\n }\n\n return this.subSeries[ 0 ].getMarkerForLegend();\n }\n}\n\nclass SerieScatterExtended extends SerieScatter {\n\n constructor() {\n super( ...arguments );\n this.subSeries = [];\n }\n\n setData() {\n super.setData( ...arguments );\n this.subSeries.map( ( sub ) => {\n sub.data = this.data;\n } );\n return this;\n }\n\n draw() {\n return this;\n }\n\n getSymbolForLegend() {\n if ( !this.subSeries[ 0 ] ) {\n return false;\n }\n\n return this.subSeries[ 0 ].getSymbolForLegend();\n }\n\n getMarkerForLegend() {\n if ( !this.subSeries[ 0 ] ) {\n return false;\n }\n\n return this.subSeries[ 0 ].getMarkerForLegend();\n }\n}\n\nvar excludingMethods = [\n 'constructor',\n 'init',\n 'draw',\n 'setLineColor',\n 'setLineWidth',\n 'setLineStyle',\n 'getLineColor',\n 'getLineWidth',\n 'getLineStyle',\n 'setMarkers',\n 'showMarkers',\n 'hideMarkers',\n 'getMarkerDom',\n 'getMarkerDomIndependant',\n 'getMarkerPath',\n 'eraseMarkers',\n '_recalculateMarkerPoints'\n];\nvar addMethods = [];\n\nObject.getOwnPropertyNames( SerieLine.prototype ).concat( addMethods ).map( function( i ) {\n\n if ( excludingMethods.indexOf( i ) > -1 ) {\n return;\n }\n\n SerieLineExtended.prototype[ i ] = ( function( j ) {\n\n return function() {\n\n var args = arguments;\n this.subSeries.map( ( subSerie ) => {\n subSerie[ j ]( ...args );\n } );\n };\n\n } )( i );\n} );\n\n/**\n * Axis splitting plugin\n * @augments Plugin\n */\nclass PluginAxisSplitting extends Plugin {\n\n constructor( options ) {\n super( ...arguments );\n this.series = new Map();\n }\n\n static defaults() {\n\n return {\n axes: {\n margins: {\n high: 5,\n low: 5\n }\n }\n };\n }\n\n init( graph ) {\n this.graph = graph;\n }\n\n /**\n * Creates a new bottom split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newXAxis( options ) {\n return this.newBottomAxis( options );\n }\n\n /**\n * Creates a new left split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newYAxis( options ) {\n return this.newLeftAxis( options );\n }\n\n /**\n * Creates a new top split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newTopAxis( options ) {\n options = this.getOptions( options );\n return new SplitXAxis( this.graph, 'top', options );\n }\n\n /**\n * Creates a new bottom split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newBottomAxis( options ) {\n options = this.getOptions( options );\n return new SplitXAxis( this.graph, 'bottom', options );\n }\n\n /**\n * Creates a new left split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newLeftAxis( options ) {\n options = this.getOptions( options );\n return new SplitYAxis( this.graph, 'left', options );\n }\n\n /**\n * Creates a new right split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newRightAxis( options ) {\n options = this.getOptions( options );\n return new SplitYAxis( this.graph, 'right', options );\n }\n\n getOptions( options ) {\n var defaults = {\n marginMin: this.options.axes.margins.low,\n marginMax: this.options.axes.margins.high,\n };\n return util.extend( true, defaults, options );\n }\n\n preDraw() {\n\n var xAxis, yAxis;\n\n // for ( let { serie } of this.series.values() ) {\n this.series.forEach( ( {\n serie\n } ) => {\n\n xAxis = serie.getXAxis();\n yAxis = serie.getYAxis();\n\n let splits = 1;\n\n if ( xAxis.splitNumber ) {\n splits *= xAxis.splitNumber;\n }\n\n if ( yAxis.splitNumber ) {\n splits *= yAxis.splitNumber;\n }\n\n while ( serie.subSeries.length < splits ) {\n\n const name = serie.getName() + '_' + serie.subSeries.length;\n\n const s = this.graph.newSerie( name, {}, serie.getType() || Graph.SERIE_LINE );\n\n s.excludedFromLegend = true;\n s.styles = serie.styles;\n s.data = serie.data; // Copy data\n\n if ( serie.getType() == Graph.SERIE_LINE ) {\n s.markerPoints = serie.markerPoints;\n s.markerFamilies = serie.markerFamilies;\n }\n\n serie.subSeries.push( s );\n }\n\n while ( serie.subSeries.length > splits ) {\n\n let subserie = this.graph.getSerie( serie.getName() + '_' + ( serie.subSeries.length - 1 ) );\n\n if ( subserie && subserie.kill ) {\n subserie.kill();\n }\n serie.subSeries.pop();\n\n }\n\n if ( !serie.getXAxis().splitNumber && serie.getXAxis().splitAxis ) {\n serie.getXAxis().splitAxis();\n }\n\n if ( !serie.getYAxis().splitNumber && serie.getYAxis().splitAxis ) {\n serie.getYAxis().splitAxis();\n }\n\n // Re-assign axes to the sub series\n serie.subSeries.map( ( sserie, index ) => {\n\n var xSubAxis, ySubAxis;\n\n //sserie.groupMarkers = firstSubSerie.groupMarkers;\n\n if ( serie.getXAxis().getSubAxis ) {\n let subAxisIndex = index % ( ( xAxis.splitNumber || 1 ) );\n xSubAxis = serie.getXAxis().getSubAxis( subAxisIndex );\n } else {\n xSubAxis = serie.getXAxis();\n }\n\n sserie.setXAxis( xSubAxis );\n\n if ( serie.getYAxis().getSubAxis ) {\n\n let subAxisIndex = Math.floor( index / ( ( xAxis.splitNumber || 1 ) ) );\n ySubAxis = serie.getYAxis().getSubAxis( subAxisIndex );\n } else {\n ySubAxis = serie.getYAxis();\n }\n\n sserie.setYAxis( ySubAxis );\n\n sserie.draw( true );\n } );\n //}\n\n } );\n\n }\n\n /**\n * Creates a new serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @param {String} type - The type of the serie\n * @return {Serie} The created serie\n */\n newSerie( name, options = {}, type ) {\n\n switch ( type ) {\n\n case 'line':\n return this.newLineSerie( name, options );\n break;\n\n case 'scatter':\n return this.newScatterSerie( name, options );\n break;\n }\n\n throw 'Cannot create a split serie of type ' + type;\n }\n\n /**\n * Creates a new line serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @return {Serie} The created serie\n */\n newLineSerie( name, options ) {\n var serieObj = {\n type: 'lineSerie',\n serie: new SerieLineExtended( name, options, 'line' )\n };\n this.series.set( name, serieObj );\n serieObj.serie.init( this.graph, name, options );\n this.graph.series.push( serieObj.serie );\n return serieObj.serie;\n }\n\n /**\n * Creates a new scatter serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @return {Serie} The created serie\n */\n newScatterSerie( name, options ) {\n var serieObj = {\n type: 'scatterSerie',\n serie: new SerieScatterExtended( name, options, 'scatter' )\n };\n this.series.set( name, serieObj );\n serieObj.serie.init( this.graph, options );\n this.graph.series.push( serieObj.serie );\n return serieObj.serie;\n }\n\n}\n\nvar defaultAxisConstructorOptions = {\n splitMarks: true\n};\n\nvar SplitAxis = function( mixin ) {\n\n var delegateMethods = [\n\n 'turnGridsOff',\n 'turnGridsOn',\n 'gridsOff',\n 'gridsOn',\n 'setEngineering',\n 'setScientificScaleExponent',\n 'setScientific',\n 'setLabelColor',\n 'setSecondaryGridDasharray',\n 'setPrimaryGridDasharray',\n 'setSecondaryGridsOpacity',\n 'setPrimaryGridOpacity',\n 'setSecondaryGridWidth',\n 'setPrimaryGridWidth',\n 'setSecondaryGridColor',\n 'setPrimaryGridColor',\n 'setTicksLabelColor',\n 'setSecondaryTicksColor',\n 'setPrimaryTicksColor',\n 'setAxisColor',\n 'secondaryGridOn',\n 'secondaryGridOff',\n 'primaryGridOff',\n 'primaryGridOn',\n 'setSecondaryGrid',\n 'setPrimaryGrid',\n 'setGrids',\n 'setTickPosition',\n 'setExponentialFactor',\n 'setExponentialLabelFactor',\n 'setGridLinesStyle',\n 'forcePrimaryTickUnitMin',\n 'forcePrimaryTickUnitMax',\n 'forcePrimaryTickUnit',\n 'flip',\n 'show',\n 'hide',\n 'setDisplay'\n ];\n\n /**\n * Split axis\n * @mixes AxisX\n * @mixes AxisY\n * @name SplitAxis\n * @static\n */\n var cl = class SplitAxis extends mixin {\n\n constructor( graph, position, options = {} ) {\n\n super( graph, position, options );\n this.axes = [];\n this.position = position;\n this.constructorOptions = util.extend( true, {}, defaultAxisConstructorOptions, options );\n\n this._splitVal = [];\n }\n\n /**\n * Calls a callback onto each chunk axes. The callback receives two parameters: 1) the ```axis``` itself and 2) the ```index``` of the axis in the stack\n * @param {Function} callback - The callback to be applied to each axes\n * @return {SplitAxis} The current axis instance\n */\n all( callback ) {\n\n if ( !( typeof callback == 'function' ) ) {\n return;\n }\n\n this.axes.map( callback );\n return this;\n }\n\n /**\n * Splits the axis into chunks at the positions defined as a list of parameters.\n * @param {Function} ...splits - The positions of axis splitting\n * @return {SplitAxis} The current axis instance\n * @example axis.splitAxis( 0.2, 0.5, 0.8 ); // Creates 4 chunks (0-20%, 20%-50%, 50%-80%, 80%-100%)\n */\n splitAxis( ...splits ) {\n\n splits.push( 1 );\n let splitNumber = splits.length;\n\n while ( this.axes.length > splitNumber ) {\n this.axes.pop().kill( true, true );\n }\n\n while ( this.axes.length < splitNumber ) {\n let axis = new( this.getConstructor() )( this.graph, this.position, this.constructorOptions );\n this.axes.push( axis );\n axis.zoomLock = true;\n axis.init( this.graph, this.constructorOptions );\n }\n\n let from = 0;\n let i = 0;\n for ( let axis of this.axes ) {\n\n axis.options.marginMin = 10;\n axis.options.marginMax = 10;\n\n if ( i == 0 ) {\n axis.options.marginMin = 0;\n }\n\n if ( i == this.axes.length - 1 ) {\n axis.options.marginMax = 0;\n }\n\n axis.setSpan( from, ( from = splits[ i ] ) );\n axis.setMinMaxFlipped();\n i++;\n }\n\n this._splits = splits;\n return this;\n }\n\n /**\n * Fixes the major tick interval of all axes based on the one provided as a parameter\n * @param {Number} axisIndex - The index of the reference axis (starting at 0)\n * @return {SplitAxis} The current axis instance\n */\n fixGridIntervalBasedOnAxis( axisIndex ) {\n\n this.fixGridFor = axisIndex;\n this.graph._axisHasChanged();\n return this;\n }\n\n /**\n * Spreads the chunks of the axis based on the relative interval of each one of them, so that the unit / px is constant for each chunk\n * @param {Boolean} bln - ```true``` to enable the spread, ```false``` otherwise\n * @return {SplitAxis} The current axis instance\n */\n splitSpread( bln ) {\n this.autoSpread = !!bln;\n return this;\n }\n\n hasAxis( axis ) {\n return this.axes.indexOf( axis ) > -1;\n }\n\n _splitSpread() {\n\n let splits = [],\n total = 0,\n currentSplit = 0;\n //console.log( this._splitVal );\n for ( let split of this._splitVal ) {\n total += split[ 1 ] - split[ 0 ];\n }\n\n for ( let split of this._splitVal ) {\n\n splits.push( currentSplit += ( split[ 1 ] - split[ 0 ] ) / total );\n }\n\n splits.pop();\n this.splitAxis( ...splits );\n }\n\n /**\n * Defines the boundaries of each chunk in axis unit.\n * @param {Array<(Array|Number)>} values - An array of either 2-component arrays (from-to) or number (mean)\n * @example axis.setChunkBoundaries( [ [ 12, 20 ], [ 100, 200 ] ] ); // First chunk from 12 to 20, second one from 100 to 200\n * @example axis.setChunkBoundaries( [ 12, [ 100, 200 ] ] ); // Second chunk from 100 to 200, first chunk with a mean at 12 and min / max determined by the relative widths of the chunks\n * @return {SplitAxis} The current axis instance\n */\n setChunkBoundaries( values ) {\n\n let index = 0,\n baseWidth,\n baseWidthIndex;\n\n for ( let axis of this.axes ) { // List all axes\n\n // Two elements in the array => becomes the new reference\n if ( Array.isArray( values[ index ] ) && values[ index ].length > 1 && !baseWidth ) {\n baseWidth = values[ index ][ 1 ] - values[ index ][ 0 ];\n baseWidthIndex = index;\n }\n\n if ( values[ index ].length == 1 || !Array.isArray( values[ index ] ) ) {\n axis._mean = values[ index ];\n\n if ( Array.isArray( axis._mean ) ) {\n axis._mean = axis._mean[ 0 ];\n }\n\n } else {\n\n axis\n .forceMin( values[ index ][ 0 ] )\n .forceMax( values[ index ][ 1 ] );\n }\n\n index++;\n }\n\n this._baseWidthVal = baseWidth;\n this._baseWidthIndex = baseWidthIndex;\n\n this._splitVal = values;\n\n this.graph._axisHasChanged();\n\n return this;\n }\n\n setMinMaxToFitSeries() {\n\n if ( !this._splitVal || this._splitVal.length < 1 ) {\n super.setMinMaxToFitSeries( ...arguments );\n this._splitVal[ 0 ] = this._splitVal[ 0 ] || [];\n this._splitVal[ this._splitVal.length - 1 ] = this._splitVal[ this._splitVal.length - 1 ] || [];\n\n this._splitVal[ 0 ][ 0 ] = this.getCurrentMin();\n this._splitVal[ this._splitVal.length - 1 ][ 1 ] = this.getCurrentMax();\n this.setChunkBoundaries( this._splitVal );\n }\n }\n\n draw() {\n\n if ( this.autoSpread ) {\n this._splitSpread();\n }\n\n let max = 0;\n let unit;\n let subAxis;\n let spanReference;\n\n if ( this._baseWidthIndex >= 0 && ( subAxis = this.getSubAxis( this._baseWidthIndex ) ) ) {\n spanReference = subAxis.getSpan();\n }\n\n subAxis = undefined;\n\n if ( this.fixGridFor >= 0 && ( subAxis = this.getSubAxis( this.fixGridFor ) ) ) {\n\n if ( subAxis._mean !== undefined ) {\n let width = ( subAxis.getSpan()[ 1 ] - subAxis.getSpan()[ 0 ] ) / ( spanReference[ 1 ] - spanReference[ 0 ] ) * this._baseWidthVal;\n subAxis.forceMin( subAxis._mean - width / 2 );\n subAxis.forceMax( subAxis._mean + width / 2 );\n }\n\n max = subAxis.draw();\n unit = subAxis.getPrimaryTickUnit();\n }\n\n this.axes.map( ( axis ) => {\n\n if ( subAxis === axis ) {\n return;\n }\n\n if ( axis._mean !== undefined ) {\n let width = ( axis.getSpan()[ 1 ] - axis.getSpan()[ 0 ] ) / ( spanReference[ 1 ] - spanReference[ 0 ] ) * this._baseWidthVal;\n axis.forceMin( axis._mean - width / 2 );\n axis.forceMax( axis._mean + width / 2 );\n }\n\n if ( unit ) {\n axis.forcePrimaryTickUnit( unit );\n }\n\n max = Math.max( max, axis.draw() );\n\n } );\n\n // this.drawLabel();\n this.writeUnit();\n\n return max;\n }\n\n setMinPx( min ) {\n\n super.setMinPx( min );\n for ( let axis of this.axes ) {\n axis.setMinPx( min );\n }\n }\n\n setMaxPx( max ) {\n\n super.setMaxPx( max );\n\n for ( let axis of this.axes ) {\n axis.setMaxPx( max );\n }\n }\n\n setShift() {\n\n super.setShift( ...arguments );\n\n for ( let axis of this.axes ) {\n axis.setShift( ...arguments );\n }\n }\n\n init() {\n super.init( ...arguments );\n this.splitAxis();\n }\n\n getAxisPosition() {\n var max = 0;\n\n this.axes.map( ( axis ) => {\n max = Math.max( max, axis.getAxisPosition() );\n } );\n\n return max;\n }\n\n getSubAxis( index ) {\n\n if ( this.axes.length <= index ) {\n throw 'Impossible to reach axis. Index ' + index + ' is out of range';\n }\n\n return this.axes[ index ];\n }\n\n get splitNumber() {\n return this._splits.length;\n }\n };\n\n delegateMethods.map( ( methodName ) => {\n\n cl.prototype[ methodName ] = ( function( method ) {\n\n return function() {\n //super[ method ]( ...arguments )\n\n this.axes.map( ( axis ) => {\n axis[ method ]( ...arguments );\n } );\n return this;\n };\n\n } )( methodName );\n } );\n\n return cl;\n};\n\nclass SplitXAxis extends SplitAxis( AxisX ) {\n\n constructor( graph, topbottom, options ) {\n super( ...arguments );\n this.topbottom = topbottom;\n }\n\n getConstructor() {\n return AxisX;\n }\n\n getAxisPosition() {\n var max = super.getAxisPosition( ...arguments );\n\n this.labelPosY = max;\n\n if ( this.getLabel() ) {\n max += this.graph.options.fontSize;\n }\n\n return max;\n }\n\n drawLabel() {\n super.drawLabel();\n this.label.setAttribute( 'y', ( this.top ? -1 : 1 ) * ( this.graph.options.fontSize + this.labelPosY ) );\n }\n\n draw() {\n var height = super.draw( ...arguments );\n this.drawLabel();\n return height;\n }\n\n}\n\nclass SplitYAxis extends SplitAxis( AxisY ) {\n\n constructor( graph, leftright, options ) {\n super( ...arguments );\n ///this.leftright = leftright;\n }\n\n getConstructor() {\n return AxisY;\n }\n /*\n draw() {\n\n if ( this.getLabel() ) {\n this.axes.map( ( axis ) => {\n axis.setAxisPosition( this.graph.options.fontSize );\n } ); // Extra shift allowed for the label\n //this.setShift( this.graph.options.fontSize );\n }\n return super.draw( ...arguments );\n }\n */\n drawLabel() {\n super.drawLabel();\n }\n\n equalizePosition( width ) {\n\n var widthAfter = width;\n\n if ( this.getLabel() ) {\n this.axes.map( ( axis ) => {\n widthAfter = Math.max( axis.equalizePosition( width ), widthAfter );\n } ); // Extra shift allowed for the label\n //this.setShift( this.graph.options.fontSize );\n }\n\n if ( this.getLabel() ) {\n this.placeLabel( this.left ? -widthAfter : widthAfter );\n return widthAfter + this.graph.options.fontSize;\n }\n }\n\n}\n\nutil.mix( SplitXAxis, new AxisX() );\nutil.mix( SplitYAxis, new AxisY() );\n\nexport default PluginAxisSplitting;","import * as util from '../graph.util.js';\nimport Plugin from './graph.plugin.js';\n\n/**\n * The intent of this plugin is to provide methods for the user to make the traces on the graph automatically different\n * Options to provide colorization, markers and line styles should be provided\n * @extends Plugin\n */\nclass PluginMakeTracesDifferent extends Plugin {\n\n constructor() {\n super( ...arguments );\n }\n\n init( graph, options ) {\n super.init( graph, options );\n }\n // Load this with defaults\n static\n default () {\n\n return {\n\n };\n }\n\n checkHSL( color ) {\n\n let result = {},\n hue, saturation, lightness;\n\n if ( ( hue = ( color.h || color.hue ) ) ) {\n\n if ( hue < 1 ) {\n hue = Math.round( hue * 360 );\n }\n\n result.hue = hue;\n } else {\n result.h = 0;\n }\n\n if ( ( saturation = ( color.s || color.saturation ) ) ) {\n\n if ( saturation > 1 ) {\n saturation /= 100;\n }\n\n result.saturation = saturation;\n } else {\n result.saturation = 0.75;\n }\n\n if ( ( lightness = ( color.lightness || color.l ) ) ) {\n\n if ( lightness > 1 ) {\n lightness /= 100;\n }\n\n result.lightness = lightness;\n } else {\n result.lightness = 0.5;\n }\n\n return result;\n }\n\n buildHSLString( hsl ) {\n return 'hsl( ' + Math.round( hsl.h ) + ', ' + Math.round( hsl.s * 100 ) + '%, ' + Math.round( hsl.l * 100 ) + '%)';\n }\n\n colorizeAll( options ) {\n\n let series,\n seriesLength;\n\n if ( options.serieTypes ) {\n\n if ( !Array.isArray( options.serieTypes ) ) {\n options.serieTypes = [ options.serieTypes ];\n }\n\n series = this.graph.allSeries( ...options.serieTypes );\n } else {\n series = this.graph.getSeries();\n }\n\n seriesLength = series.length;\n\n if ( !options.startingColorHSL ) {\n\n if ( options.colorHSL ) {\n options.startingColorHSL = this.checkHSL( options.colorHSL );\n } else {\n throw 'No starting color was provided. There must exist either options.colorHSL or options.startingColorHSL';\n }\n }\n\n if ( !options.endingColorHSL ) {\n\n if ( !options.affect || ![ 'h', 's', 'l', 'hue', 'saturation', 'lightness' ].include( options.affect ) ) {\n options.affect = 'h';\n }\n\n switch ( options.affect ) {\n\n case 'h':\n case 'hue':\n options.endingColorHSL = {\n h: options.startingColorHSL.h + 300,\n s: options.startingColorHSL.s,\n l: options.startingColorHSL.l\n };\n break;\n\n case 'saturation':\n case 's':\n let endS;\n\n if ( options.startingColorHSL.s > 0.5 ) {\n endS = 0;\n } else {\n endS = 1;\n }\n\n options.endingColorHSL = {\n h: options.startingColorHSL.h,\n s: endS,\n l: options.startingColorHSL.l\n };\n break;\n\n case 'lightness':\n case 'l':\n let endL;\n\n if ( options.startingColorHSL.l > 0.5 ) {\n endL = 0;\n } else {\n endL = 0.75;\n }\n\n options.endingColorHSL = {\n h: options.startingColorHSL.h,\n s: options.startingColorHSL.s,\n l: endL\n };\n break;\n }\n } else {\n options.endingColorHSL = Object.assign( {}, options.startingColorHSL, options.endingColorHSL );\n }\n\n return series.map( ( serie, index ) => {\n\n if ( !serie.setLineColor ) {\n throw 'The serie ' + serie.getName() + ' does not implement the method `startingColor`';\n }\n\n const colorString = this.buildHSLString( {\n h: options.startingColorHSL.h + index / ( seriesLength - 1 ) * ( options.endingColorHSL.h - options.startingColorHSL.h ),\n s: options.startingColorHSL.s + index / ( seriesLength - 1 ) * ( options.endingColorHSL.s - options.startingColorHSL.s ),\n l: options.startingColorHSL.l + index / ( seriesLength - 1 ) * ( options.endingColorHSL.l - options.startingColorHSL.l )\n } );\n\n serie.setLineColor( colorString );\n return colorString;\n } );\n }\n}\n\nexport default PluginMakeTracesDifferent;","import * as util from '../graph.util.js';\nimport Plugin from './graph.plugin.js';\n\n/*\n What is it ?\n It is a plugin for automatic peak detection on a line serie\n\n How to use ?\n Basic usage:\n\n let graph = new Graph(\"dom\", {\n plugins: {\n 'peakPicking': {}\n }\n }\n );\n\n let wv = Graph.newWaveform();\n wv.setData( [ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 ] );\n let s = graph.newSerie(\"serie\").setWaveform( wv ).autoAxis();\n\n graph.getPlugin('peakPicking').setSerie( s );\n graph.draw();\n*/\n\n/**\n * @extends Plugin\n */\nclass PluginPeakPicking extends Plugin {\n\n constructor() {\n super( ...arguments );\n }\n\n static\n default () {\n\n return {\n autoPeakPicking: false,\n autoPeakPickingNb: 4,\n autoPeakPickingMinDistance: 10,\n autoPeakPickingFormat: false,\n autoPeakPickingAllowAllY: false\n };\n }\n\n init( graph, options ) {\n\n super.init( graph, options );\n this.picks = [];\n\n for ( var n = 0, m = this.options.autoPeakPickingNb; n < m; n++ ) {\n\n var shape = this.graph.newShape( {\n type: 'label',\n label: {\n text: '',\n position: {\n x: 0\n },\n anchor: 'middle',\n\n },\n\n selectable: true,\n\n shapeOptions: {\n minPosY: 15\n }\n\n } );\n\n shape.draw();\n\n this.picks.push( shape );\n\n }\n\n }\n\n setSerie( serie ) {\n this.serie = serie;\n }\n\n serieRemoved( serie ) {\n\n if ( this.serie == serie ) {\n this.picks.map( ( pick ) => {\n pick.kill();\n } );\n }\n }\n\n preDraw() {\n\n if ( !this.serie ) {\n return;\n }\n\n this.detectedPeaks = [];\n this.lastYPeakPicking = false;\n }\n\n postDraw() {\n\n if ( !this.serie ) {\n return;\n }\n let lookForMaxima = true;\n let lookForMinima = false;\n let lastYPeakPicking;\n let peaks = [];\n\n let waveform = this.serie.getWaveform();\n\n if ( !waveform ) {\n throw 'The serie must have a waveform for the peak picking to work';\n }\n\n let length = waveform.getLength(),\n i = 0,\n y;\n\n for ( ; i < length; i++ ) {\n\n y = waveform.getY( i );\n\n if ( this.serie.options.lineToZero ) {\n peaks.push( [ waveform.getX( i ), y ] );\n continue;\n }\n\n if ( !lastYPeakPicking ) {\n lastYPeakPicking = [ waveform.getX( i ), y ];\n continue;\n }\n\n if ( ( y >= lastYPeakPicking[ 1 ] && lookForMaxima ) || ( y <= lastYPeakPicking[ 1 ] && lookForMinima ) ) {\n\n lastYPeakPicking = [ waveform.getX( i ), y ];\n\n } else if ( ( y < lastYPeakPicking[ 1 ] && lookForMaxima ) || ( y > lastYPeakPicking[ 1 ] && lookForMinima ) ) {\n\n if ( lookForMinima ) {\n lookForMinima = false;\n lookForMaxima = true;\n\n } else {\n\n lookForMinima = true;\n lookForMaxima = false;\n\n peaks.push( lastYPeakPicking );\n lastYPeakPicking = false;\n }\n\n lastYPeakPicking = [ waveform.getX( i ), y ];\n\n }\n }\n\n var ys = peaks;\n var x,\n px,\n passed = [],\n px,\n l = ys.length,\n k, m,\n index;\n\n i = 0;\n\n var selected = this.graph.selectedShapes.map( function( shape ) {\n return shape.getProp( 'xval' );\n } );\n\n ys.sort( function( a, b ) {\n return b[ 1 ] - a[ 1 ];\n } );\n\n m = 0;\n\n for ( ; i < l; i++ ) {\n\n x = ys[ i ][ 0 ];\n px = this.serie.getX( x );\n k = 0;\n y = this.serie.getY( ys[ i ][ 1 ] );\n\n if ( px < this.serie.getXAxis().getMinPx() || px > this.serie.getXAxis().getMaxPx() ) {\n continue;\n }\n\n if ( !this.options.autoPeakPickingAllowAllY && ( y > this.serie.getYAxis().getMinPx() || y < this.serie.getYAxis().getMaxPx() ) ) {\n\n continue;\n }\n\n // Distance check\n for ( ; k < passed.length; k++ ) {\n if ( Math.abs( passed[ k ] - px ) < this.options.autoPeakPickingMinDistance ) {\n break;\n }\n }\n if ( k < passed.length ) {\n continue;\n }\n\n // Distance check end\n\n // If the retained one has already been selected somewhere, continue;\n if ( ( index = selected.indexOf( x ) ) > -1 ) {\n passed.push( px );\n continue;\n }\n\n if ( !this.picks[ m ] ) {\n return;\n }\n\n //console.log( this.getYAxis().getDataMax(), this.getYAxis().getCurrentMin(), y );\n // this.picks[ m ].show();\n\n if ( this.serie.getYAxis().getPx( ys[ i ][ 1 ] ) - 20 < 0 ) {\n\n this.picks[ m ].setLabelPosition( {\n x: x,\n y: '5px',\n } );\n\n this.picks[ m ].setLabelBaseline( 'hanging' );\n\n } else {\n\n this.picks[ m ].setLabelBaseline( 'no-change' );\n\n this.picks[ m ].setLabelPosition( {\n x: x,\n y: ys[ i ][ 1 ],\n dy: '-15px'\n } );\n\n }\n\n this.picks[ m ].setProp( 'xval', x );\n\n if ( this.options.autoPeakPickingFormat ) {\n\n this.picks[ m ].setLabelText( this.options.autoPeakPickingFormat.call( this.picks[ m ], x, m ) );\n } else {\n this.picks[ m ].setLabelText( String( Math.round( x * 1000 ) / 1000 ) );\n }\n\n this.picks[ m ].makeLabels();\n\n m++;\n while ( this.picks[ m ] && this.picks[ m ].isSelected() ) {\n m++;\n }\n\n if ( passed.length == this.options.autoPeakPickingNb ) {\n break;\n }\n }\n }\n\n /**\n * Hides the automatic peak picking (see the autoPeakPicking option)\n * @memberof SerieLine\n */\n hidePeakPicking( lock ) {\n\n if ( !this._hidePeakPickingLocked ) {\n this._hidePeakPickingLocked = lock;\n }\n\n if ( !this.graph.picks ) {\n return;\n }\n for ( var i = 0; i < this.graph.picks.length; i++ ) {\n this.graph.picks[ i ].hide();\n }\n }\n\n /**\n * Shows the automatic peak picking (see the autoPeakPicking option)\n * @memberof SerieLine\n */\n showPeakPicking( unlock ) {\n\n if ( this._hidePeakPickingLocked && !unlock ) {\n return;\n }\n\n if ( !this.graph.picks ) {\n return;\n }\n\n for ( var i = 0; i < this.graph.picks.length; i++ ) {\n this.graph.picks[ i ].show();\n }\n }\n\n killPeakPicking() {\n\n if ( this.picks ) {\n for ( var i = 0, l = this.picks.length; i < l; i++ ) {\n this.picks[ i ].kill();\n }\n }\n }\n}\n\nexport default PluginPeakPicking;","import Graph from './graph.core.js';\nimport GraphPosition from './graph.position.js';\nimport GraphLegend from './graph.legend.js';\n\nimport AxisX from './graph.axis.x.js';\nimport AxisY from './graph.axis.y.js';\nimport AxisXBar from './graph.axis.x.bar.js';\nimport AxisXTime from './graph.axis.x.time.js';\n\nimport SerieLine from './series/graph.serie.line.js';\nimport SerieLine3D from './series/graph.serie.line.3d.js';\nimport SerieBar from './series/graph.serie.bar.js';\nimport SerieBox from './series/graph.serie.box.js';\nimport SerieLineColor from './series/graph.serie.line.colored.js';\nimport SerieScatter from './series/graph.serie.scatter.js';\nimport SerieZone from './series/graph.serie.zone.js';\nimport SerieZone3D from './series/graph.serie.zone.3d.js';\nimport SerieDensityMap from './series/graph.serie.densitymap.js';\nimport SerieContour from './series/graph.serie.contour.js';\n\nimport Shape from './shapes/graph.shape.js';\nimport ShapeAreaUnderCurve from './shapes/graph.shape.areaundercurve.js';\nimport ShapeArrow from './shapes/graph.shape.arrow.js';\nimport ShapeEllipse from './shapes/graph.shape.ellipse.js';\nimport ShapeLabel from './shapes/graph.shape.label.js';\nimport ShapePolyline from './shapes/graph.shape.polyline.js';\nimport ShapeLine from './shapes/graph.shape.line.js';\nimport ShapeNMRIntegral from './shapes/graph.shape.nmrintegral.js';\nimport ShapePeakIntegration2D from './shapes/graph.shape.peakintegration2d.js';\nimport ShapeRect from './shapes/graph.shape.rect.js';\nimport ShapeCross from './shapes/graph.shape.cross.js';\nimport ShapePeakBoundariesCenter from './shapes/graph.shape.peakboundariescenter.js';\nimport ShapeHTML from './shapes/graph.shape.html.js';\n\nimport GraphPlugin from './plugins/graph.plugin.js';\nimport GraphPluginDrag from './plugins/graph.plugin.drag.js';\nimport GraphPluginShape from './plugins/graph.plugin.shape.js';\nimport GraphPluginSelectScatter from './plugins/graph.plugin.selectScatter.js';\nimport GraphPluginZoom from './plugins/graph.plugin.zoom.js';\nimport GraphPluginTimeSerieManager from './plugins/graph.plugin.timeseriemanager.js';\nimport GraphPluginSerieLineDifference from './plugins/graph.plugin.serielinedifference.js';\nimport GraphPluginAxisSplitting from './plugins/graph.plugin.axissplitting.js';\nimport GraphPluginMakeTracesDifferent from './plugins/graph.plugin.makeTracesDifferent.js';\nimport GraphPluginPeakPicking from './plugins/graph.plugin.peakpicking.js';\n\nimport Waveform from './util/waveform.js';\nimport FitLM from './util/fit_lm.js';\n\n// Corrent naming is important here !\n\nGraph.registerConstructor( 'graph.position', GraphPosition );\n\nGraph.registerConstructor( 'graph.axis.x', AxisX );\nGraph.registerConstructor( 'graph.axis.y', AxisY );\nGraph.registerConstructor( 'graph.axis.x.bar', AxisXBar );\nGraph.registerConstructor( 'graph.axis.x.time', AxisXTime );\n\nGraph.registerConstructor( 'graph.serie.line', SerieLine );\nGraph.registerConstructor( 'graph.serie.line.3d', SerieLine3D );\nGraph.registerConstructor( 'graph.serie.line.color', SerieLineColor );\nGraph.registerConstructor( 'graph.serie.contour', SerieContour );\nGraph.registerConstructor( 'graph.serie.bar', SerieBar );\nGraph.registerConstructor( 'graph.serie.box', SerieBox );\nGraph.registerConstructor( 'graph.serie.scatter', SerieScatter );\nGraph.registerConstructor( 'graph.serie.zone', SerieZone );\nGraph.registerConstructor( 'graph.serie.zone.3d', SerieZone3D );\nGraph.registerConstructor( 'graph.serie.densitymap', SerieDensityMap );\n\nGraph.registerConstructor( Graph.SERIE_LINE, SerieLine );\nGraph.registerConstructor( Graph.SERIE_LINE_3D, SerieLine3D );\nGraph.registerConstructor( Graph.SERIE_LINE_COLORED, SerieLineColor );\nGraph.registerConstructor( Graph.SERIE_CONTOUR, SerieContour );\nGraph.registerConstructor( Graph.SERIE_BAR, SerieBar );\nGraph.registerConstructor( Graph.SERIE_BOX, SerieBox );\nGraph.registerConstructor( Graph.SERIE_SCATTER, SerieScatter );\nGraph.registerConstructor( Graph.SERIE_ZONE, SerieZone );\nGraph.registerConstructor( Graph.SERIE_ZONE_3D, SerieZone3D );\nGraph.registerConstructor( Graph.SERIE_DENSITYMAP, SerieDensityMap );\n\n//Graph.registerConstructor( \"graph.serie.line.broken\", GraphSerieLineBroken );\n\nGraph.registerConstructor( 'graph.plugin.shape', GraphPluginShape );\nGraph.registerConstructor( 'graph.plugin.drag', GraphPluginDrag );\nGraph.registerConstructor( 'graph.plugin.zoom', GraphPluginZoom );\nGraph.registerConstructor( 'graph.plugin.selectScatter', GraphPluginSelectScatter );\nGraph.registerConstructor( 'graph.plugin.timeSerieManager', GraphPluginTimeSerieManager );\nGraph.registerConstructor( 'graph.plugin.serielinedifference', GraphPluginSerieLineDifference );\nGraph.registerConstructor( 'graph.plugin.serieLineDifference', GraphPluginSerieLineDifference );\nGraph.registerConstructor( 'graph.plugin.axissplitting', GraphPluginAxisSplitting );\nGraph.registerConstructor( 'graph.plugin.makeTracesDifferent', GraphPluginMakeTracesDifferent );\nGraph.registerConstructor( 'graph.plugin.peakPicking', GraphPluginPeakPicking );\n\nGraph.registerConstructor( 'graph.shape', Shape );\nGraph.registerConstructor( 'graph.shape.areaundercurve', ShapeAreaUnderCurve );\nGraph.registerConstructor( 'graph.shape.arrow', ShapeArrow );\nGraph.registerConstructor( 'graph.shape.ellipse', ShapeEllipse );\nGraph.registerConstructor( 'graph.shape.label', ShapeLabel );\nGraph.registerConstructor( 'graph.shape.polyline', ShapePolyline );\nGraph.registerConstructor( 'graph.shape.line', ShapeLine );\nGraph.registerConstructor( 'graph.shape.nmrintegral', ShapeNMRIntegral );\nGraph.registerConstructor( 'graph.shape.html', ShapeHTML );\nGraph.registerConstructor( 'graph.shape.peakintegration2d', ShapePeakIntegration2D );\n// Graph.registerConstructor( \"graph.shape.peakinterval\", GraphShapePeakInterval );\n// Graph.registerConstructor( \"graph.shape.peakinterval2\", GraphShapePeakInterval2 );\n// Graph.registerConstructor( \"graph.shape.rangex\", GraphShapeRangeX );\nGraph.registerConstructor( 'graph.shape.rect', ShapeRect );\nGraph.registerConstructor( 'graph.shape.rectangle', ShapeRect );\nGraph.registerConstructor( 'graph.shape.cross', ShapeCross );\n//Graph.registerConstructor( \"graph.shape.zoom2d\", GraphShapeZoom2D );\nGraph.registerConstructor( 'graph.shape.peakboundariescenter', ShapePeakBoundariesCenter );\n\n// Graph.registerConstructor( \"graph.toolbar\", GraphToolbar );\nGraph.registerConstructor( 'graph.legend', GraphLegend );\nGraph.registerConstructor( 'graph.waveform', Waveform );\n\nexport default Graph;"],"names":["_parsePx","px","indexOf","parseInt","replace","isNumeric","n","isNaN","parseFloat","isFinite","Position","x","y","dx","dy","graph","xAxis","yAxis","serie","hasXAxis","hasYAxis","throw","_compute","relativeTo","_relativeTo","relativeToComputed","parsed","pos","getXAxis","getYAxis","i","axis","val","dval","undefined","warn","closest","searchClosestValue","getName","getY","yMin","getPx","def","_parsePercent","_getPositionPx","getRelPx","value","getDrawingWidth","getDrawingHeight","getPos","percent","v","mode","delta","ref","refd","refPx","deltaPx","getValPosition","getRelVal","rel","getMaxValue","getMinValue","getMinPx","getMaxPx","check","callback","posObject","position","setAttributeTo","to","params","ns","setAttributeNS","setAttribute","mapEventEmission","options","source","eventName","substring","toLowerCase","on","j","apply","arguments","guid","c","r","Math","random","toString","throwError","message","error","obj","Array","isArray","hue2rgb","p","q","t","hslToRgb","h","s","l","g","b","round","saveDomAttributes","attributes","identification","_savedAttributesIds","_savedAttributes","_attributes","push","getAttribute","hasSavedAttribute","dom","attr","overwriteDomAttribute","attribute","newValue","restoreDomAttributes","splice","attrs","length","debounce","func","wait","immediate","timeout","context","args","later","callNow","setTimeout","SVGParser","svgString","parser","DOMParser","doc","parseFromString","getOffset","el","rect","getBoundingClientRect","top","left","setCSS","element","values","style","ajaxGet","Promise","resolve","reject","request","XMLHttpRequest","open","type","url","json","setRequestHeader","onload","status","response","responseText","JSON","parse","Error","onerror","send","hasOwn","Object","prototype","hasOwnProperty","toStr","arr","call","isPlainObject","hasOwnConstructor","hasIsPrototypeOf","constructor","key","extend","name","src","copy","copyIsArray","clone","target","deep","mix","baseClass","mixin","prop","emptyDom","firstChild","removeChild","EventEmitter","proto","indexOfListener","listeners","listener","alias","aliasClosure","getListeners","evt","events","_getEvents","RegExp","test","flattenListeners","flatListeners","getListenersAsObject","addListener","listenerIsWrapped","addOnceListener","once","defineEvent","defineEvents","evts","removeListener","index","off","addListeners","manipulateListeners","removeListeners","remove","single","multiple","removeEvent","_events","removeAllListeners","emitEvent","_getOnceReturnValue","trigger","emit","slice","setOnceReturnValue","_onceReturnValue","FitHost","DELTAP","BIGVAL","WEIGHT","setYData","dataY","setXData","dataX","setWeight","weight","setInitialParams","subsetIndex","setSubset","setFunction","function","progress","hookIteration","data","parms","map","NPARMS","fromIndex","toIndex","_from","_to","f","_hookIteration","buildFit","_func","NPTS","getLength","arrY","getDataY","arrX","getDataX","resid","fill","jac","log","join","LM","_result","done","param","sumsq","dp","computeResiduals","FACTOR","d","k","nudge","getResidualElement","xmin","getMin","xmax","getMax","fit","waveformResult","waveform","setData","gH","gnadj","gnpnts","hook","LMITER","LMBOOST","LMSHRINK","LAMBDAZERO","LAMBDAMAX","LMTOL","sos","sosprev","lambda","myH","nadj","npts","beta","alpha","amatrix","niter","bLMiter","buildJacobian","getJacobianElement","rrise","gaussj","a","N","det","big","save","L","ik","jk","abs","dataAggregator","URL","createObjectURL","Blob","Worker","aggregatorWorker","queue","string","e","maxX","minX","maxY","minY","direction","numPoints","slots","dataAggregatedX","dataAggregatedY","aggregationSum","getX","slotNumber","lastAggregationX","lastAggregation","lastAggregationSum","newAggregation","newAggregationX","xdata","xScale","xOffset","aggregations","dataPerSlot","floor","slotX","min","max","slotY","_queueId","workerUrl","onmessage","id","toOptimize","requestId","Date","now","prom","resolver","postMessage","Waveform","errors","BELOW","ABOVE","BOX","BAR","forEach","setXWaveform","newData","_makeArray","warnNaN","nanable","isNaNAllowed","Number","_setData","optimized","dataInUse","getScale","getShift","computeXMinMax","wave","xs","offset","scale","_typedArrayClass","getTypedArrayClass","isUnsigned","from","hasXWaveform","getXWaveform","setTypedArrayClass","Float32Array","Float64Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","prepend","unshift","recalculateMinMaxNewPoint","append","monotoneous","getMonotoneousAscending","_monotoneousAscending","monoDir","_monotoneous","hasErrorBars","getMaxError","b1","b2","useDataToUse","roundingMethod","getIndexFromData","dataInUseType","xval","yval","scaleX","scaleY","ydata","isXMonotoneous","getIndexFromDataXY","valCollection","isAscending","isMonotoneous","trace","binarySearch","valX","valY","getXShift","getXScale","euclidianSearch","getXMin","getXMax","shift","setShift","setScale","self","rejector","FitLM","assign","results","init","temp","sum","deltaTot","diff","getData","_integrateP","fromX","toX","integrateP","getIndexFromX","p0","p1","getAverageP","average","_integrateX","dir","requireMonotonicity","reverse","requireXMonotonicity","inverting","dataMinMax","resampleSum","resampleMin","resampleMax","resampleNum","resample_x_start","resample_x_px_start","x_px","doing_mean","firstPointIndex","xPosition","resampleToPx","xpos","xIndex","yData","xData","xIndexF","getXMonotoneousAscending","numberOrWave","_arithmetic","DIVIDE","divide","MULTIPLY","multiply","logBase","E","base","ADD","add","SUBTRACT","subtract","method","operator","_waveArithmetic","_numberArithmetic","num","operation","yDataThis","interpolate","_dataAggregating","_dataAggregated","_dataAggregationDirection","toUpperCase","pow2","pow2floor","aggregator","getMinX","getMaxX","getMinY","getMaxY","then","event","aggregates","pxWidth","level","pow2ceil","alsoDuplicateXWave","newWaveform","rescaleX","xShift","duplicate","setXShift","setXScale","fromP","toP","xRef","xWithin","indexPlus","indexMinus","findLocalMinMaxIndex","tmp","curr","currI","NEGATIVE_INFINITY","POSITIVE_INFINITY","text","console","unit","setUnit","xunit","getUnit","getXUnit","lastLvlIndex","rangeP","lvlIndex","indices","findLevel","ceil","rangeX","below","increment","box","edge","rounding","getIndexInterpolate","factor","total","minValue","maxValue","ratio","xWave","setErrorBar","setErrorBarBelow","setErrorBarAbove","setErrorBoxAbove","setErrorBoxBelow","checkMinMax","nb","bars","bottom","above","boxes","side","getMaxErrorType","stack","getErrorX","getError","valueBefore","valueAfter","indexBefore","indexAfter","targetX","targetY","haystackX","haystackY","distance","MAX_VALUE","distance_i","haystack","seedA","seedB","seedInt","nanDirection","Symbol","GraphOptionsDefault","defaultScatterStyle","_constructors","Map","Graph","wrapper","_creation","util","_drawn","HTMLElement","document","getElementById","bind","setWrapper","prevented","shapes","shapesLocked","plugins","pluginAction","plugin","mouseActions","selectedShapes","series","_axesHaveChanged","padding","paddingTop","paddingBottom","paddingLeft","paddingRight","currentAction","nsxlink","getTopAxis","getLeftAxis","getRightAxis","getBottomAxis","_pluginsInit","appendChild","outline","height","width","wrapperStyle","getComputedStyle","w","setSize","_resize","title","domTitle","textContent","display","onlyIfAxesHaveChanged","force","sizeSet","executeRedrawSlaves","haveAxesChanged","hasSizeChanged","_pluginsExecute","drawn","updateLegend","drawSeries","redraw","_lockUpdate","legend","update","draw","skipResize","setWidth","setHeight","useCache","innerHeight","innerWidth","offsetCached","right","_getAxis","setBottomAxis","setLeftAxis","kill","noRedraw","noSerieKill","isX","isY","axisGroup","group","groupPrimaryGrids","gridPrimary","groupSecondaryGrids","gridSecondary","hasTopAxis","hasBottomAxis","hasLeftAxis","hasRightAxis","hasAxis","axisList","_applyToAxes","autoscaleAxes","setMinMaxToFitSeries","color","rectEvent","state","getCurrentMin","getCurrentMax","setCurrentMin","setCurrentMax","savedName","savedAxisState","getAxisState","recallAxisState","minmax","usingZValues","valSeries","getBoundaryAxisFromSeries","func2use","infinity2use","Infinity","serieValue","getSeriesFromAxis","isShown","axisvars","getBoundaryAxis","setMinValueData","setMaxValueData","tb","lr","ax","_applyToAxis","axes","linkedToAxis","getConstructor","SERIE_LINE","getSerie","makeSerie","types","filter","include","getType","drawSerie","removeSeries","resetSeries","selectName","selectedSerie","selectionType","unselectSerie","triggerEvent","select","unselect","toolbarData","toolbar","shapeType","shapeData","mute","shapeProperties","prevent","_id","shape","_data","properties","setProperties","props","setProp","setPosition","GraphPosition","fillColor","setFillColor","fillOpacity","setFillOpacity","strokeColor","setStrokeColor","strokeWidth","setStrokeWidth","layer","setLayer","locked","lock","movable","selectable","resizable","handles","selectOnMouseDown","selectOnClick","transforms","addTransform","highlightOnMouseOver","labelEditable","labels","label","showLabel","setLabelText","setLabelPosition","setLabelColor","setLabelSize","size","setLabelAngle","angle","setLabelBaseline","baseline","setLabelAnchor","anchor","setLabelBackgroundColor","backgroundColor","setLabelBackgroundOpacity","backgroundOpacity","setSerie","createHandles","applyStyle","varArgs","isSelectable","shapesUniqueSelection","unselectShapes","_select","cancelUnselectShape","_unselect","unselectShape","isHTML","insertBefore","_dom","getLayer","groupMain","layers","createElementNS","prevLayer","plotGroup","nextSibling","focus","movingElement","bypassHandleMouse","closingLines","els","line","closeColor","graphingZone","action","enabled","keyCode","keyCheck","ctrl","meta","alt","shiftKey","ctrlKey","metaKey","altKey","forcedPlugin","funcName","which","activePlugin","pluginName","pluginOptions","onlyIfRequired","requireDelayedUpdate","zAxis","groupGrids","refAxisX","refAxisY","x0","y0","getZProj","maxZ","updateDataMinMaxAxes","sort","getZPos","sa","sb","appendSerieToDom","menuElements","onContextMenuListen","moving","resizing","arg","clientX","clientY","_sizeChanged","requireLegendUpdate","drawingSpaceWidth","drawingSpaceHeight","drawingSpaceMinX","drawingSpaceMinY","drawingSpaceMaxX","drawingSpaceMaxY","trackingLine","enable","sOptions","addSerieToTrackingLine","disableTracking","noLine","trackingObject","newShape","trackingLineShapeOptions","serieO","enableTracking","show","getPosition","trueX","_trackingLegend","_trackingLegendSerie","textMethod","output","valueToHtml","yValue","hide","trackingShape","renderer","_katexRenderer","katexValue","katexElement","div","createElement","fromJSON","schema","schemaAxis","axisOptions","labelValue","unitWrapperAfter","unitWrapperBefore","forcedMin","forcedMax","flip","flipped","_jsGraphIndex","schemaSerie","serieType","serieOptions","serieAxis","SERIE_LINE_COLORED","SERIE_SCATTER","SERIE_BOX","orientation","newSerie","lineStyle","entries","styleName","styleSerie","lineWidth","lineColor","setStyle","defaultStyle","defaultStyles","styles","individualStyles","styleNames","Set","keys","concat","eachStyleElement","zoom","points","setMarkers","setColors","errorBarsXAbove","errorBarsXBelow","errorBarsYAbove","errorBarsYBelow","errorBoxesXAbove","errorBoxesXBelow","errorBoxesYAbove","errorBoxesYBelow","errorX","errorBarX","errorBoxX","errorY","errorBarY","errorBoxY","setErrorBarXAbove","setErrorBarStyle","setErrorBoxXAbove","setErrorBoxXBelow","setErrorBoxStyle","setXAxis","setYAxis","autoAxis","setWaveform","getWidth","getHeight","axesPositions","axesExport","allaxes","axisPosition","seriesExport","toType","SERIE_BAR","exportData","isFlipped","linestyle","stylename","styleObj","markers","getLabel","registerConstructor","constructorName","has","set","softFail","get","getAxisLevelFromSpan","span","possible","m","refreshDrawingZone","levels","_painted","hideGroup","showGroup","floating","getSpan","setLevel","getAxisPosition","shiftTop","reduce","prev","shiftBottom","current","getLevel","setMinPx","setMaxPx","shift2","equalizePosition","shiftLeft","shiftRight","floatingAxis","getFloatingAxis","floatingValue","getFloatingValue","floatingPx","clipRect","getPaddingTop","getPaddingLeft","drawLines","redrawShapes","_handleKey","_pluginExecute","checkKeyActions","parameters","methodName","keyComb","keyActions","isActionAllowed","preventDefault","stopPropagation","removeSelectedShape","keepInDom","doDom","fontFamily","fontSize","defs","groupEvent","setTitle","updateGraphingZone","_makeClosingLines","clip","markerArrow","pathArrow","markerHorizontalSplit","getId","path","markerVerticalSplit","vertLineArrow","pathVertLine","_registerEvents","addEventListener","coords","_getXY","deltaY","wheelDeltaY","wheelDelta","_handleMouseDown","_handleMouseMove","handleMouseMove","snapToSerie","xClosest","getSeries","onMouseMoveData","checkMouseActions","executed","_serieExecute","xValue","justCreated","_makeTrackingLegend","withinPx","withinVal","getVal","yClosest","serieShape","getLineWidth","getLineColor","forceParentDom","onCreated","onChanged","magnet","magnetOptions","within","minmaxpos","findLocalMinMax","txt","innerHTML","forceTrackingLegendMode","toY","skip","start","offsetHeight","startX","marginLeft","startY","marginTop","offsetWidth","next","requestAnimationFrame","_trackingLegendMove","borderRadius","boxShadow","border","pointerEvents","getWrapper","getDom","_handleDblClick","pref","dblclick","_handleMouseUp","handleMouseUp","_handleClick","jsGraphIsShape","shapesUnselectOnClick","inst","_availableAxes","axisInstance","time","bar","broken","_closeLine","x1","x2","y1","y2","close","isDisplayed","_handleMouseWheel","coordX","coordY","_handleMouseLeave","handleMouseLeave","SERIE_CONTOUR","SERIE_ZONE","SERIE_DENSITYMAP","SERIE_LINE_3D","SERIE_ZONE_3D","TICKS_OUTSIDE","TICKS_INSIDE","TICKS_CENTERED","legendDefaults","Legend","svg","subG","groups","rectBottom","setEvents","eyeId","eyeCrossedId","eyeClosed","eye","adoptNode","documentElement","alignToX","alignToY","bln","autoPosition","setAutoPosition","posX","posY","excludedFromLegend","bbox","getBBox","cursor","poscoords","compute","getPaddingRight","transformX","transformY","_setPosition","isDelayedUpdate","_requiredUpdate","hasChildNodes","lastChild","fullWidth","getSymbolForLegend","marker","getMarkerForLegend","getTextForLegend","isHideable","eyeUse","hideShapesOnHideSerie","isSelected","selectSerie","buildLegendBox","calculatePosition","isSerieHideable","seriesHideable","hideable","isSerieSelectable","shapesToggleable","mousedown","elementMoving","mousemove","deltaX","frame","frameColor","frameWidth","frameRounding","svgElement","defaults","Axis","overwriteoptions","unitModificationTimeTicks","hasChanged","_lines","groupTicks","groupTickLabels","labelTspan","preunit","unitTspan","expTspan","expTspanExp","setTickPosition","tickPosition","gridLinePath","setGridLinesStyle","groupSeries","widthHeightTick","ticks","ticksLabels","tickScaling","currentTick","lastCurrentTick","totalDelta","handleMouseMoveLocal","addLabel","_axisHasChanged","bool","hideWhenNoSeriesShown","accumulator","_hidden","killAxis","atValues","lineAt","thisValue","foreignValue","preference","adaptTo","adapt","foreign","currentAxisMin","currentAxisMax","_zoomed","axisDataSpacing","getInterval","use","val1","val2","setAxisDataSpacing","minPx","setMinMaxFlipped","maxPx","minPxFlipped","maxPxFlipped","dataMin","dataMax","cache","noRescale","nbTicksPrimary","nbTicksSecondary","mouseVal","_doZoomVal","zoomLock","_zoomLocked","forceLock","_doZoom","px1","px2","cacheCurrentMin","cacheCurrentMax","cacheInterval","_hasChanged","_serieShift","_serieScale","nbTick","valrange","pxPerTick","nbTicks","unitPerTick","unitModification","breaked","decimals","numberToNatural","pow","possibleTicks","unitPerTickCorrect","noNotify","interval","logScale","getForcedMin","getForcedMax","cachedInterval","cachedCurrentMin","cachedCurrentMax","widthPx","getCurrentInterval","scientificScale","scientificScaleExponent","scientificExponent","primary","secondary","letter","useKatexForLabel","hasKatexRenderer","unitDecade","getEngineeringExponent","getExponentGreekLetter","engineeringScale","writeUnit","preunitTspan","renderWithKatex","hideTicks","resetTicksLength","widthHeight","drawLinkedToAxisTicksWrapper","drawLinearTicksWrapper","drawLogTicks","removeUselessTicks","removeUselessTickLabels","findAxesLinkedTo","_drawLine","_hideLine","tickPrimaryUnit","primaryTickUnit","getUnitPerTick","getNbTicksPrimary","maxPrimaryTickUnit","minPrimaryTickUnit","drawTicks","secondaryTicks","primaryInterval","incrTick","tickRatio","ticklabelratio","_widthLabels","_draw","secondaryIncr","subIncrTick","loop","shiftToZero","loop2","drawTickWrapper","getMaxSizeTick","tick","lastCurrentTickLabel","currentTickLabel","tickLabel","primaryGrid","secondaryGrid","gridLine","getPrimaryGridColor","getSecondaryGridColor","getPrimaryGridWidth","getSecondaryGridWidth","getPrimaryGridOpacity","getSecondaryGridOpacity","dasharray","getPrimaryGridDasharray","getSecondaryGridDasharray","setGridLineStyle","incr","optsMain","drawTick","scalingFunction","opts","delta2","String","exp","toFixed","getExponentialFactor","getExponentialLabelFactor","modifyUnit","dec","unitInTicks","noScaling","noUnits","valueToText","umin","getModifiedValue","units","valueRounded","exponentialFactor","exponentialLabelFactor","font","labelFont","_level","tickPx1","tickPx2","setPrimaryGrid","setSecondaryGrid","setGrids","gridsOff","gridsOn","axisColor","offsetValue","tickLabelOffset","primaryTicksColor","secondaryTicksColor","ticksLabelColor","primaryGridColor","secondaryGridColor","primaryGridWidth","secondaryGridWidth","opacity","primaryGridOpacity","secondaryGridOpacity","primaryGridDasharray","secondaryGridDasharray","labelColor","overwrite","exponential","tspan","before","after","engineeringScaling","getValue","getDeltaPx","AxisX","topbottom","forcedPos","nextTick","getPrimaryTicksColor","getSecondaryTicksColor","nextGridLine","nextTickLabel","getTicksLabelColor","dominantBaseline","setTickContent","getLabelColor","tickWidth","drawSpecifics","drawLabel","getAxisColor","splitMarks","marginMax","marginMin","zValue","shiftX","AxisY","leftright","shiftPosition","tickMargin","longestTick","getComputedTextLength","getAdditionalWidth","fullwidthlabel","placeLabel","xshift","isLeft","excludeSerie","end","maxV","minV","shiftY","AxisXBar","categories","_barCategories","elements","forceMin","forceMax","setSeries","setCategoryConfig","_getUsedCategories","usedCategories","getUsedCategories","cat","dispatchedCategories","scategories","setDataIndices","axisFormat","dateFormat","token","timezone","timezoneClip","pad","len","getWeek","onejan","date","mask","utc","dF","SyntaxError","masks","default","_","D","H","M","o","getTimezoneOffset","flags","i18n","dayNames","monthNames","match","pop","$0","getClosestIncrement","basis","roundDate","format","setSeconds","getSeconds","setMilliseconds","setMinutes","getMinutes","setHours","getHours","setDate","getDate","setMonth","getMonth","incrementDate","setFullYear","getFullYear","getGroup","number","line1","line2","cloneNode","hideGroups","getDateText","renderGroup","x1B","x2B","substr","GraphTimeAxis","widthTime","timePerPx","maxVal","minVal","currentFormat","threshold","xVal1","xVal2","dateFirst","currentDate","increments","getTime","Serie","redrawShapesAfterDraw","getShapesOfSerie","oneDimensional","howmany","noLegendUpdate","removeSerieFromDom","_removeSerie","hideShapes","hidden","hideImpl","doesHideWhenNoSeriesShown","showShapes","showImpl","selected","xaxis","yaxis","dataHasChanged","lineForLegend","applyLineStyle","setLegendSymbolStyle","textForLegend","layerIndex","newLayer","styleHasChanged","_changedStyles","_dataHasChanged","infos","additionalData","hoverCallback","outCallback","_tracker","_trackingCallback","_trackingOutCallback","_trackerDom","_type","_excludedFromLegend","categoryIndices","nbCategories","ErrorBarMixin","origin","errorstyle","errorbarStyle","_setErrorStyle","errorboxStyle","errorstyles","pairs","makePath","strokeOpacity","all","paths","xpx","ypx","getErrorBarXBelow","makeBarX","getErrorBarXAbove","getErrorBarYBelow","makeBarY","getErrorBarYAbove","getErrorBoxXBelow","makeBoxX","getErrorBoxXAbove","getErrorBoxYBelow","makeBoxY","getErrorBoxYAbove","doErrorDraw","SerieLine","markerFamilies","unselected","extendStyles","markersDom","shown","_isMinOrMax","groupLines","domMarker","markerLabel","markerLabelSquare","domMarkerHover","domMarkerSelect","markerHovered","groupMarkerSelected","markerPoints","lines","groupMarkers","independantMarkers","initExtended1","selectableOnClick","applyLineStyles","toggledOn","toggleMarker","onMouseOverMarker","markersOffHover","onMouseOutMarker","hover","_on","setMarkerStyleTo","getMarkerCurrentFamily","getMarkerPath","split","onSelectMarker","onUnselectMarker","onToggleMarker","searchIndexByPxXY","areMarkersShown","pxPerP","degradationPx","axisCheck","currentLineId","counter","currentLine","resampleForDisplay","_dataToUse","getDataToUseFlat","hasAggregation","numberOfPointsInTotal","getDataMax","getDataMin","promise","selectAggregatedData","_xDataToUse","_afterLinesGroup","hasDataChanged","drawInit","slotToUse","_slotToUse","removeLinesGroup","eraseMarkers","lookForMaxima","lookForMinima","markerFamily","pos0","hasErrors","errorDrawInit","errorDraw","removeExtraLines","insertMarkers","insertLinesGroup","hasStyleChanged","updateStyle","afterDraw","lastX","lastY","xpx2","ypx2","xMin","xMax","yMax","yLeftCrossingRatio","yLeftCrossing","yRightCrossingRatio","yRightCrossing","xTopCrossingRatio","xTopCrossing","xBottomCrossingRatio","xBottomCrossing","yscale","pointOutside","lastPointOutside","pointOnAxis","_markersShown","markersShown","isXMonotoneousAscending","yshift","_createLine","overflowX","overflowY","lineToZero","counter2","_addPoint","cloned","children","ret","family","z","markerCurrentFamily","getMarkerDom","move","allowMarker","errorAddPoint","getLineDashArray","removeAttribute","_getMarkerIndexFromEvent","onClickOnMarker","oldDist","xyindex","dist","p_x","p_y","indexX","getIndexFromXY","returnObj","doMarker","getMouseVal","intY","trackMouse","getFlip","trackMouseLabel","trackMouseLabelRouding","xExact","indexClosest","start2","end2","v1","v2","initJ","maxJ","dataIndex","xBeforeIndexArr","applyToSelected","setLineStyle","getStyle","styleTarget","styleOrigin","_recalculateMarkerPoints","setLineWidth","setLineColor","showMarkers","families","_extendMarkers","recalculatePoints","markerPath","markersIndependant","currentMarkersSelectionType","markerForLegend","parentNode","xmonotoneous","drawMarkerXY","markerDom","getMarkerDomIndependent","Serie3DMixin","zpos","useZValues","getZCorrectedValue","valFinal","wf","getWaveforms","SerieLine3D","zPos","setZPos","SerieBar","pathDom","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","_checkY","getFillColor","getFillOpacity","errorAddPointBarChart","SerieBox","axisref","axisval","methodref","methodval","blnX","_checkX","Q2","Q3","Q1","whiskers","outliers","styleValue","_set","_style","_gstyle","axis2","boxOtherDimension","mean","boxAbove","boxBelow","barAbove","barBelow","maxBoxWidth","_linkedToScatterSeries","scatter_serie","lineMean","applyMeanStyle","rectAbove","rectBelow","boxPos","applyBoxStyle","whiskerAbove","whiskerBelow","outliervalue","outlier","setOutlierStyle","applyWhiskerStyle","getBoxAboveLineColor","getBoxAboveLineWidth","getBoxAboveFillColor","getBoxAboveFillOpacity","getBoxBelowLineColor","getBoxBelowLineWidth","getBoxBelowFillColor","getBoxBelowFillOpacity","getBarAboveLineColor","getBarAboveLineWidth","getBarBelowLineColor","getBarBelowLineWidth","getMeanLineColor","getMeanLineWidth","getOutlierLineColor","getOutlierLineWidth","getOutlierFillColor","getOutlierFillOpacity","extremity","xymode","scatter_serie_cat","SerieLineColor","colors","toBreak","eraseLines","latchLines","xpxbefore","ypxbefore","xbefore","ybefore","_rgb","object","SerieScatter","shapesDetails","groupPoints","selectedStyleGeneral","selectedStyleModifiers","parentElement","MIN_VALUE","dataCategory","symbol","doShape","modifiers","isCategory","extraStyle","stdStylePerso","stdStyle","selection","noSetPosition","modifier","styleAll","selectPoint","setOn","selectPoints","selectionStyle","allStyles","SerieZone","groupZones","lineZone","clipId","waveforms","buffer","xminpx","xmaxpx","yminpx","ymaxpx","ymin","ymax","getLineOpacity","lineOpacity","SerieZone3D","SerieDensityMap","rects","recalculateBinsOnDraw","numX","fromY","numY","densitymap","indexY","binMin","binMax","maxIndexX","maxIndexY","compX","compY","exactX","exactY","indexXLow","indexXHigh","indexYLow","indexYHigh","calculateDensity","pxPerBinX","pxPerBinY","weightedDensityMap","calculationDensityMap","densityMapCalculation","calculateDensityAdvanced","widthValues","axisGetter","weighing","weighted","pxPerBin","dimension","numBins","densityMapCalculate","calculateDensityWeighted","colorMapMin","colorMapMax","callbackColorMapMinMax","colorStops","numColors","methods","colorMap","opacities","first","slices","colorMapNum","colorMapHSV","binValue","colorIndex","autoColorMapBinBoundaries","setColorMapBinBoundaries","deltaXPx","deltaYPx","getColorIndex","drawRects","SerieContour","negativeDelta","positiveDelta","negativeThreshold","positiveThreshold","datas","segments","_addData","domLine","minZ","zValues","incrXFlip","incrYFlip","setColorTo","onMouseWheel","fixed","positive","hasNegative","_shapeZoom","hideHandleNeg","setHandleNeg","showHandleNeg","setHandlePos","lineColors","hsl","fromPositive","toPositive","fromNegative","toNegative","rgb","overwriteValue","Shape","_selected","createDom","classes","masker","maskPath","maskingId","maskDomWrapper","maskDom","handleMouseOver","handleMouseOut","handleMouseDown","handleClick","handleDblClick","initImpl","keepDom","_inDom","removeShapeFromDom","_removeShape","stopElementMoving","className","makeClasses","autoAxes","getProp","preventRedraw","appendToDom","makeLabels","applyPosition","redrawImpl","updateLabels","_applyTransforms","getRelativePosition","relativePosition","result","exec","getLabelPosition","noForce","overwriteSavedProp","applySelectedStyle","attributeName","attributeValue","added","addProp","resetProp","setDom","getProps","applyGenericStyle","sortFunction","transformString","transform","computePosition","setDomGroup","_labels","_labelsBackground","bg","labelDblClickListener","labelIndex","_applyLabelData","visible","currAngle","labelData","_getLabelAnchor","_selectStatus","setter","isLocked","handlesInDom","hideHandles","hasHandles","hasStaticHandles","addHandles","setHandles","getSelectStyle","style2","selectStyle","staticHandles","callbackEach","handle","isResizable","handleSelected","isMovable","selectShape","moved","_mouseCoords","handleMouseDownImpl","preventUnselect","handleMouseMoveImpl","resize","handleMouseUpImpl","highlight","unHighlight","saveDomName","getHighlightAttributes","highlightImpl","unHighlightImpl","_highlightAttributes","maskingShape","getMaskingID","position2","_getPosition","isLabelEditable","shapeLabel","previousValue","getLabelText","blurEvent","nextValue","removeEventListener","changed","_forcedParentDom","appendShapeToDom","displayLabel","ShapeSurfaceUnderCurve","_createHandles","deltaPosition","resizingPosition","posXY","posXY2","v3","firstX","firstY","xBeforeIndex","ShapeLine","GraphShape","getStrokeColor","getStrokeWidth","currentPos2x","currentPos2y","currentPos1x","currentPos1y","pos2","posToChange","vertical","horizontal","forcedCoords","forced","setEventReceptacle","areHandlesInDom","ShapeArrow","nbHandles","ShapeEllipse","posR","newPosition","posComputed","rx","ry","triggerChange","ShapeLabel","ShapePolyline","pxPoints","ShapeNMRIntegral","_domShadow","xVal","yVal","getAxis","baseLine","pos1","hideLabel","getWaveform","index1","index2","index3","getReductionType","firstXVal","firstYVal","lastXVal","lastYVal","getDataInUse","condition","incrementation","_sumVal","integrate","sumVal","py","lastPointX","lastPointY","_sum","firstPointX","firstPointY","ratioLabel","updateIntegralValue","handleCondition","xor","forceValue","toPrecision","_ratio","ShapeRectangle","sides","currentX","currentY","currentW","currentH","updateMask","invX","invY","pos2X","pos2Y","_staticHandles","ShapePeakIntegration2D","ShapeRect","setBindableToDom","ShapeCross","getFromData","ShapePeakBoundaries","lineHeight","line3","rectBoundary","redrawLines","posLeft","posRight","posCenter","posYPx","redrawY","lineHeihgt","ShapeHTML","content","_renderer","currentPosX","currentPosY","Plugin","PluginDrag","totaltime","_draggingX","_draggingY","_lastDraggingX","_lastDraggingY","stopAnimation","dragX","dragY","dt","speedX","speedY","_pluginDragMin","_pluginDragMax","accelerationX","accelerationY","persistanceX","persistanceY","_persistanceMove","PluginShape","shapeInfo","count","currentShape","currentShapeEvent","onCreate","PluginSelectScatter","_path","ys","findPoints","j2","unselectPoint","PluginZoom","_zoomingGroup","_zoomingSquare","zoomMode","_zoomingMode","_backedUpZoomMode","_zoomingXStart","_zoomingYStart","forcedY","onZoomStart","onZoomMove","removeZone","_x","_y","transition","smooth","modeX","modeY","fullX","toAxes","_pluginZoomMin","_pluginZoomMax","_pluginZoomMinFinal","_pluginZoomMaxFinal","fullY","pluginYieldActiveState","doX","doY","xActual","diffX","yActual","diffY","onZoom","maxTime","gradualUnzoomStart","sin","PI","getSelectedSerie","memory","memoryHead","getFromMemory","store","head","PluginTimeSerieManager","currentSlots","requestLevels","noRecalculate","updateSerie","recalculateSeries","create","LRUName","requestsRunning","intervals","serieName","dbElements","noZoneSerie","_zoneSerie","setInfo","optimalInterval","getOptimalInterval","optimalIntervalIndex","cleanRegister","startSlotId","computeSlotID","endSlotId","intervalMultipliers","multiplier","firstSlotId","lastSlotId","slotId","computeTimeMin","register","processRequests","levelArray","levelElement","levelIndex","priority","noProcess","computeUniqueID","LRU","computeTimeMax","slotName","getInfo","maxParallelRequests","currentLevelChecking","requestToMake","getURL","nbPoints","requestElements","totalspan","optimalPxPerPoint","optimalIntervalAmongAvailable","newDiff","extra","info","setLineOpacity","recalculateSerie","lruData","recalculateSerieUpwards","setInterval","downSlotId","downInterval","nextInterval","newSlotTime","computeSlotTime","newSlotTimeEnd","newSlotId","PluginSerieLineDifference","pathsPositive","pathsNegative","positivePolyline","positiveStyle","negativePolyline","negativeStyle","serieTop","serieBottom","serie1","serie2","s1","getFrom","i1","j1","i2","crossing","bottomBroken","xAfterIndex","s2","order","nextSet","ended","getTo","computeCrossing","makePaths","setPointsPx","x11","y11","x12","y12","x21","y21","x22","y22","a1","a2","SerieLineExtended","subSeries","sub","SerieScatterExtended","excludingMethods","addMethods","getOwnPropertyNames","subSerie","PluginAxisSplitting","newBottomAxis","newLeftAxis","getOptions","SplitXAxis","SplitYAxis","margins","low","high","splits","splitNumber","subserie","splitAxis","sserie","xSubAxis","ySubAxis","getSubAxis","subAxisIndex","newLineSerie","newScatterSerie","serieObj","defaultAxisConstructorOptions","SplitAxis","delegateMethods","cl","constructorOptions","_splitVal","setSpan","_splits","axisIndex","fixGridFor","autoSpread","currentSplit","baseWidth","baseWidthIndex","_mean","_baseWidthVal","_baseWidthIndex","setChunkBoundaries","_splitSpread","subAxis","spanReference","getPrimaryTickUnit","forcePrimaryTickUnit","labelPosY","widthAfter","PluginMakeTracesDifferent","hue","saturation","lightness","seriesLength","serieTypes","allSeries","startingColorHSL","colorHSL","checkHSL","endingColorHSL","affect","endS","endL","colorString","buildHSLString","PluginPeakPicking","picks","autoPeakPickingNb","pick","detectedPeaks","lastYPeakPicking","peaks","passed","autoPeakPickingAllowAllY","autoPeakPickingMinDistance","autoPeakPickingFormat","_hidePeakPickingLocked","unlock","AxisXTime","GraphPluginShape","GraphPluginDrag","GraphPluginZoom","GraphPluginSelectScatter","GraphPluginTimeSerieManager","GraphPluginSerieLineDifference","GraphPluginAxisSplitting","GraphPluginMakeTracesDifferent","GraphPluginPeakPicking","ShapeAreaUnderCurve","ShapePe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A2B,mBAA3B,EAAgDonC,UAAhD;AACAj/C,QAAM6X,mBAAN,CAA2B,qBAA3B,EAAkDsnC,YAAlD;AACAn/C,QAAM6X,mBAAN,CAA2B,mBAA3B,EAAgD6nC,UAAhD;AACA1/C,QAAM6X,mBAAN,CAA2B,sBAA3B,EAAmD8nC,aAAnD;AACA3/C,QAAM6X,mBAAN,CAA2B,kBAA3B,EAA+ComC,SAA/C;AACAj+C,QAAM6X,mBAAN,CAA2B,yBAA3B,EAAsDgoC,gBAAtD;AACA7/C,QAAM6X,mBAAN,CAA2B,kBAA3B,EAA+CgsC,SAA/C;AACA7jD,QAAM6X,mBAAN,CAA2B,+BAA3B,EAA4DgrC,sBAA5D;;;;AAIA7iD,QAAM6X,mBAAN,CAA2B,kBAA3B,EAA+CirC,cAA/C;AACA9iD,QAAM6X,mBAAN,CAA2B,uBAA3B,EAAoDirC,cAApD;AACA9iD,QAAM6X,mBAAN,CAA2B,mBAA3B,EAAgDmrC,UAAhD;;AAEAhjD,QAAM6X,mBAAN,CAA2B,kCAA3B,EAA+Dm9C,mBAA/D;;;AAGAh1D,QAAM6X,mBAAN,CAA2B,cAA3B,EAA2Co9C,MAA3C;AACAj1D,QAAM6X,mBAAN,CAA2B,gBAA3B,EAA6C7mB,QAA7C;;;;"} \ No newline at end of file +{"version":3,"file":null,"sources":["/Users/normanpellet/Documents/Web/graph/src/graph.position.js","/Users/normanpellet/Documents/Web/graph/src/graph.util.js","/Users/normanpellet/Documents/Web/graph/src/dependencies/eventEmitter/EventEmitter.js","/Users/normanpellet/Documents/Web/graph/src/util/fit_lm.js","/Users/normanpellet/Documents/Web/graph/src/util/waveform.js","/Users/normanpellet/Documents/Web/graph/src/graph.core.js","/Users/normanpellet/Documents/Web/graph/src/graph.legend.js","/Users/normanpellet/Documents/Web/graph/src/graph.axis.js","/Users/normanpellet/Documents/Web/graph/src/graph.axis.x.js","/Users/normanpellet/Documents/Web/graph/src/graph.axis.y.js","/Users/normanpellet/Documents/Web/graph/src/graph.axis.x.bar.js","/Users/normanpellet/Documents/Web/graph/src/graph.axis.x.time.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.js","/Users/normanpellet/Documents/Web/graph/src/mixins/graph.mixin.errorbars.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.line.js","/Users/normanpellet/Documents/Web/graph/src/mixins/graph.mixin.serie3d.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.line.3d.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.bar.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.box.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.line.colored.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.scatter.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.zone.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.zone.3d.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.densitymap.js","/Users/normanpellet/Documents/Web/graph/src/series/graph.serie.contour.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.areaundercurve.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.line.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.arrow.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.ellipse.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.label.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.polyline.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.nmrintegral.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.rect.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.peakintegration2d.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.cross.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.peakboundariescenter.js","/Users/normanpellet/Documents/Web/graph/src/shapes/graph.shape.html.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.drag.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.shape.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.selectScatter.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.zoom.js","/Users/normanpellet/Documents/Web/graph/src/graph.lru.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.timeseriemanager.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.serielinedifference.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.axissplitting.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.makeTracesDifferent.js","/Users/normanpellet/Documents/Web/graph/src/plugins/graph.plugin.peakpicking.js","/Users/normanpellet/Documents/Web/graph/src/graph.js"],"sourcesContent":["function _parsePx( px ) {\n if ( px && px.indexOf && px.indexOf( 'px' ) > -1 ) {\n return parseInt( px.replace( 'px', '' ) );\n }\n return false;\n}\n\nfunction isNumeric( n ) {\n return !isNaN( parseFloat( n ) ) && isFinite( n );\n}\n\n/**\n * Utility class to compute positioning\n * @class\n */\nclass Position {\n\n constructor( x, y, dx, dy ) {\n\n if ( typeof x == 'object' ) {\n this.x = x.x;\n this.y = x.y;\n this.dx = x.dx;\n this.dy = x.dy;\n } else {\n this.x = x;\n this.y = y;\n this.dx = dx;\n this.dy = dy;\n }\n }\n\n duplicate() {\n return new Position( this.x, this.y, this.dx, this.dy );\n }\n\n /**\n * Computes the position of the position\n * @param {Graph} graph - The graph for which the position has to be computed\n * @param {AxisX} xAxis - The x axis to consider (has to belong to the graph)\n * @param {AxisY} yAxis - The y axis to consider (has to belong to the graph)\n * @param {Serie} [serie] - For non-existing y value, use a serie to compute it automatically from the serie data\n * @return {Object} An object in the format ```{x: xPx, y: yPx}``` containing the position in pixels of the position\n */\n compute( graph, xAxis, yAxis, serie ) {\n\n if ( !graph || !xAxis || !yAxis || !graph.hasXAxis || !graph.hasYAxis ) {\n graph.throw();\n }\n\n if ( !graph.hasXAxis( xAxis ) ) {\n throw ( 'Graph does not contain the x axis that was used as a parameter' );\n }\n\n if ( !graph.hasYAxis( yAxis ) ) {\n throw ( 'Graph does not contain the x axis that was used as a parameter' );\n }\n\n return this._compute( graph, xAxis, yAxis, serie );\n }\n\n _compute( graph, xAxis, yAxis, serie ) {\n\n var relativeTo = this._relativeTo;\n if ( relativeTo ) {\n var relativeToComputed = relativeTo._compute( graph, xAxis, yAxis, serie );\n }\n\n var parsed,\n pos = {\n x: false,\n y: false\n };\n\n if ( !xAxis ) {\n xAxis = graph.getXAxis();\n }\n\n if ( !yAxis ) {\n yAxis = graph.getYAxis();\n }\n\n for ( var i in pos ) {\n\n var axis = i == 'x' ? xAxis : yAxis;\n var val = this[ i ];\n var dval = this[ 'd' + i ];\n\n if ( val === undefined && ( ( dval !== undefined && relativeTo === undefined ) || relativeTo === undefined ) ) {\n\n if ( i == 'x' ) {\n\n if ( dval === undefined ) {\n continue;\n }\n\n pos[ i ] = relativeTo ? relativeTo[ i ] : 0;\n\n } else if ( this.x !== undefined && serie ) {\n\n if ( _parsePx( this.x ) !== false ) {\n console.warn( 'You have defined x in px and not y. Makes no sense. Returning 0 for y' );\n pos[ i ] = 0;\n } else {\n\n var closest = serie.searchClosestValue( this.x );\n\n if ( !closest ) {\n console.warn( 'Could not find y position for x = ' + ( this.x ) + ' on serie \"' + serie.getName() + '\". Returning 0 for y.' );\n pos[ i ] = 0;\n } else {\n pos[ i ] = serie.getY( closest.yMin );\n }\n }\n }\n\n } else if ( val !== undefined ) {\n\n pos[ i ] = this.getPx( val, axis );\n }\n\n if ( dval !== undefined ) {\n\n var def = ( val !== undefined || relativeToComputed == undefined || relativeToComputed[ i ] == undefined ) ? pos[ i ] : ( relativeToComputed[ i ] );\n\n if ( i == 'y' && relativeToComputed && relativeToComputed.x !== undefined && relativeToComputed.y == undefined ) {\n\n if ( !serie ) {\n throw 'Error. No serie exists. Cannot find y value';\n return;\n }\n\n var closest = serie.searchClosestValue( relativeTo.x );\n if ( closest ) {\n def = serie.getY( closest.yMin );\n }\n\n //console.log( relativeTo.x, closest, serie.getY( closest.yMin ), def );\n }\n\n if ( !def ) {\n def = 0;\n }\n\n if ( ( parsed = _parsePx( dval ) ) !== false ) { // dx in px => val + 10px\n\n pos[ i ] = def + parsed; // return integer (will be interpreted as px)\n\n } else if ( ( parsed = this._parsePercent( dval ) ) !== false ) {\n\n pos[ i ] = def + this._getPositionPx( parsed, true, axis, graph ); // returns xx%\n\n } else if ( axis ) {\n\n pos[ i ] = def + axis.getRelPx( dval ); // px + unittopx\n\n }\n }\n }\n\n return pos;\n }\n\n _getPositionPx( value, x, axis, graph ) {\n\n var parsed;\n\n if ( ( parsed = _parsePx( value ) ) !== false ) {\n return parsed; // return integer (will be interpreted as px)\n }\n\n if ( ( parsed = this._parsePercent( value ) ) !== false ) {\n return parsed / 100 * ( x ? graph.getDrawingWidth() : graph.getDrawingHeight() );\n } else if ( axis ) {\n return axis.getPos( value );\n }\n }\n\n _parsePercent( percent ) {\n if ( percent && percent.indexOf && percent.indexOf( '%' ) > -1 ) {\n return percent;\n }\n return false;\n }\n\n /**\n * Computes the value in pixels of an amplitude (or a distance) for a certain axis\n * @param {Number} value - The value in axis unit\n * @param {Axis} Axis - The x axis to consider (has to belong to the graph)\n * @return {String} The value in pixels, e.g. \"20px\"\n */\n getDeltaPx( value, axis ) {\n var v;\n if ( ( v = _parsePx( value ) ) !== false ) {\n return ( v ) + 'px';\n } else {\n\n return ( axis.getRelPx( value ) ) + 'px';\n }\n }\n\n deltaPosition( mode, delta, axis ) {\n\n mode = mode == 'y' ? 'y' : 'x';\n var ref = this[ mode ],\n refd = this[ 'd' + mode ],\n refPx,\n deltaPx;\n\n if ( ref !== undefined ) {\n if ( ( refPx = _parsePx( ref ) ) !== false ) {\n\n if ( ( deltaPx = _parsePx( delta ) ) !== false ) {\n this[ mode ] = ( refPx + deltaPx ) + 'px';\n } else {\n this[ mode ] = ( refPx + axis.getRelPx( delta ) ) + 'px';\n }\n } else {\n\n ref = this.getValPosition( ref, axis );\n\n if ( ( deltaPx = _parsePx( delta ) ) !== false ) {\n this[ mode ] = ( ref + axis.getRelVal( deltaPx ) );\n } else {\n this[ mode ] = ( ref + delta );\n }\n }\n } else if ( refd !== undefined ) {\n\n if ( mode == 'y' && ref === undefined && !this._relativeTo ) { // This means that the shape is placed by the x value. Therefore, the dy is only a stand-off.\n // Therefore, we do nothing\n return;\n }\n\n if ( ( refPx = _parsePx( refd ) ) !== false ) {\n\n if ( ( deltaPx = _parsePx( delta ) ) !== false ) {\n this[ 'd' + mode ] = ( refPx + deltaPx ) + 'px';\n } else {\n this[ 'd' + mode ] = ( refPx + axis.getRelPx( delta ) ) + 'px';\n }\n } else {\n\n refd = this.getValPosition( refd, axis );\n\n if ( ( deltaPx = _parsePx( delta ) ) !== false ) {\n this[ 'd' + mode ] = ( refd + axis.getRelVal( deltaPx ) );\n } else {\n this[ 'd' + mode ] = ( refd + delta );\n }\n }\n\n }\n }\n\n getValPosition( rel, axis ) {\n\n if ( rel == 'max' ) {\n return axis.getMaxValue();\n }\n\n if ( rel == 'min' ) {\n return axis.getMinValue();\n }\n\n return rel;\n }\n\n /**\n * Computes a value in pixels\n * @param {Number} value - The value in axis unit\n * @param {Axis} axis - The x or y axis to consider (has to belong to the graph)\n * @param {Boolean} rel - Whether or not the value is a distance\n * @return {(Number|String)} The computed value\n */\n getPx( value, axis, rel ) {\n\n var parsed;\n\n if ( typeof value == 'function' ) {\n\n return value( axis, rel );\n\n } else if ( ( parsed = _parsePx( value ) ) !== false ) {\n\n return parsed; // return integer (will be interpreted as px)\n\n } else if ( ( parsed = this._parsePercent( value ) ) !== false ) {\n\n return parsed; // returns xx%\n\n } else if ( axis ) {\n\n if ( value == 'min' ) {\n\n return axis.getMinPx();\n\n } else if ( value == 'max' ) {\n\n return axis.getMaxPx();\n\n } else if ( rel ) {\n\n return axis.getRelPx( value );\n\n } else if ( isNumeric( value ) ) {\n\n return axis.getPos( value );\n }\n }\n }\n\n getPxRel( value, axis ) {\n return this.getPx( value, axis, true );\n }\n\n /**\n * Assigns the current position as relative to another. This is used when a position is used with \"dx\" or \"dy\" and not \"x\" or \"y\"\n * @param {Position} pos - The reference position\n * @return {Position} The current position\n */\n relativeTo( pos ) {\n this._relativeTo = Position.check( pos );\n return this;\n }\n\n /**\n * Checks if an object is a position. If not, creates a new Position instance with the ```pos``` object. If a new position is created, ```callback``` is fired with the position as a unique parameter. The return of the function, if not false, should be a ```Position``` instance which serves as the reference position.\n * @example Position.check( { x: 1, y: 2 }, function() { return someOtherPosition; } );\n * @param {(Object|Position)} pos - The position object or the object fed into the constructor\n * @param {Function} callback - The callback fired if a new position is created\n * @return {Position} The resulting position object\n */\n static check( pos, callback ) {\n if ( pos instanceof Position ) {\n return pos;\n }\n\n var posObject = new Position( pos );\n\n if ( pos && pos.relativeTo ) {\n const position = callback( pos.relativeTo );\n if ( position ) {\n posObject.relativeTo( position );\n }\n }\n\n return posObject;\n }\n}\n\nexport default Position;","/**\n * Easy set attribute method to apply to a SVG Element the attributes listed. Optional namespacing\n * @param {SVGElement} to - The SVG element to apply the attributes to\n * @param {Object} attr - A key/value hashmap of attributes\n * @param {String} [ ns = undefined ] - The namespace to use (with setAttributeNS). Default if without namespacing\n */\nexport function setAttributeTo( to, params, ns ) {\n var i;\n\n if ( ns ) {\n for ( i in params ) {\n to.setAttributeNS( ns, i, params[ i ] );\n }\n } else {\n for ( i in params ) {\n to.setAttribute( i, params[ i ] );\n }\n }\n}\n\n/**\n * Maps old-style events defined within the creation (i.e. { onMouseOver: function() }) to modern event listening .on(\"mouseover\")\n * The function will read any object and select the ones starting with \"on\"\n * @params {Object} options - An option object to read the events from\n * @param {Object} source - The source object to which the options belong\n * @example util.mapEventEmission( this.options, this );\n */\nexport function mapEventEmission( options, source ) {\n\n if ( !source ) {\n source = this;\n }\n\n var eventName;\n\n for ( var i in options ) {\n\n // Starts with onXXX\n if ( i.indexOf( 'on' ) == 0 && typeof options[ i ] == 'function' ) {\n eventName = i.substring( 2 );\n eventName = eventName.substring( 0, 1 ).toLowerCase() + eventName.substring( 1 );\n\n if ( source.on ) {\n\n ( function( j ) {\n\n source.on( eventName, function() {\n options[ j ].apply( source, arguments );\n } );\n\n } )( i );\n\n }\n }\n }\n}\n\n/**\n * @link http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript\n * @return {String} a random id\n */\nexport function guid() {\n //\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace( /[xy]/g, function( c ) {\n var r = Math.random() * 16 | 0,\n v = c == 'x' ? r : ( r & 0x3 | 0x8 );\n return v.toString( 16 );\n } );\n\n}\n\nexport function throwError( message ) {\n console.error( message );\n}\n\nexport function warn( message ) {\n console.warn( message );\n}\n\n/**\n * Checks if a variable is a numeric or not\n * @return {Boolean} true for a numeric value, false otherwise\n */\nexport function isNumeric( obj ) {\n return !Array.isArray( obj ) && ( obj - parseFloat( obj ) + 1 ) >= 0;\n}\n\n/**\n * @see http://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion\n * Converts an HSL color value to RGB. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSL_color_space.\n * Assumes h, s, and l are contained in the set [0, 1] and\n * returns r, g, and b in the set [0, 255].\n *\n * @param Number h The hue\n * @param Number s The saturation\n * @param Number l The lightness\n * @return Array The RGB representation\n */\nexport function hue2rgb( p, q, t ) {\n if ( t < 0 ) t += 1;\n if ( t > 1 ) t -= 1;\n if ( t < 1 / 6 ) return p + ( q - p ) * 6 * t;\n if ( t < 1 / 2 ) return q;\n if ( t < 2 / 3 ) return p + ( q - p ) * ( 2 / 3 - t ) * 6;\n return p;\n}\n\nexport function hslToRgb( h, s, l ) {\n var r, g, b;\n\n if ( s == 0 ) {\n r = g = b = l; // achromatic\n } else {\n\n var q = l < 0.5 ? l * ( 1 + s ) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb( p, q, h + 1 / 3 );\n g = hue2rgb( p, q, h );\n b = hue2rgb( p, q, h - 1 / 3 );\n }\n\n return [ Math.round( r * 255 ), Math.round( g * 255 ), Math.round( b * 255 ) ];\n}\n\nexport function saveDomAttributes( to, attributes, identification ) {\n\n if ( !to ) return;\n\n to._savedAttributesIds = to._savedAttributesIds || [];\n\n if ( to._savedAttributesIds.indexOf( identification ) > -1 ) {\n restoreDomAttributes( to, identification );\n }\n\n to._savedAttributes = to._savedAttributes || {};\n to._attributes = to._attributes || {};\n to._attributes[ identification ] = attributes;\n\n to._savedAttributesIds.push( identification );\n\n for ( var i in attributes ) {\n\n if ( !to._savedAttributes[ i ] ) {\n to._savedAttributes[ i ] = to.getAttribute( i );\n }\n\n to.setAttribute( i, attributes[ i ] );\n }\n\n}\n\nexport function hasSavedAttribute( dom, attr ) {\n return dom._savedAttributes && dom._savedAttributes[ attr ] !== undefined;\n}\n\nexport function overwriteDomAttribute( dom, attribute, newValue ) {\n if ( hasSavedAttribute( dom, attribute ) ) {\n dom._savedAttributes[ attribute ] = newValue;\n }\n}\n\nexport function restoreDomAttributes( to, identification ) {\n\n if ( !to || !to._savedAttributesIds ) {\n return;\n }\n\n to._savedAttributesIds.splice( to._savedAttributesIds.indexOf( identification ), 1 );\n delete to._attributes[ identification ];\n\n var attrs = {};\n\n for ( var i in to._savedAttributes ) {\n attrs[ i ] = to._savedAttributes[ i ];\n }\n\n for ( var i = 0, l = to._savedAttributesIds.length; i < l; i++ ) {\n\n for ( var j in to._attributes[ to._savedAttributesIds[ i ] ] ) {\n attrs[ j ] = to._attributes[ to._savedAttributesIds[ i ] ][ j ];\n }\n }\n\n for ( var j in attrs ) {\n to.setAttribute( j, attrs[ j ] );\n }\n\n}\n\n// https://davidwalsh.name/function-debounce\nexport function debounce( func, wait, immediate ) {\n var timeout;\n return function() {\n var context = this,\n args = arguments;\n var later = function() {\n timeout = null;\n if ( !immediate ) func.apply( context, args );\n };\n var callNow = immediate && !timeout;\n clearTimeout( timeout );\n timeout = setTimeout( later, wait );\n if ( callNow ) func.apply( context, args );\n };\n}\n\nexport function SVGParser( svgString ) {\n\n var parser = new DOMParser();\n var doc = parser.parseFromString( svgString, 'image/svg+xml' );\n // returns a SVGDocument, which also is a Document.\n\n return doc;\n\n}\n\n// http://stackoverflow.com/questions/5276953/what-is-the-most-efficient-way-to-reverse-an-array-in-javascript\nexport function reverseArray( array ) {\n var left = null;\n var right = null;\n var length = array.length;\n for ( left = 0, right = length - 1; left < right; left += 1, right -= 1 ) {\n var temporary = array[ left ];\n array[ left ] = array[ right ];\n array[ right ] = temporary;\n }\n return array;\n}\n\n// jQuery.fn.offset\nexport function getOffset( el ) {\n var rect = el.getBoundingClientRect();\n return {\n top: rect.top,\n left: rect.left\n };\n}\n\n// jQuery.fn.css\nexport function setCSS( element, values ) {\n var style = element.style;\n for ( var i in values ) {\n style[ i ] = values[ i ];\n }\n}\n\nexport function ajaxGet( options ) {\n return new Promise( function( resolve, reject ) {\n var request = new XMLHttpRequest();\n request.open( options.type || 'GET', options.url, true );\n if ( options.json ) request.setRequestHeader( 'Accept', 'application/json' );\n request.onload = function() {\n if ( request.status === 200 ) {\n var response = request.responseText;\n if ( options.json ) response = JSON.parse( response );\n resolve( response );\n } else {\n reject( new Error( 'Request error: ' + request.status ) );\n }\n };\n request.onerror = function() {\n reject( new Error( 'Network error: ' + request.status ) );\n };\n request.send();\n } );\n}\n\n// https://raw.githubusercontent.com/justmoon/node-extend/888f153645115d1c6aa9a7e346e8e9cd9a83de9b/index.js\n// Copyright (c) 2014 Stefan Thomas\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\n\nvar isArray = function isArray( arr ) {\n if ( typeof Array.isArray === 'function' ) {\n return Array.isArray( arr );\n }\n\n return toStr.call( arr ) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject( obj ) {\n if ( !obj || toStr.call( obj ) !== '[object Object]' ) {\n return false;\n }\n\n var hasOwnConstructor = hasOwn.call( obj, 'constructor' );\n var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call( obj.constructor.prototype, 'isPrototypeOf' );\n // Not own constructor property must be Object\n if ( obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf ) {\n return false;\n }\n\n // Own properties are enumerated firstly, so to speed up,\n // if last one is own, then all properties are own.\n var key;\n for ( key in obj ) { /**/ }\n\n return typeof key === 'undefined' || hasOwn.call( obj, key );\n};\n\nexport function extend() {\n var options, name, src, copy, copyIsArray, clone;\n var target = arguments[ 0 ];\n var i = 1;\n var length = arguments.length;\n var deep = false;\n\n // Handle a deep copy situation\n if ( typeof target === 'boolean' ) {\n deep = target;\n target = arguments[ 1 ] || {};\n // skip the boolean and the target\n i = 2;\n } else if ( ( typeof target !== 'object' && typeof target !== 'function' ) || target == null ) {\n target = {};\n }\n\n for ( ; i < length; ++i ) {\n options = arguments[ i ];\n // Only deal with non-null/undefined values\n if ( options != null ) {\n // Extend the base object\n for ( name in options ) {\n src = target[ name ];\n copy = options[ name ];\n\n // Prevent never-ending loop\n if ( target !== copy ) {\n // Recurse if we're merging plain objects or arrays\n if ( deep && copy && ( isPlainObject( copy ) || ( copyIsArray = isArray( copy ) ) ) ) {\n if ( copyIsArray ) {\n copyIsArray = false;\n clone = src && isArray( src ) ? src : [];\n } else {\n clone = src && isPlainObject( src ) ? src : {};\n }\n\n // Never move original objects, clone them\n target[ name ] = extend( deep, clone, copy );\n\n // Don't bring in undefined values\n } else if ( typeof copy !== 'undefined' ) {\n target[ name ] = copy;\n }\n }\n }\n }\n }\n\n // Return the modified object\n return target;\n}\n\nexport default {};\n\nexport {\n isArray\n};\nexport {\n isPlainObject\n};\n\nexport function mix( baseClass, mixin ) {\n\n for ( let prop in mixin ) {\n\n if ( mixin.hasOwnProperty( prop ) ) {\n baseClass.prototype[ prop ] = mixin[ prop ];\n }\n }\n}\n\nexport function emptyDom( dom ) {\n while ( dom.firstChild ) {\n dom.removeChild( dom.firstChild );\n }\n}","/*!\n * EventEmitter v4.2.9 - git.io/ee\n * Oliver Caldwell\n * MIT license\n * @preserve\n */\n\n'use strict';\n\n/**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\nfunction EventEmitter() {}\n\n// Shortcuts to improve speed and size\nvar proto = EventEmitter.prototype;\n\n/**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\nfunction indexOfListener( listeners, listener ) {\n var i = listeners.length;\n while ( i-- ) {\n if ( listeners[ i ].listener === listener ) {\n return i;\n }\n }\n\n return -1;\n}\n\n/**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\nfunction alias( name ) {\n return function aliasClosure() {\n return this[ name ].apply( this, arguments );\n };\n}\n\n/**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\nproto.getListeners = function getListeners( evt ) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if ( evt instanceof RegExp ) {\n response = {};\n for ( key in events ) {\n if ( events.hasOwnProperty( key ) && evt.test( key ) ) {\n response[ key ] = events[ key ];\n }\n }\n } else {\n response = events[ evt ] || ( events[ evt ] = [] );\n }\n\n return response;\n};\n\n/**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\nproto.flattenListeners = function flattenListeners( listeners ) {\n var flatListeners = [];\n var i;\n\n for ( i = 0; i < listeners.length; i += 1 ) {\n flatListeners.push( listeners[ i ].listener );\n }\n\n return flatListeners;\n};\n\n/**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\nproto.getListenersAsObject = function getListenersAsObject( evt ) {\n var listeners = this.getListeners( evt );\n var response;\n\n if ( listeners instanceof Array ) {\n response = {};\n response[ evt ] = listeners;\n }\n\n return response || listeners;\n};\n\n/**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.addListener = function addListener( evt, listener ) {\n var listeners = this.getListenersAsObject( evt );\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for ( key in listeners ) {\n if ( listeners.hasOwnProperty( key ) && indexOfListener( listeners[ key ], listener ) === -1 ) {\n listeners[ key ].push( listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n } );\n }\n }\n\n return this;\n};\n\n/**\n * Alias of addListener\n */\nproto.on = alias( 'addListener' );\n\n/**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.addOnceListener = function addOnceListener( evt, listener ) {\n return this.addListener( evt, {\n listener: listener,\n once: true\n } );\n};\n\n/**\n * Alias of addOnceListener.\n */\nproto.once = alias( 'addOnceListener' );\n\n/**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.defineEvent = function defineEvent( evt ) {\n this.getListeners( evt );\n return this;\n};\n\n/**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.defineEvents = function defineEvents( evts ) {\n for ( var i = 0; i < evts.length; i += 1 ) {\n this.defineEvent( evts[ i ] );\n }\n return this;\n};\n\n/**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.removeListener = function removeListener( evt, listener ) {\n var listeners = this.getListenersAsObject( evt );\n var index;\n var key;\n\n for ( key in listeners ) {\n if ( listeners.hasOwnProperty( key ) ) {\n index = indexOfListener( listeners[ key ], listener );\n\n if ( index !== -1 ) {\n listeners[ key ].splice( index, 1 );\n }\n }\n }\n\n return this;\n};\n\n/**\n * Alias of removeListener\n */\nproto.off = alias( 'removeListener' );\n\n/**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.addListeners = function addListeners( evt, listeners ) {\n // Pass through to manipulateListeners\n return this.manipulateListeners( false, evt, listeners );\n};\n\n/**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.removeListeners = function removeListeners( evt, listeners ) {\n // Pass through to manipulateListeners\n return this.manipulateListeners( true, evt, listeners );\n};\n\n/**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.manipulateListeners = function manipulateListeners( remove, evt, listeners ) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if ( typeof evt === 'object' && !( evt instanceof RegExp ) ) {\n for ( i in evt ) {\n if ( evt.hasOwnProperty( i ) && ( value = evt[ i ] ) ) {\n // Pass the single listener straight through to the singular method\n if ( typeof value === 'function' ) {\n single.call( this, i, value );\n } else {\n // Otherwise pass back to the multiple function\n multiple.call( this, i, value );\n }\n }\n }\n } else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while ( i-- ) {\n single.call( this, evt, listeners[ i ] );\n }\n }\n\n return this;\n};\n\n/**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.removeEvent = function removeEvent( evt ) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if ( type === 'string' ) {\n // Remove all listeners for the specified event\n delete events[ evt ];\n } else if ( evt instanceof RegExp ) {\n // Remove all events matching the regex.\n for ( key in events ) {\n if ( events.hasOwnProperty( key ) && evt.test( key ) ) {\n delete events[ key ];\n }\n }\n } else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n};\n\n/**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\nproto.removeAllListeners = alias( 'removeEvent' );\n\n/**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.emitEvent = function emitEvent( evt, args ) {\n var listeners = this.getListenersAsObject( evt );\n var listener;\n var i;\n var key;\n var response;\n\n for ( key in listeners ) {\n if ( listeners.hasOwnProperty( key ) ) {\n i = listeners[ key ].length;\n\n while ( i-- ) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[ key ][ i ];\n\n if ( listener.once === true ) {\n this.removeListener( evt, listener.listener );\n }\n\n response = listener.listener.apply( this, args || [] );\n\n if ( response === this._getOnceReturnValue() ) {\n this.removeListener( evt, listener.listener );\n }\n }\n }\n }\n\n return this;\n};\n\n/**\n * Alias of emitEvent\n */\nproto.trigger = alias( 'emitEvent' );\n\n/**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.emit = function emit( evt ) {\n var args = Array.prototype.slice.call( arguments, 1 );\n return this.emitEvent( evt, args );\n};\n\n/**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.setOnceReturnValue = function setOnceReturnValue( value ) {\n this._onceReturnValue = value;\n return this;\n};\n\n/**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\nproto._getOnceReturnValue = function _getOnceReturnValue() {\n if ( this.hasOwnProperty( '_onceReturnValue' ) ) {\n return this._onceReturnValue;\n } else {\n return true;\n }\n};\n\n/**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\nproto._getEvents = function _getEvents() {\n return this._events || ( this._events = {} );\n};\n\nexport default EventEmitter;","class FitHost {\n\n constructor( options ) {\n\n this.DELTAP = 1e-6;\n this.BIGVAL = 9e99;\n this.WEIGHT = 1.0;\n\n this.setYData( options.dataY );\n this.setXData( options.dataX );\n this.setWeight( options.weight );\n this.setInitialParams( options.params );\n\n if ( options.subsetIndex ) {\n this.setSubset( ...options.subsetIndex );\n }\n\n this.setFunction( options.function );\n\n if ( options.progress ) {\n this.hookIteration( options.progress );\n }\n\n this.options = options;\n }\n\n //[ [ x1, y1 ], [ x2, y2 ] ]\n setYData( data ) { // Waveform instance\n this.data = data;\n }\n\n setXData( data ) { // Waveform instance\n this.dataX = data;\n }\n\n setWeight( weight ) { // Waveform instance\n this.weight = weight;\n }\n\n setInitialParams( params ) {\n this.parms = params;\n\n this.parms = this.parms.map( ( el ) => {\n if ( typeof el == 'function' ) {\n return el( this.data, this.dataX );\n } else {\n return el;\n }\n } );\n this.NPARMS = params.length;\n }\n\n setSubset( fromIndex, toIndex ) {\n if ( fromIndex !== undefined && toIndex !== undefined ) {\n this._from = fromIndex;\n this._to = toIndex;\n }\n }\n\n hookIteration( f ) {\n this._hookIteration = ( params ) => {\n let data = this.buildFit( params, 200 );\n f( data );\n };\n }\n\n setFunction( func ) {\n this._func = func;\n }\n\n init() {\n\n // Get data length\n if ( this._from !== undefined && this._to !== undefined ) {\n\n if ( this._from >= this._to ) {\n throw 'Impossible to fit negative subranges. The starting index must be lower than the ending index';\n }\n\n this.NPTS = this._to - this._from + 1;\n\n if ( this.data && this.data.getLength() <= this._to ) {\n throw 'Wave Y has not enough point to be fitted to subrange [' + this._from + ', ' + this._to + ']';\n }\n\n if ( this._from < 0 ) {\n throw 'Impossible to fit a subrange with negative indices';\n }\n\n } else {\n\n this.NPTS = this.data.getLength();\n this._from = 0;\n this._to = this.data.getLength() - 1;\n }\n\n if ( this.dataX && this.dataX.getLength() <= this._to ) {\n throw 'Wave X has not enough point to be fitted to subrange [' + this._from + ', ' + this._to + ']';\n }\n\n this.arrY = this.data.getDataY();\n\n if ( this.dataX ) {\n this.arrX = this.dataX.getDataY();\n } else {\n this.arrX = this.data.getDataX();\n }\n\n this.resid = new Array( this.NPTS ).fill( 0 );\n this.jac = new Array( this.NPTS ).fill( 0 );\n this.jac = this.jac.map( ( el ) => new Array( this.NPARMS ) );\n }\n\n fit() {\n\n this.log( 'Starting the fit with initial parameter list {' + this.parms.join() + '};' );\n new LM( this, this.NPARMS, this.NPTS, this._hookIteration );\n this.log( 'Fit successful. Output parameters {' + this.parms.join() + '};' );\n\n this._result = this.buildFit( this.parms, 200 );\n\n if ( this.options.done ) {\n this.options.done( this.parms, this._result );\n }\n\n return this._result;\n }\n\n func( x, param ) {\n return this._func( x, param );\n }\n\n computeResiduals() {\n var sumsq = 0;\n for ( var i = 0; i < this.NPTS; i++ ) {\n this.resid[ i ] = ( this.func( this.arrX[ i + this._from ], this.parms ) - this.arrY[ i + this._from ] ) * ( this.WEIGHT );\n sumsq += this.resid[ i ] * this.resid[ i ];\n }\n\n return sumsq;\n }\n\n log( message ) {\n if ( this.options.log ) {\n console.log( message );\n }\n }\n\n //------the four mandated interface methods------------\n nudge( dp ) {\n\n for ( var j = 0; j < this.NPARMS; j++ ) {\n this.parms[ j ] += dp[ j ];\n }\n return this.computeResiduals();\n }\n\n buildJacobian() {\n // Allows LM to compute a new Jacobian.\n // Uses current parms[] and two-sided finite difference.\n // If current parms[] is bad, returns false.\n var delta = new Array( this.NPARMS );\n var FACTOR = 0.5 / this.DELTAP;\n var d = 0;\n\n for ( var j = 0; j < this.NPARMS; j++ ) {\n for ( var k = 0; k < this.NPARMS; k++ )\n delta[ k ] = ( k == j ) ? this.DELTAP : 0.0;\n\n d = this.nudge( delta ); // resid at pplus\n if ( d == this.BIGVAL ) {\n throw 'Bad dBuildJacobian() exit 2';\n }\n\n for ( var i = 0; i < this.NPTS; i++ ) {\n this.jac[ i ][ j ] = this.getResidualElement( i );\n }\n\n for ( var k = 0; k < this.NPARMS; k++ ) {\n delta[ k ] = ( k == j ) ? -2 * this.DELTAP : 0.0;\n }\n\n d = this.nudge( delta ); // resid at pminus\n if ( d == this.BIGVAL ) {\n throw 'Bad dBuildJacobian(). exit 3';\n }\n\n for ( var i = 0; i < this.NPTS; i++ )\n this.jac[ i ][ j ] -= this.getResidualElement( i ); // fetches resid[]\n\n for ( var i = 0; i < this.NPTS; i++ )\n this.jac[ i ][ j ] *= FACTOR;\n\n for ( var k = 0; k < this.NPARMS; k++ )\n delta[ k ] = ( k == j ) ? this.DELTAP : 0.0;\n\n d = this.nudge( delta );\n if ( d == this.BIGVAL ) {\n throw 'Bad dBuildJacobian(). exit 4';\n }\n }\n return true;\n }\n\n getResidualElement( i ) {\n // Allows LM to see one element of the resid[] vector.\n return this.resid[ i ];\n }\n\n getJacobianElement( i, j ) {\n // Allows LM to see one element of the Jacobian matrix.\n return this.jac[ i ][ j ];\n }\n\n buildFit( parms, length ) {\n let x;\n\n if ( !length ) {\n x = this.arrX;\n } else {\n\n const xmin = ( this.dataX ).getMin( this._from, this._to );\n const xmax = ( this.dataX ).getMax( this._from, this._to );\n\n x = new Array( length ).fill( 0 ).map( ( el, index ) => index * ( xmax - xmin ) / ( length - 1 ) + xmin );\n }\n\n var fit = new Array( x.length );\n for ( var i = 0, l = x.length; i < l; i++ ) {\n fit[ i ] = this.func( x[ i ], this.parms );\n }\n\n let waveformResult = this.options.waveform;\n waveformResult.setData( fit, x );\n //waveformResult.setXWaveform( x );\n\n return waveformResult;\n }\n}\n\nclass LM {\n\n constructor( gH, gnadj, gnpnts, hook ) {\n\n this.LMITER = 100; // max number of L-M iterations\n this.LMBOOST = 2.0; // damping increase per failed step\n this.LMSHRINK = 0.10; // damping decrease per successful step\n this.LAMBDAZERO = 0.001; // initial damping\n this.LAMBDAMAX = 1E9; // max damping\n this.LMTOL = 1E-12; // exit tolerance\n this.BIGVAL = 9e99; // trouble flag\n\n this.sos;\n this.sosprev;\n this.lambda;\n\n this.myH = null; // overwritten by constructor\n this.nadj = 0; // overwritten by constructor\n this.npts = 0; // overwritten by constructor\n\n this.delta; // local parm change\n this.beta;\n this.alpha;\n this.amatrix;\n\n // Constructor sets up fields and drives iterations.\n this.myH = gH;\n this.nadj = gnadj;\n this.npts = gnpnts;\n\n this.delta = new Array( this.nadj ).fill( 0 );\n this.beta = new Array( this.nadj ).fill( 0 );\n\n this.alpha = new Array( this.nadj ).fill( 0 );\n this.amatrix = new Array( this.nadj ).fill( 0 );\n\n this.alpha = this.alpha.map( () => new Array( this.nadj ) );\n this.amatrix = this.amatrix.map( () => new Array( this.nadj ) );\n\n this.lambda = this.LAMBDAZERO;\n\n var niter = 0;\n var done = false;\n do {\n done = this.bLMiter();\n\n if ( hook ) {\n hook( this.myH.params );\n }\n\n niter++;\n }\n while ( !done && ( niter < this.LMITER ) );\n }\n\n bLMiter() {\n // Each call performs one LM iteration.\n // Returns true if done with iterations; false=wants more.\n // Global nadj, npts; needs nadj, myH to be preset.\n // Ref: M.Lampton, Computers in Physics v.11 pp.110-115 1997.\n for ( var k = 0; k < this.nadj; k++ )\n this.delta[ k ] = 0.0;\n this.sos = this.myH.nudge( this.delta );\n if ( this.sos == this.BIGVAL ) {\n console.error( ' bLMiter finds faulty initial nudge()' );\n return false;\n }\n this.sosprev = this.sos;\n\n this.myH.log( ' bLMiter..SumOfSquares= ' + this.sos );\n if ( !this.myH.buildJacobian() ) {\n console.error( ' bLMiter finds buildJacobian()=false' );\n return false;\n }\n\n for ( var k = 0; k < this.nadj; k++ ) // get downhill gradient beta\n {\n this.beta[ k ] = 0.0;\n for ( var i = 0; i < this.npts; i++ ) {\n this.beta[ k ] -= this.myH.getResidualElement( i ) * this.myH.getJacobianElement( i, k );\n }\n }\n\n for ( var k = 0; k < this.nadj; k++ ) // get curvature matrix alpha\n for ( var j = 0; j < this.nadj; j++ ) {\n this.alpha[ j ][ k ] = 0.0;\n for ( var i = 0; i < this.npts; i++ ) {\n this.alpha[ j ][ k ] += this.myH.getJacobianElement( i, j ) * this.myH.getJacobianElement( i, k );\n }\n }\n var rrise = 0;\n do // inner damping loop searches for one downhill step\n {\n for ( var k = 0; k < this.nadj; k++ ) { // copy and damp it\n for ( var j = 0; j < this.nadj; j++ ) {\n this.amatrix[ j ][ k ] = this.alpha[ j ][ k ] + ( ( j == k ) ? this.lambda : 0.0 );\n }\n }\n\n this.gaussj( this.amatrix, this.nadj ); // invert\n\n for ( var k = 0; k < this.nadj; k++ ) // compute delta[]\n {\n this.delta[ k ] = 0.0;\n for ( var j = 0; j < this.nadj; j++ )\n this.delta[ k ] += this.amatrix[ j ][ k ] * this.beta[ j ];\n }\n this.sos = this.myH.nudge( this.delta ); // try it out.\n if ( this.sos == this.BIGVAL ) {\n console.error( ' LMinner failed SOS step' );\n return false;\n }\n rrise = ( this.sos - this.sosprev ) / ( 1 + this.sos );\n if ( rrise <= 0.0 ) // good step!\n {\n this.lambda *= this.LMSHRINK; // shrink lambda\n break; // leave lmInner.\n }\n for ( var q = 0; q < this.nadj; q++ ) { // reverse course!\n this.delta[ q ] *= -1.0;\n }\n this.myH.nudge( this.delta ); // sosprev should still be OK\n if ( rrise < this.LMTOL ) { // finished but keep prev parms\n break; // leave inner loop\n }\n this.lambda *= this.LMBOOST; // else try more damping.\n } while ( this.lambda < this.LAMBDAMAX );\n return ( rrise > -this.LMTOL ) || ( this.lambda > this.LAMBDAMAX );\n }\n\n gaussj( a, N ) {\n // Inverts the double array a[N][N] by Gauss-Jordan method\n // M.Lampton UCB SSL (c)2003, 2005\n\n var det = 1.0,\n big, save;\n var i, j, k, L;\n var ik = new Array( 100 );\n var jk = new Array( 100 );\n\n for ( k = 0; k < N; k++ ) {\n big = 0.0;\n for ( i = k; i < N; i++ )\n for ( j = k; j < N; j++ ) // find biggest element\n if ( Math.abs( big ) <= Math.abs( a[ i ][ j ] ) ) {\n big = a[ i ][ j ];\n ik[ k ] = i;\n jk[ k ] = j;\n }\n if ( big == 0.0 ) return 0.0;\n i = ik[ k ];\n if ( i > k )\n for ( j = 0; j < N; j++ ) // exchange rows\n {\n save = a[ k ][ j ];\n a[ k ][ j ] = a[ i ][ j ];\n a[ i ][ j ] = -save;\n }\n j = jk[ k ];\n if ( j > k )\n for ( i = 0; i < N; i++ ) {\n save = a[ i ][ k ];\n a[ i ][ k ] = a[ i ][ j ];\n a[ i ][ j ] = -save;\n }\n for ( i = 0; i < N; i++ ) // build the inverse\n if ( i != k )\n a[ i ][ k ] = -a[ i ][ k ] / big;\n for ( i = 0; i < N; i++ )\n for ( j = 0; j < N; j++ )\n if ( ( i != k ) && ( j != k ) )\n a[ i ][ j ] += a[ i ][ k ] * a[ k ][ j ];\n for ( j = 0; j < N; j++ )\n if ( j != k )\n a[ k ][ j ] /= big;\n a[ k ][ k ] = 1.0 / big;\n det *= big; // bomb point\n } // end k loop\n for ( L = 0; L < N; L++ ) {\n k = N - L - 1;\n j = ik[ k ];\n if ( j > k )\n for ( i = 0; i < N; i++ ) {\n save = a[ i ][ k ];\n a[ i ][ k ] = -a[ i ][ j ];\n a[ i ][ j ] = save;\n }\n i = jk[ k ];\n if ( i > k )\n for ( j = 0; j < N; j++ ) {\n save = a[ k ][ j ];\n a[ k ][ j ] = -a[ i ][ j ];\n a[ i ][ j ] = save;\n }\n }\n return det;\n }\n}\n\nexport default FitHost;\n//module.export = FitHost","import FitLM from './fit_lm';\nimport extend from 'extend';\n\nclass Waveform {\n\n constructor( data = [], xOffset = 0, xScale = 1 ) {\n\n this.xOffset = xOffset;\n this.xScale = xScale;\n this.setData( data );\n }\n\n /** [ [ x1, y1 ], [ x2, y2 ] ] */\n\n /*\n setDataXY( data ) {\n\n let newData = [ this._makeArray( data.length ), this._makeArray( data.length ) ],\n warnNaN = false;\n const nanable = this.isNaNAllowed();\n\n data.map( ( el, index ) => {\n\n if ( !nanable && ( el[ 0 ] !== el[ 0 ] || el[ 1 ] !== el[ 1 ] ) ) {\n warnNaN = true;\n }\n\n newData[ 0 ][ index ] = el[ 0 ];\n newData[ 1 ][ index ] = el[ 1 ];\n } );\n\n if ( warnNaN ) {\n this.warn( \"Trying to assign NaN values to a typed array that does not support NaNs. 0's will be used instead\" );\n }\n\n this._setData( ...newData );\n return this;\n }\n*/\n setData( data, dataX = null ) {\n\n /* First, we must treat the case of the array of array for backward compatibility */\n if ( Array.isArray( data[ 0 ] ) ) {\n let x = [];\n let y = [];\n data.forEach( ( el ) => {\n x.push( el[ 0 ] );\n y.push( el[ 1 ] );\n } );\n\n this.setXWaveform( x );\n data = y;\n }\n\n let newData = this._makeArray( data.length ),\n warnNaN = false;\n\n const nanable = this.isNaNAllowed();\n\n data.map( ( el, index ) => {\n\n if ( !nanable && ( el[ 0 ] !== el[ 0 ] || el[ 1 ] !== el[ 1 ] ) ) {\n warnNaN = true;\n }\n\n newData[ index ] = el;\n } );\n\n if ( warnNaN ) {\n this.warn( \"Trying to assign NaN values to a typed array that does not support NaNs. 0's will be used instead\" );\n }\n\n this._setData( newData );\n\n if ( dataX ) {\n this.setXWaveform( dataX );\n }\n return this;\n }\n\n getY( index, optimized ) {\n\n if ( optimized && this.dataInUse ) {\n return this.dataInUse.y[ index ] * this.getScale() + this.getShift();\n }\n\n return this.data[ index ] * this.getScale() + this.getShift();\n }\n\n /*\n flipXY() {\n let temp;\n temp = this.data.x;\n this.data.x = this.data.y;\n this.data.y = temp;\n\n this._setData( this.data.x, this.data.y );\n }*/\n\n setXWaveform( waveform ) {\n\n if ( !( waveform instanceof Waveform ) ) {\n\n if ( Array.isArray( waveform ) ) {\n waveform = new Waveform( waveform );\n } else {\n throw \"Cannot set X waveform. Data is not a valid array.\"\n }\n }\n\n this.xdata = waveform;\n this.computeXMinMax();\n return this;\n }\n\n hasXWaveform() {\n return !!this.xdata;\n }\n\n getXWaveform() {\n if ( this.xdata ) {\n return this.xdata;\n }\n\n var wave = new Waveform();\n for ( var i = 0; i < this.getLength(); i += 1 ) {\n wave.append( this.getX( i ) );\n }\n return wave;\n }\n\n rescaleX( offset, scale ) {\n this.xScale = scale;\n this.xOffset = offset;\n this.computeXMinMax();\n return this;\n }\n\n getTypedArrayClass() {\n return this._typedArrayClass || false;\n }\n\n setTypedArrayClass( constructor ) {\n\n if ( this.getTypedArrayClass() && this.isNaNAllowed() && !this.isNaNAllowed( constructor ) ) {\n this.warn( \"NaN values are not allowed by the new constructor (\" + constructor.name + \") while it was allowed by the previous one (\" + this._typedArrayClass.name + \")\" );\n }\n\n if ( this.getTypedArrayClass() && this.isUnsigned() && !this.isUnsigned( constructor ) ) {\n this.warn( \"You are switching from signed values to unsigned values. You may experience data corruption if there were some negative values.\" );\n }\n\n this._typedArrayClass = constructor;\n\n if ( this.data ) {\n this._setData( ( constructor ).from( this.data ) );\n }\n\n if ( this.hasXWaveform() ) {\n this.getXWaveform().setTypedArrayClass( constructor );\n }\n\n }\n\n isNaNAllowed( constructor = this._typedArrayClass ) {\n\n // The following types accept NaNs\n return constructor == Array ||\n constructor == Float32Array ||\n constructor == Float64Array;\n }\n\n isUnsigned( constructor = this._typedArrayClass ) {\n\n // The following types accept NaNs\n return constructor == Uint8Array ||\n constructor == Uint8ClampedArray ||\n constructor == Uint16Array ||\n constructor == Uint32Array;\n }\n\n recalculateMinMaxNewPoint( x, y ) {\n if ( x < this.minX || this.minX === undefined ) {\n this.minX = x;\n }\n\n if ( x > this.maxX || this.maxX === undefined ) {\n this.maxX = x;\n }\n\n if ( y < this.minY || this.minY === undefined ) {\n this.minY = y;\n }\n\n if ( y > this.maxY || this.maxY === undefined ) {\n this.maxY = y;\n }\n\n }\n\n prepend( x, y ) {\n\n if ( typeof x == \"function\" ) {\n x = x( this );\n }\n\n if ( typeof y == \"function\" ) {\n y = y( this );\n }\n\n if ( this.xdata ) {\n this.xdata.prepend( null, x );\n } else if ( x !== null ) {\n this.xdata = this.getXWaveform();\n this.xdata.prepend( null, x );\n } else {\n this.xOffset -= this.xScale;\n }\n\n this.data.unshift( y );\n this.recalculateMinMaxNewPoint( x, y );\n return this;\n }\n\n append( x, y ) {\n\n if ( typeof x == \"function\" ) {\n x = x( this );\n }\n\n if ( typeof y == \"function\" ) {\n y = y( this );\n }\n\n if ( this.xdata ) {\n this.xdata.append( null, x );\n } else if ( x !== null ) {\n this.xdata = this.getXWaveform();\n this.xdata.append( null, x );\n }\n\n if ( this.monotoneous ) {\n if ( y > this.data[ this.data.y ] && this.getMonotoneousAscending() === false ) {\n this.monotoneous = false;\n } else if ( y < this.data[ this.data.y ] && this.getMonotoneousAscending() === true ) {\n this.monotoneous = false;\n }\n }\n\n if ( this.data.length == 1 || this._monotoneousAscending === undefined ) {\n\n this.monotoneous = true;\n\n if ( y == this.data[ 0 ] ) {\n this._monotoneousAscending = undefined;\n } else {\n this._monotoneousAscending = y > this.data[ 0 ];\n }\n }\n\n this.data.push( y );\n this.recalculateMinMaxNewPoint( x, y );\n\n return this;\n }\n\n _makeArray( length ) {\n\n const constructor = this.getTypedArrayClass();\n if ( constructor ) {\n return new( constructor )( length );\n }\n return new Array( length );\n }\n\n _setData( dataY ) {\n const l = dataY.length;\n let i = 1,\n monoDir = dataY[ 1 ] > dataY[ 0 ],\n minY = dataY[ 0 ],\n maxY = dataY[ 0 ];\n\n this._monotoneous = true;\n\n for ( ; i < l; i++ ) {\n if ( dataY[ i ] !== dataY[ i - 1 ] && monoDir !== ( dataY[ i ] > dataY[ i - 1 ] ) ) {\n this._monotoneous = false;\n }\n\n if ( dataY[ i ] === dataY[ i ] ) { // NaN support\n minY = Math.min( dataY[ i ], minY );\n maxY = Math.max( dataY[ i ], maxY );\n }\n }\n\n if ( this._monotoneous ) {\n this._monotoneousAscending = dataY[ 1 ] > dataY[ 0 ];\n }\n\n this.minY = minY;\n this.maxY = maxY;\n\n this.data = dataY;\n\n this.computeXMinMax();\n\n }\n\n computeXMinMax() {\n\n if ( !this.data ) {\n\n return;\n }\n\n if ( this.xdata ) {\n\n this.minX = this.xdata.getMin();\n this.maxX = this.xdata.getMax();\n\n } else {\n\n const b1 = this.xOffset + this.xScale * this.getLength(),\n b2 = this.xOffset;\n\n this.minX = Math.min( b1, b2 );\n this.maxX = Math.max( b1, b2 );\n }\n }\n\n getDataInUse() {\n return this.dataInUse ||  this.data;\n }\n\n getIndexFromVal( val, useDataToUse = false, roundingMethod = Math.round ) {\n\n let data;\n\n if ( useDataToUse && this.dataInUse ) {\n data = this.dataInUse.y;\n } else {\n data = this.data;\n }\n\n let position;\n\n position = this.getIndexFromData( val, data, this.data.getMonotoneousAscending(), roundingMethod );\n\n if ( useDataToUse && this.dataInUse && this.dataInUseType == \"aggregateY\" ) { // In case of aggregation, round to the closest element of 4.\n return position - ( position % 4 );\n }\n\n return position;\n }\n\n getIndexFromX( xval, useDataToUse = false, roundingMethod = Math.round ) {\n\n let xdata;\n\n if ( useDataToUse && this.dataInUse ) {\n xdata = this.dataInUse.x;\n } else if ( this.xdata ) {\n xdata = this.xdata.getData();\n }\n\n let position;\n\n if ( this.hasXWaveform() ) {\n position = this.xdata.getIndexFromData( xval, xdata, this.xdata.getMonotoneousAscending(), roundingMethod );\n } else {\n position = Math.max( 0, Math.min( this.getLength() - 1, roundingMethod( ( xval - this.xOffset ) / ( this.xScale ) ) ) );\n }\n\n if ( useDataToUse && this.dataInUse && this.dataInUseType == \"aggregateX\" ) { // In case of aggregation, round to the closest element of 4.\n return position - ( position % 4 );\n }\n\n return position;\n }\n\n getIndexFromData( val, valCollection, isAscending, roundingMethod ) {\n\n if ( !this.isMonotoneous() ) {\n console.trace();\n throw \"Impossible to get the index from a non-monotoneous wave !\"\n }\n\n let data, position;\n\n val -= this.getShift();\n val /= this.getScale();\n\n return binarySearch( val, valCollection, !isAscending );\n\n }\n\n getReductionType() {\n return this.dataInUseType;\n }\n\n getXMin() {\n return this.minX * this.getXScale() + this.getXShift();\n }\n\n getXMax() {\n return this.maxX * this.getXScale() + this.getXShift();\n }\n\n getYMin() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getYMax() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getMin() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getMax() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getMinX() {\n\n return this.minX * this.getXScale() + this.getXShift();\n }\n\n getMaxX() {\n return this.maxX * this.getXScale() + this.getXShift();\n }\n\n getMinY() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getMaxY() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getDataY() {\n return this.data;\n }\n\n getData( optimized ) {\n if ( !optimized ||  !this.dataInUse ) {\n return this.data;\n }\n return this.dataInUse.y;\n }\n\n setShift( shift = 0 ) {\n\n // We must update the min and the max of the y data\n //this.minY += ( shift - this.getShift() );\n //this.maxY += ( shift - this.getShift() );\n this.shift = shift;\n return this;\n }\n\n getShift() {\n return this.shift ||  0;\n }\n\n getScale() {\n return this.scale ||  1;\n }\n\n setScale( scale = 1 ) {\n\n // this.minY = ( this.minY - this.getShift() ) * scale;\n // this.maxY = ( this.maxY - this.getShift() ) * scale;\n this.scale = scale;\n return this;\n }\n\n setXShift( shift = 0 ) {\n\n if ( !this.hasXWaveform ) {\n return this;\n }\n\n // We must update the min and the max of the x data\n // That's important for when the data has already been set\n // this.minX += ( shift - this.getXShift() );\n // this.maxX += ( shift - this.getXShift() );\n this.getXWaveform().setShift( shift );\n return this;\n }\n\n getXShift( shift = 0 ) {\n\n if ( !this.hasXWaveform ) {\n return 0;\n }\n\n return this.getXWaveform().getShift();\n }\n\n setXScale( scale = 1 ) {\n\n if ( !this.hasXWaveform ) {\n return this;\n }\n\n this.getXWaveform().setScale( scale );\n return this;\n }\n\n getXScale() {\n\n if ( !this.hasXWaveform ) {\n return 1;\n }\n\n return this.getXWaveform().getScale();\n }\n\n getLength() {\n return this.data.length;\n }\n\n getDataToUseFlat() {\n\n let l;\n let j = 0;\n let arr;\n\n if ( this.dataInUse ) {\n\n l = this.dataInUse.x.length;\n arr = new Array( l * 2 ).fill( 0 );\n\n for ( var i = 0; i < l; i += 1 ) {\n arr[ j ] = this.dataInUse.x[ i ];\n arr[ j + 1 ] = this.dataInUse.y[ i ];\n j += 2;\n }\n\n } else {\n\n l = this.getLength();\n arr = new Array( l * 2 ).fill( 0 );\n for ( var i = 0; i < l; i += 1 ) {\n arr[ j + 1 ] = this.data[ i ];\n arr[ j ] = this.getX( i );\n j += 2;\n }\n }\n\n return arr;\n }\n\n fit( options ) {\n\n var self = this;\n\n return new Promise( function( resolver, rejector ) {\n\n var fit = new FitLM( extend( {}, {\n\n dataY: self,\n dataX: self.getXWaveform(),\n done: function( results ) {\n resolver( results );\n },\n waveform: new Waveform()\n\n }, options ) );\n\n fit.init();\n fit.fit();\n } );\n }\n\n getX( index, optimized ) {\n\n if ( optimized && this.dataInUse ) {\n return this.dataInUse.x[ index ] * this.getXScale() + this.getXShift();\n }\n\n if ( this.xdata ) {\n return this.xdata.data[ index ] * this.getXScale() + this.getXShift();\n } else {\n return this.xOffset + index * this.xScale;\n }\n }\n\n getXRaw( index, optimized ) {\n\n if ( optimized && this.dataInUse ) {\n return this.dataInUse.x[ index ];\n }\n\n if ( this.xdata ) {\n return this.xdata.data[ index ];\n } else {\n return index;\n }\n }\n\n _integrateP( from = 0, to = this.getLength() - 1 ) {\n\n from = Math.round( from );\n to = Math.round( to );\n\n if ( from > to ) {\n let temp = from;\n from = to;\n to = temp;\n }\n\n var l = to - from + 1;\n var sum = 0,\n delta;\n\n let deltaTot = 0;\n let diff;\n var arrY = this.getData();\n\n for ( ; from <= to; from++ ) {\n\n if ( arrY.length - 1 > from ) {\n diff = this.getX( from + 1 ) - this.getX( from );\n deltaTot += diff;\n sum += arrY[ from ] * diff;\n }\n }\n\n return [ sum, l, deltaTot ];\n }\n\n integrateP( from, to ) {\n var val = this._integrateP( from, to );\n return val[ 0 ];\n }\n\n integrate( fromX, toX ) {\n return this.integrateP( this.getIndexFromX( fromX ), this.getIndexFromX( toX ) );\n }\n\n average( p0 = 0, p1 = this.getLength() - 1 ) {\n return this.getAverageP( p0, p1 );\n }\n\n mean() {\n return this.average();\n }\n\n getAverageP( from, to ) {\n var sum = this._integrateP( from, to );\n return sum[ 0 ] / sum[ 2 ];\n }\n\n getAverageX( from, to ) {\n var sum = this._integrateX( from, to );\n return sum[ 0 ] / sum[ 2 ];\n }\n\n checkMonotonicity() {\n\n let i = 1,\n data = this.getData();\n const l = this.data.length;\n let dir = data[ 1 ] > data[ 0 ];\n\n for ( ; i < l; i++ ) {\n if ( data[ i ] !== data[ i - 1 ] && dir !== ( data[ i ] > data[ i - 1 ] ) ) {\n return this._monotoneous = false;\n }\n }\n\n this._monotoneousAscending = data[ 1 ] > data[ 0 ];\n return this._monotoneous = true;\n }\n\n requireXMonotonicity() {\n if ( this.xdata ) {\n this.xdata.requireMonotonicity();\n }\n }\n\n requireMonotonicity() {\n if ( !this.isMonotoneous() ) {\n throw \"The wave must be monotonic\";\n }\n }\n\n isMonotoneous() {\n return !!this._monotoneous;\n }\n\n isXMonotoneous() {\n if ( this.xdata ) {\n return this.xdata.isMonotoneous();\n }\n // Offset and scale is always monotoneous\n return true;\n }\n\n invert( data ) {\n\n let d = dataY || this.data;\n d.reverse();\n\n if ( this.isMonotoneous() ) {\n this._monotoneousAscending = !this._monotoneousAscending;\n }\n\n return d;\n }\n\n resampleForDisplay( options ) { // Serie redrawing\n\n let i = 0;\n\n this.requireXMonotonicity();\n\n let inverting = false,\n dataY = this.getDataY(),\n data = {\n x: [],\n y: []\n },\n dataMinMax = [],\n resampleSum, resampleMin, resampleMax, resampleNum, resample_x_start, resample_x_px_start,\n x_px,\n doing_mean = false,\n firstPointIndex = 0,\n xval;\n\n const l = this.getLength();\n\n if ( !options.xPosition ) {\n throw \"No position calculation method provided\";\n }\n\n if ( !options.resampleToPx ) {\n throw \"No \\\"resampleToPx\\\" method was provided. Unit: px per point\";\n }\n\n if ( options.minX > options.maxX ) {\n let temp = options.minX;\n options.minX = options.maxX;\n options.maxX = temp;\n }\n\n if ( ( this.xdata && !this.xdata.getMonotoneousAscending() ) || ( !this.xdata && this.xScale < -0 ) ) {\n inverting = true;\n i = l;\n }\n\n for ( ; inverting ? i > 0 : i < l; inverting ? i-- : i++ ) {\n\n xval = this.getX( i );\n\n if ( options.minX > xval ) {\n\n firstPointIndex = i;\n continue;\n }\n\n x_px = options.xPosition( xval );\n\n if ( !doing_mean ) {\n\n if ( !firstPointIndex ) {\n\n firstPointIndex = i;\n } else {\n\n data.x.push( xval );\n data.y.push( dataY[ firstPointIndex ] );\n\n }\n\n while ( isNaN( dataY[ i ] ) ) {\n\n if ( inverting ) {\n i--;\n } else {\n i++;\n }\n }\n\n resampleSum = resampleMin = resampleMax = dataY[ firstPointIndex ];\n resampleNum = 1;\n resample_x_px_start = x_px;\n resample_x_start = xval;\n firstPointIndex = 0;\n\n doing_mean = true;\n\n continue;\n }\n\n if ( Math.abs( x_px - resample_x_px_start ) > options.resampleToPx || i == l || i == 0 || isNaN( dataY[ i ] ) ) {\n\n let xpos = ( resample_x_start + xval ) / 2;\n\n data.x.push( xpos );\n data.y.push( resampleSum / resampleNum );\n\n dataMinMax.push( xpos, resampleMin, resampleMax );\n\n if ( options.maxX !== undefined && xval > options.maxX ) {\n\n break;\n }\n\n doing_mean = false;\n\n continue;\n }\n\n resampleSum += dataY[ i ];\n resampleNum++;\n\n resampleMin = Math.min( resampleMin, dataY[ i ] );\n resampleMax = Math.max( resampleMax, dataY[ i ] );\n }\n\n this.dataInUseType = \"resampled\";\n this.dataInUse = data;\n return dataMinMax;\n }\n\n interpolate( x ) {\n\n let yData = this.getDataY();\n let xIndex;\n\n if ( this.xdata ) {\n let xData = this.xdata.getData();\n xIndex = binarySearch( x, xData, !this.xdata.getMonotoneousAscending() );\n if ( xData[ xIndex ] == x ) {\n return yData[ xIndex ];\n }\n return ( x - xData[ xIndex ] ) / ( xData[ xIndex + 1 ] - xData[ xIndex ] ) * ( yData[ xIndex + 1 ] - yData[ xIndex ] ) + yData[ xIndex ];\n\n } else {\n xIndex = ( x - this.xOffset ) / ( this.xScale );\n let xIndexF = Math.floor( xIndex );\n return ( xIndex - xIndexF ) * ( yData[ xIndexF + 1 ] - yData[ xIndexF ] ) + yData[ xIndexF ];\n }\n\n }\n\n interpolateIndex_X( index ) {\n\n let yData = this.getDataY();\n if ( this.xdata ) {\n let xData = this.xdata.getData();\n let indexStart = Math.floor( index );\n\n return ( index - indexStart ) * ( xData[ indexStart + 1 ] - xData[ indexStart ] ) + xData[ indexStart ];\n }\n }\n\n getMonotoneousAscending() {\n\n if ( !this.isMonotoneous() ) {\n return \"The waveform is not monotoneous\";\n }\n\n return this._monotoneousAscending;\n }\n\n getXMonotoneousAscending() {\n if ( this.xdata ) {\n return this.xdata.getMonotoneousAscending();\n }\n\n return this.xScale > 0;\n }\n\n isXMonotoneousAscending() {\n return this.getXMonotoneousAscending( ...arguments );\n }\n\n divide( numberOrWave ) {\n return this._arithmetic( numberOrWave, DIVIDE );\n }\n\n divideBy() {\n return this.divide( ...arguments );\n }\n\n multiply( numberOrWave ) {\n return this._arithmetic( numberOrWave, MULTIPLY );\n }\n\n multiplyBy() {\n return this.multiply( ...arguments );\n }\n\n log() {\n return this.logBase( 10 );\n }\n\n ln() {\n return this.logBase( Math.E )\n }\n\n logBase( base ) {\n\n let logBase = Math.log( base );\n this.data.map( ( valY ) => {\n\n return Math.log( valY ) / logBase;\n } )\n }\n\n add( numberOrWave ) {\n return this._arithmetic( numberOrWave, ADD );\n }\n\n addBy() {\n return this.add( ...arguments );\n }\n\n subtract( numberOrWave ) {\n return this._arithmetic( numberOrWave, SUBTRACT );\n }\n\n subtractBy() {\n return this.subtract( ...arguments );\n }\n\n math( method ) {\n\n for ( var i = 0; i < this.getLength(); i++ ) {\n this.data[ i ] = method( this.getY( i ), this.getX( i ) );\n }\n\n this._setData( this.data );\n return this;\n }\n\n _arithmetic( numberOrWave, operator ) {\n\n if ( numberOrWave instanceof Waveform ) {\n return this._waveArithmetic( numberOrWave, operator );\n } else if ( typeof numberOrWave == 'number' ) {\n\n return this._numberArithmetic( numberOrWave, operator );\n }\n }\n\n _numberArithmetic( num, operation ) {\n\n let i = 0,\n l = this.getLength();\n\n if ( operation == MULTIPLY ) {\n\n for ( ; i < l; i++ ) {\n this.data[ i ] *= num;\n }\n\n this.minY *= num;\n this.maxY *= num;\n } else if ( operation == DIVIDE ) {\n\n for ( ; i < l; i++ ) {\n this.data[ i ] /= num;\n }\n\n this.minY /= num;\n this.maxY /= num;\n } else if ( operation == ADD ) {\n\n for ( ; i < l; i++ ) {\n this.data[ i ] += num;\n }\n\n this.minY += num;\n this.maxY += num;\n } else if ( operation == SUBTRACT ) {\n\n for ( ; i < l; i++ ) {\n this.data[ i ] -= num;\n }\n\n this.minY -= num;\n this.maxY -= num;\n }\n\n return this;\n }\n\n _waveArithmetic( wave, operation ) {\n\n let yDataThis = this.getDataY(),\n\n i = 0;\n const l = this.getLength();\n this.requireXMonotonicity();\n wave.requireXMonotonicity();\n\n if ( operation == MULTIPLY ) {\n\n for ( ; i < l; i++ ) {\n yDataThis[ i ] *= wave.interpolate( this.getX( i ) );\n }\n } else if ( operation == DIVIDE ) {\n\n for ( ; i < l; i++ ) {\n yDataThis[ i ] /= wave.interpolate( this.getX( i ) );\n }\n } else if ( operation == ADD ) {\n\n for ( ; i < l; i++ ) {\n yDataThis[ i ] += wave.interpolate( this.getX( i ) );\n }\n } else if ( operation == SUBTRACT ) {\n\n for ( ; i < l; i++ ) {\n yDataThis[ i ] -= wave.interpolate( this.getX( i ) );\n }\n }\n\n this._setData( yDataThis );\n return this;\n }\n\n aggregate( direction = 'x' ) {\n\n this._dataAggregating = {};\n this._dataAggregated = {};\n this._dataAggregationDirection = direction.toUpperCase();\n\n var pow2 = pow2floor( this.getLength() );\n\n this._dataAggregating = aggregator( {\n\n minX: this.minX,\n maxX: this.maxX,\n minY: this.minY,\n maxY: this.maxY,\n data: this.data,\n xdata: this.xdata ? this.xdata.getData() : undefined,\n xScale: this.xScale,\n xOffset: this.xOffset,\n numPoints: pow2,\n direction: direction\n\n } ).then( ( event ) => {\n\n this._dataAggregated = event.aggregates;\n this._dataAggregating = false;\n } );\n\n }\n\n hasAggregation() {\n return !!this._dataAggregated;\n }\n\n selectAggregatedData( pxWidth ) {\n\n if ( pxWidth < 2 ) {\n return false;\n }\n /*\n console.log( direction, this._dataAggregationDirection );\n\n if( direction !== this._dataAggregationDirection ) {\n throw \"The data is not aggregated in that direction\";\n }\n */\n\n var level = pow2ceil( pxWidth );\n\n if ( this._dataAggregated[ level ] ) {\n\n this.dataInUseType = \"aggregate\" + this._dataAggregationDirection;\n this.dataInUse = this._dataAggregated[ level ];\n return;\n } else if ( this._dataAggregating ) {\n\n return this._dataAggregating;\n }\n\n this.dataInUseType = \"none\";\n this.dataInUse = {\n y: this.data,\n x: this.getXWaveform().data\n };\n }\n\n duplicate( alsoDuplicateXWave ) {\n var newWaveform = new Waveform();\n newWaveform._setData( this.getDataY().slice() );\n newWaveform.rescaleX( this.xOffset, this.xShift );\n newWaveform.setShift( this.getShift() );\n newWaveform.setScale( this.getScale() );\n\n if ( this.xdata ) {\n if ( alsoDuplicateXWave ) {\n newWaveform.setXWaveform( this.xdata.duplicate() );\n } else {\n newWaveform.setXWaveform( this.xdata );\n }\n\n newWaveform.setXShift( this.getXShift() );\n newWaveform.setXScale( this.getXScale() );\n\n } else {\n newWaveform.xOffset = this.xOffset;\n newWaveform.xScale = this.xScale;\n }\n\n return newWaveform;\n }\n\n subrangeX( fromX, toX ) {\n\n if ( !this.xdata ) { // We can select the new range from there\n\n let fromP = this.getIndexFromX( fromX ),\n toP = this.getIndexFromX( toP );\n\n return new Waveform()\n .setData( this.data.slice( fromP, toP ) )\n .rescaleX( this.xOffset, this.xScale );\n\n } else {\n\n var waveform = new Waveform();\n\n for ( var i = 0, l = this.data.length; i < l; i++ ) {\n\n if ( this.data[ i ] >= fromX && this.data[ i ] < toX ) {\n\n waveform.append( this.dataX[ i ], this.data[ i ] )\n }\n }\n\n return waveform;\n }\n }\n\n findLocalMinMax( xRef, xWithin, type ) {\n\n let index = this.getIndexFromX( xRef ),\n indexPlus = this.getIndexFromX( xRef + xWithin ),\n indexMinus = this.getIndexFromX( xRef - xWithin );\n\n return this.findLocalMinMaxIndex( indexMinus, indexPlus, type );\n }\n\n findLocalMinMaxIndex( indexMinus, indexPlus, type ) {\n\n let tmp;\n\n if ( indexPlus < indexMinus ) {\n tmp = indexPlus;\n indexPlus = indexMinus;\n indexMinus = tmp;\n }\n\n let curr, currI;\n\n if ( type == 'max' ) {\n\n curr = Number.NEGATIVE_INFINITY;\n\n for ( var i = indexMinus; i <= indexPlus; i++ ) {\n\n if ( this.getY( i ) > curr ) {\n curr = this.getY( i );\n currI = i;\n }\n }\n } else {\n\n curr = Number.POSITIVE_INFINITY;\n\n for ( var i = indexMinus; i <= indexPlus; i++ ) {\n\n if ( this.getY( i ) < curr ) {\n curr = this.getY( i );\n currI = i;\n }\n }\n }\n\n if ( currI == indexMinus || currI == indexPlus ) {\n return false;\n }\n\n return this.getX( currI );\n }\n\n warn( text ) {\n if ( console ) {\n console.warn( text );\n }\n }\n\n setUnit( unit ) {\n this.unit = unit;\n return this;\n }\n\n setXUnit( unit ) {\n if ( this.hasXWaveform() ) {\n this.xdata.setUnit( unit );\n }\n\n this.xunit = unit;\n return this;\n }\n\n getUnit() {\n return this.unit || \"\";\n }\n\n getXUnit() {\n if ( this.hasXWaveform() ) {\n return this.xdata.getUnit();\n }\n\n return this.xunit | \"\";\n }\n\n hasXUnit() {\n return this.getXUnit().length > 0;\n }\n\n hasUnit() {\n return this.getUnit().length > 0;\n }\n\n findLevels( level, options ) {\n\n options = extend( {\n\n box: 1,\n edge: 'both',\n rounding: 'before',\n rangeP: [ 0, this.getLength() ],\n\n }, options );\n\n var lastLvlIndex = options.rangeP[ 0 ];\n var lvlIndex;\n var indices = [];\n var i = 0;\n\n while ( lvlIndex = this.findLevel( level, extend( true, {}, options, {\n rangeP: [ lastLvlIndex, options.rangeP[ 1 ] ]\n } ) ) ) {\n indices.push( lvlIndex );\n lastLvlIndex = Math.ceil( lvlIndex );\n\n i++;\n if ( i > 1000 ) {\n return;\n }\n }\n\n return indices;\n }\n\n // Find the first level in the specified range\n findLevel( level, options ) {\n\n options = extend( {\n\n box: 1,\n edge: 'both',\n direction: 'ascending',\n rounding: 'before',\n rangeP: [ 0, this.getLength() ],\n\n }, options );\n\n if ( options.rangeX ) {\n options.rangeP = options.rangeX.map( this.getIndexFromX );\n }\n\n var value,\n below,\n i,\n j,\n l,\n increment;\n\n var box = options.box;\n\n if ( box % 2 == 0 ) {\n box++;\n }\n\n if ( options.direction == \"descending\" ) {\n i = options.rangeP[ 1 ],\n l = options.rangeP[ 0 ],\n increment = -1;\n } else {\n i = options.rangeP[ 0 ],\n l = options.rangeP[ 1 ],\n increment = +1;\n }\n\n for ( ;; i += increment ) {\n\n if ( options.direction == \"descending\" ) {\n if ( i < l ) {\n break;\n }\n } else {\n if ( i > l ) {\n break;\n }\n }\n\n if ( i < options.rangeP[ 0 ] + ( box - 1 ) / 2 ) {\n continue;\n }\n\n if ( i > options.rangeP[ 1 ] - ( box - 1 ) / 2 ) {\n break;\n }\n\n value = this.getAverageP( i - ( box - 1 ) / 2, i + ( box - 1 ) / 2 );\n\n if ( below === undefined ) {\n below = value < level;\n continue;\n }\n // Crossing up\n if ( value >= level && below ) {\n\n below = false;\n\n if ( options.edge == 'ascending' || options.edge == 'both' ) {\n // Found something\n\n for ( j = i + ( box - 1 ) / 2; j >= i - ( box - 1 ) / 2; j-- ) {\n\n if ( this.data[ j ] >= level && this.data[ j - 1 ] <= level ) { // Find a crossing\n\n switch ( options.rounding ) {\n case 'before':\n return j - 1;\n break;\n\n case 'after':\n return j;\n break;\n\n case 'interpolate':\n return getIndexInterpolate( level, this.data[ j ], this.data[ j - 1 ], j, j - 1 );\n break;\n }\n }\n }\n }\n\n } else if ( value <= level && !below ) {\n\n below = true;\n\n if ( options.edge == 'descending' ||  options.edge == 'both' ) {\n\n for ( j = i + ( box - 1 ) / 2; j >= i - ( box - 1 ) / 2; j-- ) {\n\n if ( this.data[ j ] <= level && this.data[ j - 1 ] >= level ) { // Find a crossing\n\n switch ( options.rounding ) {\n case 'before':\n return j - 1;\n break;\n\n case 'after':\n return j;\n break;\n\n case 'interpolate':\n return getIndexInterpolate( level, this.data[ j ], this.data[ j - 1 ], j, j - 1 );\n break;\n }\n\n }\n }\n }\n }\n }\n }\n\n normalize( mode ) {\n\n let factor,\n total,\n minValue,\n maxValue,\n ratio,\n i;\n\n if ( mode == 'max1' || mode == 'max100' ) {\n\n factor = 1;\n\n if ( mode == 'max100' ) {\n factor = 100;\n }\n\n maxValue = this.data[ 0 ];\n\n for ( i = 1; i < this.getLength(); i++ ) {\n\n if ( this.data[ i ] > maxValue ) {\n\n maxValue = this.data[ i ];\n }\n }\n\n for ( i = 0; i < this.getLength(); i++ ) {\n\n this.data[ i ] /= maxValue / factor;\n }\n\n } else if ( mode == 'sum1' ) {\n\n total = 0;\n\n for ( i = 0; i < this.getLength(); i++ ) {\n total += this.data[ i ];\n }\n\n for ( i = 0; i < this.getLength(); i++ ) {\n\n this.data[ i ] /= total;\n }\n\n } else if ( mode == 'max1min0' ) {\n\n maxValue = this.data[ 0 ],\n minValue = this.data[  0 ];\n\n for ( i = 1; i < this.getLength(); i++ ) {\n if ( this.data[ i ] > maxValue ) {\n\n maxValue = this.data[ i ]\n\n } else if ( this.data[ i ] < minValue ) {\n\n minValue = this.data[ i ];\n\n }\n }\n\n ratio = 1 / ( maxValue - minValue );\n\n for ( i = 0; i < this.getLength(); i++ ) {\n\n this.data[ i ] = ( this.data[ i ] - minValue ) * ratio;\n }\n\n }\n\n this.setData( this.data );\n }\n\n};\n\nconst MULTIPLY = Symbol();\nconst ADD = Symbol();\nconst SUBTRACT = Symbol();\nconst DIVIDE = Symbol();\n\n// http://stackoverflow.com/questions/26965171/fast-nearest-power-of-2-in-javascript\nfunction pow2ceil( v ) {\n v--;\n var p = 2;\n while ( ( v >>= 1 ) ) {\n p <<= 1;\n }\n return p;\n}\n\nfunction pow2floor( v ) {\n\n var p = 1;\n\n while ( ( v >>= 1 ) ) {\n p <<= 1;\n\n }\n return p;\n}\n\nfunction getIndexInterpolate( value, valueBefore, valueAfter, indexBefore, indexAfter ) {\n return ( value - valueBefore ) / ( valueAfter - valueBefore ) * ( indexAfter - indexBefore ) + indexBefore;\n}\n\nfunction binarySearch( target, haystack, reverse ) {\n\n let seedA = 0,\n length = haystack.length,\n seedB = ( length - 1 ),\n seedInt,\n i = 0,\n nanDirection = 1;\n\n if ( haystack[ seedA ] == target ) {\n return seedA;\n }\n\n if ( haystack[ seedB ] == target ) {\n return seedB;\n }\n\n while ( true ) {\n i++;\n if ( i > 100 ) {\n throw \"Error loop\";\n }\n\n seedInt = Math.floor( ( seedA + seedB ) / 2 );\n\n // seedInt -= seedInt % 2; // Always looks for an x.\n\n while ( isNaN( haystack[ seedInt ] ) ) {\n\n if ( seedInt >= haystack.length - 1 ) {\n\n return haystack.length - 1;\n\n } else if ( seedInt <= 0 ) {\n\n return 0;\n }\n\n seedInt += nanDirection;\n }\n\n if ( seedInt == seedA || haystack[ seedInt ] == target || seedInt == seedB ) {\n return seedInt;\n }\n\n // console.log(seedA, seedB, seedInt, haystack[seedInt]);\n if ( haystack[ seedInt ] <= target ) {\n if ( reverse ) {\n seedB = seedInt;\n } else {\n seedA = seedInt;\n }\n } else if ( haystack[ seedInt ] > target ) {\n if ( reverse ) {\n seedA = seedInt;\n } else {\n seedB = seedInt;\n }\n } else {\n return false;\n }\n\n nanDirection *= -1;\n }\n}\n\nexport default Waveform","import GraphPosition from './graph.position.js';\nimport * as util from './graph.util.js';\nimport EventEmitter from './dependencies/eventEmitter/EventEmitter.js';\nimport Waveform from './util/waveform.js';\n\n/**\n * Default graph parameters\n * @name Graph~GraphOptionsDefault\n * @name GraphOptions\n * @object\n * @static\n * @memberof Graph\n * @prop {String} title - Title of the graph\n * @prop {Number} paddingTop - The top padding\n * @prop {Number} paddingLeft - The left padding\n * @prop {Number} paddingRight - The right padding\n * @prop {Number} paddingBottom - The bottom padding\n * @prop {(Number|Boolean)} padding - A common padding value for top, bottom, left and right\n * @prop {Number} fontSize - The basic text size of the graphs\n * @prop {Number} fontFamily - The basic font family. Should be installed on the computer of the user\n * @prop {Object.} plugins - A list of plugins to import with their options\n * @prop {Object.} pluginAction - The default key combination to access those actions\n * @prop {Object.} mouseActions - Alias of pluginActions\n * @prop {Object.} keyActions - Defines what happens when keys are pressed\n * @prop {Object} wheel - Define the mouse wheel action\n * @prop {Object} dblclick - Define the double click action\n * @prop {Boolean} shapesUniqueSelection - true to allow only one shape to be selected at the time\n * @prop {Boolean} shapesUnselectOnClick - true to unselect all shapes on click\n */\nconst GraphOptionsDefault = {\n\n title: '',\n\n paddingTop: 30,\n paddingBottom: 5,\n paddingLeft: 20,\n paddingRight: 20,\n\n close: {\n left: true,\n right: true,\n top: true,\n bottom: true\n },\n\n closeColor: 'black',\n\n fontSize: 12,\n fontFamily: 'Myriad Pro, Helvetica, Arial',\n\n plugins: {},\n pluginAction: {},\n mouseActions: [],\n keyActions: [],\n wheel: {},\n dblclick: {},\n\n shapesUnselectOnClick: true,\n shapesUniqueSelection: true\n};\n\nconst defaultScatterStyle = {\n shape: 'circle',\n r: 4\n};\n\nvar _constructors = new Map();\n\n/**\n * Entry class of jsGraph that creates a new graph.\n * @extends EventEmitter\n * @tutorial basic\n */\nclass Graph extends EventEmitter {\n\n /**\n * Graph constructor\n * @param {(HTMLElement|String)} [wrapper ] - The DOM Wrapper element its ```id``` property. If you do not use the wrapper during the graph creation, use it with the @link{Graph.setWrapper} method\n * @param {GraphOptions} [ options ] - The options of the graph\n * @param {Object} [ axis ] - The list of axes\n * @param {Array} axis.left - The list of left axes\n * @param {Array} axis.bottom - The list of bottom axes\n * @param {Array} axis.top - The list of top axes\n * @param {Array} axis.right - The list of right axes\n * @example var graph = new Graph(\"someDomID\");\n * @example var graph = new Graph(\"someOtherDomID\", { title: 'Graph title', paddingRight: 100 } );\n */\n constructor( wrapper, options, axis ) {\n\n super();\n\n /*\n The unique ID of the graph\n @name Graph#uniqueid\n @type String\n */\n this._creation = util.guid();\n this._drawn = false;\n\n if ( wrapper === Object( wrapper ) && !( wrapper instanceof HTMLElement ) ) { // Wrapper is options\n axis = options;\n options = wrapper;\n wrapper = null;\n } else if ( typeof wrapper == 'string' ) {\n wrapper = document.getElementById( wrapper );\n } else if ( typeof wrapper.length == 'number' ) {\n wrapper = wrapper[ 0 ];\n }\n\n /**\n * @object\n * @memberof Graph\n * @name Graph#options\n * @type GraphOptions\n * @default {@link GraphOptionsDefault}\n * Access directly the options of the graph using this public object.\n * @example graph.options.mouseActions.push( { } );\n */\n this.options = util.extend( {}, GraphOptionsDefault, options );\n // Options declaration must be placed before the doDom operation\n\n // doDom is a private method. We bind it to this thanks to ES6 features\n ( doDom.bind( this ) )();\n\n if ( wrapper ) {\n this.setWrapper( wrapper );\n }\n\n this.prevented = false;\n\n this.axis = {\n left: [],\n top: [],\n bottom: [],\n right: []\n };\n\n this.shapes = [];\n this.shapesLocked = false;\n this.plugins = {};\n\n for ( var i in this.options.pluginAction ) {\n this.options.pluginAction.plugin = i;\n this.options.mouseActions.push( this.options.pluginAction );\n }\n\n this.selectedShapes = [];\n\n this.series = [];\n //this._dom = wrapper;\n this._axesHaveChanged = true;\n\n if ( this.options.hasOwnProperty( 'padding' ) && util.isNumeric( this.options.padding ) ) {\n this.options.paddingTop = this.options.paddingBottom = this.options.paddingLeft = this.options.paddingRight = this.options.padding;\n }\n\n this.currentAction = false;\n\n this.ns = Graph.ns;\n this.nsxlink = Graph.nsxlink;\n\n // Load all axes\n if ( axis ) {\n for ( var i in axis ) {\n for ( var j = 0, l = axis[ i ].length; j < l; j++ ) {\n\n switch ( i ) {\n\n case 'top':\n this.getTopAxis( j, axis[ i ][ j ] );\n break;\n case 'left':\n this.getLeftAxis( j, axis[ i ][ j ] );\n break;\n case 'right':\n this.getRightAxis( j, axis[ i ][ j ] );\n break;\n case 'bottom':\n this.getBottomAxis( j, axis[ i ][ j ] );\n break;\n\n default: // Do not do anything\n break;\n }\n }\n }\n }\n\n this._pluginsInit();\n\n }\n\n setWrapper( wrapper ) {\n\n if ( !wrapper ) {\n throw new Error( 'The wrapper DOM element was not found.' );\n }\n\n if ( !wrapper.appendChild ) {\n throw new Error( 'The wrapper appears to be an invalid HTMLElement' );\n }\n\n wrapper.style[ '-webkit-user-select' ] = 'none';\n wrapper.style[ '-moz-user-select' ] = 'none';\n wrapper.style[ '-o-user-select' ] = 'none';\n wrapper.style[ '-ms-user-select' ] = 'none';\n wrapper.style[ 'user-select' ] = 'none';\n\n wrapper.style.position = 'relative';\n wrapper.style.outline = 'none';\n\n // Why would that be necessary ?\n // wrapper.setAttribute( 'tabindex', 1 );\n\n this.wrapper = wrapper;\n\n // DOM\n\n if ( !this.height || !this.width ) {\n var wrapperStyle = getComputedStyle( wrapper );\n var w = parseInt( wrapperStyle.width, 10 );\n var h = parseInt( wrapperStyle.height, 10 );\n this.setSize( w, h );\n this._resize();\n }\n\n wrapper.appendChild( this.dom );\n\n _registerEvents( this );\n\n }\n /**\n * Returns the graph SVG wrapper element\n * @public\n * @return {SVGElement} The DOM element wrapping the graph\n */\n getDom() {\n return this.dom;\n }\n\n /**\n * Returns the unique id representing the graph\n * @public\n * @return {String} The unique ID of the graph\n */\n getId() {\n return this._creation;\n }\n\n /**\n * Returns the graph wrapper element passed during the graph creation\n * @public\n * @return {HTMLElement} The DOM element wrapping the graph\n */\n getWrapper() {\n return this.wrapper;\n }\n\n /**\n * Sets an option of the graph\n * @param {String} name - Option name\n * @param value - New option value\n * @returns {Graph} - Graph instance\n */\n setOption( name, val ) {\n this.options[ name ] = val;\n return this;\n }\n\n /**\n * Sets the title of the graph\n */\n setTitle( title ) {\n this.options.title = title;\n this.domTitle.textContent = title;\n }\n\n /**\n * Shows the title of the graph\n */\n displayTitle() {\n this.domTitle.setAttribute( 'display', 'inline' );\n }\n\n /**\n * Hides the title of the graph\n */\n hideTitle() {\n this.domTitle.setAttribute( 'display', 'none' );\n }\n\n hide() {\n if ( this.dom.style.display !== 'none' ) {\n this.dom.style.display = 'none';\n }\n }\n\n show() {\n if ( this.dom.style.display == 'none' ) {\n this.dom.style.display = 'initial';\n }\n }\n\n /**\n * Calls a repaint of the container. Used internally when zooming on the graph, or when .autoscaleAxes() is called (see {@link Graph#autoscaleAxes}).
\n * To be called after axes min/max are expected to have changed (e.g. after an axis.zoom( from, to )) has been called\n * @param {Boolean} onlyIfAxesHaveChanged - Triggers a redraw only if min/max values of the axes have changed.\n * @return {Boolean} if the redraw has been successful\n */\n redraw( onlyIfAxesHaveChanged, force ) {\n\n if ( !this.width || !this.height ) {\n return;\n }\n\n if ( !this.sizeSet ) {\n this._resize();\n this.executeRedrawSlaves();\n return true;\n\n } else {\n\n if ( !onlyIfAxesHaveChanged || force || haveAxesChanged( this ) || hasSizeChanged( this ) ) {\n this.executeRedrawSlaves();\n refreshDrawingZone( this );\n return true;\n }\n }\n\n this.executeRedrawSlaves( true );\n return false;\n }\n\n executeRedrawSlaves() {\n this._pluginsExecute( 'preDraw' );\n\n }\n\n /**\n * Draw the graph and the series. This method will only redraw what is necessary. You may trust its use when you have set new data to series, changed serie styles or called for a zoom on an axis.\n */\n draw( force ) {\n\n this.drawn = true;\n this.updateLegend( true );\n this.drawSeries( this.redraw( true, force ) );\n\n this._pluginsExecute( 'postDraw' );\n\n }\n\n /**\n * Prevents the graph, the series and the legend from redrawing automatically. Valid until {@link Graph#resumeUpdate} is called\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#resumeUpdate}\n * @see {@link Graph#doUpdate}\n * @since 1.16.19\n */\n delayUpdate() {\n this._lockUpdate = true;\n return this;\n }\n\n /**\n * Forces legend and graph update, even is {@link Graph#delayUpdate} has been called before.\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#delayUpdate}\n * @see {@link Graph#resumeUpdate}\n * @since 1.16.19\n */\n doUpdate() {\n if ( this.legend ) {\n this.legend.update();\n }\n this.draw();\n if ( this.legend ) {\n this.legend.update();\n }\n return this;\n }\n\n /**\n * Cancels the effect of {@link Graph#delayUpdate}, but does not redraw the graph automatically\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#delayUpdate}\n * @see {@link Graph#doUpdate}\n * @since 1.16.19\n */\n resumeUpdate() {\n this._lockUpdate = false;\n return this;\n }\n\n isDelayedUpdate() {\n return this._lockUpdate;\n }\n\n /**\n * Sets the total width of the graph\n * @param {Number} width - The new width of the graph\n * @param {Boolean} skipResize - true to defer graph repaint. Use {@link Graph#resize} to force repain later on. (Useful if many graph sizing operations are done successively)\n * @see Graph#setHeight\n * @see Graph#resize\n */\n setWidth( width, skipResize ) {\n this.width = width;\n if ( !skipResize ) {\n this._resize();\n }\n }\n\n /**\n * Sets the total height of the graph\n * @param {Number} height - The new height of the graph\n * @param {Boolean} skipResize - true to defer graph repaint. Use {@link Graph#resize} to force repain later on. (Useful if many graph sizing operations are done successively)\n * @see Graph#setWidth\n * @see Graph#resize\n */\n setHeight( height, skipResize ) {\n this.height = height;\n if ( !skipResize ) {\n this._resize();\n }\n }\n\n /**\n * Sets the new dimension of the graph and repaints it. If width and height are omitted, a simple refresh is done.\n * @param {Number} [ width ] - The new width of the graph\n * @param {Number} [ height ] - The new height of the graph\n * @see Graph#setWidth\n * @see Graph#setHeight\n * @return {Graph} The current graph\n */\n resize( w, h ) {\n if ( w && h ) {\n this.setSize( w, h );\n }\n\n this._resize();\n return this;\n }\n\n /**\n * Sets the new dimension of the graph without repainting it. Use {@link Graph#resize} to perform the actual resizing of the graph.\n * @param {Number} [ width ] - The new width of the graph\n * @param {Number} [ height ] - The new height of the graph\n * @see Graph#setWidth\n * @see Graph#setHeight\n * @see Graph#resize\n */\n setSize( w, h ) {\n this.setWidth( w, true );\n this.setHeight( h, true );\n this.getDrawingHeight();\n this.getDrawingWidth();\n }\n\n /**\n * Returns the width of the graph (set by setSize, setWidth or resize methods)\n * @return {Number} Width of the graph\n */\n getWidth() {\n return this.width;\n }\n\n /**\n * Returns the height of the graph (set by setSize, setHeight or resize methods)\n * @return {Number} Height of the graph\n */\n getHeight() {\n return this.height;\n }\n\n /**\n * Returns the top padding of the graph (space between the top of the svg container and the topmost axis)\n * @return {Number} paddingTop\n */\n getPaddingTop() {\n return this.options.paddingTop;\n }\n\n /**\n * Returns the left padding of the graph (space between the left of the svg container and the leftmost axis)\n * @return {Number} paddingTop\n */\n getPaddingLeft() {\n return this.options.paddingLeft;\n }\n\n /**\n * Returns the bottom padding of the graph (space between the bottom of the svg container and the bottommost axis)\n * @return {Number} paddingTop\n */\n getPaddingBottom() {\n return this.options.paddingBottom;\n }\n\n /**\n * Returns the right padding of the graph (space between the right of the svg container and the rightmost axis)\n * @return {Number} paddingRight\n */\n getPaddingRight() {\n return this.options.paddingRight;\n }\n\n /**\n * Returns the height of the drawable zone, including the space used by the axes\n * @param {Boolean} useCache - Use cached value. Useful if one is sure the graph hasn't changed dimension. Automatically called after a Graph.resize();\n * @returns {Number} Height of the graph\n */\n getDrawingHeight( useCache ) {\n if ( useCache && this.innerHeight ) {\n return this.innerHeight;\n }\n return ( this.innerHeight = ( this.height - this.options.paddingTop - this.options.paddingBottom ) );\n }\n\n /**\n * Returns the width of the drawable zone, including the space used by the axes\n * @param {Boolean} useCache - Use cached value. Useful if one is sure the graph hasn't changed dimension. Automatically called after a Graph.resize();\n * @returns {Number} Width of the graph\n */\n getDrawingWidth( useCache ) {\n if ( useCache && this.innerWidth ) {\n return this.innerWidth;\n }\n return ( this.innerWidth = ( this.width - this.options.paddingLeft - this.options.paddingRight ) );\n }\n\n /**\n * Caches the wrapper offset in the page.
\n * The position of the wrapper is used when processing most of mouse events and it is fetched via the jQuery function .offset().\n * If performance becomes a critical issue in your application, cacheOffset() should be used to store the offset position. It should be ensured that the graph doesn't move in the page. If one can know when the graph has moved, cacheOffset() should be called again to update the offset position.\n * @see Graph#uncacheOffset\n */\n cacheOffset() {\n this.offsetCached = util.getOffset( this.wrapper );\n }\n\n /**\n * Un-caches the wrapper offset value\n * @see Graph#cacheOffset\n */\n uncacheOffset() {\n this.offsetCached = false;\n }\n\n /**\n * Returns the x axis at a certain index. If any top axis exists and no bottom axis exists, returns or creates a top axis. Otherwise, creates or returns a bottom axis\n * Caution ! The options parameter will only be effective if an axis is created\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getXAxis( index, options ) {\n if ( this.axis.top.length > 0 && this.axis.bottom.length == 0 ) {\n return this.getTopAxis( index, options );\n }\n\n return this.getBottomAxis( index, options );\n }\n\n /**\n * Returns the y axis at a certain index. If any right axis exists and no left axis exists, returns or creates a right axis. Otherwise, creates or returns a left axis\n * Caution ! The options parameter will only be effective if an axis is created\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getYAxis( index, options ) {\n\n if ( this.axis.right.length > 0 && this.axis.left.length == 0 ) {\n return this.getRightAxis( index, options );\n }\n\n return this.getLeftAxis( index, options );\n }\n\n /**\n * Returns the top axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getTopAxis( index, options ) {\n return _getAxis( this, index, options, 'top' );\n }\n\n /**\n * Returns the bottom axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getBottomAxis( index, options ) {\n return _getAxis( this, index, options, 'bottom' );\n }\n\n /**\n * Returns the left axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getLeftAxis( index, options ) {\n return _getAxis( this, index, options, 'left' );\n }\n\n /**\n * Returns the right axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getRightAxis( index, options ) {\n return _getAxis( this, index, options, 'right' );\n }\n\n /**\n * Sets a bottom axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n */\n setXAxis( axis, index ) {\n this.setBottomAxis( axis, index );\n }\n\n /**\n * Sets a left axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n */\n setYAxis( axis, index ) {\n this.setLeftAxis( axis, index );\n }\n\n /**\n * Sets a left axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setTopAxis\n * @see Graph#setRightAxis\n * @see Graph#getLeftAxis\n * @see Graph#getYAxis\n */\n setLeftAxis( axis, index ) {\n index = index || 0;\n\n if ( this.axis.left[ index ] ) {\n this.axis.left[ index ].kill();\n }\n this.axis.left[ index ] = axis;\n }\n\n /**\n * Sets a right axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setLeftAxis\n * @see Graph#setTopAxis\n * @see Graph#getRightAxis\n * @see Graph#getYAxis\n */\n setRightAxis( axis, index ) {\n index = index || 0;\n\n if ( this.axis.right[ index ] ) {\n this.axis.right[ index ].kill();\n }\n this.axis.right[ index ] = axis;\n }\n\n /**\n * Sets a top axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setLeftAxis\n * @see Graph#setRightAxis\n * @see Graph#getBottomAxis\n * @see Graph#getXAxis\n */\n setTopAxis( axis, index ) {\n index = index || 0;\n\n if ( this.axis.top[ index ] ) {\n this.axis.top[ index ].kill();\n }\n this.axis.top[ index ] = axis;\n }\n\n /**\n * Sets a bottom axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setTopAxis\n * @see Graph#setLeftAxis\n * @see Graph#setRightAxis\n * @see Graph#getTopAxis\n * @see Graph#getXAxis\n */\n setBottomAxis( axis, index ) {\n index = index || 0;\n\n if ( this.axis.bottom[ index ] ) {\n this.axis.bottom[ index ].kill();\n }\n this.axis.bottom[ index ] = axis;\n }\n\n killAxis( axis, noRedraw = false, noSerieKill = false ) {\n\n var index;\n\n if ( axis.isX() ) {\n\n if ( ( index = this.axis.bottom.indexOf( axis ) ) > -1 ) {\n this.axis.bottom.splice( index, 1 );\n }\n\n if ( ( index = this.axis.top.indexOf( axis ) ) > -1 ) {\n this.axis.top.splice( index, 1 );\n }\n\n if ( !noSerieKill ) {\n this.series.forEach( ( serie ) => {\n\n if ( serie.getXAxis() == axis ) {\n serie.kill();\n }\n } );\n }\n }\n\n if ( axis.isY() ) {\n\n if ( ( index = this.axis.left.indexOf( axis ) ) > -1 ) {\n this.axis.left.splice( index, 1 );\n }\n\n if ( ( index = this.axis.right.indexOf( axis ) ) > -1 ) {\n this.axis.right.splice( index, 1 );\n }\n\n if ( !noSerieKill ) {\n this.series.forEach( ( serie ) => {\n\n if ( serie.getYAxis() == axis ) {\n serie.kill();\n }\n } );\n }\n }\n\n this.axisGroup.removeChild( axis.group ); // Removes all DOM\n this.groupPrimaryGrids.removeChild( axis.gridPrimary );\n this.groupSecondaryGrids.removeChild( axis.gridSecondary );\n\n if ( !noRedraw ) {\n this.draw( true );\n }\n }\n\n /**\n * Determines if an x axis belongs to the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasXAxis( axis ) {\n return this.hasTopAxis( axis ) || this.hasBottomAxis( axis );\n }\n\n /**\n * Determines if an x axis belongs to the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasYAxis( axis ) {\n return this.hasLeftAxis( axis ) || this.hasRightAxis( axis );\n }\n\n /**\n * Determines if an x axis belongs to top axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasTopAxis( axis ) {\n return this.hasAxis( axis, this.axis.top );\n }\n\n /**\n * Determines if an x axis belongs to bottom axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasBottomAxis( axis ) {\n return this.hasAxis( axis, this.axis.bottom );\n }\n\n /**\n * Determines if a y axis belongs to left axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasLeftAxis( axis ) {\n return this.hasAxis( axis, this.axis.left );\n }\n\n /**\n * Determines if a y axis belongs to right axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasRightAxis( axis ) {\n return this.hasAxis( axis, this.axis.right );\n }\n\n /**\n * Determines if an axis belongs to a list of axes\n * @param {Axis} axis - The axis instance to check\n * @param {Array} axisList - The list of axes to check\n * @private\n */\n hasAxis( axis, axisList ) {\n for ( var i = 0, l = axisList.length; i < l; i++ ) {\n if ( axisList[ i ] == axis ) {\n return true;\n }\n\n if ( axisList[ i ].hasAxis( axis ) ) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Autoscales the x and y axes of the graph.\n * Does not repaint the canvas\n * @return {Graph} The current graph instance\n */\n autoscaleAxes() {\n\n this._applyToAxes( 'setMinMaxToFitSeries', null, true, true );\n\n //this._applyToAxes( \"scaleToFitAxis\", [ this.getYAxis() ], false, true )\n // X is not always ascending...\n return this;\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoscale() {\n return this.autoscaleAxes( ...arguments );\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoScale() {\n return this.autoscaleAxes( ...arguments );\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoScaleAxes() {\n return this.autoscaleAxes( ...arguments );\n }\n\n // See #138\n /**\n * Autoscales a particular axis\n * @param {Axis} The axis to rescale\n * @return {Graph} The current graph instance\n */\n autoScaleAxis( axis ) {\n if ( !axis ) {\n return this;\n }\n\n axis.setMinMaxToFitSeries();\n return this;\n }\n\n /**\n * Sets the background color\n * @param {String} color - An SVG accepted color for the background\n * @return {Graph} The current graph instance\n */\n setBackgroundColor( color ) {\n\n this.rectEvent.setAttribute( 'fill', color );\n return this;\n }\n\n getAxisState() {\n\n var state = {};\n for ( var i in this.axis ) {\n state[ i ] = this.axis[ i ].map( function( axis ) {\n return [ axis.getCurrentMin(), axis.getCurrentMax() ];\n } );\n }\n return state;\n }\n\n setAxisState( state ) {\n\n var j, l;\n for ( var i in state ) {\n\n if ( !this.axis[ i ] ) {\n continue;\n }\n\n for ( j = 0, l = state[ i ].length; j < l; j++ ) {\n\n if ( !this.axis[ i ][ j ] ) {\n continue;\n }\n\n this.axis[ i ][ j ].setCurrentMin( state[ i ][ j ][ 0 ] );\n this.axis[ i ][ j ].setCurrentMax( state[ i ][ j ][ 1 ] );\n }\n }\n\n this.draw();\n }\n\n saveAxisState( savedName ) {\n this.savedAxisState = this.savedAxisState || {};\n this.savedAxisState[ savedName ] = this.getAxisState();\n return this;\n }\n\n recallAxisState( savedName ) {\n if ( this.savedAxisState[ savedName ] ) {\n this.recallAxisState( this.savedAxisState[ savedName ] );\n }\n return this;\n }\n\n _applyToAxis( type ) {\n\n switch ( type ) {\n\n case 'string':\n return function( type, func, params ) {\n // params.splice(1, 0, type);\n\n for ( var i = 0; i < this.axis[ type ].length; i++ ) {\n this.axis[ type ][ i ][ func ].apply( this.axis[ type ][ i ], params );\n }\n };\n\n case 'function':\n return function( type, func, params ) {\n for ( var i = 0; i < this.axis[ type ].length; i++ ) {\n func.call( this, this.axis[ type ][ i ], type, params );\n }\n };\n\n default:\n throw new Error( 'You must either execute a function or provide a string that registers a function' );\n }\n }\n\n /**\n * Calculates the minimal or maximal value of the axis. Currently, alias of getBoudaryAxisFromSeries\n */\n getBoundaryAxis( axis, minmax, usingZValues ) {\n\n var valSeries = this.getBoundaryAxisFromSeries( axis, minmax, usingZValues );\n // var valShapes = this.getBoundaryAxisFromShapes( axis, xy, minmax );\n return valSeries;\n //return Math[ minmax ]( valSeries, valShapes );\n\n }\n\n /**\n * Calculates the minimal or maximal value of the axis, based on the series that belong to it. The value is computed so that all series just fit in the value.\n * @memberof Graph.prototype\n * @param {Axis} axis - The axis for which the value should be computed\n * @param {minmax} minmax - The minimum or maximum to look for. \"min\" for the minimum, anything else for the maximum\n * @returns {Number} The minimimum or maximum of the axis based on its series\n */\n getBoundaryAxisFromSeries( axis, minmax, usingZValues ) {\n\n var min = minmax == 'min',\n val,\n func = axis.isX() ? [ 'getMinX', 'getMaxX' ] : [ 'getMinY', 'getMaxY' ],\n func2use = func[ min ? 0 : 1 ],\n infinity2use = min ? +Infinity : -Infinity,\n serie,\n series,\n serieValue,\n i,\n l;\n\n val = infinity2use;\n series = this.getSeriesFromAxis( axis );\n\n for ( i = 0, l = series.length; i < l; i++ ) {\n\n serie = series[ i ];\n\n if ( !serie.isShown() ) {\n continue;\n }\n\n serieValue = serie[ func2use ]( usingZValues );\n val = Math[ minmax ]( isNaN( val ) ? infinity2use : val, isNaN( serieValue ) ? infinity2use : serieValue );\n }\n\n return val;\n }\n\n /**\n * Returns all the series associated to an axis\n * @param {Axis} axis - The axis to which the series belong\n * @returns {Serie[]} An array containing the list of series that belong to the axis\n */\n getSeriesFromAxis( axis ) {\n var series = [],\n i = this.series.length - 1;\n\n for ( ; i >= 0; i-- ) {\n if ( this.series[ i ].getXAxis() == axis || this.series[ i ].getYAxis() == axis ) {\n series.push( this.series[ i ] );\n }\n }\n\n return series;\n }\n\n /**\n * Determines the maximum and minimum of each axes, based on {@link Graph#getBoundaryAxis}. It is usually called internally, but if the data of series has changed, called this function to make sure that minimum / maximum of the axes are properly updated.\n * @see Graph#getBoundaryAxis\n */\n updateDataMinMaxAxes( usingZValues ) {\n\n var axisvars = [ 'bottom', 'top', 'left', 'right' ],\n axis,\n j,\n l,\n i;\n\n for ( j = 0, l = axisvars.length; j < l; j++ ) {\n\n for ( i = this.axis[ axisvars[ j ] ].length - 1; i >= 0; i-- ) {\n\n axis = this.axis[ axisvars[ j ] ][ i ];\n\n // 25.10.2017. Wait a second, this cannot be real. Even hidden axes must have min max values.\n // The data can be displayed while the axis is hidden\n // I assume this was added to cover another bug, but another approach must be chosen\n if ( !axis.isShown() ) {\n // continue;\n }\n\n //console.log( axisvars[ j ], this.getBoundaryAxisFromSeries( this.axis[ axisvars[ j ] ][ i ], xy, 'min'), this.getBoundaryAxisFromSeries( this.axis[ axisvars[ j ] ][ i ], xy, 'max') );\n\n let min = this.getBoundaryAxis( this.axis[ axisvars[ j ] ][ i ], 'min', usingZValues );\n let max = this.getBoundaryAxis( this.axis[ axisvars[ j ] ][ i ], 'max', usingZValues );\n\n if ( isFinite( max ) ) {\n axis.setMaxValueData( max );\n }\n if ( isFinite( min ) ) {\n axis.setMinValueData( min );\n }\n }\n }\n }\n\n /**\n * Function that is called from {@link Graph#_applyToAxes}\n * @function\n * @name AxisCallbackFunction\n * @param {Axis} axis - The axis of the function\n * @param {String} type - The type of the axis (left,right,top,bottom)\n * @param params - The params passed in the _applyToAxis function.\n * @see Graph#_applyToAxes\n */\n\n /**\n * Applies a function to axes. The function will be executed once for every axis.\n * If func is a string, the internal function belonging to the axis will be called, with the params array flattened out (in this case, params must be an array).\n * If func is a function, the function will be called with the axis, its type and params as parameters. See {@link AxisCallbackFunction} for more details.\n * @param {(AxisCallbackFunction|String)} func - The function or function name to execute\n * @param params - Extra parameters to pass to the function\n * @param {Boolean} topbottom=false - True to apply to function to top and bottom axes\n * @param {Boolean} leftright=false - True to apply to function to left and right axes\n */\n _applyToAxes( func, params, tb, lr ) {\n\n var ax = [],\n i = 0,\n l;\n\n if ( tb || tb == undefined ) {\n ax.push( 'top' );\n ax.push( 'bottom' );\n }\n if ( lr || lr == undefined ) {\n ax.push( 'left' );\n ax.push( 'right' );\n }\n\n for ( l = ax.length; i < l; i++ ) {\n this._applyToAxis( typeof func ).call( this, ax[ i ], func, params );\n }\n }\n\n /**\n * Axes can be dependant of one another (for instance for unit conversions)\n * Finds and returns all the axes that are linked to a specific axis. Mostly used internally.\n * @param {Axis} axis - The axis that links one or multiple other dependant axes\n * @returns {Axis[]} The list of axes linked to the axis passed as parameter\n */\n findAxesLinkedTo( axis ) {\n\n var axes = [];\n this._applyToAxes( function( a ) {\n\n if ( a.linkedToAxis && a.linkedToAxis.axis == axis ) {\n axes.push( a );\n }\n }, {}, axis instanceof this.getConstructor( 'graph.axis.x' ), axis instanceof this.getConstructor( 'graph.axis.y' ) );\n\n return axes;\n }\n\n _axisHasChanged() {\n this._axesHaveChanged = true;\n }\n\n /**\n * Creates a new serie.\n * If the a serie with the same name exists, returns this serie with update options.\n * The type of the serie is used to fetch the corresponding registered constructor registered with the name \"graph.serie.\", e.g \"line\" will fetch the \"graph.serie.line\" prototype (built-in)
\n * Built-in series types are \"line\", \"contour\", \"zone\" and \"scatter\".\n * @param {String} name - The name of the serie (unique)\n * @param {Object} options - The serie options\n * @param {Type} type - The type of the serie.\n * @returns {Serie} The newly created serie\n */\n newSerie( name, options, type ) {\n\n let serie;\n\n if ( typeof options !== 'object' && !type ) {\n type = options;\n options = {};\n }\n\n if ( !type ) {\n type = Graph.SERIE_LINE;\n }\n\n if ( ( serie = this.getSerie( name ) ) ) {\n return serie;\n }\n\n if ( !( serie = makeSerie( this, name, options, type ) ) ) {\n return;\n }\n\n this.series.push( serie );\n this.emit( 'newSerie', serie );\n return serie;\n }\n\n /**\n * Looks for an existing serie by name or by index and returns it.\n * The index of the serie follows the creation sequence (0 for the first one, 1 for the second one, ...)\n * @param {(String|Number)} name - The name or the index of the serie\n * @returns {Serie}\n */\n getSerie( name ) {\n\n if ( typeof name == 'number' ) {\n return this.series[ name ] || false;\n }\n\n if ( typeof name == 'function' ) {\n name = name();\n }\n\n var i = 0,\n l = this.series.length;\n\n for ( ; i < l; i++ ) {\n\n if ( this.series[ i ].getName() == name || this.series[ i ] == name ) {\n\n return this.series[ i ];\n\n }\n }\n\n return false;\n }\n\n /**\n * Returns all the series\n * @returns {Serie[]} An array of all the series\n */\n getSeries() {\n return this.series;\n }\n\n /**\n * Returns all the series that correspond to one or multiple types\n * @param {...Symbol} type - The serie types to select\n * @returns {Serie[]} An array of all the series\n * @example graph.allSeries( Graph.SERIE_LINE, Graph.SERIE_ZONE );\n */\n allSeries( ...types ) {\n\n return this.series.filter( ( serie ) => {\n return types.include( serie.getType() );\n } );\n }\n\n /**\n * Draws a specific serie\n * @param {Serie} serie - The serie to redraw\n * @param {Boolean} force - Forces redraw even if no data has changed\n */\n drawSerie( serie, force ) {\n\n if ( !serie.draw ) {\n throw new Error( 'Serie has no method draw' );\n }\n\n serie.draw( force );\n }\n\n /**\n * Redraws all visible series\n * @param {Boolean} force - Forces redraw even if no data has changed\n */\n drawSeries( force ) {\n\n if ( !this.width || !this.height ) {\n return;\n }\n\n var i = this.series.length - 1;\n for ( ; i >= 0; i-- ) {\n if ( this.series[ i ].isShown() ) {\n this.drawSerie( this.series[ i ], force );\n }\n }\n }\n\n /**\n * @alias Graph#removeSeries\n */\n resetSeries() {\n this.removeSeries();\n }\n\n /**\n * @alias Graph#removeSeries\n */\n\n killSeries() {\n this.resetSeries();\n }\n\n /**\n * Removes all series from the graph\n */\n removeSeries() {\n while ( this.series[ 0 ] ) {\n this.series[ 0 ].kill( true );\n }\n this.series = [];\n\n if ( this.legend ) {\n this.legend.update();\n }\n }\n\n /**\n * Selects a serie. Only one serie per graph can be selected.\n * @param {Serie} serie - The serie to select\n * @param {String} selectName=\"selected\" - The name of the selection\n */\n selectSerie( serie, selectName ) {\n\n if ( !( typeof serie == 'object' ) ) {\n serie = this.getSerie( serie );\n }\n\n if ( this.selectedSerie == serie && this.selectedSerie.selectionType == selectName ) {\n return;\n }\n\n if ( this.selectedSerie !== serie && this.selectedSerie ) {\n this.unselectSerie( this.selectedSerie );\n }\n\n this.selectedSerie = serie;\n this.triggerEvent( 'onSelectSerie', serie );\n\n serie.select( selectName || 'selected' );\n }\n\n /**\n * Returns the selected serie\n * @returns {(Serie|undefined)} The selected serie\n */\n getSelectedSerie() {\n return this.selectedSerie;\n }\n\n /**\n * Unselects a serie\n * @param {Serie} serie - The serie to unselect\n */\n unselectSerie( serie ) {\n\n if ( !serie.unselect ) {\n return;\n }\n\n serie.unselect();\n this.selectedSerie = false;\n this.triggerEvent( 'onUnselectSerie', serie );\n }\n\n /**\n * Returns all the shapes associated to a serie. Shapes can (but don't have to) be associated to a serie. The position of the shape can then be relative to the same axes as the serie.\n * @param {Serie} serie - The serie containing the shapes\n * @returns {Shape[]} An array containing a list of shapes associated to the serie\n */\n getShapesOfSerie( serie ) {\n\n var shapes = [];\n var i = this.shapes.length - 1;\n\n for ( ; i >= 0; i-- ) {\n\n if ( this.shapes[ i ].getSerie() == serie ) {\n shapes.push( this.shapes[ i ] );\n }\n }\n\n return shapes;\n }\n makeToolbar( toolbarData ) {\n\n var constructor = this.getConstructor( 'graph.toolbar' );\n if ( constructor ) {\n return this.toolbar = new constructor( this, toolbarData );\n } else {\n return util.throwError( 'No constructor exists for toolbar' );\n }\n }\n\n /**\n * Returns all shapes from the graph\n */\n getShapes() {\n return this.shapes || [];\n }\n\n /**\n * Creates a new shape. jsGraph will look for the registered constructor \"graph.shape.\".\n * @param {String} shapeType - The type of the shape\n * @param {Object} [shapeData] - The options passed to the shape creator\n * @param {Boolean} [mute=false] - true to create the shape quietly\n * @param {Object} [shapeProperties] - The native object containing the shape properties in the jsGraph format (caution when using it)\n * @returns {Shape} The created shape\n * @see Graph#getConstructor\n */\n newShape( shapeType, shapeData, mute = false, shapeProperties ) {\n\n this.prevent( false );\n\n if ( !mute ) {\n\n this.emit( 'beforeNewShape', shapeData );\n\n if ( this.prevent( false ) ) {\n return false;\n }\n }\n\n // Backward compatibility\n if ( typeof shapeType == 'object' ) {\n mute = shapeData;\n shapeData = shapeType;\n shapeType = shapeData.type;\n }\n\n shapeData = shapeData || {};\n shapeData._id = util.guid();\n\n var constructor;\n if ( typeof shapeType == 'function' ) {\n constructor = shapeType;\n } else {\n constructor = this.getConstructor( 'graph.shape.' + shapeType );\n }\n\n if ( !constructor ) {\n return util.throwError( 'No constructor for this shape' );\n }\n\n var shape = new constructor( this, shapeData );\n\n if ( !shape ) {\n return util.throwError( 'Failed to construct shape.' );\n }\n\n shape.type = shapeType;\n shape.graph = this;\n shape._data = shapeData;\n\n if ( shapeData.properties !== undefined ) {\n shape.setProperties( shapeData.properties );\n }\n\n shape.init( this, shapeProperties );\n\n if ( shapeData.props !== undefined ) {\n for ( var i in shapeData.props ) {\n shape.setProp( i, shapeData.props[ i ] );\n }\n }\n\n if ( shapeData.position ) {\n\n for ( var i = 0, l = shapeData.position.length; i < l; i++ ) {\n shape.setPosition( new GraphPosition( shapeData.position[ i ] ), i );\n }\n }\n\n /* Setting shape properties */\n if ( shapeData.fillColor !== undefined ) {\n shape.setFillColor( shapeData.fillColor );\n }\n\n if ( shapeData.fillOpacity !== undefined ) {\n shape.setFillOpacity( shapeData.fillOpacity );\n }\n\n if ( shapeData.strokeColor !== undefined ) {\n shape.setStrokeColor( shapeData.strokeColor );\n }\n\n if ( shapeData.strokeWidth !== undefined ) {\n shape.setStrokeWidth( shapeData.strokeWidth );\n }\n\n if ( shapeData.layer !== undefined ) {\n shape.setLayer( shapeData.layer );\n }\n\n if ( shapeData.locked == true ) {\n shape.lock();\n }\n\n if ( shapeData.movable == true ) {\n shape.movable();\n }\n\n if ( shapeData.selectable == true ) {\n shape.selectable();\n }\n\n if ( shapeData.resizable == true ) {\n shape.resizable();\n }\n\n if ( shapeData.attributes !== undefined ) {\n shape.setProp( 'attributes', shapeData.attributes );\n }\n\n if ( shapeData.handles !== undefined ) {\n shape.setProp( 'handles', shapeData.handles );\n }\n\n if ( shapeData.selectOnMouseDown !== undefined ) {\n shape.setProp( 'selectOnMouseDown', true );\n }\n\n if ( shapeData.selectOnClick !== undefined ) {\n shape.setProp( 'selectOnClick', true );\n }\n\n if ( shapeData.transforms !== undefined && Array.isArray( shapeData.transforms ) ) {\n\n shapeData.transforms.forEach( ( {\n\n type,\n value\n\n } ) => {\n\n shape.addTransform( type, value );\n\n } );\n }\n\n if ( shapeData.highlightOnMouseOver !== undefined ) {\n shape.setProp( 'highlightOnMouseOver', true );\n }\n\n if ( shapeData.labelEditable ) {\n shape.setProp( 'labelEditable', shapeData.labelEditable );\n }\n\n if ( shapeData.labels && !shapeData.label ) {\n shapeData.label = shapeData.labels;\n }\n\n if ( shapeData.label !== undefined ) {\n\n if ( !Array.isArray( shapeData.label ) ) {\n shapeData.label = [ shapeData.label ];\n }\n\n for ( var i = 0, l = shapeData.label.length; i < l; i++ ) {\n\n shape.showLabel( i );\n shape.setLabelText( shapeData.label[ i ].text, i );\n shape.setLabelPosition( shapeData.label[ i ].position, i );\n shape.setLabelColor( shapeData.label[ i ].color || 'black', i );\n shape.setLabelSize( shapeData.label[ i ].size, i );\n shape.setLabelAngle( shapeData.label[ i ].angle || 0, i );\n shape.setLabelBaseline( shapeData.label[ i ].baseline || 'no-change', i );\n shape.setLabelAnchor( shapeData.label[ i ].anchor || 'start', i );\n shape.setLabelBackgroundColor( shapeData.label[ i ].backgroundColor || 'transparent', i );\n shape.setLabelBackgroundOpacity( shapeData.label[ i ].backgroundOpacity || 1, i );\n\n }\n }\n\n if ( shapeData.serie ) {\n shape.setSerie( this.getSerie( shapeData.serie ) );\n }\n shape.createHandles();\n shape.applyStyle();\n\n this.shapes.push( shape );\n\n if ( !mute ) {\n this.emit( 'newShape', shape, shapeData );\n }\n\n return shape;\n }\n\n /**\n * Creates a new position. Arguments are passed to the position constructor\n * @param {...*} varArgs\n * @see Position\n */\n newPosition( varArgs ) {\n\n return new GraphPosition( ...arguments );\n\n // 18 September 2016 Norman: What is that ?\n //Array.prototype.unshift.call( arguments, null );\n //return new( Function.prototype.bind.apply( GraphPosition, arguments ) )();\n }\n\n /**\n * Redraws all shapes. To be called if their definitions have changed\n */\n redrawShapes() {\n\n //this.graphingZone.removeChild(this.shapeZone);\n for ( var i = 0, l = this.shapes.length; i < l; i++ ) {\n this.shapes[ i ].redraw();\n }\n //this.graphingZone.insertBefore(this.shapeZone, this.axisGroup);\n }\n\n /**\n * Removes all shapes from the graph\n */\n removeShapes() {\n for ( var i = 0, l = this.shapes.length; i < l; i++ ) {\n if ( this.shapes[ i ] && this.shapes[ i ].kill ) {\n this.shapes[ i ].kill( true );\n }\n }\n this.shapes = [];\n }\n\n /**\n * Selects a shape\n * @param {Shape} shape - The shape to select\n * @param {Boolean} mute - Select the shape quietly\n */\n selectShape( shape, mute ) {\n\n // Already selected. Returns false\n\n if ( !shape ) {\n return;\n }\n\n if ( this.selectedShapes.indexOf( shape ) > -1 ) {\n return false;\n }\n\n if ( !shape.isSelectable() ) {\n return false;\n }\n\n if ( !mute ) {\n this.emit( 'beforeShapeSelect', shape );\n }\n\n if ( this.prevent( false ) ) {\n return;\n }\n\n if ( this.selectedShapes.length > 0 && this.options.shapesUniqueSelection ) { // Only one selected shape at the time\n\n this.unselectShapes( mute );\n }\n\n shape._select( mute );\n this.selectedShapes.push( shape );\n\n if ( !mute ) {\n this.emit( 'shapeSelect', shape );\n }\n }\n\n getSelectedShapes() {\n return this.selectedShapes;\n }\n\n /**\n * Unselects a shape\n * @param {Shape} shape - The shape to unselect\n * @param {Boolean} mute - Unselect the shape quietly\n */\n unselectShape( shape, mute ) {\n\n if ( this.selectedShapes.indexOf( shape ) == -1 ) {\n return;\n }\n\n if ( !mute ) {\n this.emit( 'beforeShapeUnselect', shape );\n }\n\n if ( this.cancelUnselectShape ) {\n this.cancelUnselectShape = false;\n return;\n }\n\n shape._unselect();\n\n this.selectedShapes.splice( this.selectedShapes.indexOf( shape ), 1 );\n\n if ( !mute ) {\n this.emit( 'shapeUnselect', shape );\n }\n\n }\n\n /**\n * Unselects all shapes\n * @param {Boolean} [ mute = false ] - Mutes all unselection events\n * @return {Graph} The current graph instance\n */\n unselectShapes( mute ) {\n\n while ( this.selectedShapes[ 0 ] ) {\n this.unselectShape( this.selectedShapes[ 0 ], mute );\n }\n\n return this;\n }\n\n _removeShape( shape ) {\n this.shapes.splice( this.shapes.indexOf( shape ), 1 );\n }\n\n appendShapeToDom( shape ) {\n\n if ( shape.isHTML() ) {\n this.wrapper.insertBefore( shape._dom, this.dom );\n }\n\n this.getLayer( shape.getLayer(), 'shape' ).appendChild( shape.group );\n }\n\n removeShapeFromDom( shape ) {\n\n if ( shape.isHTML() ) {\n this.wrapper.removeChild( shape._dom );\n }\n\n this.getLayer( shape.getLayer(), 'shape' ).removeChild( shape.group );\n }\n\n appendSerieToDom( serie ) {\n this.getLayer( serie.getLayer(), 'serie' ).appendChild( serie.groupMain );\n }\n\n removeSerieFromDom( serie ) {\n this.getLayer( serie.getLayer(), 'serie' ).removeChild( serie.groupMain );\n }\n\n getLayer( layer, mode ) {\n\n if ( !this.layers[ layer ] ) {\n\n this.layers[ layer ] = [];\n\n this.layers[ layer ][ 0 ] = document.createElementNS( Graph.ns, 'g' );\n this.layers[ layer ][ 0 ].setAttribute( 'data-layer', layer );\n this.layers[ layer ][ 1 ] = document.createElementNS( Graph.ns, 'g' );\n this.layers[ layer ][ 2 ] = document.createElementNS( Graph.ns, 'g' );\n\n this.layers[ layer ][ 0 ].appendChild( this.layers[ layer ][ 1 ] );\n this.layers[ layer ][ 0 ].appendChild( this.layers[ layer ][ 2 ] );\n\n var i = 1,\n prevLayer;\n\n while ( !( prevLayer = this.layers[ layer - i ] ) && layer - i >= 0 ) {\n i++;\n }\n\n if ( !prevLayer ) {\n\n this.plotGroup.insertBefore( this.layers[ layer ][ 0 ], this.plotGroup.firstChild );\n\n } else if ( prevLayer.nextSibling ) {\n\n this.plotGroup.insertBefore( this.layers[ layer ][ 0 ], prevLayer.nextSibling );\n\n } else {\n\n this.plotGroup.appendChild( this.layers[ layer ][ 0 ] );\n\n }\n }\n\n return this.layers[ layer ][ mode == 'shape' ? 2 : 1 ];\n\n }\n\n focus() {\n this.wrapper.focus();\n }\n\n elementMoving( movingElement ) {\n this.bypassHandleMouse = movingElement;\n }\n\n stopElementMoving( element ) {\n\n if ( element && element == this.bypassHandleMouse ) {\n this.bypassHandleMouse = false;\n } else if ( !element ) {\n this.bypassHandleMouse = false;\n }\n }\n\n _makeClosingLines() {\n\n this.closingLines = {};\n var els = [ 'top', 'bottom', 'left', 'right' ],\n i = 0,\n l = 4;\n for ( ; i < l; i++ ) {\n var line = document.createElementNS( Graph.ns, 'line' );\n line.setAttribute( 'stroke', this.options.closeColor );\n line.setAttribute( 'shape-rendering', 'crispEdges' );\n line.setAttribute( 'stroke-linecap', 'square' );\n line.setAttribute( 'display', 'none' );\n this.closingLines[ els[ i ] ] = line;\n this.graphingZone.appendChild( line );\n }\n }\n\n isActionAllowed( e, action ) {\n\n if ( action.type !== e.type && ( action.type !== undefined || e.type !== 'mousedown' ) && !( ( e.type === 'wheel' || e.type === 'mousewheel' ) && action.type == 'mousewheel' ) ) {\n return;\n }\n\n if ( action.enabled && ( typeof action.enabled == 'function' ? !action.enabled( this ) : !action.enabled ) ) {\n return;\n }\n\n if ( action.key ) {\n\n if ( action.key !== e.keyCode ) {\n\n let keyCheck = {\n 'backspace': 8,\n 'enter': 13,\n 'tab': 9,\n 'shift': 16,\n 'ctrl': 17,\n 'alt': 18,\n 'pause': 19,\n 'escape': 27,\n 'up': 33,\n 'down': 34,\n 'left': 37,\n 'right': 39\n };\n\n if ( keyCheck[ action.key ] !== e.keyCode ) {\n return;\n }\n }\n }\n\n if ( action.shift === undefined ) {\n action.shift = false;\n }\n\n if ( action.ctrl === undefined ) {\n action.ctrl = false;\n }\n\n if ( action.meta === undefined ) {\n action.meta = false;\n }\n\n if ( action.alt === undefined ) {\n action.alt = false;\n }\n\n return ( e.shiftKey == action.shift && e.ctrlKey == action.ctrl && e.metaKey == action.meta && e.altKey == action.alt );\n }\n\n forcePlugin( plugin ) {\n this.forcedPlugin = plugin;\n }\n\n unforcePlugin() {\n this.forcedPlugin = false;\n }\n\n _pluginsExecute( funcName, ...args ) {\n\n //\t\t\tArray.prototype.splice.apply(args, [0, 0, this]);\n\n for ( var i in this.plugins ) {\n\n if ( this.plugins[ i ] && this.plugins[ i ][ funcName ] ) {\n\n this.plugins[ i ][ funcName ].apply( this.plugins[ i ], args );\n\n }\n }\n }\n\n _pluginExecute( which, func, args ) {\n\n //Array.prototype.splice.apply( args, [ 0, 0, this ] );\n if ( !which ) {\n return;\n }\n\n if ( this.plugins[ which ] && this.plugins[ which ][ func ] ) {\n\n this.plugins[ which ][ func ].apply( this.plugins[ which ], args );\n return true;\n }\n\n }\n\n pluginYieldActiveState() {\n this.activePlugin = false;\n }\n\n _serieExecute( serie, func, args ) {\n\n if ( typeof serie !== 'object' ) {\n serie = this.getSerie( serie );\n }\n\n if ( typeof serie[ func ] == 'function' ) {\n serie.apply( serie, args );\n }\n }\n _pluginsInit() {\n\n var constructor, pluginName, pluginOptions;\n\n for ( var i in this.options.plugins ) {\n\n pluginName = i;\n pluginOptions = this.options.plugins[ i ];\n\n constructor = this.getConstructor( 'graph.plugin.' + pluginName );\n\n if ( constructor ) {\n\n //var options = util.extend( true, {}, constructor.defaults(), pluginOptions );\n this.plugins[ pluginName ] = new constructor( pluginOptions );\n\n util.mapEventEmission( this.plugins[ pluginName ].options, this.plugins[ pluginName ] );\n this.plugins[ pluginName ].init( this, pluginOptions );\n\n } else {\n util.throwError( 'Plugin \"' + pluginName + '\" has not been registered' );\n }\n }\n }\n\n /**\n * Returns an initialized plugin\n * @param {String} pluginName\n * @returns {Plugin} The plugin which name is \n */\n getPlugin( pluginName ) {\n var plugin = this.plugins[ pluginName ];\n\n if ( !plugin ) {\n return util.throwError( 'Plugin \"' + pluginName + '\" has not been loaded or properly registered' );\n }\n\n return plugin;\n }\n triggerEvent() {\n var func = arguments[ 0 ];\n /*,\n args = Array.prototype.splice.apply( arguments, [ 0, 1 ] );\n */\n if ( typeof this.options[ func ] == 'function' ) {\n return this.options[ func ].apply( this, arguments );\n }\n }\n\n /**\n * Creates a legend. Only one legend is allowed per graph\n * @param {Object} options - The legend options\n */\n makeLegend( options ) {\n\n if ( this.legend ) {\n return this.legend;\n }\n\n var constructor = this.getConstructor( 'graph.legend' );\n if ( constructor ) {\n this.legend = new constructor( this, options );\n } else {\n return util.throwError( 'Graph legend is not available as it has not been registered' );\n }\n\n return this.legend;\n }\n\n /**\n * Redraws the legend if it exists\n * @param {Boolean} [ onlyIfRequired = false ] ```true``` to redraw the legend only when it actually needs to be updated\n * @return {Graph} The graph instance\n */\n updateLegend( onlyIfRequired = false ) {\n\n if ( !this.legend ) {\n return;\n }\n\n this.legend.update( onlyIfRequired );\n return this;\n }\n\n /**\n * @returns {Legend} The legend item\n */\n getLegend() {\n if ( !this.legend ) {\n return;\n }\n\n return this.legend;\n\n }\n\n requireLegendUpdate() {\n\n if ( !this.legend ) {\n return;\n }\n\n this.legend.requireDelayedUpdate();\n }\n\n orthogonalProjectionSetup() {\n\n this.options.zAxis = util.extend( true, {\n maxZ: 10,\n minZ: 0,\n shiftX: -25,\n shiftY: -15,\n xAxis: this.getXAxis(),\n yAxis: this.getYAxis()\n } );\n }\n\n orthogonalProjectionUpdate() {\n\n if ( !this.zAxis ) {\n this.zAxis = {\n g: document.createElementNS( Graph.ns, 'g' ),\n l: document.createElementNS( Graph.ns, 'line' )\n };\n\n this.zAxis.g.appendChild( this.zAxis.l );\n this.groupGrids.appendChild( this.zAxis.g );\n }\n\n let refAxisX = this.options.zAxis.xAxis;\n let refAxisY = this.options.zAxis.yAxis;\n\n var x0 = refAxisX.getMinPx();\n var y0 = refAxisY.getMinPx();\n\n var dx = refAxisX.getZProj( this.options.zAxis.maxZ );\n var dy = refAxisY.getZProj( this.options.zAxis.maxZ );\n\n this.zAxis.l.setAttribute( 'stroke', 'black' );\n this.zAxis.l.setAttribute( 'x1', x0 );\n this.zAxis.l.setAttribute( 'x2', x0 + dx );\n this.zAxis.l.setAttribute( 'y1', y0 );\n this.zAxis.l.setAttribute( 'y2', y0 + dy );\n\n this.updateDataMinMaxAxes( true );\n\n var sort = this.series.map( ( serie ) => {\n return [ serie.getZPos(), serie ];\n } );\n\n sort.sort( ( sa, sb ) => {\n return sb[ 0 ] - sa[ 0 ];\n } );\n\n let i = 0;\n sort.forEach( s => {\n s[ 1 ].setLayer( i );\n this.appendSerieToDom( s[ 1 ] );\n i++;\n } );\n\n this.drawSeries( true );\n }\n\n /**\n * Kills the graph\n **/\n kill() {\n this.wrapper.removeChild( this.dom );\n }\n _removeSerie( serie ) {\n this.series.splice( this.series.indexOf( serie ), 1 );\n this._pluginsExecute( 'serieRemoved', serie );\n }\n contextListen( target, menuElements, callback ) {\n\n if ( this.options.onContextMenuListen ) {\n return this.options.onContextMenuListen( target, menuElements, callback );\n }\n }\n lockShapes() {\n this.shapesLocked = true;\n\n // Removes the current actions of the shapes\n for ( var i = 0, l = this.shapes.length; i < l; i++ ) {\n this.shapes[ i ].moving = false;\n this.shapes[ i ].resizing = false;\n }\n }\n unlockShapes() {\n //\t\tconsole.log('unlock');\n this.shapesLocked = false;\n }\n prevent( arg ) {\n var curr = this.prevented;\n if ( arg != -1 ) {\n this.prevented = ( arg == undefined ) || arg;\n }\n return curr;\n }\n _getXY( e ) {\n\n var x = e.clientX,\n y = e.clientY;\n\n var pos = this.offsetCached || util.getOffset( this.wrapper );\n\n x -= pos.left;\n y -= pos.top;\n\n return {\n x: x,\n y: y\n };\n }\n _resize() {\n\n if ( !this.width || !this.height ) {\n return;\n }\n\n this.getDrawingWidth();\n this.getDrawingHeight();\n\n this.sizeSet = true;\n this.dom.setAttribute( 'width', this.width );\n this.dom.setAttribute( 'height', this.height );\n this.domTitle.setAttribute( 'x', this.width / 2 );\n\n this._sizeChanged = true;\n\n if ( this.drawn ) {\n this.requireLegendUpdate();\n this.draw( true );\n }\n\n }\n\n updateGraphingZone() {\n util.setAttributeTo( this.graphingZone, {\n 'transform': 'translate(' + this.options.paddingLeft + ', ' + this.options.paddingTop + ')'\n } );\n\n this._sizeChanged = true;\n }\n\n // We have to proxy the methods in case they are called anonymously\n getDrawingSpaceWidth() {\n return () => this.drawingSpaceWidth;\n }\n\n getDrawingSpaceHeight() {\n return () => this.drawingSpaceHeight;\n }\n\n getDrawingSpaceMinX() {\n return () => this.drawingSpaceMinX;\n }\n\n getDrawingSpaceMinY() {\n return () => this.drawingSpaceMinY;\n }\n\n getDrawingSpaceMaxX() {\n return () => this.drawingSpaceMaxX;\n }\n\n getDrawingSpaceMaxY() {\n return () => this.drawingSpaceMaxY;\n }\n\n /**\n * Enables the line tracking\n * @param {Object|Boolean} options - Defines the tracking behavior. If a boolean, simply enables or disables the existing tracking.\n */\n trackingLine( options ) {\n\n var self = this;\n\n if ( typeof options === 'boolean' ) {\n\n if ( this.options.trackingLine ) {\n this.options.trackingLine.enable = options;\n }\n return;\n }\n\n if ( options ) {\n this.options.trackingLine = options;\n }\n\n options.series = options.series || [];\n options.enable = options.enable === undefined ? true : !!options.enable;\n\n // Individual tracking\n if ( options.mode == 'individual' ) {\n\n if ( options.series ) {\n\n if ( !Array.isArray( options.series ) ) {\n\n if ( options.series == 'all' ) {\n\n options.series = this.series.map( ( serie ) => ( {\n serie: serie\n } ) );\n\n } else {\n\n options.series = [ options.series ];\n }\n }\n\n options.series.forEach( ( sOptions ) => {\n\n if ( typeof sOptions.serie !== 'object' ) {\n\n if ( typeof sOptions !== 'object' ) {\n throw new Error( 'Misuse of the trackingLine() method. Each serie must be an object with the serie property: { series: [ { serie: jsGraphSerie, options: { ... someOptions } } ] }' );\n }\n\n sOptions.serie = this.getSerie( sOptions.serie );\n }\n\n if ( !sOptions.serie ) {\n return;\n }\n\n self.addSerieToTrackingLine( sOptions.serie, sOptions );\n\n } );\n }\n } else {\n\n options.series.forEach( ( serie ) => {\n serie.serie.disableTracking();\n } );\n }\n\n if ( options.noLine ) {\n return;\n }\n\n if ( !this.trackingObject ) { // Avoid multiple creation of tracking lines\n\n // Creates a new shape called trackingLine, in the first layer (below everything)\n this.trackingObject = this.newShape( 'line', util.extend( true, {\n position: [ {\n y: 'min'\n }, {\n y: 'max'\n } ],\n stroke: 'black',\n layer: -1\n }, options.trackingLineShapeOptions ) );\n }\n\n this.trackingObject.draw();\n\n return this.trackingObject;\n }\n\n addSerieToTrackingLine( serie, options ) {\n\n if ( !this.options.trackingLine ) {\n\n this.trackingLine( {\n mode: 'individual'\n } );\n }\n\n this.options.trackingLine.series.forEach( ( serieO, index ) => {\n if ( serieO.serie == serie ) {\n this.options.trackingLine.series.splice( index, 1 );\n }\n } );\n\n this.options.trackingLine.series.push( Object.assign( {\n serie: serie\n }, options ) );\n\n serie.enableTracking( ( serie, index, x, y ) => {\n\n if ( this.options.trackingLine.enable ) {\n\n if ( index ) {\n\n if ( this.trackingObject ) {\n\n this.trackingObject.show();\n this.trackingObject.getPosition( 0 ).x = index.trueX; //serie.getData()[ 0 ][ index.closestIndex * 2 ];\n this.trackingObject.getPosition( 1 ).x = index.trueX; //serie.getData()[ 0 ][ index.closestIndex * 2 ];\n this.trackingObject.redraw();\n }\n\n serie._trackingLegend = _trackingLegendSerie( this, {\n serie: serie\n }, x, y, serie._trackingLegend, options.textMethod ? options.textMethod : ( output ) => {\n\n for ( var i in output ) {\n return output[ i ].serie.serie.getName() + ': ' + output[ i ].serie.serie.getYAxis().valueToHtml( output[ i ].yValue );\n }\n\n }, index.trueX );\n\n if ( serie._trackingLegend ) {\n serie._trackingLegend.style.display = 'block';\n }\n }\n }\n }, ( serie ) => {\n\n if ( this.trackingObject ) {\n this.trackingObject.hide();\n }\n\n if ( serie.trackingShape ) {\n serie.trackingShape.hide();\n }\n\n if ( serie._trackingLegend ) {\n serie._trackingLegend.style.display = 'none';\n }\n\n serie._trackingLegend = _trackingLegendSerie( this, {\n\n serie: serie\n\n }, false, false, serie._trackingLegend, false, false );\n\n } );\n\n }\n\n /**\n * Pass here the katex.render method to be used later\n * @param {Function} renderer - katexRendered - renderer\n * @return {Graph} The current graph instance\n */\n setKatexRenderer( renderer ) {\n this._katexRenderer = renderer;\n }\n\n hasKatexRenderer() {\n return !!this._katexRenderer;\n }\n\n renderWithKatex( katexValue, katexElement ) {\n\n if ( this._katexRenderer ) {\n\n if ( katexElement ) {\n katexElement.removeChild( katexElement.firstChild );\n } else {\n katexElement = document.createElementNS( Graph.ns, 'foreignObject' );\n }\n\n let div = document.createElement( 'div' );\n\n katexElement.appendChild( div );\n this._katexRenderer( katexValue, div );\n\n return katexElement;\n }\n\n return false;\n }\n\n /**\n * Returns a graph created from a schema\n * @param {Object} schema - The schema (see https://github.com/cheminfo/json-chart/blob/master/chart-schema.json)\n * @param {HTMLElement} wrapper - The wrapping element\n * @returns {Graph} Newly created graph\n */\n static fromJSON( schema, wrapper ) {\n\n let graph,\n options = {},\n axes = {\n left: [],\n top: [],\n right: [],\n bottom: []\n },\n style;\n\n if ( schema.title ) {\n options.title = schema.title;\n }\n\n if ( schema.axis ) {\n\n schema.axis.forEach( function( schemaAxis ) {\n\n if ( !schemaAxis.type ) {\n util.throwError( 'Axis type is required (top, bottom, left or right)' );\n }\n\n var axisOptions = {};\n if ( schemaAxis.label ) {\n axisOptions.labelValue = schemaAxis.label;\n }\n\n if ( schemaAxis.unit !== undefined ) {\n axisOptions.unit = schemaAxis.unit;\n }\n\n if ( schemaAxis.unitWrapperAfter !== undefined ) {\n axisOptions.unitWrapperAfter = schemaAxis.unitWrapperAfter;\n }\n\n if ( schemaAxis.unitWrapperBefore !== undefined ) {\n axisOptions.unitWrapperBefore = schemaAxis.unitWrapperBefore;\n }\n\n if ( schemaAxis.min !== undefined ) {\n axisOptions.forcedMin = schemaAxis.min;\n }\n\n if ( schemaAxis.max !== undefined ) {\n axisOptions.forcedMax = schemaAxis.max;\n }\n\n if ( schemaAxis.flip !== undefined ) {\n axisOptions.flipped = schemaAxis.flip;\n }\n\n axes[ schemaAxis.type ].push( axisOptions );\n schemaAxis._jsGraphIndex = axes[ schemaAxis.type ].length - 1;\n\n } );\n }\n\n graph = new Graph( wrapper, options, axes );\n\n if ( schema.width ) {\n graph.setWidth( schema.width );\n }\n\n if ( schema.height ) {\n graph.setHeight( schema.width );\n }\n\n graph._resize();\n\n if ( schema.data ) {\n\n schema.data.forEach( function( schemaSerie ) {\n\n var serieType = schemaSerie.type,\n serie,\n serieOptions = {},\n serieAxis;\n\n let waveform;\n\n switch ( schemaSerie.type ) {\n\n case 'bar':\n util.throwError( 'Bar charts not supported' );\n serieType = false;\n break;\n\n case 'color':\n serieType = Graph.SERIE_LINE_COLORED;\n break;\n\n case 'scatter':\n serieType = Graph.SERIE_SCATTER;\n break;\n\n case 'box':\n serieType = Graph.SERIE_BOX;\n\n if ( schemaSerie.orientation == 'x' || schemaSerie.orientation == 'y' ) {\n serieOptions.orientation = schemaSerie.orientation;\n }\n break;\n\n default:\n serieType = Graph.SERIE_LINE;\n break;\n }\n\n if ( serieType !== Graph.SERIE_BOX ) {\n waveform = Graph.newWaveform();\n }\n\n if ( !serieType ) {\n util.throwError( 'No valid serie type was found' );\n return;\n }\n\n serie = graph.newSerie( schemaSerie.id || schemaSerie.label || util.guid(), serieOptions, serieType );\n\n if ( schemaSerie.lineStyle ) {\n\n let lineStyle;\n\n if ( Array.isArray( lineStyle ) ) {\n lineStyle = {\n unselected: lineStyle\n };\n }\n\n Object.entries( lineStyle ).forEach( ( [ styleName, style ] ) => {\n\n var styleSerie = {};\n\n switch ( serieType ) {\n\n case Graph.SERIE_LINE:\n if ( style.lineWidth !== undefined ) {\n styleSerie.lineWidth = style.lineWidth;\n }\n\n if ( style.color !== undefined ) {\n styleSerie.lineColor = style.color;\n }\n\n if ( style.lineStyle ) {\n styleSerie.lineStyle = style.lineStyle;\n }\n\n serie.setStyle( styleSerie, styleName );\n break;\n }\n } );\n }\n\n let defaultStyle = {};\n let defaultStyles = {};\n\n if ( schemaSerie.defaultStyle ) {\n defaultStyle = schemaSerie.defaultStyle;\n }\n\n if ( schemaSerie.defaultStyles ) {\n defaultStyles = schemaSerie.defaultStyles;\n }\n\n if ( schemaSerie.styles ) {\n\n let individualStyles;\n\n if ( Array.isArray( schemaSerie.styles ) ) {\n individualStyles = {\n unselected: schemaSerie.styles\n };\n } else {\n individualStyles = schemaSerie.styles;\n }\n\n let styleNames = new Set( Object.keys( defaultStyles ).concat( Object.keys( individualStyles ) ) );\n\n styleNames.forEach( ( styleName ) => {\n\n var styleSerie = {};\n let style = [],\n styles;\n\n if ( individualStyles && individualStyles[ styleName ] ) {\n\n style = individualStyles[ styleName ];\n\n if ( !Array.isArray( style ) ) {\n style = [ style ];\n }\n\n styles = style.map( function( eachStyleElement ) {\n\n switch ( serieType ) {\n\n case Graph.SERIE_LINE:\n\n return {\n type: eachStyleElement.shape,\n zoom: eachStyleElement.zoom,\n strokeWidth: eachStyleElement.lineWidth,\n strokeColor: eachStyleElement.lineColor,\n fillColor: eachStyleElement.color,\n points: eachStyleElement.points\n };\n\n break;\n\n case Graph.SERIE_BOX:\n\n return eachStyleElement;\n\n break;\n\n case Graph.SERIE_SCATTER:\n return eachStyleElement;\n\n break;\n }\n } );\n }\n\n switch ( serieType ) {\n\n case Graph.SERIE_LINE:\n\n serie.setMarkers( styles, styleName );\n break;\n\n case Graph.SERIE_SCATTER:\n serie.setStyle( Object.assign( {}, defaultScatterStyle, defaultStyle, defaultStyles[ styleName ] || {} ), styles, styleName );\n break;\n\n case Graph.SERIE_BOX:\n\n serie.setStyle( styles[ 0 ], styleName || 'unselected' );\n break;\n }\n } );\n }\n\n if ( schemaSerie.color && serieType == Graph.SERIE_LINE_COLORED ) {\n serie.setColors( schemaSerie.color );\n }\n\n if ( serieType !== Graph.SERIE_BOX ) {\n waveform.setData( schemaSerie.y, schemaSerie.x );\n }\n\n if ( !serie ) {\n return;\n }\n\n let errorBarsXAbove = [],\n errorBarsXBelow = [],\n errorBarsYAbove = [],\n errorBarsYBelow = [],\n\n errorBoxesXAbove = [],\n errorBoxesXBelow = [],\n errorBoxesYAbove = [],\n errorBoxesYBelow = [];\n\n if ( waveform !== undefined ) {\n var errors = [];\n if ( schemaSerie.errorX ) {\n\n for ( var i = 0, l = schemaSerie.errorX.length; i < l; i++ ) {\n\n if ( Array.isArray( schemaSerie.errorX[ i ] ) ) {\n\n errorBarsXAbove.push( schemaSerie.errorX[ i ][ 0 ] );\n errorBarsXBelow.push( schemaSerie.errorX[ i ][ 1 ] );\n } else {\n errorBarsXAbove.push( schemaSerie.errorX[ i ] );\n errorBarsXBelow.push( schemaSerie.errorX[ i ] );\n }\n }\n\n } else if ( schemaSerie.errorBarX || schemaSerie.errorBoxX ) {\n\n if ( schemaSerie.errorBarX ) {\n\n for ( var i = 0, l = schemaSerie.errorBarX.length; i < l; i++ ) {\n\n if ( Array.isArray( schemaSerie.errorBarX[ i ] ) ) {\n\n errorBarsXAbove.push( schemaSerie.errorBarX[ i ][ 0 ] );\n errorBarsXBelow.push( schemaSerie.errorBarX[ i ][ 1 ] );\n } else {\n errorBarsXAbove.push( schemaSerie.errorBarX[ i ] );\n errorBarsXBelow.push( schemaSerie.errorBarX[ i ] );\n }\n }\n }\n\n if ( schemaSerie.errorBoxX ) {\n\n for ( var i = 0, l = schemaSerie.errorBoxX.length; i < l; i++ ) {\n\n if ( Array.isArray( schemaSerie.errorBoxX[ i ] ) ) {\n\n errorBoxesXAbove.push( schemaSerie.errorBoxX[ i ][ 0 ] );\n errorBoxesXBelow.push( schemaSerie.errorBoxX[ i ][ 1 ] );\n } else {\n errorBoxesXAbove.push( schemaSerie.errorBoxX[ i ] );\n errorBoxesXBelow.push( schemaSerie.errorBoxX[ i ] );\n }\n }\n }\n }\n\n if ( schemaSerie.errorY ) {\n\n for ( var i = 0, l = schemaSerie.errorY.length; i < l; i++ ) {\n\n if ( Array.isArray( schemaSerie.errorY[ i ] ) ) {\n\n errorBarsYAbove.push( schemaSerie.errorY[ i ][ 0 ] );\n errorBarsYBelow.push( schemaSerie.errorY[ i ][ 1 ] );\n } else {\n errorBarsYAbove.push( schemaSerie.errorY[ i ] );\n errorBarsYBelow.push( schemaSerie.errorY[ i ] );\n }\n }\n } else if ( schemaSerie.errorBarY || schemaSerie.errorBoxY ) {\n\n if ( schemaSerie.errorBarY ) {\n\n for ( var i = 0, l = schemaSerie.errorBarY.length; i < l; i++ ) {\n\n if ( Array.isArray( schemaSerie.errorBarY[ i ] ) ) {\n\n errorBarsYAbove.push( schemaSerie.errorBarY[ i ][ 0 ] );\n errorBarsYBelow.push( schemaSerie.errorBarY[ i ][ 1 ] );\n } else {\n errorBarsYAbove.push( schemaSerie.errorBarY[ i ] );\n errorBarsYBelow.push( schemaSerie.errorBarY[ i ] );\n }\n }\n }\n\n if ( schemaSerie.errorBoxY ) {\n\n for ( var i = 0, l = schemaSerie.errorBoxY.length; i < l; i++ ) {\n\n if ( Array.isArray( schemaSerie.errorBoxY[ i ] ) ) {\n\n errorBoxesYAbove.push( schemaSerie.errorBoxY[ i ][ 0 ] );\n errorBoxesYBelow.push( schemaSerie.errorBoxY[ i ][ 1 ] );\n } else {\n errorBoxesYAbove.push( schemaSerie.errorBoxY[ i ] );\n errorBoxesYBelow.push( schemaSerie.errorBoxY[ i ] );\n }\n }\n }\n }\n\n style = {};\n if ( errorBarsXAbove.length > 0 ) {\n waveform.setErrorBarXAbove( Graph.newWaveform( errorBarsXAbove ) );\n style.right = {};\n }\n if ( errorBarsXBelow.length > 0 ) {\n waveform.setErrorBarXAbove( Graph.newWaveform( errorBarsXAbove ) );\n style.left = {};\n }\n if ( errorBarsYAbove.length > 0 ) {\n waveform.setErrorBarXAbove( Graph.newWaveform( errorBarsYAbove ) );\n style.top = {};\n }\n if ( errorBarsYBelow.length > 0 ) {\n waveform.setErrorBarXAbove( Graph.newWaveform( errorBarsYAbove ) );\n style.bottom = {};\n }\n\n serie.setErrorBarStyle( style );\n\n style = {};\n if ( errorBoxesXAbove.length > 0 ) {\n waveform.setErrorBoxXAbove( Graph.newWaveform( errorBoxesXAbove ) );\n style.right = {};\n }\n if ( errorBoxesXBelow.length > 0 ) {\n waveform.setErrorBoxXBelow( Graph.newWaveform( errorBoxesXBelow ) );\n style.left = {};\n }\n if ( errorBoxesYAbove.length > 0 ) {\n waveform.setErrorBoxAbove( Graph.newWaveform( errorBoxesYAbove ) );\n style.top = {};\n }\n if ( errorBoxesYBelow.length > 0 ) {\n waveform.setErrorBoxBelow( Graph.newWaveform( errorBoxesYBelow ) );\n style.bottom = {};\n }\n serie.setErrorBoxStyle( style );\n }\n\n if ( schema.axis ) {\n serieAxis = schema.axis[ schemaSerie.xAxis ];\n\n if ( !serieAxis || ( serieAxis.type !== 'top' && serieAxis.type !== 'bottom' ) ) {\n util.warn( 'No x axis found. Setting automatically' );\n serie.setXAxis( graph.getXAxis( 0 ) );\n } else {\n if ( serieAxis.type == 'top' ) {\n serie.setXAxis( graph.getTopAxis( serieAxis._jsGraphIndex ) );\n } else if ( serieAxis.type == 'bottom' ) {\n serie.setXAxis( graph.getBottomAxis( serieAxis._jsGraphIndex ) );\n }\n }\n\n serieAxis = schema.axis[ schemaSerie.yAxis ];\n\n if ( !serieAxis || ( serieAxis.type !== 'left' && serieAxis.type !== 'right' ) ) {\n util.warn( 'No y axis found. Setting automatically' );\n serie.setYAxis( graph.getYAxis( 0 ) );\n } else {\n if ( serieAxis.type == 'left' ) {\n serie.setYAxis( graph.getLeftAxis( serieAxis._jsGraphIndex ) );\n } else if ( serieAxis.type == 'right' ) {\n serie.setYAxis( graph.getRightAxis( serieAxis._jsGraphIndex ) );\n }\n }\n\n } else {\n util.warn( 'No axes found. Setting automatically' );\n serie.autoAxis();\n }\n\n switch ( serieType ) {\n\n case Graph.SERIE_BOX:\n\n serie.setData( schemaSerie.boxes );\n\n break;\n\n default:\n case Graph.SERIE_SCATTER:\n case Graph.SERIE_LINE_COLORED:\n case Graph.SERIE_LINE:\n\n serie.setWaveform( waveform );\n\n break;\n }\n } );\n\n }\n\n graph.autoscaleAxes();\n graph.draw();\n\n return graph;\n }\n\n exportToSchema() {\n\n let schema = {};\n\n schema.title = this.options.title;\n\n schema.width = this.getWidth();\n schema.height = this.getHeight();\n\n let axesPositions = [ 'top', 'bottom', 'left', 'right' ];\n let axesExport = [];\n let allaxes = {\n x: [],\n y: []\n };\n\n axesPositions.map( ( axisPosition ) => {\n\n if ( !this.axis[ axisPosition ] ) {\n return;\n }\n\n axesExport = axesExport.concat( this.axis[ axisPosition ].map( ( axis ) => {\n return {\n\n type: axisPosition,\n label: axis.options.label,\n unit: axis.options.unit,\n min: axis.options.forcedMin,\n max: axis.options.forcedMax,\n flip: axis.options.flipped\n\n };\n } ) );\n\n if ( axisPosition == 'top' || axisPosition == 'bottom' ) {\n allaxes.x = allaxes.x.concat( this.axis[ axisPosition ] );\n } else {\n allaxes.y = allaxes.y.concat( this.axis[ axisPosition ] );\n }\n } );\n\n schema.axis = axesExport;\n\n let seriesExport = [];\n\n let toType = ( type ) => {\n switch ( type ) {\n\n case Graph.SERIE_LINE:\n return 'line';\n break;\n\n case Graph.SERIE_BAR:\n return 'bar';\n break;\n\n case Graph.SERIE_LINE_COLORED:\n return 'color';\n break;\n\n case Graph.SERIE_SCATTER:\n return 'scatter';\n break;\n }\n };\n\n let exportData = ( serie, x ) => {\n\n let data = [];\n\n switch ( serie.getType() ) {\n\n case Graph.SERIE_LINE:\n\n for ( var i = 0; i < serie.data.length; i++ ) {\n\n for ( var j = 0; j < serie.data[ i ].length - 1; j += 2 ) {\n\n data.push( serie.data[ i ][ j + ( ( x && serie.isFlipped() || !x && !serie.isFlipped() ) ? 1 : 0 ) ] );\n }\n }\n break;\n\n case Graph.SERIE_SCATTER:\n\n for ( var j = 0; j < serie.data.length - 1; j += 2 ) {\n\n data.push( serie.data[ i + ( ( x && serie.isFlipped() || !x && !serie.isFlipped() ) ? 1 : 0 ) ] );\n }\n\n break;\n }\n\n return data;\n };\n\n schema.data = seriesExport.concat( this.series.map( ( serie ) => {\n\n let style = [];\n let linestyle = [];\n\n if ( serie.getType() == Graph.SERIE_LINE ) {\n\n for ( var stylename in serie.styles ) {\n linestyle.push( {\n styleName: stylename,\n color: serie.styles[ stylename ].lineColor,\n lineWidth: serie.styles[ stylename ].lineWidth,\n lineStyle: serie.styles[ stylename ].lineStyle,\n } );\n\n let styleObj = {\n styleName: stylename,\n styles: []\n };\n style.push( styleObj );\n\n styleObj.styles = styleObj.styles.concat( ( serie.styles[ stylename ].markers || [] ).map( ( markers ) => {\n return {\n shape: markers.type,\n zoom: markers.zoom,\n lineWidth: markers.strokeWidth,\n lineColor: markers.strokeColor,\n color: markers.fillColor,\n points: markers.points\n };\n } ) );\n\n }\n }\n\n return {\n label: serie.getLabel(),\n id: serie.getName(),\n type: toType( serie.getType() ),\n x: exportData( serie, true ),\n y: exportData( serie, false ),\n xAxis: allaxes.x.indexOf( serie.getXAxis() ),\n yAxis: allaxes.y.indexOf( serie.getYAxis() ),\n style: style,\n lineStyle: linestyle\n };\n } ) );\n\n return schema;\n }\n\n /**\n * Registers a constructor to jsGraph. Constructors are used on a later basis by jsGraph to create series, shapes or plugins\n * @param {String} constructorName - The name of the constructor\n * @param {Function} constructor - The constructor method\n * @see Graph.getConstructor\n * @static\n */\n static registerConstructor( constructorName, constructor ) {\n\n if ( _constructors.has( constructorName ) ) {\n return util.throwError( 'Constructor ' + constructor + ' already exists.' );\n }\n\n _constructors.set( constructorName, constructor );\n }\n\n /**\n * Returns a registered constructor\n * @param {String} constructorName - The constructor name to look for\n * @param {Boolean} [softFail = false ] - Fails silently if the constructor doesn't exist, and returns false\n * @returns {Function} The registered constructor\n * @throws Error\n * @see Graph.registerConstructor\n * @static\n */\n static getConstructor( constructorName, softFail = false ) {\n\n if ( !_constructors.has( constructorName ) ) {\n\n if ( softFail ) {\n return false;\n }\n\n return util.throwError( 'Constructor \"' + constructorName + \"\\\" doesn't exist\" );\n }\n\n return _constructors.get( constructorName );\n }\n\n static newWaveform() {\n return new Waveform( ...arguments );\n }\n\n static waveform() {\n return new Waveform( ...arguments );\n }\n}\n\n// Adds getConstructor to the prototype. Cannot do that in ES6 classes\nGraph.prototype.getConstructor = Graph.getConstructor;\n\nfunction makeSerie( graph, name, options, type ) {\n\n var constructor = graph.getConstructor( type, true );\n if ( !constructor && typeof type == 'string' ) {\n constructor = graph.getConstructor( 'graph.serie.' + type, true );\n }\n\n if ( constructor ) {\n\n var serie = new constructor( graph, name, options );\n //serie.init( graph, name, options );\n graph.appendSerieToDom( serie );\n\n } else {\n\n return util.throwError( 'No constructor exists for the serie type provided. Use Graph.registerConstructor( name, constructor ) first is you use your own series' );\n\n }\n\n return serie;\n}\n\nfunction getAxisLevelFromSpan( span, level ) {\n\n for ( var i = 0, l = level.length; i < l; i++ ) {\n\n var possible = true;\n for ( var k = 0, m = level[ i ].length; k < m; k++ ) {\n\n if ( !( ( span[ 0 ] < level[ i ][ k ][ 0 ] && span[ 1 ] < level[ i ][ k ][ 0 ] ) || ( ( span[ 0 ] > level[ i ][ k ][ 1 ] && span[ 1 ] > level[ i ][ k ][ 1 ] ) ) ) ) {\n possible = false;\n }\n }\n\n if ( possible ) {\n\n level[ i ].push( span );\n return i;\n }\n }\n\n level.push( [ span ] );\n return ( level.length - 1 );\n}\n\nfunction refreshDrawingZone( graph ) {\n\n var i, j, l, xy, min, max, axis;\n var shift = {\n top: [],\n bottom: [],\n left: [],\n right: []\n };\n\n var levels = {\n top: [],\n bottom: [],\n left: [],\n right: []\n };\n\n graph._painted = true;\n // Apply to top and bottom\n\n graph._applyToAxes( function( axis, position ) {\n\n if ( !axis.isShown() ) {\n axis.hideGroup();\n return;\n } else {\n axis.showGroup();\n }\n\n if ( axis.floating ) {\n return;\n }\n\n var level = getAxisLevelFromSpan( axis.getSpan(), levels[ position ] );\n axis.setLevel( level );\n\n shift[ position ][ level ] = Math.max( axis.getAxisPosition(), ( shift[ position ][ level ] || 0 ) );\n\n }, false, true, false );\n\n var shiftTop = shift.top.reduce( function( prev, curr ) {\n return prev + curr;\n }, 0 );\n\n var shiftBottom = shift.bottom.reduce( function( prev, curr ) {\n return prev + curr;\n }, 0 );\n\n graph.drawingSpaceHeight = graph.getDrawingHeight() - shiftTop - shiftBottom;\n\n [ shift.top, shift.bottom ].map( function( arr ) {\n arr.reduce( function( prev, current, index ) {\n arr[ index ] = prev + current;\n return prev + current;\n }, 0 );\n } );\n\n // Apply to top and bottom\n graph._applyToAxes( function( axis, position ) {\n\n if ( !axis.isShown() || axis.floating ) {\n return;\n }\n\n axis.setShift( shift[ position ][ axis.getLevel() ] );\n\n }, false, true, false );\n\n // Applied to left and right\n graph._applyToAxes( function( axis, position ) {\n\n if ( !axis.isShown() ) {\n axis.hideGroup();\n // Don't return here. We need to go through the draw method as the axis must be assigned minPx and maxPx values.\n // This is because some series can still be visible although the axis isn't.\n } else {\n axis.showGroup();\n }\n\n axis.setMinPx( shiftTop );\n axis.setMaxPx( graph.getDrawingHeight( true ) - shiftBottom );\n\n if ( axis.floating ) {\n return;\n }\n\n // First we need to draw it in order to determine the width to allocate\n // graph is done to accomodate 0 and 100000 without overlapping any element in the DOM (label, ...)\n\n // Let's not draw dependant axes yet\n let drawn = ( !axis.linkedToAxis ) ? axis.draw() : 0;\n\n if ( !axis.isShown() ) {\n return;\n }\n // Get axis position gives the extra shift that is common\n var level = getAxisLevelFromSpan( axis.getSpan(), levels[ position ] );\n axis.setLevel( level );\n shift[ position ][ level ] = Math.max( drawn, shift[ position ][ level ] || 0 );\n\n }, false, false, true );\n\n var shift2 = util.extend( true, {}, shift );\n\n // Applied to left and right\n graph._applyToAxes( function( axis, position ) {\n\n if ( !axis.isShown() || axis.floating ) {\n return;\n }\n\n shift2[ position ][ axis.getLevel() ] = Math.max( shift[ position ][ axis.getLevel() ], axis.equalizePosition( shift[ position ][ axis.getLevel() ] ) );\n\n }, false, false, true );\n\n shift = shift2;\n\n var shiftLeft = shift.left.reduce( function( prev, curr ) {\n return prev + curr;\n }, 0 );\n\n var shiftRight = shift.right.reduce( function( prev, curr ) {\n return prev + curr;\n }, 0 );\n\n graph.drawingSpaceWidth = graph.getDrawingWidth() - shiftLeft - shiftRight;\n\n [ shift.left, shift.right ].map( function( arr ) {\n arr.reduce( function( prev, current, index ) {\n arr[ index ] = prev + current;\n return prev + current;\n }, 0 );\n } );\n\n // Apply to left and right\n graph._applyToAxes( ( axis, position ) => {\n\n if ( !axis.isShown() || axis.floating ) {\n return;\n }\n axis.setShift( shift[ position ][ axis.getLevel() ] );\n\n }, false, false, true );\n\n // Apply to top and bottom\n graph._applyToAxes( function( axis, position ) {\n\n if ( !axis.isShown() ) {\n // return;\n }\n\n axis.setMinPx( shiftLeft );\n axis.setMaxPx( graph.getDrawingWidth( true ) - shiftRight );\n\n if ( axis.floating ) {\n return;\n }\n\n if ( !axis.linkedToAxis ) {\n axis.draw();\n }\n\n }, false, true, false );\n\n // Floating axes\n graph._applyToAxes( function( axis ) {\n\n if ( !axis.floating ) {\n return;\n }\n\n var floatingAxis = axis.getFloatingAxis();\n var floatingValue = axis.getFloatingValue();\n var floatingPx = floatingAxis.getPx( floatingValue );\n\n axis.setShift( floatingPx );\n\n if ( !axis.linkedToAxis ) {\n axis.draw();\n }\n\n }, false, true, true );\n\n _closeLine( graph, 'right', graph.getDrawingWidth( true ), graph.getDrawingWidth( true ), shiftTop, graph.getDrawingHeight( true ) - shiftBottom );\n _closeLine( graph, 'left', 0, 0, shiftTop, graph.getDrawingHeight( true ) - shiftBottom );\n _closeLine( graph, 'top', shiftLeft, graph.getDrawingWidth( true ) - shiftRight, 0, 0 );\n _closeLine( graph, 'bottom', shiftLeft, graph.getDrawingWidth( true ) - shiftRight, graph.getDrawingHeight( true ) - shiftBottom, graph.getDrawingHeight( true ) - shiftBottom );\n\n graph.clipRect.setAttribute( 'y', shiftTop );\n graph.clipRect.setAttribute( 'x', shiftLeft );\n graph.clipRect.setAttribute( 'width', graph.getDrawingWidth() - shiftLeft - shiftRight );\n graph.clipRect.setAttribute( 'height', graph.getDrawingHeight() - shiftTop - shiftBottom );\n\n graph.rectEvent.setAttribute( 'y', shiftTop + graph.getPaddingTop() );\n graph.rectEvent.setAttribute( 'x', shiftLeft + graph.getPaddingLeft() );\n\n graph.rectEvent.setAttribute( 'width', graph.drawingSpaceWidth );\n graph.rectEvent.setAttribute( 'height', graph.drawingSpaceHeight );\n\n graph.drawingSpaceMinX = shiftLeft + graph.getPaddingLeft(); // + \"px\";\n graph.drawingSpaceMinY = shiftTop + graph.getPaddingTop(); // + \"px\";\n graph.drawingSpaceMaxX = graph.getDrawingWidth() - shiftRight + graph.getPaddingLeft(); // + \"px\";\n graph.drawingSpaceMaxY = graph.getDrawingHeight() - shiftBottom + graph.getPaddingTop(); // + \"px\";\n\n // Apply to top and bottom\n graph._applyToAxes( function( axis, position ) {\n\n if ( !axis.isShown() ) {\n return;\n }\n\n axis.drawLines();\n\n }, false, true, true );\n\n /*\n\tgraph.shapeZoneRect.setAttribute('x', shift[1]);\n\tgraph.shapeZoneRect.setAttribute('y', shift[2]);\n\tgraph.shapeZoneRect.setAttribute('width', graph.getDrawingWidth() - shift[2] - shift[3]);\n\tgraph.shapeZoneRect.setAttribute('height', graph.getDrawingHeight() - shift[1] - shift[0]);\n*/\n graph.shift = shift;\n graph.redrawShapes(); // Not sure this should be automatic here. The user should be clever.\n}\n\nfunction _handleKey( graph, event, type ) {\n\n var self = graph;\n console.log( event, type );\n if ( graph.forcedPlugin ) {\n\n graph.activePlugin = graph.forcedPlugin;\n graph._pluginExecute( graph.activePlugin, type, [ graph, event ] );\n return;\n }\n\n checkKeyActions( graph, event, [ graph, event ], type );\n}\n\n// Similar to checkMouseActions\nfunction checkKeyActions( graph, e, parameters, methodName ) {\n\n var keyComb = graph.options.keyActions,\n i, l;\n\n for ( i = 0, l = keyComb.length; i < l; i++ ) {\n\n if ( keyComb[ i ].plugin ) { // Is it a plugin ?\n\n if ( graph.forcedPlugin == keyComb[ i ].plugin || graph.isActionAllowed( e, keyComb[ i ] ) ) {\n\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n\n graph.activePlugin = keyComb[ i ].plugin; // Lease the mouse action to the current action\n graph._pluginExecute( keyComb[ i ].plugin, methodName, parameters );\n\n e.preventDefault();\n e.stopPropagation();\n\n return true;\n }\n\n } else if ( keyComb[ i ].callback && graph.isActionAllowed( e, keyComb[ i ] ) ) {\n\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n keyComb[ i ].callback.apply( graph, parameters );\n return true;\n\n }\n\n if ( keyComb[ i ].removeSelectedShape && graph.isActionAllowed( e, keyComb[ i ] ) ) {\n\n e.preventDefault();\n e.stopPropagation();\n\n graph.selectedShapes.map( ( shape ) => {\n\n shape.kill( keyComb[ i ].keepInDom );\n } );\n }\n\n /* else if ( keyComb[ i ].series ) {\n\n var series;\n if ( keyComb[ i ].series === 'all' ) {\n series = graph.series;\n }\n\n if ( !Array.isArray( keyComb[ i ].series ) ) {\n series = [ series ];\n }\n\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n\n for ( var j = 0; j < series.length; i++ ) {\n graph._serieExecute( series[ i ], methodName, parameters );\n }\n return true;\n }*/\n\n }\n\n return false;\n\n}\n\nfunction doDom() {\n\n // Create SVG element, set the NS\n this.dom = document.createElementNS( Graph.ns, 'svg' );\n this.dom.setAttributeNS( 'http://www.w3.org/2000/xmlns/', 'xmlns:xlink', 'http://www.w3.org/1999/xlink' );\n //this.dom.setAttributeNS(this.ns, 'xmlns:xlink', this.nsxml);\n util.setAttributeTo( this.dom, {\n 'xmlns': Graph.ns,\n 'font-family': this.options.fontFamily,\n 'font-size': this.options.fontSize\n } );\n\n try {\n util.setAttributeTo( this.dom, {\n 'data-jsgraph-version': __VERSION__\n } );\n } catch ( e ) {\n // ignore\n }\n\n this.defs = document.createElementNS( Graph.ns, 'defs' );\n this.dom.appendChild( this.defs );\n\n this.groupEvent = document.createElementNS( Graph.ns, 'g' );\n\n this.rectEvent = document.createElementNS( Graph.ns, 'rect' );\n util.setAttributeTo( this.rectEvent, {\n 'pointer-events': 'fill',\n 'fill': 'transparent'\n } );\n this.groupEvent.appendChild( this.rectEvent );\n\n this.dom.appendChild( this.groupEvent );\n\n // Handling graph title\n this.domTitle = document.createElementNS( Graph.ns, 'text' );\n this.setTitle( this.options.title );\n util.setAttributeTo( this.domTitle, {\n 'text-anchor': 'middle',\n 'y': 20\n } );\n this.groupEvent.appendChild( this.domTitle );\n //\n\n this.graphingZone = document.createElementNS( Graph.ns, 'g' );\n this.updateGraphingZone();\n\n this.groupEvent.appendChild( this.graphingZone );\n\n /* this.shapeZoneRect = document.createElementNS(this.ns, 'rect');\n //this.shapeZoneRect.setAttribute('pointer-events', 'fill');\n this.shapeZoneRect.setAttribute('fill', 'transparent');\n this.shapeZone.appendChild(this.shapeZoneRect);\n*/\n this.axisGroup = document.createElementNS( Graph.ns, 'g' );\n this.graphingZone.appendChild( this.axisGroup );\n\n this.groupGrids = document.createElementNS( Graph.ns, 'g' );\n\n // With the z stacking, this should probably be removed\n //this.groupGrids.setAttribute( 'clip-path', 'url(#_clipplot' + this._creation + ')' );\n\n this.groupPrimaryGrids = document.createElementNS( Graph.ns, 'g' );\n this.groupSecondaryGrids = document.createElementNS( Graph.ns, 'g' );\n\n this.axisGroup.appendChild( this.groupGrids );\n\n this.groupGrids.appendChild( this.groupSecondaryGrids );\n this.groupGrids.appendChild( this.groupPrimaryGrids );\n\n this.plotGroup = document.createElementNS( Graph.ns, 'g' );\n this.graphingZone.appendChild( this.plotGroup );\n\n // 5 September 2014. I encountered a case here shapeZone must be above plotGroup\n /*this.shapeZone = document.createElementNS( this.ns, 'g' );\n this.graphingZone.appendChild( this.shapeZone );\n*/\n\n this.layers = [];\n\n this._makeClosingLines();\n\n this.clip = document.createElementNS( Graph.ns, 'clipPath' );\n this.clip.setAttribute( 'id', '_clipplot' + this._creation );\n this.defs.appendChild( this.clip );\n\n this.clipRect = document.createElementNS( Graph.ns, 'rect' );\n this.clip.appendChild( this.clipRect );\n this.clip.setAttribute( 'clipPathUnits', 'userSpaceOnUse' );\n\n this.markerArrow = document.createElementNS( this.ns, 'marker' );\n this.markerArrow.setAttribute( 'viewBox', '0 0 10 10' );\n this.markerArrow.setAttribute( 'id', 'arrow' + this._creation );\n this.markerArrow.setAttribute( 'refX', '6' );\n this.markerArrow.setAttribute( 'refY', '5' );\n this.markerArrow.setAttribute( 'markerUnits', 'strokeWidth' );\n this.markerArrow.setAttribute( 'markerWidth', '8' );\n this.markerArrow.setAttribute( 'markerHeight', '6' );\n this.markerArrow.setAttribute( 'orient', 'auto' );\n //this.markerArrow.setAttribute('fill', 'context-stroke');\n //this.markerArrow.setAttribute('stroke', 'context-stroke');\n\n var pathArrow = document.createElementNS( Graph.ns, 'path' );\n pathArrow.setAttribute( 'd', 'M 0 0 L 10 5 L 0 10 z' );\n //pathArrow.setAttribute( 'fill', 'context-stroke' );\n this.markerArrow.appendChild( pathArrow );\n\n this.defs.appendChild( this.markerArrow );\n\n // Horionzal split marker for axis\n this.markerHorizontalSplit = document.createElementNS( Graph.ns, 'marker' );\n this.markerHorizontalSplit.setAttribute( 'viewBox', '0 0 6 8' );\n this.markerHorizontalSplit.setAttribute( 'id', 'horionzalsplit_' + this.getId() );\n this.markerHorizontalSplit.setAttribute( 'refX', '3' );\n this.markerHorizontalSplit.setAttribute( 'refY', '4' );\n this.markerHorizontalSplit.setAttribute( 'markerUnits', 'strokeWidth' );\n this.markerHorizontalSplit.setAttribute( 'markerWidth', '6' );\n this.markerHorizontalSplit.setAttribute( 'markerHeight', '8' );\n\n var path = document.createElementNS( Graph.ns, 'line' );\n path.setAttribute( 'x1', '0' );\n path.setAttribute( 'y1', '8' );\n\n path.setAttribute( 'x2', '6' );\n path.setAttribute( 'y2', '0' );\n\n path.setAttribute( 'stroke', 'black' );\n this.markerHorizontalSplit.appendChild( path );\n\n this.defs.appendChild( this.markerHorizontalSplit );\n\n // Vertical split marker for axis\n this.markerVerticalSplit = document.createElementNS( Graph.ns, 'marker' );\n this.markerVerticalSplit.setAttribute( 'viewBox', '0 0 8 6' );\n this.markerVerticalSplit.setAttribute( 'id', 'verticalsplit_' + this.getId() );\n this.markerVerticalSplit.setAttribute( 'refX', '4' );\n this.markerVerticalSplit.setAttribute( 'refY', '3' );\n this.markerVerticalSplit.setAttribute( 'markerUnits', 'strokeWidth' );\n this.markerVerticalSplit.setAttribute( 'markerWidth', '8' );\n this.markerVerticalSplit.setAttribute( 'markerHeight', '6' );\n\n var path = document.createElementNS( Graph.ns, 'line' );\n\n path.setAttribute( 'x1', '0' );\n path.setAttribute( 'y1', '0' );\n\n path.setAttribute( 'x2', '8' );\n path.setAttribute( 'y2', '6' );\n\n path.setAttribute( 'stroke', 'black' );\n this.markerVerticalSplit.appendChild( path );\n this.defs.appendChild( this.markerVerticalSplit );\n\n this.vertLineArrow = document.createElementNS( Graph.ns, 'marker' );\n this.vertLineArrow.setAttribute( 'viewBox', '0 0 10 10' );\n this.vertLineArrow.setAttribute( 'id', 'verticalline' + this._creation );\n this.vertLineArrow.setAttribute( 'refX', '0' );\n this.vertLineArrow.setAttribute( 'refY', '5' );\n this.vertLineArrow.setAttribute( 'markerUnits', 'strokeWidth' );\n this.vertLineArrow.setAttribute( 'markerWidth', '20' );\n this.vertLineArrow.setAttribute( 'markerHeight', '10' );\n this.vertLineArrow.setAttribute( 'orient', 'auto' );\n //this.vertLineArrow.setAttribute('fill', 'context-stroke');\n //this.vertLineArrow.setAttribute('stroke', 'context-stroke');\n this.vertLineArrow.setAttribute( 'stroke-width', '1px' );\n\n var pathVertLine = document.createElementNS( Graph.ns, 'path' );\n pathVertLine.setAttribute( 'd', 'M 0 -10 L 0 10' );\n pathVertLine.setAttribute( 'stroke', 'black' );\n\n this.vertLineArrow.appendChild( pathVertLine );\n\n this.defs.appendChild( this.vertLineArrow );\n\n // Removed with z stacking ?\n // this.plotGroup.setAttribute( 'clip-path', 'url(#_clipplot' + this._creation + ')' );\n\n this.bypassHandleMouse = false;\n}\n\nfunction _registerEvents( graph ) {\n var self = graph;\n\n if ( !graph.wrapper ) {\n throw 'No wrapper exists. Cannot register the events.';\n }\n\n graph.dom.setAttribute( 'tabindex', 0 );\n\n graph.dom.addEventListener( 'keydown', e => {\n _handleKey( graph, e, 'keydown' );\n } );\n\n graph.dom.addEventListener( 'keypress', e => {\n _handleKey( graph, e, 'keypress' );\n } );\n\n graph.dom.addEventListener( 'keyup', e => {\n _handleKey( graph, e, 'keyup' );\n } );\n // Not sure this has to be prevented\n\n // August 17th, 2017: I extended the graph.groupEvent to the more general graph.dom to make the zoom plugin more\n // intuitive. Let us see if it breaks another example...\n graph.dom.addEventListener( 'mousemove', e => {\n //e.preventDefault();\n var coords = graph._getXY( e );\n _handleMouseMove( graph, coords.x, coords.y, e );\n\n } );\n\n graph.dom.addEventListener( 'mouseleave', e => {\n\n _handleMouseLeave( graph );\n\n } );\n\n graph.groupEvent.addEventListener( 'mousedown', e => {\n\n graph.focus();\n\n // e.preventDefault();\n if ( e.which == 3 || e.ctrlKey ) {\n return;\n }\n\n var coords = graph._getXY( e );\n _handleMouseDown( graph, coords.x, coords.y, e );\n\n } );\n\n graph.dom.addEventListener( 'mouseup', e => {\n\n graph.emit( 'mouseUp', e );\n var coords = graph._getXY( e );\n\n _handleMouseUp( graph, coords.x, coords.y, e );\n\n } );\n\n graph.wrapper.addEventListener( 'mouseup', e => {\n e.stopPropagation();\n } );\n\n graph.dom.addEventListener( 'dblclick', e => {\n\n graph.emit( 'dblClick', e );\n var coords = graph._getXY( e );\n\n _handleDblClick( graph, coords.x, coords.y, e );\n } );\n\n graph.groupEvent.addEventListener( 'click', e => {\n\n // Cancel right click or Command+Click\n if ( e.which == 3 || e.ctrlKey ) {\n return;\n }\n\n // e.preventDefault();\n var coords = graph._getXY( e );\n\n if ( !graph.prevent( false ) ) {\n _handleClick( graph, coords.x, coords.y, e );\n }\n\n //}, 200 );\n } );\n\n graph.groupEvent.addEventListener( 'mousewheel', e => {\n\n var deltaY = e.wheelDeltaY || e.wheelDelta || -e.deltaY;\n var coords = graph._getXY( e );\n _handleMouseWheel( graph, deltaY, coords.x, coords.y, e );\n\n return false;\n } );\n\n graph.groupEvent.addEventListener( 'wheel', e => {\n\n var coords = graph._getXY( e );\n var deltaY = e.wheelDeltaY || e.wheelDelta || -e.deltaY;\n _handleMouseWheel( graph, deltaY, coords.x, coords.y, e );\n\n return false;\n } );\n}\n\nfunction _handleMouseDown( graph, x, y, e ) {\n\n var self = graph;\n\n if ( graph.forcedPlugin ) {\n\n graph.activePlugin = graph.forcedPlugin;\n graph._pluginExecute( graph.activePlugin, 'onMouseDown', [ graph, x, y, e ] );\n return;\n }\n\n if ( graph.activePlugin ) {\n graph.activePlugin = false;\n }\n\n checkMouseActions( graph, e, [ graph, x, y, e ], 'onMouseDown' );\n}\n\nfunction _handleMouseMove( graph, x, y, e ) {\n\n if ( graph.bypassHandleMouse ) {\n graph.bypassHandleMouse.handleMouseMove( e );\n return;\n }\n\n if ( graph.activePlugin && graph._pluginExecute( graph.activePlugin, 'onMouseMove', [ graph, x, y, e ] ) ) {\n return;\n }\n\n //\t\t\treturn;\n\n graph._applyToAxes( 'handleMouseMove', [ x - graph.options.paddingLeft, e ], true, false );\n graph._applyToAxes( 'handleMouseMove', [ y - graph.options.paddingTop, e ], false, true );\n\n if ( !graph.activePlugin ) {\n var index;\n\n // Takes care of the tracking line\n if ( graph.options.trackingLine && graph.options.trackingLine.enable && graph.options.trackingLine.snapToSerie ) {\n\n if ( graph.options.trackingLine.mode == 'common' ) {\n\n var snapToSerie = graph.options.trackingLine.snapToSerie;\n index = snapToSerie.handleMouseMove( false, true );\n\n if ( this.trackingObject ) {\n\n if ( !index ) {\n\n graph.trackingObject.hide();\n\n } else {\n\n graph.trackingObject.show();\n\n graph.trackingObject.getPosition( 0 ).x = index.xClosest;\n graph.trackingObject.getPosition( 1 ).x = index.xClosest;\n graph.trackingObject.redraw();\n\n var x = snapToSerie.getXAxis().getPx( index.xClosest ) + graph.options.paddingLeft;\n }\n }\n\n var series = graph.options.trackingLine.series;\n\n // Gets a default value\n if ( !series ) {\n\n series = graph.getSeries().map( function( serie ) {\n return {\n serie: serie,\n withinPx: 20,\n withinVal: -1\n };\n } );\n }\n\n graph._trackingLegend = _trackingLegendSerie( graph, series, x, y, graph._trackingLegend, graph.options.trackingLine.textMethod, index.xClosest );\n }\n }\n }\n // End takes care of the tracking line\n\n if ( graph.options.onMouseMoveData ) {\n var results = {};\n\n for ( var i = 0; i < graph.series.length; i++ ) {\n\n results[ graph.series[ i ].getName() ] = graph.series[ i ].handleMouseMove( false, true );\n\n }\n\n graph.options.onMouseMoveData.call( graph, e, results );\n }\n\n checkMouseActions( graph, e, [ graph, x, y, e ], 'onMouseMove' );\n\n}\n\nfunction checkMouseActions( graph, e, parameters, methodName ) {\n\n var keyComb = graph.options.mouseActions,\n i, l, executed = false;\n\n for ( i = 0, l = keyComb.length; i < l; i++ ) {\n\n if ( keyComb[ i ].plugin ) { // Is it a plugin ?\n\n if ( graph.forcedPlugin == keyComb[ i ].plugin || graph.isActionAllowed( e, keyComb[ i ] ) ) {\n\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n\n // Lease the mouse action to the current action\n // 25.10.2017: Except for mousewheel. See #111\n if ( e.type !== 'wheel' && e.type !== 'mousewheel' ) {\n graph.activePlugin = keyComb[ i ].plugin;\n }\n\n graph._pluginExecute( keyComb[ i ].plugin, methodName, parameters );\n executed = true;\n continue;\n }\n\n } else if ( keyComb[ i ].callback && graph.isActionAllowed( e, keyComb[ i ] ) ) {\n\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n\n keyComb[ i ].callback.apply( graph, parameters );\n executed = true;\n continue;\n\n } else if ( keyComb[ i ].series ) {\n\n var series;\n if ( keyComb[ i ].series === 'all' ) {\n series = graph.series;\n }\n\n if ( !Array.isArray( keyComb[ i ].series ) ) {\n series = [ series ];\n }\n\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n\n for ( var j = 0; j < series.length; i++ ) {\n graph._serieExecute( series[ i ], methodName, parameters );\n }\n executed = true;\n continue;\n }\n }\n\n return executed;\n}\n\nvar _trackingLegendSerie = function( graph, serie, x, y, legend, textMethod, xValue ) {\n\n var justCreated = false;\n\n if ( !Array.isArray( serie ) ) {\n serie = [ serie ];\n }\n\n var output = [];\n\n if ( !legend && graph.options.trackingLine.legend ) {\n justCreated = true;\n legend = _makeTrackingLegend( graph );\n }\n\n serie.map( ( serie ) => {\n\n var index = serie.serie.handleMouseMove( xValue, false );\n\n if ( !index || !textMethod ) {\n\n if ( serie.serie.trackingShape ) {\n serie.serie.trackingShape.hide();\n }\n\n return legend;\n }\n\n // Should we display the dot ?\n if (\n ( serie.withinPx > 0 && Math.abs( x - graph.options.paddingLeft - serie.serie.getXAxis().getPx( index.xClosest ) ) - serie.withinPx > 1e-14 ) ||\n ( serie.withinVal > 0 && Math.abs( serie.serie.getXAxis().getVal( x - graph.options.paddingLeft ) - index.xClosest ) - serie.withinVal > serie.serie.getXAxis().getVal( x - graph.options.paddingLeft ) / 100000 )\n ) {\n\n if ( serie.serie.trackingShape ) {\n serie.serie.trackingShape.hide();\n }\n\n } else {\n\n output[ serie.serie.getName() ] = {\n\n yValue: index.xClosest,\n xValue: index.yClosest,\n serie: serie,\n index: index\n\n };\n\n let serieShape;\n if ( graph.options.trackingLine && graph.options.trackingLine.serieShape ) {\n serieShape = graph.options.trackingLine.serieShape;\n } else {\n serieShape = {\n shape: 'ellipse',\n properties: {\n rx: [ serie.serie.getLineWidth() * 3 + 'px' ],\n ry: [ serie.serie.getLineWidth() * 3 + 'px' ]\n }\n };\n }\n\n if ( !serie.serie.trackingShape ) {\n\n serie.serie.trackingShape = graph.newShape( serieShape.shape, {\n fillColor: serie.serie.getLineColor(),\n strokeColor: 'White',\n strokeWidth: serie.serie.getLineWidth()\n },\n true,\n serieShape.properties\n )\n .setSerie( serie.serie )\n .forceParentDom( serie.serie.groupMain )\n .draw();\n\n ( serieShape.onCreated && serieShape.onCreated( serie.serie.trackingShape ) );\n\n serie.serie.trackingShape.on( 'changed', () => {\n\n ( serieShape.onChanged && serieShape.onChanged( serie.serie.trackingShape ) );\n\n } );\n }\n\n serie.serie.trackingShape.show();\n serie.serie.trackingShape.getPosition( 0 ).x = index.xClosest;\n\n if ( serieShape.magnet ) {\n\n let magnetOptions = serieShape.magnet,\n val = magnetOptions.within,\n minmaxpos;\n\n if ( magnetOptions.withinPx ) {\n val = serie.serie.getXAxis().getRelVal( magnetOptions.withinPx );\n }\n\n if ( ( minmaxpos = serie.serie.findLocalMinMax( index.xClosest, val, magnetOptions.mode ) ) ) {\n\n serie.serie.trackingShape.getPosition( 0 ).x = minmaxpos;\n }\n }\n\n serie.serie.trackingShape.redraw();\n }\n\n } ); // End map\n\n if ( !graph.options.trackingLine.legend ) {\n return;\n }\n\n if ( Object.keys( output ).length == 0 || !textMethod ) {\n legend.style.display = 'none';\n } else {\n\n if ( legend.style.display == 'none' || justCreated ) {\n\n forceTrackingLegendMode( graph, legend, x, y, true );\n } else {\n _trackingLegendMove( graph, legend, x, y );\n }\n\n legend.style.display = 'block';\n var txt = textMethod( output, xValue, x, y );\n\n legend.innerHTML = txt;\n\n //legend.innerHTML = textMethod( output, xValue, x, y );\n\n }\n\n return legend;\n\n};\n\nvar forceTrackingLegendMode = function( graph, legend, toX, toY, skip ) {\n\n var ratio = 0,\n start = Date.now(),\n h = legend.offsetHeight,\n startX = parseInt( legend.style.marginLeft.replace( 'px', '' ) || 0 ),\n startY = parseInt( legend.style.marginTop.replace( 'px', '' ) || 0 );\n\n toX = ( toX > graph.getWidth() / 2 ) ? ( ( toX - toX % 10 - 20 ) - legend.offsetWidth ) : ( toX - toX % 10 + 30 );\n toY = ( toY - toY % 10 + h / 2 );\n\n if ( skip ) {\n legend.style.marginLeft = ( toX ) + 'px';\n legend.style.marginTop = ( toY ) + 'px';\n return;\n }\n\n function next() {\n\n var progress = ( Date.now() - start ) / 200;\n if ( progress > 1 ) {\n progress = 1;\n }\n\n legend.style.marginLeft = ( ( toX - startX ) * progress + startX ) + 'px';\n legend.style.marginTop = ( ( toY - startY ) * progress + startY ) + 'px';\n\n if ( progress < 1 ) {\n window.requestAnimationFrame( next );\n }\n }\n\n window.requestAnimationFrame( next );\n};\n\nvar _trackingLegendMove = util.debounce( forceTrackingLegendMode, 50 );\n\nfunction _makeTrackingLegend( graph ) {\n\n var group = document.createElement( 'div' );\n group.setAttribute( 'class', 'trackingLegend' );\n group.style.position = 'absolute';\n group.style.borderRadius = '4px';\n group.style.boxShadow = '1px 1px 3px 0px rgba(100,100,100,0.6)';\n group.style.border = '2px solid #333333';\n group.style.backgroundColor = 'rgba(255, 255, 255, 0.5 )';\n group.style.pointerEvents = 'none';\n group.style.paddingTop = '5px';\n group.style.paddingBottom = '5px';\n group.style.paddingLeft = '10px';\n group.style.paddingRight = '10px';\n\n graph.getWrapper().insertBefore( group, graph.getDom() );\n\n return group;\n}\n\nfunction _handleDblClick( graph, x, y, e ) {\n //\tvar _x = x - graph.options.paddingLeft;\n //\tvar _y = y - graph.options.paddingTop;\n var pref = graph.options.dblclick;\n checkMouseActions( graph, e, [ x, y, e ], 'onDblClick' );\n /*\n if ( !pref || !pref.type ) {\n return;\n }\n\n switch ( pref.type ) {\n\n case 'plugin':\n\n var plugin;\n\n if ( ( plugin = graph.plugins[ pref.plugin ] ) ) {\n\n plugin.onDblClick( graph, x, y, pref.options, e );\n }\n\n break;\n }*/\n}\n\nfunction _handleMouseUp( graph, x, y, e ) {\n\n if ( graph.bypassHandleMouse ) {\n graph.bypassHandleMouse.handleMouseUp( e );\n graph.activePlugin = false;\n return;\n }\n\n graph._pluginExecute( graph.activePlugin, 'onMouseUp', [ graph, x, y, e ] );\n graph.activePlugin = false;\n}\n\nfunction _handleClick( graph, x, y, e ) {\n\n graph.emit( 'click', [ graph, x, y, e ] );\n // Not on a shape\n checkMouseActions( graph, e, [ x, y, e ], 'onClick' );\n\n if ( !e.target.jsGraphIsShape && !graph.prevent( false ) && graph.options.shapesUnselectOnClick ) {\n\n graph.unselectShapes();\n }\n\n}\n\nfunction _getAxis( graph, num, options, pos ) {\n\n var options = options || {};\n var inst;\n\n var _availableAxes = {\n\n def: {\n x: graph.getConstructor( 'graph.axis.x' ),\n y: graph.getConstructor( 'graph.axis.y' )\n },\n\n time: {\n x: graph.getConstructor( 'graph.axis.x.time' )\n },\n\n bar: {\n x: graph.getConstructor( 'graph.axis.x.bar' )\n }\n };\n\n switch ( options.type ) {\n\n case 'time':\n var axisInstance = _availableAxes.time;\n break;\n\n case 'bar':\n var axisInstance = _availableAxes.bar;\n break;\n\n case 'broken':\n var axisInstance = _availableAxes.broken;\n break;\n\n default:\n var axisInstance = _availableAxes.def;\n break;\n }\n\n switch ( pos ) {\n\n case 'top':\n case 'bottom':\n inst = axisInstance.x;\n break;\n\n case 'left':\n case 'right':\n inst = axisInstance.y;\n break;\n }\n\n num = num || 0;\n\n if ( typeof num == 'object' ) {\n options = num;\n num = 0;\n }\n\n if ( !graph.axis[ pos ][ num ] ) {\n\n graph.axis[ pos ][ num ] = new inst( graph, pos, options );\n graph.axis[ pos ][ num ].init( graph, options );\n }\n\n return graph.axis[ pos ][ num ];\n}\n\nfunction _closeLine( graph, mode, x1, x2, y1, y2 ) {\n\n if ( graph.options.close === false ) {\n return;\n }\n\n var l = 0;\n\n graph.axis[ mode ].map( function( g ) {\n\n if ( g.isDisplayed() && !g.floating ) {\n l++;\n }\n } );\n\n if ( ( graph.options.close === true || graph.options.close[ mode ] ) && l == 0 ) {\n\n graph.closingLines[ mode ].setAttribute( 'display', 'block' );\n graph.closingLines[ mode ].setAttribute( 'x1', x1 );\n graph.closingLines[ mode ].setAttribute( 'x2', x2 );\n graph.closingLines[ mode ].setAttribute( 'y1', y1 );\n graph.closingLines[ mode ].setAttribute( 'y2', y2 );\n\n } else {\n\n graph.closingLines[ mode ].setAttribute( 'display', 'none' );\n }\n}\n\nfunction _handleMouseWheel( graph, delta, coordX, coordY, e ) {\n if ( checkMouseActions( graph, e, [ delta, e, coordX, coordY ], 'onMouseWheel' ) ) {\n e.preventDefault();\n e.stopPropagation();\n }\n}\n\nfunction _handleMouseLeave( graph ) {\n if ( graph.options.handleMouseLeave ) {\n graph.options.handleMouseLeave.call( graph );\n }\n}\n\nfunction haveAxesChanged( graph ) {\n var temp = graph._axesHaveChanged;\n graph._axesHaveChanged = false;\n return temp;\n}\n\nfunction hasSizeChanged( graph ) {\n var temp = graph._sizeChanged;\n graph._sizeChanged = false;\n return temp;\n}\n\n// Constants\nGraph.SERIE_LINE = Symbol();\nGraph.SERIE_SCATTER = Symbol();\nGraph.SERIE_CONTOUR = Symbol();\nGraph.SERIE_BAR = Symbol();\nGraph.SERIE_BOX = Symbol();\nGraph.SERIE_ZONE = Symbol();\nGraph.SERIE_LINE_COLORED = Symbol();\nGraph.SERIE_ZONE = Symbol();\nGraph.SERIE_DENSITYMAP = Symbol();\nGraph.SERIE_LINE_3D = Symbol();\nGraph.SERIE_ZONE_3D = Symbol();\n\nGraph.TICKS_OUTSIDE = Symbol();\nGraph.TICKS_INSIDE = Symbol();\nGraph.TICKS_CENTERED = Symbol();\n\nGraph.ns = 'http://www.w3.org/2000/svg';\nGraph.nsxlink = 'http://www.w3.org/1999/xlink';\n\nexport default Graph;","import GraphPosition from './graph.position.js';\nimport * as util from './graph.util.js';\n\n/**\n * Default legend configuration\n * @name LegendOptionsDefault\n * @object\n * @static\n * @prop {Boolean} frame - true to display a frame around the legend\n * @prop {Number} frameWidth - The width of the frame stroke\n * @prop {String} frameColor - The stroke color of the frame\n * @prop {String} backgroundColor - The background color of the frame\n * @prop {Number} paddingLeft - The left padding\n * @prop {Number} paddingRight - The right padding\n * @prop {Number} paddingTop - The top padding\n * @prop {Number} paddingBottom - The bottom padding\n * @prop {Boolean} shapesToggleable - true to toggle the shapes linked to serie with its status (shown or hidden)\n * @prop {Boolean} isSerieHideable - true to allow series to be hidden through the legend\n * @prop {Boolean} isSerieSelectable - true to allow series to be selected through the legend\n */\nvar legendDefaults = {\n\n backgroundColor: 'rgba(255, 255, 255, 0.8)',\n frame: true,\n frameWidth: 1,\n frameColor: 'black',\n paddingTop: 10,\n paddingLeft: 10,\n paddingBottom: 10,\n paddingRight: 10,\n color: 'black',\n frameRounding: 0,\n\n movable: false,\n\n shapesToggleable: true,\n isSerieHideable: true,\n isSerieSelectable: true\n\n};\n\n/**\n * Legend constructor. You should not call this method directly, but rather use {@link graph.makeLegend}\n * @example var legend = graph.makeLegend( { backgroundColor: 'rgba(255, 255, 255, 0.8)',\n * frame: true,\n * frameWidth: 1,\n * frameColor: 'black',\n * paddingTop: 10,\n * paddingLeft: 10,\n * paddingBottom: 10,\n * paddingRight: 10,\n * frameRounding: 3,\n *\n * movable: false,\n *\n * shapesToggleable: true,\n * isSerieHideable: true,\n * isSerieSelectable: true\n * } );\n */\nclass Legend {\n\n constructor( graph, options ) {\n\n this.options = util.extend( {}, legendDefaults, options );\n\n this.graph = graph;\n this.svg = document.createElementNS( this.graph.ns, 'g' );\n this.subG = document.createElementNS( this.graph.ns, 'g' );\n\n this.groups = [];\n this.rect = document.createElementNS( this.graph.ns, 'rect' );\n this.rectBottom = document.createElementNS( this.graph.ns, 'rect' );\n\n this.rect.setAttribute( 'x', 0 );\n this.rect.setAttribute( 'y', 0 );\n\n this.rectBottom.setAttribute( 'x', 0 );\n this.rectBottom.setAttribute( 'y', 0 );\n\n this.series = false;\n\n this.svg.setAttribute( 'display', 'none' );\n this.pos = {\n x: undefined,\n y: undefined,\n transformX: 0,\n transformY: 0\n };\n\n this.setEvents();\n\n this.eyeId = util.guid();\n this.eyeCrossedId = util.guid();\n\n var eyeClosed = util.SVGParser( '' );\n // var eyeClosed = util.SVGParser('');\n\n /* var eyeClosed = document.createElementNS( this.graph.ns, \"symbol\");\n eyeClosed.setAttribute('id', this.eyeId );\n eyeClosed.setAttribute(\"viewBox\", '0 0 100 100');\n\n var rect = document.createElementNS( this.graph.ns, \"rect\" );\n rect.setAttribute('width', 100 );\n rect.setAttribute('height', 100 );\n rect.setAttribute('x', 0 );\n rect.setAttribute('y', 0 );\n rect.setAttribute('fill', 'black');\n eyeClosed.appendChild( rect );\n */\n var eye = util.SVGParser( '' );\n\n this.svg.appendChild( document.adoptNode( eye.documentElement.firstChild ) );\n this.svg.appendChild( document.adoptNode( eyeClosed.documentElement.firstChild ) );\n\n this.svg.appendChild( this.subG );\n\n this.applyStyle();\n }\n\n /**\n * Sets the position of the legend\n * @param {Position} position - the position to set the legend to versus the graph main axes ({@link Graph#getXAxis} and {@link Graph#getYAxis})\n * @param {String} alignToX - \"right\" or \"left\". References the legend right or left boundary using the position parameter\n * @param {String} alignToY - \"top\" or \"bottom\". References the legend top or bottom boundary using the position parameter\n * @example legend.setPosition( { x: 'max', y: '0px' }, 'right', 'top' ); // The rightmost side of the legend will at the maximum value of the axis, and will be positioned at the top\n */\n setPosition( position, alignToX, alignToY ) {\n\n if ( !position ) {\n return;\n }\n\n this.position = position;\n this.alignToX = alignToX || 'left';\n this.alignToY = alignToY || 'top';\n\n }\n\n setDraggable( bln ) {\n this.options.movable = bln;\n\n }\n\n setAutoPosition( position ) {\n\n if ( [ 'bottom', 'left', 'top', 'right' ].indexOf( ( position = position.toLowerCase() ) ) > -1 ) {\n this.autoPosition = position;\n return this;\n }\n\n this.requireDelayedUpdate();\n this.autoPosition = false;\n }\n\n autoPosition() {\n return this.setAutoPosition( ...arguments );\n }\n\n buildLegendBox() {\n\n var series = this.series || this.graph.getSeries(),\n posX = 0,\n posY = this.options.paddingTop;\n\n if ( !this.autoPosition ) {\n this.graph.graphingZone.appendChild( this.getDom() );\n } else {\n this.graph.getDom().appendChild( this.getDom() );\n }\n\n for ( var i = 0, l = series.length; i < l; i++ ) {\n\n if ( series[ i ].excludedFromLegend && !this.series ) {\n continue;\n }\n\n if ( this.autoPosition == 'bottom' || this.autoPosition == 'top' ) {\n\n var bbox = getBBox( this.groups[ i ] );\n\n if ( posX + bbox.width > this.graph.getDrawingWidth() - this.options.paddingRight ) {\n posY += 16;\n posX = 0;\n }\n }\n\n this.groups[ i ].setAttribute( 'transform', 'translate( ' + posX + ', ' + posY + ')' );\n\n if ( this.autoPosition == 'bottom' || this.autoPosition == 'top' ) {\n\n posX += bbox.width + 10;\n posY += 0;\n\n } else {\n\n posX = 0;\n posY += 16;\n }\n }\n\n var bbox = getBBox( this.subG );\n\n /* Independant on box position */\n this.width = bbox.width + this.options.paddingRight + this.options.paddingLeft;\n this.height = bbox.height + this.options.paddingBottom + this.options.paddingTop;\n\n this.rect.setAttribute( 'width', this.width );\n this.rect.setAttribute( 'height', this.height );\n this.rect.setAttribute( 'fill', 'none' );\n this.rect.setAttribute( 'pointer-events', 'fill' );\n\n this.rect.setAttribute( 'display', 'none' );\n\n if ( this.options.movable ) {\n this.rectBottom.style.cursor = 'move';\n }\n\n this.rectBottom.setAttribute( 'width', this.width );\n this.rectBottom.setAttribute( 'height', this.height );\n\n this.rectBottom.setAttribute( 'x', bbox.x - this.options.paddingLeft );\n this.rectBottom.setAttribute( 'y', bbox.y - this.options.paddingTop );\n /* End independant on box position */\n\n this.position = this.position || {};\n\n switch ( this.autoPosition ) {\n\n case 'bottom':\n this.position.y = this.graph.getHeight() + 'px';\n // Try to center with respect to the drawing space, not the full graph. It's useful when the graph is fairly asymmetric (i.e. multiple axes on 1 side)\n this.position.x = ( ( this.graph.drawingSpaceWidth - this.width ) / 2 + this.graph.drawingSpaceMinX ) + 'px';\n this.alignToY = 'bottom';\n this.alignToX = false;\n break;\n\n case 'left':\n this.position.x = '6px';\n this.position.y = ( ( this.graph.getHeight() - this.height ) / 2 ) + 'px';\n this.alignToX = 'left';\n this.alignToY = false;\n break;\n\n case 'right':\n this.position.x = this.graph.getWidth() + 'px';\n this.position.y = ( ( this.graph.getHeight() - this.height ) / 2 ) + 'px';\n this.alignToX = 'right';\n this.alignToY = false;\n break;\n\n case 'top':\n this.position.x = ( ( this.graph.drawingSpaceWidth - this.width ) / 2 + this.graph.drawingSpaceMinX ) + 'px';\n this.position.y = '10px';\n this.alignToY = 'top';\n this.alignToX = false;\n break;\n }\n\n if ( this.autoPosition ) {\n switch ( this.autoPosition ) {\n\n case 'bottom':\n this.graph.options.paddingBottom = this.height + 10;\n break;\n\n case 'left':\n this.graph.options.paddingLeft = this.width + 5;\n break;\n\n case 'right':\n this.graph.options.paddingRight = this.width + 10;\n break;\n\n case 'top':\n this.graph.options.paddingTop = this.height + 14;\n break;\n }\n\n this.graph.updateGraphingZone();\n this.graph.getDrawingHeight();\n this.graph.getDrawingWidth();\n // this.graph.redraw( false );\n\n }\n\n this.bbox = bbox;\n }\n\n calculatePosition() {\n\n var pos = GraphPosition.check( this.position );\n let poscoords = pos.compute( this.graph, this.graph.getXAxis(), this.graph.getYAxis() );\n\n if ( !poscoords ) {\n return;\n }\n\n if ( pos.y == 'max' ) {\n poscoords.y += this.graph.getPaddingTop();\n }\n\n if ( pos.x == 'max' ) {\n poscoords.x -= this.graph.getPaddingRight();\n }\n\n if ( this.alignToX == 'right' ) {\n poscoords.x -= this.width;\n poscoords.x -= this.bbox.x;\n\n } else {\n //poscoords.x -= this.bbox.x;\n }\n\n if ( this.alignToY == 'bottom' ) {\n poscoords.y -= this.height;\n poscoords.y -= this.bbox.y;\n\n } else {\n\n poscoords.y -= this.bbox.y;\n }\n\n this.pos.transformX = poscoords.x;\n this.pos.transformY = poscoords.y;\n\n this._setPosition();\n\n }\n\n /**\n * Updates the legend position and content\n */\n update( onlyIfRequired ) {\n\n if ( this.graph.isDelayedUpdate() || ( !this._requiredUpdate && onlyIfRequired ) ) {\n return;\n }\n\n this._requiredUpdate = false;\n\n var self = this;\n\n this.applyStyle();\n\n while ( this.subG.hasChildNodes() ) {\n this.subG.removeChild( this.subG.lastChild );\n }\n\n this.svg.insertBefore( this.rectBottom, this.svg.firstChild );\n\n var series = this.series || this.graph.getSeries(),\n line,\n text,\n g;\n\n if ( series.length > 0 ) {\n this.svg.setAttribute( 'display', 'block' );\n } else {\n return;\n }\n\n if ( this.autoPosition == 'bottom' || this.autoPosition == 'top' ) {\n var fullWidth = this.graph.getDrawingWidth();\n }\n\n var posX, posY;\n\n for ( var i = 0, l = series.length; i < l; i++ ) {\n\n if ( series[ i ].excludedFromLegend && !this.series ) {\n continue;\n }\n\n ( function( j ) {\n\n var g, line, text, xPadding = 0;\n\n if ( this.autoPosition == 'bottom' || this.autoPosition == 'top' ) {\n var fullWidth = this.graph.getDrawingWidth();\n }\n\n g = document.createElementNS( self.graph.ns, 'g' );\n var rect = document.createElementNS( self.graph.ns, 'rect' );\n\n self.subG.appendChild( g );\n\n g.appendChild( rect );\n\n var line = series[ j ].getSymbolForLegend();\n var marker = series[ j ].getMarkerForLegend();\n var text = series[ j ].getTextForLegend();\n\n var dx = 35;\n\n if ( this.isHideable() ) {\n dx += 20;\n\n var eyeUse = document.createElementNS( self.graph.ns, 'use' );\n eyeUse.setAttributeNS( 'http://www.w3.org/1999/xlink', 'xlink:href', '#' + ( series[ i ].isShown() ? this.eyeId : this.eyeCrossedId ) );\n eyeUse.setAttribute( 'width', 15 );\n eyeUse.setAttribute( 'height', 15 );\n eyeUse.setAttribute( 'x', 35 );\n eyeUse.setAttribute( 'y', -8 );\n\n eyeUse.addEventListener( 'click', function( e ) {\n e.stopPropagation();\n\n var id;\n if ( series[ j ].isShown() ) {\n series[ j ].hide( self.options.hideShapesOnHideSerie );\n id = self.eyeCrossedId;\n } else {\n series[ j ].show( self.options.hideShapesOnHideSerie );\n id = self.eyeId;\n }\n\n eyeUse.setAttributeNS( 'http://www.w3.org/1999/xlink', 'xlink:href', '#' + id );\n\n } );\n\n }\n\n text.setAttribute( 'transform', 'translate(' + dx + ', 3)' );\n\n text.setAttribute( 'color', this.options.color );\n\n if ( line ) {\n g.appendChild( line );\n }\n\n if ( series[ j ].getType() == 'scatter' ) {\n line.setAttribute( 'transform', 'translate( 20, 0 )' );\n }\n\n if ( marker ) {\n g.appendChild( marker );\n }\n\n if ( eyeUse ) {\n g.appendChild( eyeUse );\n }\n\n g.appendChild( text );\n\n var bbox = getBBox( g );\n\n rect.setAttribute( 'x', bbox.x );\n rect.setAttribute( 'y', bbox.y );\n rect.setAttribute( 'width', bbox.width );\n rect.setAttribute( 'height', bbox.height );\n rect.setAttribute( 'fill', 'none' );\n rect.setAttribute( 'pointer-events', 'fill' );\n\n self.groups[ j ] = g;\n\n g.addEventListener( 'click', function( e ) {\n\n var serie = series[ j ];\n\n if ( !serie.isShown() ) {\n return;\n }\n\n if ( self.isSelectable() && !serie.isSelected() ) {\n\n self.graph.selectSerie( serie );\n } else {\n\n self.graph.unselectSerie( serie );\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n } );\n\n } ).call( this, i );\n }\n\n this.svg.appendChild( this.rect );\n this.buildLegendBox();\n this.calculatePosition();\n\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be hidden or not\n */\n isHideable() {\n return this.options.isSerieHideable;\n }\n\n notHideable() {\n this.options.isSerieHideable = false;\n return this;\n }\n\n hideable() {\n this.options.isSerieHideable = true;\n return this;\n }\n\n set seriesHideable( hideable ) {\n this.options.isSerieHideable = !!hideable;\n }\n\n /**\n * @type {Boolean}\n */\n get seriesHideable() {\n return this.options.isSerieHideable;\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be selected or not\n */\n isSelectable() {\n return this.options.isSerieSelectable;\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be t or not\n */\n isToggleShapes() {\n return this.options.shapesToggleable;\n }\n\n /**\n * @return {SVGGroupElement} The SVG group element wrapping the legend\n */\n getDom() {\n return this.svg;\n }\n\n setEvents() {\n\n var self = this;\n var pos = this.pos;\n\n var mousedown = function( e ) {\n\n e.stopPropagation();\n console.log( 'down' );\n if ( self.options.movable ) {\n pos.x = e.clientX;\n pos.y = e.clientY;\n\n e.preventDefault();\n self.mousedown = true;\n self.graph.elementMoving( self );\n\n self.rect.setAttribute( 'display', 'block' );\n }\n };\n\n var mousemove = function( e ) {\n self.handleMouseMove( e );\n };\n\n this.svg.addEventListener( 'mousedown', mousedown );\n this.svg.addEventListener( 'click', function( e ) {\n e.stopPropagation();\n } );\n this.svg.addEventListener( 'dblclick', function( e ) {\n e.stopPropagation();\n } );\n this.svg.addEventListener( 'mousemove', mousemove );\n //this.rect.addEventListener( 'mousemove', mousemove );\n }\n\n handleMouseUp( e ) {\n\n e.stopPropagation();\n e.preventDefault();\n this.mousedown = false;\n this.rect.setAttribute( 'display', 'none' );\n this.graph.elementMoving( false );\n }\n\n handleMouseMove( e ) {\n\n if ( !this.mousedown ) {\n return;\n }\n\n var pos = this.pos;\n\n var deltaX = e.clientX - pos.x;\n var deltaY = e.clientY - pos.y;\n\n pos.transformX += deltaX;\n pos.transformY += deltaY;\n\n pos.x = e.clientX;\n pos.y = e.clientY;\n\n e.stopPropagation();\n e.preventDefault();\n\n this._setPosition();\n }\n\n _setPosition() {\n\n var pos = this.pos;\n if ( !isNaN( pos.transformX ) && !isNaN( pos.transformY ) && pos.transformX !== false && pos.transformY !== false ) {\n this.svg.setAttribute( 'transform', 'translate(' + pos.transformX + ', ' + pos.transformY + ')' );\n }\n }\n\n /**\n * Re-applies the legend style\n */\n applyStyle() {\n\n if ( this.options.frame ) {\n this.rectBottom.setAttribute( 'stroke', this.options.frameColor );\n this.rectBottom.setAttribute( 'stroke-width', this.options.frameWidth + 'px' );\n this.rectBottom.setAttribute( 'rx', this.options.frameRounding );\n this.rectBottom.setAttribute( 'ry', this.options.frameRounding );\n }\n\n this.rectBottom.setAttribute( 'fill', this.options.backgroundColor );\n\n }\n\n /**\n * Re-applies the legend style\n * @param {...(GraphSerie|GraphSerie[])} a serie or an array of series\n */\n fixSeries() {\n var series = [];\n\n if ( arguments[ 0 ] === false ) {\n this.series = false;\n this.update();\n return;\n }\n\n for ( var i = 0, l = arguments.length; i < l; i++ ) {\n if ( Array.isArray( arguments[ i ] ) ) {\n series = series.concat( arguments[ i ] );\n } else {\n series.push( arguments[ i ] );\n }\n }\n\n this.update();\n this.series = series;\n }\n\n fixSeriesAdd( serie ) {\n this.series = this.series || [];\n this.series.push( serie );\n }\n\n requireDelayedUpdate() {\n this._requiredUpdate = true;\n }\n\n}\n\nfunction getBBox( svgElement ) {\n // Firefox throws when trying to call getBBox() on elements\n // that are not yet rendered.\n try {\n return svgElement.getBBox();\n } catch ( e ) {\n return {\n height: 0,\n width: 0,\n x: 0,\n y: 0\n };\n }\n}\n\nexport default Legend;","import Graph from './graph.core.js';\nimport EventEmitter from './dependencies/eventEmitter/EventEmitter.js';\nimport * as util from './graph.util.js';\n\n/**\n * Default graph parameters\n * @name AxisOptionsDefault\n * @object\n * @static\n * @memberof Axis\n * @prop {Boolean} display - Whether to display or not the axis\n * @prop {Boolean} flipped - Flips the axis (maximum and minimum will be inverted)\n * @prop {Numner} axisDataSpacing.min - The spacing of the at the bottom of the axis. The value is multiplied by the (max - min) values given by the series (0.1 means 10% of the serie width / height).\n * @prop {Number} axisDataSpacing.max - The spacing of the at the top of the axis. The value is multiplied by the (max - min) values given by the series (0.1 means 10% of the serie width / height).\n * @prop {String} unitModification - Used to change the units of the axis in a defined way. Currently, \"time\" and \"time:min.sec\" are supported. They will display the value in days, hours, minutes and seconds and the data should be expressed in seconds.\n * @prop {Boolean} primaryGrid - Whether or not to display the primary grid (on the main ticks)\n * @prop {Boolean} secondaryGrid - Whether or not to display the secondary grid (on the secondary ticks)\n * @prop {Number} tickPosition - Sets the position of the ticks with regards to the axis ( 1 = inside, 2 = centered, 3 = outside ).\n * @prop {Number} nbTicksPrimary - The number of primary ticks to use (approximately)\n * @prop {Number} nbTicksSecondary - The number of secondary ticks to use (approximately)\n * @prop {Number} ticklabelratio - Scaling factor on the labels under each primary ticks\n * @prop {Number} exponentialFactor - Scales the labels under each primary ticks by 10^(exponentialFactor)\n * @prop {Number} exponentialLabelFactor - Scales the axis label by 10^(exponentialFactor)\n * @prop {Boolean} logScale - Display the axis in log scale (base 10)\n * @prop {(Number|Boolean)} forcedMin - Use a number to force the minimum value of the axis (becomes independant of its series)\n * @prop {(Number|Boolean)} forcedMax - Use a number to force the maximum value of the axis (becomes independant of its series)\n */\nconst defaults = {\n lineAt: false,\n display: true,\n flipped: false,\n axisDataSpacing: {\n min: 0.1,\n max: 0.1\n },\n unitModification: false,\n primaryGrid: true,\n secondaryGrid: true,\n\n primaryGridColor: '#f0f0f0',\n secondaryGridColor: '#f0f0f0',\n\n primaryGridWidth: 1,\n secondaryGridWidth: 1,\n\n hideWhenNoSeriesShown: false,\n shiftToZero: false,\n tickPosition: 1,\n nbTicksPrimary: 3,\n nbTicksSecondary: 10,\n ticklabelratio: 1,\n exponentialFactor: 0,\n exponentialLabelFactor: 0,\n logScale: false,\n forcedMin: false,\n forcedMax: false,\n\n span: [ 0, 1 ],\n marginMin: 0,\n marginMax: 0,\n\n scientificScale: false,\n scientificScaleExponent: false,\n engineeringScale: false,\n\n unitInTicks: false,\n unit: false,\n unitWrapperBefore: '',\n unitWrapperAfter: '',\n\n splitMarks: false,\n\n tickLabelOffset: 0,\n\n useKatexForLabel: false\n};\n\n/**\n * Axis constructor. Usually not instanced directly, but for custom made axes, that's possible\n * @class Axis\n * @static\n * @augments EventEmitter\n * @example function myAxis() {};\n * myAxis.prototype = new Graph.getConstructor(\"axis\");\n * graph.setBottomAxis( new myAxis( { } ) );\n */\nclass Axis extends EventEmitter {\n\n constructor() {\n\n super();\n }\n\n init( graph, options, overwriteoptions ) {\n\n this.unitModificationTimeTicks = [\n [ 1, [ 1, 2, 5, 10, 20, 30 ] ],\n [ 60, [ 1, 2, 5, 10, 20, 30 ] ],\n [ 3600, [ 1, 2, 6, 12 ] ],\n [ 3600 * 24, [ 1, 2, 3, 4, 5, 10, 20, 40 ] ]\n ];\n\n this.graph = graph;\n this.options = util.extend( true, {}, defaults, overwriteoptions, options );\n\n this.group = document.createElementNS( this.graph.ns, 'g' );\n this.hasChanged = true;\n\n this.rectEvent = document.createElementNS( this.graph.ns, 'rect' );\n this.rectEvent.setAttribute( 'pointer-events', 'fill' );\n this.rectEvent.setAttribute( 'fill', 'transparent' );\n this.group.appendChild( this.rectEvent );\n\n this.graph.axisGroup.appendChild( this.group ); // Adds to the main axiszone\n\n // Lines at a certain value\n this._lines = [];\n\n this.line = document.createElementNS( this.graph.ns, 'line' );\n this.line.setAttribute( 'stroke', 'black' );\n this.line.setAttribute( 'shape-rendering', 'crispEdges' );\n this.line.setAttribute( 'stroke-linecap', 'square' );\n this.groupTicks = document.createElementNS( this.graph.ns, 'g' );\n this.groupTickLabels = document.createElementNS( this.graph.ns, 'g' );\n\n this.group.appendChild( this.groupTicks );\n this.group.appendChild( this.groupTickLabels );\n this.group.appendChild( this.line );\n\n this.label = document.createElementNS( this.graph.ns, 'text' );\n\n this.labelTspan = document.createElementNS( this.graph.ns, 'tspan' ); // Contains the main label\n this.preunit = ''; //document.createElementNS( this.graph.ns, 'tspan' ); // Contains the scaling unit\n this.unitTspan = document.createElementNS( this.graph.ns, 'tspan' ); // Contains the unit\n this.expTspan = document.createElementNS( this.graph.ns, 'tspan' ); // Contains the exponent (x10)\n this.expTspanExp = document.createElementNS( this.graph.ns, 'tspan' ); // Contains the exponent value\n\n this.label.appendChild( this.labelTspan );\n //this.label.appendChild( this.preunitTspan );\n this.label.appendChild( this.unitTspan );\n this.label.appendChild( this.expTspan );\n this.label.appendChild( this.expTspanExp );\n\n this.expTspan.setAttribute( 'dx', 6 );\n this.expTspanExp.setAttribute( 'dy', -5 );\n this.expTspanExp.setAttribute( 'font-size', '0.8em' );\n\n this.label.setAttribute( 'text-anchor', 'middle' );\n\n this.setTickPosition( this.options.tickPosition );\n\n this.gridLinePath = {\n primary: '',\n secondary: ''\n };\n\n this.gridPrimary = document.createElementNS( this.graph.ns, 'path' );\n this.gridSecondary = document.createElementNS( this.graph.ns, 'path' );\n\n this.graph.groupPrimaryGrids.appendChild( this.gridPrimary );\n this.graph.groupSecondaryGrids.appendChild( this.gridSecondary );\n\n this.setGridLinesStyle();\n\n this.group.appendChild( this.label );\n\n this.groupSeries = document.createElementNS( this.graph.ns, 'g' );\n this.group.appendChild( this.groupSeries );\n\n this.widthHeightTick = 0;\n\n this.ticks = {};\n this.ticksLabels = [];\n this.tickScaling = {\n 1: 3,\n 2: 2,\n 3: 1,\n 4: 0.5\n };\n\n this.currentTick = {};\n this.lastCurrentTick = {};\n\n this.series = [];\n this.totalDelta = 0;\n this.currentAction = false;\n\n this.group.addEventListener( 'mousemove', ( e ) => {\n e.preventDefault();\n var coords = this.graph._getXY( e );\n this.handleMouseMoveLocal( coords.x, coords.y, e );\n\n for ( var i = 0, l = this.series.length; i < l; i++ ) {\n this.series[ i ].handleMouseMove( false, true );\n }\n } );\n\n this.labels = [];\n this.group.addEventListener( 'click', ( e ) => {\n e.preventDefault();\n var coords = this.graph._getXY( e );\n this.addLabel( this.getVal( coords.x - this.graph.getPaddingLeft() ) );\n } );\n\n //this.clip = document.createElementNS( this.graph.ns, 'clipPath' );\n //this.clip.setAttribute( 'id', '_clip' + this.axisRand );\n //this.graph.defs.appendChild( this.clip );\n /*\n this.clipRect = document.createElementNS( this.graph.ns, 'rect' );\n this.clip.appendChild( this.clipRect );\n this.clip.setAttribute( 'clipPathUnits', 'userSpaceOnUse' );\n */\n this.gridPrimary.setAttribute( 'clip-path', 'url(#_clipplot' + this.graph._creation + ')' );\n this.gridSecondary.setAttribute( 'clip-path', 'url(#_clipplot' + this.graph._creation + ')' );\n this.graph._axisHasChanged( this );\n }\n\n handleMouseMoveLocal() {}\n\n /**\n * Hides the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n hide() {\n this.options.display = false;\n return this;\n }\n\n /**\n * Shows the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n show() {\n this.options.display = true;\n return this;\n }\n\n /**\n * Shows or hides the axis\n * @memberof Axis\n * @param {Boolean} display - true to display the axis, false to hide it\n * @return {Axis} The current axis\n */\n setDisplay( bool ) {\n this.options.display = !!bool;\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Boolean} A boolean indicating the displayed state of the axis\n */\n isDisplayed() {\n\n if ( !this.options.hideWhenNoSeriesShown ) {\n return this.options.display;\n }\n\n return this.graph.getSeriesFromAxis( this ).reduce( ( accumulator, serie ) => {\n return accumulator || serie.isShown();\n }, false );\n }\n\n isShown() {\n\n return this.isDisplayed( ...arguments );\n }\n\n hideGroup() {\n if ( this._hidden ) {\n return;\n }\n this._hidden = true;\n this.group.setAttribute( 'display', 'none' );\n }\n\n showGroup() {\n if ( !this._hidden ) {\n return;\n }\n this._hidden = false;\n this.group.setAttribute( 'display', 'initial' );\n }\n\n kill( noRedraw, noSerieKill ) {\n this.graph.killAxis( this, noRedraw, noSerieKill );\n }\n /**\n * Forces the appearence of a straight perpendicular line at value 0\n * @param {Array} atValues - An array of x or y values where the lines are displayed\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setLineAt( atValues ) {\n this.options.lineAt = atValues;\n return this;\n }\n\n // Used to adapt the 0 of the axis to the zero of another axis that has the same direction\n\n /**\n * Aligns ```thisValue``` of the axis to ```foreignValue``` of another axis\n * @param {(Axis|Boolean)} axis - The axis with which the 0 should be aligned. Use \"false\" to deactivate the adapt to 0 mode.\n * @param {Number} thisValue - The value of the current axis that should be aligned\n * @param {Number} foreignValue - The value of the reference axis that should be aligned\n * @param {String} preference - \"min\" or \"max\". Defined the boundary that should behave the more normally\n * @memberof Axis\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n adaptTo( axis, thisValue, foreignValue, preference ) {\n\n if ( !axis ) {\n this.options.adaptTo = false;\n return this;\n }\n\n this.options.adaptTo = {\n axis: axis,\n thisValue: thisValue,\n foreignValue: foreignValue,\n preference: preference\n };\n\n this.adapt();\n\n return this;\n }\n\n /**\n * Adapts maximum and minimum of the axis if options.adaptTo is defined\n * @memberof Axis\n * @returns {Axis} The current axis\n * @since 1.13.2\n */\n adapt() {\n\n if ( !this.options.adaptTo ) {\n return;\n }\n\n var axis = this.options.adaptTo.axis,\n current = this.options.adaptTo.thisValue,\n foreign = this.options.adaptTo.foreignValue;\n\n if ( axis.currentAxisMin === undefined || axis.currentAxisMax === undefined ) {\n axis.setMinMaxToFitSeries();\n }\n\n if ( ( this.options.forcedMin !== false && this.options.forcedMax == false ) || ( this.options.adaptTo.preference !== 'max' ) ) {\n\n if ( this.options.forcedMin !== false ) {\n this.currentAxisMin = this.options.forcedMin;\n } else {\n this.currentAxisMin = this._zoomed ? this.getCurrentMin() : this.getMinValue() - ( current - this.getMinValue() ) * ( this.options.axisDataSpacing.min * ( axis.getCurrentMax() - axis.getCurrentMin() ) / ( foreign - axis.getCurrentMin() ) );\n }\n\n if ( this.currentAxisMin == current ) {\n this.currentAxisMin -= this.options.axisDataSpacing.min * this.getInterval();\n }\n\n var use = this.options.forcedMin !== false ? this.options.forcedMin : this.currentAxisMin;\n this.currentAxisMax = ( current - use ) * ( axis.getCurrentMax() - axis.getCurrentMin() ) / ( foreign - axis.getCurrentMin() ) + use;\n\n } else {\n\n if ( this.options.forcedMax !== false ) {\n this.currentAxisMax = this.options.forcedMax;\n } else {\n this.currentAxisMax = this._zoomed ? this.getCurrentMax() : this.getMaxValue() + ( this.getMaxValue() - current ) * ( this.options.axisDataSpacing.max * ( axis.getCurrentMax() - axis.getCurrentMin() ) / ( axis.getCurrentMax() - foreign ) );\n }\n\n if ( this.currentAxisMax == current ) {\n this.currentAxisMax += this.options.axisDataSpacing.max * this.getInterval();\n }\n\n var use = this.options.forcedMax !== false ? this.options.forcedMax : this.currentAxisMax;\n\n this.currentAxisMin = ( current - use ) * ( axis.getCurrentMin() - axis.getCurrentMax() ) / ( foreign - axis.getCurrentMax() ) + use;\n }\n\n this.graph._axisHasChanged( this );\n }\n\n // Floating axis. Adapts axis position orthogonally to another axis at a defined value. Not taken into account for margins\n\n /**\n * Makes the axis floating (not aligned to the right or the left anymore). You need to specify another axis (perpendicular) and a value at which this axis should be located\n * @param {Axis} axis - The axis on which the current axis should be aligned to\n * @param {Number} value - The value on which the current axis should be aligned\n * @memberof Axis\n * @return {Axis} The current axis\n * @example graph.getYAxis().setFloat( graph.getBottomAxis(), 0 ); // Alignes the y axis with the origin of the bottom axis\n */\n setFloating( axis, value ) {\n\n this.floating = true;\n this.floatingAxis = axis;\n this.floatingValue = value;\n\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Axis} The axis referencing the floating value of the current axis\n */\n getFloatingAxis() {\n return this.floatingAxis;\n }\n\n /**\n * @memberof Axis\n * @return {Axis} The value to which the current axis is aligned to\n */\n getFloatingValue() {\n return this.floatingValue;\n }\n\n /**\n * Sets the axis data spacing\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} min - The spacing at the axis min value\n * @param {Number} [ max = min ] - The spacing at the axis max value. If omitted, will be equal to the \"min\" parameter\n * @return {Axis} The current axis\n */\n setAxisDataSpacing( val1, val2 ) {\n this.options.axisDataSpacing.min = val1;\n this.options.axisDataSpacing.max = val2 || val1;\n return this;\n }\n\n dataSpacing() {\n return this.setAxisDataSpacing( ...arguments );\n }\n\n /**\n * Sets the axis data spacing at the minimum of the axis\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} min - The spacing at the axis min value\n * @return {Axis} The current axis\n */\n setAxisDataSpacingMin( val ) {\n this.options.axisDataSpacing.min = val;\n }\n\n /**\n * Sets the axis data spacing at the maximum of the axis\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} max - The spacing at the axis max value\n * @return {Axis} The current axis\n */\n setAxisDataSpacingMax( val ) {\n this.options.axisDataSpacing.max = val;\n }\n\n setMinPx( px ) {\n\n this.minPx = px;\n this.setMinMaxFlipped();\n }\n\n setMaxPx( px ) {\n\n this.maxPx = px;\n this.setMinMaxFlipped();\n }\n\n /**\n * @memberof Axis\n * @return {Number} The position in px of the bottom of the axis\n */\n getMinPx() {\n return this.minPxFlipped;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The position in px of the top of the axis\n */\n getMaxPx() {\n return this.maxPxFlipped;\n }\n\n getMathMaxPx() {\n return this.maxPx;\n }\n\n getMathMinPx() {\n return this.minPx;\n }\n\n // Returns the true minimum of the axis. Either forced in options or the one from the data\n\n /**\n * Retrieves the minimum possible value of the axis. Can be set by \"forcedMin\", \"adapt0ToAxis\" or by the values of the series the axis contains. Does not take into account any zooming.\n * @memberof Axis\n * @return {Number} The minimum possible value of the axis\n */\n getMinValue() {\n return this.options.forcedMin !== false ? this.options.forcedMin : this.dataMin;\n }\n\n /**\n * Retrieves the maximum possible value of the axis. Can be set by \"forcedMax\", \"adapt0ToAxis\" or by the values of the series the axis contains. Does not take into account any zooming.\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getMaxValue() {\n return this.options.forcedMax !== false ? this.options.forcedMax : this.dataMax;\n }\n\n setMinValueData( min ) {\n this.dataMin = min;\n\n // 25.10.2017. This is to help in the case there's no autoscaling\n if ( isNaN( this.getCurrentMin() ) ) {\n //this.setCurrentMin( this.getMinValue() );\n //this.cache();\n\n }\n }\n\n setMaxValueData( max ) {\n this.dataMax = max;\n\n // 25.10.2017. This is to help in the case there's no autoscaling\n // 02.02.2018. Don't agree with this. Next time, put a link to show the use of this piece of code\n if ( isNaN( this.getCurrentMax() ) ) {\n // this.setCurrentMax( this.getMaxValue() );\n //this.cache();\n\n }\n }\n\n /**\n * Retrieves the maximum possible value of the axis based only on the data. Does not take into account the possible axis forcing\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getDataMax() {\n return this.dataMax;\n }\n\n /**\n * Retrieves the minimum possible value of the axis based only on the data. Does not take into account the possible axis forcing\n * @memberof Axis\n * @return {Number} The minimum possible value of the axis\n */\n getDataMin() {\n return this.dataMin;\n }\n\n /**\n * Forces the minimum value of the axis (no more dependant on the serie values)\n * @memberof Axis\n * @param {Number} min - The minimum value of the axis\n * @param {Boolean} noRescale - ```true``` to prevent the axis to rescale to set this minimum. Rescales anyway if current min is lower than the value. Defaults to ```false```\n * @return {Axis} The current axis\n */\n forceMin( min, noRescale = false ) {\n this.options.forcedMin = min;\n this.setCurrentMin( noRescale ? this.getCurrentMin() : undefined );\n this.graph._axisHasChanged( this );\n return this;\n }\n\n /**\n * Forces the maximum value of the axis (no more dependant on the serie values).\n * @memberof Axis\n * @param {Number} max - The maximum value of the axis\n * @param {Boolean} noRescale - ```true``` to prevent the axis to rescale to set this maximum. Rescales anyway if current max is higher than the value\n * @return {Axis} The current axis\n */\n forceMax( max, noRescale = false ) {\n this.options.forcedMax = max;\n this.setCurrentMax( noRescale ? this.getCurrentMax() : undefined );\n this.graph._axisHasChanged( this );\n return this;\n }\n\n /**\n * Retrieves the forced minimum of the axis\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getForcedMin() {\n return this.options.forcedMin;\n }\n\n /**\n * Retrieves the forced minimum of the axis\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getForcedMax() {\n return this.options.forcedMax;\n }\n\n /**\n * Forces the min and max values of the axis to the min / max values of another axis\n * @param {Axis} axis - The axis from which the min / max values are retrieved.\n * @memberof Axis\n * @return {Axis} The current axis\n */\n forceToAxis( axis ) {\n if ( axis.getMaxValue && axis.getMinValue ) {\n this.options.forcedMin = axis.getMinValue();\n this.options.forcedMax = axis.getMaxValue();\n }\n\n return this;\n }\n\n getNbTicksPrimary() {\n return this.options.nbTicksPrimary;\n }\n\n setNbTicksPrimary( nb ) {\n this.options.nbTicksPrimary = nb;\n }\n\n getNbTicksSecondary() {\n return this.options.nbTicksSecondary;\n }\n\n setNbTicksSecondary( nb ) {\n this.options.nbTicksSecondary = nb;\n return this;\n }\n\n handleMouseMove( px ) {\n this.mouseVal = this.getVal( px );\n }\n\n handleMouseWheel( delta, e, baseline ) {\n\n delta = Math.min( 0.2, Math.max( -0.2, delta ) );\n\n if ( baseline == 'min' ) {\n baseline = this.getMinValue();\n } else if ( baseline == 'max' ) {\n baseline = this.getMaxValue();\n } else if ( !baseline ) {\n baseline = 0;\n }\n\n this._doZoomVal(\n ( ( this.getCurrentMax() - baseline ) * ( 1 + delta ) ) + baseline, ( ( this.getCurrentMin() - baseline ) * ( 1 + delta ) ) + baseline\n );\n\n this.graph.draw();\n //\tthis.graph.drawSeries(true);\n\n }\n\n set zoomLock( bln ) {\n this._zoomLocked = bln;\n }\n\n get zoomLock() {\n return this._zoomLocked || false;\n }\n\n /**\n * Performs a zoom on the axis, without redraw afterwards\n * @param {Number} val1 - The new axis minimum\n * @param {Number} val2 - The new axis maximum\n * @memberof Axis\n * @return {Axis} The current axis\n * @example\n * graph.getBottomAxis().zoom( 50, 70 ); // Axis boundaries will be 50 and 70 after next redraw\n * graph.redraw();\n * @example\n * graph.getBottomAxis().forceMin( 0 ).forceMax( 100 ).zoom( 50, 70 ); // Axis boundaries will be 50 and 70 after next redraw\n * graph.draw();\n * graph.autoscaleAxes(); // New bottom axis boundaries will be 0 and 100, not 50 and 70 !\n * graph.draw();\n */\n zoom( val1, val2, forceLock ) {\n\n if ( !forceLock && this.zoomLock ) {\n return;\n }\n\n return this._doZoomVal( val1, val2, true );\n }\n\n _doZoomVal( val1, val2, mute ) {\n\n return this._doZoom( this.getPx( val1 ), this.getPx( val2 ), val1, val2, mute );\n }\n\n _doZoom( px1, px2, val1, val2, mute ) {\n\n //if(this.options.display || 1 == 1) {\n var val1 = val1 !== undefined ? val1 : this.getVal( px1 );\n var val2 = val2 !== undefined ? val2 : this.getVal( px2 );\n\n this.setCurrentMin( Math.min( val1, val2 ) );\n this.setCurrentMax( Math.max( val1, val2 ) );\n\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n\n this._zoomed = true;\n\n this.adapt();\n\n this._hasChanged = true;\n\n // New method\n if ( !mute ) {\n this.emit( 'zoom', [ this.currentAxisMin, this.currentAxisMax, this ] );\n }\n\n return this;\n }\n\n getSerieShift() {\n return this._serieShift;\n }\n\n getSerieScale() {\n return this._serieScale;\n }\n\n getMouseVal() {\n return this.mouseVal;\n }\n\n getUnitPerTick( px, nbTick, valrange ) {\n\n var pxPerTick = px / nbTicks; // 1000 / 100 = 10 px per tick\n if ( !nbTick ) {\n nbTick = px / 10;\n } else {\n nbTick = Math.min( nbTick, px / 10 );\n }\n\n // So now the question is, how many units per ticks ?\n // Say, we have 0.0004 unit per tick\n var unitPerTick = valrange / nbTick;\n\n switch ( this.options.unitModification ) {\n\n case 'time':\n case 'time:min.sec':\n {\n\n //const max = this.getModifiedValue( this.getMaxValue() );/*,\n /*units = [\n [ 60, 'min' ],\n [ 3600, 'h' ],\n [ 3600 * 24, 'd' ]\n ];*/\n\n let i, l, k, m;\n let breaked = false;\n for ( i = 0, l = this.unitModificationTimeTicks.length; i < l; i++ ) {\n for ( k = 0, m = this.unitModificationTimeTicks[ i ][ 1 ].length; k < m; k++ ) {\n if ( unitPerTick < this.unitModificationTimeTicks[ i ][ 0 ] * this.unitModificationTimeTicks[ i ][ 1 ][ k ] ) {\n breaked = true;\n break;\n }\n }\n if ( breaked ) {\n break;\n }\n }\n\n //i and k contain the good variable;\n if ( i !== this.unitModificationTimeTicks.length ) {\n unitPerTickCorrect = this.unitModificationTimeTicks[ i ][ 0 ] * this.unitModificationTimeTicks[ i ][ 1 ][ k ];\n } else {\n unitPerTickCorrect = 1;\n }\n\n break;\n }\n default:\n {\n\n // We take the log\n var decimals = Math.floor( Math.log( unitPerTick ) / Math.log( 10 ) );\n /*\n \t\t\t\t\tExample:\n \t\t\t\t\t\t13'453 => Math.log10() = 4.12 => 4\n \t\t\t\t\t\t0.0000341 => Math.log10() = -4.46 => -5\n \t\t\t\t*/\n\n var numberToNatural = unitPerTick * Math.pow( 10, -decimals );\n\n /*\n \t\t\t\t\tExample:\n \t\t\t\t\t\t13'453 (4) => 1.345\n \t\t\t\t\t\t0.0000341 (-5) => 3.41\n \t\t\t\t*/\n\n this.decimals = -decimals;\n\n var possibleTicks = [ 1, 2, 5, 10 ];\n var closest = false;\n for ( let i = possibleTicks.length - 1; i >= 0; i-- ) {\n if ( !closest || ( Math.abs( possibleTicks[ i ] - numberToNatural ) < Math.abs( closest - numberToNatural ) ) ) {\n closest = possibleTicks[ i ];\n }\n }\n\n // Ok now closest is the number of unit per tick in the natural number\n /*\n \t\t\t\t\tExample:\n \t\t\t\t\t\t13'453 (4) (1.345) => 1\n \t\t\t\t\t\t0.0000341 (-5) (3.41) => 5\n \t\t\t\t*/\n\n // Let's scale it back\n var unitPerTickCorrect = closest * Math.pow( 10, decimals );\n\n /*\n \t\t\t\t\tExample:\n \t\t\t\t\t\t13'453 (4) (1.345) (1) => 10'000\n \t\t\t\t\t\t0.0000341 (-5) (3.41) (5) => 0.00005\n \t\t\t\t*/\n break;\n }\n }\n\n var nbTicks = valrange / unitPerTickCorrect;\n\n var pxPerTick = px / nbTick;\n return [ unitPerTickCorrect, nbTicks, pxPerTick ];\n }\n\n /**\n * Resets the min and max of the serie to fit the series it contains\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setMinMaxToFitSeries( noNotify ) {\n\n var interval = this.getInterval();\n\n if ( this.options.logScale ) {\n\n this.currentAxisMin = Math.max( 1e-50, this.getMinValue() * 0.9 );\n this.currentAxisMax = Math.max( 1e-50, this.getMaxValue() * 1.1 );\n\n } else {\n\n this.currentAxisMin = this.getMinValue();\n this.currentAxisMax = this.getMaxValue();\n\n if ( this.getForcedMin() === false ) {\n this.currentAxisMin -= ( this.options.axisDataSpacing.min * interval );\n }\n\n if ( this.getForcedMax() === false ) {\n this.currentAxisMax += ( this.options.axisDataSpacing.max * interval );\n }\n }\n\n if ( isNaN( this.currentAxisMin ) || isNaN( this.currentAxisMax ) ) {\n this.currentAxisMax = undefined;\n this.currentAxisMin = undefined;\n }\n\n this.cache();\n\n this._zoomed = false;\n\n this.adapt();\n\n if ( !noNotify ) {\n this.graph._axisHasChanged( this );\n }\n\n this.emit( 'zoomOutFull', [ this.currentAxisMin, this.currentAxisMax, this ] );\n\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Number} the maximum interval ( max - min ) of the axis ( not nessarily the current one )\n */\n getInterval() {\n return this.getMaxValue() - this.getMinValue();\n }\n\n /**\n * @memberof Axis\n * @return {Number} the maximum interval ( max - min ) of the axis ( not nessarily the current one )\n */\n getCurrentInterval() {\n return this.cachedInterval;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The current minimum value of the axis\n */\n getCurrentMin() {\n return this.cachedCurrentMin;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The current maximum value of the axis\n */\n getCurrentMax() {\n return this.cachedCurrentMax;\n }\n\n /**\n * Caches the current axis minimum\n * @memberof Axis\n */\n cacheCurrentMin() {\n this.cachedCurrentMin = this.currentAxisMin == this.currentAxisMax ? ( this.options.logScale ? this.currentAxisMin / 10 : this.currentAxisMin - 1 ) : this.currentAxisMin;\n }\n\n /**\n * Caches the current axis maximum\n * @memberof Axis\n */\n cacheCurrentMax() {\n this.cachedCurrentMax = this.currentAxisMax == this.currentAxisMin ? ( this.options.logScale ? this.currentAxisMax * 10 : this.currentAxisMax + 1 ) : this.currentAxisMax;\n }\n\n /**\n * Caches the current interval\n * @memberof Axis\n */\n cacheInterval() {\n this.cachedInterval = this.cachedCurrentMax - this.cachedCurrentMin;\n }\n\n cache() {\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n }\n\n /**\n * Sets the current minimum value of the axis. If lower that the forced value, the forced value is used\n * @memberof Axis\n * @param {Number} val - The new minimum value\n * @return {Axis} The current axis\n */\n setCurrentMin( val ) {\n\n if ( val === undefined || ( this.getForcedMin() !== false && ( val < this.getForcedMin() || val === undefined ) ) ) {\n val = this.getMinValue();\n }\n this.currentAxisMin = val;\n if ( this.options.logScale ) {\n this.currentAxisMin = Math.max( 1e-50, val );\n }\n\n this.cacheCurrentMin();\n this.cacheInterval();\n\n this.graph._axisHasChanged( this );\n return this;\n }\n\n /**\n * Sets the current maximum value of the axis. If higher that the forced value, the forced value is used\n * @memberof Axis\n * @param {Number} val - The new maximum value\n * @return {Axis} The current axis\n */\n setCurrentMax( val ) {\n\n if ( val === undefined || ( this.getForcedMax() !== false && ( val > this.getForcedMax() || val === undefined ) ) ) {\n val = this.getMaxValue();\n }\n\n this.currentAxisMax = val;\n\n if ( this.options.logScale ) {\n this.currentAxisMax = Math.max( 1e-50, val );\n }\n\n this.cacheCurrentMax();\n this.cacheInterval();\n\n this.graph._axisHasChanged( this );\n }\n\n /**\n * Sets the flipping state of the axis. If enabled, the axis is descending rather than ascending.\n * @memberof Axis\n * @param {Boolean} flip - The new flipping state of the axis\n * @return {Axis} The current axis\n */\n flip( flip ) {\n this.options.flipped = flip;\n this.setMinMaxFlipped();\n return this;\n }\n /*\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n var maxPx = this.maxPx - interval * this.options.span[ 0 ];\n var minPx = this.maxPx - interval * this.options.span[ 1 ];\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n\n // this.minPx = minPx;\n //this.maxPx = maxPx;\n }\n */\n /**\n * @memberof Axis\n * @return {Boolean} The current flipping state of the axis\n */\n isFlipped() {\n return this.options.flipped;\n }\n\n _draw() { // Redrawing of the axis\n\n var self = this;\n // var visible;\n\n // this.drawInit();\n\n if ( this.currentAxisMin === undefined || this.currentAxisMax === undefined ) {\n this.setMinMaxToFitSeries( true ); // We reset the min max as a function of the series\n }\n\n // this.cache();\n\n // this.setSlaveAxesBoundaries();\n\n // The data min max is stored in this.dataMin, this.dataMax\n\n //var widthPx = this.maxPx - this.minPx;\n var widthPx = Math.abs( this.getMaxPx() - this.getMinPx() );\n var valrange = this.getCurrentInterval();\n\n /* Number of px per unit */\n /* Example: width: 1000px\n\t\t\t/* \t\t\t10 - 100 => 11.11\n\t\t\t/*\t\t\t0 - 2 => 500\n\t\t\t/*\t\t\t0 - 0.00005 => 20'000'000\n\t\t\t*/\n\n if ( !this.isShown() ) {\n this.line.setAttribute( 'display', 'none' );\n return 0;\n }\n\n this.line.setAttribute( 'display', 'block' );\n\n if ( this.options.scientificScale == true ) {\n\n if ( this.options.scientificScaleExponent ) {\n\n this.scientificExponent = this.options.scientificScaleExponent;\n } else {\n this.scientificExponent = Math.floor( Math.log( Math.max( Math.abs( this.getCurrentMax() ), Math.abs( this.getCurrentMin() ) ) ) / Math.log( 10 ) );\n }\n } else {\n this.scientificExponent = 0;\n }\n\n /************************************/\n /*** DRAWING LABEL ******************/\n /************************************/\n\n this.gridLinePath.primary = '';\n this.gridLinePath.secondary = '';\n\n /*\n var label;\n if ( label = this.getLabel() ) {\n // Sets the label\n this.labelTspan.textContent = label;\n }\n*/\n let letter;\n if ( !this.options.useKatexForLabel || !this.graph.hasKatexRenderer() ) {\n\n if ( this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && ( this.scientificExponent = this.getEngineeringExponent( this.scientificExponent ) ) && ( letter = this.getExponentGreekLetter( this.scientificExponent ) ) ) {\n\n this.preunit = letter;\n this.unitTspan.setAttribute( 'dx', 0 );\n\n } else if ( this.scientificExponent !== 0 && !isNaN( this.scientificExponent ) ) {\n\n if ( this.options.engineeringScale ) {\n this.scientificExponent = this.getEngineeringExponent( this.scientificExponent );\n }\n\n this.preunit = '';\n\n this.expTspan.setAttribute( 'display', 'visible' );\n this.expTspanExp.setAttribute( 'display', 'visible' );\n\n this.expTspan.textContent = 'x10';\n this.expTspanExp.textContent = this.scientificExponent;\n\n } else {\n\n if ( !this.options.unit ) {\n this.unitTspan.setAttribute( 'display', 'none' );\n }\n\n this.preunit = '';\n this.expTspan.setAttribute( 'display', 'none' );\n this.expTspanExp.setAttribute( 'display', 'none' );\n }\n\n this.writeUnit();\n\n } else {\n\n let string = this.getLabel();\n /*,\n domEl;*/\n\n if ( this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && ( this.scientificExponent = this.getEngineeringExponent( this.scientificExponent ) ) && ( letter = this.getExponentGreekLetter( this.scientificExponent ) ) ) {\n\n string += letter;\n this.preunitTspan.innerHTML = letter;\n this.preunitTspan.setAttribute( 'display', 'visible' );\n this.unitTspan.setAttribute( 'dx', 0 );\n\n string += ' ' + letter + ' ' + this.options.unit;\n\n } else if ( this.scientificExponent !== 0 && !isNaN( this.scientificExponent ) ) {\n\n if ( this.options.engineeringScale ) {\n this.scientificExponent = this.getEngineeringExponent( this.scientificExponent );\n }\n string += ' \\\\cdot 10^' + this.scientificExponent + ' ' + this.options.unit;\n\n }\n\n this.katexElement = this.graph.renderWithKatex( string, this.katexElement );\n }\n\n if ( !this.options.hideTicks ) {\n\n this.resetTicksLength();\n\n if ( this.linkedToAxis ) { // px defined, linked to another axis\n\n this.linkedToAxis.deltaPx = 10;\n var widthHeight = this.drawLinkedToAxisTicksWrapper( widthPx, valrange );\n\n } else if ( !this.options.logScale ) {\n // So the setting is: How many ticks in total ? Then we have to separate it\n\n var widthHeight = this.drawLinearTicksWrapper( widthPx, valrange );\n\n } else {\n\n var widthHeight = this.drawLogTicks();\n\n }\n } else {\n var widthHeight = 0;\n }\n\n this.removeUselessTicks();\n this.removeUselessTickLabels();\n\n this.gridPrimary.setAttribute( 'd', this.gridLinePath.primary );\n this.gridSecondary.setAttribute( 'd', this.gridLinePath.secondary );\n\n // Looks for axes linked to this current axis\n var axes = this.graph.findAxesLinkedTo( this );\n axes.forEach( function( axis ) {\n\n if ( !axis.linkedToAxis ) {\n return;\n }\n axis.setMinPx( self.getMinPx() );\n axis.setMaxPx( self.getMaxPx() );\n\n axis.draw();\n\n } );\n\n /************************************/\n /*** DRAW CHILDREN IMPL SPECIFIC ****/\n /************************************/\n\n // this.drawSpecifics();\n\n return widthHeight;\n }\n\n drawLines() {\n\n if ( this.options.lineAt && Array.isArray( this.options.lineAt ) ) {\n\n this.options.lineAt.forEach( ( val, index ) => {\n\n if ( !isNaN( val ) && this.getCurrentMin() <= val && this.getCurrentMax() >= val ) {\n\n this._lines[ index ] = this._drawLine( val, this._lines[ index ] );\n\n } else {\n this._hideLine( this._lines[ index ] );\n }\n\n } );\n }\n\n }\n\n writeUnit() {\n if ( this.options.unit ) {\n\n this.unitTspan.setAttribute( 'display', 'visible' );\n this.unitTspan.setAttribute( 'dx', 5 );\n\n this.expTspan.setAttribute( 'display', 'none' );\n this.expTspanExp.setAttribute( 'display', 'none' );\n this.unitTspan.innerHTML = ( this.options.unitWrapperBefore + this.preunit + this.options.unit + this.options.unitWrapperAfter ).replace( /\\^([-+0-9]*)(.*)/g, \"$1$2\" );\n\n } else {\n this.unitTspan.setAttribute( 'display', 'none' );\n }\n }\n\n getExponentGreekLetter( val ) {\n\n switch ( val ) {\n\n case 3:\n {\n return 'k';\n }\n\n case 6:\n {\n return 'M';\n }\n case 9:\n {\n return 'G';\n }\n case 12:\n {\n return 'T';\n }\n case 15:\n {\n return 'E';\n }\n case -3:\n {\n return 'm';\n }\n case -6:\n {\n return 'μ';\n }\n case -9:\n {\n return 'n';\n }\n case -12:\n {\n return 'p';\n\n }\n case -15:\n {\n return 'f';\n }\n default:\n {\n return '';\n }\n }\n\n }\n\n drawLinearTicksWrapper( widthPx, valrange ) {\n\n let tickPrimaryUnit;\n\n if ( this.options.primaryTickUnit ) {\n\n tickPrimaryUnit = this.options.primaryTickUnit;\n\n } else {\n\n tickPrimaryUnit = this.getUnitPerTick( widthPx, this.getNbTicksPrimary(), valrange )[ 0 ];\n\n if ( this.options.maxPrimaryTickUnit && this.options.maxPrimaryTickUnit < tickPrimaryUnit ) {\n tickPrimaryUnit = this.options.maxPrimaryTickUnit;\n } else if ( this.options.minPrimaryTickUnit && this.options.minPrimaryTickUnit > tickPrimaryUnit ) {\n tickPrimaryUnit = this.options.minPrimaryTickUnit;\n }\n\n }\n\n // We need to get here the width of the ticks to display the axis properly, with the correct shift\n return this.drawTicks( tickPrimaryUnit, this.secondaryTicks() );\n }\n\n forcePrimaryTickUnit( primaryInterval ) {\n this.options.primaryTickUnit = primaryInterval;\n }\n\n forcePrimaryTickUnitMax( value ) {\n this.options.maxPrimaryTickUnit = value;\n }\n\n forcePrimaryTickUnitMin( value ) {\n this.options.minPrimaryTickUnit = value;\n }\n\n getPrimaryTickUnit() {\n return this.incrTick;\n }\n\n setTickLabelRatio( tickRatio ) {\n this.options.ticklabelratio = tickRatio;\n }\n\n doesHideWhenNoSeriesShown() {\n return this.options.hideWhenNoSeriesShown;\n }\n\n draw() {\n\n this._widthLabels = 0;\n var drawn = this._draw();\n this._widthLabels += drawn;\n return drawn;\n }\n\n drawTicks( primary, secondary ) {\n\n var unitPerTick = primary,\n min = this.getCurrentMin(),\n max = this.getCurrentMax(),\n secondaryIncr,\n incrTick,\n subIncrTick,\n loop = 0;\n\n if ( secondary ) {\n secondaryIncr = unitPerTick / secondary;\n }\n\n incrTick = this.options.shiftToZero ? this.dataMin - Math.ceil( ( this.dataMin - min ) / unitPerTick ) * unitPerTick : Math.floor( min / unitPerTick ) * unitPerTick;\n this.incrTick = primary;\n\n while ( incrTick <= max ) {\n\n loop++;\n if ( loop > 200 ) {\n break;\n }\n\n if ( secondary ) {\n\n subIncrTick = incrTick + secondaryIncr;\n this.subIncrTick = subIncrTick;\n //widthHeight = Math.max(widthHeight, this.drawTick(subIncrTick, 1));\n var loop2 = 0;\n\n while ( subIncrTick < incrTick + unitPerTick ) {\n loop2++;\n if ( loop2 > 100 ) {\n break;\n }\n\n if ( subIncrTick < min || subIncrTick > max ) {\n subIncrTick += secondaryIncr;\n continue;\n }\n\n this.drawTickWrapper( subIncrTick, false, Math.abs( subIncrTick - incrTick - unitPerTick / 2 ) < 1e-4 ? 2 : 3 );\n\n subIncrTick += secondaryIncr;\n }\n }\n\n if ( incrTick < min || incrTick > max ) {\n incrTick += primary;\n continue;\n }\n\n this.drawTickWrapper( incrTick, true, 1 );\n incrTick += primary;\n }\n\n this.widthHeightTick = this.getMaxSizeTick();\n return this.widthHeightTick;\n }\n\n nextTick( level, callback ) {\n\n this.ticks[ level ] = this.ticks[ level ] || [];\n this.lastCurrentTick[ level ] = this.lastCurrentTick[ level ] || 0;\n this.currentTick[ level ] = this.currentTick[ level ] || 0;\n\n if ( this.currentTick[ level ] >= this.ticks[ level ].length ) {\n var tick = document.createElementNS( this.graph.ns, 'line' );\n this.groupTicks.appendChild( tick );\n this.ticks[ level ].push( tick );\n\n callback( tick );\n }\n\n var tick = this.ticks[ level ][ this.currentTick[ level ] ];\n\n if ( this.currentTick[ level ] >= this.lastCurrentTick[ level ] ) {\n tick.setAttribute( 'display', 'visible' );\n }\n\n this.currentTick[ level ]++;\n\n return tick;\n }\n\n nextTickLabel( callback ) {\n\n this.ticksLabels = this.ticksLabels || [];\n this.lastCurrentTickLabel = this.lastCurrentTickLabel || 0;\n this.currentTickLabel = this.currentTickLabel || 0;\n\n if ( this.currentTickLabel >= this.ticksLabels.length ) {\n\n var tickLabel = document.createElementNS( this.graph.ns, 'text' );\n this.groupTickLabels.appendChild( tickLabel );\n this.ticksLabels.push( tickLabel );\n callback( tickLabel );\n }\n\n var tickLabel = this.ticksLabels[ this.currentTickLabel ];\n\n if ( this.currentTickLabel >= this.lastCurrentTickLabel ) {\n tickLabel.setAttribute( 'display', 'visible' );\n }\n\n this.currentTickLabel++;\n\n return tickLabel;\n }\n\n removeUselessTicks() {\n\n for ( var j in this.currentTick ) {\n\n for ( var i = this.currentTick[ j ]; i < this.ticks[ j ].length; i++ ) {\n this.ticks[ j ][ i ].setAttribute( 'display', 'none' );\n }\n\n this.lastCurrentTick[ j ] = this.currentTick[ j ];\n this.currentTick[ j ] = 0;\n }\n }\n\n removeUselessTickLabels() {\n\n for ( var i = this.currentTickLabel; i < this.ticksLabels.length; i++ ) {\n this.ticksLabels[ i ].setAttribute( 'display', 'none' );\n }\n\n this.lastCurrentTickLabel = this.currentTickLabel;\n this.currentTickLabel = 0;\n\n }\n /*\n doGridLine() {\n var gridLine = document.createElementNS( this.graph.ns, 'line' );\n this.groupGrids.appendChild( gridLine );\n return gridLine;\n };*/\n\n nextGridLine( primary, x1, x2, y1, y2 ) {\n\n if ( !( ( primary && this.options.primaryGrid ) || ( !primary && this.options.secondaryGrid ) ) ) {\n return;\n }\n\n this.gridLinePath[ primary ? 'primary' : 'secondary' ] += 'M ' + x1 + ' ' + y1 + ' L ' + x2 + ' ' + y2;\n }\n\n setGridLineStyle( gridLine, primary ) {\n\n gridLine.setAttribute( 'shape-rendering', 'crispEdges' );\n gridLine.setAttribute( 'stroke', primary ? this.getPrimaryGridColor() : this.getSecondaryGridColor() );\n gridLine.setAttribute( 'stroke-width', primary ? this.getPrimaryGridWidth() : this.getSecondaryGridWidth() );\n gridLine.setAttribute( 'stroke-opacity', primary ? this.getPrimaryGridOpacity() : this.getSecondaryGridOpacity() );\n\n var dasharray;\n if ( ( dasharray = primary ? this.getPrimaryGridDasharray() : this.getSecondaryGridDasharray() ) ) {\n gridLine.setAttribute( 'stroke-dasharray', dasharray );\n }\n\n }\n\n setGridLinesStyle() {\n this.setGridLineStyle( this.gridPrimary, true );\n this.setGridLineStyle( this.gridSecondary, false );\n return this;\n }\n\n resetTicksLength() {}\n\n secondaryTicks() {\n return this.options.nbTicksSecondary;\n }\n\n drawLogTicks() {\n var min = this.getCurrentMin(),\n max = this.getCurrentMax();\n var incr = Math.min( min, max );\n var max = Math.max( min, max );\n\n if ( incr < 1e-50 ) {\n incr = 1e-50;\n }\n\n if ( Math.log( incr ) - Math.log( max ) > 20 ) {\n max = Math.pow( 10, ( Math.log( incr ) * 20 ) );\n }\n\n var optsMain = {\n fontSize: '1.0em',\n exponential: true,\n overwrite: false\n };\n\n if ( incr < 0 ) {\n incr = 0;\n }\n\n var pow = incr == 0 ? 0 : Math.floor( Math.log( incr ) / Math.log( 10 ) );\n var incr = 1,\n val;\n while ( ( val = incr * Math.pow( 10, pow ) ) < max ) {\n if ( incr == 1 ) { // Superior power\n if ( val > min )\n this.drawTickWrapper( val, true, 1, optsMain );\n }\n if ( incr == 10 ) {\n incr = 1;\n pow++;\n } else {\n\n if ( incr != 1 && val > min ) {\n\n this.drawTickWrapper( val, false, 2, {\n overwrite: '',\n fontSize: '0.6em'\n } );\n\n }\n\n incr++;\n }\n }\n\n this.widthHeightTick = this.getMaxSizeTick();\n return this.widthHeightTick;\n }\n\n drawTickWrapper( value, label, level, options ) {\n\n //var pos = this.getPos( value );\n\n this.drawTick( value, level, options );\n }\n\n /**\n * Used to scale the master axis into the slave axis\n * @function SlaveAxisScalingFunction\n * @param {Number} val - The master value to convert into a slave value\n * @returns undefined\n */\n\n /**\n * Makes this axis a slave. This can be used to show the same data with different units, specifically when a conversion function exists from axis -> slaveAxis but not in reverse. This axis should actually have no series.\n * @param {Axis} axis - The master axis\n * @param {SlaveAxisScalingFunction} scalingFunction - The scaling function used to map masterValue -> slaveValue\n * @param {Number} decimals - The number of decimals to round the value to\n * @memberof Axis\n * @return {Number} The width or height used by the axis (used internally)\n */\n linkToAxis( axis, scalingFunction, decimals ) {\n\n this.linkedToAxis = {\n axis: axis,\n scalingFunction: scalingFunction,\n decimals: decimals || 1\n };\n\n }\n\n drawLinkedToAxisTicksWrapper( widthPx, valrange ) {\n\n var opts = this.linkedToAxis,\n px = 0,\n val,\n t,\n l,\n delta2;\n\n // Redrawing the main axis ? Why ?\n //opts.axis.draw();\n\n if ( !opts.deltaPx ) {\n opts.deltaPx = 10;\n }\n\n do {\n\n val = opts.scalingFunction( opts.axis.getVal( px + this.getMinPx() ) );\n\n if ( opts.decimals ) {\n this.decimals = opts.decimals;\n }\n\n t = this.drawTick( val, 1, {}, px + this.getMinPx() );\n\n if ( !t ) {\n console.error( val, px, this.getMinPx() );\n throw new Error( 'Unable to draw tick. Please report the test-case' );\n }\n\n l = String( t[ 1 ].textContent ).length * 8;\n delta2 = Math.round( l / 5 ) * 5;\n\n if ( delta2 > opts.deltaPx ) {\n opts.deltaPx = delta2;\n // this.drawInit();\n this.drawLinkedToAxisTicksWrapper( widthPx, valrange );\n return;\n }\n\n px += opts.deltaPx;\n\n } while ( px < widthPx );\n }\n\n /**\n * Transform a value into pixels, according to the axis scaling. The value is referenced to the drawing wrapper, not the the axis minimal value\n * @param {Number} value - The value to translate into pixels\n * @memberof Axis\n * @return {Number} The value transformed into pixels\n */\n getPos( value ) {\n return this.getPx( value );\n }\n\n /**\n * @alias Axis~getPos\n */\n getPx( value ) {\n // if(this.getMaxPx() == undefined)\n // console.log(this);\n //console.log(this.getMaxPx(), this.getMinPx(), this.getCurrentInterval());\n // Ex 50 / (100) * (1000 - 700) + 700\n\n //console.log( value, this.getCurrentMin(), this.getMaxPx(), this.getMinPx(), this.getCurrentInterval() );\n\n if ( !this.options.logScale ) {\n\n return ( value - this.getCurrentMin() ) / ( this.getCurrentInterval() ) * ( this.getMaxPx() - this.getMinPx() ) + this.getMinPx();\n } else {\n // 0 if value = min\n // 1 if value = max\n\n if ( value < 0 )\n return;\n\n var value = ( ( Math.log( value ) - Math.log( this.getCurrentMin() ) ) / ( Math.log( this.getCurrentMax() ) - Math.log( this.getCurrentMin() ) ) ) * ( this.getMaxPx() - this.getMinPx() ) + this.getMinPx();\n\n return value;\n }\n }\n\n /**\n * @alias Axis~getPos\n */\n getRoundedPx( value ) {\n // if(this.getMaxPx() == undefined)\n // console.log(this);\n //console.log(this.getMaxPx(), this.getMinPx(), this.getCurrentInterval());\n // Ex 50 / (100) * (1000 - 700) + 700\n\n //console.log( value, this.getCurrentMin(), this.getMaxPx(), this.getMinPx(), this.getCurrentInterval() );\n return Math.round( this.getPx( value ) * 10 ) / 10;\n }\n\n /**\n * Transform a pixel position (referenced to the graph zone, not to the axis minimum) into a value, according to the axis scaling.\n * @param {Number} pixels - The number of pixels to translate into a value\n * @memberof Axis\n * @return {Number} The axis value corresponding to the pixel position\n */\n getVal( px ) {\n\n if ( !this.options.logScale ) {\n\n return ( px - this.getMinPx() ) / ( this.getMaxPx() - this.getMinPx() ) * this.getCurrentInterval() + this.getCurrentMin();\n\n } else {\n\n return Math.exp( ( px - this.getMinPx() ) / ( this.getMaxPx() - this.getMinPx() ) * ( Math.log( this.getCurrentMax() ) - Math.log( this.getCurrentMin() ) ) + Math.log( this.getCurrentMin() ) );\n }\n }\n\n /**\n * Transform a delta value into pixels\n * @param {Number} value - The value to translate into pixels\n * @return {Number} The value transformed into pixels\n * @example graph.getBottomAxis().forceMin( 20 ).forceMax( 50 ).getRelPx( 2 ); // Returns how many pixels will be covered by 2 units. Let's assume 600px of width, it's ( 2 / 30 ) * 600 = 40px\n */\n getRelPx( delta ) {\n\n return ( delta / this.getCurrentInterval() ) * ( this.getMaxPx() - this.getMinPx() );\n }\n\n /**\n * Transform a delta pixels value into value\n * @param {Number} pixels - The pixel to convert into a value\n * @return {Number} The delta value corresponding to delta pixels\n * @see Axis~getRelPx\n * @example graph.getBottomAxis().forceMin( 20 ).forceMax( 50 ).getRelVal( 40 ); // Returns 2 (for 600px width)\n */\n getRelVal( px ) {\n return px / ( this.getMaxPx() - this.getMinPx() ) * this.getCurrentInterval();\n }\n\n valueToText( value ) {\n\n if ( this.scientificExponent ) {\n\n value /= Math.pow( 10, this.scientificExponent );\n return value.toFixed( 1 );\n\n } else {\n\n value = value * Math.pow( 10, this.getExponentialFactor() ) * Math.pow( 10, this.getExponentialLabelFactor() );\n if ( this.options.shiftToZero ) {\n value -= this.dataMin;\n }\n if ( this.options.ticklabelratio ) {\n value *= this.options.ticklabelratio;\n }\n if ( this.options.unitModification ) {\n value = this.modifyUnit( value, this.options.unitModification );\n return value;\n }\n\n var dec = this.decimals - this.getExponentialFactor() - this.getExponentialLabelFactor();\n\n if ( isNaN( value ) ) {\n return '';\n }\n\n if ( dec > 0 ) {\n value = value.toFixed( dec );\n } else {\n value = value.toFixed( 0 );\n }\n\n if ( this.options.unitInTicks && this.options.unit ) {\n value += ' ' + this.options.unit;\n }\n\n return value;\n }\n }\n\n /**\n * Computes a value and returns it in HTML formatting\n * @memberof Axis\n * @param {Number} value - The value to compute\n * @param {Boolean} noScaling - Does not display scaling\n * @param {Boolean} noUnits - Does not display units\n * @return {String} An HTML string containing the computed value\n * @example graph.getXAxis().setUnit( \"m\" ).setUnitDecade( true ).setScientific( true );\n * graph.getXAxis().valueToHtml( 3500 ); // Returns \"3.5 km\"\n * @see Axis#valueToText\n */\n valueToHtml( value, noScaling, noUnits ) {\n\n var text = this.valueToText( value );\n var letter;\n\n if ( this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && ( this.scientificExponent = this.getEngineeringExponent( this.scientificExponent ) ) && ( letter = this.getExponentGreekLetter( this.scientificExponent ) ) ) {\n\n text += letter;\n\n } else if ( this.scientificExponent !== 0 && !isNaN( this.scientificExponent ) && !noScaling ) {\n text += 'x10';\n text += '' + this.scientificExponent + '';\n }\n\n if ( this.options.unit && !noUnits ) {\n\n text += this.options.unit.replace( /\\^([-+0-9]*)/g, '$1' );\n }\n\n return text;\n }\n\n getModifiedValue( value ) {\n if ( this.options.ticklabelratio ) {\n value *= this.options.ticklabelratio;\n }\n\n if ( this.options.shiftToZero ) {\n value -= this.getMinValue() * ( this.options.ticklabelratio || 1 );\n }\n\n return value;\n }\n\n modifyUnit( value, mode ) {\n\n var text = '';\n var incr = this.incrTick;\n var umin;\n\n switch ( mode ) {\n\n case 'time': // val must be in seconds => transform in hours / days / months\n var max = this.getModifiedValue( this.getMaxValue() ),\n units = [\n [ 60, 'min' ],\n [ 3600, 'h' ],\n [ 3600 * 24, 'd' ]\n ];\n\n if ( max < 3600 ) { // to minutes\n umin = 0;\n } else if ( max < 3600 * 24 ) {\n umin = 1;\n } else if ( max < 3600 * 24 * 30 ) {\n umin = 2;\n }\n\n if ( !units[ umin ] ) {\n return false;\n }\n\n value = value / units[ umin ][ 0 ];\n var valueRounded = Math.floor( value );\n text = valueRounded + units[ umin ][ 1 ];\n\n // Addind lower unit for precision\n umin--;\n while ( incr < 1 * units[ umin + 1 ][ 0 ] && umin > -1 ) {\n\n value = ( value - valueRounded ) * units[ umin + 1 ][ 0 ] / units[ umin ][ 0 ];\n valueRounded = Math.round( value );\n text += ' ' + valueRounded + units[ umin ][ 1 ];\n umin--;\n }\n\n break;\n\n case 'time:min.sec':\n value = value / 60;\n var valueRounded = Math.floor( value );\n var s = ( Math.round( ( value - valueRounded ) * 60 ) + '' );\n s = s.length == 1 ? '0' + s : s;\n text = valueRounded + '.' + s;\n break;\n\n default:\n break;\n }\n\n return text;\n }\n\n getExponentialFactor() {\n return this.options.exponentialFactor;\n }\n\n setExponentialFactor( value ) {\n this.options.exponentialFactor = value;\n }\n\n setExponentialLabelFactor( value ) {\n this.options.exponentialLabelFactor = value;\n }\n\n getExponentialLabelFactor() {\n return this.options.exponentialLabelFactor;\n }\n\n /**\n * Sets the label of the axis\n * @param {Number} label - The label to display under the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setLabel( label ) {\n this.options.labelValue = label;\n return this;\n }\n\n setLabelFont( font ) {\n this.options.labelFont = font;\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {String} The label value\n */\n getLabel() {\n return this.options.labelValue;\n }\n\n setSpan( _from, _to ) {\n\n this.options.span = [ _from, _to ];\n return this;\n }\n\n getSpan() {\n return this.options.span;\n }\n\n setLevel( level ) {\n this._level = level;\n return this;\n }\n\n getLevel() {\n return this._level;\n }\n\n setShift( shift ) {\n this.shift = shift;\n }\n\n getShift() {\n return this.shift;\n }\n\n /**\n * Changes the tick position\n * @param {Number} pos - The new position ( \"outside\", \"centered\" or \"inside\" )\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setTickPosition( pos ) {\n switch ( pos ) {\n case 3:\n case 'outside':\n case Graph.TICKS_OUTSIDE:\n {\n pos = 3;\n break;\n }\n\n case 2:\n case 'centered':\n case Graph.TICKS_CENTERED:\n {\n pos = 2;\n break;\n }\n\n case 1:\n case 'inside':\n case Graph.TICKS_INSIDE:\n default:\n {\n pos = 1;\n break;\n }\n }\n\n this.options.tickPosition = pos;\n\n switch ( this.options.tickPosition ) {\n case 3:\n this.tickPx1 = -2;\n this.tickPx2 = 0;\n break;\n\n case 2:\n this.tickPx1 = -1;\n this.tickPx2 = 1;\n break;\n\n default:\n case 1:\n this.tickPx1 = 0;\n this.tickPx2 = 2;\n break;\n }\n\n return this;\n }\n\n /**\n * Displays or hides the axis grids\n * @param {Boolean} on - true to enable the grids, false to disable them\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setGrids( on ) {\n this.options.primaryGrid = on;\n this.options.secondaryGrid = on;\n return this;\n }\n\n /**\n * Displays or hides the axis primary grid\n * @param {Boolean} on - true to enable the grids, false to disable it\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setPrimaryGrid( on ) {\n this.options.primaryGrid = on;\n return this;\n }\n\n /**\n * Displays or hides the axis secondary grid\n * @param {Boolean} on - true to enable the grids, false to disable it\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setSecondaryGrid( on ) {\n this.options.secondaryGrid = on;\n return this;\n }\n\n /**\n * Enables primary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n primaryGridOn() {\n return this.setPrimaryGrid( true );\n }\n\n /**\n * Disables primary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n primaryGridOff() {\n return this.setPrimaryGrid( false );\n }\n\n /**\n * Enables secondary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n secondaryGridOn() {\n return this.setSecondaryGrid( true );\n }\n\n /**\n * Disables secondary grid\n * @return {Axis} The current axis\n */\n secondaryGridOff() {\n return this.setSecondaryGrid( false );\n }\n\n /**\n * Enables all the grids\n * @return {Axis} The current axis\n */\n gridsOn() {\n return this.setGrids( true );\n }\n\n /**\n * Disables all the grids\n * @return {Axis} The current axis\n */\n gridsOff() {\n return this.setGrids( false );\n }\n\n /**\n * @alias Axis#gridsOff\n */\n turnGridsOff() {\n return this.gridsOff( ...arguments );\n }\n\n /**\n * @alias Axis#gridsOn\n */\n turnGridsOn() {\n return this.gridsOn( ...arguments );\n }\n\n /**\n * Sets the axis color\n * @memberof Axis\n * @param {String} color - The color to set the axis\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setAxisColor( color ) {\n this.options.axisColor = color;\n return this;\n }\n\n /**\n * Gets the axis color\n * @memberof Axis\n * @return {String} The color of the axis\n * @since 1.13.2\n */\n getAxisColor() {\n return this.options.axisColor || 'black';\n }\n\n setTickLabelOffset( offsetValue ) {\n this.options.tickLabelOffset = offsetValue;\n return this;\n }\n\n /**\n * Sets the color of the main ticks\n * @memberof Axis\n * @param {String} color - The new color of the primary ticks\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setPrimaryTicksColor( color ) {\n this.options.primaryTicksColor = color;\n return this;\n }\n\n /**\n * Gets the color of the main ticks\n * @memberof Axis\n * @return {String} The color of the primary ticks\n * @since 1.13.2\n */\n getPrimaryTicksColor() {\n return this.options.primaryTicksColor || 'black';\n }\n\n /**\n * Sets the color of the secondary ticks\n * @memberof Axis\n * @param {String} color - The new color of the secondary ticks\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setSecondaryTicksColor( color ) {\n this.options.secondaryTicksColor = color;\n return this;\n }\n\n /**\n * Gets the color of the secondary ticks\n * @memberof Axis\n * @return {String} The color of the secondary ticks\n * @since 1.13.2\n */\n getSecondaryTicksColor() {\n return this.options.secondaryTicksColor || 'black';\n }\n\n /**\n * Sets the color of the tick labels\n * @memberof Axis\n * @param {String} color - The new color of the tick labels\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setTicksLabelColor( color ) {\n this.options.ticksLabelColor = color;\n if ( Array.isArray( this.ticksLabels ) ) {\n this.ticksLabels.forEach( ( tick ) => {\n tick.setAttribute( 'fill', color );\n } );\n }\n return this;\n }\n\n /**\n * Gets the color of the tick labels\n * @memberof Axis\n * @return {String} The color of the tick labels\n * @since 1.13.2\n */\n getTicksLabelColor() {\n return this.options.ticksLabelColor || 'black';\n }\n\n /**\n * Sets the color of the primary grid\n * @memberof Axis\n * @param {String} color - The primary grid color\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridColor( color ) {\n this.options.primaryGridColor = color;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the color of the primary grid\n * @memberof Axis\n * @return {String} color - The primary grid color\n * @since 1.13.3\n */\n getPrimaryGridColor() {\n return this.options.primaryGridColor;\n }\n\n /**\n * Sets the color of the primary grid\n * @memberof Axis\n * @param {String} color - The primary grid color\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridColor( color ) {\n this.options.secondaryGridColor = color;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the color of the secondary grid\n * @memberof Axis\n * @return {String} color - The secondary grid color\n * @since 1.13.3\n */\n getSecondaryGridColor() {\n return this.options.secondaryGridColor;\n }\n\n /**\n * Sets the width of the primary grid lines\n * @memberof Axis\n * @param {Number} width - The width of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridWidth( width ) {\n this.options.primaryGridWidth = width;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the width of the primary grid lines\n * @memberof Axis\n * @return {Number} width - The width of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridWidth() {\n return this.options.primaryGridWidth;\n }\n\n /**\n * Sets the width of the secondary grid lines\n * @memberof Axis\n * @param {Number} width - The width of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridWidth( width ) {\n this.options.secondaryGridWidth = width;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the width of the secondary grid lines\n * @memberof Axis\n * @return {Number} width - The width of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridWidth() {\n return this.options.secondaryGridWidth;\n }\n\n /**\n * Sets the opacity of the primary grid lines\n * @memberof Axis\n * @param {Number} opacity - The opacity of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridOpacity( opacity ) {\n this.options.primaryGridOpacity = opacity;\n return this;\n }\n\n /**\n * Gets the opacity of the primary grid lines\n * @memberof Axis\n * @return {Number} opacity - The opacity of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridOpacity() {\n return this.options.primaryGridOpacity;\n }\n\n /**\n * Sets the opacity of the secondary grid lines\n * @memberof Axis\n * @param {Number} opacity - The opacity of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridOpacity( opacity ) {\n this.options.secondaryGridOpacity = opacity;\n return this;\n }\n\n /**\n * Gets the opacity of the secondary grid lines\n * @memberof Axis\n * @return {Number} opacity - The opacity of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridOpacity() {\n return this.options.secondaryGridOpacity;\n }\n\n /**\n * Sets the dasharray of the primary grid lines\n * @memberof Axis\n * @param {String} dasharray - The dasharray of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridDasharray( dasharray ) {\n this.options.primaryGridDasharray = dasharray;\n return this;\n }\n\n /**\n * Gets the dasharray of the primary grid lines\n * @memberof Axis\n * @return {String} dasharray - The dasharray of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridDasharray() {\n return this.options.primaryGridDasharray;\n }\n\n /**\n * Sets the dasharray of the secondary grid lines\n * @memberof Axis\n * @param {String} dasharray - The dasharray of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridDasharray( dasharray ) {\n this.options.secondaryGridDasharray = dasharray;\n return this;\n }\n\n /**\n * Gets the dasharray of the secondary grid lines\n * @memberof Axis\n * @return {String} dasharray - The dasharray of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridDasharray() {\n return this.options.secondaryGridDasharray;\n }\n\n /**\n * Sets the color of the label\n * @memberof Axis\n * @param {String} color - The new color of the label\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setLabelColor( color ) {\n this.options.labelColor = color;\n return this;\n }\n\n /**\n * Gets the color of the label\n * @memberof Axis\n * @return {String} The color of the label\n * @since 1.13.2\n */\n getLabelColor() {\n return this.options.labelColor;\n }\n\n setTickContent( dom, val, options ) {\n if ( !options ) options = {};\n\n if ( options.overwrite || !options.exponential ) {\n\n dom.textContent = options.overwrite || this.valueToText( val );\n\n } else {\n var log = Math.round( Math.log( val ) / Math.log( 10 ) );\n var unit = Math.floor( val * Math.pow( 10, -log ) );\n\n dom.textContent = ( unit != 1 ) ? unit + 'x10' : '10';\n var tspan = document.createElementNS( this.graph.ns, 'tspan' );\n tspan.textContent = log;\n tspan.setAttribute( 'font-size', '0.7em' );\n tspan.setAttribute( 'dy', -5 );\n dom.appendChild( tspan );\n }\n\n if ( options.fontSize ) {\n dom.setAttribute( 'font-size', options.fontSize );\n }\n }\n\n /**\n * @memberof Axis\n * @returns {Boolean} true if it is an x axis, false otherwise\n */\n isX() {\n return false;\n }\n\n /**\n * @memberof Axis\n * @returns {Boolean} true if it is an y axis, false otherwise\n */\n isY() {\n return false;\n }\n\n /**\n * Sets the unit of the axis\n * @param {String} unit - The unit of the axis\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setUnit( unit ) {\n this.options.unit = unit;\n return this;\n }\n\n /**\n * Places the unit in every tick\n * @param {Boolean} bool - ```true``` to place the unit, ```false``` otherwise\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 2.0.44\n */\n setUnitInTicks( bool ) {\n this.options.unitInTicks = bool;\n return this;\n }\n\n /**\n * Sets characters wrapping the unit\n * @param {String} before - The string to insert before\n * @param {String} after - The string to insert after\n * @return {Axis} The current axis\n * @memberof Axis\n * @example axis.setUnitWrapper(\"[\", \"]\").setUnit('m'); // Will display [m]\n * @since 1.13.3\n */\n setUnitWrapper( before, after ) {\n this.options.unitWrapperBefore = before;\n this.options.unitWrapperAfter = after;\n return this;\n }\n\n /**\n * Allows the unit to scale with thousands\n * @param {Boolean} on - Enables this mode\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setUnitDecade( on ) {\n this.options.unitDecade = on;\n return this;\n }\n\n /**\n * Enable the scientific mode for the axis values. This way, big numbers can be avoided, e.g. \"1000000000\" would be displayed 1 with 109 or \"G\" shown on near the axis unit.\n * @param {Boolean} on - Enables the scientific mode\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setScientific( on ) {\n this.options.scientificScale = on;\n return this;\n }\n\n /**\n * In the scientific mode, forces the axis to take a specific power of ten. Useful if you want to show kilometers instead of meters for example. In this case you would use \"3\" as a value.\n * @param {Number} scientificScaleExponent - Forces the scientific scale to take a defined power of ten\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n * @see Axis#setScientific\n */\n setScientificScaleExponent( scientificScaleExponent ) {\n this.options.scientificScaleExponent = scientificScaleExponent;\n return this;\n }\n\n /**\n * The engineer scaling is similar to the scientific scaling ({@link Axis#setScientificScale}) but allowing only mupltiples of 3 to be used to scale the axis (for instance, go from grams to kilograms while skipping decagrams and hexagrams)\n * @param {Boolean} engineeringScaling - true to turn on the engineering scaling\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n * @see Axis#setScientific\n */\n setEngineering( engineeringScaling ) { //bool\n this.options.scientificScale = engineeringScaling;\n this.options.engineeringScale = engineeringScaling;\n return this;\n }\n\n /**\n * Calculates the closest engineering exponent from a scientific exponent\n * @param {Number} scientificExponent - The exponent of 10 based on which the axis will be scaled\n * @return {Number} The appropriate engineering exponent\n * @memberof Axis\n * @since 1.13.3\n * @private\n */\n getEngineeringExponent( scientificExponent ) {\n\n if ( scientificExponent > 0 ) {\n scientificExponent -= ( scientificExponent % 3 );\n } else {\n scientificExponent -= ( 3 - ( -scientificExponent ) % 3 ) % 3;\n }\n\n return scientificExponent;\n }\n\n /**\n * Enables log scaling\n * @param {Boolean} logScale - ```true``` to enable the log scaling, ```false``` to disable it\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setLogScale( log ) {\n this.options.logScale = log;\n return this;\n }\n\n isZoomed() {\n return !( this.currentAxisMin == this.getMinValue() || this.currentAxisMax == this.getMaxValue() );\n }\n\n hasAxis() {\n return false;\n }\n\n getType() {\n return null;\n }\n\n useKatexForLabel( use = true ) {\n this.options.useKatexForLabel = use;\n return this;\n }\n\n}\n\n/**\n * @alias Axis#getVal\n */\nAxis.prototype.getValue = Axis.prototype.getVal;\n\n/**\n * @alias Axis#getRelPx\n */\nAxis.prototype.getDeltaPx = Axis.prototype.getRelPx;\n\nexport default Axis;","import Axis from './graph.axis.js';\n\n/**\n * Generic constructor of a y axis\n * @augments Axis\n */\nclass AxisX extends Axis {\n\n constructor( graph, topbottom, options = {} ) {\n\n super( graph, topbottom, options );\n this.top = topbottom == 'top';\n }\n\n /**\n * @private\n * Returns the position of the axis, used by refreshDrawingZone in core module\n */\n getAxisPosition() {\n\n if ( !this.options.display ) {\n return 0;\n }\n\n let size;\n\n if ( this.options.tickLabelOffset == 0 ) { // Normal mode, no offset\n size = ( this.options.tickPosition == 1 ? 8 : 20 );\n size += this.graph.options.fontSize * 1;\n } else { // With an offset, and ticks inside, axis position is actually 0. Otherwise, it's the heights of the ticks\n size = ( this.options.tickPosition == 1 ? 0 : 12 );\n }\n\n if ( this.getLabel() ) {\n size += this.graph.options.fontSize;\n }\n\n return size;\n }\n\n /**\n * @returns {Boolean} always ```true```\n */\n isX() {\n return true;\n }\n\n /**\n * @returns {Boolean} always ```false```\n */\n isY() {\n return false;\n }\n\n /**\n * @private\n * Used to set the x position of the axis\n */\n setShift( shift ) {\n\n this.shift = shift;\n if ( this.getShift() === undefined || !this.graph.getDrawingHeight() ) {\n return;\n }\n\n this.group.setAttribute( 'transform', 'translate(0 ' + ( this.floating ? this.getShift() : ( this.top ? this.shift : ( this.graph.getDrawingHeight() - this.shift ) ) ) + ')' );\n }\n\n /**\n * Caclulates the maximum tick height\n * @return {Number} The maximum tick height\n */\n getMaxSizeTick() {\n return ( this.top ? -1 : 1 ) * ( ( this.options.tickPosition == 1 ) ? 10 : 10 );\n }\n\n /**\n * Draws a tick. Mostly used internally but it can be useful if you want to make your own axes\n * @param {Number} value - The value in axis unit to place the tick\n * @param {Number} level - The importance of the tick\n * @param {Object} options - Further options to be passed to ```setTickContent```\n * @param {Number} forcedPos - Forces the position of the tick (for axis dependency)\n */\n drawTick( value, level, options, forcedPos ) {\n\n var self = this,\n val;\n\n val = forcedPos || this.getPos( value );\n\n if ( val == undefined || isNaN( val ) ) {\n return;\n }\n\n var tick = this.nextTick( level, function( tick ) {\n\n tick.setAttribute( 'y1', ( self.top ? 1 : -1 ) * self.tickPx1 * self.tickScaling[ level ] );\n tick.setAttribute( 'y2', ( self.top ? 1 : -1 ) * self.tickPx2 * self.tickScaling[ level ] );\n\n if ( level == 1 ) {\n tick.setAttribute( 'stroke', self.getPrimaryTicksColor() );\n } else {\n tick.setAttribute( 'stroke', self.getSecondaryTicksColor() );\n }\n\n } );\n\n // tick.setAttribute( 'shape-rendering', 'crispEdges' );\n tick.setAttribute( 'x1', val );\n tick.setAttribute( 'x2', val );\n\n this.nextGridLine( level == 1, val, val, 0, this.graph.getDrawingHeight() );\n\n // this.groupTicks.appendChild( tick );\n if ( level == 1 ) {\n var tickLabel = this.nextTickLabel( ( tickLabel ) => {\n\n tickLabel.setAttribute( 'y', ( self.top ? -1 : 1 ) * ( ( self.options.tickPosition == 1 ? 8 : 20 ) + ( self.top ? 10 : 0 ) ) + this.options.tickLabelOffset );\n tickLabel.setAttribute( 'text-anchor', 'middle' );\n if ( self.getTicksLabelColor() !== 'black' ) {\n tickLabel.setAttribute( 'fill', self.getTicksLabelColor() );\n }\n tickLabel.style.dominantBaseline = 'hanging';\n } );\n\n tickLabel.setAttribute( 'x', val );\n this.setTickContent( tickLabel, value, options );\n\n }\n // this.ticks.push( tick );\n\n return [ tick, tickLabel ];\n }\n\n drawLabel() {\n // Place label correctly\n\n if ( this.getLabelColor() !== 'black' ) {\n this.label.setAttribute( 'fill', this.getLabelColor() );\n }\n\n if ( this.options.labelFont ) {\n this.label.setAttribute( 'font-family', this.options.labelFont );\n }\n\n this.label.setAttribute( 'text-anchor', 'middle' );\n this.label.setAttribute( 'style', 'display: initial;' );\n this.label.setAttribute( 'x', Math.abs( this.getMaxPx() + this.getMinPx() ) / 2 );\n this.label.setAttribute( 'y', ( this.top ? -1 : 1 ) * ( ( this.options.tickPosition == 1 ? 10 : 25 ) + this.graph.options.fontSize ) );\n this.labelTspan.textContent = this.getLabel();\n\n }\n\n draw() {\n var tickWidth = super.draw( ...arguments );\n this.drawSpecifics();\n\n return tickWidth;\n }\n /**\n * Paints the label, the axis line and anything else specific to x axes\n */\n drawSpecifics() {\n\n // Adjusts group shift\n //this.group.setAttribute('transform', 'translate(0 ' + this.getShift() + ')');\n\n this.drawLabel();\n\n this.line.setAttribute( 'x1', this.getMinPx() );\n this.line.setAttribute( 'x2', this.getMaxPx() );\n this.line.setAttribute( 'y1', 0 );\n this.line.setAttribute( 'y2', 0 );\n\n this.line.setAttribute( 'stroke', this.getAxisColor() );\n\n if ( !this.top ) {\n\n this.labelTspan.style.dominantBaseline = 'hanging';\n this.expTspan.style.dominantBaseline = 'hanging';\n this.expTspanExp.style.dominantBaseline = 'hanging';\n\n this.unitTspan.style.dominantBaseline = 'hanging';\n // this.preunitTspan.style.dominantBaseline = 'hanging';\n\n }\n\n var span = this.getSpan();\n this.line.setAttribute( 'marker-start', ( !this.options.splitMarks || span[ 0 ] == 0 ? '' : 'url(#horionzalsplit_' + this.graph.getId() + ')' ) );\n this.line.setAttribute( 'marker-end', ( !this.options.splitMarks || span[ 1 ] == 1 ? '' : 'url(#horionzalsplit_' + this.graph.getId() + ')' ) );\n\n }\n\n /**\n * @private\n */\n _drawLine( pos, line ) {\n\n let px = this.getPx( pos );\n\n if ( !line ) {\n line = document.createElementNS( this.graph.ns, 'line' );\n } else {\n line.setAttribute( 'display', 'initial' );\n }\n\n line.setAttribute( 'x1', px );\n line.setAttribute( 'x2', px );\n\n line.setAttribute( 'y1', 0 );\n line.setAttribute( 'y2', this.graph.drawingSpaceHeight );\n\n line.setAttribute( 'stroke', 'black' );\n this.group.appendChild( line );\n\n return line;\n }\n\n _hideLine( line ) {\n if ( !line ) {\n return;\n }\n line.setAttribute( 'display', 'none' );\n }\n\n /**\n * @private\n */\n handleMouseMoveLocal( x ) { // handleMouseMoveLocal( x, y, e )\n x -= this.graph.getPaddingLeft();\n this.mouseVal = this.getVal( x );\n }\n\n /**\n * Caches the minimum px and maximum px position of the axis. Includes axis spans and flipping. Mostly used internally\n */\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n\n if ( isNaN( interval ) ) {\n return;\n }\n\n var maxPx = interval * this.options.span[ 1 ] + this.minPx - this.options.marginMax;\n var minPx = interval * this.options.span[ 0 ] + this.minPx + this.options.marginMin;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n\n }\n\n getZProj( zValue ) {\n return zValue * this.graph.options.zAxis.shiftX;\n }\n\n}\n\nexport default AxisX;","import Axis from './graph.axis.js';\n\n/**\n * Generic constructor of a y axis\n * @extends Axis\n */\nclass AxisY extends Axis {\n\n constructor( graph, leftright, options ) {\n\n super( graph, leftright, options );\n this.leftright = leftright;\n this.left = leftright == 'left';\n\n }\n\n /**\n * @private\n */\n setAxisPosition( shift ) {\n this.shiftPosition = shift;\n }\n\n getAxisPosition() {\n return this.shiftPosition || 0;\n }\n\n getAdditionalWidth() {\n let pos = 0;\n if ( this.getLabel() ) {\n pos += this.graph.options.fontSize;\n }\n\n if ( this.isShown() ) {\n pos += Math.abs( this.tickMargin );\n }\n return pos;\n }\n\n /**\n * @returns {Boolean} always ```false```\n */\n isX() {\n return false;\n }\n\n /**\n * @returns {Boolean} always ```true```\n */\n isY() {\n return true;\n }\n\n /**\n * @private\n */\n resetTicksLength() {\n this.longestTick = [ false, 0 ];\n }\n\n /**\n * @private\n */\n getMaxSizeTick() { // Gives an extra margin of 5px\n return ( this.longestTick && this.longestTick[ 0 ] ? this.longestTick[ 0 ].getComputedTextLength() + 5 : 0 ); //(this.left ? 10 : 0);\n }\n\n draw() {\n\n this.tickMargin = ( this.left ? -5 - this.tickPx1 * this.tickScaling[ 1 ] : 2 - this.tickPx1 * this.tickScaling[ 1 ] );\n var tickWidth = super.draw( ...arguments );\n tickWidth += this.getAdditionalWidth();\n this.drawSpecifics( tickWidth );\n\n this.fullwidthlabel = tickWidth;\n\n return tickWidth;\n }\n\n equalizePosition( width ) {\n\n this.placeLabel( this.left ? -width : width );\n\n if ( this.getLabel() ) {\n return width + this.graph.options.fontSize;\n }\n\n return 0;\n }\n\n /**\n * @private\n */\n drawTick( value, level, options, forcedPos ) {\n let pos,\n tick,\n tickLabel;\n\n pos = forcedPos || this.getPos( value );\n\n if ( pos == undefined || isNaN( pos ) ) {\n return;\n }\n\n tick = this.nextTick( level, ( tick ) => {\n\n tick.setAttribute( 'x1', ( this.left ? 1 : -1 ) * this.tickPx1 * this.tickScaling[ level ] );\n tick.setAttribute( 'x2', ( this.left ? 1 : -1 ) * this.tickPx2 * this.tickScaling[ level ] );\n\n if ( level == 1 ) {\n tick.setAttribute( 'stroke', this.getPrimaryTicksColor() );\n } else {\n tick.setAttribute( 'stroke', this.getSecondaryTicksColor() );\n }\n\n } );\n\n tick.setAttribute( 'y1', pos );\n tick.setAttribute( 'y2', pos );\n\n this.nextGridLine( level == 1, 0, this.graph.getDrawingWidth(), pos, pos );\n\n // this.groupTicks.appendChild( tick );\n if ( level == 1 ) {\n tickLabel = this.nextTickLabel( ( tickLabel ) => {\n\n tickLabel.setAttribute( 'x', this.tickMargin + this.options.tickLabelOffset );\n if ( this.getTicksLabelColor() !== 'black' ) {\n tickLabel.setAttribute( 'fill', this.getTicksLabelColor() );\n }\n\n if ( this.left ) {\n tickLabel.setAttribute( 'text-anchor', 'end' );\n } else {\n tickLabel.setAttribute( 'text-anchor', 'start' );\n }\n tickLabel.style.dominantBaseline = 'central';\n\n } );\n\n tickLabel.setAttribute( 'y', pos );\n this.setTickContent( tickLabel, value, options );\n\n if ( String( tickLabel.textContent ).length >= this.longestTick[ 1 ] ) {\n this.longestTick[ 0 ] = tickLabel;\n this.longestTick[ 1 ] = String( tickLabel.textContent ).length;\n\n }\n }\n }\n\n drawLabel() {\n\n if ( this.getLabelColor() !== 'black' ) {\n this.label.setAttribute( 'fill', this.getLabelColor() );\n }\n\n this.label.setAttribute( 'dominant-baseline', !this.left ? 'auto' : 'auto' );\n this.labelTspan.textContent = this.getLabel();\n }\n\n placeLabel( y ) {\n this.label.setAttribute( 'transform', 'translate(' + y + ', ' + ( Math.abs( this.getMaxPx() + this.getMinPx() ) / 2 ) + ') rotate(-90)' );\n }\n\n /**\n * @private\n */\n drawSpecifics() {\n // Place label correctly\n //this.label.setAttribute('x', (this.getMaxPx() - this.getMinPx()) / 2);\n /*\n if ( !this.left ) {\n\n this.labelTspan.style.dominantBaseline = 'hanging';\n this.expTspan.style.dominantBaseline = 'hanging';\n this.expTspanExp.style.dominantBaseline = 'hanging';\n\n this.unitTspan.style.dominantBaseline = 'hanging';\n this.preunitTspan.style.dominantBaseline = 'hanging';\n }\n*/\n this.line.setAttribute( 'y1', this.getMinPx() );\n this.line.setAttribute( 'y2', this.getMaxPx() );\n this.line.setAttribute( 'x1', 0 );\n this.line.setAttribute( 'x2', 0 );\n\n this.line.setAttribute( 'stroke', this.getAxisColor() );\n\n var span = this.getSpan();\n this.line.setAttribute( 'marker-start', ( !this.options.splitMarks || span[ 0 ] == 0 ? '' : 'url(#verticalsplit_' + this.graph.getId() + ')' ) );\n this.line.setAttribute( 'marker-end', ( !this.options.splitMarks || span[ 1 ] == 1 ? '' : 'url(#verticalsplit_' + this.graph.getId() + ')' ) );\n }\n\n /**\n * @private\n */\n setShift( shift ) {\n\n this.shift = shift;\n\n if ( !this.shift || !this.graph.getWidth() ) {\n return;\n }\n\n let xshift = this.shift;\n xshift = this.floating ? xshift : ( this.isLeft() ? xshift : this.graph.getWidth() - this.graph.getPaddingRight() - this.graph.getPaddingLeft() - xshift );\n this.group.setAttribute( 'transform', 'translate( ' + xshift + ' 0 )' );\n this.drawLabel();\n }\n\n /**\n * @private\n */\n isLeft() {\n return this.left;\n }\n\n /**\n * @private\n */\n isRight() {\n return !this.left;\n }\n\n /**\n * @private\n */\n isFlipped() {\n return !this.options.flipped;\n }\n\n /**\n * @private\n */\n _drawLine( pos, line ) {\n\n let px = this.getPx( pos );\n\n if ( !line ) {\n line = document.createElementNS( this.graph.ns, 'line' );\n } else {\n line.setAttribute( 'display', 'initial' );\n }\n\n line.setAttribute( 'y1', px );\n line.setAttribute( 'y2', px );\n\n line.setAttribute( 'x1', 0 );\n line.setAttribute( 'x2', this.graph.drawingSpaceWidth );\n\n line.setAttribute( 'stroke', 'black' );\n this.group.appendChild( line );\n\n return line;\n }\n\n _hideLine( line ) {\n if ( !line ) {\n return;\n }\n\n line.setAttribute( 'display', 'none' );\n }\n\n /**\n * @private\n */\n handleMouseMoveLocal( x, y ) {\n y -= this.graph.getPaddingTop();\n this.mouseVal = this.getVal( y );\n }\n\n /**\n * Scales the axis with respect to the series contained in an x axis\n * @param {Axis} [ axis = graph.getXAxis() ] - The X axis to use as a reference\n * @param {Serie} [ excludeSerie ] - A serie to exclude\n * @param {Number} [ start = xaxis.getCurrentMin() ] - The start of the boundary\n * @param {Number} [ end = xaxis.getCurrentMax() ] - The end of the boundary\n * @param {Boolean} [ min = true ] - Adapt the min\n * @param {Boolean} [ max = true ] - Adapt the max\n * @returns {Axis} The current axis\n */\n scaleToFitAxis( axis, excludeSerie, start, end, min, max ) {\n //console.log( axis instanceof GraphAxis );\n if ( !axis || !axis.isX() ) {\n axis = this.graph.getXAxis();\n }\n\n if ( isNaN( start ) ) {\n start = axis.getCurrentMin();\n }\n\n if ( isNaN( end ) ) {\n end = axis.getCurrentMax();\n }\n\n if ( min === undefined ) {\n min = true;\n }\n\n if ( max === undefined ) {\n max = true;\n }\n\n if ( typeof excludeSerie == 'number' ) {\n end = start;\n start = excludeSerie;\n excludeSerie = false;\n }\n\n var maxV = -Infinity,\n minV = Infinity,\n j = 0;\n\n for ( var i = 0, l = this.graph.series.length; i < l; i++ ) {\n\n if ( !this.graph.series[ i ].isShown() ) {\n continue;\n }\n\n if ( this.graph.series[ i ] == excludeSerie ) {\n continue;\n }\n\n if ( !( this.graph.series[ i ].getXAxis() == axis ) || ( this.graph.series[ i ].getYAxis() !== this ) ) {\n continue;\n }\n\n j++;\n\n maxV = max ? Math.max( maxV, this.graph.series[ i ].getMax( start, end ) ) : 0;\n minV = min ? Math.min( minV, this.graph.series[ i ].getMin( start, end ) ) : 0;\n }\n\n if ( j == 0 ) {\n\n this.setMinMaxToFitSeries(); // No point was found\n\n } else {\n\n // If we wanted originally to resize min and max. Otherwise we use the current value\n minV = min ? minV : this.getCurrentMin();\n maxV = max ? maxV : this.getCurrentMax();\n\n var interval = maxV - minV;\n\n minV -= ( this.options.axisDataSpacing.min * interval );\n maxV += ( this.options.axisDataSpacing.max * interval );\n\n this._doZoomVal( minV, maxV );\n }\n\n return this;\n }\n\n /**\n * Caches the minimum px and maximum px position of the axis. Includes axis spans and flipping. Mostly used internally\n * @return {Axis} The current axis instance\n */\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n\n if ( isNaN( interval ) ) {\n return;\n }\n\n var maxPx = this.maxPx - interval * this.options.span[ 0 ] - this.options.marginMin;\n var minPx = this.maxPx - interval * this.options.span[ 1 ] + this.options.marginMax;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n\n }\n\n getZProj( zValue ) {\n return zValue * this.graph.options.zAxis.shiftY;\n }\n\n}\n\nexport default AxisY;","import AxisX from './graph.axis.x.js';\n\n/**\n * Generic constructor of a y axis\n * @class AxisXBar\n * @augments Axis\n */\nclass AxisXBar extends AxisX {\n\n constructor( graph, topbottom, options = {} ) {\n super( graph, topbottom, options );\n }\n\n /**\n * @param {Object[]} categories - Categories array\n * @param {(String|Number)} categories[].title - The title of the category (to be dispalyed)\n * @param {(String|Number)} categories[].name - The name of the category (to indentify series)\n * @returns {AxisBar} The current axis instance\n */\n set categories( categories ) {\n this._barCategories = categories;\n return this;\n }\n\n draw() {\n\n var self = this,\n tickLabel,\n elements = this._barCategories;\n\n this.forceMin( 0 );\n this.forceMax( 1 );\n\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n\n if ( !elements ) {\n return;\n }\n\n if ( !Array.isArray( elements ) ) {\n elements = [ elements ];\n }\n\n // this.drawInit();\n\n //var widthPerElement = width / elements.length;\n for ( var i = 0; i <= elements.length; i++ ) {\n this.drawTick( i / elements.length, 2 );\n\n if ( i < elements.length ) {\n tickLabel = this.nextTickLabel( function( tickLabel ) {\n\n tickLabel.setAttribute( 'y', ( self.top ? -1 : 1 ) * ( ( self.options.tickPosition == 1 ? 8 : 20 ) + ( self.top ? 10 : 0 ) ) );\n tickLabel.setAttribute( 'text-anchor', 'middle' );\n if ( self.getTicksLabelColor() !== 'black' ) {\n tickLabel.setAttribute( 'fill', self.getTicksLabelColor() );\n }\n tickLabel.style.dominantBaseline = 'hanging';\n\n } );\n\n tickLabel.setAttribute( 'x', this.getPos( ( i + 0.5 ) / elements.length ) );\n tickLabel.textContent = elements[ i ].title;\n }\n\n }\n\n this.drawSpecifics();\n return this;\n }\n\n /**\n * Sets the series automatically\n * @returns {AxisBar} The current axis instance\n */\n autoSeries() {\n\n let series = [];\n for ( let serie of this.graph.series ) {\n if ( serie.getXAxis() == this ) {\n series.push( serie );\n }\n }\n\n this.setSeries( ...series );\n return this;\n }\n\n /**\n * Sets the series that should belong to the axis\n * @param {...(Series|Number|String)} series - List of series identified either by their instance, or their index (string or number)\n * @returns {AxisBar} The current axis instance\n */\n setSeries() {\n\n var self = this;\n this.series = arguments;\n\n Array.prototype.map.call( this.series, function( serie, index ) {\n\n if ( !( typeof serie == 'object' ) ) {\n serie = self.graph.getSerie( serie );\n }\n\n if ( serie.setCategoryConfig ) {\n serie.setCategoryConfig( index, self._barCategories, self.series.length );\n }\n } );\n\n this._getUsedCategories();\n\n return this;\n }\n\n _getUsedCategories() {\n\n let categories = {},\n total = 0;\n\n Array.prototype.map.call( this.series, ( serie ) => {\n let usedCategories = serie.getUsedCategories();\n for ( let cat of usedCategories ) {\n\n if ( !categories.hasOwnProperty( cat ) ) {\n categories[ cat ] = 1;\n total += 1;\n }\n\n categories[ cat ]++;\n total++;\n }\n } );\n\n let accumulator = 0;\n for ( let i in categories ) {\n let temp = categories[ i ];\n categories[ i ] = accumulator;\n accumulator += temp;\n }\n\n let dispatchedCategories = {};\n\n Array.prototype.map.call( this.series, ( serie ) => {\n\n let scategories = serie.getUsedCategories(),\n indices = {};\n\n scategories.forEach( ( cat ) => {\n\n dispatchedCategories[ cat ] = dispatchedCategories[ cat ] || 0.5;\n indices[ cat ] = ( categories[ cat ] + dispatchedCategories[ cat ] ) / total;\n dispatchedCategories[ cat ]++;\n } );\n\n serie.setDataIndices( indices, total );\n\n } );\n\n }\n\n getType() {\n return 'category';\n }\n}\n\nexport default AxisXBar;","import Axis from './graph.axis.js';\nimport * as util from './graph.util.js';\n\nvar axisFormat = [\n\n {\n\n threshold: 20,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 seconds\n increment: 1,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n },\n\n {\n\n threshold: 50,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 2 seconds\n increment: 2,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n },\n\n {\n\n threshold: 100,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 5 seconds\n increment: 5,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n },\n\n {\n\n threshold: 600,\n increments: {\n\n 1: {\n increment: 10, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 seconds\n increment: 30,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n },\n\n { // One day\n\n threshold: 1000,\n increments: {\n\n 1: { // 1h\n increment: 1,\n unit: 'h',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 minutes\n increment: 10,\n unit: 'i',\n format: 'MM\"min\"'\n }\n }\n },\n\n { // One day\n\n threshold: 1500,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 1,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 3000,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 2,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 8000,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 10,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 26400,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 20,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 86400,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 1,\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 200000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 2, // One day on the first axis\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 6, // One day on the first axis\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 1400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 12, // One day on the first axis\n unit: 'h',\n format: 'HH\"h\"MM'\n }\n }\n },\n\n { // One day\n\n threshold: 6400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n },\n\n { // One day\n\n threshold: 12400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 2, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n },\n\n { // One day\n\n threshold: 86400000 * 0.5,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 7, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n },\n\n { // One day\n\n threshold: 86400000 * 0.8,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 15, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n },\n\n { // One month\n\n threshold: 86400000 * 1,\n increments: {\n\n 1: {\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 3, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n },\n\n { // One month\n\n threshold: 86400000 * 2,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 4, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n },\n\n { // One month\n\n threshold: 86400000 * 10,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 6, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n },\n\n { // One month\n\n threshold: 86400000 * 12,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 1, // One day on the first axis\n unit: 'y',\n format: 'yyyy'\n }\n }\n },\n\n];\n\n/*\n * Date Format 1.2.3\n * (c) 2007-2009 Steven Levithan \n * MIT license\n *\n * Includes enhancements by Scott Trenda \n * and Kris Kowal \n *\n * Accepts a date, a mask, or a date and a mask.\n * Returns a formatted version of the given date.\n * The date defaults to the current date/time.\n * The mask defaults to dateFormat.masks.default.\n */\n\nvar dateFormat = ( function() {\n var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\\1?|[WLloSZ]|\"[^\"]*\"|'[^']*'/g,\n timezone = /\\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\\d{4})?)\\b/g,\n timezoneClip = /[^-+\\dA-Z]/g,\n pad = function( val, len ) {\n val = String( val );\n len = len || 2;\n while ( val.length < len ) val = '0' + val;\n return val;\n },\n getWeek = function( d, f ) {\n var onejan = new Date( d[ f + 'FullYear' ](), 0, 1 );\n return Math.ceil( ( ( ( d - onejan ) / 86400000 ) + onejan[ f + 'Day' ]() + 1 ) / 7 );\n };\n\n // Regexes and supporting functions are cached through closure\n return function( date, mask, utc ) {\n var dF = dateFormat;\n\n // You can't provide utc if you skip other args (use the \"UTC:\" mask prefix)\n if ( arguments.length == 1 && Object.prototype.toString.call( date ) == '[object String]' && !/\\d/.test( date ) ) {\n mask = date;\n date = undefined;\n }\n\n // Passing date through Date applies Date.parse, if necessary\n date = date ? new Date( date ) : new Date();\n if ( isNaN( date ) ) throw SyntaxError( 'invalid date:' + date );\n\n mask = String( dF.masks[ mask ] || mask || dF.masks.default );\n\n // Allow setting the utc argument via the mask\n if ( mask.slice( 0, 4 ) == 'UTC:' ) {\n mask = mask.slice( 4 );\n utc = true;\n }\n\n var _ = utc ? 'getUTC' : 'get',\n d = date[ _ + 'Date' ](),\n D = date[ _ + 'Day' ](),\n m = date[ _ + 'Month' ](),\n y = date[ _ + 'FullYear' ](),\n H = date[ _ + 'Hours' ](),\n M = date[ _ + 'Minutes' ](),\n s = date[ _ + 'Seconds' ](),\n L = date[ _ + 'Milliseconds' ](),\n o = utc ? 0 : date.getTimezoneOffset(),\n flags = {\n d: d,\n dd: pad( d ),\n ddd: dF.i18n.dayNames[ D ],\n dddd: dF.i18n.dayNames[ D + 7 ],\n m: m + 1,\n mm: pad( m + 1 ),\n mmm: dF.i18n.monthNames[ m ],\n mmmm: dF.i18n.monthNames[ m + 12 ],\n yy: String( y ).slice( 2 ),\n yyyy: y,\n h: H % 12 || 12,\n hh: pad( H % 12 || 12 ),\n H: H,\n HH: pad( H ),\n M: M,\n MM: pad( M ),\n s: s,\n ss: pad( s ),\n l: pad( L, 3 ),\n L: pad( L > 99 ? Math.round( L / 10 ) : L ),\n t: H < 12 ? 'a' : 'p',\n tt: H < 12 ? 'am' : 'pm',\n T: H < 12 ? 'A' : 'P',\n TT: H < 12 ? 'AM' : 'PM',\n Z: utc ? 'UTC' : ( String( date ).match( timezone ) || [ '' ] ).pop().replace( timezoneClip, '' ),\n o: ( o > 0 ? '-' : '+' ) + pad( Math.floor( Math.abs( o ) / 60 ) * 100 + Math.abs( o ) % 60, 4 ),\n S: [ 'th', 'st', 'nd', 'rd' ][ d % 10 > 3 ? 0 : ( d % 100 - d % 10 != 10 ) * d % 10 ],\n W: getWeek( date, _ ),\n };\n\n return mask.replace( token, function( $0 ) {\n return $0 in flags ? flags[ $0 ] : $0.slice( 1, $0.length - 1 );\n } );\n };\n} )();\n\n// Some common format strings\ndateFormat.masks = {\n 'default': 'ddd mmm dd yyyy HH:MM:ss',\n shortDate: 'm/d/yy',\n mediumDate: 'mmm d, yyyy',\n longDate: 'mmmm d, yyyy',\n fullDate: 'dddd, mmmm d, yyyy',\n shortTime: 'h:MM TT',\n mediumTime: 'h:MM:ss TT',\n longTime: 'h:MM:ss TT Z',\n isoDate: 'yyyy-mm-dd',\n isoTime: 'HH:MM:ss',\n isoDateTime: \"yyyy-mm-dd'T'HH:MM:ss\",\n isoUtcDateTime: \"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'\"\n};\n\n// Internationalization strings\ndateFormat.i18n = {\n dayNames: [\n 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',\n 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'\n ],\n monthNames: [\n 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',\n 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'\n ]\n};\n\n/* END DATE FORMAT */\n\nfunction getClosestIncrement( value, basis ) {\n return Math.round( value / basis ) * basis;\n}\n\nfunction roundDate( date, format ) {\n\n switch ( format.unit ) {\n\n case 's': // Round at n hour\n\n date.setSeconds( getClosestIncrement( date.getSeconds(), format.increment ) );\n date.setMilliseconds( 0 );\n\n break;\n\n case 'i': // Round at n hour\n\n date.setMinutes( getClosestIncrement( date.getMinutes(), format.increment ) );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n\n break;\n\n case 'h': // Round at n hour\n\n date.setHours( getClosestIncrement( date.getHours(), format.increment ) );\n\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n\n break;\n\n case 'd':\n\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n date.setHours( 0 );\n\n date.setDate( getClosestIncrement( date.getDate(), format.increment ) );\n\n break;\n\n case 'm':\n\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n date.setHours( 0 );\n date.setDate( 1 );\n\n date.setMonth( getClosestIncrement( date.getMonth(), format.increment ) );\n\n break;\n\n case 'y':\n\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n date.setHours( 0 );\n date.setDate( 1 );\n date.setMonth( 0 );\n\n //date.setYear( getClosest( date.getDate(), format.increment ) );\n\n break;\n\n default:\n {\n throw new Error( 'Date format not recognized' );\n }\n }\n\n return date;\n}\n\nfunction incrementDate( date, format ) {\n\n switch ( format.unit ) {\n\n case 's':\n\n date.setSeconds( date.getSeconds() + format.increment );\n date.setMilliseconds( 0 );\n\n break;\n\n case 'i':\n\n date.setMinutes( date.getMinutes() + format.increment );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n\n break;\n\n case 'h': // Round at n hour\n\n date.setHours( date.getHours() + format.increment );\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n\n break;\n\n case 'd':\n\n date.setDate( date.getDate() + format.increment );\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n date.setHours( 0 );\n\n break;\n\n case 'm':\n\n date.setMonth( date.getMonth() + format.increment );\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n date.setHours( 0 );\n date.setDate( 1 );\n\n break;\n\n case 'y':\n\n date.setFullYear( date.getFullYear() + format.increment );\n\n date.setMinutes( 0 );\n date.setSeconds( 0 );\n date.setMilliseconds( 0 );\n date.setHours( 0 );\n date.setDate( 1 );\n date.setMonth( 0 );\n\n break;\n\n default:\n {\n throw new Error( 'Date format not recognized' );\n }\n }\n\n return date;\n}\n\nfunction getGroup( axis, level, number ) {\n\n if ( axis.groups[ level ][ number ] ) {\n axis.groups[ level ][ number ].group.setAttribute( 'display', 'block' );\n return axis.groups[ level ][ number ];\n }\n\n var g = {\n\n group: document.createElementNS( axis.graph.ns, 'g' ),\n text: document.createElementNS( axis.graph.ns, 'text' )\n };\n\n var line = document.createElementNS( axis.graph.ns, 'line' );\n\n line.setAttribute( 'stroke', 'black' );\n line.setAttribute( 'y1', 0 );\n switch ( level ) {\n\n case 2:\n\n line.setAttribute( 'y2', 6 );\n g.text.setAttribute( 'y', 15 );\n\n g.line = line;\n\n g.group.appendChild( g.line );\n break;\n\n default:\n case 1:\n\n line.setAttribute( 'y2', 20 );\n g.text.setAttribute( 'y', 10 );\n\n g.line1 = line;\n g.line2 = line.cloneNode();\n\n g.group.appendChild( g.line1 );\n g.group.appendChild( g.line2 );\n\n break;\n }\n\n g.text.setAttribute( 'text-anchor', 'middle' );\n g.text.setAttribute( 'dominant-baseline', 'middle' );\n\n g.group.appendChild( g.text );\n\n axis.getWrapper( level ).appendChild( g.group );\n\n return axis.groups[ level ][ number ] = g;\n}\n\nfunction hideGroups( axis, level, from ) {\n\n for ( ; from < axis.groups[ level ].length; from++ ) {\n\n hideGroup( axis.groups[ level ][ from ] );\n }\n}\n\nfunction hideGroup( group ) {\n group.group.setAttribute( 'display', 'none' );\n}\n\nfunction getDateText( date, format ) {\n\n return dateFormat( date, format );\n}\n\nfunction renderGroup( level, group, text, minPx, maxPx, x1, x2 ) {\n\n switch ( level ) {\n\n case 2:\n\n if ( x1 < minPx || x1 > maxPx ) {\n\n hideGroup( group );\n return;\n }\n\n group.line.setAttribute( 'x1', x1 );\n group.line.setAttribute( 'x2', x1 );\n group.text.setAttribute( 'x', x1 );\n group.text.textContent = text;\n\n break;\n\n default:\n case 1:\n\n var x1B = Math.max( minPx, Math.min( maxPx, x1 ) ),\n x2B = Math.max( minPx, Math.min( maxPx, x2 ) );\n\n if ( isNaN( x2B ) || isNaN( x1B ) ) {\n return;\n }\n\n group.line1.setAttribute( 'x1', x1B );\n group.line2.setAttribute( 'x1', x2B );\n\n group.line1.setAttribute( 'x2', x1B );\n group.line2.setAttribute( 'x2', x2B );\n\n group.text.setAttribute( 'x', ( x1B + x2B ) / 2 );\n\n while ( text.length * 8 > x2B - x1B ) {\n\n text = text.substr( 0, text.length - 2 ) + '.';\n\n if ( text.length == 1 ) {\n text = '';\n break;\n }\n }\n\n group.text.textContent = text;\n break;\n }\n}\n\nclass GraphTimeAxis extends Axis {\n\n constructor() {\n\n super( ...arguments );\n }\n\n init( graph, options ) {\n\n super.init( graph, options );\n\n this.wrapper = {\n 1: document.createElementNS( graph.ns, 'g' ),\n 2: document.createElementNS( graph.ns, 'g' )\n };\n this.groups = {\n 1: [],\n 2: []\n };\n\n var rect = document.createElementNS( graph.ns, 'rect' );\n rect.setAttribute( 'fill', '#c0c0c0' );\n rect.setAttribute( 'stroke', '#808080' );\n rect.setAttribute( 'height', '20' );\n rect.setAttribute( 'x', '0' );\n rect.setAttribute( 'y', '0' );\n\n this.rect = rect;\n\n this.wrapper[ 1 ].appendChild( this.rect );\n\n // this.init( graph, options );\n\n this.group.appendChild( this.wrapper[ 1 ] );\n this.group.appendChild( this.wrapper[ 2 ] );\n\n this.wrapper[ 1 ].setAttribute( 'transform', 'translate( 0, 25 )' );\n this.wrapper[ 2 ].setAttribute( 'transform', 'translate( 0, 00 )' );\n }\n\n draw() { // Redrawing of the axis\n\n //this.drawInit();\n\n this.cacheCurrentMax();\n this.cacheCurrentMin();\n\n if ( this.currentAxisMin == undefined || this.currentAxisMax == undefined ) {\n this.setMinMaxToFitSeries( true ); // We reset the min max as a function of the series\n\n }\n\n this.line.setAttribute( 'x1', this.getMinPx() );\n this.line.setAttribute( 'x2', this.getMaxPx() );\n this.line.setAttribute( 'y1', 0 );\n this.line.setAttribute( 'y2', 0 );\n\n var widthPx = this.maxPx - this.minPx;\n var widthTime = this.getCurrentInterval();\n\n var timePerPx = widthTime / widthPx;\n\n var maxVal = this.getCurrentMax();\n var minVal = this.getCurrentMin();\n\n this.rect.setAttribute( 'width', widthPx );\n this.rect.setAttribute( 'x', this.minPx );\n\n if ( !maxVal || !minVal ) {\n return 0;\n }\n\n var currentFormat;\n\n for ( i = 0; i < axisFormat.length; i++ ) {\n\n if ( axisFormat[ i ].threshold > timePerPx ) {\n currentFormat = axisFormat[ i ];\n\n break;\n }\n\n }\n\n if ( !currentFormat ) {\n currentFormat = axisFormat[ axisFormat.length - 1 ];\n }\n\n var xVal1,\n xVal2,\n level = 0,\n dateFirst,\n currentDate,\n text,\n group,\n i;\n\n for ( level = 1; level <= 2; level++ ) {\n\n if ( !util.isNumeric( minVal ) ) {\n hideGroups( this, level, 0 );\n break;\n }\n\n dateFirst = new Date( minVal );\n\n currentDate = roundDate( dateFirst, currentFormat.increments[ level ] );\n\n i = 0;\n\n do {\n /** @ignore */\n text = getDateText( currentDate, currentFormat.increments[ level ].format );\n group = getGroup( this, level, i );\n\n xVal1 = this.getPx( currentDate.getTime() );\n currentDate = incrementDate( currentDate, currentFormat.increments[ level ] );\n xVal2 = this.getPx( currentDate.getTime() );\n\n renderGroup( level, group, text, this.getMinPx(), this.getMaxPx(), xVal1, xVal2 );\n\n i++;\n if ( i > 100 ) {\n break;\n }\n } while ( currentDate.getTime() < maxVal );\n\n hideGroups( this, level, i );\n }\n\n }\n\n isX() {\n return true;\n }\n\n getWrapper( level ) {\n return this.wrapper[ level ];\n }\n\n setShift( shift ) {\n this.shift = shift;\n this.group.setAttribute( 'transform', 'translate(0 ' + ( this.top ? this.shift : ( this.graph.getDrawingHeight() - this.shift ) ) + ')' );\n }\n\n getAxisPosition() {\n return 60;\n }\n\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n var maxPx = interval * this.options.span[ 1 ] + this.minPx;\n var minPx = interval * this.options.span[ 0 ] + this.minPx;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n }\n\n}\n\nexport default GraphTimeAxis;","import EventEmitter from '../dependencies/eventEmitter/EventEmitter.js';\nimport * as util from '../graph.util.js';\n\nimport Waveform from '../util/waveform.js';\n\n/**\n * Serie class to be extended\n * @static\n */\nclass Serie extends EventEmitter {\n\n static\n default () {\n\n return {\n redrawShapesAfterDraw: false\n };\n }\n\n constructor( graph, name, options ) {\n\n super( ...arguments );\n this.graph = graph;\n this.name = name;\n this.options = Object.assign( {}, Serie.default(), this.constructor.default(), options );\n\n //if( new.target.default ) {\n //console.log( new.target.default() );\n //}\n\n }\n\n draw() {}\n\n beforeDraw() {}\n\n afterDraw() {\n\n if ( this.options.redrawShapesAfterDraw ) {\n this.graph.getShapesOfSerie( this ).forEach( ( shape ) => {\n shape.redraw();\n } );\n }\n\n this.emit( 'draw' );\n }\n\n /**\n * Sets data to the serie\n * @memberof Serie\n * @param {(Object|Array|Array[])} data - The data of the serie\n * @param {Boolean} [ oneDimensional=false ] - In some cases you may need to force the 1D type. This is required when one uses an array or array to define the data (see examples)\n * @param{String} [ type=float ] - Specify the type of the data. Use int to save memory (half the amount of bytes allocated to the data).\n * @example serie.setData( [ [ x1, y1 ], [ x2, y2 ], ... ] );\n * @example serie.setData( [ x1, y1, x2, y2, ... ] ); // Faster\n * @example serie.setData( [ [ x1, y1, x2, y2, ..., xn, yn ] , [ xm, ym, x(m + 1), y(m + 1), ...] ], true ) // 1D array with a gap in the middle\n * @example serie.setData( { x: x0, dx: spacing, y: [ y1, y2, y3, y4 ] } ); // Data with equal x separation. Fastest way\n */\n setData( data, oneDimensional, type ) {\n\n if ( data instanceof Waveform ) {\n return this.setWaveform( data );\n }\n\n throw 'Setting data other than waveforms in not supported by default. You must implemented this method in the inherited class.';\n }\n\n _addData( type, howmany ) {\n return [];\n }\n\n /**\n * Removes all the data from the serie, without redrawing\n * @returns {Serie} The current serie\n */\n clearData() {\n this.setData( new Waveform() );\n return this;\n }\n\n /**\n * Returns the data in its current form\n * @returns {Array.<(Float64Array|Int32Array)>} An array containing the data chunks. Has only one member if the data has no gaps\n * @memberof Serie\n */\n getData() {\n return this.data;\n }\n\n /**\n * Sets the options of the serie (no extension of default options)\n * @param {Object} options - The options of the serie\n * @memberof Serie\n */\n setOptions( options ) {\n this.options = options || {};\n }\n\n /**\n * Sets the options of the serie (no extension of default options)\n * @param {String} name - The option name\n * @param value - The option value\n * @memberof Serie\n * @example serie.setOption('selectableOnClick', true );\n */\n setOption( name, value ) {\n this.options[ name ] = value;\n }\n\n /**\n * Removes the serie from the graph. The method doesn't perform any axis autoscaling or repaint of the graph. This should be done manually.\n * @return {Serie} The current serie instance\n * @memberof Serie\n */\n kill( noLegendUpdate ) {\n\n this.graph.removeSerieFromDom( this );\n this.graph._removeSerie( this );\n\n if ( this.graph.legend && !noLegendUpdate ) {\n\n this.graph.legend.update();\n }\n\n this.graph = undefined;\n return this;\n }\n\n /**\n * Hides the serie\n * @memberof Serie\n * @param {Boolean} [ hideShapes = false ] - true to hide the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n hide( hideShapes, mute = false ) {\n\n this.hidden = true;\n this.groupMain.setAttribute( 'display', 'none' );\n\n this.getSymbolForLegend().setAttribute( 'opacity', 0.5 );\n this.getTextForLegend().setAttribute( 'opacity', 0.5 );\n\n this.hideImpl();\n\n if ( hideShapes ) {\n var shapes = this.graph.getShapesOfSerie( this );\n for ( var i = 0, l = shapes.length; i < l; i++ ) {\n shapes[ i ].hide();\n }\n }\n\n if ( !mute ) {\n this.emit( 'hide' );\n }\n\n if ( this.getXAxis().doesHideWhenNoSeriesShown() || this.getYAxis().doesHideWhenNoSeriesShown() ) {\n this.graph.draw( true );\n }\n\n return this;\n }\n\n /**\n * Shows the serie\n * @memberof Serie\n * @param {Boolean} [showShapes=false] - true to show the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n show( showShapes, mute = false ) {\n\n this.hidden = false;\n this.groupMain.setAttribute( 'display', 'block' );\n\n this.getSymbolForLegend().setAttribute( 'opacity', 1 );\n this.getTextForLegend().setAttribute( 'opacity', 1 );\n\n this.showImpl();\n\n this.draw( true );\n\n if ( showShapes ) {\n var shapes = this.graph.getShapesOfSerie( this );\n for ( var i = 0, l = shapes.length; i < l; i++ ) {\n shapes[ i ].show();\n }\n }\n\n if ( !mute ) {\n this.emit( 'show' );\n }\n\n if ( this.getXAxis().doesHideWhenNoSeriesShown() || this.getYAxis().doesHideWhenNoSeriesShown() ) {\n this.graph.draw( true );\n }\n return this;\n }\n\n hideImpl() {}\n showImpl() {}\n\n /**\n * Toggles the display of the serie (effectively, calls .show() and .hide() alternatively on each call)\n * @memberof Serie\n * @param {Boolean} [hideShapes=false] - true to hide the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n toggleDisplay() {\n\n if ( !this.isShown() ) {\n this.show();\n } else {\n this.hide();\n }\n\n return this;\n }\n\n /**\n * Determines if the serie is currently visible\n * @memberof Serie\n * @returns {Boolean} The current visibility status of the serie\n */\n isShown() {\n return !this.hidden;\n }\n\n /**\n * Checks that axes assigned to the serie have been defined and have proper values\n * @memberof Serie\n */\n axisCheck() {\n\n if ( !this.getXAxis() || !this.getYAxis() ) {\n throw 'No axis exist for this serie. Check that they were properly assigned';\n }\n\n if (\n isNaN( this.getXAxis().getCurrentMin() ) ||\n isNaN( this.getXAxis().getCurrentMax() ) ||\n isNaN( this.getYAxis().getCurrentMin() ) ||\n isNaN( this.getYAxis().getCurrentMax() )\n ) {\n throw 'Axis min and max values are not defined. Try autoscaling';\n }\n }\n /**\n * Returns the x position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The x position in px corresponding to the x value\n */\n getX( val ) {\n return ( val = this.getXAxis().getPx( val ) ) - val % 0.2;\n }\n\n /**\n * Returns the y position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The y position in px corresponding to the y value\n */\n getY( val ) {\n return ( val = this.getYAxis().getPx( val ) ) - val % 0.2;\n }\n\n /**\n * Returns the selection state of the serie. Generic for most serie types\n * @memberof Serie\n * @returns {Boolean} true if the serie is selected, false otherwise\n */\n isSelected() {\n return this.selected || ( this.selectionType !== 'unselected' );\n }\n\n _checkX( val ) {\n this.minX = Math.min( this.minX, val );\n this.maxX = Math.max( this.maxX, val );\n }\n\n _checkY( val ) {\n this.minY = Math.min( this.minY, val );\n this.maxY = Math.max( this.maxY, val );\n }\n\n /**\n * Getter for the serie name\n * @memberof Serie\n * @returns {String} The serie name\n */\n getName() {\n return this.name;\n }\n\n /* AXIS */\n\n /**\n * Assigns axes automatically, based on {@link Graph#getXAxis} and {@link Graph#getYAxis}.\n * @memberof Serie\n * @returns {Serie} The current serie\n */\n autoAxis() {\n\n if ( this.isFlipped() ) {\n\n this.setXAxis( this.graph.getYAxis() );\n this.setYAxis( this.graph.getXAxis() );\n\n } else {\n\n this.setXAxis( this.graph.getXAxis() );\n this.setYAxis( this.graph.getYAxis() );\n }\n\n // After axes have been assigned, the graph axes should update their min/max\n this.graph.updateDataMinMaxAxes();\n return this;\n }\n\n autoAxes() {\n return this.autoAxis( ...arguments );\n }\n\n /**\n * Assigns an x axis to the serie\n * @memberof Serie\n * @param {Axis|Number} axis - The axis to use as an x axis. If an integer, {@link Graph#getXAxis} or {@link Graph#getYAxis} will be used\n * @returns {Serie} The current serie\n * @example serie.setXAxis( graph.getTopAxis( 1 ) ); // Assigns the second top axis to the serie\n */\n setXAxis( axis ) {\n\n if ( typeof axis == 'number' ) {\n this.xaxis = this.isFlipped() ? this.graph.getYAxis( axis ) : this.graph.getXAxis( axis );\n } else {\n this.xaxis = axis;\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Assigns an y axis to the serie\n * @memberof Serie\n * @param {Axis|Number} axis - The axis to use as an y axis. If an integer, {@link Graph#getXAxis} or {@link Graph#getYAxis} will be used\n * @returns {Serie} The current serie\n * @example serie.setYAxis( graph.getLeftAxis( 4 ) ); // Assigns the 5th left axis to the serie\n */\n setYAxis( axis ) {\n if ( typeof axis == 'number' ) {\n this.xaxis = this.isFlipped() ? this.graph.getXAxis( axis ) : this.graph.getYAxis( axis );\n } else {\n this.yaxis = axis;\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Assigns two axes to the serie\n * @param {GraphAxis} axis1 - First axis to assign to the serie (x or y)\n * @param {GraphAxis} axis2 - Second axis to assign to the serie (y or x)\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setAxes() {\n\n for ( var i = 0; i < 2; i++ ) {\n\n if ( arguments[ i ] ) {\n this[ ( arguments[ i ].isX() ? 'setXAxis' : 'setYAxis' ) ]( arguments[ i ] );\n }\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * @returns {GraphAxis} The x axis assigned to the serie\n * @memberof Serie\n */\n getXAxis() {\n return this.xaxis;\n }\n\n /**\n * @returns {GraphAxis} The y axis assigned to the serie\n * @memberof Serie\n */\n getYAxis() {\n return this.yaxis;\n }\n\n /* */\n\n /* DATA MIN MAX */\n\n /**\n * @returns {Number} Lowest x value of the serie's data\n * @memberof Serie\n */\n getMinX() {\n return this.minX;\n }\n\n /**\n * @returns {Number} Highest x value of the serie's data\n * @memberof Serie\n */\n getMaxX() {\n return this.maxX;\n }\n\n /**\n * @returns {Number} Lowest y value of the serie's data\n * @memberof Serie\n */\n getMinY() {\n return this.minY;\n }\n\n /**\n * @returns {Number} Highest y value of the serie's data\n * @memberof Serie\n */\n getMaxY() {\n return this.maxY;\n }\n\n getWaveform() {\n return this.waveform;\n }\n\n getWaveforms() {\n return [ this.waveform ];\n }\n\n setWaveform( waveform ) {\n\n if ( !( waveform instanceof Waveform ) ) {\n console.trace();\n console.error( waveform );\n throw new Error( 'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance' );\n }\n\n this.waveform = waveform;\n\n this.minX = this.waveform.getXMin();\n this.maxX = this.waveform.getXMax();\n this.minY = this.waveform.getMin();\n this.maxY = this.waveform.getMax();\n\n this.graph.updateDataMinMaxAxes();\n this.dataHasChanged();\n\n return this;\n }\n\n /**\n * Computes and returns a line SVG element with the same line style as the serie, or width 20px\n * @returns {SVGElement}\n * @memberof Serie\n */\n getSymbolForLegend() {\n\n if ( !this.lineForLegend ) {\n\n var line = document.createElementNS( this.graph.ns, 'line' );\n this.applyLineStyle( line );\n\n line.setAttribute( 'x1', 5 );\n line.setAttribute( 'x2', 25 );\n line.setAttribute( 'y1', 0 );\n line.setAttribute( 'y2', 0 );\n\n line.setAttribute( 'cursor', 'pointer' );\n\n this.lineForLegend = line;\n }\n\n return this.lineForLegend;\n\n }\n\n /**\n * Explicitely applies the line style to the SVG element returned by {@link Serie#getSymbolForLegend}\n * @see Serie#getSymbolForLegend\n * @returns {SVGElement}\n * @memberof Serie\n */\n setLegendSymbolStyle() {\n this.applyLineStyle( this.getSymbolForLegend() );\n }\n\n /**\n * @alias Serie#setLegendSymbolStyle\n * @memberof Serie\n */\n updateStyle() {\n this.setLegendSymbolStyle();\n this.graph.updateLegend();\n }\n\n /**\n * Computes and returns a text SVG element with the label of the serie as a text, translated by 35px\n * @returns {SVGElement}\n * @memberof Serie\n * @see Serie#getLabel\n */\n getTextForLegend() {\n\n if ( !this.textForLegend ) {\n\n var text = document.createElementNS( this.graph.ns, 'text' );\n text.setAttribute( 'cursor', 'pointer' );\n text.textContent = this.getLabel();\n\n this.textForLegend = text;\n }\n\n return this.textForLegend;\n }\n\n /**\n * @returns {Number} The current index of the serie\n * @memberof Serie\n */\n getIndex() {\n return this.graph.series.indexOf( this );\n }\n\n /**\n * @returns {String} The label or, alternatively - the name of the serie\n * @memberof Serie\n */\n getLabel() {\n return this.options.label || this.name;\n }\n\n /**\n * Sets the label of the serie. Note that this does not automatically updates the legend\n * @param {String} label - The new label of the serie\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setLabel( label ) {\n this.options.label = label;\n\n if ( this.textForLegend ) {\n this.textForLegend.textContent = label;\n }\n\n this.graph.requireLegendUpdate();\n return this;\n }\n\n /* FLIP */\n\n /**\n * Assigns the flipping value of the serie. A flipped serie will have inverted axes. However this method does not automatically re-assigns the axes of the serie. Call {@link Serie#autoAxis} to re-assign the axes automatically, or any other axis setting method.\n * @param {Boolean} [flipped=false] - true to flip the serie\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setFlip( flipped ) {\n this.options.flip = flipped;\n return this;\n }\n\n /**\n * @returns {Boolean} true if the serie is flipped, false otherwise\n * @memberof Serie\n */\n getFlip() {\n return this.options.flip;\n }\n\n /**\n * @alias Serie#getFlip\n * @memberof Serie\n */\n isFlipped() {\n return this.options.flip;\n }\n\n /**\n * Sets the layer onto which the serie should be displayed. This method does not trigger a graph redraw.\n * @memberof Serie\n * @param {Number} layerIndex=1 - The index of the layer into which the serie will be drawn\n * @returns {Serie} The current serie\n */\n setLayer( layerIndex ) {\n let newLayer = parseInt( layerIndex ) || 1;\n\n if ( newLayer !== this.options.layer ) {\n this.options.layer = newLayer;\n this.graph.appendSerieToDom( this );\n }\n\n return this;\n }\n\n /**\n * Sets the layer onto which the serie should be displayed. This method does not trigger a graph redraw.\n * @memberof Serie\n * @returns {Nunber} The index of the layer into which the serie will be drawn\n */\n getLayer() {\n return this.options.layer || 1;\n }\n\n setStyle( style, selectionType = 'unselected' ) {\n this.styles[ selectionType ] = style;\n this.styleHasChanged( selectionType );\n\n }\n\n /**\n * Notifies jsGraph that the style of the serie has changed and needs to be redrawn on the next repaint\n * @param {String} selectionType - The selection for which the style may have changed\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n styleHasChanged( selectionType = 'unselected' ) {\n this._changedStyles = this._changedStyles || {};\n\n if ( selectionType === false ) {\n for ( var i in this._changedStyles ) {\n this._changedStyles[ i ] = false;\n }\n\n } else {\n this._changedStyles[ selectionType || 'unselected' ] = true;\n }\n\n this.graph.requireLegendUpdate();\n return this;\n }\n\n /**\n * Checks if the style has changed for a selection type\n * @param {String} selectionType - The selection for which the style may have changed\n * @returns {Boolean} true if the style has changed\n * @private\n * @memberof Serie\n */\n hasStyleChanged( selectionType ) {\n this._changedStyles = this._changedStyles || {};\n return this._changedStyles[ selectionType || 'unselected' ];\n }\n\n /**\n * Notifies jsGraph that the data of the serie has changed\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n dataHasChanged( arg ) {\n this._dataHasChanged = arg === undefined || arg;\n return this;\n }\n\n /**\n * Checks if the data has changed\n * @returns {Boolean} true if the data has changed\n * @private\n * @memberof Serie\n */\n hasDataChanged() {\n return this._dataHasChanged;\n }\n\n /**\n * Set a key/value arbitrary information to the serie. It is particularly useful if you have this serie has a reference through an event for instance, and you want to retrieve data associated to it\n * @param {String} prop - The property\n * @param value - The value\n * @returns {Serie} The current serie\n * @see Serie#getInfo\n * @memberof Serie\n */\n setInfo( prop, value ) {\n this.infos = this.infos || {};\n this.infos[ prop ] = value;\n return this;\n }\n\n /**\n * Retrives an information value from its key\n * @param {String} prop - The property\n * @returns The value associated to the prop parameter\n * @see Serie#setInfo\n * @memberof Serie\n */\n getInfo( prop, value ) {\n return ( this.infos || {} )[ prop ];\n }\n\n /**\n * @deprecated\n * @memberof Serie\n */\n setAdditionalData( data ) {\n this.additionalData = data;\n return this;\n }\n\n /**\n * @deprecated\n * @memberof Serie\n */\n getAdditionalData() {\n return this.additionalData;\n }\n\n /**\n * Flags the serie as selected\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n select() {\n this.selected = true;\n return this;\n }\n\n /**\n * Flags the serie as unselected\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n unselect() {\n this.selected = false;\n return this;\n }\n\n /**\n * Allows mouse tracking of the serie\n * @memberof Serie\n * @returns {Serie} The current serie\n * @param {Function} hoverCallback - Function to be called when the mouse enters the serie area\n * @param {Function} outCallback - Function to be called when the mouse exits the serie area\n * @private\n */\n enableTracking( hoverCallback, outCallback ) {\n this._tracker = true;\n this._trackingCallback = hoverCallback;\n this._trackingOutCallback = outCallback;\n\n return this;\n }\n\n /**\n * Disables mouse tracking of the serie\n * @memberof Serie\n * @returns {Serie} The current serie\n * @private\n */\n disableTracking() {\n\n if ( this._trackerDom ) {\n this._trackerDom.remove();\n this._trackerDom = null;\n }\n\n this._tracker = false;\n this._trackingCallback = null;\n return this;\n }\n\n /**\n * Allows mouse tracking of the serie\n * @memberof Serie\n * @param {Object} options - The tracking line options\n * @returns {Serie} The current serie\n */\n allowTrackingLine( options ) {\n\n options = options || {};\n this.graph.addSerieToTrackingLine( this, options );\n }\n\n getMarkerForLegend() {\n return false;\n }\n\n get type() {\n return this._type;\n }\n\n getType() {\n return this._type;\n }\n\n set excludedFromLegend( bln ) {\n this._excludedFromLegend = bln;\n }\n\n get excludedFromLegend() {\n return !!this._excludedFromLegend;\n }\n\n setDataIndices( categories, nb ) {\n this.categoryIndices = categories;\n this.nbCategories = nb;\n }\n\n hasErrors() {\n if ( !this.waveform ) {\n return false;\n }\n\n return this.waveform.hasErrorBars();\n }\n}\n\nexport default Serie;","import * as util from '../graph.util.js';\n\nvar ErrorBarMixin = {\n /*\n doErrorDraw: function( orientation, error, originVal, originPx, xpx, ypx ) {\n\n if ( !( error instanceof Array ) ) {\n error = [ error ];\n }\n\n var functionName = orientation == 'y' ? 'getY' : 'getX';\n var bars = orientation == 'y' ? [ 'top', 'bottom' ] : [ 'left', 'right' ];\n var j;\n\n if ( isNaN( xpx ) || isNaN( ypx ) ) {\n return;\n }\n\n for ( var i = 0, l = error.length; i < l; i++ ) {\n\n if ( error[ i ] instanceof Array ) { // TOP\n\n j = bars[ 0 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal + error[ i ][ 0 ] ), originPx, j );\n\n j = bars[ 1 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal - error[ i ][ 1 ] ), originPx, j );\n\n } else {\n\n j = bars[ 0 ];\n\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal + error[ i ] ), originPx, j );\n j = bars[ 1 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal - error[ i ] ), originPx, j );\n }\n }\n },\n */\n\n /*\n makeError: function( orientation, type, coord, origin, quadOrientation ) {\n\n var method;\n switch ( this.errorstyles[ level ].type ) {\n case 'bar':\n method = \"makeBar\";\n break;\n\n case 'box':\n method = \"makeBox\";\n break;\n }\n\n return this[ method + orientation.toUpperCase() ]( coord, origin, this.errorstyles[ level ][ quadOrientation ] );\n\n },*/\n\n makeBarY: function( coordY, origin, style ) {\n if ( !coordY || style === undefined ) {\n return;\n }\n var width = !util.isNumeric( style.width ) ? 10 : style.width;\n return ' V ' + coordY + ' m -' + ( width / 2 ) + ' 0 h ' + ( width ) + ' m -' + ( width / 2 ) + ' 0 V ' + origin + ' ';\n },\n\n makeBoxY: function( coordY, origin, style ) {\n if ( !coordY || style === undefined ) {\n return;\n }\n return ' m 5 0 V ' + coordY + ' h -10 V ' + origin + ' m 5 0 ';\n },\n\n makeBarX: function( coordX, origin, style ) {\n if ( !coordX || style === undefined ) {\n return;\n }\n var height = !util.isNumeric( style.width ) ? 10 : style.width;\n return ' H ' + coordX + ' m 0 -' + ( height / 2 ) + ' v ' + ( height ) + ' m 0 -' + ( height / 2 ) + ' H ' + origin + ' ';\n },\n\n makeBoxX: function( coordX, origin, style ) {\n if ( !coordX || style === undefined ) {\n return;\n }\n return ' v 5 H ' + coordX + ' v -10 H ' + origin + ' v 5 ';\n },\n /*\n check: function( index, valY, valX ) {\n\n var dx, dy;\n\n if ( ( this.getType() == Graph.SERIE_LINE || this.getType() == Graph.SERIE_SCATTER ) ) {\n\n if ( !( dx = this.data[ index * 2 ] ) || !( dy = this.data[ index * 2 + 1 ] ) ) { //\n return;\n }\n }\n\n if ( dx === undefined ) {\n return;\n }\n\n for ( var i = 0, l = valY.length; i < l; i++ ) {\n\n if ( Array.isArray( valY[ i ] ) ) {\n\n if ( !isNaN( valY[ i ][ 0 ] ) ) {\n this._checkY( dy + valY[ i ][ 0 ] );\n }\n\n if ( !isNaN( valY[ i ][ 1 ] ) ) {\n this._checkY( dy - valY[ i ][ 1 ] );\n }\n\n } else {\n\n if ( !isNaN( valY[ i ] ) ) {\n this._checkY( dy + valY[ i ] );\n this._checkY( dy - valY[ i ] );\n }\n }\n }\n\n for ( var i = 0, l = valX.length; i < l; i++ ) {\n\n if ( Array.isArray( valX[ i ] ) ) {\n\n if ( !isNaN( valX[ i ][ 0 ] ) ) {\n this._checkX( dx - valX[ i ][ 0 ] );\n }\n\n if ( !isNaN( valX[ i ][ 1 ] ) ) {\n this._checkX( dx + valX[ i ][ 1 ] );\n }\n\n } else {\n\n if ( !isNaN( valY[ i ] ) ) {\n this._checkX( dx - valX[ i ] );\n this._checkX( dx + valX[ i ] );\n }\n }\n }\n\n },\n */\n\n /**\n *\n * @example serie.setErrorStyle( [ { type: 'bar', x: {} }, { type: 'box', top: { strokeColor: 'green', fillColor: 'olive' }, bottom: { strokeColor: 'red', fillColor: \"#800000\" } } ] );\n */\n setErrorBarStyle: function( errorstyle ) {\n\n this.errorbarStyle = this._setErrorStyle( errorstyle );\n return this;\n },\n\n setErrorBoxStyle: function( errorstyle ) {\n\n this.errorboxStyle = this._setErrorStyle( errorstyle );\n return this;\n },\n\n _setErrorStyle( errorstyles = {} ) {\n\n var styles = [];\n var pairs = [\n [ 'y', 'top', 'bottom' ],\n [ 'x', 'left', 'right' ]\n ];\n\n var makePath = ( style ) => {\n\n style.dom = document.createElementNS( this.graph.ns, 'path' );\n style.dom.setAttribute( 'fill', style.fillColor || 'none' );\n style.dom.setAttribute( 'stroke', style.strokeColor || 'black' );\n style.dom.setAttribute( 'stroke-opacity', style.strokeOpacity || 1 );\n style.dom.setAttribute( 'fill-opacity', style.fillOpacity || 1 );\n style.dom.setAttribute( 'stroke-width', style.strokeWidth || 1 );\n\n this.groupMain.appendChild( style.dom );\n };\n // i is bar or box\n\n var styles = {};\n\n if ( typeof errorstyles == 'string' ) {\n errorstyles = {};\n }\n\n for ( var j = 0, l = pairs.length; j < l; j++ ) {\n\n if ( errorstyles.all ) {\n\n errorstyles[ pairs[ j ][ 1 ] ] = util.extend( true, {}, errorstyles.all );\n errorstyles[ pairs[ j ][ 2 ] ] = util.extend( true, {}, errorstyles.all );\n\n }\n\n if ( errorstyles[ pairs[ j ][ 0 ] ] ) { //.x, .y\n\n errorstyles[ pairs[ j ][ 1 ] ] = util.extend( true, {}, errorstyles[ pairs[ j ][ 0 ] ] );\n errorstyles[ pairs[ j ][ 2 ] ] = util.extend( true, {}, errorstyles[ pairs[ j ][ 0 ] ] );\n\n }\n\n for ( var k = 1; k <= 2; k++ ) {\n\n if ( errorstyles[ pairs[ j ][ k ] ] ) {\n\n styles[ pairs[ j ][ k ] ] = errorstyles[ pairs[ j ][ k ] ];\n makePath( styles[ pairs[ j ][ k ] ] );\n }\n }\n }\n\n return styles;\n },\n\n errorDrawInit: function() {\n var error;\n // var pathError = \"M 0 0 \";\n\n if ( this.errorboxStyle ) {\n\n this.errorboxStyle.paths = {\n top: '',\n bottom: '',\n left: '',\n right: ''\n };\n }\n\n if ( this.errorbarStyle ) {\n\n this.errorbarStyle.paths = {\n top: '',\n bottom: '',\n left: '',\n right: ''\n };\n }\n },\n\n errorAddPoint: function( index, dataX, dataY, xpx, ypx ) {\n\n /* eslint-disable no-cond-assign */\n let error;\n if ( error = this.waveform.getErrorBarXBelow( index ) ) {\n this.errorbarStyle.paths.left += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.left += this.makeBarX( this.getX( dataX - error ), xpx, this.errorbarStyle.left );\n }\n\n if ( error = this.waveform.getErrorBarXAbove( index ) ) {\n this.errorbarStyle.paths.right += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.right += this.makeBarX( this.getX( dataX + error ), xpx, this.errorbarStyle.right );\n }\n\n if ( error = this.waveform.getErrorBarYBelow( index ) ) {\n this.errorbarStyle.paths.bottom += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.bottom += this.makeBarY( this.getY( dataY - error ), ypx, this.errorbarStyle.bottom );\n }\n\n if ( error = this.waveform.getErrorBarYAbove( index ) ) {\n this.errorbarStyle.paths.top += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.top += this.makeBarY( this.getY( dataY + error ), ypx, this.errorbarStyle.top );\n }\n\n if ( error = this.waveform.getErrorBoxXBelow( index ) ) {\n this.errorboxStyle.paths.left += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.left += this.makeBoxX( this.getX( dataX - error ), xpx, this.errorboxStyle.left );\n }\n\n if ( error = this.waveform.getErrorBoxXAbove( index ) ) {\n this.errorboxStyle.paths.right += ' M ' + xpx + ' ' + ypx;\n\n this.errorboxStyle.paths.right += this.makeBoxX( this.getX( dataX + error ), xpx, this.errorboxStyle.right );\n }\n\n if ( error = this.waveform.getErrorBoxYBelow( index ) ) {\n this.errorboxStyle.paths.bottom += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.bottom += this.makeBoxY( this.getY( dataY - error ), ypx, this.errorboxStyle.bottom );\n }\n\n if ( error = this.waveform.getErrorBoxYAbove( index ) ) {\n this.errorboxStyle.paths.top += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.top += this.makeBoxY( this.getY( dataY + error ), ypx, this.errorboxStyle.top );\n }\n /* eslint-enable */\n\n },\n\n errorAddPointBarChart: function( j, posY, xpx, ypx ) {\n var error;\n if ( this.error && ( error = this.error[ j ] ) ) {\n this.doErrorDraw( 'y', error, posY, ypx, xpx, ypx );\n }\n },\n\n errorDraw: function() {\n\n if ( this.errorbarStyle ) {\n\n for ( var j in this.errorbarStyle.paths ) {\n\n if ( this.errorbarStyle[ j ] && this.errorbarStyle[ j ].dom ) {\n this.errorbarStyle[ j ].dom.setAttribute( 'd', this.errorbarStyle.paths[ j ] );\n }\n }\n }\n\n if ( this.errorboxStyle ) {\n\n for ( var j in this.errorboxStyle.paths ) {\n\n if ( this.errorboxStyle[ j ] && this.errorboxStyle[ j ].dom ) {\n this.errorboxStyle[ j ].dom.setAttribute( 'd', this.errorboxStyle.paths[ j ] );\n }\n }\n }\n }\n};\n\nexport default ErrorBarMixin;","import Graph from '../graph.core.js';\nimport Serie from './graph.serie.js';\n\nimport * as util from '../graph.util.js';\nimport ErrorBarMixin from '../mixins/graph.mixin.errorbars.js';\nimport Waveform from '../util/waveform.js';\n\n/**\n * Serie line\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends Serie\n */\nclass SerieLine extends Serie {\n\n static\n default () {\n /**\n * @name SerieLineDefaultOptions\n * @object\n * @static\n * @memberof SerieLine\n */\n return {\n\n lineColor: 'black',\n lineStyle: 1,\n flip: false,\n label: '',\n lineWidth: 1,\n markers: false,\n trackMouse: false,\n trackMouseLabel: false,\n trackMouseLabelRouding: 1,\n lineToZero: false,\n selectableOnClick: false,\n markersIndependant: false,\n overflowX: false,\n overflowY: false\n };\n }\n\n constructor( graph, name, options ) {\n\n super( ...arguments );\n\n this.selectionType = 'unselected';\n this.markerFamilies = {};\n\n util.mapEventEmission( this.options, this ); // Register events\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n lineWidth: this.options.lineWidth,\n markers: this.options.markers\n };\n\n this.styles.selected = {\n lineWidth: 3\n };\n\n this.extendStyles();\n this.markersDom = new Map();\n\n this.shown = true;\n\n this.data = [];\n this._isMinOrMax = {\n x: {\n min: false,\n max: false\n },\n y: {\n min: false,\n max: false\n }\n };\n\n // Optimize is no markerPoints => save loops\n // this.markerPoints = {};\n\n this.groupLines = document.createElementNS( this.graph.ns, 'g' );\n this.domMarker = document.createElementNS( this.graph.ns, 'path' );\n this.domMarker.style.cursor = 'pointer';\n\n this.groupMain = document.createElementNS( this.graph.ns, 'g' );\n this.additionalData = {};\n\n this.marker = document.createElementNS( this.graph.ns, 'circle' );\n this.marker.setAttribute( 'fill', 'black' );\n this.marker.setAttribute( 'r', 3 );\n this.marker.setAttribute( 'display', 'none' );\n\n this.markerLabel = document.createElementNS( this.graph.ns, 'text' );\n this.markerLabelSquare = document.createElementNS( this.graph.ns, 'rect' );\n this.markerLabelSquare.setAttribute( 'fill', 'white' );\n this.domMarkerHover = {};\n this.domMarkerSelect = {};\n this.markerHovered = 0;\n this.groupMarkerSelected = document.createElementNS( this.graph.ns, 'g' );\n\n this.markerPoints = {};\n\n //this.scale = 1;\n //this.shift = 0;\n this.lines = [];\n\n this.groupMain.appendChild( this.groupLines );\n\n this.groupMain.appendChild( this.marker );\n\n this.groupMain.appendChild( this.groupMarkerSelected );\n this.groupMain.appendChild( this.markerLabelSquare );\n this.groupMain.appendChild( this.markerLabel );\n\n this.groupMarkers = document.createElementNS( this.graph.ns, 'g' );\n this.groupMain.appendChild( this.groupMarkers );\n\n this.independantMarkers = [];\n\n if ( this.initExtended1 ) {\n this.initExtended1();\n }\n\n this.groupLines.addEventListener( 'click', ( e ) => {\n\n if ( this.options.selectableOnClick ) {\n\n if ( this.isSelected() ) {\n\n this.graph.unselectSerie( this );\n\n } else {\n this.graph.selectSerie( this );\n }\n }\n } );\n\n if ( this.options.markers ) {\n this.setMarkers( this.options.markers, 'unselected' );\n }\n\n }\n\n /**\n * Sets the options of the serie\n * @see SerieLineDefaultOptions\n * @param {Object} options - A object containing the options to set\n * @return {SerieLine} The current serie\n * @memberof SerieLine\n */\n setOptions( options ) {\n this.options = util.extend( true, {}, SerieLine.prototype.defaults, ( options || {} ) );\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n markers: this.options.markers\n };\n\n this.applyLineStyles();\n return this;\n }\n\n onMouseOverMarker( e, index ) {\n\n var toggledOn = this.toggleMarker( index, true, true );\n\n if ( this.options.onMouseOverMarker ) {\n\n this.options.onMouseOverMarker(\n index,\n this.infos ? ( this.infos[ index ] || false ) : false, [ this.waveform.getX( index ), this.waveform.getY( index ) ] );\n }\n }\n\n onMouseOutMarker( e, index ) {\n this.markersOffHover();\n\n if ( this.options.onMouseOutMarker ) {\n this.options.onMouseOutMarker(\n index,\n this.infos ? ( this.infos[ index ] || false ) : false, [ this.waveform.getX( index ), this.waveform.getY( index ) ]\n );\n }\n }\n\n /**\n * Selects one of the markers of the serie\n * @param {Number} index - The point index to select (starting at 0)\n * @param {Boolean} [force = undefined] - Forces state of the marker. true forces selection, false forces deselection. undefined toggles the state of the marker\n * @param {Boolean} [hover = false] - true to set the selection in mode \"hover\" (will disappear on mouse out of the marker). false to set the selection in mode \"select\" (will disappear when another marker is selected)\n * @returns {Boolean} The new state of the marker\n * @memberof SerieLine\n */\n toggleMarker( index, force, hover ) {\n\n let i = index;\n\n var _on;\n if ( typeof force === 'undefined' ) {\n _on = !hover ? !this.domMarkerSelect[ index ] : !this.domMarkerHover[ index ];\n }\n var el = this[ 'domMarker' + ( hover ? 'Hover' : 'Select' ) ];\n\n if ( _on || force === true ) {\n\n if ( !el[ index ] ) {\n\n var dom = document.createElementNS( this.graph.ns, 'path' );\n\n this.setMarkerStyleTo( dom, this.markerFamilies[ this.selectionType ][ this.getMarkerCurrentFamily( i ) ] );\n this[ 'domMarker' + ( hover ? 'Hover' : 'Select' ) ][ index ] = dom;\n this.groupMarkerSelected.appendChild( dom );\n\n } else {\n dom = el[ index ];\n }\n\n let x = this.getX( this.waveform.getX( i ) ),\n y = this.getY( this.waveform.getY( i ) );\n\n dom.setAttribute( 'd', 'M ' + x + ' ' + y + ' ' + this.getMarkerPath( this.markerFamilies[ this.selectionType ][ this.getMarkerCurrentFamily( i ) ], 1 ) );\n\n if ( hover ) {\n this.markerHovered++;\n }\n\n } else if ( !_on || force === false ) {\n\n if ( ( hover && this.domMarkerHover[ index ] && !this.domMarkerSelect[ index ] ) || this.domMarkerSelect[ index ] ) {\n\n if ( !el[ index ] ) {\n return;\n }\n\n this.groupMarkerSelected.removeChild( el[ index ] );\n\n delete el[ index ];\n\n if ( hover )\n this.markerHovered--;\n }\n\n }\n\n return _on;\n }\n\n /**\n * Toggles off markers that have the hover mode \"on\"\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n markersOffHover() {\n\n for ( var i in this.domMarkerHover ) {\n this.toggleMarker( i.split( ',' ), false, true );\n }\n return this;\n }\n\n /**\n * Toggles off markers that have the select mode \"on\"\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n markersOffSelect() {\n\n for ( var i in this.domMarkerSelect ) {\n this.toggleMarker( i.split( ',' ), false, false );\n }\n return this;\n }\n\n onClickOnMarker( e, index ) {\n\n var toggledOn = this.toggleMarker( index );\n\n if ( toggledOn && this.options.onSelectMarker ) {\n this.options.onSelectMarker( index, this.infos ? ( this.infos[ index[ 0 ] ] || false ) : false );\n }\n\n if ( !toggledOn && this.options.onUnselectMarker ) {\n this.options.onUnselectMarker( index, this.infos ? ( this.infos[ index[ 0 ] ] || false ) : false );\n }\n\n if ( this.options.onToggleMarker ) {\n this.options.onToggleMarker( index, this.infos ? ( this.infos[ index[ 0 ] ] || false ) : false, toggledOn );\n }\n }\n\n _getMarkerIndexFromEvent( e ) {\n var px = this.graph._getXY( e );\n\n // return this.searchIndexByPxXY( ( px.x ), ( px.y ) );\n return this.searchIndexByPxXY( ( px.x - this.graph.getPaddingLeft() ), ( px.y - this.graph.getPaddingTop() ) );\n }\n\n onMouseWheel() {}\n\n /**\n * Cleans the DOM from the serie internal object (serie and markers). Mostly used internally when a new {@link Serie#setData} is called\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n empty() {\n\n for ( var i = 0, l = this.lines.length; i < l; i++ ) {\n this.groupLines.removeChild( this.lines[ i ] );\n }\n this.lines = [];\n\n return this;\n }\n\n /**\n * Applies a selection to the serie\n * @param {String} [ selectionType = \"selected\" ] - The selection name\n * @returns {SerieLine} The current serie\n * @see SerieLine#unselect\n * @memberof SerieLine\n */\n select( selectionType ) {\n\n selectionType = selectionType || 'selected';\n\n this.selected = selectionType !== 'unselected';\n\n if ( this.areMarkersShown() || this.areMarkersShown( selectionType ) ) {\n this.selectionType = selectionType;\n\n this.draw( true ); // Drawing is absolutely required here\n this.applyLineStyles();\n } else {\n this.selectionType = selectionType;\n this.applyLineStyles();\n }\n\n this.applyLineStyle( this.getSymbolForLegend() );\n return this;\n }\n\n /**\n * Removes the selection to the serie. Effectively, calls {@link SerieLine#select}(\"unselected\").\n * @returns {SerieLine} The current serie\n * @see SerieLine#select\n * @memberof SerieLine\n */\n unselect() {\n\n this.selected = false;\n\n return this.select( 'unselected' );\n }\n\n /**\n * Degrades the data of the serie. This option is used for big data sets that have monotoneously increasing (or decreasing) x values.\n * For example, a serie containing 1'000'000 points, displayed over 1'000px, will have 1'000 points per pixel. Often it does not make sense to display more than 2-3 points per pixel.\n * degrade( pxPerPoint ) allows a degradation of the serie, based on a a number of pixel per point. It computes the average of the data that would be displayed over each pixel range\n * Starting from jsGraph 2.0, it does not calculate the minimum and maximum and creates the zone serie anymore\n * @return {SerieLine} The current serie instance\n * @example serie.degrade( 0.5 ); // Will display 2 points per pixels\n * @memberof SerieLine\n */\n degrade( pxPerP ) {\n\n this.degradationPx = pxPerP;\n return this;\n }\n\n drawInit( force ) {\n\n var data, xData;\n\n try {\n this.axisCheck();\n } catch ( e ) {\n console.warn( e );\n return false;\n }\n\n this.currentLineId = 0;\n this.counter = 0;\n this._drawn = true;\n this.currentLine = '';\n\n // Degradation\n\n if ( this.waveform ) {\n\n if ( this.degradationPx ) {\n\n this.waveform.resampleForDisplay( {\n\n resampleToPx: this.degradationPx,\n xPosition: this.getXAxis().getPx.bind( this.getXAxis() ),\n minX: this.getXAxis().getCurrentMin(),\n maxX: this.getXAxis().getCurrentMax()\n\n } );\n\n this._dataToUse = [ this.waveform.getDataToUseFlat() ];\n\n } else if ( this.waveform.hasAggregation() ) {\n\n let xaxis = this.getXAxis(),\n numberOfPointsInTotal = this.graph.getDrawingWidth() * ( xaxis.getDataMax() - xaxis.getDataMin() ) / ( xaxis.getCurrentMax() - xaxis.getCurrentMin() ),\n promise = this.waveform.selectAggregatedData( numberOfPointsInTotal );\n\n if ( promise instanceof Promise ) {\n\n promise.then( () => {\n\n this.draw( force );\n\n } );\n\n return false;\n\n } else if ( promise === false ) {\n\n return false;\n\n } else {\n\n this._dataToUse = this.waveform.getDataToUseFlat();\n }\n\n }\n\n // this._dataToUse = this.waveform.getDataToUseFlat();\n\n } else {\n\n this._dataToUse = this.data;\n this._xDataToUse = this.xData;\n }\n\n return true;\n }\n\n removeLinesGroup() {\n this._afterLinesGroup = this.groupLines.nextSibling;\n this.groupMain.removeChild( this.groupLines );\n }\n\n insertLinesGroup() {\n\n if ( !this._afterLinesGroup ) {\n throw 'Could not find group after lines to insertion.';\n }\n\n this.groupMain.insertBefore( this.groupLines, this._afterLinesGroup );\n this._afterLinesGroup = false;\n }\n\n removeExtraLines() {\n\n var i = this.currentLineId,\n l = this.lines.length;\n\n for ( ; i < l; i++ ) {\n this.groupLines.removeChild( this.lines[ i ] );\n }\n\n this.lines.splice( this.currentLineId, l - ( this.currentLineId ) );\n this.currentLineId = 0;\n }\n\n /**\n * Draws the serie\n * @memberof SerieLine\n */\n draw( force ) { // Serie redrawing\n\n super.draw( ...arguments );\n\n if ( !this.getXAxis() || !this.getYAxis() ) {\n throw 'No axes were defined for this serie';\n }\n\n if ( force || this.hasDataChanged() ) {\n if ( !this.drawInit( force ) ) {\n return;\n }\n\n var data = this._dataToUse,\n xData = this._xDataToUse,\n slotToUse = this._slotToUse;\n\n this.removeLinesGroup();\n this.eraseMarkers();\n\n this.lookForMaxima = true;\n this.lookForMinima = false;\n\n this.markerFamily = this.markerFamilies[ this.selectionType || 'unselected' ];\n\n this.pos0 = this.getYAxis().getPos( 0 );\n\n if ( this.hasErrors() ) {\n this.errorDrawInit();\n }\n\n this._draw();\n\n if ( this.hasErrors() ) {\n this.errorDraw();\n }\n\n this.removeExtraLines();\n this.insertMarkers();\n this.insertLinesGroup();\n }\n\n // Unhovers everything\n for ( var i in this.domMarkerHover ) {\n this.toggleMarker( i.split( ',' ), false, true );\n }\n\n // Deselects everything\n for ( var i in this.domMarkerSelect ) {\n this.toggleMarker( i.split( ',' ), false, false );\n }\n\n this.applyLineStyle( this.getSymbolForLegend() );\n\n if ( this.hasStyleChanged( this.selectionType ) ) {\n this.updateStyle();\n }\n\n this.dataHasChanged( false );\n super.afterDraw();\n\n }\n\n _draw() {\n\n let self = this,\n waveform = this.waveform,\n data,\n x,\n y,\n lastX = false,\n lastY = false,\n xpx,\n ypx,\n xpx2,\n ypx2,\n xAxis = this.getXAxis(),\n yAxis = this.getYAxis(),\n xMin = xAxis.getCurrentMin(),\n yMin = yAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n yMax = yAxis.getCurrentMax();\n\n if ( !waveform ) {\n return;\n }\n\n data = waveform.getData( true );\n\n // Y crossing\n let yLeftCrossingRatio,\n yLeftCrossing,\n yRightCrossingRatio,\n yRightCrossing,\n xTopCrossingRatio,\n xTopCrossing,\n xBottomCrossingRatio,\n xBottomCrossing,\n\n /*xshift = waveform.getXShift(),\n xscale = wave.getXScale(),*/\n yshift = waveform.getShift(),\n yscale = waveform.getScale();\n\n let pointOutside = false;\n let lastPointOutside = false;\n let pointOnAxis;\n\n let _monotoneous = this.isMonotoneous(),\n _markersShown = this.markersShown();\n\n let i = 0,\n l = waveform.getLength();\n\n this.currentLine = '';\n\n if ( waveform.isXMonotoneous() ) {\n\n if ( waveform.isXMonotoneousAscending() ) {\n\n i = waveform.getIndexFromX( xMin, true ) || 0;\n l = waveform.getIndexFromX( xMax, true );\n\n if ( l === false ) {\n l = waveform.getLength();\n }\n\n } else {\n\n i = waveform.getIndexFromX( xMax, true ) || 0;\n l = waveform.getIndexFromX( xMin, true );\n\n if ( l === false ) {\n l = waveform.getLength();\n }\n }\n\n l += 2;\n if ( l > data.length ) {\n l = data.length;\n }\n }\n\n for ( ; i < l; i += 1 ) {\n\n x = waveform.getX( i, true );\n y = data[ i ] * yscale + yshift;\n\n if ( x != x || y != y ) { // NaN checks\n this._createLine();\n continue;\n }\n\n if ( ( !this.options.overflowX && x < xMin && lastX < xMin ) || ( !this.options.overflowX && x > xMax && lastX > xMax ) || ( ( ( !this.options.overflowY && y < yMin && lastY < yMin ) || ( !this.options.overflowY && y > yMax && lastY > yMax ) ) && !this.options.lineToZero ) ) {\n lastX = x;\n lastY = y;\n lastPointOutside = true;\n continue;\n }\n\n this.counter2 = i;\n\n if ( _markersShown ) {\n this.getMarkerCurrentFamily( this.counter2 );\n }\n\n xpx2 = this.getX( x );\n ypx2 = this.getY( y );\n //xpx2 = 0;\n //ypx2 = 0;\n\n if ( xpx2 == xpx && ypx2 == ypx ) {\n continue;\n }\n\n if ( xpx2 != xpx2 || ypx2 != ypx2 ) { // NaN checks\n if ( this.counter > 0 ) {\n\n this._createLine();\n }\n continue;\n }\n\n if ( !_monotoneous ) {\n\n pointOutside = ( !this.options.overflowX && ( x < xMin || x > xMax ) ) || ( !this.options.overflowY && ( y < yMin || y > yMax ) );\n\n } else {\n pointOutside = !this.options.overflowY && ( y < yMin || y > yMax );\n }\n\n if ( this.options.lineToZero ) {\n pointOutside = ( x < xMin || x > xMax );\n\n if ( pointOutside ) {\n continue;\n }\n } else {\n\n if ( pointOutside || lastPointOutside ) {\n\n if ( ( lastX === false || lastY === false ) && !lastPointOutside ) {\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n\n } else {\n\n pointOnAxis = [];\n // Y crossing\n yLeftCrossingRatio = ( x - xMin ) / ( x - lastX );\n yLeftCrossing = y - yLeftCrossingRatio * ( y - lastY );\n yRightCrossingRatio = ( x - xMax ) / ( x - lastX );\n yRightCrossing = y - yRightCrossingRatio * ( y - lastY );\n\n // X crossing\n xTopCrossingRatio = ( y - yMin ) / ( y - lastY );\n xTopCrossing = x - xTopCrossingRatio * ( x - lastX );\n xBottomCrossingRatio = ( y - yMax ) / ( y - lastY );\n xBottomCrossing = x - xBottomCrossingRatio * ( x - lastX );\n\n if ( yLeftCrossingRatio < 1 && yLeftCrossingRatio > 0 && yLeftCrossing !== false && yLeftCrossing < yMax && yLeftCrossing > yMin ) {\n pointOnAxis.push( [ xMin, yLeftCrossing ] );\n }\n\n if ( yRightCrossingRatio < 1 && yRightCrossingRatio > 0 && yRightCrossing !== false && yRightCrossing < yMax && yRightCrossing > yMin ) {\n pointOnAxis.push( [ xMax, yRightCrossing ] );\n }\n\n if ( xTopCrossingRatio < 1 && xTopCrossingRatio > 0 && xTopCrossing !== false && xTopCrossing < xMax && xTopCrossing > xMin ) {\n pointOnAxis.push( [ xTopCrossing, yMin ] );\n }\n\n if ( xBottomCrossingRatio < 1 && xBottomCrossingRatio > 0 && xBottomCrossing !== false && xBottomCrossing < xMax && xBottomCrossing > xMin ) {\n pointOnAxis.push( [ xBottomCrossing, yMax ] );\n }\n\n if ( pointOnAxis.length > 0 ) {\n\n if ( !pointOutside ) { // We were outside and now go inside\n\n if ( pointOnAxis.length > 1 ) {\n console.error( 'Programmation error. Please e-mail me.' );\n console.log( pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY );\n }\n\n this._createLine();\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n this._addPoint( xpx2, ypx2, lastX, lastY, false, false, true );\n\n } else if ( !lastPointOutside ) { // We were inside and now go outside\n\n if ( pointOnAxis.length > 1 ) {\n console.error( 'Programmation error. Please e-mail me.' );\n console.log( pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY );\n }\n\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n\n } else {\n\n // No crossing: do nothing\n if ( pointOnAxis.length == 2 ) {\n this._createLine();\n\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n this._addPoint( this.getX( pointOnAxis[ 1 ][ 0 ] ), this.getY( pointOnAxis[ 1 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n }\n\n }\n } else if ( !pointOutside ) {\n\n this._addPoint( xpx2, ypx2, lastX, lastY, i, false, false );\n } // else {\n // Norman:\n // This else case is not the sign of a bug. If yLeftCrossing == 0 or 1 for instance, pointOutside or lastPointOutside will be true\n // However, there's no need to draw anything because the point is on the axis and will already be covered.\n // 28 Aug 2015\n\n /*\n if ( lastPointOutside !== pointOutside ) {\n console.error( \"Programmation error. A crossing should have been found\" );\n console.log( yLeftCrossing, yLeftCrossingRatio, yMax, yMin );\n console.log( yRightCrossing, yRightCrossingRatio, yMax, yMin );\n console.log( xTopCrossing, xTopCrossingRatio, xMax, xMin );\n console.log( xBottomCrossing, xBottomCrossingRatio, xMax, xMin );\n console.log( pointOutside, lastPointOutside )\n\n }\n */\n // }\n }\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n\n lastPointOutside = pointOutside;\n\n continue;\n }\n\n }\n\n this._addPoint( xpx2, ypx2, x, y, i, false, true );\n\n //this.detectPeaks( x, y );\n\n xpx = xpx2;\n ypx = ypx2;\n\n lastX = x;\n lastY = y;\n }\n\n this._createLine();\n\n if ( this._tracker ) {\n\n if ( this._trackerDom ) {\n this._trackerDom.remove();\n }\n\n var cloned = this.groupLines.cloneNode( true );\n this.groupMain.appendChild( cloned );\n\n for ( i = 0, l = cloned.children.length; i < l; i++ ) {\n\n cloned.children[ i ].setAttribute( 'stroke', 'transparent' );\n cloned.children[ i ].setAttribute( 'stroke-width', '25px' );\n cloned.children[ i ].setAttribute( 'pointer-events', 'stroke' );\n }\n\n this._trackerDom = cloned;\n\n this.groupMain.addEventListener( 'mousemove', ( e ) => {\n var coords = this.graph._getXY( e ),\n ret = this.handleMouseMove( false, false );\n\n this._trackingCallback( this, ret, coords.x, coords.y );\n } );\n\n this.groupMain.addEventListener( 'mouseleave', ( e ) => {\n this._trackingOutCallback( this );\n } );\n }\n\n return this;\n\n }\n\n kill() {\n super.kill();\n }\n\n /**\n * @param {Number} k - Index of the point for which we should get the family\n * @memberof SerieLine\n */\n getMarkerCurrentFamily( k ) {\n\n if ( !this.markerPoints || !this.markerPoints[ this.selectionType ] ) {\n return;\n }\n\n var family;\n\n for ( var z = 0; z < this.markerPoints[ this.selectionType ].length; z++ ) {\n if ( this.markerPoints[ this.selectionType ][ z ][ 0 ] <= k ) { // This one is a possibility !\n if ( this.markerPoints[ this.selectionType ][ z ][ 1 ] >= k ) { // Verify that it's in the boundary\n this.markerCurrentFamily = this.markerPoints[ this.selectionType ][ z ][ 2 ];\n family = this.markerFamilies[ this.selectionType ][ this.markerCurrentFamily ];\n }\n } else {\n break;\n }\n }\n\n if ( !family ) {\n return false;\n }\n this.getMarkerDom( family );\n return this.markerCurrentFamily;\n }\n\n setMarkerStyleTo( dom, family ) {\n\n if ( !dom || !family ) {\n console.trace();\n throw 'Cannot set marker style. DOM does not exist.';\n }\n\n dom.setAttribute( 'fill', family.fillColor || 'transparent' );\n dom.setAttribute( 'stroke', family.strokeColor || this.getLineColor() );\n dom.setAttribute( 'stroke-width', family.strokeWidth || 1 );\n }\n\n /**\n * Hides the tracking marker (see the trackMouse option)\n * @memberof SerieLine\n */\n hideTrackingMarker() {\n this.marker.setAttribute( 'display', 'none' );\n this.markerLabel.setAttribute( 'display', 'none' );\n this.markerLabelSquare.setAttribute( 'display', 'none' );\n }\n\n _addPoint( xpx, ypx, x, y, j, move, allowMarker ) {\n\n /*if( ! this.currentLineId ) {\n throw \"No current line\"\n }* @memberof SerieLine\n*/\n\n if ( xpx !== xpx || ypx !== ypx ) {\n return;\n }\n\n if ( this.counter == 0 ) {\n this.currentLine = 'M ';\n } else {\n\n if ( this.options.lineToZero || move ) {\n this.currentLine += 'M ';\n } else {\n this.currentLine += 'L ';\n }\n }\n\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += ypx;\n this.currentLine += ' ';\n\n if ( this.options.lineToZero && this.pos0 !== undefined ) {\n\n this.currentLine += 'L ';\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += this.pos0;\n this.currentLine += ' ';\n\n }\n\n if ( this.hasErrors() ) {\n this.errorAddPoint( j, x, y, xpx, ypx );\n }\n\n if ( !this.markerPoints ) {\n this.counter++;\n\n return;\n }\n\n if ( this.markersShown() && allowMarker !== false && this.markerFamily ) {\n drawMarkerXY(\n this,\n this.markerFamily[ this.markerCurrentFamily ],\n xpx,\n ypx,\n this.markersDom.get( this.markerFamily[ this.markerCurrentFamily ] )\n );\n }\n\n this.counter++;\n\n }\n\n // Returns the DOM\n _createLine() {\n\n var i = this.currentLineId++,\n line;\n\n // Creates a line if needed\n if ( this.lines[ i ] ) {\n line = this.lines[ i ];\n } else {\n\n line = document.createElementNS( this.graph.ns, 'path' );\n this.applyLineStyle( line );\n this.groupLines.appendChild( line );\n this.lines[ i ] = line;\n }\n\n if ( this.counter == 0 ) {\n line.setAttribute( 'd', '' );\n } else {\n line.setAttribute( 'd', this.currentLine );\n }\n\n this.currentLine = 'M ';\n this.counter = 0;\n\n return line;\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyles() {\n\n for ( var i = 0; i < this.lines.length; i++ ) {\n this.applyLineStyle( this.lines[ i ] );\n }\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyle( line ) {\n\n line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute( 'stroke-width', this.getLineWidth() );\n if ( this.getLineDashArray() ) {\n line.setAttribute( 'stroke-dasharray', this.getLineDashArray() );\n } else {\n line.removeAttribute( 'stroke-dasharray' );\n }\n line.setAttribute( 'fill', 'none' );\n //\tline.setAttribute('shape-rendering', 'optimizeSpeed');\n }\n\n /**\n * Updates the current style (lines + legend) of the serie. Use this method if you have explicitely changed the options of the serie\n * @example var opts = { lineColor: 'red' };\n * var s = graph.newSerie( \"name\", opts ).setData( someData );\n * opts.lineColor = 'green';\n * s.updateStyle(); // Sets the lineColor to green\n * s.draw(); // Would also do the same thing, but recalculates the whole serie display (including (x,y) point pairs)\n * @memberof SerieLine\n */\n updateStyle() {\n this.applyLineStyles();\n this.setLegendSymbolStyle();\n\n this.styleHasChanged( false );\n }\n\n // Revised August 2014. Ok\n getMarkerPath( family, add ) {\n\n var z = family.zoom || 1,\n add = add || 0,\n el = [];\n\n switch ( family.type ) {\n\n case 2:\n el = [ 'm', -2, -2, 'l', 4, 4, 'm', -4, 0, 'l', 4, -4 ];\n break;\n\n case 3:\n el = [ 'm', -2, 0, 'l', 4, 0, 'm', -2, -2, 'l', 0, 4 ];\n break;\n\n case 4:\n el = [ 'm', -1, -1, 'l', 2, 0, 'l', -1, 2, 'z' ];\n break;\n\n default:\n case 1:\n el = [ 'm', -2, -2, 'l', 4, 0, 'l', 0, 4, 'l', -4, 0, 'z' ];\n break;\n\n }\n\n if ( ( z == 1 || !z ) && !add ) {\n return el.join( ' ' );\n }\n\n var num = 'number';\n\n if ( !el ) {\n return;\n }\n\n for ( var i = 0, l = el.length; i < l; i++ ) {\n\n if ( typeof el[ i ] == num ) {\n\n el[ i ] *= ( z + add );\n }\n }\n\n return el.join( ' ' );\n\n }\n\n // Revised August 2014. Ok\n getMarkerDom( family ) {\n\n var self = this;\n\n if ( !this.markersDom.has( family ) ) {\n\n var dom = document.createElementNS( this.graph.ns, 'path' );\n this.setMarkerStyleTo( dom, family );\n this.markersDom.set( family, {\n dom: dom,\n path: ''\n } );\n\n dom.addEventListener( 'mouseover', function( e ) {\n var closest = self._getMarkerIndexFromEvent( e );\n self.onMouseOverMarker( e, closest );\n } );\n\n dom.addEventListener( 'mouseout', function( e ) {\n var closest = self._getMarkerIndexFromEvent( e );\n self.onMouseOutMarker( e, closest );\n } );\n\n dom.addEventListener( 'click', function( e ) {\n var closest = self._getMarkerIndexFromEvent( e );\n self.onClickOnMarker( e, closest );\n } );\n\n }\n\n return family.dom;\n }\n\n // In case markers are not grouped in families but independant\n getMarkerDomIndependent( index, family ) {\n\n if ( !this.independantMarkers[ index ] ) {\n\n var dom = document.createElementNS( this.graph.ns, 'path' );\n this.setMarkerStyleTo( dom, family );\n\n dom.addEventListener( 'mouseover', ( e ) => {\n\n this.onMouseOverMarker( e, index );\n\n } );\n\n dom.addEventListener( 'mouseout', ( e ) => {\n\n this.onMouseOutMarker( e, index );\n\n } );\n\n dom.addEventListener( 'click', ( e ) => {\n\n this.onClickOnMarker( e, index );\n\n } );\n\n this.independantMarkers[ index ] = dom;\n }\n\n this.groupMarkers.appendChild( this.independantMarkers[ index ] );\n\n return this.independantMarkers[ index ];\n }\n\n /**\n * Searches the closest point pair (x,y) to the a pair of pixel position\n * @param {Number} x - The x position in pixels (from the left)\n * @param {Number} y - The y position in pixels (from the left)\n * @returns {Number} Index in the data array of the closest (x,y) pair to the pixel position passed in parameters\n * @memberof SerieLine\n */\n searchIndexByPxXY( x, y ) {\n\n var oldDist = false,\n xyindex = false,\n dist;\n\n var xData = this._xDataToUse,\n p_x,\n p_y;\n\n for ( var k = 0, m = this.waveform.getLength(); k < m; k += 1 ) {\n\n p_x = this.waveform.getX( k );\n p_y = this.waveform.getY( k );\n\n dist = Math.pow( ( this.getX( p_x ) - x ), 2 ) + Math.pow( ( this.getY( p_y ) - y ), 2 );\n //console.log(x, y, dist, this.data[i][k], this.data[i][k + 1]);\n\n if ( !oldDist || dist < oldDist ) {\n oldDist = dist;\n xyindex = k;\n }\n }\n\n return xyindex;\n }\n\n /**\n * Performs a binary search to find the closest point index to an x value. For the binary search to work, it is important that the x values are monotoneous.\n * @param {Number} valX - The x value to search for\n * @returns {Object} Index in the data array of the closest (x,y) pair to the pixel position passed in parameters\n * @memberof SerieLine\n */\n searchClosestValue( valX, valY ) {\n\n if ( this.waveform ) {\n\n const indexX = this.waveform.getIndexFromXY( valX, valY, undefined, undefined, this.getXAxis().getRelPx( 1 ), this.getYAxis().getRelPx( 1 ) );\n\n let returnObj = {};\n\n let direction;\n\n if ( valX > this.waveform.getX( indexX ) ) {\n direction = 0;\n } else {\n direction = 1;\n }\n\n Object.assign( returnObj, {\n indexMin: indexX + direction,\n indexMax: indexX + direction + 1,\n indexClosest: indexX,\n xMin: this.waveform.getX( indexX + direction ),\n xMax: this.waveform.getX( indexX + direction + 1 ),\n yMin: this.waveform.getY( indexX + direction ),\n yMax: this.waveform.getY( indexX + direction + 1 ),\n xClosest: this.waveform.getX( indexX ),\n yClosest: this.waveform.getY( indexX ),\n xExact: valX\n } );\n return returnObj;\n }\n\n }\n\n handleMouseMove( xValue, doMarker, yValue ) {\n\n var valX = xValue || this.getXAxis().getMouseVal(),\n valY = yValue || this.getYAxis().getMouseVal(),\n xMinIndex,\n xMin,\n yMin,\n xMax,\n yMax;\n\n var value = this.searchClosestValue( valX, valY );\n\n if ( !value ) {\n return;\n }\n\n var ratio, intY;\n\n if ( value.xMax == value.xMin ) {\n intY = value.yMin;\n } else {\n\n //ratio = ( valX - value.xMin ) / ( value.xMax - value.xMin );\n //intY = ( ( 1 - ratio ) * value.yMin + ratio * value.yMax );\n }\n\n if ( doMarker && this.options.trackMouse ) {\n\n if ( value.xMin == undefined ) {\n\n return false;\n\n } else {\n\n if ( !this.marker ) {\n return;\n }\n\n var x = this.getX( this.getFlip() ? value.yClosest : value.xClosest );\n var y = this.getY( this.getFlip() ? value.xClosest : value.yClosest );\n\n if ( isNaN( x ) || isNaN( y ) ) {\n return;\n }\n\n this.marker.setAttribute( 'display', 'block' );\n this.marker.setAttribute( 'cx', x );\n this.marker.setAttribute( 'cy', y );\n\n this.markerLabel.setAttribute( 'display', 'block' );\n this.markerLabelSquare.setAttribute( 'display', 'block' );\n\n switch ( this.options.trackMouseLabel ) {\n\n case false:\n\n break;\n\n default:\n this.markerLabel.textContent = this.options.trackMouseLabel\n .replace( '', valX.toFixed( this.options.trackMouseLabelRouding ) )\n .replace( '', intY.toFixed( this.options.trackMouseLabelRouding ) );\n break;\n }\n\n this.markerLabel.setAttribute( 'x', x + 5 );\n this.markerLabel.setAttribute( 'y', y - 5 );\n\n this.markerLabelSquare.setAttribute( 'x', x + 5 );\n this.markerLabelSquare.setAttribute( 'y', y - 5 - this.graph.options.fontSize );\n this.markerLabelSquare.setAttribute( 'width', this.markerLabel.getComputedTextLength() + 2 );\n this.markerLabelSquare.setAttribute( 'height', this.graph.options.fontSize + 2 );\n }\n }\n\n return {\n xBefore: value.xMin,\n xAfter: value.xMax,\n yBefore: value.yMin,\n yAfter: value.yMax,\n trueX: value.xExact,\n indexClosest: value.indexClosest,\n interpolatedY: intY,\n\n xClosest: value.xClosest,\n yClosest: value.yClosest\n };\n }\n /**\n * Gets the maximum value of the y values between two x values. The x values must be monotoneously increasing\n * @param {Number} startX - The start of the x values\n * @param {Number} endX - The end of the x values\n * @returns {Number} Maximal y value in between startX and endX\n * @memberof SerieLine\n */\n getMax( start, end ) {\n\n var start2 = Math.min( start, end ),\n end2 = Math.max( start, end ),\n v1 = this.searchClosestValue( start2 ),\n v2 = this.searchClosestValue( end2 ),\n i, j, max = -Infinity,\n initJ, maxJ;\n\n // console.log( start2, end2, v1, v2 );\n\n if ( !v1 ) {\n start2 = this.minX;\n v1 = this.searchClosestValue( start2 );\n }\n\n if ( !v2 ) {\n end2 = this.maxX;\n v2 = this.searchClosestValue( end2 );\n }\n\n if ( !v1 || !v2 ) {\n return -Infinity;\n }\n\n for ( i = v1.dataIndex; i <= v2.dataIndex; i++ ) {\n initJ = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n maxJ = i == v2.dataIndex ? v2.xBeforeIndexArr : this.data[ i ].length;\n\n for ( j = initJ; j <= maxJ; j += 2 ) {\n max = Math.max( max, this.data[ i ][ j + 1 ] );\n }\n }\n\n return max;\n }\n\n /**\n * Gets the minimum value of the y values between two x values. The x values must be monotoneously increasing\n * @param {Number} startX - The start of the x values\n * @param {Number} endX - The end of the x values\n * @returns {Number} Maximal y value in between startX and endX\n * @memberof SerieLine\n */\n getMin( start, end ) {\n\n var start2 = Math.min( start, end ),\n end2 = Math.max( start, end ),\n v1 = this.searchClosestValue( start2 ),\n v2 = this.searchClosestValue( end2 ),\n i, j, min = Infinity,\n initJ, maxJ;\n\n if ( !v1 ) {\n start2 = this.minX;\n v1 = this.searchClosestValue( start2 );\n }\n\n if ( !v2 ) {\n end2 = this.maxX;\n v2 = this.searchClosestValue( end2 );\n }\n\n if ( !v1 || !v2 ) {\n return Infinity;\n }\n\n for ( i = v1.dataIndex; i <= v2.dataIndex; i++ ) {\n initJ = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n maxJ = i == v2.dataIndex ? v2.xBeforeIndexArr : this.data[ i ].length;\n\n for ( j = initJ; j <= maxJ; j += 2 ) {\n min = Math.min( min, this.data[ i ][ j + 1 ] );\n }\n }\n\n return min;\n }\n\n /* LINE STYLE * @memberof SerieLine\n */\n\n setStyle( style, selectionType = 'unselected' ) {\n\n this.styles[ selectionType ] = style;\n this.styleHasChanged( selectionType );\n\n }\n\n setLineStyle( number, selectionType = 'unselected', applyToSelected ) {\n\n this.styles[ selectionType ] = this.styles[ selectionType ] || {};\n this.styles[ selectionType ].lineStyle = number;\n\n if ( applyToSelected ) {\n this.setLineStyle( number, 'selected' );\n }\n\n this.styleHasChanged( selectionType );\n\n return this;\n }\n\n getLineStyle( selectionType ) {\n return this.getStyle( selectionType ).lineStyle;\n }\n\n getLineDashArray( selectionType = this.selectionType || 'unselected' ) {\n\n switch ( this.getStyle( selectionType ).lineStyle ) {\n\n case 2:\n return '1, 1';\n break;\n case 3:\n return '2, 2';\n break;\n case 4:\n return '3, 3';\n break;\n case 5:\n return '4, 4';\n break;\n case 6:\n return '5, 5';\n break;\n\n case 7:\n return '5 2';\n break;\n case 8:\n return '2 5';\n break;\n\n case 9:\n return '4 2 4 4';\n break;\n case 10:\n return '1,3,1';\n break;\n case 11:\n return '9 2';\n break;\n case 12:\n return '2 9';\n break;\n\n case 1:\n case false:\n return false;\n break;\n\n default:\n return this.styles[ selectionType ].lineStyle;\n break;\n }\n\n this.styleHasChanged( selectionType );\n\n }\n\n getStyle( selectionType = this.selectionType || 'unselected' ) {\n return this.styles[ selectionType ];\n }\n\n extendStyles() {\n for ( var i in this.styles ) {\n\n var s = this.styles[ i ];\n if ( s ) {\n this.styles[ i ] = util.extend( true, {}, this.styles.unselected, s );\n }\n }\n }\n\n extendStyle( styleTarget, styleOrigin ) {\n var s = this.styles[ styleTarget ];\n\n this.styles[ styleTarget ] = util.extend( true, {}, this.styles[ styleOrigin || 'unselected' ], s || {} );\n\n this.styles[ styleTarget ].markers.map( function( marker ) {\n if ( marker.dom ) {\n marker.dom = '';\n }\n } );\n\n this._recalculateMarkerPoints( styleTarget, this.styles[ styleTarget ].markers );\n this.styleHasChanged( styleTarget );\n }\n\n /* * @memberof SerieLine\n */\n\n setLineWidth( width, selectionType, applyToSelected ) {\n\n selectionType = selectionType || 'unselected';\n this.styles[ selectionType ] = this.styles[ selectionType ] || {};\n this.styles[ selectionType ].lineWidth = width;\n\n if ( applyToSelected ) {\n this.setLineWidth( width, 'selected' );\n }\n\n this.styleHasChanged( selectionType );\n\n return this;\n }\n\n getLineWidth( selectionType ) {\n\n return this.getStyle( selectionType ).lineWidth || 1;\n }\n\n /* LINE COLOR * @memberof SerieLine\n */\n setLineColor( color, selectionType, applyToSelected ) {\n\n selectionType = selectionType || 'unselected';\n this.styles[ selectionType ] = this.styles[ selectionType ] || {};\n this.styles[ selectionType ].lineColor = color;\n\n if ( applyToSelected ) {\n this.setLineColor( color, 'selected' );\n }\n\n this.styleHasChanged( selectionType );\n\n return this;\n }\n\n getLineColor( selectionType ) {\n\n return this.getStyle( selectionType ).lineColor || 'black';\n }\n\n /* * @memberof SerieLine\n */\n\n /* MARKERS * @memberof SerieLine\n */\n showMarkers( selectionType, redraw ) {\n selectionType = selectionType || 'unselected';\n this.styles[ selectionType ] = this.styles[ selectionType ] || {};\n this.styles[ selectionType ].showMarkers = true;\n\n if ( redraw && this._drawn ) {\n this.draw( true );\n } else {\n this.styleHasChanged( selectionType );\n }\n\n return this;\n }\n\n hideMarkers( selectionType, redraw ) {\n\n selectionType = selectionType || 'unselected';\n this.styles[ selectionType ].showMarkers = false;\n\n if ( redraw && this._drawn ) {\n this.draw( true );\n } else {\n this.styleHasChanged( selectionType );\n }\n return this;\n }\n\n markersShown( selectionType ) {\n return this.getStyle( selectionType ).showMarkers !== false;\n }\n\n areMarkersShown() {\n return this.markersShown.apply( this, arguments );\n }\n\n isMarkersShown() {\n return this.markersShown.apply( this, arguments );\n }\n\n // Multiple markers\n setMarkers( families, selectionType, applyToSelected ) {\n // Family has to be an object\n // Family looks like\n /*\n\t\t\t\t{\n\t\t\t\t\ttype: 1,\n\t\t\t\t\tzoom: 1,\n\t\t\t\t\tstrokeWidth: 1,\n\t\t\t\t\tstrokeColor: '',\n\t\t\t\t\tfillColor: '',\n points: []\n\t\t\t\t}\n\t\t\t* @memberof SerieLine\n*/\n\n this.styles[ selectionType || 'unselected' ] = this.styles[ selectionType || 'unselected' ] || {};\n\n this.showMarkers( selectionType, false );\n\n if ( !Array.isArray( families ) && typeof families == 'object' ) {\n families = [ families ];\n } else if ( !families ) {\n\n families = [ {\n type: 1,\n zoom: 1,\n points: 'all'\n } ];\n }\n\n this.styles[ selectionType || 'unselected' ].markers = families;\n\n if ( applyToSelected ) {\n this.styles.selected.markers = util.extend( true, {}, families );\n }\n\n this._recalculateMarkerPoints( selectionType, families );\n this.styleHasChanged( selectionType );\n this.dataHasChanged( true ); // Data has not really changed, but marker placing is performed during the draw method\n return this;\n }\n\n setMarkersPoints( points, family, selectionType ) {\n this._extendMarkers( 'points', points, family, selectionType, true );\n }\n\n setMarkersColor( color, family, selectionType ) {\n this._extendMarkers( 'color', color, family, selectionType );\n }\n\n setMarkersType( type, family, selectionType ) {\n this._extendMarkers( 'type', type, family, selectionType );\n }\n\n setMarkersZoom( zoom, family, selectionType ) {\n this._extendMarkers( 'zoom', zoom, family, selectionType );\n }\n\n setMarkersStrokeColor( strokeColor, family, selectionType ) {\n this._extendMarkers( 'strokeColor', strokeColor, family, selectionType );\n }\n\n setMarkersStrokeWidth( strokeWidth, family, selectionType ) {\n this._extendMarkers( 'strokeWidth', strokeWidth, family, selectionType );\n }\n\n setMarkersFillColor( fillColor, family, selectionType ) {\n this._extendMarkers( 'fillColor', fillColor, family, selectionType );\n }\n\n _extendMarkers( type, value, family, selectionType, recalculatePoints ) {\n\n family = family || 0;\n selectionType = selectionType || 'unselected';\n\n if ( !this.styles[ selectionType ] || !this.styles[ selectionType ].markers ) {\n return;\n }\n\n this.styles[ selectionType ].markers[ family ][ type ] = value;\n\n if ( recalculatePoints ) {\n this._recalculateMarkerPoints( selectionType, this.styles[ selectionType ].markers );\n }\n\n if ( !this.markersDom[ this.styles[ selectionType ].markers[ family ] ] ) { // DOM doesn't exist yet.\n return;\n }\n\n this.setMarkerStyleTo( this.markersDom[ this.styles[ selectionType ].markers[ family ] ].dom, this.styles[ selectionType ].markers[ family ] );\n\n }\n\n _recalculateMarkerPoints( selectionType, families ) {\n\n var markerPoints = [];\n // Overwriting any other undefined families\n markerPoints.push( [ 0, Infinity, null ] );\n\n for ( var i = 0, k = families.length; i < k; i++ ) {\n\n families[ i ].markerPath = this.getMarkerPath( families[ i ] );\n\n if ( !families[ i ].points ) {\n families[ i ].points = 'all';\n }\n\n if ( !Array.isArray( families[ i ].points ) ) {\n families[ i ].points = [ families[ i ].points ];\n }\n\n for ( var j = 0, l = families[ i ].points.length; j < l; j++ ) {\n\n if ( families[ i ].points[ j ] == 'all' ) {\n\n markerPoints.push( [ 0, Infinity, i ] );\n\n } else if ( !Array.isArray( families[ i ].points[ j ] ) ) {\n\n markerPoints.push( [ families[ i ].points[ j ], families[ i ].points[ j ], i ] );\n //markerPoints.push( [ family[ i ].points[ j ] + 1, null ] );\n } else {\n\n markerPoints.push( [ families[ i ].points[ j ][ 0 ], families[ i ].points[ j ][ 1 ], i ] );\n\n }\n }\n }\n\n this.markerFamilies[ selectionType || 'unselected' ] = families;\n\n // Let's sort if by the first index.\n markerPoints.sort( function( a, b ) {\n return ( a[ 0 ] - b[ 0 ] ) || ( a[ 2 ] == null ? -1 : 1 );\n } );\n\n this.markerPoints[ selectionType || 'unselected' ] = markerPoints;\n }\n\n insertMarkers( selectionType ) {\n\n if ( !this.markerFamilies || !this.markerFamilies[ selectionType || this.selectionType ] || this.options.markersIndependant ) {\n return;\n }\n\n for ( var i = 0, l = this.markerFamilies[ selectionType || this.selectionType ].length; i < l; i++ ) {\n\n if ( !this.markersDom.has( this.markerFamilies[ selectionType || this.selectionType ][ i ] ) ) {\n continue;\n }\n\n let dom =\n this\n .markersDom\n .get( this.markerFamilies[ selectionType || this.selectionType ][ i ] );\n\n dom.dom\n .setAttribute(\n 'd',\n dom.path );\n\n this.groupMarkers.appendChild( dom.dom );\n this.currentMarkersSelectionType = this.selectionType;\n }\n }\n\n getMarkerForLegend() {\n\n if ( !this.markerPoints || !this.markerPoints[ this.selectionType ] ) {\n return;\n }\n\n if ( !this.markerForLegend ) {\n\n var marker = document.createElementNS( this.graph.ns, 'path' );\n this.setMarkerStyleTo( marker, this.markerFamilies[ this.selectionType ][ 0 ] );\n\n marker.setAttribute( 'd', 'M 14 0 ' + this.getMarkerPath( this.markerFamilies[ this.selectionType ][ 0 ] ) );\n\n this.markerForLegend = marker;\n }\n\n return this.markerForLegend;\n }\n\n eraseMarkers() {\n\n var self = this;\n\n if ( this.options.markersIndependant ) {\n\n for ( var i in this.independantMarkers ) {\n self.groupMarkers.removeChild( this.independantMarkers[ i ] );\n }\n\n this.independantMarkers = {};\n\n } else if ( this.currentMarkersSelectionType ) {\n\n this.markersDom.forEach( function( el ) {\n\n if ( !el.dom ) {\n return;\n }\n\n if ( el.dom.parentNode !== self.groupMarkers ) {\n return;\n }\n\n self.groupMarkers.removeChild( el.dom );\n el.path = '';\n } );\n\n this.currentMarkersSelectionType = false;\n }\n\n }\n\n isMonotoneous() {\n if ( this.waveform ) {\n return this.waveform.isMonotoneous();\n }\n\n return !!this.xmonotoneous;\n }\n\n findLocalMinMax( xRef, xWithin, type ) {\n\n if ( !this.waveform ) {\n return false;\n }\n\n return this.waveform.findLocalMinMax( xRef, xWithin, type );\n }\n\n}\n\nfunction drawMarkerXY( graph, family, x, y, markerDom ) {\n\n if ( !family ) {\n return;\n }\n\n if ( graph.options.markersIndependant ) {\n var dom = graph.getMarkerDomIndependent( graph.counter2, family );\n var p = 'M ' + x + ' ' + y + ' ';\n p += family.markerPath + ' ';\n\n dom.setAttribute( 'd', p );\n }\n\n markerDom.path = markerDom.path || '';\n markerDom.path += 'M ' + x + ' ' + y + ' ';\n markerDom.path += family.markerPath + ' ';\n}\n\nutil.mix( SerieLine, ErrorBarMixin );\n\nexport default SerieLine;","var Serie3DMixin = {\n\n /**\n * Returns the x position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The x position in px corresponding to the x value\n */\n getX: function( val ) {\n return ( ( val = this.getXAxis().getPx( val ) ) - val % 0.2 ) + this.getXAxis().getZProj( this.options.zpos );\n },\n\n /**\n * Returns the y position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie3DMixin\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The y position in px corresponding to the y value\n */\n getY: function( val ) {\n return ( ( val = this.getYAxis().getPx( val ) ) - val % 0.2 ) + this.getYAxis().getZProj( this.options.zpos );\n },\n\n getZPos: function() {\n return this.options.zpos;\n },\n\n /**\n * @returns {Number} Lowest x value of the serie's data\n * @memberof Serie\n */\n getMinX: function( useZValues ) {\n if ( !useZValues ) {\n return this.minX;\n }\n\n return getZCorrectedValue( this, true, true );\n },\n\n /**\n * @returns {Number} Highest x value of the serie's data\n * @memberof Serie\n */\n getMaxX: function( useZValues ) {\n\n if ( !useZValues ) {\n return this.maxX;\n }\n return getZCorrectedValue( this, true, false );\n },\n\n /**\n * @returns {Number} Lowest y value of the serie's data\n * @memberof Serie\n */\n getMinY: function( useZValues ) {\n\n if ( !useZValues ) {\n return this.minY;\n }\n return getZCorrectedValue( this, false, true );\n },\n\n /**\n * @returns {Number} Highest y value of the serie's data\n * @memberof Serie\n */\n getMaxY: function( useZValues ) {\n\n if ( !useZValues ) {\n return this.maxY;\n }\n return getZCorrectedValue( this, false, false );\n }\n\n};\n\nfunction getZCorrectedValue( serie, x, min ) {\n\n let i, l, data, val, valFinal;\n let wf = serie.getWaveforms();\n\n for ( let wave of wf ) {\n\n i = 0;\n l = wave.getLength();\n data = wave.getData();\n\n for ( ; i < l; i += 1 ) {\n\n if ( x ) {\n val = serie.getXAxis().getVal( serie.getX( wave.getX( i, true ) ) );\n } else {\n val = serie.getYAxis().getVal( serie.getY( data[ i ] ) );\n }\n\n if ( i == 0 ) {\n valFinal = val;\n } else {\n\n if ( min ) {\n valFinal = Math.min( valFinal, val );\n } else {\n valFinal = Math.max( valFinal, val );\n }\n }\n }\n }\n return valFinal;\n}\n\nexport default Serie3DMixin;","import Graph from '../graph.core.js';\nimport Serie from './graph.serie.line.js';\nimport Waveform from '../util/waveform.js';\nimport Serie3DMixin from '../mixins/graph.mixin.serie3d.js';\nimport * as util from '../graph.util.js';\n\n/**\n * Serie line with 3D projection\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends SerieLine\n */\nclass SerieLine3D extends Serie {\n\n static defaults() {\n return {\n zpos: 0\n };\n }\n constructor( graph, name, options ) {\n super( ...arguments );\n\n }\n\n /**\n * Sets the z-position\n * @memberof SerieLine3D\n * @param {Number} zPos - The position in the z axis\n */\n setZPos( zPos ) {\n this.options.zpos = zPos;\n return this;\n }\n\n setz() {\n return this.setZPos( ...arguments );\n }\n}\n\nutil.mix( SerieLine3D, Serie3DMixin );\nexport default SerieLine3D;","import * as util from '../graph.util.js';\nimport Serie from './graph.serie.line.js';\nimport ErrorBarMixin from '../mixins/graph.mixin.errorbars.js';\n\n/**\n * Represents a bar serie.\n Needs to be used exclusively with a bar axis ({@link AxisXBar}).\n Supports error bars, line color, line width, fill color, fill opacity.\n * @example graph.newSerie(\"serieName\", { fillColor: 'red', fillOpacity: 0.2 }, \"bar\" );\n * @extends Serie\n */\nclass SerieBar extends Serie {\n\n constructor( graph, name, options ) {\n\n super( ...arguments );\n\n this.groupMain = document.createElementNS( this.graph.ns, 'g' );\n\n this.pathDom = document.createElementNS( this.graph.ns, 'path' );\n this.groupMain.appendChild( this.pathDom );\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n lineWidth: this.options.lineWidth,\n fillColor: this.options.fillColor,\n fillOpacity: this.options.fillOpacity,\n markers: this.options.markers\n };\n\n }\n\n /**\n * Sets the data of the bar serie\n * @param {Object} data\n * @example serie.setData( { \"cat1\": val1, \"cat2\": val2, \"cat4\": val4 } );\n * @return {SerieBar} The current serie instance\n */\n setData( data ) {\n\n this.data = data;\n this.minY = Number.MAX_SAFE_INTEGER;\n this.maxY = Number.MIN_SAFE_INTEGER;\n\n for ( var i in this.data ) {\n this._checkY( this.data[ i ] );\n }\n\n return this;\n }\n\n /**\n * Sets the fill color\n */\n setFillColor( fillColor, selectionType, applyToSelected ) {\n\n selectionType = selectionType || 'unselected';\n this.styles[ selectionType ] = this.styles[ selectionType ] || {};\n this.styles[ selectionType ].fillColor = fillColor;\n\n if ( applyToSelected ) {\n this.setFillColor( fillColor, 'selected' );\n }\n\n this.styleHasChanged( selectionType );\n\n return this;\n }\n\n /**\n * Returns the fill color\n */\n getFillColor( selectionType ) {\n return this.getStyle( selectionType ).fillColor;\n }\n\n /*\n * @memberof SerieBar\n */\n setFillOpacity( opacity, selectionType, applyToSelected ) {\n\n selectionType = selectionType || 'unselected';\n this.styles[ selectionType ] = this.styles[ selectionType ] || {};\n this.styles[ selectionType ].fillOpacity = opacity;\n\n if ( applyToSelected ) {\n this.setLineWidth( opacity, 'selected' );\n }\n\n this.styleHasChanged( selectionType );\n\n return this;\n }\n\n getFillOpacity( selectionType ) {\n\n return this.getStyle( selectionType ).fillOpacity || 1;\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n */\n applyLineStyles() {\n this.applyLineStyle( this.pathDom );\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieBar\n */\n applyLineStyle( line ) {\n\n line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute( 'stroke-width', this.getLineWidth() );\n if ( this.getLineDashArray() ) {\n line.setAttribute( 'stroke-dasharray', this.getLineDashArray() );\n } else {\n line.removeAttribute( 'stroke-dasharray' );\n }\n line.setAttribute( 'fill', this.getFillColor() );\n line.setAttribute( 'fill-opacity', this.getFillOpacity() || 1 );\n }\n\n draw() {\n\n var path = '';\n var categoryNumber,\n position;\n\n if ( this.error ) {\n this.errorDrawInit();\n }\n\n for ( var i in this.data ) {\n\n if ( !this.categoryIndices[ i ] ) {\n continue;\n }\n\n path += 'M ' +\n this.getXAxis().getPos( this.categoryIndices[ i ] ) +\n ' ' +\n this.getYAxis().getPos( 0 ) +\n ' V ' +\n this.getYAxis().getPos( this.data[ i ] ) +\n ' h ' +\n this.getXAxis().getDeltaPx( 1 / this.nbCategories ) +\n ' V ' +\n this.getYAxis().getPos( 0 );\n\n if ( this.error ) {\n this.errorAddPointBarChart( i, this.data[ i ], this.getXAxis().getPos( this.categoryIndices[ i ] + 0.5 / this.nbCategories ), this.getYAxis().getPos( this.data[ i ] ) );\n }\n }\n\n if ( this.error ) {\n this.errorDraw();\n }\n\n this.pathDom.setAttribute( 'd', path );\n this.applyLineStyles();\n }\n\n // Markers now allowed\n setMarkers() {}\n\n getUsedCategories() {\n return Object.keys( this.data );\n }\n\n}\n\nexport default SerieBar;","import Serie from './graph.serie.js';\nimport {\n extend,\n guid,\n throwError,\n emptyDom\n}\nfrom '../graph.util.js';\n\n/**\n * @static\n * @extends Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\nclass SerieBox extends Serie {\n\n static\n default () {\n return {\n orientation: 'y',\n maxBoxWidth: 20,\n\n defaultStyle: {\n\n meanLineColor: 'rgb( 100, 0, 0 )',\n meanLineWidth: 2,\n\n boxAboveLineWidth: 1,\n boxAboveLineColor: 'rgb( 0, 0, 0 )',\n boxAboveFillColor: 'transparent',\n boxAboveFillOpacity: 1,\n boxBelowLineWidth: 1,\n boxBelowLineColor: 'rgb( 0, 0, 0 )',\n boxBelowFillColor: 'transparent',\n boxBelowFillOpacity: 1,\n\n barAboveLineColor: 'rgba( 0, 0, 0, 1 )',\n barAboveLineWidth: 1,\n barBelowLineColor: 'rgba( 0, 0, 0, 1 )',\n barBelowLineWidth: 1,\n\n outlierLineWidth: 1,\n outlierLineColor: 'rgb( 255, 255, 255 )',\n outlierFillColor: 'rgb( 0, 0, 0 )',\n outlierFillOpacity: 1\n }\n };\n }\n\n constructor( graph, name, options ) {\n\n super( ...arguments );\n\n this.groupMain = document.createElementNS( this.graph.ns, 'g' );\n\n this.pathDom = document.createElementNS( this.graph.ns, 'path' );\n this.groupMain.appendChild( this.pathDom );\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = this.options.defaultStyle;\n\n }\n\n /**\n * Sets the data of the bar serie\n * @param {Object} data\n * @example serie.setData( [ { x: 'cat', Q2: valMean, Q1: valBoxMin, Q3: valBoxMax, whiskers: [ val1, val2 ], outliers: [ ...yList ] } ] );\n * @return {SerieBar} The current serie instance\n */\n setData( data, noRescale ) {\n\n this.data = data;\n\n if ( !Array.isArray( data ) ) {\n return;\n }\n\n let axisref, axisval, methodref, methodval, blnX;\n\n if ( this.options.orientation == 'y' ) {\n axisref = this.getXAxis();\n axisval = this.getYAxis();\n methodref = this._checkX.bind( this );\n methodval = this._checkY.bind( this );\n blnX = true;\n\n this.minY = data[ 0 ].Q2;\n this.maxY = data[ 0 ].Q2;\n this.maxX = data[ 0 ].x;\n this.minX = data[ 0 ].x;\n\n } else {\n axisref = this.getYAxis();\n axisval = this.getXAxis();\n methodref = this._checkY.bind( this );\n methodval = this._checkX.bind( this );\n blnX = false;\n\n this.minX = data[ 0 ].Q2;\n this.maxX = data[ 0 ].Q2;\n this.maxY = data[ 0 ].y;\n this.minY = data[ 0 ].y;\n\n }\n\n if ( noRescale ) {\n methodref = function() {};\n methodval = function() {};\n }\n\n if ( !axisref || !axisval ) {\n throwError( 'Error in setting data of the box serie. The X and Y axes must be set beforehand' );\n }\n\n for ( var i in this.data ) {\n\n if ( blnX ) {\n methodref( this.data[ i ].x );\n this.data[ i ].pos = this.data[ i ].x;\n } else {\n methodref( this.data[ i ].y );\n this.data[ i ].pos = this.data[ i ].y;\n }\n\n if ( this.data[ i ].Q3 ) {\n\n methodval( this.data[ i ].Q3 );\n\n }\n\n if ( this.data[ i ].Q1 ) {\n methodval( this.data[ i ].Q1 );\n }\n\n if ( this.data[ i ].whiskers ) {\n\n if ( Array.isArray( this.data[ i ].whiskers ) ) {\n\n if ( this.data[ i ].whiskers.length > 0 ) {\n methodval( this.data[ i ].whiskers[ 0 ] );\n }\n\n if ( this.data[ i ].whiskers.length > 1 ) {\n methodval( this.data[ i ].whiskers[ 1 ] );\n }\n\n } else {\n methodval( this.data[ i ].whiskers );\n this.data[ i ].whiskers = [ this.data[ i ].whiskers ];\n }\n\n } else {\n this.data[ i ].whiskers = [];\n }\n\n if ( Array.isArray( this.data[ i ].outliers ) ) {\n this.data[ i ].outliers.map( ( val ) => methodval( val ) );\n } else {\n this.data[ i ].outliers = [];\n }\n }\n\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n _style( type, styleValue, selectionType = 'unselected', applyToSelected = false ) {\n this.styles[ selectionType ] = this.styles[ selectionType ] || {};\n this.styles[ selectionType ][ type ] = styleValue;\n\n if ( applyToSelected ) {\n this._set( type, styleValue, 'selected' );\n }\n\n this.styleHasChanged( selectionType );\n return this;\n }\n\n _gstyle( type, selectionType ) {\n return this.getStyle( selectionType )[ type ];\n }\n\n /**\n * Retrives a selection object\n * @param {String} [ selectionType = \"unselected\" ] - The selection type\n * @returns {Object} The selection object\n */\n getStyle( selectionType = 'unselected' ) {\n\n return this.styles[ selectionType ] || {};\n }\n\n /**\n * Sets the mean line color\n * @param {String} color - The mean line color\n * @returns {SerieBox} The current serie instance\n */\n setMeanLineColor() {\n return this._style( 'meanLineColor', ...arguments );\n }\n\n /**\n * Returns the mean line color\n * @return {String} The mean line color\n */\n getMeanLineColor() {\n return this._gstyle( 'meanLineColor', ...arguments );\n }\n\n setStyle( style, selectionType = 'unselected' ) {\n //console.log( style, selectionType );\n this.styles[ selectionType ] = extend( {}, this.default().defaultStyle, this.styles.unselected, style );\n this.styleHasChanged( selectionType );\n }\n\n /**\n * Sets the mean line width\n * @param {Number} width - The line width\n * @returns {SerieBox} The current serie instance\n */\n setMeanLineWidth() {\n return this._style( 'meanLineWidth', ...arguments );\n }\n\n /**\n * Returns the mean line width\n * @return {Number} The mean line width\n */\n getMeanLineWidth() {\n return this._gstyle( 'meanLineWidth', ...arguments );\n }\n\n /**\n * Sets the box line color\n * @param {Number} color - The color of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveLineColor() {\n return this._style( 'boxAboveLineColor', ...arguments );\n }\n\n /**\n * Returns the box line color\n * @return {String} The line color of the box above the median\n */\n getBoxAboveLineColor() {\n return this._gstyle( 'boxAboveLineColor', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {Number} color - The color of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowLineColor() {\n return this._style( 'boxBelowLineColor', ...arguments );\n }\n\n /**\n * Returns the fill color\n * @return {String} The line color of the box below the median\n */\n getBoxBelowLineColor() {\n return this._gstyle( 'boxBelowLineColor', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The contour width of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveLineWidth() {\n return this._style( 'boxAboveLineWidth', ...arguments );\n }\n\n /**\n * Returns the line width of the box above the median\n * @return {Number} The line width of the box above the median\n */\n getBoxAboveLineWidth() {\n return this._gstyle( 'boxAboveLineWidth', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The contour width of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowLineWidth() {\n return this._style( 'boxBelowLineWidth', ...arguments );\n }\n\n /**\n * Returns the line width of the box below the median\n * @return {Number} The line width of the box below the median\n */\n getBoxBelowLineWidth() {\n return this._gstyle( 'boxBelowLineWidth', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The fill color of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveFillColor() {\n return this._style( 'boxAboveFillColor', ...arguments );\n }\n\n /**\n * Returns the fill color of the box above the median\n * @return {String} The fill color of the box above the median\n */\n getBoxAboveFillColor() {\n return this._gstyle( 'boxAboveFillColor', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The fill color of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowFillColor() {\n return this._style( 'boxBelowFillColor', ...arguments );\n }\n\n /**\n * Returns the fill color of the box below the median\n * @return {String} The fill color of the box below the median\n */\n getBoxBelowFillColor() {\n return this._gstyle( 'boxBelowFillColor', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {Number} opacity - The fill opacity of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveFillOpacity() {\n return this._style( 'boxAboveFillOpacity', ...arguments );\n }\n\n /**\n * Returns the fill opacity of the box above the median\n * @return {Number} The fill opacity of the box above the median\n */\n getBoxAboveFillOpacity() {\n return this._gstyle( 'boxAboveFillOpacity', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {Number} opacity - The fill opacity of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowFillOpacity() {\n return this._style( 'boxBelowFillOpacity', ...arguments );\n }\n\n /**\n * Returns the fill opacity of the box below the median\n * @return {Number} The fill opacity of the box below the median\n */\n getBoxBelowFillOpacity() {\n return this._gstyle( 'boxBelowFillOpacity', ...arguments );\n }\n\n /**\n * Sets the whisker color\n * @param {String} color - The line color of the whisker above the median\n * @returns {SerieBox} The current serie instance\n */\n setBarAboveLineColor() {\n return this._style( 'barAboveLineColor', ...arguments );\n }\n\n /**\n * Returns the line color of the whisker above the median\n * @return {String} The line color of the whisker above the median\n */\n getBarAboveLineColor() {\n return this._gstyle( 'barAboveLineColor', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The line color of the whisker below the median\n * @returns {SerieBox} The current serie instance\n */\n setBarBelowLineColor() {\n return this._style( 'barBelowLineColor', ...arguments );\n }\n\n /**\n * Returns the line color of the whisker below the median\n * @return {String} The line color of the whisker below the median\n */\n getBarBelowLineColor() {\n return this._gstyle( 'barBelowLineColor', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The line width of the whisker above the median\n * @returns {SerieBox} The current serie instance\n */\n setBarAboveLineWidth() {\n return this._style( 'barAboveLineWidth', ...arguments );\n }\n\n /**\n * Returns the line width of the whisker above the median\n * @return {Number} The line width of the whisker above the median\n */\n getBarAboveLineWidth() {\n return this._gstyle( 'barAboveLineWidth', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The line width of the whisker below the median\n * @returns {SerieBox} The current serie instance\n */\n setBarBelowLineWidth() {\n return this._style( 'barBelowLineWidth', ...arguments );\n }\n\n /**\n * Returns the line width of the whisker below the median\n * @return {Number} The line width of the whisker below the median\n */\n getBarBelowLineWidth() {\n return this._gstyle( 'barBelowLineWidth', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The outlier stroke color\n * @returns {SerieBox} The current serie instance\n */\n setOutlierLineColor() {\n return this._style( 'outlierLineColor', ...arguments );\n }\n\n /**\n * Returns the line color of the outliers\n * @return {String} The line color of the outliers\n */\n getOutlierLineColor() {\n return this._gstyle( 'outlierLineColor', ...arguments );\n }\n\n /**\n * Sets the stroke width\n * @param {Number} width - The outlier stroke width\n * @returns {SerieBox} The current serie instance\n */\n setOutlierLineWidth() {\n return this._style( 'outlierLineWidth', ...arguments );\n }\n\n /**\n * Returns the line width of the outliers\n * @return {Number} The line width of the outliers\n */\n getOutlierLineWidth() {\n return this._gstyle( 'outlierLineWidth', ...arguments );\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The outlier fill color\n * @returns {SerieBox} The current serie instance\n */\n setOutlierFillColor() {\n return this._style( 'outlierFillColor', ...arguments );\n }\n\n /**\n * Returns the fill color of the outliers\n * @return {String} The fill color of the outliers\n */\n getOutlierFillColor() {\n return this._gstyle( 'outlierFillColor', ...arguments );\n }\n\n /**\n * Sets the outlier fill opacity\n * @param {Number} opacity - The outlier fill opacity\n * @returns {SerieBox} The current serie instance\n */\n setOutlierFillOpacity() {\n return this._style( 'outlierFillOpacity', ...arguments );\n }\n\n /**\n * Returns the fill opacity of the outliers\n * @return {Number} The fill opacity of the outliers\n */\n getOutlierFillOpacity() {\n return this._gstyle( 'outlierFillOpacity', ...arguments );\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n * @returns {SerieBox} The current serie instance\n */\n applyLineStyles() {\n this.applyLineStyle( this.pathDom );\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieBar\n */\n applyLineStyle( line ) {\n\n line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute( 'stroke-width', this.getLineWidth() );\n line.removeAttribute( 'stroke-dasharray' );\n line.setAttribute( 'fill', this.getFillColor() );\n line.setAttribute( 'fill-opacity', this.getFillOpacity() || 1 );\n }\n\n draw() {\n\n if ( !this.data ) {\n return;\n }\n\n let position;\n let axis = this.options.orientation == 'y' ? this.getYAxis() : this.getXAxis();\n let axis2 = this.options.orientation == 'y' ? this.getXAxis() : this.getYAxis();\n let boxOtherDimension; // width or height of the box\n let useCategories = false;\n let mean, boxAbove, boxBelow, barAbove, barBelow, outliers, posAbove, posBelow;\n let categoryNumber;\n\n emptyDom( this.groupMain );\n\n if ( axis2.getType() == 'category' ) {\n\n boxOtherDimension = axis2.getRelPx( 0.8 / ( this.nbCategories ) );\n useCategories = true;\n\n } else {\n // Get all the spacing and determine the smallest one\n boxOtherDimension = this.options.maxBoxWidth;\n // console.log( boxOtherDimension );\n for ( var i = 0, l = this.data.length; i < l - 1; i++ ) {\n\n // console.log( Math.abs( axis.getPx( this.data[ i + 1 ].pos ) - axis.getPx( this.data[ i ].pos ) ), axis.getPx( this.data[ i + 1 ].pos ), axis.getPx( this.data[ i ].pos ) );\n boxOtherDimension = Math.min( boxOtherDimension, Math.abs( axis2.getPx( this.data[ i + 1 ].pos ) - axis2.getPx( this.data[ i ].pos ) ) );\n }\n // console.log( boxOtherDimension );\n }\n\n for ( var i = 0, l = this.data.length; i < l; i++ ) {\n\n if ( axis2.getType() == 'category' ) {\n\n let cat = this.options.orientation == 'y' ? this.data[ i ].x : this.data[ i ].y;\n\n if ( !this.categoryIndices.hasOwnProperty( cat ) ) {\n\n if ( Array.isArray( this._linkedToScatterSeries ) ) {\n for ( let scatter_serie of this._linkedToScatterSeries ) {\n\n if ( scatter_serie.categoryIndices.hasOwnProperty( cat ) ) {\n\n position = [ axis2.getPos( scatter_serie.categoryIndices[ cat ] ) + 1.2 * boxOtherDimension / 2 ];\n\n if ( this.options.orientation == 'y' ) {\n axis = scatter_serie.getYAxis();\n } else {\n axis = scatter_serie.getXAxis();\n }\n\n break;\n }\n }\n }\n } else {\n\n position = [ axis2.getPos( this.categoryIndices[ cat ] ) + 1.2 * boxOtherDimension / 2 ];\n\n }\n\n } else {\n\n position = [ axis2.getPos( this.options.orientation == 'y' ? this.data[ i ].x : this.data[ i ].y ), boxOtherDimension ];\n\n }\n\n mean = axis.getPos( this.data[ i ].Q2 );\n boxAbove = axis.getPos( this.data[ i ].Q3 );\n boxBelow = axis.getPos( this.data[ i ].Q1 );\n\n this.data[ i ].whiskers.map( ( val ) => {\n\n if ( val < this.data[ i ].Q1 ) {\n barBelow = axis.getPos( val );\n } else {\n barAbove = axis.getPos( val );\n }\n } );\n\n outliers = this.data[ i ].outliers.map( ( val ) => axis.getPos( val ) );\n\n var lineMean = document.createElementNS( this.graph.ns, 'line' );\n\n this.applyMeanStyle( lineMean );\n\n var rectAbove = document.createElementNS( this.graph.ns, 'rect' );\n var rectBelow = document.createElementNS( this.graph.ns, 'rect' );\n\n if ( this.options.orientation == 'y' ) {\n\n rectAbove.setAttribute( 'width', boxOtherDimension );\n rectAbove.setAttribute( 'x', position[ 0 ] - boxOtherDimension / 2 );\n\n rectBelow.setAttribute( 'width', boxOtherDimension );\n rectBelow.setAttribute( 'x', position[ 0 ] - boxOtherDimension / 2 );\n\n lineMean.setAttribute( 'x1', position[ 0 ] - boxOtherDimension / 2 );\n lineMean.setAttribute( 'x2', position[ 0 ] + boxOtherDimension / 2 );\n lineMean.setAttribute( 'y1', mean );\n lineMean.setAttribute( 'y2', mean );\n\n } else {\n\n rectAbove.setAttribute( 'height', boxOtherDimension );\n rectAbove.setAttribute( 'y', position[ 0 ] - boxOtherDimension / 2 );\n\n rectBelow.setAttribute( 'height', boxOtherDimension );\n rectBelow.setAttribute( 'y', position[ 0 ] - boxOtherDimension / 2 );\n\n lineMean.setAttribute( 'y1', position[ 0 ] - boxOtherDimension / 2 );\n lineMean.setAttribute( 'y2', position[ 0 ] + boxOtherDimension / 2 );\n lineMean.setAttribute( 'x1', mean );\n lineMean.setAttribute( 'x2', mean );\n }\n\n this.boxPos( rectAbove, mean, boxAbove, this.options.orientation == 'x' );\n this.boxPos( rectBelow, mean, boxBelow, this.options.orientation == 'x' );\n\n this.applyBoxStyle( rectAbove, rectBelow );\n\n var whiskerAbove = document.createElementNS( this.graph.ns, 'line' );\n var whiskerBelow = document.createElementNS( this.graph.ns, 'line' );\n\n if ( this.options.orientation == 'y' ) {\n\n if ( barAbove !== undefined ) {\n whiskerAbove.setAttribute( 'y1', boxAbove );\n whiskerAbove.setAttribute( 'y2', barAbove );\n whiskerAbove.setAttribute( 'x1', position[ 0 ] );\n whiskerAbove.setAttribute( 'x2', position[ 0 ] );\n }\n\n if ( barBelow !== undefined ) {\n whiskerBelow.setAttribute( 'y1', boxBelow );\n whiskerBelow.setAttribute( 'y2', barBelow );\n whiskerBelow.setAttribute( 'x1', position[ 0 ] );\n whiskerBelow.setAttribute( 'x2', position[ 0 ] );\n }\n\n } else {\n\n if ( barAbove !== undefined ) {\n whiskerAbove.setAttribute( 'x1', boxAbove );\n whiskerAbove.setAttribute( 'x2', barAbove );\n whiskerAbove.setAttribute( 'y1', position[ 0 ] );\n whiskerAbove.setAttribute( 'y2', position[ 0 ] );\n }\n\n if ( barBelow !== undefined ) {\n whiskerBelow.setAttribute( 'x1', boxBelow );\n whiskerBelow.setAttribute( 'x2', barBelow );\n whiskerBelow.setAttribute( 'y1', position[ 0 ] );\n whiskerBelow.setAttribute( 'y2', position[ 0 ] );\n }\n }\n\n outliers.map( ( outliervalue ) => {\n\n let outlier = document.createElementNS( this.graph.ns, 'circle' );\n\n outlier.setAttribute( 'r', 2 );\n\n if ( this.options.orientation == 'y' ) {\n\n outlier.setAttribute( 'cx', position[ 0 ] );\n outlier.setAttribute( 'cy', outliervalue );\n\n } else {\n\n outlier.setAttribute( 'cy', position[ 0 ] );\n outlier.setAttribute( 'cx', outliervalue );\n }\n\n this.setOutlierStyle( outlier );\n\n this.groupMain.appendChild( outlier );\n } );\n\n if ( barAbove !== undefined ) {\n this.groupMain.appendChild( whiskerAbove );\n }\n\n if ( barBelow !== undefined ) {\n this.groupMain.appendChild( whiskerBelow );\n }\n\n if ( boxAbove !== undefined ) {\n this.groupMain.appendChild( rectAbove );\n }\n\n if ( boxBelow !== undefined ) {\n this.groupMain.appendChild( rectBelow );\n }\n\n this.groupMain.appendChild( lineMean );\n\n this.applyWhiskerStyle( whiskerAbove, whiskerBelow );\n }\n }\n\n applyBoxStyle( above, below ) {\n\n above.setAttribute( 'stroke', this.getBoxAboveLineColor() );\n above.setAttribute( 'stroke-width', this.getBoxAboveLineWidth() );\n\n if ( this.getBoxAboveFillColor() !== undefined ) {\n above.setAttribute( 'fill', this.getBoxAboveFillColor() );\n }\n if ( this.getBoxAboveFillOpacity() !== undefined ) {\n above.setAttribute( 'fill-opacity', this.getBoxAboveFillOpacity() );\n }\n\n below.setAttribute( 'stroke', this.getBoxBelowLineColor() );\n below.setAttribute( 'stroke-width', this.getBoxBelowLineWidth() );\n\n if ( this.getBoxBelowFillColor() !== undefined ) {\n below.setAttribute( 'fill', this.getBoxBelowFillColor() );\n }\n if ( this.getBoxAboveFillOpacity() !== undefined ) {\n below.setAttribute( 'fill-opacity', this.getBoxBelowFillOpacity() );\n }\n }\n\n applyWhiskerStyle( above, below ) {\n\n above.setAttribute( 'stroke', this.getBarAboveLineColor() );\n above.setAttribute( 'stroke-width', this.getBarAboveLineWidth() );\n\n below.setAttribute( 'stroke', this.getBarBelowLineColor() );\n below.setAttribute( 'stroke-width', this.getBarBelowLineWidth() );\n }\n\n applyMeanStyle( line ) {\n\n line.setAttribute( 'stroke', this.getMeanLineColor() );\n line.setAttribute( 'stroke-width', this.getMeanLineWidth() );\n }\n\n setOutlierStyle( outlier ) {\n\n outlier.setAttribute( 'stroke', this.getOutlierLineColor() );\n outlier.setAttribute( 'stroke-width', this.getOutlierLineWidth() );\n\n if ( this.getBoxBelowFillColor() !== undefined ) {\n outlier.setAttribute( 'fill', this.getOutlierFillColor() );\n }\n if ( this.getBoxAboveFillOpacity() !== undefined ) {\n outlier.setAttribute( 'fill-opacity', this.getOutlierFillOpacity() );\n }\n }\n /**\n * Returns the index of a category based on its name\n * @param {String} name - The name of the category\n */\n getCategoryIndex( name ) {\n\n if ( !this.categories ) {\n throw new Error( 'No categories were defined. Probably axis.setSeries was not called' );\n }\n\n for ( var i = 0; i < this.categories.length; i++ ) {\n\n if ( this.categories[ i ].name == name ) {\n return i;\n }\n }\n\n return false;\n }\n\n // Markers now allowed\n setMarkers() {}\n\n boxPos( box, mean, extremity, blnX ) {\n\n if ( mean > extremity ) {\n\n box.setAttribute( blnX ? 'x' : 'y', extremity );\n box.setAttribute( blnX ? 'width' : 'height', mean - extremity );\n\n } else {\n\n box.setAttribute( blnX ? 'x' : 'y', mean );\n box.setAttribute( blnX ? 'width' : 'height', extremity - mean );\n }\n }\n\n getUsedCategories() {\n let xymode = this.options.orientation == 'y' ? 'x' : 'y';\n\n let categories = this.data.map( ( d ) => d[ xymode ] );\n\n if ( Array.isArray( this._linkedToScatterSeries ) ) {\n this._linkedToScatterSeries.map( ( scatter_serie ) => {\n\n scatter_serie.getUsedCategories().map( ( scatter_serie_cat ) => {\n let index;\n if ( ( index = categories.indexOf( scatter_serie_cat ) ) > -1 ) {\n categories.splice( index, 1 );\n }\n\n } );\n } );\n\n }\n\n return categories;\n }\n\n linkToScatterSerie( ...series ) {\n this._linkedToScatterSeries = series;\n }\n}\n\nexport default SerieBox;","import SerieLine from './graph.serie.line.js';\nimport * as util from '../graph.util.js';\nimport ErrorBarMixin from '../mixins/graph.mixin.errorbars.js';\n\n/**\n * Colored serie line\n * @example graph.newSerie( name, options, \"color\" );\n * @see Graph#newSerie\n * @augments SerieLine\n */\nclass SerieLineColor extends SerieLine {\n\n constructor( graph, name, options ) {\n\n super( ...arguments );\n this.lines = this.lines || {};\n }\n\n setColors( colors ) {\n this.colors = colors;\n }\n\n _draw() {\n\n var self = this,\n data = this._dataToUse,\n toBreak,\n i = 0,\n j,\n k,\n m,\n x,\n y,\n k,\n o,\n lastX = false,\n lastY = false,\n xpx,\n ypx,\n xpx2,\n ypx2,\n xAxis = this.getXAxis(),\n yAxis = this.getYAxis(),\n xMin = xAxis.getCurrentMin(),\n yMin = yAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n yMax = yAxis.getCurrentMax();\n\n // Y crossing\n var yLeftCrossingRatio,\n yLeftCrossing,\n yRightCrossingRatio,\n yRightCrossing,\n xTopCrossingRatio,\n xTopCrossing,\n xBottomCrossingRatio,\n xBottomCrossing;\n\n var incrXFlip = 0;\n var incrYFlip = 1;\n\n var pointOutside = false;\n var lastPointOutside = false;\n var pointOnAxis;\n\n this.eraseLines();\n\n if ( this.isFlipped() ) {\n incrXFlip = 1;\n incrYFlip = 0;\n }\n\n this.currentLine = '';\n m = this.waveform.getLength();\n\n for ( j = 0; j < m; j += 2 ) {\n\n x = this.waveform.getX( j );\n y = this.waveform.getY( j );\n\n if ( ( x < xMin && lastX < xMin ) || ( x > xMax && lastX > xMax ) || ( ( ( y < yMin && lastY < yMin ) || ( y > yMax && lastY > yMax ) ) && !this.options.lineToZero ) ) {\n lastX = x;\n lastY = y;\n lastPointOutside = true;\n continue;\n }\n\n this.counter2 = j;\n\n if ( this.markersShown() ) {\n this.getMarkerCurrentFamily( this.counter2 );\n }\n\n xpx2 = this.getX( x );\n ypx2 = this.getY( y );\n\n if ( xpx2 == xpx && ypx2 == ypx ) {\n continue;\n }\n\n pointOutside = ( x < xMin || y < yMin || x > xMax || y > yMax );\n /*\n if ( this.options.lineToZero ) {\n pointOutside = ( x < xMin || x > xMax );\n\n if ( pointOutside ) {\n continue;\n }\n } else {\n\n if ( pointOutside || lastPointOutside ) {\n\n if ( ( lastX === false || lastY === false ) && !lastPointOutside ) {\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n\n } else {\n\n pointOnAxis = [];\n // Y crossing\n yLeftCrossingRatio = ( x - xMin ) / ( x - lastX );\n yLeftCrossing = y - yLeftCrossingRatio * ( y - lastY );\n yRightCrossingRatio = ( x - xMax ) / ( x - lastX );\n yRightCrossing = y - yRightCrossingRatio * ( y - lastY );\n\n // X crossing\n xTopCrossingRatio = ( y - yMin ) / ( y - lastY );\n xTopCrossing = x - xTopCrossingRatio * ( x - lastX );\n xBottomCrossingRatio = ( y - yMax ) / ( y - lastY );\n xBottomCrossing = x - xBottomCrossingRatio * ( x - lastX );\n\n if ( yLeftCrossingRatio < 1 && yLeftCrossingRatio > 0 && yLeftCrossing !== false && yLeftCrossing < yMax && yLeftCrossing > yMin ) {\n pointOnAxis.push( [ xMin, yLeftCrossing ] );\n }\n\n if ( yRightCrossingRatio < 1 && yRightCrossingRatio > 0 && yRightCrossing !== false && yRightCrossing < yMax && yRightCrossing > yMin ) {\n pointOnAxis.push( [ xMax, yRightCrossing ] );\n }\n\n if ( xTopCrossingRatio < 1 && xTopCrossingRatio > 0 && xTopCrossing !== false && xTopCrossing < xMax && xTopCrossing > xMin ) {\n pointOnAxis.push( [ xTopCrossing, yMin ] );\n }\n\n if ( xBottomCrossingRatio < 1 && xBottomCrossingRatio > 0 && xBottomCrossing !== false && xBottomCrossing < xMax && xBottomCrossing > xMin ) {\n pointOnAxis.push( [ xBottomCrossing, yMax ] );\n }\n\n if ( pointOnAxis.length > 0 ) {\n\n if ( !pointOutside ) { // We were outside and now go inside\n\n if ( pointOnAxis.length > 1 ) {\n console.error( \"Programmation error. Please e-mail me.\" );\n console.log( pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY );\n }\n\n this._createLine();\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n this._addPoint( xpx2, ypx2, lastX, lastY, false, false, true );\n\n } else if ( !lastPointOutside ) { // We were inside and now go outside\n\n if ( pointOnAxis.length > 1 ) {\n console.error( \"Programmation error. Please e-mail me.\" );\n console.log( pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY );\n }\n\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n\n } else {\n\n // No crossing: do nothing\n if ( pointOnAxis.length == 2 ) {\n this._createLine();\n\n this._addPoint( this.getX( pointOnAxis[ 0 ][ 0 ] ), this.getY( pointOnAxis[ 0 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n this._addPoint( this.getX( pointOnAxis[ 1 ][ 0 ] ), this.getY( pointOnAxis[ 1 ][ 1 ] ), pointOnAxis[ 0 ][ 0 ], pointOnAxis[ 0 ][ 1 ], false, false, false );\n }\n\n }\n } else if ( !pointOutside ) {\n this._addPoint( xpx2, ypx2, lastX, lastY, j, false, false );\n }\n }\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n\n lastPointOutside = pointOutside;\n\n continue;\n }\n\n }*/\n\n if ( isNaN( xpx2 ) || isNaN( ypx2 ) ) {\n if ( this.counter > 0 ) {\n\n // this._createLine();\n }\n continue;\n }\n\n var color = this.colors[ j ];\n\n this._addPoint( xpx2, ypx2, x, y, xpx, ypx, lastX, lastY, j, color, false, true );\n\n xpx = xpx2;\n ypx = ypx2;\n\n lastX = x;\n lastY = y;\n }\n\n this.latchLines();\n\n if ( this._tracker ) {\n\n if ( this._trackerDom ) {\n this._trackerDom.remove();\n }\n\n var cloned = this.groupLines.cloneNode( true );\n this.groupMain.appendChild( cloned );\n\n for ( var i = 0, l = cloned.children.length; i < l; i++ ) {\n\n cloned.children[ i ].setAttribute( 'stroke', 'transparent' );\n cloned.children[ i ].setAttribute( 'stroke-width', '25px' );\n cloned.children[ i ].setAttribute( 'pointer-events', 'stroke' );\n }\n\n self._trackerDom = cloned;\n\n self.groupMain.addEventListener( 'mousemove', function( e ) {\n var coords = self.graph._getXY( e ),\n ret = self.handleMouseMove( false, false );\n self._trackingCallback( self, ret, coords.x, coords.y );\n } );\n\n self.groupMain.addEventListener( 'mouseleave', function( e ) {\n self._trackingOutCallback( self );\n } );\n }\n return this;\n\n }\n\n _addPoint( xpx, ypx, x, y, xpxbefore, ypxbefore, xbefore, ybefore, j, color, move, allowMarker ) {\n\n if ( xpxbefore === undefined || ypxbefore === undefined ) {\n return;\n }\n\n if ( isNaN( xpx ) || isNaN( ypx ) ) {\n return;\n }\n\n if ( color._rgb ) {\n color = 'rgba(' + color._rgb[ 0 ] + ',' + color._rgb[ 1 ] + ',' + color._rgb[ 2 ] + ',' + ( color._rgb[ 3 ] || 1 ) + ')';\n }\n\n var line = this.lines[ color ];\n if ( !line ) {\n line = this.lines[ color ] = {\n object: document.createElementNS( this.graph.ns, 'path' ),\n path: '',\n color: color\n };\n line.object.setAttribute( 'stroke', color );\n line.color = color;\n // this.applyLineStyle( line );\n this.groupLines.appendChild( line.object );\n }\n\n line.path += 'M ' + xpxbefore + ' ' + ypxbefore + ' L ' + xpx + ' ' + ypx;\n\n if ( this.hasErrors() ) {\n this.errorAddPoint( j, x, y, xpx, ypx );\n }\n\n /*if ( this.markersShown() && allowMarker !== false ) {\n drawMarkerXY( this, this.markerFamilies[ this.selectionType ][ this.markerCurrentFamily ], xpx, ypx );\n }*/\n }\n\n removeExtraLines() {\n\n }\n\n // Returns the DOM\n latchLines() {\n\n for ( var i in this.lines ) {\n this.lines[ i ].object.setAttribute( 'd', this.lines[ i ].path );\n }\n }\n\n // Returns the DOM\n eraseLines() {\n\n for ( var i in this.lines ) {\n this.lines[ i ].path = '';\n this.lines[ i ].object.setAttribute( 'd', '' );\n }\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyle( line ) {\n\n //line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute( 'stroke-width', this.getLineWidth() );\n if ( this.getLineDashArray() ) {\n line.setAttribute( 'stroke-dasharray', this.getLineDashArray() );\n } else {\n line.removeAttribute( 'stroke-dasharray' );\n }\n line.setAttribute( 'fill', 'none' );\n //\tline.setAttribute('shape-rendering', 'optimizeSpeed');\n }\n}\n\nexport default SerieLineColor;","import Serie from './graph.serie.js';\nimport * as util from '../graph.util.js';\nimport ErrorBarMixin from '../mixins/graph.mixin.errorbars.js';\n\nconst defaults = {};\n\nvar type = 'scatter';\n\n/**\n * @static\n * @augments Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\nclass SerieScatter extends Serie {\n\n constructor( graph, name, options ) {\n\n super( ...arguments );\n this.id = Math.random() + Date.now();\n this.shapes = []; // Stores all shapes\n this.shown = true;\n this.data = [];\n\n this.shapesDetails = [];\n this.shapes = [];\n\n this._type = type;\n\n util.mapEventEmission( this.options, this );\n\n this._isMinOrMax = {\n x: {\n min: false,\n max: false\n },\n y: {\n min: false,\n max: false\n }\n };\n\n this.groupPoints = document.createElementNS( this.graph.ns, 'g' );\n this.groupMain = document.createElementNS( this.graph.ns, 'g' );\n\n this.additionalData = {};\n\n this.selectedStyleGeneral = {};\n this.selectedStyleModifiers = {};\n\n this.groupPoints.addEventListener( 'mouseover', ( e ) => {\n var id = parseInt( e.target.parentElement.getAttribute( 'data-shapeid' ) );\n this.emit( 'mouseover', id, this.waveform.getX( id ), this.waveform.getY( id ) );\n } );\n\n this.groupPoints.addEventListener( 'mouseout', ( e ) => {\n var id = parseInt( e.target.parentElement.getAttribute( 'data-shapeid' ) );\n this.emit( 'mouseout', id, this.waveform.getX( id ), this.waveform.getY( id ) );\n } );\n\n this.minX = Number.MAX_VALUE;\n this.minY = Number.MAX_VALUE;\n this.maxX = Number.MIN_VALUE;\n this.maxY = Number.MIN_VALUE;\n\n this.groupMain.appendChild( this.groupPoints );\n this.currentAction = false;\n\n if ( this.initExtended1 ) {\n this.initExtended1();\n }\n\n this.styles = {};\n this.styles.unselected = {};\n this.styles.selected = {};\n\n this.styles.unselected.default = {\n shape: 'circle',\n cx: 0,\n cy: 0,\n r: 3,\n stroke: 'transparent',\n fill: 'black'\n };\n\n this.styles.selected.default = {\n shape: 'circle',\n cx: 0,\n cy: 0,\n r: 4,\n stroke: 'transparent',\n fill: 'black'\n };\n\n }\n\n /**\n * Applies for x as the category axis\n * @example serie.setDataCategory( { x: \"someName\", y: Waveform } );\n */\n setDataCategory( data ) {\n\n let minY = +Infinity;\n let maxY = -Infinity;\n\n for ( let dataCategory of data ) {\n\n this._checkY( dataCategory.y.getMaxY() );\n this._checkY( dataCategory.y.getMinY() );\n\n }\n\n this.data = data;\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n return this;\n }\n\n /**\n * Removes all DOM points\n * @private\n */\n empty() {\n\n while ( this.groupPoints.firstChild ) {\n this.groupPoints.removeChild( this.groupPoints.firstChild );\n }\n }\n\n getSymbolForLegend() {\n\n if ( this.symbol ) {\n return this.symbol;\n }\n\n var g = document.createElementNS( this.graph.ns, 'g' );\n g.setAttribute( 'data-shapeid', -1 );\n var shape = this.doShape( g, this.styles.unselected.default );\n\n var style = this.getStyle( 'unselected', -1, true );\n\n for ( var i in style[ -1 ] ) {\n if ( i == 'shape' ) {\n continue;\n }\n shape.setAttribute( i, style[ -1 ][ i ] );\n }\n\n return g;\n\n }\n\n /**\n * Sets style to the scatter points\n * First argument is the style applied by default to all points\n * Second argument is an array of modifiers that allows customization of any point of the scatter plot. Data for each elements of the array will augment allStyles, so be sure to reset the style if needed.\n * All parameters - except shape - will be set as parameters to the DOM element of the shape\n *\n * @example\n * var modifiers = [];\n * modifiers[ 20 ] = { shape: 'circle', r: 12, fill: 'rgba(0, 100, 255, 0.3)', stroke: 'rgb(0, 150, 255)' };\n * serie.setStyle( { shape: 'circle', r: 2, fill: 'rgba(255, 0, 0, 0.3)', stroke: 'rgb(255, 100, 0)' }, modifiers ); // Will modify scatter point n°20\n *\n * @param {Object} allStyles - The general style for all markers\n * @param {Object} [ modifiers ] - The general style for all markers\n * @param {String} [ selectionMode=\"unselected\" ] - The selection mode to which this style corresponds. Default is unselected\n *\n */\n setStyle( all, modifiers, mode = 'unselected' ) {\n\n if ( typeof modifiers == 'string' ) {\n mode = modifiers;\n modifiers = false;\n }\n\n /*\n if( ! this.styles[ mode ] ) {\n\n }\n\n if ( mode !== \"selected\" && mode !== \"unselected\" ) {\n throw \"Style mode is not correct. Should be selected or unselected\";\n }\n*/\n\n this.styles[ mode ] = this.styles[ mode ] || {};\n this.styles[ mode ].all = all;\n this.styles[ mode ].modifiers = modifiers;\n\n this.styleHasChanged( mode );\n\n return this;\n }\n\n /**\n * Redraws the serie\n * @private\n * @param {force} Boolean - Forces redraw even if the data hasn't changed\n */\n draw( force ) { // Serie redrawing\n\n if ( !force && !this.hasDataChanged() && !this.hasStyleChanged( 'unselected' ) ) {\n return;\n }\n\n var x,\n y,\n xpx,\n ypx,\n j = 0,\n k,\n m,\n currentLine,\n max;\n\n var isCategory = this.getXAxis().getType() == 'category';\n\n this._drawn = true;\n\n this.dataHasChanged( false );\n this.styleHasChanged( false );\n this.groupMain.removeChild( this.groupPoints );\n\n var keys = [];\n\n j = 0;\n k = 0;\n\n if ( this.hasErrors() ) {\n this.errorDrawInit();\n }\n\n if ( isCategory ) {\n\n let k = 0;\n\n for ( ; j < this.data.length; j++ ) {\n\n if ( !this.categoryIndices.hasOwnProperty( this.data[ j ].x ) ) {\n continue;\n }\n\n if ( this.error ) {\n // this.errorAddPoint( j, position[ 0 ] + position[ 1 ] / 2, 0, this.getX( position[ 0 ] + position[ 1 ] / 2 ), ypx );\n }\n\n for ( var n = 0, l = this.data[ j ].y.getLength(); n < l; n++ ) {\n\n //let xpos = i / ( l - 1 ) * ( position[ 1 ] ) + position[ 0 ];\n\n ypx = this.getY( this.data[ j ].y.getY( n ) );\n xpx = this.getX( n / ( l - 1 ) * ( 0.8 / this.nbCategories ) + this.categoryIndices[ this.data[ j ].x ] + 0.1 / this.nbCategories );\n n++;\n\n this.shapesDetails[ k ] = this.shapesDetails[ k ] || [];\n this.shapesDetails[ k ][ 0 ] = xpx;\n this.shapesDetails[ k ][ 1 ] = ypx;\n keys.push( k );\n k++;\n }\n }\n } else {\n\n for ( ; j < this.waveform.getLength(); j++ ) {\n\n if (\n this.waveform.getX( j ) < this.getXAxis().getCurrentMin() ||\n this.waveform.getX( j ) > this.getXAxis().getCurrentMax() ||\n this.waveform.getY( j ) < this.getYAxis().getCurrentMin() ||\n this.waveform.getY( j ) > this.getYAxis().getCurrentMax()\n ) {\n\n if ( this.shapes[ j ] ) {\n this.shapes[ j ].setAttribute( 'display', 'none' );\n }\n continue;\n }\n\n if ( this.shapes[ j ] ) {\n this.shapes[ j ].setAttribute( 'display', 'initial' );\n }\n\n xpx = this.getX( this.waveform.getX( j ) );\n ypx = this.getY( this.waveform.getY( j ) );\n\n if ( this.hasErrors() ) {\n this.errorAddPoint( j, this.waveform.getX( j ), this.waveform.getY( j ), xpx, ypx );\n }\n\n this.shapesDetails[ j ] = this.shapesDetails[ j ] || [];\n this.shapesDetails[ j ][ 0 ] = xpx;\n this.shapesDetails[ j ][ 1 ] = ypx;\n keys.push( j );\n\n //this.shapes[ j / 2 ] = this.shapes[ j / 2 ] || undefined;\n }\n }\n\n if ( this.hasErrors() ) {\n this.errorDraw();\n }\n\n // This will automatically create the shapes\n this.applyStyle( 'unselected', keys );\n\n this.groupMain.appendChild( this.groupPoints );\n }\n\n _addPoint( xpx, ypx, k ) {\n\n let shape;\n let g = document.createElementNS( this.graph.ns, 'g' );\n g.setAttribute( 'transform', 'translate(' + xpx + ', ' + ypx + ')' );\n g.setAttribute( 'data-shapeid', k );\n\n if ( this.extraStyle && this.extraStyle[ k ] ) {\n\n shape = this.doShape( g, this.extraStyle[ k ] );\n\n } else if ( this.stdStylePerso ) {\n\n shape = this.doShape( g, this.stdStylePerso );\n\n } else {\n\n shape = this.doShape( g, this.stdStyle );\n }\n\n this.shapes[ k ] = shape;\n this.groupPoints.appendChild( g );\n }\n\n doShape( group, shape ) {\n var el = document.createElementNS( this.graph.ns, shape.shape );\n group.appendChild( el );\n return el;\n }\n\n getStyle( selection, index, noSetPosition ) {\n\n var selection = selection || 'unselected';\n var indices;\n\n var styles = {};\n\n if ( typeof index == 'number' ) {\n indices = [ index ];\n } else if ( Array.isArray( index ) ) {\n indices = index;\n }\n\n var shape, index, modifier, style, j; // loop variables\n var styleAll;\n\n if ( this.styles[ selection ].all !== undefined ) {\n\n styleAll = this.styles[ selection ].all;\n\n if ( typeof styleAll == 'function' ) {\n\n styleAll = styleAll();\n\n } else if ( styleAll === false ) {\n\n styleAll = {};\n\n }\n }\n\n var i = 0,\n l = indices.length;\n\n for ( ; i < l; i++ ) {\n\n index = indices[ i ];\n shape = this.shapes[ index ];\n\n if ( ( modifier = this.styles[ selection ].modifiers ) && ( typeof modifier == 'function' || modifier[ index ] ) ) {\n\n if ( typeof modifier == 'function' ) {\n\n style = modifier( index, shape );\n\n } else if ( modifier[ index ] ) {\n\n style = modifier[ index ];\n\n }\n\n styles[ index ] = Object.assign( {}, styleAll, style );\n\n } else if ( styleAll !== undefined ) {\n\n styles[ index ] = styleAll;\n\n } else {\n\n styles[ index ] = this.styles[ selection ].default;\n\n }\n\n if ( !styles[ index ] ) {\n styles[ index ] = styleAll;\n }\n\n if ( !shape ) { // Shape doesn't exist, let's create it\n\n if ( !styles[ index ].shape ) {\n console.error( style );\n throw 'No shape was defined with this style.';\n }\n\n var g = document.createElementNS( this.graph.ns, 'g' );\n g.setAttribute( 'data-shapeid', index );\n this.shapes[ index ] = this.doShape( g, styles[ index ] );\n this.groupPoints.appendChild( g );\n shape = this.shapes[ index ];\n }\n\n if ( !noSetPosition ) {\n shape.parentNode.setAttribute( 'transform', 'translate(' + this.shapesDetails[ index ][ 0 ] + ', ' + this.shapesDetails[ index ][ 1 ] + ')' );\n }\n\n }\n\n return styles;\n }\n\n applyStyle( selection, index, noSetPosition ) {\n\n var i, j;\n var styles = this.getStyle( selection, index, noSetPosition );\n\n for ( i in styles ) {\n\n for ( j in styles[ i ] ) {\n\n if ( j !== 'shape' ) {\n\n if ( styles[ i ][ j ] ) {\n\n this.shapes[ i ].setAttribute( j, styles[ i ][ j ] );\n\n } else {\n\n this.shapes[ i ].removeAttribute( j );\n\n }\n\n }\n\n }\n\n }\n\n }\n\n unselectPoint( index ) {\n this.selectPoint( index, false );\n }\n\n selectPoint( index, setOn, selectionType ) {\n\n if ( this.shapesDetails[ index ][ 2 ] && this.shapesDetails[ index ][ 2 ] == selectionType ) {\n return;\n }\n\n if ( typeof setOn == 'string' ) {\n selectionType = setOn;\n setOn = undefined;\n }\n\n if ( Array.isArray( index ) ) {\n return this.selectPoints( index );\n }\n\n if ( this.shapes[ index ] && this.shapesDetails[ index ] ) {\n\n if ( ( this.shapesDetails[ index ][ 2 ] || setOn === false ) && setOn !== true ) {\n\n var selectionStyle = this.shapesDetails[ index ][ 2 ];\n this.shapesDetails[ index ][ 2 ] = false;\n\n var allStyles = this.getStyle( selectionStyle, index, true );\n for ( var i in allStyles[ index ] ) {\n this.shapes[ index ].removeAttribute( i );\n }\n\n this.applyStyle( 'unselected', index, true );\n\n } else {\n\n selectionType = selectionType || 'selected';\n this.shapesDetails[ index ][ 2 ] = selectionType;\n\n this.applyStyle( selectionType, index, true );\n\n }\n\n }\n\n }\n\n getUsedCategories() {\n\n if ( typeof this.data[ 0 ] == 'object' ) {\n return this.data.map( ( d ) => d.x );\n }\n\n return [];\n }\n\n}\n\nutil.mix( SerieScatter, ErrorBarMixin );\n\nexport default SerieScatter;","import Serie from './graph.serie.js';\nimport Waveform from '../util/waveform.js';\nimport {\n extend,\n guid\n} from '../graph.util.js';\n\n/**\n * @static\n * @extends Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\nclass SerieZone extends Serie {\n\n static\n default () {\n return {\n fillColor: 'rgba( 0, 0, 0, 0.1 )',\n lineColor: 'rgba( 0, 0, 0, 1 )',\n lineWidth: '1px'\n };\n }\n constructor( graph, name, options ) {\n super( ...arguments );\n\n this.selectionType = 'unselected';\n this.id = guid();\n\n this.groupZones = document.createElementNS( this.graph.ns, 'g' );\n this.groupMain = document.createElementNS( this.graph.ns, 'g' );\n this.lineZone = document.createElementNS( this.graph.ns, 'path' );\n this.lineZone.setAttribute( 'stroke', 'black' );\n this.lineZone.setAttribute( 'stroke-width', '1px' );\n\n this.groupMain.appendChild( this.groupZones );\n this.groupZones.appendChild( this.lineZone );\n\n this.applyLineStyle( this.lineZone );\n this.styleHasChanged();\n\n this.clip = document.createElementNS( this.graph.ns, 'clipPath' );\n this.clipId = guid();\n this.clip.setAttribute( 'id', this.clipId );\n\n this.graph.defs.appendChild( this.clip );\n\n }\n\n /**\n * Assigns a collection of waveforms that make up the zone\n * The waveforms will appended one after the other, without break\n * @param {...Waveform} waveforms - The collection of waveforms\n * @return {SerieZone} - The current serie zone instance\n * @memberof SerieZone\n */\n setWaveform( ...waveforms ) {\n this.waveforms = waveforms;\n\n this.waveforms = this.waveforms.map( ( wave ) => {\n\n if ( !( wave instanceof Waveform ) ) {\n return new Waveform( wave );\n } else {\n return wave;\n }\n } );\n\n this.minX = this.waveforms[ 0 ].getXMin();\n this.maxX = this.waveforms[ 0 ].getXMax();\n this.minY = this.waveforms[ 0 ].getMin();\n this.maxY = this.waveforms[ 0 ].getMax();\n\n this.waveforms.map( ( wave ) => {\n\n this.minX = Math.min( wave.getXMin(), this.minX );\n this.maxX = Math.max( wave.getXMin(), this.maxX );\n this.minY = Math.min( wave.getMin(), this.minY );\n this.maxY = Math.max( wave.getMax(), this.maxY );\n } );\n\n this.graph.updateDataMinMaxAxes();\n this.dataHasChanged();\n return this;\n }\n\n setWaveforms() {\n return this.setWaveform( ...arguments );\n }\n\n getWaveforms() {\n return this.waveforms;\n }\n\n setMinMaxWaveforms( min, max ) {\n this.waveforms = [ min, max.reverse() ];\n return this;\n }\n\n /**\n * Removes all the dom concerning this serie from the drawing zone\n */\n empty() {\n\n while ( this.group.firstChild ) {\n this.group.removeChild( this.group.firstChild );\n }\n }\n\n /**\n * Redraws the serie\n * @private\n *\n * @param {force} Boolean - Forces redraw even if the data hasn't changed\n */\n draw( force ) { // Serie redrawing\n\n if ( force || this.hasDataChanged() ) {\n\n if ( !this.waveforms ) {\n return;\n }\n\n let\n dataX = 0,\n dataY = 0,\n xpx = 0,\n ypx = 0,\n j = 0,\n line = '',\n buffer,\n move = false;\n\n const xminpx = this.getXAxis().getMinPx(),\n xmaxpx = this.getXAxis().getMaxPx(),\n yminpx = this.getYAxis().getMinPx(),\n ymaxpx = this.getYAxis().getMaxPx();\n\n const xmin = this.getXAxis().getCurrentMin(),\n xmax = this.getXAxis().getCurrentMax(),\n ymin = this.getYAxis().getCurrentMin(),\n ymax = this.getYAxis().getCurrentMax();\n\n //this.clipRect.setAttribute( \"x\", Math.min( xmin, xmax ) );\n //this.clipRect.setAttribute( \"y\", Math.min( ymin, ymax ) );\n //this.clipRect.setAttribute( \"width\", Math.abs( xmax - xmin ) );\n //this.clipRect.setAttribute( \"height\", Math.abs( ymax - ymin ) );\n\n this.groupMain.removeChild( this.groupZones );\n\n for ( let waveform of this.waveforms ) {\n\n for ( j = 0; j < waveform.getLength(); j += 1 ) {\n dataX = waveform.getX( j, true );\n dataY = waveform.getY( j, true );\n\n // The y axis in screen coordinate is inverted vs cartesians\n if ( dataY[ j ] < ymin ) {\n ypx = this.getY( ymin );\n } else if ( dataY[ j ] > ymax ) {\n ypx = this.getY( ymax );\n }\n\n if ( dataX !== dataX ) {\n continue;\n }\n\n if ( dataY !== dataY ) {\n // Let's make a new line\n\n if ( line.length == 0 ) {\n continue;\n }\n\n line += 'L ' + xpx + ', ' + this.getY( waveform.getMinY() );\n move = true;\n continue;\n }\n\n ypx = this.getY( dataY );\n xpx = this.getX( dataX );\n\n if ( dataX < xmin || dataX > xmax ) {\n buffer = [ dataX, dataY[ j ], xpx, ypx ];\n continue;\n }\n\n if ( move ) {\n line += ' M ' + xpx + ', ' + this.getY( waveform.getMinY() ) + ' ';\n move = false;\n }\n\n if ( line.length > 0 ) {\n line += ' L ';\n }\n\n if ( buffer ) {\n line += buffer[ 2 ] + ',' + buffer[ 3 ] + ' ';\n buffer = false;\n } else {\n line += xpx + ',' + ypx + ' ';\n }\n }\n }\n\n if ( line !== '' ) {\n this.lineZone.setAttribute( 'd', 'M ' + line + ' z' );\n } else {\n this.lineZone.setAttribute( 'd', '' );\n }\n this.groupMain.appendChild( this.groupZones );\n }\n\n if ( this.hasStyleChanged( this.selectionType ) ) {\n this.applyLineStyle( this.lineZone );\n this.styleHasChanged( false );\n }\n\n }\n\n /**\n * Applies the computed style to the DOM element fed as a parameter\n * @private\n *\n * @param {SVGLineElement} line - The line to which the style has to be applied to\n */\n applyLineStyle( line ) {\n\n line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute( 'stroke-width', this.getLineWidth() );\n line.setAttribute( 'fill', this.getFillColor() );\n line.setAttribute( 'fill-opacity', this.getFillOpacity() );\n line.setAttribute( 'stroke-opacity', this.getLineOpacity() );\n }\n\n /**\n * Sets the line width\n *\n * @param {Number} width - The line width\n * @returns {SerieZone} - The current serie\n */\n setLineWidth( width ) {\n this.options.lineWidth = width;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line width\n *\n * @returns {Number} - The line width\n */\n getLineWidth() {\n return this.options.lineWidth;\n }\n\n /**\n * Sets the line opacity\n *\n * @param {Number} opacity - The line opacity\n * @returns {SerieZone} - The current serie\n */\n setLineOpacity( opacity ) {\n this.options.lineOpacity = opacity;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line opacity\n *\n * @returns {Number} - The line opacity\n */\n getLineOpacity() {\n return this.options.lineOpacity;\n }\n\n /**\n * Sets the line color\n *\n * @param {String} color - The line color\n * @returns {SerieZone} - The current serie\n */\n setLineColor( color ) {\n this.options.lineColor = color;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line width\n *\n * @returns {Number} - The line width\n */\n getLineColor() {\n return this.options.lineColor;\n }\n\n /**\n * Sets the fill opacity\n *\n * @param {Number} opacity - The fill opacity\n * @returns {SerieZone} - The current serie\n */\n setFillOpacity( opacity ) {\n this.options.fillOpacity = opacity;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the fill opacity\n *\n * @returns {Number} - The fill opacity\n */\n getFillOpacity() {\n return this.options.fillOpacity;\n }\n\n /**\n * Sets the fill color\n *\n * @param {Number} width - The line width\n * @returns {Number} - The line width\n */\n setFillColor( color ) {\n this.options.fillColor = color;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the fill color\n *\n * @returns {Number} - The fill color\n */\n getFillColor() {\n return this.options.fillColor;\n }\n\n}\n\nexport default SerieZone;","import Graph from '../graph.core.js';\nimport Serie from './graph.serie.zone.js';\nimport Waveform from '../util/waveform.js';\nimport Serie3DMixin from '../mixins/graph.mixin.serie3d.js';\nimport * as util from '../graph.util.js';\n\n/**\n * Serie line with 3D projection\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends SerieLine\n */\nclass SerieZone3D extends Serie {\n\n static\n default () {\n return {\n zpos: 0\n };\n }\n constructor( graph, name, options ) {\n super( ...arguments );\n }\n\n /**\n * Sets the z-position\n * @memberof SerieZone3D\n * @param {Number} zPos - The position in the z axis\n */\n setZPos( zPos ) {\n this.options.zpos = zPos;\n return this;\n }\n\n setz() {\n return this.setZPos( ...arguments );\n }\n}\n\nutil.mix( SerieZone3D, Serie3DMixin );\nexport default SerieZone3D;","import Serie from './graph.serie.js';\nimport * as util from '../graph.util.js';\n\n/**\n * Density map serie\n * @example graph.newSerie( name, options, \"densitymap\" );\n * @see Graph#newSerie\n * @augments Serie\n */\nclass SerieDensityMap extends Serie {\n\n constructor( graph, name, options ) {\n\n super( ...arguments );\n util.mapEventEmission( this.options, this ); // Register events\n\n this.groupMain = document.createElementNS( this.graph.ns, 'g' );\n\n this.rects = [];\n this.paths = [];\n\n this.recalculateBinsOnDraw = false;\n }\n /**\n * Sets the data of the serie. Careful, only one format allowed for now.\n * @memberof SerieDensityMap\n * @param {Array} data - A vector containing 2-elements arrays\n * @return {SerieDensityMap} The current instance\n * @example serie.setData( [ [ x1, y1 ], [ x2, y2 ], ..., [ xn, yn ] ] );\n */\n setData( data ) {\n\n this.minX = this.maxX = this.minY = this.maxY = 0;\n var i = 0,\n l = data.length;\n this.data = data;\n\n this.minX = Number.POSITIVE_INFINITY;\n this.minY = Number.POSITIVE_INFINITY;\n this.maxX = Number.NEGATIVE_INFINITY;\n this.maxY = Number.NEGATIVE_INFINITY;\n\n for ( i = 0; i < l; i++ ) {\n this._checkX( data[ i ][ 0 ] );\n this._checkY( data[ i ][ 1 ] );\n }\n\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n\n return this;\n\n }\n\n /**\n * Calculates the bins from the (x,y) dataset\n * @memberof SerieDensityMap\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} numX - The number of x bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @param {Number} numY - The number of y bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n calculateDensity( fromX, deltaX, numX, fromY, deltaY, numY ) {\n\n var densitymap = [],\n i,\n l = this.data.length,\n indexX, indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n for ( i = 0; i < l; i++ ) {\n indexX = ~~( ( this.data[ i ][ 0 ] - fromX ) / deltaX );\n indexY = ~~( ( this.data[ i ][ 1 ] - fromY ) / deltaY );\n\n if ( indexX > numX || indexY > numY || indexX < 0 || indexY < 0 ) {\n continue;\n }\n\n densitymap[ indexX ] = densitymap[ indexX ] || [];\n densitymap[ indexX ][ indexY ] = densitymap[ indexX ][ indexY ] + 1 || 1;\n\n binMin = densitymap[ indexX ][ indexY ] < binMin ? densitymap[ indexX ][ indexY ] : binMin;\n binMax = densitymap[ indexX ][ indexY ] > binMax ? densitymap[ indexX ][ indexY ] : binMax;\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = numX;\n this.maxIndexY = numY;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = numX;\n this.numY = numY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Sets the density map from a precalculated data set\n * @memberof SerieDensityMap\n * @param {Array} densitymap - A 2D-array containing the map\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n setDensityMap( densitymap, fromX, deltaX, numX, fromY, deltaY, numY ) {\n\n var i,\n j,\n l = this.data.length,\n indexX, indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n for ( i = 0; i < densitymap.length; i++ ) {\n\n for ( j = 0; j < densitymap[ i ].length; j++ ) {\n binMin = densitymap[ i ][ j ] < binMin ? densitymap[ i ][ j ] : binMin;\n binMax = densitymap[ i ][ j ] > binMax ? densitymap[ i ][ j ] : binMax;\n }\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = densitymap.length;\n this.maxIndexY = densitymap[ 0 ].length;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = this.maxIndexX;\n this.numY = this.maxIndexY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Calculates the bins from the (x,y) dataset using bin weighing\n * Will assign a set of (x,y) to the 4 neighbouring bins according to its exact position\n * @memberof SerieDensityMap\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} numX - The number of x bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @param {Number} numY - The number of y bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n calculateDensityWeighted( fromX, deltaX, numX, fromY, deltaY, numY ) {\n\n var densitymap = [],\n i,\n l = this.data.length,\n indexX, indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n var compX, compY;\n var exactX, exactY;\n var indexXLow, indexXHigh, indexYLow, indexYHigh;\n\n for ( i = 0; i < l; i++ ) {\n exactX = ( ( this.data[ i ][ 0 ] - fromX ) / deltaX ) - 0.5;\n exactY = ( ( this.data[ i ][ 1 ] - fromY ) / deltaY ) - 0.5;\n\n indexX = Math.floor( exactX );\n indexY = Math.floor( exactY );\n\n indexXLow = indexX; //Math.floor( exactX );\n indexYLow = indexY; //Math.floor( exactY );\n\n indexXHigh = indexX + 1; //Math.ceil( exactX );\n indexYHigh = indexY + 1; //Math.ceil( exactY );\n\n compX = ( 1 - ( exactX - indexX ) );\n compY = ( 1 - ( exactY - indexY ) );\n\n //console.log( exactY, indexY );\n //console.log( compY, indexYLow, indexYHigh );\n if ( indexX > numX || indexY > numY || indexX < 0 || indexY < 0 ) {\n continue;\n }\n\n densitymap[ indexXLow ] = densitymap[ indexXLow ] || [];\n densitymap[ indexXHigh ] = densitymap[ indexXHigh ] || [];\n\n densitymap[ indexXLow ][ indexYLow ] = densitymap[ indexXLow ][ indexYLow ] || 0;\n densitymap[ indexXHigh ][ indexYLow ] = densitymap[ indexXHigh ][ indexYLow ] || 0;\n densitymap[ indexXLow ][ indexYHigh ] = densitymap[ indexXLow ][ indexYHigh ] || 0;\n densitymap[ indexXHigh ][ indexYHigh ] = densitymap[ indexXHigh ][ indexYHigh ] || 0;\n\n densitymap[ indexXLow ][ indexYLow ] += compX * compY;\n densitymap[ indexXHigh ][ indexYLow ] += ( 1 - compX ) * compY;\n densitymap[ indexXLow ][ indexYHigh ] += compX * ( 1 - compY );\n densitymap[ indexXHigh ][ indexYHigh ] += ( 1 - compX ) * ( 1 - compY );\n\n // A loop would be nicer, but would it be faster ?\n binMin = densitymap[ indexXLow ][ indexYLow ] < binMin ? densitymap[ indexXLow ][ indexYLow ] : binMin;\n binMax = densitymap[ indexXLow ][ indexYLow ] > binMax ? densitymap[ indexXLow ][ indexYLow ] : binMax;\n binMin = densitymap[ indexXHigh ][ indexYLow ] < binMin ? densitymap[ indexXHigh ][ indexYLow ] : binMin;\n binMax = densitymap[ indexXHigh ][ indexYLow ] > binMax ? densitymap[ indexXHigh ][ indexYLow ] : binMax;\n binMin = densitymap[ indexXLow ][ indexYHigh ] < binMin ? densitymap[ indexXLow ][ indexYHigh ] : binMin;\n binMax = densitymap[ indexXLow ][ indexYHigh ] > binMax ? densitymap[ indexXLow ][ indexYHigh ] : binMax;\n binMin = densitymap[ indexXHigh ][ indexYHigh ] < binMin ? densitymap[ indexXHigh ][ indexYHigh ] : binMin;\n binMax = densitymap[ indexXHigh ][ indexYHigh ] > binMax ? densitymap[ indexXHigh ][ indexYHigh ] : binMax;\n\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = numX;\n this.maxIndexY = numY;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = numX;\n this.numY = numY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Calculates the density map based on the minimum and maximum values found in the data array\n * @memberof SerieDensityMap\n * @param {Number} [ numX = 400 ] - The number of x bins\n * @param {Number} [ numY = numX ] - The number of y bins\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n autoBins( numX, numY ) {\n\n this.numX = numX || 400;\n this.numY = numY || this.numX;\n\n this.calculateDensity(\n this.minX, ( this.maxX - this.minX ) / numX, numX,\n this.minY, ( this.maxY - this.minY ) / numY, numY\n );\n\n this.recalculateBinsOnDraw = false;\n\n return this;\n }\n\n /**\n * Only calculates the density map upon redraw based on the current state of the graph. In this mode, a fixed number of pixels per bin is used to calculate the number of bins and fed into\n * the calculation of the density map. In this method, the color map spans on the full scale of the density map values (i.e. a subrange cannot be defined, like you would do using {@link SerieDensityMap#setColorMapBinBoundaries}).\n * @memberof SerieDensityMap\n * @param {Number} pxPerBinX - The number of x bins per pixels. Should be an integer, but technically it doesn't have to\n * @param {Number} pxPerBinY - The number of y bins per pixels. Should be an integer, but technically it doesn't have to\n * @param {Boolean} weightedDensityMap - Whether jsGraph should use weighted density mapping or not\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n setPxPerBin( pxPerBinX, pxPerBinY, weightedDensityMap ) {\n\n if ( pxPerBinX ) {\n this.calculationDensityMap( {\n from: 'min',\n to: 'max',\n pxPerBin: pxPerBinX,\n weighted: weightedDensityMap\n } );\n }\n\n if ( pxPerBinY ) {\n this.calculationDensityMap( false, {\n from: 'min',\n to: 'max',\n pxPerBin: pxPerBinY,\n weighted: weightedDensityMap\n } );\n }\n\n return this;\n }\n\n /**\n * Sets bins in the ```x``` or ```y``` direction based on a from value, a to value and a number of bins.\n * @memberof SerieDensityMap\n * @param {String} mode - ```x``` or ```y```\n * @param {Number} from - The from value of the bin for the calculation with ```calculateDensityMap```\n * @param {Number} to - The to value\n * @param {Number} num - The number of bins\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n setBinsFromTo( mode, from, to, num ) {\n\n this.densityMapCalculation = this.densityMapCalculation || {};\n\n this.densityMapCalculation[ mode ] = {\n from: from,\n to: to,\n numBins: num\n };\n this.calculationDensityMap();\n return this;\n }\n\n calculationDensityMap( x, y ) {\n\n this.method = this.calculateDensityAdvanced;\n this.densityMapCalculation = this.densityMapCalculation || {};\n\n if ( x ) {\n this.densityMapCalculation.x = x;\n }\n\n if ( y ) {\n this.densityMapCalculation.y = y;\n }\n }\n\n calculateDensityAdvanced() {\n\n var results = {\n x: {\n from: 0,\n num: 0,\n delta: 0,\n weighing: false\n },\n\n y: {\n from: 0,\n num: 0,\n delta: 0,\n weighing: false\n }\n };\n\n var widthValues = {\n x: this.graph.drawingSpaceWidth,\n y: this.graph.drawingSpaceHeight\n };\n var axisGetter = {\n x: this.getXAxis,\n y: this.getYAxis\n };\n\n var weighing = false;\n\n for ( var i in this.densityMapCalculation ) {\n\n if ( this.densityMapCalculation[ i ].weighted ) {\n weighing = true;\n results[ i ].weighing = true;\n }\n\n if ( this.densityMapCalculation[ i ].pxPerBin ) {\n\n // In value\n\n var from = ( this.densityMapCalculation[ i ].from == 'min' ) ? axisGetter[ i ].call( this ).getCurrentMin() : this.densityMapCalculation[ i ].from;\n var to = this.densityMapCalculation[ i ].to == 'max' ? axisGetter[ i ].call( this ).getCurrentMax() : this.densityMapCalculation[ i ].to;\n\n // In px\n var dimension = Math.abs( axisGetter[ i ].call( this ).getRelPx( to - from ) );\n results[ i ].num = Math.ceil( widthValues[ i ] / this.densityMapCalculation[ i ].pxPerBin );\n\n //console.log( from, from - axisGetter[ i ].call( this ).getRelVal( ( results[i ].num * this.densityMapCalculation[ i ].pxPerBin - dimension ) / 2 ), ( results[i ].num * this.densityMapCalculation[ i ].pxPerBin - dimension ) / 2 );\n results[ i ].from = from - Math.abs( axisGetter[ i ].call( this ).getRelVal( ( ( results[ i ].num ) * this.densityMapCalculation[ i ].pxPerBin - dimension ) / 2 ) );\n results[ i ].delta = Math.abs( axisGetter[ i ].call( this ).getRelVal( this.densityMapCalculation[ i ].pxPerBin ) );\n\n } else {\n\n results[ i ].num = this.densityMapCalculation[ i ].numBins || 400;\n results[ i ].from = ( this.densityMapCalculation[ i ].from == 'min' ) ? axisGetter[ i ].call( this ).getCurrentMin() : this.densityMapCalculation[ i ].from;\n results[ i ].delta = ( this.densityMapCalculation[ i ].to ) ? ( ( this.densityMapCalculation[ i ].to == 'max' ? axisGetter[ i ].call( this ).getCurrentMax() : this.densityMapCalculation[ i ].to ) - results[ i ].from ) / ( results[ i ].num ) : this.densityMapCalculate[ i ].delta;\n\n }\n\n // console.log( axisGetter[ i ].call( this ).getCurrentMin(), axisGetter[ i ].call( this ).getCurrentMax(), )\n }\n //console.log( this.getYAxis().getCurrentMin(), this.getYAxis().getCurrentMax(), this.graph.drawingSpaceHeight );\n\n //console.log( this.densityMapCalculation );\n\n ( weighing ? this.calculateDensityWeighted : this.calculateDensity ).call( this,\n results.x.from, results.x.delta, results.x.num,\n results.y.from, results.y.delta, results.y.num\n );\n }\n\n /**\n * Selects a subrange of bins for the color mapping. There is no need to recalculate the color map after calling this method\n * @memberof SerieDensityMap\n * @param {Number} binMin - The minimum bin value\n * @param {Number} binMax - The maximum bin value\n * @return {SerieDensityMap} The current instance\n * @example // In this case, all bins with values below binMin * 2 (the middle scale) will be rendered with the first color of the color map\n * serie.setColorMapBinBoundaries( serie.binMin * 2, serie.binMax );\n */\n setColorMapBinBoundaries( min, max ) {\n this.colorMapMin = min;\n this.colorMapMax = max;\n return this;\n }\n\n /**\n * Calls {@link SerieDensityMap#setColorMapBinBoundaries} using the minimum and maximum bin values calculated by {@link SerieDensityMap#calculateDensity}. This function must be called, since colorMinMap and colorMaxMap are not set automatically when the density map is calculated.\n * @memberof SerieDensityMap\n * @param {Number} binMin - The minimum bin value\n * @param {Number} binMax - The maximum bin value\n * @return {SerieDensityMap} The current instance\n */\n autoColorMapBinBoundaries() {\n this.colorMapMin = this.binMin;\n this.colorMapMax = this.binMax;\n return this;\n }\n\n /**\n * Allows the use of a callback to determine the color map min and max value just before the density map is redrawn. This is very useful when the density map is recalculate before redraw, such as in the case where bins per pixels are used\n * @memberof SerieDensityMap\n * @param {(String|Function)} callback - The callback function to call. Should return an array with two elements ```[ colorMapMin, colorMapMax ]```. This parameter can also take the value ```auto```, in which case ```autoColorMapBinBoundaries``` will be called before redraw\n * @return {SerieDensityMap} The current instance\n */\n onRedrawColorMapBinBoundaries( callback ) {\n this.callbackColorMapMinMax = callback;\n return this;\n }\n\n /**\n * Generates a color map based on a serie of HSL(A) values.\n * @summary Colors can scale linearly, logarithmically (enhances short range differences) or exponentially (enhances long range differences).\n * One word of advice though. SVG being not canvas, jsGraph has to create a path for each color value of the color map. In other words, if you're asking for 16-bit coloring (65536 values), 65536 SVG paths will be created and your browser will start to suffer from it.\n * As of now, all the colors in colorStops will be places at equal distances from each other between colorMapMin and colorMapMax set by {@link autoColorMapBinBoundaries} or {@link setColorMapBinBoundaries}\n * @memberof SerieDensityMap\n * @param {Array} colorStops - An array of objects, each having the following format: { h: [ 0-360], s: 0-1, l: 0-1, a: 0-1}\n * @param {Number} numColors - The number of colors to compute.\n * @param {String} [ method = \"linear\" ] - The method to use to calculate the density map: linear, exp, or log\n * @return {SerieDensityMap} The current instance\n */\n colorMapHSL( colorStops, numColors, method ) {\n\n method = method || 'linear';\n\n var methods = {\n 'exp': function( value ) {\n return ( Math.exp( value / numColors * 1 ) - Math.exp( 0 ) ) / ( Math.exp( 1 ) - Math.exp( 0 ) );\n },\n 'log': function( value ) {\n return ( Math.log( value + 1 ) - Math.log( 1 ) ) / ( Math.log( numColors + 1 ) - Math.log( 1 ) );\n },\n 'linear': function( value ) {\n return ( value - 0 ) / ( numColors - 0 );\n }\n };\n\n var k = 0,\n colorMap = [],\n opacities = [];\n\n var color = {\n h: null,\n s: null,\n l: null,\n a: null\n };\n\n var ratio, first;\n\n var slices = colorStops.length - 1;\n\n for ( var i = 0; i <= numColors; i++ ) {\n\n ratio = methods[ method ]( i );\n\n first = Math.floor( ratio * slices );\n\n if ( first == colorStops.length - 1 ) { // Handle 1\n first = slices - 1;\n }\n\n ratio = ( ratio - first / ( slices ) ) / ( 1 / ( slices ) );\n\n for ( var j in color ) {\n color[ j ] = ( colorStops[ first + 1 ][ j ] - colorStops[ first ][ j ] ) * ratio + colorStops[ first ][ j ];\n }\n\n colorMap[ k ] = 'hsl(' + color.h + ', ' + Math.round( color.s * 100 ) + '%, ' + Math.round( color.l * 100 ) + '%)'; //this.HSVtoRGB( color.h, color.s, color.v );\n opacities[ k ] = color.a;\n k++;\n }\n\n this.opacities = opacities;\n this.colorMap = colorMap;\n this.colorMapNum = numColors;\n return this;\n }\n\n /**\n * Calls {@link SerieDensityMap#colorMapHSV} using 100 colors.\n * @memberof SerieDensityMap\n * @param {Array} colorStops - An array of objects, each having the following format: { h: [ 0-360], s: 0-1, l: 0-1, a: 0-1}\n * @param {String} [ method = \"linear\" ] - The method to use to calculate the density map: linear, exp or log\n * @return {SerieDensityMap} The current instance\n */\n autoColorMapHSL( colorStops, method = 'linear' ) {\n this.colorMapHSV( colorStops, 100, method );\n return this;\n }\n\n /* byteToHex( b ) {\n return hexChar[ ( b >> 4 ) & 0x0f ] + hexChar[ b & 0x0f ];\n }\n */\n /*\n HSVtoRGB( h, s, v ) {\n var r, g, b, i, f, p, q, t;\n if ( arguments.length === 1 ) {\n s = h.s, v = h.v, h = h.h;\n }\n i = Math.floor( h * 6 );\n f = h * 6 - i;\n p = v * ( 1 - s );\n q = v * ( 1 - f * s );\n t = v * ( 1 - ( 1 - f ) * s );\n switch ( i % 6 ) {\n case 0:\n r = v, g = t, b = p;\n break;\n case 1:\n r = q, g = v, b = p;\n break;\n case 2:\n r = p, g = v, b = t;\n break;\n case 3:\n r = p, g = q, b = v;\n break;\n case 4:\n r = t, g = p, b = v;\n break;\n case 5:\n r = v, g = p, b = q;\n break;\n }\n return \"#\" + this.byteToHex( Math.floor( r * 255 ) ) + this.byteToHex( Math.floor( g * 255 ) ) + this.byteToHex( Math.floor( b * 255 ) );\n }\n */\n\n /**\n * Returns the color index (```[ 0 - 1 ]```) for a certain value, based on colorMapMin and colorMapMax.\n * @memberof SerieDensityMap\n * @param {Number} binValue - The value of the bin\n * @return {Number} The color index\n */\n getColorIndex( binValue ) {\n\n return Math.max( 0, Math.min( this.colorMapNum, Math.floor( ( binValue - this.colorMapMin ) / ( this.colorMapMax - this.colorMapMin ) * this.colorMapNum ) ) );\n }\n\n /**\n * Draws the serie\n * @memberof SerieDensityMap\n * @private\n */\n draw() {\n\n var colorIndex;\n\n if ( this.method ) {\n this.method();\n }\n\n if ( !this.callbackColorMapMinMax || this.colorMapMin == undefined || this.colorMapMax == undefined || this.callbackColorMapMinMax == 'auto' ) {\n\n this.autoColorMapBinBoundaries();\n } else {\n var val = this.callbackColorMapMinMax( this.binMin, this.binMax );\n\n this.setColorMapBinBoundaries( val[ 0 ], val[ 1 ] );\n }\n\n var deltaXPx = this.getXAxis().getRelPx( this.deltaX ),\n deltaYPx = this.getYAxis().getRelPx( this.deltaY );\n\n for ( var i = 0; i < this.paths.length; i++ ) {\n this.paths[ i ] = '';\n }\n\n for ( var i = 0; i < this.maxIndexX; i++ ) {\n\n for ( var j = 0; j < this.maxIndexY; j++ ) {\n\n if ( this.densitymap[ i ] == undefined || this.densitymap[ i ][ j ] == undefined ) {\n continue;\n }\n\n colorIndex = this.getColorIndex( this.densitymap[ i ][ j ] );\n if ( !this.paths[ colorIndex ] ) {\n this.paths[ colorIndex ] = '';\n }\n\n this.paths[ colorIndex ] += ' M ' + this.getXAxis().getPx( i * this.deltaX + this.fromX ) + ' ' + this.getYAxis().getPx( j * this.deltaY + this.fromY ) + ' h ' + deltaXPx + ' v ' + deltaYPx + ' h -' + deltaXPx + ' z';\n\n }\n }\n /*\n this.maxIndexX = indexX;\n this.maxIndexY = indexY;*/\n\n this.drawRects();\n }\n\n /**\n * Draws the rectangles\n * @memberof SerieDensityMap\n * @private\n */\n drawRects() {\n\n for ( var i = 0; i < this.paths.length; i++ ) {\n\n if ( !this.rects[ i ] ) {\n this.rects[ i ] = document.createElementNS( this.graph.ns, 'path' );\n this.rects[ i ].setAttribute( 'shape-rendering', 'crispEdges' );\n\n }\n\n if ( this.paths[ i ] !== undefined ) {\n this.rects[ i ].setAttribute( 'd', this.paths[ i ] );\n this.rects[ i ].setAttribute( 'fill', this.colorMap[ i ] );\n this.rects[ i ].setAttribute( 'fill-opacity', this.opacities[ i ] );\n }\n this.groupMain.appendChild( this.rects[ i ] );\n }\n\n }\n\n /**\n * Sets the options of the serie\n * @see SerieDensityMapDefaultOptions\n * @param {Object} options - A object containing the options to set\n * @return {SerieDensityMap} The current serie\n * @memberof SerieDensityMap\n */\n setOptions( options ) {\n this.options = util.extend( true, {}, this.defaults(), ( options || {} ) );\n // Unselected style\n\n return this;\n }\n}\n\nexport default SerieDensityMap;","import SerieLine from './graph.serie.line.js';\nimport * as util from '../graph.util.js';\n\n/**\n * Constructor for the contour serie. Do not use this constructor directly, but use the {@link Graph#newSerie} method\n * @private\n * @extends Serie\n * @example graph.newSerie( name, options, \"contour\" );\n * @see Graph#newSerie\n */\nclass SerieContour extends SerieLine {\n\n constructor( graph, name, options ) {\n super( ...arguments );\n\n this.negativeDelta = 0;\n this.positiveDelta = 0;\n\n this.negativeThreshold = 0;\n this.positiveThreshold = 0;\n\n this.groupMain.setAttribute( 'clip-path', 'url(#_clipplot' + graph._creation + ')' );\n }\n\n /**\n * Sets the contour lines\n * @memberof SerieContour.prototype\n * @param {Object} data - The object data\n * @param {Number} data.minX - The minimum x value\n * @param {Number} data.maxX - The maximum x value\n * @param {Number} data.minY - The minimum y value\n * @param {Number} data.maxY - The maximum y value\n * @param {Object[]} data.segments - The segments making up the contour lines\n * @param {Number[]} data.segments.lines - An array of alternating (x1,y1,x2,y2) quadruplet\n * @param {Number} data.segments.zValue - The corresponding z-value of this array\n * @return {Serie} The current serie\n */\n setData( data, arg, type ) {\n\n var z = 0;\n var x, dx, arg = arg || '2D',\n type = type || 'float',\n i, l = data.length,\n j, k,\n arr, datas = [];\n\n if ( !( data instanceof Array ) ) {\n\n if ( typeof data == 'object' ) {\n // Def v2\n this.minX = data.minX;\n this.minY = data.minY;\n this.maxX = data.maxX;\n this.maxY = data.maxY;\n\n data = data.segments;\n l = data.length;\n }\n }\n\n for ( i = 0; i < l; i++ ) {\n k = data[ i ].lines.length;\n arr = this._addData( type, k );\n\n for ( j = 0; j < k; j += 2 ) {\n\n arr[ j ] = data[ i ].lines[ j ];\n this._checkX( arr[ j ] );\n arr[ j + 1 ] = data[ i ].lines[ j + 1 ];\n this._checkY( arr[ j + 1 ] );\n }\n\n datas.push( {\n lines: arr,\n zValue: data[ i ].zValue\n } );\n }\n this.data = datas;\n this.graph.updateDataMinMaxAxes();\n\n this.dataHasChanged( true );\n\n return this;\n }\n\n /**\n * Draws the serie if the data has changed\n * @memberof SerieContour.prototype\n * @param {Boolean} force - Forces redraw even if the data hasn't changed\n * @return {Serie} The current serie\n */\n draw( force ) {\n\n if ( force || this.hasDataChanged() ) {\n\n this.currentLine = 0;\n var x, y, xpx, ypx, xpx2, ypx2, i = 0,\n l = this.data.length,\n j = 0,\n k, m, currentLine, domLine, arr;\n this.minZ = Infinity;\n this.maxZ = -Infinity;\n\n var next = this.groupLines.nextSibling;\n this.groupMain.removeChild( this.groupLines );\n this.zValues = {};\n\n var incrXFlip = 0;\n var incrYFlip = 1;\n if ( this.getFlip() ) {\n incrXFlip = 0;\n incrYFlip = 1;\n }\n\n var minY = this.getYAxis().getCurrentMin();\n var minX = this.getXAxis().getCurrentMin();\n\n var maxX = this.getXAxis().getCurrentMax();\n var maxY = this.getYAxis().getCurrentMax();\n\n this.counter = 0;\n this.currentLineId = 0;\n\n for ( ; i < l; i++ ) {\n this.currentLine = '';\n j = 0;\n k = 0;\n\n for ( arr = this.data[ i ].lines, m = arr.length; j < m; j += 4 ) {\n\n var lastxpx, lastypx;\n\n if ( ( arr[ j + incrXFlip ] < minX && arr[ j + 2 + incrXFlip ] < minX ) || ( arr[ j + incrYFlip ] < minY && arr[ j + 2 + incrYFlip ] < minY ) || ( arr[ j + incrYFlip ] > maxY && arr[ j + 2 + incrYFlip ] > maxY || ( arr[ j + incrXFlip ] > maxX && arr[ j + 2 + incrXFlip ] > maxX ) ) ) {\n continue;\n }\n\n xpx2 = this.getX( arr[ j + incrXFlip ] );\n ypx2 = this.getY( arr[ j + incrYFlip ] );\n\n xpx = this.getX( arr[ j + 2 + incrXFlip ] );\n ypx = this.getY( arr[ j + 2 + incrYFlip ] );\n\n if ( xpx == xpx2 && ypx == ypx2 ) {\n continue;\n }\n\n /*\tif( j > 0 && ( lastxpx !== undefined && lastypx !== undefined && Math.abs( xpx2 - lastxpx ) <= 30 && Math.abs( ypx2 - lastypx ) <= 30 ) ) {\n \t\t\t\t\t\tcurrentLine += \"L\";\n \t\t\t\t\t} else {\n \t\t\t\t\t\tcurrentLine += \"M\";\n \t\t\t\t\t}\n */\n\n this.currentLine += 'M ';\n this.currentLine += xpx2;\n this.currentLine += ' ';\n this.currentLine += ypx2;\n\n this.currentLine += 'L ';\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += ypx;\n\n this.counter++;\n\n lastxpx = xpx;\n lastypx = ypx;\n\n k++;\n }\n\n this.currentLine += ' z';\n\n domLine = this._createLine();\n domLine.setAttribute( 'data-zvalue', this.data[ i ].zValue );\n\n this.zValues[ this.data[ i ].zValue ] = {\n dom: domLine\n };\n\n this.minZ = Math.min( this.minZ, this.data[ i ].zValue );\n this.maxZ = Math.max( this.maxZ, this.data[ i ].zValue );\n }\n\n i++;\n\n for ( i = this.currentLine + 1; i < this.lines.length; i++ ) {\n this.groupLines.removeChild( this.lines[ i ] );\n this.lines.splice( i, 1 );\n }\n\n i = 0;\n\n for ( ; i < l; i++ ) {\n this.setColorTo( this.lines[ i ], this.data[ i ].zValue, this.minZ, this.maxZ );\n }\n\n this.onMouseWheel( 0, {\n shiftKey: false\n } );\n this.groupMain.insertBefore( this.groupLines, next );\n\n } else if ( this.hasStyleChanged( this.selectionType ) ) {\n\n for ( ; i < l; i++ ) {\n this.setColorTo( this.lines[ i ], this.data[ i ].zValue, this.minZ, this.maxZ );\n }\n\n }\n\n }\n\n onMouseWheel( delta, e, fixed, positive ) {\n\n delta /= 250;\n\n if ( fixed !== undefined ) {\n\n if ( !positive ) {\n this.negativeThreshold = -fixed * this.minZ;\n this.negativeDelta = -Math.pow( Math.abs( ( this.negativeThreshold / ( -this.minZ ) ) ), 1 / 3 );\n }\n\n if ( positive ) {\n this.positiveThreshold = fixed * this.maxZ;\n this.positiveDelta = Math.pow( this.positiveThreshold / ( this.maxZ ), 1 / 3 );\n }\n\n } else {\n\n if ( ( !e.shiftKey ) || !this.options.hasNegative ) {\n\n this.positiveDelta = Math.min( 1, Math.max( 0, this.positiveDelta + Math.min( 0.1, Math.max( -0.1, delta ) ) ) );\n this.positiveThreshold = this.maxZ * ( Math.pow( this.positiveDelta, 3 ) );\n\n } else {\n\n this.negativeDelta = Math.min( 0, Math.max( -1, this.negativeDelta + Math.min( 0.1, Math.max( -0.1, delta ) ) ) );\n this.negativeThreshold = -this.minZ * ( Math.pow( this.negativeDelta, 3 ) );\n\n }\n\n }\n\n if ( isNaN( this.positiveDelta ) ) {\n this.positiveDelta = 0;\n }\n\n if ( isNaN( this.negativeDelta ) ) {\n this.negativeDelta = 0;\n }\n\n for ( var i in this.zValues ) {\n\n this.zValues[ i ].dom.setAttribute( 'display', ( ( i >= 0 && i >= this.positiveThreshold ) || ( i <= 0 && i <= this.negativeThreshold ) ) ? 'block' : 'none' );\n\n }\n\n if ( this._shapeZoom ) {\n\n if ( !this.options.hasNegative ) {\n this._shapeZoom.hideHandleNeg();\n } else {\n\n this._shapeZoom.setHandleNeg( -( Math.pow( this.negativeDelta, 3 ) ), this.minZ );\n this._shapeZoom.showHandleNeg();\n }\n\n this._shapeZoom.setHandlePos( ( Math.pow( this.positiveDelta, 3 ) ), this.maxZ );\n }\n }\n\n /**\n * Sets rainbow colors based on hsl format\n * @memberof SerieContour.prototype\n * @param {Object} colors\n * @param {Object} colors.fromPositive\n * @param {Number} colors.fromPositive.h\n * @param {Number} colors.fromPositive.s\n * @param {Number} colors.fromPositive.l\n\n * @param {Object} colors.toPositive\n * @param {Number} colors.toPositive.h\n * @param {Number} colors.toPositive.s\n * @param {Number} colors.toPositive.l\n\n\n * @param {Object} colors.fromNegative\n * @param {Number} colors.fromNegative.h\n * @param {Number} colors.fromNegative.s\n * @param {Number} colors.fromNegative.l\n\n\n * @param {Object} colors.toNegative\n * @param {Number} colors.toNegative.h\n * @param {Number} colors.toNegative.s\n * @param {Number} colors.toNegative.l\n * @return {Serie} The current serie\n */\n setDynamicColor( colors ) {\n this.lineColors = colors;\n\n this.styleHasChanged();\n }\n\n setNegative( bln ) {\n this.options.hasNegative = bln;\n\n if ( bln ) {\n this.negativeThreshold = 0;\n }\n }\n\n setColorTo( line, zValue, min, max ) {\n\n if ( !this.lineColors ) {\n return;\n }\n\n var hsl = {\n h: 0,\n s: 0,\n l: 0\n };\n\n for ( var i in hsl ) {\n\n if ( zValue > 0 ) {\n hsl[ i ] = this.lineColors.fromPositive[ i ] + ( ( this.lineColors.toPositive[ i ] - this.lineColors.fromPositive[ i ] ) * ( zValue / max ) );\n } else {\n hsl[ i ] = this.lineColors.fromNegative[ i ] + ( ( this.lineColors.toNegative[ i ] - this.lineColors.fromNegative[ i ] ) * ( zValue / min ) );\n }\n }\n\n hsl.h /= 360;\n\n var rgb = util.hslToRgb( hsl.h, hsl.s, hsl.l );\n\n line.setAttribute( 'stroke', 'rgb(' + rgb.join() + ')' );\n }\n\n getSymbolForLegend() {\n\n if ( !this.lineForLegend ) {\n\n var line = document.createElementNS( this.graph.ns, 'ellipse' );\n\n line.setAttribute( 'cx', 7 );\n line.setAttribute( 'cy', 0 );\n line.setAttribute( 'rx', 8 );\n line.setAttribute( 'ry', 3 );\n\n line.setAttribute( 'cursor', 'pointer' );\n this.lineForLegend = line;\n\n }\n\n this.applyLineStyle( this.lineForLegend, this.maxZ );\n\n return this.lineForLegend;\n }\n\n applyLineStyle( line, overwriteValue ) {\n line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute( 'stroke-width', this.getLineWidth() + ( this.isSelected() ? 2 : 0 ) );\n if ( this.getLineDashArray() ) {\n line.setAttribute( 'stroke-dasharray', this.getLineDashArray() );\n }\n line.setAttribute( 'fill', 'none' );\n\n this.setColorTo( line, ( ( overwriteValue !== undefined ) ? overwriteValue : line.getAttribute( 'data-zvalue' ) ), this.minZ, this.maxZ );\n // line.setAttribute('shape-rendering', 'optimizeSpeed');\n\n this.hasStyleChanged( false );\n }\n\n setShapeZoom( shape ) {\n this._shapeZoom = shape;\n }\n\n}\n\nexport default SerieContour;","import GraphPosition from '../graph.position.js';\nimport * as util from '../graph.util.js';\nimport EventEmitter from '../dependencies/eventEmitter/EventEmitter.js';\n\n/**\n * Shape class that should be extended\n * @class Shape\n * @static\n */\nclass Shape extends EventEmitter {\n\n constructor() {\n super();\n }\n\n /**\n * Initializes the shape\n * @param {Graph} graph - The graph containing the shape\n * @param {Object} properties - The properties object (not copied)\n * @return {Shape} The current shape\n */\n init( graph, properties ) {\n\n var self = this;\n\n this.graph = graph;\n this.properties = properties || {};\n this.handles = [];\n this.options = this.options || {};\n\n this.group = document.createElementNS( this.graph.ns, 'g' );\n\n this.group.setAttribute( 'clip-path', 'url(#_clipplot' + graph._creation + ')' );\n\n this._selected = false;\n this.createDom();\n\n if ( this._dom ) {\n this._dom.jsGraphIsShape = this;\n }\n\n this.group.jsGraphIsShape = this;\n\n this.classes = [];\n this.transforms = [];\n\n if ( this._data.masker ) {\n\n var maskPath = document.createElementNS( this.graph.ns, 'mask' );\n this.maskingId = Math.random();\n maskPath.setAttribute( 'id', this.maskingId );\n\n this.maskDomWrapper = document.createElementNS( this.graph.ns, 'rect' );\n this.maskDomWrapper.setAttribute( 'fill', 'white' );\n maskPath.appendChild( this.maskDomWrapper );\n\n var maskDom = this._dom.cloneNode();\n maskPath.appendChild( maskDom );\n\n this.maskDom = maskDom;\n\n this.graph.defs.appendChild( maskPath );\n }\n\n if ( this.group ) {\n\n if ( this._dom && !this.isHTML() ) {\n this.group.appendChild( this._dom );\n }\n\n this.group.addEventListener( 'mouseover', function( e ) {\n\n self.handleMouseOver( e );\n\n } );\n\n this.group.addEventListener( 'mouseout', function( e ) {\n\n self.handleMouseOut( e );\n\n } );\n\n this.group.addEventListener( 'mousedown', function( e ) {\n\n self.graph.focus();\n\n self.handleMouseDown( e );\n } );\n\n this.group.addEventListener( 'click', this.handleClick.bind( this ) );\n\n this.group.addEventListener( 'dblclick', function( e ) {\n\n //e.preventDefault();\n // e.stopPropagation();\n\n self.handleDblClick( e );\n } );\n }\n\n //\t\t\tthis.group.appendChild(this.rectEvent);\n\n this.initImpl();\n\n this.graph.emit( 'shapeNew', this );\n\n return this;\n }\n\n /**\n * Implentation of the init method. To be extended if necessary on extended Shape classes\n */\n initImpl() {}\n\n /**\n * @return {Object} The shape's underlying data object\n */\n getData() {\n return this._data;\n }\n\n /**\n * @returns {String} The type of the shape\n */\n getType() {\n return this.type;\n }\n\n /**\n * Removes the shape from the DOM and unlinks it from the graph\n */\n kill( keepDom ) {\n\n if ( this._inDom && !keepDom ) {\n this.graph.removeShapeFromDom( this );\n }\n\n if ( !keepDom ) {\n this.graph._removeShape( this );\n }\n\n this.graph.stopElementMoving( this );\n this.graph.emit( 'shapeRemoved', this );\n this.emit( 'removed', this );\n\n this._inDom = false;\n }\n\n /**\n * Hides the shape\n * @return {Shape} The current shape\n */\n hide() {\n\n if ( this.hidden ) {\n return this;\n }\n\n this.hidden = true;\n if ( !this.isHTML() ) {\n this.group.style.display = 'none';\n } else {\n this._dom.style.display = 'none';\n }\n return this;\n }\n\n /**\n * Returns whether the shape is hidden or not\n * @return {Boolean} true if the shape is hidden, false otherwise\n */\n isHidden() {\n return this.hidden;\n }\n\n /**\n * Returns whether the shape is visible or not\n * @return {Boolean} true if the shape is visible, false if it is hidden\n */\n isVisible() {\n return !this.hidden;\n }\n\n /**\n * Shows the shape\n * @return {Shape} The current shape\n */\n show() {\n\n if ( !this.hidden ) {\n return this;\n }\n\n this.hidden = false;\n if ( !this.isHTML() ) {\n this.group.style.display = 'initial';\n } else {\n this._dom.style.display = 'initial';\n }\n\n this.redraw();\n return this;\n\n }\n\n /**\n * Adds a class to the shape DOM\n * @param {String} className - The class to add\n * @return {Shape} The current shape\n */\n addClass( className ) {\n this.classes = this.classes || [];\n if ( this.classes.indexOf( className ) == -1 ) {\n this.classes.push( className );\n }\n this.makeClasses();\n return this;\n }\n\n /**\n * Removes a class from the shape DOM\n * @param {String} className - The class to remove\n * @return {Shape} The current shape\n */\n removeClass( className ) {\n this.classes.splice( this.classes.indexOf( className ), 1 );\n this.makeClasses();\n return this;\n }\n\n /**\n * Builds the classes\n * @private\n * @return {Shape} The current shape\n */\n makeClasses() {\n\n if ( this._dom ) {\n this._dom.setAttribute( 'class', this.classes.join( ' ' ) );\n }\n\n return this;\n }\n\n /**\n * Triggers a ```shapeChanged``` event on the graph and a ```changed``` event on the shape\n * @return {Shape} The current shape\n */\n changed( event, parameters ) {\n\n if ( event ) {\n this.graph.emit( event, this, parameters );\n this.emit( event, this, parameters );\n }\n\n this.emit( 'changed', this, parameters );\n this.graph.emit( 'shapeChanged', this, parameters );\n return this;\n }\n\n /**\n * Creates an event receptacle with the coordinates of the shape bounding box\n * @return {Shape} The current shape\n */\n setEventReceptacle() {\n\n if ( !this.rectEvent ) {\n this.rectEvent = document.createElementNS( this.graph.ns, 'rect' );\n this.rectEvent.setAttribute( 'pointer-events', 'fill' );\n this.rectEvent.setAttribute( 'fill', 'transparent' );\n this.group.appendChild( this.rectEvent );\n this.rectEvent.jsGraphIsShape = this;\n }\n\n var box = this.group.getBBox();\n this.rectEvent.setAttribute( 'x', box.x );\n this.rectEvent.setAttribute( 'y', box.y - 10 );\n this.rectEvent.setAttribute( 'width', box.width );\n this.rectEvent.setAttribute( 'height', box.height + 20 );\n\n }\n\n /**\n * Assigns a serie to the shape\n * @param {Serie} The serie that owns the shape\n * @return {Shape} The current shape\n */\n setSerie( serie ) {\n\n if ( !serie ) {\n return;\n }\n\n this.serie = serie;\n\n if ( !serie.getXAxis || !serie.getYAxis ) {\n console.error( serie );\n throw 'Serie does not implement the getXAxis or getYAxis method';\n }\n this.xAxis = serie.getXAxis();\n this.yAxis = serie.getYAxis();\n return this;\n }\n\n /**\n * @return {Serie} The serie associated to the shape\n */\n getSerie() {\n return this.serie;\n }\n\n /**\n * Assigns the shape to the default x and y axes of the graph, only if they don't exist yet\n * @return {Shape} The current shape\n * @see Graph#getXAxis\n * @see Graph#getYAxis\n */\n autoAxes() {\n\n if ( !this.xAxis ) {\n this.xAxis = this.graph.getXAxis();\n }\n\n if ( !this.yAxis ) {\n this.yAxis = this.graph.getYAxis();\n }\n\n return this;\n }\n\n /**\n * Assigns the shape to an x axis\n * @param {XAxis} The X axis related to the shape\n * @return {Shape} The current shape\n */\n setXAxis( axis ) {\n this.xAxis = axis;\n return this;\n }\n\n /**\n * Assigns the shape to an y axis\n * @param {YAxis} The Y axis related to the shape\n * @return {Shape} The current shape\n */\n setYAxis( axis ) {\n this.yAxis = axis;\n }\n\n /**\n * Returns the x axis associated to the shape. If non-existent, assigns it automatically\n * @return {XAxis} The x axis associated to the shape.\n */\n getXAxis() {\n\n if ( !this.xAxis ) {\n this.autoAxes();\n }\n\n return this.xAxis;\n }\n\n /**\n * Returns the y axis associated to the shape. If non-existent, assigns it automatically\n * @return {YAxis} The y axis associated to the shape.\n */\n getYAxis() {\n\n if ( !this.yAxis ) {\n this.autoAxes();\n }\n\n return this.yAxis;\n }\n\n /**\n * Sets the layer of the shape\n * @param {Number} layer - The layer number (1 being the lowest)\n * @return {Shape} The current shape\n * @see Shape#getLayer\n */\n setLayer( layer ) {\n this.setProp( 'layer', layer );\n return this;\n }\n\n /**\n * Returns the layer on which the shape is placed\n * @return {Number} The layer number (1 being the lowest layer)\n */\n getLayer() {\n var layer = this.getProp( 'layer' );\n\n if ( layer !== undefined ) {\n return layer;\n }\n\n return 1;\n }\n\n /**\n * Initial drawing of the shape. Adds it to the DOM and creates the labels. If the shape was already in the DOM, the method simply recreates the labels and reapplies the shape style, unless ```force``` is set to ```true```\n * @param {Boolean} force - Forces adding the shape to the DOM (useful if the shape has changed layer)\n * @param {Boolean} preventRedraw - Prevents the redraw method\n * @return {Shape} The current shape\n */\n draw( force, preventRedraw ) {\n\n if ( !this._inDom || force ) {\n\n this.appendToDom();\n this._inDom = true;\n }\n\n this.makeLabels();\n\n if ( !preventRedraw ) {\n this.redraw();\n }\n\n this.applyStyle();\n\n return this;\n }\n\n /**\n * Redraws the shape. Repositions it, applies the style and updates the labels\n * @return {Shape} The current shape\n */\n redraw() {\n\n if ( this.hidden ) {\n return this;\n }\n\n this.position = this.applyPosition();\n\n this.redrawImpl();\n if ( !this.position ) {\n this.updateLabels();\n return this;\n }\n\n this.updateLabels();\n this._applyTransforms();\n return this;\n }\n\n /**\n * Implementation of the redraw method. Extended Shape classes should override this method\n */\n redrawImpl() {}\n\n /**\n * Sets all dumpable properties of the shape\n * @param {Object} properties - The properties object\n * @return {Shape} The current shape\n */\n setProperties( properties ) {\n this.properties = properties;\n\n if ( !Array.isArray( this.properties.position ) ) {\n this.properties.position = [ this.properties.position ];\n }\n var self = this;\n for ( var i = 0, l = this.properties.position.length; i < l; i++ ) {\n\n var pos = GraphPosition.check( this.properties.position[ i ], function( relativeTo ) {\n return self.getRelativePosition( relativeTo );\n } );\n\n this.properties.position[ i ] = pos;\n }\n\n this.emit( 'propertiesChanged' );\n return this;\n }\n\n getRelativePosition( relativePosition ) {\n\n var result;\n if ( ( result = /position([0-9]*)/.exec( relativePosition ) ) !== null ) {\n return this.getPosition( result[ 1 ] );\n } else if ( ( result = /labelPosition([0-9]*)/.exec( relativePosition ) ) !== null ) {\n return this.getLabelPosition( result[ 1 ] );\n }\n\n }\n\n /**\n * Gets all dumpable properties of the shape\n * @return {Object} properties - The properties object\n */\n getProperties( properties ) {\n return this.properties;\n }\n\n /**\n * Sets a property to the shape that is remembered and can be later reexported (or maybe reimported)\n * @param {String} prop - The property to save\n * @param val - The value to save\n * @param [ index = 0 ] - The index of the property array to save the property\n * @return {Shape} The current shape\n */\n setProp( prop, val, index ) {\n this.properties = this.properties || {};\n this.properties[ prop ] = this.properties[ prop ] || [];\n this.properties[ prop ][ index || 0 ] = val;\n this.emit( 'propertyChanged', prop );\n return this;\n }\n\n /**\n * Returns a property of the shape\n * @param {String} prop - The property to retrieve\n * @param [ index = 0 ] - The index of the property array\n */\n getProp( prop, index ) {\n return ( this.properties[ prop ] || [] )[ index || 0 ];\n }\n\n /**\n * Returns all the properties of the shape\n * @param {String} prop - The property to retrieve\n */\n getProps( prop, index ) {\n return ( this.properties[ prop ] || [] );\n }\n\n /**\n * Adds a property to the property array\n * @param {String} prop - The property to add\n * @param val - The value to save\n */\n addProp( prop, value ) {\n this.properties[ prop ] = this.properties[ prop ] || [];\n this.properties[ prop ].push( value );\n }\n\n /**\n * Resets the property array\n * @param {String} prop - The property to reset\n */\n resetProp( prop ) {\n this.properties[ prop ] = [];\n }\n\n /**\n * Sets a DOM property to the shape\n */\n setDom( prop, val, noForce ) {\n if ( this._dom ) {\n\n if ( !noForce || !util.hasSavedAttribute( this._dom, prop ) ) {\n this._dom.setAttribute( prop, val );\n }\n }\n }\n\n /**\n * Sets a DOM property to the shape group\n */\n setDomGroup( prop, val ) {\n if ( this.group ) {\n this.group.setAttribute( prop, val );\n }\n }\n\n /**\n * Saves the stroke color\n * @return {Shape} The current shape\n */\n setStrokeColor( color ) {\n this.setProp( 'strokeColor', color );\n this.overwriteSavedProp( 'stroke', color );\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the stroke color\n * @return {String} The stroke color of the shape\n */\n getStrokeColor() {\n return this.getProp( 'strokeColor' );\n }\n\n /**\n * Saves the fill color\n * @param {String} color - The filling color\n * @return {Shape} The current shape\n */\n setFillColor( color ) {\n\n this.setProp( 'fillColor', color );\n this.overwriteSavedProp( 'fill', color );\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the fill color\n * @return {String} The fill color of the shape\n */\n getFillColor() {\n return this.getProp( 'fillColor' );\n }\n\n /**\n * Saves the opacity of the filling color of the shape\n * @param {Number} opacity - The filling opacity (0 to 1)\n * @return {Shape} The current shape\n */\n setFillOpacity( opacity ) {\n this.setProp( 'fillOpacity', opacity );\n this.overwriteSavedProp( 'fill-opacity', opacity );\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Saves the stroke width\n * @param {String} width - The stroke width\n * @return {Shape} The current shape\n */\n setStrokeWidth( width ) {\n this.setProp( 'strokeWidth', width );\n this.overwriteSavedProp( 'stroke-width', width );\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the stroke width\n * @return {String} The stroke width of the shape\n */\n getStrokeWidth() {\n return this.getProp( 'strokeWidth' );\n }\n\n /**\n * Saves the stroke dash array\n * @param {String} dasharray - The dasharray string\n * @example shape.setStrokeDasharray(\"5,5,1,4\");\n * shape.applyStyle();\n * @return {Shape} The current shape\n */\n setStrokeDasharray( dasharray ) {\n this.setProp( 'strokeDasharray', dasharray );\n this.overwriteSavedProp( 'stroke-dasharray', dasharray );\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Sets any extra attributes to the DOM element of the shape\n * @param {Object} attributes - An extra attribute array to apply to the shape DOM\n * @example shape.setAttributes( { \"data-bindable\" : true } );\n * shape.applyStyle();\n * @return {Shape} The current shape\n */\n setAttributes( attributes ) {\n this.setProp( 'attributes', attributes );\n return this;\n }\n\n overwriteSavedProp( prop, newValue ) {\n util.overwriteDomAttribute( this._dom, prop, newValue );\n }\n\n /**\n * Adds an extra attribute to the shape\n * @param {String} attributeName - The name of the attribute\n * @param {String} attributeValue - The value of the attribute\n * @return {Shape} The current shape\n */\n addAttribute( attributeName, attributeValue ) {\n var added = {};\n added[ attributeName ] = attributeValue;\n this.addProp( 'attributes', added );\n return this;\n }\n\n /**\n * Adds a transform property to the shape.\n * @param {String} type - The transform type (\"rotate\", \"transform\" or \"scale\")\n * @param {String} args - The arguments following the transform\n * @return {Shape} The current shape\n */\n addTransform( type, args ) {\n this.addProp( 'transforms', {\n type: type,\n arguments: Array.isArray( args ) ? args : [ args ]\n } );\n return this;\n }\n\n /**\n * Resets the transforms\n * @see Shape#addTransform\n * @return {Shape} The current shape\n */\n resetTransforms() {\n this.resetProp( 'transforms' );\n return this;\n }\n\n /**\n * Sets the text of the label\n * @param {String} text - The text of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelText( text, index = 0 ) {\n this.setProp( 'labelText', text, index );\n return this;\n }\n\n /**\n * Sets the text of the label\n * @param {String} data - Some additional HTML tags that will be set to the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelData( data, text, index = 0 ) {\n this.setProp( 'labelData', text, index );\n return this;\n }\n\n /**\n * Returns the text of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {String} The text of the label\n */\n getLabelText( text, index = 0 ) {\n return this.getProp( 'labelText', index );\n }\n\n /**\n * Displays a hidden label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n displayLabel( index = 0 ) {\n this.setProp( 'labelVisible', true, index );\n return this;\n }\n\n /**\n * Hides a displayed label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n hideLabel( index = 0 ) {\n this.setProp( 'labelVisible', false, index );\n return this;\n }\n\n /**\n * Sets the color of the label\n * @param {String} color - The color of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelColor( color, index = 0 ) {\n this.setProp( 'labelColor', color, index );\n return this;\n }\n\n /**\n * Sets the font size of the label\n * @param {String} size - The font size (in px) of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelFontSize( size, index = 0 ) {\n this.setProp( 'labelFontSize', size, index );\n return this;\n }\n\n /**\n * Returns the position of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Position} The current position of the label\n */\n getLabelPosition( index = 0 ) {\n return this.getProp( 'labelPosition', index );\n }\n\n /**\n * Sets the position of the label\n * @param {Position} position - The position of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelPosition( position, index ) {\n\n var self;\n var pos = GraphPosition.check( position, function( relativeTo ) {\n return self.getRelativePosition( relativeTo );\n } );\n\n this.setProp( 'labelPosition', pos, index || 0 );\n return this;\n }\n\n /**\n * Sets the angle of the label\n * @param {Number} angle - The angle of the label in degrees (0 to 360°)\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelAngle( angle, index ) {\n this.setProp( 'labelAngle', angle, index || 0 );\n return this;\n }\n\n /**\n * Sets the baseline of the label, which affects its y position with respect to the text direction. For text along the x direction, different baselines will reference differently the text to the ```y``` coordinate.\n * @param {String} baseline - The baseline of the label. Most common baselines are ```no-change```, ```central```, ```middle``` and ```hanging```. You will find an explanation of those significations on the [corresponding MDN article]{@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/dominant-baseline}\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBaseline( baseline, index ) {\n this.setProp( 'labelBaseline', baseline, index || 0 );\n return this;\n }\n\n /**\n * Sets the anchoring of the label.\n * @param {String} anchor - The anchor of the label. Values can be ```start```, ```middle```, ```end``` or ```inherit```.\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelAnchor( anchor, index ) {\n this.setProp( 'labelAnchor', anchor, index || 0 );\n return this;\n }\n\n /**\n * Sets the anchoring of the label.\n * @param {String} size - The font size in px\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelSize( size, index ) {\n this.setProp( 'labelSize', size, index || 0 );\n return this;\n }\n\n /**\n * Sets the color of the stroke of the label.\n * @param {String} color - The color of the stroke\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelStrokeColor( color, index ) {\n this.setProp( 'labelStrokeColor', color, index || 0 );\n return this;\n }\n\n /**\n * Sets the width of the stroke of the label.\n * @param {Number} width - The width of the stroke\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelStrokeWidth( width, index ) {\n this.setProp( 'labelStrokeWidth', width, index || 0 );\n return this;\n }\n\n /**\n * Sets the color of the background of the label.\n * @param {String} color - The color of the background\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBackgroundColor( color, index ) {\n this.setProp( 'labelBackgroundColor', color, index || 0 );\n return this;\n }\n\n /**\n * Sets the opacity of the background of the label.\n * @param {Number} opacity - The opacity of the background, between 0 and 1\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBackgroundOpacity( opacity, index ) {\n this.setProp( 'labelBackgroundOpacity', opacity, index || 0 );\n return this;\n }\n\n /**\n * Applies the generic style to the shape. This is a method that applies to most shapes, hence should not be overridden. However if you create a bundle of shapes that extend another one, you may use it to set common style properties to all your shapes.\n * @return {Shape} The current shape\n */\n applyGenericStyle() {\n\n this.setDom( 'fill', this.getProp( 'fillColor' ), true );\n this.setDom( 'fill-opacity', this.getProp( 'fillOpacity' ), true );\n this.setDom( 'stroke', this.getProp( 'strokeColor' ), true );\n this.setDom( 'stroke-width', this.getProp( 'strokeWidth' ), true );\n this.setDom( 'stroke-dasharray', this.getProp( 'strokeDasharray' ), true );\n\n var attributes = this.getProps( 'attributes' );\n for ( var j = 0, l = attributes.length; j < l; j++ ) {\n\n for ( var i in attributes[ j ] ) {\n this.setDom( i, typeof attributes[ j ][ i ] == 'function' ? attributes[ j ][ i ].call( this, i ) : attributes[ j ][ i ], true );\n }\n\n }\n\n this._applyTransforms();\n\n return this;\n }\n\n /**\n * Applies the style to the shape. This method can be extended to apply specific style to the shapes\n * @return {Shape} The current shape\n */\n applyStyle() {\n\n return this.applyGenericStyle();\n }\n\n /**\n * Returns a computed position object\n * @param {(Number|Position)} [ index = 0 ] - The index of the position to compute\n * @param {Position} relToPosition - A base position from which to compute the position (useful for dx values)\n * @return {Object} The computed position object in the format { x: x_in_px, y: y_in_px }\n */\n calculatePosition( index ) {\n\n var position;\n\n position = ( index instanceof GraphPosition ) ? index : this.getPosition( index );\n\n if ( !position ) {\n return;\n }\n\n if ( position && position.compute ) {\n return position.compute( this.graph, this.getXAxis(), this.getYAxis(), this.getSerie() );\n }\n\n this.graph.throw();\n }\n\n /**\n * Returns a stored position object\n * @param {Number} [ index = 0 ] - The index of the position to compute\n * @return {Position} The position at the proper index, or undefined\n */\n getPosition( index ) {\n\n var pos = this.getProp( 'position', ( index || 0 ) );\n this.setProp( 'position', ( pos = GraphPosition.check( pos ) ), index );\n return pos;\n }\n\n /**\n * Sets a position object\n * @param {Position} position - The position object to store\n * @param {Number} [ index = 0 ] - The index of the position to store\n * @return {Shape} The current shape\n */\n setPosition( position, index ) {\n\n var self = this;\n var pos = GraphPosition.check( position, function( relativeTo ) {\n return self.getRelativePosition( relativeTo );\n } );\n\n return this.setProp( 'position', pos, ( index || 0 ) );\n }\n\n /**\n * Sorts the positions\n * @param {Function} sortFunction - Function passed into the ```Array.sort``` method\n * @return {Position} The current shape\n */\n sortPositions( sortFunction ) {\n this.getProps( 'position' ).sort( sortFunction );\n return this;\n }\n\n /**\n * Applies the style to the shape. This method can be extended to apply specific style to the shapes\n * @private\n * @return {Shape} The current shape\n */\n _applyTransforms() {\n\n var transforms = this.getProp( 'transforms' ),\n transformString = '';\n\n if ( !transforms ) {\n return;\n }\n transforms = Array.isArray( transforms ) ? transforms : [ transforms ];\n\n if ( transforms.length == 0 ) {\n return;\n }\n\n for ( var i = 0; i < transforms.length; i++ ) {\n\n transformString += transforms[ i ].type + '(';\n\n switch ( transforms[ i ].type ) {\n\n case 'translate':\n\n let transform = transforms[ i ].arguments[ 0 ].compute( this.graph, this.getXAxis(), this.getYAxis(), this.getSerie() );\n\n transformString += transform.x;\n transformString += ', ';\n transformString += transform.y;\n break;\n\n case 'rotate':\n\n transformString += transforms[ i ].arguments[ 0 ];\n transformString += ', ';\n\n if ( transforms[ i ].arguments.length == 1 ) {\n var p = this.computePosition( 0 );\n transformString += p.x + ', ' + p.y;\n\n } else {\n\n transformString += GraphPosition.getDeltaPx( transforms[ i ].arguments[ 1 ], this.getXAxis() ).replace( 'px', '' );\n transformString += ', ';\n transformString += GraphPosition.getDeltaPx( transforms[ i ].arguments[ 2 ], this.getYAxis() ).replace( 'px', '' );\n }\n\n break;\n }\n\n transformString += ') ';\n }\n\n this.setDomGroup( 'transform', transformString );\n return this;\n }\n\n /**\n * Creates all the labels\n * @private\n * @returns {Shape} The current shape\n */\n makeLabels() {\n\n this._labels = this._labels || [];\n this._labelsBackground = this._labelsBackground || [];\n\n this._labels.map( ( label ) => {\n this.group.removeChild( label );\n } );\n\n this._labelsBackground.map( ( bg ) => {\n this.group.removeChild( bg );\n } );\n\n this._labels = [];\n this._labelsBackground[ i ] = [];\n\n var i = 0;\n\n while ( this.getProp( 'labelText', i ) !== undefined ) {\n\n if ( !this._labels[ i ] ) {\n\n this._labels[ i ] = document.createElementNS( this.graph.ns, 'text' );\n this._labels[ i ].setAttribute( 'data-label-i', i );\n this._labels[ i ].jsGraphIsShape = this;\n\n this._labelsBackground[ i ] = document.createElementNS( this.graph.ns, 'rect' );\n this._labelsBackground[ i ].setAttribute( 'data-label-i', i );\n this._labelsBackground[ i ].jsGraphIsShape = this;\n\n this.group.appendChild( this._labelsBackground[ i ] );\n this.group.appendChild( this._labels[ i ] );\n\n this._labels[ i ].addEventListener( 'dblclick', ( e ) => {\n e.stopPropagation();\n\n this.labelDblClickListener( e );\n } );\n\n this._labelsBackground[ i ].addEventListener( 'dblclick', ( e ) => {\n e.stopPropagation();\n\n this.labelDblClickListener( e );\n } );\n\n }\n\n i++;\n }\n\n this.updateLabels();\n\n return this;\n }\n\n /**\n * Determines if the label is editable\n * @param {Number} labelIndex - The index of the label\n * @return {Boolean} ```true``` if the label is editable, ```false``` otherwise\n */\n isLabelEditable( labelIndex ) {\n return this.getProp( 'labelEditable', labelIndex || 0 );\n }\n\n /**\n * Applies the label data to the dom object\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {Shape} The current shape\n */\n updateLabels() {\n\n var self = this;\n this._labels = this._labels || [];\n\n for ( var i = 0, l = this._labels.length; i < l; i++ ) {\n this._applyLabelData( i );\n }\n\n }\n\n /**\n * Applies the label data to the dom object\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {Shape} The current shape\n */\n _applyLabelData( labelIndex ) {\n\n labelIndex = labelIndex || 0;\n\n /** Sets the position */\n\n var visible = this.getProp( 'labelVisible', labelIndex );\n\n if ( visible === false ) {\n this._labels[ labelIndex ].setAttribute( 'display', 'none' );\n this._labelsBackground[ labelIndex ].setAttribute( 'display', 'none' );\n return;\n } else {\n this._labels[ labelIndex ].setAttribute( 'display', 'initial' );\n this._labelsBackground[ labelIndex ].setAttribute( 'display', 'initial' );\n }\n\n var position = this.calculatePosition( GraphPosition.check( this.getProp( 'labelPosition', labelIndex ) ) );\n\n if ( isNaN( position.x ) || isNaN( position.y ) || position.y === false || position.x === false ) {\n /*console.warn( \"Cannot compute positioning for labelIndex \" + labelIndex + \" with text \" + this.getProp( \"labelText\", labelIndex ) );\n console.log( this, this._labels );\n console.trace();*/\n return;\n\n }\n\n if ( position.x != 'NaNpx' && !isNaN( position.x ) && position.x !== 'NaN' && position.x !== false ) {\n\n this._labels[ labelIndex ].setAttribute( 'x', position.x );\n this._labels[ labelIndex ].setAttribute( 'y', position.y );\n }\n\n /** Sets the angle */\n var currAngle = this.getProp( 'labelAngle', labelIndex ) || 0;\n if ( currAngle != 0 ) {\n\n var x = this._labels[ labelIndex ].getAttribute( 'x' ),\n y = this._labels[ labelIndex ].getAttribute( 'y' );\n\n this._labels[ labelIndex ].setAttribute( 'transform', 'rotate(' + currAngle + ' ' + x + ' ' + y + ')' );\n // this._labelsBackground[ labelIndex ].setAttribute( 'transform', 'rotate(' + currAngle + ' ' + x + ' ' + y + ')' );\n }\n\n let labelData = this.getProp( 'labelHTMLData', labelIndex ) || {};\n\n for ( var i in labelData ) {\n\n this._labels[ labelIndex ].setAttribute( i, labelData[ i ] );\n this._labelsBackground[ labelIndex ].setAttribute( i, labelData[ i ] );\n }\n\n /** Sets the baseline */\n this._labels[ labelIndex ].setAttribute( 'dominant-baseline', this.getProp( 'labelBaseline', labelIndex ) || 'no-change' );\n\n /** Sets the text */\n this._labels[ labelIndex ].textContent = this.getProp( 'labelText', labelIndex );\n\n /** Sets the color */\n this._labels[ labelIndex ].setAttribute( 'fill', this.getProp( 'labelColor', labelIndex ) || 'black' );\n\n /** Sets the size */\n this._labels[ labelIndex ].setAttribute( 'font-size', this.getProp( 'labelSize', labelIndex ) + 'px' || '12px' );\n\n /** Sets the anchor */\n this._labels[ labelIndex ].setAttribute( 'text-anchor', this._getLabelAnchor( labelIndex ) );\n\n /** Sets the stroke */\n this._labels[ labelIndex ].setAttribute( 'stroke', this.getProp( 'labelStrokeColor', labelIndex ) || 'black' );\n\n /** Sets the stroke */\n this._labels[ labelIndex ].setAttribute( 'stroke-width', this.getProp( 'labelStrokeWidth', labelIndex ) || 0 + 'px' );\n\n this._labels[ labelIndex ].setAttribute( 'stroke-location', 'outside' );\n\n let rect = this._labels[ labelIndex ].getBBox();\n\n this._labelsBackground[ labelIndex ].setAttribute( 'x', rect.x );\n this._labelsBackground[ labelIndex ].setAttribute( 'y', rect.y );\n this._labelsBackground[ labelIndex ].setAttribute( 'width', rect.width );\n this._labelsBackground[ labelIndex ].setAttribute( 'height', rect.height );\n\n this._labelsBackground[ labelIndex ].setAttribute( 'fill', this.getProp( 'labelBackgroundColor' ) || 'transparent' );\n this._labelsBackground[ labelIndex ].setAttribute( 'fill-opacity', this.getProp( 'labelBackgroundOpacity' ) || 1 );\n\n return this;\n }\n\n /**\n * Temporarily empties the labels, until the next rendering.\n * This is used when the shape should not be displayed\n * @returns {Shape} The current shape instance\n */\n emptyLabels() {\n\n for ( var i = 0, l = this._labels.length; i < l; i++ ) {\n /** Sets the baseline */\n this._labels[ i ].textContent = '';\n }\n\n return this;\n }\n\n /**\n * Returns the anchor of the label\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {String} The anchor in SVG string\n */\n _getLabelAnchor( labelIndex ) {\n var anchor = this.getProp( 'labelAnchor', labelIndex );\n switch ( anchor ) {\n case 'middle':\n case 'start':\n case 'end':\n return anchor;\n break;\n\n case 'right':\n return 'end';\n break;\n\n case 'left':\n return 'start';\n break;\n\n default:\n return 'start';\n break;\n }\n }\n\n /**\n * Returns the shape selection status\n * @returns {Boolean} true is the shape is selected, false otherwise\n */\n isSelected() {\n return this._selectStatus || false;\n }\n\n /**\n * Sets or queries whether the shape can have handles. Even if the property is set to false, the getter can return true if the property ```statichandles``` is true (used when handles never disappear)\n * @param {Boolean} setter - If used, defined if the shape has handles or not\n * @returns {Boolean} true is the shape has handles, false otherwise\n * @example Shape.hasHandles( true ); // Sets that the shape has handles\n * @example Shape.hasHandles( false ); // Sets that the shape has no handles\n * @example Shape.hasHandles( ); // Queries the shape to determine if it has handles or not. Also returns true if handles are static\n */\n hasHandles( setter ) {\n\n if ( setter !== undefined ) {\n this.setProp( 'handles', setter );\n }\n\n return !!this.getProp( 'handles' ) || !!this.getProp( 'staticHandles' );\n }\n\n /**\n * Adds shape handles\n * @private\n * @return {Shape} The current shape\n */\n addHandles() {\n\n if ( this.isLocked() ) {\n return;\n }\n\n if ( !this.handlesInDom ) {\n\n this.handlesInDom = true;\n\n for ( var i = 1; i < this.handles.length; i++ ) {\n\n if ( this.handles[ i ] ) {\n this.group.appendChild( this.handles[ i ] );\n }\n }\n }\n\n return this;\n }\n\n /**\n * Remove shape handles\n * @private\n * @return {Shape} The current shape\n */\n removeHandles() {\n\n this.hideHandles();\n this.handles = [];\n }\n\n /**\n * Hide shape handles\n * @private\n * @return {Shape} The current shape\n */\n hideHandles() {\n\n if ( !this.handlesInDom ) {\n return this;\n }\n\n for ( var i = 1; i < this.handles.length; i++ ) {\n this.group.removeChild( this.handles[ i ] );\n }\n\n this.handlesInDom = false;\n return this;\n }\n\n /**\n * @protected\n * @return {Boolean} ```true``` if the handles are in the DOM\n */\n areHandlesInDom() {\n\n return this.handlesInDom;\n }\n\n /**\n * Selects the shape. Should only be called from jsGraph main instance\n * @private\n * @param {Boolean} [ mute = false ] - Mutes the method (no event emission)\n * @returns {Shape} the current shape\n */\n _select( mute ) {\n\n if ( !this.isSelectable() ) {\n return false;\n }\n\n // Put on the stack\n this.appendToDom();\n //this.graph.appendShapeToDom( this ); // Put the shape on top of the stack !\n\n this._selectStatus = true;\n\n this.applySelectedStyle();\n\n if ( this.hasHandles() && !this.hasStaticHandles() ) {\n\n this.addHandles();\n this.setHandles();\n\n }\n\n if ( !mute ) {\n this.graph.emit( 'shapeSelected', this );\n }\n }\n\n applySelectedStyle() {\n\n if ( !this._selectStatus ) {\n return;\n }\n\n var style = this.getSelectStyle();\n var style2 = {};\n for ( var i in style ) {\n if ( typeof style[ i ] == 'function' ) {\n style2[ i ] = style[ i ].call( this );\n } else {\n style2[ i ] = style[ i ];\n }\n }\n\n util.saveDomAttributes( this._dom, style2, 'select' );\n }\n\n /**\n * Unselects the shape. Should only be called from jsGraph main instance\n * @private\n * @param {Boolean} [ mute = false ] - Mutes the method (no event emission)\n * @returns {Shape} the current shape\n */\n _unselect( mute ) {\n\n this._selectStatus = false;\n\n util.restoreDomAttributes( this._dom, 'select' );\n\n if ( this.hasHandles() && !this.hasStaticHandles() ) {\n this.hideHandles();\n }\n\n if ( !mute ) {\n this.graph.emit( 'shapeUnselected', this );\n }\n }\n\n /**\n * Returns the special style of the shape when it is selected.\n * @see Shape#setSelectStyle\n * @param {Object} The SVG attributes to apply to the shape\n */\n getSelectStyle() {\n return this.selectStyle;\n }\n\n /**\n * Defines the style that is applied to the shape when it is selected. The style extends the default style of the shape\n * @param {Object} [ attr = {} ] - The SVG attributes to apply to the shape\n * @example rectangle.setSelectStyle( { fill: 'red' } );\n * @returns {Shape} the current shape\n */\n setSelectStyle( attr ) {\n this.selectStyle = attr;\n this.applySelectedStyle(); // Maybe the shape is already selected\n return this;\n }\n\n /**\n * Assigns static handles to the shape. In this mode, handles will not disappear\n * @param {Boolean} staticHandles - true to enable static handles, false to disable them.\n * @returns {Shape} the current shape\n */\n setStaticHandles( staticHandles ) {\n this.setProp( 'staticHandles', staticHandles );\n }\n\n /**\n * @returns {Boolean} ```true``` if the shape has static handles, ```false``` otherwise\n */\n hasStaticHandles( staticHandles ) {\n return !!this.getProp( 'staticHandles' );\n }\n\n /**\n * Creates the handles for the shape\n * @param {Number} nb - The number of handles\n * @param {String} type - The type of SVG shape to use\n * @param {Object} [ attr = {} ] - The SVG attributes to apply to the handles\n * @param {Function} [ callbackEach ] - An additional callback the user can provide to further personalize the handles\n * @returns {Shape} the current shape\n * @private\n */\n _createHandles( nb, type, attr, callbackEach ) {\n\n if ( this.handles && this.handles.length > 0 ) {\n return;\n }\n\n var self = this;\n\n for ( var i = 1, l = nb; i <= l; i++ ) {\n\n ( ( j ) => {\n\n var self = this;\n\n var handle = document.createElementNS( self.graph.ns, type );\n handle.jsGraphIsShape = true;\n\n if ( attr ) {\n for ( var k in attr ) {\n handle.setAttribute( k, attr[ k ] );\n }\n }\n\n handle\n .addEventListener( 'mousedown', ( e ) => {\n\n if ( self.isResizable() ) {\n\n e.preventDefault();\n e.stopPropagation();\n\n self.graph.emit( 'beforeShapeResize', self );\n this.emit( 'beforeShapeResize' );\n\n if ( !self.graph.prevent( false ) ) {\n\n self.resizing = true;\n self.handleSelected = j;\n self.handleMouseDown( e );\n }\n }\n\n } );\n\n if ( callbackEach ) {\n callbackEach( self.handles[ j ] );\n }\n\n self.handles[ j ] = handle;\n\n } ).call( this, i );\n\n }\n\n return this.handles;\n }\n\n /**\n * Creates the handles for the shape. Should be implemented by the children shapes classes.\n */\n createHandles() {\n\n if ( this.hasStaticHandles() ) {\n this.addHandles();\n this.setHandles();\n }\n\n }\n\n /**\n * Handles mouse down event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseDownImpl() {}\n\n /**\n * Handles the mouse move event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseMoveImpl() {}\n\n /**\n * Handles mouse up event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseUpImpl() {}\n\n /**\n * Called when the shape is created\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleCreateImpl() {}\n\n /**\n * Handles mouse down events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDownImpl} method.prototype\n */\n handleMouseDown( e ) {\n\n //this.handleSelected = false;\n\n if ( this.isLocked() ) {\n return;\n }\n\n if ( this.isMovable() || this.isResizable() ) {\n\n this.graph.elementMoving( this );\n }\n\n if ( this.getProp( 'selectOnMouseDown' ) ) {\n this.graph.selectShape( this );\n }\n\n if ( this.isMovable() ) {\n if ( !this.resizing ) {\n\n this.graph.emit( 'beforeShapeMove', self );\n\n if ( !this.graph.prevent( false ) ) {\n\n this.moving = true;\n this.moved = false;\n }\n }\n }\n\n this._mouseCoords = this.graph._getXY( e );\n return this.handleMouseDownImpl( e, this._mouseCoords );\n }\n\n /**\n * Handles mouse click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDownClick} method\n * @private\n */\n handleClick( e ) {\n\n this.graph.emit( 'shapeClicked', this );\n this.emit( 'shapeClicked' );\n\n if ( !this.isSelectable() ) {\n return false;\n }\n\n if ( !e.shiftKey ) {\n this.graph.unselectShapes();\n }\n\n if ( this.getProp( 'selectOnClick' ) ) {\n\n this.graph.selectShape( this );\n }\n }\n\n /**\n * Handles mouse click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseUpImpl} method\n * @private\n */\n handleMouseMove( e ) {\n //console.log( this.resizinh, this.moving, this.isSelected(), this._mouseCoords );\n if ( ( this.resizing || this.moving ) && !this.isSelected() ) {\n this.graph.selectShape( this );\n }\n\n this.graph.emit( 'beforeShapeMouseMove', this );\n this.emit( 'beforeShapeMouseMove' );\n\n if ( this.graph.prevent( false ) || !this._mouseCoords ) {\n return false;\n }\n\n this.moved = true;\n var coords = this.graph._getXY( e );\n var\n deltaX = this.getXAxis().getRelVal( coords.x - this._mouseCoords.x ),\n deltaY = this.getYAxis().getRelVal( coords.y - this._mouseCoords.y );\n\n if ( deltaX != 0 || deltaY !== 0 ) {\n this.preventUnselect = true;\n }\n\n this._mouseCoords = coords;\n\n var ret = this.handleMouseMoveImpl( e, deltaX, deltaY, coords.x - this._mouseCoords.x, coords.y - this._mouseCoords.y );\n\n return ret;\n\n }\n\n /**\n * Handles mouse up events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseUpImpl} method\n * @private\n */\n handleMouseUp( e ) {\n\n if ( this.moving && this.moved ) {\n\n this.graph.emit( 'shapeMoved', this );\n this.emit( 'shapeMoved' );\n\n }\n\n if ( this.handleSelected || this.resize ) {\n\n this.graph.emit( 'shapeResized', this );\n this.emit( 'shapeResized' );\n\n }\n\n this.moving = false;\n this.resizing = false;\n this.handleSelected = false;\n this.graph.elementMoving( false );\n\n return this.handleMouseUpImpl( e );\n }\n\n /**\n * Handles double click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDblClickImpl} method\n * @private\n */\n handleDblClick( e ) {\n\n }\n\n /**\n * Handles mouse over events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseOverImpl} method\n * @private\n */\n handleMouseOver() {\n\n if ( this.getProp( 'highlightOnMouseOver' ) ) {\n\n if ( !this.moving && !this.resizing ) {\n this.highlight();\n }\n }\n\n this.graph.emit( 'shapeMouseOver', this );\n }\n\n /**\n * Handles mouse out events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseOutImpl} method\n * @private\n */\n handleMouseOut() {\n\n if ( this.getProp( 'highlightOnMouseOver' ) ) {\n this.unHighlight();\n }\n\n this.graph.emit( 'shapeMouseOut', this );\n }\n\n /*\n * Updated July 1st, 2015\n */\n\n /**\n * Locks the shape (prevents selection, resizing and moving)\n * @return {Shape} The current shape\n */\n lock() {\n this.setProp( 'locked', true );\n return this;\n }\n\n /**\n * Unlocks the shape (prevents selection, resizing and moving)\n * @return {Shape} The current shape\n */\n unlock() {\n this.setProp( 'locked', false );\n return this;\n }\n\n /**\n * @return {Boolean} True if the shape is locked, false otherwise\n */\n isLocked() {\n return this.getProp( 'locked' ) || this.graph.shapesLocked;\n }\n\n /**\n * Makes the shape moveable\n * @return {Shape} The current shape\n */\n movable( bln ) {\n this.setProp( 'movable', true );\n }\n\n /**\n * Makes the shape non-moveable\n * @return {Shape} The current shape\n */\n unmovable() {\n this.setProp( 'movable', false );\n return false;\n }\n\n /**\n * @return {Boolean} True if the shape is movable, false otherwise\n */\n isMovable() {\n return this.getProp( 'movable' );\n }\n\n /**\n * Makes the shape resizable\n * @return {Shape} The current shape\n */\n resizable() {\n this.setProp( 'resizable', true );\n }\n\n /**\n * Makes the shape non-resizable\n * @return {Shape} The current shape\n */\n unresizable() {\n this.setProp( 'resizable', false );\n }\n\n /**\n * @return {Boolean} True if the shape is resizable, false otherwise\n */\n isResizable() {\n return this.getProp( 'resizable' );\n }\n\n /**\n * Makes the shape selectable\n * @return {Shape} The current shape\n */\n selectable() {\n this.setProp( 'selectable', true );\n }\n\n /**\n * Makes the shape non-selectable\n * @return {Shape} The current shape\n */\n unselectable() {\n this.graph.unselectShape( this );\n this.setProp( 'selectable', false );\n }\n\n /**\n * @return {Boolean} True if the shape is selectable, false otherwise\n */\n isSelectable() {\n return this.getProp( 'selectable' );\n }\n\n /**\n * Highlights the shape with attributes\n * @returns {Shape} The current shape\n * @param {Object} [ attributes ] - A hashmap of attributes to apply. If omitted, {@link Shape#getHighlightAttributes} will be called\n * @param {String} [ saveDomName=highlight ] - The name to which the current shape attributes will be saved to be recovered later with the {@link Shape#unHighlight} method\n * @example shape.highlight( { fill: 'red', 'fill-opacity': 0.5 } );\n * @see Shape#unHighlight\n */\n highlight( attributes, saveDomName ) {\n\n if ( !attributes ) {\n attributes = this.getHighlightAttributes();\n }\n\n if ( !saveDomName ) {\n saveDomName = 'highlight';\n }\n\n util.saveDomAttributes( this._dom, attributes, saveDomName );\n this.highlightImpl();\n return this;\n }\n\n /**\n * Removes the highlight properties from the same\n * @returns {Shape} The current shape\n * @param {String} [ saveDomName=highlight ] - The name to which the current shape attributes will be saved to be recovered later with the {@link Shape#unHighlight} method\n * @see Shape#highlight\n */\n unHighlight( saveDomName ) {\n\n if ( !saveDomName ) {\n saveDomName = 'highlight';\n }\n\n util.restoreDomAttributes( this._dom, saveDomName );\n this.unHighlightImpl();\n return this;\n }\n\n highlightImpl() {}\n unHighlightImpl() {}\n\n /**\n * @returns {Object} The attributes taken by the shape when highlighted\n * @see Shape#highlight\n */\n getHighlightAttributes() {\n return this._highlightAttributes;\n }\n\n /**\n * Sets the attributes the shape will take when highlighted\n * @param {Object} [ attributes ] - A hashmap of attributes to apply when the shape is highlighted\n * @returns {Shape} The current shape\n * @see Shape#highlight\n */\n setHighlightAttributes( attributes ) {\n this._highlightAttributes = attributes;\n return this;\n }\n\n /**\n * Returns the masking id of the shape. Returns null if the shape does not behave as a mask\n * @returns {String} The ```id``` attribute of the shape\n */\n getMaskingID() {\n return this.maskingId;\n }\n\n /**\n * Masks the current shape with another shape passed as the first parameter of the method\n * @param {Shape} maskingShape - The shape used to mask the current shape\n * @return {Shape} The current shape\n */\n maskWith( maskingShape ) {\n\n const maskingId = maskingShape.getMaskingID();\n\n if ( maskingId ) {\n\n this._dom.setAttribute( 'mask', 'url(#' + maskingId + ')' );\n\n } else {\n\n this._dom.removeAttribute( 'mask' );\n }\n }\n\n /**\n * Manually updates the mask of the shape. This is needed because the shape needs to be surrounded by a white rectangle (because transparent is treated as black and will not render the shape)\n * This method will work well for rectangles but should be overridden for other shapes\n * @return {Shape} The current shape\n * @todo Explore a way to make it compatible for all kinds of shapes. Maybe the masker position should span the whole graph...\n */\n updateMask() {\n return;\n if ( !this.maskDom ) {\n return; // eslint-disable-line no-useless-return\n }\n\n var position = {\n x: 'min',\n y: 'min'\n };\n var position2 = {\n x: 'max',\n y: 'max'\n };\n\n position = this._getPosition( position );\n position2 = this._getPosition( position2 );\n\n this.maskDomWrapper.setAttribute( 'x', Math.min( position.x, position2.x ) );\n this.maskDomWrapper.setAttribute( 'y', Math.min( position.y, position2.y ) );\n\n this.maskDomWrapper.setAttribute( 'width', Math.abs( position2.x - position.x ) );\n this.maskDomWrapper.setAttribute( 'height', Math.abs( position2.y - position.y ) );\n\n for ( var i = 0; i < this._dom.attributes.length; i++ ) {\n this.maskDom.setAttribute( this._dom.attributes[ i ].name, this._dom.attributes[ i ].value );\n }\n\n this.maskDom.setAttribute( 'fill', 'black' );\n\n return this;\n }\n\n labelDblClickListener( e ) {\n\n var i = parseInt( e.target.getAttribute( 'data-label-i' ) );\n\n var self = this;\n\n if ( isNaN( i ) ) {\n return;\n }\n\n if ( !this.isLabelEditable( i ) ) {\n return;\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n var shapeLabel = document.createElement( 'input' );\n shapeLabel.setAttribute( 'type', 'text' );\n shapeLabel.setAttribute( 'value', self.getProp( 'labelText', i ) );\n\n self.graph.wrapper.prepend( shapeLabel );\n shapeLabel.select();\n\n util.setCSS( shapeLabel, {\n position: 'absolute',\n marginTop: ( parseInt( e.target.getAttribute( 'y' ).replace( 'px', '' ) ) + this.graph.getPaddingTop() - 10 ) + 'px',\n marginLeft: ( parseInt( e.target.getAttribute( 'x' ).replace( 'px', '' ) ) + this.graph.getPaddingLeft() - 50 ) + 'px',\n textAlign: 'center',\n width: '100px'\n } );\n\n const previousValue = self.getLabelText( i );\n\n const blurEvent = function() {\n\n self.setLabelText( shapeLabel.value, i );\n self._labels[ i ].textContent = shapeLabel.value;\n\n const nextValue = shapeLabel.value;\n\n shapeLabel.remove();\n shapeLabel.removeEventListener( 'blur', blurEvent );\n shapeLabel = false;\n\n self.changed( 'shapeLabelChanged', {\n previousValue: previousValue,\n nextValue: nextValue\n } );\n };\n\n shapeLabel.addEventListener( 'blur', blurEvent );\n\n shapeLabel.addEventListener( 'keyup', function( e ) {\n\n if ( e.keyCode === 13 ) {\n blurEvent();\n }\n } );\n shapeLabel.addEventListener( 'keypress', function( e ) {\n e.stopPropagation();\n } );\n shapeLabel.addEventListener( 'keydown', function( e ) {\n e.stopPropagation();\n } );\n shapeLabel.focus();\n\n }\n\n /**\n * Appends the shape DOM to its parent\n * @private\n * @return {Shape} The current shape\n */\n appendToDom() {\n\n if ( this._forcedParentDom ) {\n\n this._forcedParentDom.appendChild( this.group );\n } else {\n this.graph.appendShapeToDom( this );\n }\n return this;\n }\n\n /**\n * Forces the DOM parent (instead of the normal layer)\n * @return {Shape} The current shape\n */\n forceParentDom( dom ) {\n\n this._forcedParentDom = dom;\n\n return this;\n }\n\n isHTML() {\n return false;\n }\n}\n\n/**\n * @alias Shape#calculatePosition\n */\nShape.prototype.computePosition = Shape.prototype.calculatePosition;\n\n/**\n * @alias Shape#displayLabel\n */\nShape.prototype.showLabel = Shape.prototype.displayLabel;\n\n/**\n * @alias Shape#kill\n */\nShape.prototype.remove = Shape.prototype.kill;\n\nexport default Shape;","import Shape from './graph.shape.js';\n\n/**\n * Displays a surface under a line serie\n * @extends GraphShape\n */\nclass ShapeSurfaceUnderCurve extends Shape {\n\n createDom() {\n this._dom = document.createElementNS( this.graph.ns, 'path' );\n }\n\n createHandles() {\n\n this._createHandles( 2, 'line', {\n 'stroke-width': '3',\n 'stroke': 'transparent',\n 'pointer-events': 'stroke',\n 'cursor': 'ew-resize'\n } );\n\n }\n\n handleMouseMoveImpl( e, deltaX, deltaY ) {\n\n if ( this.isLocked() ) {\n return;\n }\n\n if ( this.moving ) {\n\n this.getPosition( 0 ).deltaPosition( 'x', deltaX, this.getXAxis() );\n this.getPosition( 1 ).deltaPosition( 'x', deltaX, this.getXAxis() );\n\n } else if ( this.serie && this.handleSelected ) {\n\n this.resizingPosition = this.handleSelected == 1 ? this.getPosition( 0 ) : this.getPosition( 1 );\n\n var value = this.serie.searchClosestValue( this.getXAxis().getVal( this.graph._getXY( e ).x - this.graph.getPaddingLeft() ) );\n\n if ( !value ) {\n return;\n }\n\n if ( this.resizingPosition.x != value.xMin ) {\n this.preventUnselect = true;\n }\n\n this.resizingPosition.x = value.xMin;\n\n } else if ( this.handleSelected ) {\n\n this.resizingPosition = this.handleSelected == 1 ? this.getPosition( 0 ) : this.getPosition( 1 );\n this.resizingPosition.deltaPosition( 'x', deltaX, this.getXAxis() );\n }\n\n this.applyPosition();\n }\n /*\n redrawImpl: function() {\n //var doDraw = this.setPosition();\n //\tthis.setDom('fill', 'url(#' + 'patternFill' + this.graph._creation + ')')\n\n if ( this.position != this.doDraw ) {\n this.group.setAttribute( \"visibility\", this.position ? \"visible\" : 'hidden' );\n this.doDraw = this.position;\n }\n },\n */\n applyPosition() {\n\n if ( !this.serie ) {\n return;\n }\n\n var posXY = this.computePosition( 0 ),\n posXY2 = this.computePosition( 1 ),\n w = Math.abs( posXY.x - posXY2.x ),\n x = Math.min( posXY.x, posXY2.x );\n\n // this.reversed = x == posXY2.x;\n\n if ( w < 2 || x + w < 0 || x > this.graph.getDrawingWidth() ) {\n this.setDom( 'd', '' );\n return false;\n }\n\n var v1 = this.serie.searchClosestValue( this.getPosition( 0 ).x ),\n v2 = this.serie.searchClosestValue( this.getPosition( 1 ).x ),\n v3,\n i,\n j,\n init,\n max,\n k,\n x,\n y,\n firstX,\n firstY,\n currentLine,\n maxY = 0,\n minY = Number.MAX_VALUE;\n\n if ( !v1 || !v2 ) {\n return false;\n }\n\n if ( v1.xBeforeIndex > v2.xBeforeIndex ) {\n v3 = v1;\n v1 = v2;\n v2 = v3;\n\n //this.handleSelected = ( this.handleSelected == 1 ) ? 2 : 1;\n }\n\n this.counter = 0;\n\n for ( i = v1.dataIndex; i <= v2.dataIndex; i++ ) {\n this.currentLine = '';\n init = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n max = i == v2.dataIndex ? v2.xBeforeIndexArr : this.serie.data[ i ].length;\n k = 0;\n\n if ( init == max ) {\n max++;\n }\n\n for ( j = init; j <= max; j += 2 ) {\n\n x = this.serie.getX( this.serie.data[ i ][ j + 0 ] );\n y = this.serie.getY( this.serie.data[ i ][ j + 1 ] );\n\n maxY = Math.max( this.serie.data[ i ][ j + 1 ], maxY );\n minY = Math.min( this.serie.data[ i ][ j + 1 ], minY );\n\n if ( j == init ) {\n this.firstX = x;\n this.firstY = y;\n }\n\n if ( k > 0 ) {\n this.currentLine += ' L ' + x + ' ' + y + ' ';\n } else {\n this.currentLine += ' M ' + x + ' ' + y + ' ';\n }\n\n //this.serie._addPoint( x, y, false, this.currentLine );\n k++;\n\n }\n\n this.lastX = x;\n this.lastY = y;\n\n if ( !this.firstX || !this.firstY || !this.lastX || !this.lastY ) {\n return;\n }\n\n this.currentLine += ' V ' + this.getYAxis().getPx( 0 ) + ' H ' + this.firstX + ' z';\n this.setDom( 'd', this.currentLine );\n }\n\n this.maxY = this.serie.getY( maxY );\n this.setHandles();\n\n this.changed();\n\n return true;\n }\n\n setHandles() {\n\n if ( !this.firstX ) {\n return;\n }\n\n var posXY = this.computePosition( 0 ),\n posXY2 = this.computePosition( 1 );\n\n if ( posXY.x < posXY2.x ) {\n\n this.handles[ 1 ].setAttribute( 'x1', this.firstX );\n this.handles[ 1 ].setAttribute( 'x2', this.firstX );\n\n this.handles[ 2 ].setAttribute( 'x1', this.lastX );\n this.handles[ 2 ].setAttribute( 'x2', this.lastX );\n\n } else {\n\n this.handles[ 1 ].setAttribute( 'x1', this.lastX );\n this.handles[ 1 ].setAttribute( 'x2', this.lastX );\n\n this.handles[ 2 ].setAttribute( 'x1', this.firstX );\n this.handles[ 2 ].setAttribute( 'x2', this.firstX );\n\n }\n this.handles[ 1 ].setAttribute( 'y1', this.getYAxis().getMaxPx() );\n this.handles[ 1 ].setAttribute( 'y2', this.serie.getY( 0 ) );\n\n this.handles[ 2 ].setAttribute( 'y1', this.getYAxis().getMaxPx() );\n this.handles[ 2 ].setAttribute( 'y2', this.serie.getY( 0 ) );\n }\n}\n\nexport default ShapeSurfaceUnderCurve;","import GraphShape from './graph.shape.js';\n\n/**\n * Represents a line\n * @extends Shape\n * @see Graph#newShape\n */\nclass ShapeLine extends GraphShape {\n\n constructor( graph, options ) {\n super( graph, options );\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElementNS( this.graph.ns, 'line' );\n\n if ( !this.getStrokeColor() ) {\n this.setStrokeColor( 'black' );\n }\n\n if ( !this.getStrokeWidth() ) {\n this.setStrokeWidth( 1 );\n }\n\n }\n\n /**\n * Creates the handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {\n\n this._createHandles( 2, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n } );\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n var position = this.calculatePosition( 0 );\n var position2 = this.calculatePosition( 1 );\n\n if ( !position || !position.x || !position.y ) {\n return;\n }\n\n this.setDom( 'x2', position.x );\n this.setDom( 'y2', position.y );\n\n this.setDom( 'y1', position2.y );\n this.setDom( 'x1', position2.x );\n\n this.currentPos2x = position2.x;\n this.currentPos2y = position2.y;\n\n this.currentPos1x = position.x;\n this.currentPos1y = position.y;\n\n return true;\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl( e, deltaX, deltaY, deltaXPx, deltaYPx ) {\n\n if ( this.isLocked() ) {\n return;\n }\n\n var pos = this.getPosition( 0 );\n var pos2 = this.getPosition( 1 );\n\n var posToChange;\n if ( this.handleSelected == 1 ) {\n\n posToChange = pos;\n\n } else if ( this.handleSelected == 2 ) {\n\n posToChange = pos2;\n }\n\n if ( posToChange ) {\n\n if ( !this._data.vertical ) {\n posToChange.deltaPosition( 'x', deltaX, this.getXAxis() );\n }\n\n if ( !this._data.horizontal ) {\n posToChange.deltaPosition( 'y', deltaY, this.getYAxis() );\n }\n }\n\n if ( this.moving ) {\n console.log( this._data );\n // If the pos2 is defined by a delta, no need to move them\n if ( pos.x && !this._data.noX ) {\n pos.deltaPosition( 'x', deltaX, this.getXAxis() );\n }\n if ( pos.y && !this._data.noY ) {\n pos.deltaPosition( 'y', deltaY, this.getYAxis() );\n }\n\n // If the pos2 is defined by a delta, no need to move them\n if ( pos2.x && !this._data.noX ) {\n pos2.deltaPosition( 'x', deltaX, this.getXAxis() );\n }\n if ( pos2.y && !this._data.noY ) {\n pos2.deltaPosition( 'y', deltaY, this.getYAxis() );\n }\n\n }\n\n if ( this._data.forcedCoords ) {\n\n var forced = this._data.forcedCoords;\n\n if ( forced.y !== undefined ) {\n\n if ( typeof forced.y == 'function' ) {\n pos2.y = pos.y = forced.y( this );\n } else {\n pos2.y = forced.y;\n pos.y = forced.y;\n }\n }\n\n if ( forced.x !== undefined ) {\n\n if ( typeof forced.x == 'function' ) {\n pos2.x = pos.x = forced.x( this );\n } else {\n pos2.x = forced.x;\n pos.x = forced.x;\n }\n }\n }\n\n if ( this.rectEvent ) {\n this.setEventReceptacle();\n }\n\n this.redraw();\n this.changed();\n this.setHandles();\n\n return true;\n }\n\n /**\n * Sets the handle position\n * @private\n */\n setHandles() {\n\n if ( !this.areHandlesInDom() ) {\n return;\n }\n\n if ( isNaN( this.currentPos1x ) ) {\n return;\n }\n\n this.handles[ 1 ].setAttribute( 'x', this.currentPos1x );\n this.handles[ 1 ].setAttribute( 'y', this.currentPos1y );\n\n this.handles[ 2 ].setAttribute( 'x', this.currentPos2x );\n this.handles[ 2 ].setAttribute( 'y', this.currentPos2y );\n }\n\n /**\n * Creates an line receptacle with the coordinates of the line, but continuous and thicker\n * @return {Shape} The current shape\n */\n setEventReceptacle() {\n\n if ( !this.currentPos1x ) {\n return;\n }\n\n if ( !this.rectEvent ) {\n this.rectEvent = document.createElementNS( this.graph.ns, 'line' );\n this.rectEvent.setAttribute( 'pointer-events', 'stroke' );\n this.rectEvent.setAttribute( 'stroke', 'transparent' );\n this.rectEvent.jsGraphIsShape = this;\n this.group.appendChild( this.rectEvent );\n }\n\n this.rectEvent.setAttribute( 'x1', this.currentPos1x );\n this.rectEvent.setAttribute( 'y1', this.currentPos1y );\n this.rectEvent.setAttribute( 'x2', this.currentPos2x );\n this.rectEvent.setAttribute( 'y2', this.currentPos2y );\n this.rectEvent.setAttribute( 'stroke-width', this.getProp( 'strokeWidth' ) + 2 );\n }\n}\n\nexport default ShapeLine;","import ShapeLine from './graph.shape.line.js';\n\n/**\n * Displays an arrow\n * @extends GraphShapeLine\n */\nclass ShapeArrow extends ShapeLine {\n\n constructor( graph ) {\n\n super( graph );\n\n }\n\n createDom() {\n\n this._dom = document.createElementNS( this.graph.ns, 'line' );\n this._dom.setAttribute( 'marker-end', 'url(#arrow' + this.graph._creation + ')' );\n\n this.createHandles( this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n } );\n\n this.setStrokeColor( 'black' );\n this.setStrokeWidth( 1 );\n }\n}\n\nexport default ShapeArrow;","import * as util from '../graph.util.js';\nimport Shape from './graph.shape.js';\n\n/**\n * Displays an ellipse\n * @extends Shape\n */\nclass ShapeEllipse extends Shape {\n\n constructor( graph, options ) {\n super( graph, options );\n }\n\n createDom() {\n this._dom = document.createElementNS( this.graph.ns, 'ellipse' );\n }\n\n applyPosition() {\n\n var pos = this.computePosition( 0 );\n\n this.setDom( 'cx', pos.x || 0 );\n this.setDom( 'cy', pos.y || 0 );\n\n let posR = this.graph.newPosition( {\n\n dx: this.getProp( 'rx' ),\n dy: this.getProp( 'ry' ) || this.getProp( 'rx' )\n\n } );\n\n let posComputed = this.calculatePosition( posR );\n\n this.setDom( 'rx', Math.abs( posComputed.x ) || 0 );\n this.setDom( 'ry', Math.abs( posComputed.y ) || 0 );\n return true;\n }\n\n setR( rx, ry ) {\n this.setProp( 'rx', rx );\n this.setProp( 'ry', ry );\n return this;\n }\n\n handleMouseUpImpl() {\n this.triggerChange();\n }\n\n handleMouseMoveImpl( e, deltaX, deltaY, deltaXPx, deltaYPx ) {\n\n }\n}\n\nexport default ShapeEllipse;","import GraphShape from './graph.shape.js';\n\n/**\n * Blank shape used to display label\n * Use myShapelabel.setLabelText(); and associated methods\n * @extend GraphShape\n */\nclass ShapeLabel extends GraphShape {\n\n constructor( graph, options ) {\n\n super( graph, options );\n }\n\n createDom() {\n return false;\n }\n\n applyPosition() {\n return true;\n }\n}\n\nexport default ShapeLabel;","import Shape from './graph.shape.js';\n\n/**\n * Represents a line that extends the Shape class. Used by the plugin {@link PluginSerieLineDifference}\n * @extends Shape\n * @see Graph#newShape\n */\nclass ShapePolyline extends Shape {\n\n constructor( graph, options ) {\n super( graph, options );\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElementNS( this.graph.ns, 'path' );\n\n if ( !this.getStrokeColor() ) {\n this.setStrokeColor( 'black' );\n }\n\n if ( this.getStrokeWidth() == undefined ) {\n this.setStrokeWidth( 1 );\n }\n }\n\n /**\n * No handles for the polyline\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {}\n\n /**\n * Force the points of the polyline already computed in pixels\n * @param {String} a SVG string to be used in the ```d``` attribute of the path.\n * @return {ShapePolyline} The current polyline instance\n */\n setPointsPx( points ) {\n this.setProp( 'pxPoints', points );\n return this;\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n let pxPoints;\n let pos = this.computePosition( 0 );\n\n if ( ( pxPoints = this.getProp( 'pxPoints' ) ) ) {\n\n pxPoints = ' M ' + pos.x + ' ' + pos.y + ' ' + pxPoints;\n this.setDom( 'd', pxPoints );\n\n } else if ( this.points ) {\n\n var xAxis, yAxis;\n\n if ( this.serie ) {\n\n xAxis = this.serie.getXAxis();\n yAxis = this.serie.getYAxis();\n\n } else if ( this.xAxis && this.yAxis ) {\n\n xAxis = this.xAxis;\n yAxis = this.yAxis;\n }\n\n this.setDom( 'd', 'M ' + this.points.map( function( p ) {\n return xAxis.getPx( p[ 0 ] ) + ', ' + yAxis.getPx( p[ 1 ] );\n } ).join( ' L ' ) );\n }\n\n this.changed();\n return true;\n }\n}\n\nexport default ShapePolyline;","import Shape from './graph.shape.js';\nimport GraphPosition from '../graph.position.js';\n\n/**\n * Displays an integral with NMR style\n * @extends ShapeSurfaceUnderCurve\n */\nclass ShapeNMRIntegral extends Shape {\n\n constructor( graph, options ) {\n\n super( graph, options );\n\n this.nbHandles = 2;\n }\n\n createDom() {\n this._dom = document.createElementNS( this.graph.ns, 'path' );\n this._domShadow = document.createElementNS( this.graph.ns, 'path' );\n this._domShadow.jsGraphIsShape = this;\n this._dom.setAttribute( 'pointer-events', 'stroke' );\n this._domShadow.setAttribute( 'pointer-events', 'stroke' );\n this._domShadow.setAttribute( 'stroke-width', '12' );\n this._domShadow.setAttribute( 'fill', 'transparent' );\n this._domShadow.setAttribute( 'stroke', 'transparent' );\n this.group.appendChild( this._domShadow );\n }\n\n initImpl() {\n this.setFillColor( 'transparent' );\n this.setStrokeColor( 'black' );\n }\n\n createHandles() {\n\n this._createHandles( 2, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white'\n } );\n\n this.handles[ 1 ].setAttribute( 'fill', 'red' );\n }\n\n xor( a, b ) {\n return ( a && !b ) || ( !a && b );\n }\n\n applyPosition() {\n\n let\n x,\n y,\n xVal,\n yVal,\n axis = this.getAxis(),\n points = [];\n\n let currentLine = '',\n baseLine = this.getProp( 'baseLine', 0 ) || 300,\n ratio;\n\n if ( !this.serie ) {\n throw 'No serie exists for this shape';\n }\n /*\n this.sortPositions( ( a, b ) => {\n return a.x - b.x;\n } );\n\n */\n let pos1 = this.getPosition( 0 );\n let pos2 = this.getPosition( 1 );\n\n if ( ( pos1.x < this.serie.getXAxis().getCurrentMin() && pos2.x < this.serie.getXAxis().getCurrentMin() ) || ( pos1.x > this.serie.getXAxis().getCurrentMax() && pos2.x > this.serie.getXAxis().getCurrentMax() ) ) {\n this.setDom( 'd', '' );\n this._domShadow.setAttribute( 'd', '' );\n\n this.hideLabel( 0 );\n return false;\n }\n\n this.showLabel( 0 );\n\n let sum = 0;\n\n let j;\n let waveform = this.serie.getWaveform();\n\n if ( !waveform ) {\n return;\n }\n\n let index1 = waveform.getIndexFromX( pos1[ axis ], true, Math.floor ),\n index2 = waveform.getIndexFromX( pos2[ axis ], true, Math.ceil ),\n index3,\n flipped = false;\n\n if ( index1 == index2 ) { // At least one px please !\n if ( waveform.getReductionType() == 'aggregate' ) {\n index2 += 4; // Aggregated state\n } else {\n index2++; // Non aggregated state\n }\n }\n\n if ( index2 < index1 ) {\n index3 = index1;\n index1 = index2;\n index2 = index3;\n flipped = true;\n }\n\n let firstX, firstY, firstXVal, firstYVal, lastX, lastXVal, lastY, lastYVal;\n let data = waveform.getDataInUse();\n\n let condition, incrementation;\n\n let normalSums = true;\n if ( waveform.getReductionType() == 'aggregate' ) {\n normalSums = false;\n }\n\n if (\n ( waveform.getXMonotoneousAscending() && // Ascending\n 1 == 1 ) ||\n ( !waveform.getXMonotoneousAscending() && // Ascending\n 1 == 2 )\n ) {\n\n j = index2;\n condition = true;\n incrementation = -1;\n\n } else {\n\n j = index1;\n condition = false;\n incrementation = 1;\n }\n\n for ( ; condition ? j >= index1 : j <= index2; j += incrementation ) {\n\n xVal = waveform.getX( j, true );\n yVal = waveform.getY( j, true );\n\n x = this.serie.getX( xVal );\n y = this.serie.getY( yVal );\n\n /*\n if ( ! normalSums && j % 4 == 0 && j >= index1 && data.sums ) { // Sums are located every 4 element\n\n sum += data.sums[ j ];// * ( waveform.getX( j, true ) - waveform.getX( j - 3, true ) ); // y * (out-in)\n\n } else if( normalSums ) {\n */\n sum += waveform.getY( j, true ); // * ( waveform.getX( j, true ) - waveform.getX( j - 1, true ) ); // y * (out-in)\n //}\n\n if ( !firstX ) {\n\n firstX = x;\n firstY = y;\n firstXVal = waveform.getX( j );\n firstYVal = waveform.getY( j );\n }\n\n if ( lastX == undefined ) {\n\n lastX = x;\n lastY = y;\n lastXVal = waveform.getX( j );\n lastYVal = waveform.getY( j );\n continue;\n }\n\n if ( x == lastX && y == lastY ) {\n //continue;\n }\n\n lastX = x;\n lastY = y;\n //console.log( data, data[ j ] );\n\n points.push( [ x, y, sum ] );\n lastXVal = xVal;\n }\n\n lastXVal = false;\n lastYVal = false;\n lastX = false;\n lastY = false;\n\n if ( sum == 0 ) {\n sum = 1;\n }\n\n this._sumVal = waveform.integrate( pos1.x, pos2.x );\n\n if ( !this.ratio ) {\n // 150px / unit\n ratio = 200 / sum;\n\n } else {\n // Already existing\n ratio = this.ratio * ( this.sumVal / sum );\n }\n let py;\n\n if ( points.length == 0 ) {\n return;\n }\n\n for ( var i = 0, l = points.length; i < l; i++ ) {\n\n py = baseLine - ( points[ i ][ 2 ] ) * ratio;\n\n if ( i > 0 && ( ( points[ i - 1 ][ 2 ] > sum / 2 && points[ i ][ 2 ] <= sum / 2 ) || ( points[ i - 1 ][ 2 ] < sum / 2 && points[ i ][ 2 ] >= sum / 2 ) ) ) {\n\n let pos = baseLine - ( points[ i - 1 ][ 2 ] + points[ i ][ 2 ] ) / 2 * ratio;\n\n this.setPosition( {\n x: points[ i ][ 0 ] + 'px',\n y: pos + 'px'\n\n }, 3 );\n\n this.setLabelPosition( this.getPosition( 3 ), 0 );\n }\n\n currentLine += ' L ' + points[ i ][ 0 ] + ', ' + py + ' ';\n\n this.lastPointX = points[ i ][ 0 ];\n this.lastPointY = py;\n }\n\n this.points = points;\n this._sum = sum;\n\n if ( this.serie.isFlipped() ) {\n currentLine = ' M ' + baseLine + ', ' + firstX + ' ' + currentLine;\n } else {\n currentLine = ' M ' + firstX + ', ' + baseLine + ' ' + currentLine;\n }\n\n this.firstPointX = firstX;\n this.firstPointY = baseLine;\n\n this.setDom( 'd', currentLine );\n this._domShadow.setAttribute( 'd', currentLine );\n\n this.firstX = firstX;\n this.firstY = firstY;\n /*\n if ( this._selected ) {\n this.select();\n }\n\n this.setHandles();*/\n\n ( this.serie.ratioLabel && this.updateIntegralValue( this.serie.ratioLabel ) ) || this.updateLabels();\n\n this.changed();\n this.handleCondition = !this.xor( incrementation == -1, flipped );\n this.setHandles();\n\n this.updateIntegralValue();\n\n return true;\n }\n\n updateIntegralValue( ratioLabel = this.serie.ratioLabel, forceValue ) {\n console.log( ratioLabel );\n if ( ratioLabel ) {\n this.serie.ratioLabel = ratioLabel;\n }\n\n if ( !isNaN( forceValue ) && !isNaN( this.sumVal ) && this.sumVal ) {\n this.serie.ratioLabel = forceValue / this.sumVal;\n }\n\n this.setLabelText( ratioLabel ? ( Math.round( 100 * this.sumVal * ratioLabel ) / 100 ).toPrecision( 3 ) : 'N/A', 0 );\n this.updateLabels();\n return this.serie.ratioLabel;\n }\n\n getAxis() {\n return this._data.axis || 'x';\n }\n\n /**\n * User to screen coordinate transform. In (unit)/(px), (unit) being the unit of the integral (x * y)\n * @type {Number}\n */\n set ratio( r ) {\n this._ratio = r;\n }\n\n get ratio() {\n return this._ratio;\n }\n\n get sum() {\n return this._sum;\n }\n\n get sumVal() {\n return this._sumVal;\n }\n\n selectStyle() {\n this.setDom( 'stroke-width', '2px' );\n }\n\n selectHandles() {} // Cancel areaundercurve\n\n setHandles() {\n\n if ( this.points == undefined ) {\n return;\n }\n\n if ( !this.isSelected() ) {\n return;\n }\n\n this.addHandles();\n\n if ( this.handleCondition ) {\n\n this.handles[ 1 ].setAttribute( 'x', this.firstPointX );\n this.handles[ 1 ].setAttribute( 'y', this.firstPointY );\n this.handles[ 2 ].setAttribute( 'x', this.lastPointX );\n this.handles[ 2 ].setAttribute( 'y', this.lastPointY );\n\n } else {\n\n this.handles[ 2 ].setAttribute( 'x', this.firstPointX );\n this.handles[ 2 ].setAttribute( 'y', this.firstPointY );\n this.handles[ 1 ].setAttribute( 'x', this.lastPointX );\n this.handles[ 1 ].setAttribute( 'y', this.lastPointY );\n\n }\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl( e, deltaX, deltaY, deltaXPx, deltaYPx ) {\n\n if ( this.isLocked() ) {\n return;\n }\n\n var pos = this.getPosition( 0 );\n var pos2 = this.getPosition( 1 );\n\n var posToChange;\n\n if ( this.handleSelected == 1 ) {\n\n posToChange = pos;\n\n } else if ( this.handleSelected == 2 ) {\n\n posToChange = pos2;\n }\n\n if ( posToChange ) {\n\n if ( !this._data.vertical ) {\n posToChange.deltaPosition( 'x', deltaX, this.getXAxis() );\n }\n }\n\n if ( this.moving ) {\n\n // If the pos2 is defined by a delta, no need to move them\n if ( pos.x ) {\n pos.deltaPosition( 'x', deltaX, this.getXAxis() );\n }\n\n // If the pos2 is defined by a delta, no need to move them\n if ( pos2.x ) {\n pos2.deltaPosition( 'x', deltaX, this.getXAxis() );\n }\n }\n\n if ( this.rectEvent ) {\n this.setEventReceptacle();\n }\n\n this.redraw();\n this.changed();\n\n return true;\n }\n}\n\nexport default ShapeNMRIntegral;","import GraphShape from './graph.shape.js';\nimport * as util from '../graph.util.js';\n\n/**\n * Represents a rectangle that extends the Shape class\n * @class ShapeRectangle\n * @augments Shape\n * @see Graph#newShape\n */\nclass ShapeRectangle extends GraphShape {\n\n constructor( graph, options ) {\n super( graph, options );\n\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n this._dom = document.createElementNS( this.graph.ns, 'rect' );\n\n if ( !this.getStrokeColor() ) {\n this.setStrokeColor( 'black' );\n }\n\n if ( !this.getStrokeWidth() ) {\n this.setStrokeWidth( 1 );\n }\n\n if ( !this.getFillColor() ) {\n this.setFillColor( 'transparent' );\n }\n\n return this;\n }\n\n /**\n * Creates the Handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {\n if ( !this.hasHandles() ) {\n return;\n }\n\n /*\n this._data.handles = this._data.handles || {\n type: 'corners'\n };\n */\n\n var handles = this.getProp( 'handles' );\n\n if ( typeof handles != 'object' ) {\n handles = {};\n }\n\n if ( !handles.type ) {\n handles.type = 'corners';\n }\n\n switch ( handles.type ) {\n\n case 'sides':\n\n util.extend( handles, {\n sides: {\n top: true,\n bottom: true,\n left: true,\n right: true\n }\n } );\n\n var j = 0;\n for ( var i in handles.sides ) {\n if ( handles.sides[ i ] ) {\n j++;\n }\n }\n\n this._createHandles( j, 'g' ).map( function( g ) {\n\n var r = document.createElementNS( self.graph.ns, 'rect' );\n r.setAttribute( 'x', '-3' );\n r.setAttribute( 'width', '6' );\n r.setAttribute( 'y', '-6' );\n r.setAttribute( 'height', '12' );\n r.setAttribute( 'stroke', 'black' );\n r.setAttribute( 'fill', 'white' );\n r.setAttribute( 'cursor', 'pointer' );\n\n g.appendChild( r );\n\n } );\n\n var j = 1;\n\n for ( var i in handles.sides ) {\n if ( handles.sides[ i ] ) {\n this.handles[ i ] = this[ 'handle' + j ];\n this.sides[ j ] = i;\n j++;\n }\n }\n\n break;\n\n case 'corners':\n this._createHandles( 4, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white'\n } );\n\n if ( this.handles ) {\n this.handles[ 2 ].setAttribute( 'cursor', 'nesw-resize' );\n this.handles[ 4 ].setAttribute( 'cursor', 'nesw-resize' );\n\n this.handles[ 1 ].setAttribute( 'cursor', 'nwse-resize' );\n this.handles[ 3 ].setAttribute( 'cursor', 'nwse-resize' );\n }\n\n break;\n\n case 'seamlessX':\n\n this._createHandles( 2, 'rect', {\n transform: 'translate(-3 -3)',\n stroke: 'transparent',\n fill: 'transparent',\n width: '20px',\n cursor: 'ew-resize'\n } );\n\n break;\n }\n\n super.createHandles();\n\n return this;\n }\n\n /**\n * Updates the position\n * @memberof ShapeRectangle\n * @private\n * @return {Shape} The current shape\n */\n applyPosition() {\n\n var pos = this.computePosition( 0 ),\n pos2 = this.computePosition( 1 ),\n x,\n y,\n width,\n height;\n\n if ( pos.x < pos2.x ) {\n x = pos.x;\n width = pos2.x - pos.x;\n } else {\n x = pos2.x;\n width = pos.x - pos2.x;\n }\n\n if ( pos.y < pos2.y ) {\n y = pos.y;\n height = pos2.y - pos.y;\n } else {\n y = pos2.y;\n height = pos.y - pos2.y;\n }\n\n this.currentX = x;\n this.currentY = y;\n this.currentW = width;\n this.currentH = height;\n\n if ( !isNaN( x ) && !isNaN( y ) && x !== false && y !== false ) {\n\n this.setDom( 'width', width );\n this.setDom( 'height', height );\n this.setDom( 'x', x );\n this.setDom( 'y', y );\n\n this.setHandles();\n this.updateMask();\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Implements mouse move event\n * @private\n * @return {Shape} The current shape\n */\n handleMouseMoveImpl( e, deltaX, deltaY, deltaXPx, deltaYPx ) {\n\n var handles = this.getProp( 'handles' );\n\n if ( !this.moving && !this.handleSelected ) {\n return;\n }\n\n var pos = this.getPosition( 0 );\n var pos2 = this.getPosition( 1 );\n\n var invX = this.getXAxis().isFlipped(),\n invY = this.getYAxis().isFlipped(),\n posX = pos.x,\n posY = pos.y,\n pos2X = pos2.x,\n pos2Y = pos2.y;\n\n if ( this.moving ) {\n\n pos.deltaPosition( 'x', deltaX, this.getXAxis() );\n pos.deltaPosition( 'y', deltaY, this.getYAxis() );\n\n pos2.deltaPosition( 'x', deltaX, this.getXAxis() );\n pos2.deltaPosition( 'y', deltaY, this.getYAxis() );\n\n } else {\n\n switch ( handles.type ) {\n\n case 'seamlessX':\n // Do nothing for now\n\n switch ( this.handleSelected ) {\n\n case 1:\n pos.deltaPosition( 'x', deltaX, this.getXAxis() );\n break;\n\n case 2:\n pos2.deltaPosition( 'x', deltaX, this.getXAxis() );\n break;\n }\n\n break;\n\n case 'sides':\n // Do nothing for now\n\n switch ( this.sides[ this.handleSelected ] ) {\n\n case 'left':\n pos.deltaPosition( 'x', deltaX, this.getXAxis() );\n break;\n\n case 'right':\n pos2.deltaPosition( 'x', deltaX, this.getXAxis() );\n break;\n\n case 'top':\n pos.deltaPosition( 'y', deltaY, this.getYAxis() );\n break;\n\n case 'bottom':\n pos2.deltaPosition( 'y', deltaY, this.getYAxis() );\n break;\n\n }\n\n break;\n\n case 'corners':\n default:\n\n if ( this.handleSelected == 1 ) {\n\n pos.deltaPosition( 'x', deltaX, this.getXAxis() );\n pos.deltaPosition( 'y', deltaY, this.getYAxis() );\n\n } else if ( this.handleSelected == 2 ) {\n\n pos2.deltaPosition( 'x', deltaX, this.getXAxis() );\n pos.deltaPosition( 'y', deltaY, this.getYAxis() );\n\n } else if ( this.handleSelected == 3 ) {\n\n pos2.deltaPosition( 'y', deltaY, this.getYAxis() );\n pos2.deltaPosition( 'x', deltaX, this.getXAxis() );\n\n } else if ( this.handleSelected == 4 ) {\n\n pos.deltaPosition( 'x', deltaX, this.getXAxis() );\n pos2.deltaPosition( 'y', deltaY, this.getYAxis() );\n\n }\n\n break;\n\n }\n }\n\n this.redraw();\n this.changed();\n this.setHandles();\n\n return true;\n\n }\n\n /**\n * Places handles properly\n * @private\n * @return {Shape} The current shape\n */\n setHandles() {\n\n if ( this.isLocked() || ( !this.isSelectable() && !this._staticHandles ) ) {\n return;\n }\n\n if ( !this.handlesInDom ) {\n return;\n }\n\n var pos = this.computePosition( 0 );\n var pos2 = this.computePosition( 1 );\n\n var handles = this.getProp( 'handles' );\n\n switch ( handles.type ) {\n\n case 'seamlessX':\n\n if ( this.handles[ 1 ] ) {\n this.handles[ 1 ].setAttribute( 'transform', 'translate(-10) translate(' + pos.x + ')' );\n this.handles[ 1 ].setAttribute( 'height', Math.abs( ( pos2.y - pos.y ) ) );\n this.handles[ 1 ].setAttribute( 'y', Math.min( pos2.y, pos.y ) );\n }\n\n if ( this.handles[ 2 ] ) {\n this.handles[ 2 ].setAttribute( 'transform', 'translate(-10) translate(' + pos2.x + ')' );\n this.handles[ 2 ].setAttribute( 'height', Math.abs( ( pos2.y - pos.y ) ) );\n this.handles[ 2 ].setAttribute( 'y', Math.min( pos2.y, pos.y ) );\n }\n\n break;\n\n case 'sides':\n\n if ( this.handles.left ) {\n this.handles.left.setAttribute( 'transform', 'translate(' + this.currentX + ' ' + ( this.currentY + this.currentH / 2 ) + ')' );\n }\n\n if ( this.handles.right ) {\n this.handles.right.setAttribute( 'transform', 'translate( ' + ( this.currentX + this.currentW ) + ' ' + ( this.currentY + this.currentH / 2 ) + ')' );\n }\n\n if ( this.handles.top ) {\n this.handles.top.setAttribute( 'transform', 'translate( ' + ( this.currentX + this.currentW / 2 ) + ' ' + this.currentY + ')' );\n }\n\n if ( this.handles.bottom ) {\n this.handles.bottom.setAttribute( 'transform', 'translate( ' + ( this.currentX + this.currentW / 2 ) + ' ' + ( this.currentY + this.currentH ) + ')' );\n }\n\n break;\n\n case 'corners':\n default:\n\n this.handles[ 1 ].setAttribute( 'x', pos.x );\n this.handles[ 1 ].setAttribute( 'y', pos.y );\n\n this.handles[ 2 ].setAttribute( 'x', pos2.x );\n this.handles[ 2 ].setAttribute( 'y', pos.y );\n\n this.handles[ 3 ].setAttribute( 'x', pos2.x );\n this.handles[ 3 ].setAttribute( 'y', pos2.y );\n\n this.handles[ 4 ].setAttribute( 'x', pos.x );\n this.handles[ 4 ].setAttribute( 'y', pos2.y );\n\n break;\n\n }\n\n }\n\n}\n\nexport default ShapeRectangle;","import ShapeRect from './graph.shape.rect.js';\n\nclass ShapePeakIntegration2D extends ShapeRect {\n\n constructor( graph, options ) {\n\n super( graph, options );\n this.nbHandles = 4;\n }\n\n createDom() {\n\n this._dom = document.createElementNS( this.graph.ns, 'rect' );\n this._dom.element = this;\n\n this.createHandles( this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n } );\n }\n\n redrawImpl() {\n\n this.setPosition();\n this.setHandles();\n this.setBindableToDom( this._dom );\n }\n\n}\n\nexport default ShapePeakIntegration2D;","import Shape from './graph.shape.js';\n\n/**\n * Displays a cross\n * @extends Shape\n */\nclass ShapeCross extends Shape {\n\n constructor( graph, options ) {\n super( graph, options );\n this.nbHandles = 1;\n }\n\n /**\n * Width of the cross, also available from the constructor\n * @type {Number} width\n */\n get width() {\n return this.options.width || 10;\n }\n\n set width( l ) {\n this.options.width = l;\n }\n\n createDom() {\n\n this._dom = document.createElementNS( this.graph.ns, 'path' );\n this._dom.setAttribute( 'd', 'M -' + ( this.width / 2 ) + ' 0 h ' + ( this.width ) + ' m -' + ( this.width / 2 ) + ' -' + ( this.width / 2 ) + ' v ' + ( this.width ) + '' );\n\n }\n\n createHandles() {\n\n this._createHandles( this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n } );\n\n }\n applyPosition() {\n\n var position = this.calculatePosition( 0 );\n if ( !position || !position.x || !position.y ) {\n return;\n }\n\n this.setDom( 'transform', 'translate( ' + position.x + ', ' + position.y + ')' );\n\n this.currentPos1x = position.x;\n this.currentPos1y = position.y;\n\n return true;\n }\n\n redrawImpl() {\n\n this.setHandles();\n }\n\n handleCreateImpl() {\n\n }\n\n handleMouseDownImpl( e ) {\n\n this.moving = true;\n\n return true;\n }\n\n handleMouseUpImpl() {\n\n this.triggerChange();\n return true;\n }\n\n handleMouseMoveImpl( e, deltaX, deltaY, deltaXPx, deltaYPx ) {\n\n if ( this.isLocked() ) {\n return;\n }\n\n var pos = this.getFromData( 'pos' );\n\n if ( this.moving ) {\n\n pos.x = this.graph.deltaPosition( pos.x, deltaX, this.getXAxis() );\n pos.y = this.graph.deltaPosition( pos.y, deltaY, this.getYAxis() );\n }\n\n this.redrawImpl();\n\n return true;\n\n }\n\n setHandles() {\n\n if ( !this.areHandlesInDom() ) {\n return;\n }\n\n if ( isNaN( this.currentPos1x ) ) {\n return;\n }\n\n this.handles[ 1 ].setAttribute( 'x', this.currentPos1x );\n this.handles[ 1 ].setAttribute( 'y', this.currentPos1y );\n }\n\n selectStyle() {\n this.setDom( 'stroke', 'red' );\n this.setDom( 'stroke-width', '2' );\n }\n}\n\nexport default ShapeCross;","import ShapeLine from './graph.shape.line.js';\n\n/**\n * Shows a horizontal line with three little vertical bars. Very useful to demonstrate a peak start, end and middle value\n * @extends ShapeLine\n */\nclass ShapePeakBoundaries extends ShapeLine {\n\n constructor( graph ) {\n super( graph );\n this.lineHeight = 6;\n }\n\n createDom() {\n\n this._dom = document.createElementNS( this.graph.ns, 'line' );\n this.line1 = document.createElementNS( this.graph.ns, 'line' );\n this.line2 = document.createElementNS( this.graph.ns, 'line' );\n this.line3 = document.createElementNS( this.graph.ns, 'line' );\n\n this.rectBoundary = document.createElementNS( this.graph.ns, 'path' );\n\n this.rectBoundary.setAttribute( 'fill', 'transparent' );\n this.rectBoundary.setAttribute( 'stroke', 'none' );\n this.rectBoundary.setAttribute( 'pointer-events', 'fill' );\n\n this.rectBoundary.jsGraphIsShape = true;\n\n this.group.appendChild( this.rectBoundary );\n this.group.appendChild( this.line1 );\n this.group.appendChild( this.line2 );\n this.group.appendChild( this.line3 );\n this._dom.element = this;\n }\n\n createHandles() {\n this._createHandles( 3, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n } );\n }\n\n redrawImpl() {\n\n this.line1.setAttribute( 'stroke', this.getStrokeColor() );\n this.line2.setAttribute( 'stroke', this.getStrokeColor() );\n this.line3.setAttribute( 'stroke', this.getStrokeColor() );\n\n this.line1.setAttribute( 'stroke-width', this.getStrokeWidth() );\n this.line2.setAttribute( 'stroke-width', this.getStrokeWidth() );\n this.line3.setAttribute( 'stroke-width', this.getStrokeWidth() );\n\n this.setHandles();\n this.redrawLines();\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Redraws the vertical lines according to the positions.\n * Position 0 is the left line, position 1 is the right line and position 2 is the center line\n * @returns {ShapePeakBoundaries} The shape instance\n */\n redrawLines() {\n\n var posLeft = this.computePosition( 0 );\n var posRight = this.computePosition( 1 );\n var posCenter = this.computePosition( 2 );\n\n if ( posLeft.x && posRight.x && posCenter.x && this.posYPx ) {\n\n var height = this.lineHeight;\n this.rectBoundary.setAttribute( 'd', 'M ' + posLeft.x + ' ' + ( this.posYPx - height ) + ' v ' + ( 2 * height ) + ' H ' + posRight.x + ' v ' + ( -2 * height ) + 'z' );\n this.line1.setAttribute( 'x1', posLeft.x );\n this.line1.setAttribute( 'x2', posLeft.x );\n\n this.line2.setAttribute( 'x1', posRight.x );\n this.line2.setAttribute( 'x2', posRight.x );\n\n this.line3.setAttribute( 'x1', posCenter.x );\n this.line3.setAttribute( 'x2', posCenter.x );\n\n this._dom.setAttribute( 'x1', posLeft.x );\n this._dom.setAttribute( 'x2', posRight.x );\n\n this.redrawY( height );\n }\n\n return this;\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Redraws the vertical positions of the shape\n * @returns {ShapePeakBoundaries} The shape instance\n */\n redrawY() {\n\n if ( !this.posYPx ) {\n return this;\n }\n\n var height = this.lineHeight;\n\n this.line1.setAttribute( 'y1', this.posYPx - height );\n this.line1.setAttribute( 'y2', this.posYPx + height );\n\n this.line2.setAttribute( 'y1', this.posYPx - height );\n this.line2.setAttribute( 'y2', this.posYPx + height );\n\n this.line3.setAttribute( 'y1', this.posYPx - height );\n this.line3.setAttribute( 'y2', this.posYPx + height );\n\n this._dom.setAttribute( 'y1', this.posYPx );\n this._dom.setAttribute( 'y2', this.posYPx );\n\n return this;\n }\n\n setHandles() {\n\n if ( !this.posYPx ) {\n return;\n }\n\n var posLeft = this.computePosition( 0 );\n var posRight = this.computePosition( 1 );\n var posCenter = this.computePosition( 2 );\n\n if ( posLeft.x && posRight.x && posCenter.x ) {\n\n this.handles[ 1 ].setAttribute( 'x', posLeft.x );\n this.handles[ 1 ].setAttribute( 'y', this.posYPx );\n\n this.handles[ 2 ].setAttribute( 'x', posRight.x );\n this.handles[ 2 ].setAttribute( 'y', this.posYPx );\n\n this.handles[ 3 ].setAttribute( 'x', posCenter.x );\n this.handles[ 3 ].setAttribute( 'y', this.posYPx );\n }\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Sets the y position of the shape\n * @param {Number} y - The y position in px\n * @returns {ShapePeakBoundaries} The shape instance\n */\n setY( y ) {\n this.posYPx = y;\n return this;\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Sets the height of the peak lines\n * @param {Number} height - The height of the lines in px\n * @returns {ShapePeakBoundaries} The shape instance\n */\n setLineHeight( height ) {\n this.lineHeihgt = height;\n }\n\n handleMouseMoveImpl( e, deltaX, deltaY ) {\n\n if ( this.isLocked() ) {\n return;\n }\n\n var posLeft = this.getPosition( 0 );\n var posRight = this.getPosition( 1 );\n var posCenter = this.getPosition( 2 );\n\n switch ( this.handleSelected ) {\n\n case 1: // left\n posLeft.deltaPosition( 'x', deltaX, this.getXAxis() );\n\n if ( Math.abs( posCenter.x - posRight.x ) > Math.abs( posRight.x - posLeft.x ) || Math.abs( posCenter.x - posLeft.x ) > Math.abs( posRight.x - posLeft.x ) ) {\n posCenter.x = posLeft.x + ( posRight.x - posLeft.x ) * 0.1;\n }\n break;\n\n case 2: // left\n\n posRight.deltaPosition( 'x', deltaX, this.getXAxis() );\n\n if ( Math.abs( posCenter.x - posRight.x ) > Math.abs( posRight.x - posLeft.x ) || Math.abs( posCenter.x - posLeft.x ) > Math.abs( posRight.x - posLeft.x ) ) {\n posCenter.x = posRight.x + ( posLeft.x - posRight.x ) * 0.1;\n }\n\n break;\n\n case 3: // left\n\n posCenter.deltaPosition( 'x', deltaX, this.getXAxis() );\n\n if ( Math.abs( posCenter.x - posRight.x ) > Math.abs( posRight.x - posLeft.x ) || Math.abs( posCenter.x - posLeft.x ) > Math.abs( posRight.x - posLeft.x ) ) {\n return;\n }\n\n break;\n\n }\n\n this.setLabelPosition( {\n y: this.getLabelPosition( 0 ).y,\n x: posCenter.x\n } );\n\n this.updateLabels();\n this.redrawLines();\n this.setHandles();\n }\n\n applyPosition() {\n\n this.redrawLines();\n return true;\n }\n\n}\n\nexport default ShapePeakBoundaries;","import {\n isNumeric\n} from '../graph.util.js';\nimport GraphShape from './graph.shape.js';\n\n/**\n * Represents a line\n * @extends Shape\n * @see Graph#newShape\n */\nclass ShapeHTML extends GraphShape {\n\n constructor( graph, options ) {\n super( graph, options );\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElement( 'div' );\n // this._dom.setAttribute( \"requiredExtensions\", \"http://www.w3.org/1999/xhtml\" );\n\n this._dom.setAttribute( 'style', 'position: absolute' );\n let div = document.createElement( 'div' );\n this._dom.appendChild( div );\n this.div = div;\n }\n\n /**\n * Creates the handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {\n\n }\n\n setHeight( height ) {\n this.setProp( 'height', height );\n }\n\n setWidth( width ) {\n this.setProp( 'width', width );\n }\n\n setContent( content ) {\n this.setProp( 'content', content );\n }\n\n setRenderer( method ) {\n this._renderer = method;\n }\n\n redraw() {\n\n if ( this._renderer ) {\n this._renderer( this.div );\n } else {\n this.div.innerHTML = this.getProp( 'content' );\n }\n\n super.redraw( ...arguments );\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n var position = this.calculatePosition( 0 );\n\n if ( !position || !isNumeric( position.x ) || !isNumeric( position.y ) ) {\n return;\n }\n this._dom.style.left = position.x + 'px';\n this._dom.style.top = position.y + 'px';\n\n this.currentPosX = position.x;\n this.currentPosY = position.y;\n\n return true;\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl( e, deltaX, deltaY, deltaXPx, deltaYPx ) {\n\n return true;\n }\n\n /**\n * Sets the handle position\n * @private\n */\n setHandles() {\n\n }\n\n isHTML() {\n return true;\n }\n}\n\nexport default ShapeHTML;","import EventEmitter from '../dependencies/eventEmitter/EventEmitter.js';\n\n/**\n * Represents a plugin\n * @interface\n */\nclass Plugin extends EventEmitter {\n\n static\n default () {\n return {};\n }\n\n constructor( options ) {\n super( ...arguments );\n\n this.options = Object.assign( {}, Plugin.default(), this.constructor.default(), options );\n }\n\n /**\n * Init function called by jsGraph on load\n */\n init( graph ) {\n this.graph = graph;\n }\n\n /**\n * Handles the mousedown event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseDown() {}\n\n /**\n * Handles the mouseup event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseUp() {}\n\n /**\n * Handles the mousemove event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseMove() {}\n}\n\nexport default Plugin;","import Plugin from './graph.plugin.js';\n\n/**\n * Constructor for the drag plugin. Do not use this constructor directly.\n * @class PluginDrag\n * @implements Plugin\n */\nclass PluginDrag extends Plugin {\n\n static\n default () {\n return {\n\n dragX: true,\n dragY: true,\n persistanceX: false,\n persistanceY: false\n\n };\n }\n\n /**\n * @private\n */\n init( graph ) {\n\n this.graph = graph;\n this.time = null;\n this.totaltime = 2000;\n }\n\n /**\n * @private\n */\n onMouseDown( graph, x, y, e, target ) {\n this._draggingX = x;\n this._draggingY = y;\n\n this._lastDraggingX = this._draggingX;\n this._lastDraggingY = this._draggingY;\n\n this.stopAnimation = true;\n\n this.moved = false;\n\n return true;\n }\n\n /**\n * @memberof PluginDrag\n * @private\n */\n onMouseMove( graph, x, y, e, target ) {\n\n var deltaX = x - this._draggingX;\n var deltaY = y - this._draggingY;\n\n if ( this.options.dragX ) {\n graph._applyToAxes( function( axis ) {\n axis.setCurrentMin( axis.getVal( axis.getMinPx() - deltaX ) );\n axis.setCurrentMax( axis.getVal( axis.getMaxPx() - deltaX ) );\n }, false, true, false );\n }\n\n if ( this.options.dragY ) {\n\n graph._applyToAxes( function( axis ) {\n axis.setCurrentMin( axis.getVal( axis.getMinPx() - deltaY ) );\n axis.setCurrentMax( axis.getVal( axis.getMaxPx() - deltaY ) );\n }, false, false, true );\n }\n\n this._lastDraggingX = this._draggingX;\n this._lastDraggingY = this._draggingY;\n\n this._draggingX = x;\n this._draggingY = y;\n\n this.moved = true;\n\n this.time = Date.now();\n\n this.emit( 'dragging' );\n\n graph.draw( true );\n\n }\n\n onMouseUp( graph, x, y, e, target ) {\n\n var dt = ( Date.now() - this.time );\n\n if ( x == this._lastDraggingX || y == this._lastDraggingY ) {\n\n if ( this.moved ) {\n this.emit( 'dragged' );\n }\n\n return;\n }\n\n this.speedX = ( x - this._lastDraggingX ) / dt;\n this.speedY = ( y - this._lastDraggingY ) / dt;\n\n if ( isNaN( this.speedX ) || isNaN( this.speedY ) ) {\n this.emit( 'dragged' );\n return;\n }\n\n graph._applyToAxes( function( axis ) {\n axis._pluginDragMin = axis.getCurrentMin();\n axis._pluginDragMax = axis.getCurrentMax();\n }, false, true, true );\n\n this.stopAnimation = false;\n this.accelerationX = -this.speedX / this.totaltime;\n this.accelerationY = -this.speedY / this.totaltime;\n\n if ( this.options.persistanceX || this.options.persistanceY ) {\n\n this._persistanceMove( graph );\n\n } else {\n\n this.emit( 'dragged' );\n }\n\n }\n\n _persistanceMove( graph ) {\n\n var self = this;\n\n if ( self.stopAnimation ) {\n self.emit( 'dragged' );\n return;\n }\n\n window.requestAnimationFrame( function() {\n\n var dt = Date.now() - self.time;\n var dx = ( 0.5 * self.accelerationX * dt + self.speedX ) * dt;\n var dy = ( 0.5 * self.accelerationY * dt + self.speedY ) * dt;\n\n if ( self.options.persistanceX ) {\n\n graph._applyToAxes( function( axis ) {\n\n axis.setCurrentMin( -axis.getRelVal( dx ) + axis._pluginDragMin );\n axis.setCurrentMax( -axis.getRelVal( dx ) + axis._pluginDragMax );\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n\n }, false, true, false );\n }\n\n if ( self.options.persistanceY ) {\n\n graph._applyToAxes( function( axis ) {\n\n axis.setCurrentMin( -axis.getRelVal( dy ) + axis._pluginDragMin );\n axis.setCurrentMax( -axis.getRelVal( dy ) + axis._pluginDragMax );\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n\n }, false, false, true );\n }\n\n graph.draw();\n\n if ( dt < self.totaltime ) {\n self.emit( 'dragging' );\n self._persistanceMove( graph );\n } else {\n self.emit( 'dragged' );\n }\n\n } );\n\n }\n}\n\nexport default PluginDrag;","import Plugin from './graph.plugin.js';\nimport * as util from '../graph.util.js';\n\n/**\n * @class PluginShape\n * @implements Plugin\n */\nclass PluginShape extends Plugin {\n\n constructor() {\n super( ...arguments );\n }\n\n static\n default () {\n return {};\n }\n\n /**\n * Init method\n * @private\n */\n init( graph, options ) {\n\n super.init( graph, options );\n this.shapeType = options.type;\n }\n\n /**\n * Sets the shape that is created by the plugin\n * @param {String} shapeType - The type of the shape\n */\n setShape( shapeType ) {\n this.shapeInfo.shapeType = shapeType;\n }\n\n /**\n * @private\n */\n onMouseDown( graph, x, y, e, target ) {\n\n if ( !this.shapeType && !this.options.url ) {\n return;\n }\n\n var self = this,\n selfPlugin = this;\n\n var xVal, yVal;\n\n this.count = this.count || 0;\n\n x -= graph.getPaddingLeft();\n y -= graph.getPaddingTop();\n\n xVal = graph.getXAxis().getVal( x );\n yVal = graph.getYAxis().getVal( y );\n\n var shapeInfo = {\n\n position: [ {\n x: xVal,\n y: yVal\n }, {\n x: xVal,\n y: yVal\n } ],\n\n onChange: function( newData ) {\n graph.triggerEvent( 'onAnnotationChange', newData );\n },\n\n locked: false,\n selectable: true,\n resizable: true,\n movable: true\n };\n\n let shapeProperties = this.options.properties;\n\n util.extend( true, shapeInfo, this.options );\n\n this.emit( 'beforeNewShape', e, shapeInfo );\n\n if ( this.graph.prevent( false ) ) {\n return;\n }\n\n var shape = graph.newShape( shapeInfo.type, shapeInfo, false, shapeProperties );\n\n this.emit( 'createdShape', e, shape );\n\n if ( shape ) {\n self.currentShape = shape;\n self.currentShapeEvent = e;\n }\n\n graph.once( 'mouseUp', () => {\n console.log( this.currentShape );\n if ( !this.currentShape ) { // The mouse has moved\n self.emit( 'newShape', e, shape );\n }\n } );\n }\n\n /**\n * @private\n */\n onMouseMove( graph, x, y, e ) {\n\n if ( this.currentShape ) {\n console.log( 'mv' );\n this.count++;\n\n var shape = this.currentShape;\n\n this.currentShape = false;\n\n if ( graph.selectedSerie && !shape.serie ) {\n shape.setSerie( graph.selectedSerie );\n }\n\n shape.resizing = true;\n\n if ( shape.options && shape.options.onCreate ) {\n shape.options.onCreate.call( shape );\n }\n\n shape.draw();\n graph.selectShape( shape );\n shape.handleMouseDown( this.currentShapeEvent, true );\n shape.handleSelected = this.options.handleSelected || 1;\n shape.handleMouseMove( e, true );\n }\n }\n\n /**\n * @private\n */\n onMouseUp() {\n\n if ( this.currentShape ) {\n // No need to kill it as it hasn't been actually put in the dom right now\n\n // Norman 30 July 2017: Yes but it's added in the jsGraph stack. We need to remove it. See #176\n // From now on killing the shape will result in removing it from the stack as well.\n this.currentShape.kill();\n this.currentShape = false;\n }\n }\n\n}\n\nexport default PluginShape;","import * as util from '../graph.util.js';\nimport Plugin from './graph.plugin.js';\n\n/**\n * @extends Plugin\n */\nclass PluginSelectScatter extends Plugin {\n\n constructor() {\n super( ...arguments );\n }\n\n static\n default () {\n return {};\n }\n /**\n * Init method\n * @private\n */\n init( graph, options ) {\n\n this._path = document.createElementNS( graph.ns, 'path' );\n\n util.setAttributeTo( this._path, {\n 'display': 'none',\n 'fill': 'rgba(0,0,0,0.1)',\n 'stroke': 'rgba(0,0,0,1)',\n 'shape-rendering': 'crispEdges',\n 'x': 0,\n 'y': 0,\n 'height': 0,\n 'width': 0,\n 'd': ''\n } );\n\n this.graph = graph;\n\n graph.dom.appendChild( this._path );\n }\n\n /**\n * Assigns the scatter serie that should be selected to the plugin\n * @param {ScatterSerie} serie - The serie\n * @return {PluginSelectScatter} The current plugin instance\n */\n setSerie( serie ) {\n this.serie = serie;\n }\n\n /**\n * @private\n */\n onMouseDown( graph, x, y, e, mute ) {\n\n if ( !this.serie ) {\n return;\n }\n\n this.path = 'M ' + x + ' ' + y + ' ';\n this.currentX = x;\n this.currentY = y;\n\n this.xs = [ this.serie.getXAxis().getVal( x - graph.getPaddingLeft() ) ];\n this.ys = [ this.serie.getYAxis().getVal( y - graph.getPaddingTop() ) ];\n this._path.setAttribute( 'd', '' );\n this._path.setAttribute( 'display', 'block' );\n\n }\n\n /**\n * @private\n */\n onMouseMove( graph, x, y, e, mute ) {\n\n if ( Math.pow( ( x - this.currentX ), 2 ) + Math.pow( ( y - this.currentY ), 2 ) > 25 ) {\n\n this.path += ' L ' + x + ' ' + y + ' ';\n this.currentX = x;\n this.currentY = y;\n\n this.xs.push( this.serie.getXAxis().getVal( x - graph.getPaddingLeft() ) );\n this.ys.push( this.serie.getYAxis().getVal( y - graph.getPaddingTop() ) );\n\n this._path.setAttribute( 'd', this.path + ' z' );\n\n this.findPoints();\n }\n }\n\n /**\n * @private\n */\n findPoints() {\n\n var data = this.serie.waveform;\n var selected = [];\n var counter = 0,\n j2;\n for ( var i = 0, l = data.getLength(); i < l; i += 1 ) {\n\n counter = 0;\n for ( var j = 0, k = this.xs.length; j < k; j += 1 ) {\n\n if ( j == k - 1 ) {\n j2 = 0;\n } else {\n j2 = j + 1;\n }\n\n if ( ( ( this.ys[ j ] < data.getY( i ) && this.ys[ j2 ] > data.getY( i ) ) || ( this.ys[ j ] > data.getY( i ) && this.ys[ j2 ] < data.getY( i ) ) ) ) {\n\n if ( data.getX( i ) > ( ( data.getY( i ) - this.ys[ j ] ) / ( this.ys[ j2 ] - this.ys[ j ] ) ) * ( this.xs[ j2 ] - this.xs[ j ] ) + this.xs[ j ] ) {\n counter++;\n }\n }\n }\n\n if ( counter % 2 == 1 ) {\n selected.push( i );\n this.serie.selectPoint( i, true, 'selected' );\n } else {\n this.serie.unselectPoint( i );\n }\n\n }\n\n this.selected = selected;\n this.emit( 'selectionProcess', selected );\n }\n\n /**\n * @private\n */\n onMouseUp( graph, x, y, e ) {\n this._path.setAttribute( 'display', 'none' );\n this.emit( 'selectionEnd', this.selected );\n }\n\n}\n\nexport default PluginSelectScatter;","import * as util from '../graph.util.js';\nimport Plugin from './graph.plugin.js';\n\n/**\n * @class PluginZoom\n * @implements Plugin\n */\nclass PluginZoom extends Plugin {\n\n constructor() {\n super( ...arguments );\n }\n\n static\n default () {\n\n return {\n 'axes': 'all'\n };\n }\n\n /**\n * Init method\n * @private\n */\n init( graph, options ) {\n\n this._zoomingGroup = document.createElementNS( graph.ns, 'g' );\n this._zoomingSquare = document.createElementNS( graph.ns, 'rect' );\n this._zoomingSquare.setAttribute( 'display', 'none' );\n\n util.setAttributeTo( this._zoomingSquare, {\n 'display': 'none',\n 'fill': 'rgba(171,12,12,0.2)',\n 'stroke': 'rgba(171,12,12,1)',\n 'shape-rendering': 'crispEdges',\n 'x': 0,\n 'y': 0,\n 'height': 0,\n 'width': 0,\n 'pointer-events': 'none'\n } );\n\n this.graph = graph;\n graph.groupEvent.appendChild( this._zoomingGroup );\n this._zoomingGroup.appendChild( this._zoomingSquare );\n }\n\n /**\n * @private\n */\n onMouseDown( graph, x, y, e, mute ) {\n\n var zoomMode = this.options.zoomMode;\n\n if ( !zoomMode ) {\n return;\n }\n\n this._zoomingMode = zoomMode;\n\n if ( x === undefined ) {\n this._backedUpZoomMode = this._zoomingMode;\n this._zoomingMode = 'y';\n x = 0;\n }\n\n if ( y === undefined ) {\n this._backedUpZoomMode = this._zoomingMode;\n this._zoomingMode = 'x';\n y = 0;\n }\n\n this._zoomingXStart = x;\n this._zoomingYStart = y;\n this.x1 = x - graph.getPaddingLeft();\n this.y1 = y - graph.getPaddingTop();\n\n this._zoomingSquare.setAttribute( 'width', 0 );\n this._zoomingSquare.setAttribute( 'height', 0 );\n this._zoomingSquare.setAttribute( 'display', 'block' );\n\n switch ( this._zoomingMode ) {\n\n case 'x':\n this._zoomingSquare.setAttribute( 'y', graph.options.paddingTop );\n this._zoomingSquare.setAttribute( 'height', graph.getDrawingHeight() - graph.shift.bottom );\n break;\n\n case 'y':\n this._zoomingSquare.setAttribute( 'x', graph.options.paddingLeft /* + this.shift[1]*/ );\n this._zoomingSquare.setAttribute( 'width', graph.getDrawingWidth() /* - this.shift[1] - this.shift[2]*/ );\n break;\n\n case 'forceY2':\n\n this.y2 = graph.getYAxis().getPx( this.options.forcedY ) + graph.options.paddingTop;\n\n break;\n\n }\n\n if ( this.options.onZoomStart && !mute ) {\n this.options.onZoomStart( graph, x, y, e, mute );\n }\n }\n\n /**\n * @private\n */\n onMouseMove( graph, x, y, e, mute ) {\n\n //\tthis._zoomingSquare.setAttribute('display', 'none');\n\n //\tthis._zoomingSquare.setAttribute('transform', 'translate(' + Math.random() + ', ' + Math.random() + ') scale(10, 10)');\n switch ( this._zoomingMode ) {\n\n case 'xy':\n this._zoomingSquare.setAttribute( 'x', Math.min( this._zoomingXStart, x ) );\n this._zoomingSquare.setAttribute( 'y', Math.min( this._zoomingYStart, y ) );\n this._zoomingSquare.setAttribute( 'width', Math.abs( this._zoomingXStart - x ) );\n this._zoomingSquare.setAttribute( 'height', Math.abs( this._zoomingYStart - y ) );\n\n break;\n\n case 'forceY2':\n this._zoomingSquare.setAttribute( 'y', Math.min( this._zoomingYStart, this.y2 ) );\n this._zoomingSquare.setAttribute( 'height', Math.abs( this._zoomingYStart - this.y2 ) );\n this._zoomingSquare.setAttribute( 'x', Math.min( this._zoomingXStart, x ) );\n this._zoomingSquare.setAttribute( 'width', Math.abs( this._zoomingXStart - x ) );\n\n break;\n\n case 'x':\n this._zoomingSquare.setAttribute( 'x', Math.min( this._zoomingXStart, x ) );\n this._zoomingSquare.setAttribute( 'width', Math.abs( this._zoomingXStart - x ) );\n\n break;\n\n case 'y':\n this._zoomingSquare.setAttribute( 'y', Math.min( this._zoomingYStart, y ) );\n this._zoomingSquare.setAttribute( 'height', Math.abs( this._zoomingYStart - y ) );\n break;\n\n }\n\n if ( this.options.onZoomMove && !mute ) {\n\n this.options.onZoomMove( graph, x, y, e, mute );\n }\n //\t\tthis._zoomingSquare.setAttribute('display', 'block');\n\n }\n\n /**\n * @private\n */\n onMouseUp( graph, x, y, e, mute ) {\n var self = this;\n this.removeZone();\n\n var _x = x - graph.options.paddingLeft;\n var _y = y - graph.options.paddingTop;\n\n this.emit( 'beforeZoom', {\n graph: graph,\n x: x,\n y: y,\n e: e,\n mute: mute\n } );\n\n if ( graph.prevent( false ) ) {\n\n // This doesn't work !\n //graph.prevent( true ); // Cancel future click event\n return;\n }\n\n if ( ( x - this._zoomingXStart == 0 && this._zoomingMode != 'y' ) || ( y - this._zoomingYStart == 0 && this._zoomingMode != 'x' ) ) {\n return;\n }\n\n if ( this.options.transition || this.options.smooth ) {\n\n let modeX = false,\n modeY = false;\n\n if ( this._zoomingMode == 'x' || this._zoomingMode == 'xy' || this._zoomingMode == 'forceY2' ) {\n\n this.fullX = false;\n this.toAxes( function( axis ) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min( axis.getVal( _x ), axis.getVal( self.x1 ) );\n axis._pluginZoomMaxFinal = Math.max( axis.getVal( _x ), axis.getVal( self.x1 ) );\n }, false, true, false );\n\n modeX = true;\n\n }\n\n if ( this._zoomingMode == 'y' || this._zoomingMode == 'xy' ) {\n\n this.fullY = false;\n this.toAxes( function( axis ) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min( axis.getVal( _y ), axis.getVal( self.y1 ) );\n axis._pluginZoomMaxFinal = Math.max( axis.getVal( _y ), axis.getVal( self.y1 ) );\n\n }, false, false, true );\n\n modeY = true;\n }\n\n if ( this._zoomingMode == 'forceY2' ) {\n\n this.fullY = false;\n this.toAxes( function( axis ) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min( axis.getVal( self.y2 ), axis.getVal( self.y1 ) );\n axis._pluginZoomMaxFinal = Math.max( axis.getVal( self.y2 ), axis.getVal( self.y1 ) );\n\n }, false, false, true );\n\n modeY = true;\n }\n\n this.transition( modeX, modeY, 'zoomEnd' );\n\n } else {\n\n switch ( this._zoomingMode ) {\n case 'x':\n this.fullX = false;\n this.toAxes( '_doZoom', [ _x, this.x1 ], true, false );\n break;\n case 'y':\n this.fullY = false;\n this.toAxes( '_doZoom', [ _y, this.y1 ], false, true );\n break;\n case 'xy':\n this.fullX = false;\n this.fullY = false;\n this.toAxes( '_doZoom', [ _x, this.x1 ], true, false );\n this.toAxes( '_doZoom', [ _y, this.y1 ], false, true );\n break;\n\n case 'forceY2':\n\n this.fullX = false;\n this.fullY = false;\n\n this.toAxes( '_doZoom', [ _x, this.x1 ], true, false );\n this.toAxes( '_doZoom', [ this.y1, this.y2 ], false, true );\n\n break;\n }\n\n // graph.prevent( true ); // WHat are you doing ??\n graph.draw();\n\n if ( this._backedUpZoomMode ) {\n this._zoomingMode = this._backedUpZoomMode;\n }\n\n this.emit( 'zoomed' );\n\n graph.pluginYieldActiveState();\n\n }\n\n }\n\n /**\n * @private\n */\n removeZone() {\n\n this._zoomingSquare.setAttribute( 'display', 'none' );\n }\n\n /**\n * @private\n */\n onMouseWheel( delta, e, coordX, coordY, options ) {\n\n if ( !options ) {\n options = {};\n }\n\n if ( !options.baseline ) {\n options.baseline = 0;\n }\n\n let baseline = options.baseline;\n\n if ( options.baseline == 'mousePosition' ) {\n baseline = this.graph.getYAxis().getVal( coordY );\n console.log( baseline );\n }\n\n /*var serie;\n if ( ( serie = this.graph.getSelectedSerie() ) ) {\n\n if ( serie.getYAxis().handleMouseWheel( delta, e ) ) {\n return;\n }\n }*/\n\n var doX = ( options.direction == 'x' );\n var doY = !( options.direction !== 'y' );\n\n this.toAxes( 'handleMouseWheel', [ delta, e, baseline ], doX, doY );\n\n this.graph.drawSeries();\n\n }\n\n /**\n * @private\n */\n onDblClick( x, y, e, pref, mute ) {\n\n var graph = this.graph;\n this.emit( 'beforeDblClick', {\n graph: graph,\n x: x,\n y: y,\n pref: pref,\n e: e,\n mute: mute\n } );\n\n if ( graph.prevent( false ) ) {\n return;\n }\n\n if ( this.options.transition || this.options.smooth ) {\n\n var modeX = false,\n modeY = false;\n\n if ( pref.mode == 'xtotal' || pref.mode == 'total' ) {\n\n this.toAxes( function( axis ) {\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getMinValue() - ( axis.options.axisDataSpacing.min * axis.getInterval() );\n axis._pluginZoomMaxFinal = axis.getMaxValue() + ( axis.options.axisDataSpacing.max * axis.getInterval() );\n\n }, false, true, false );\n\n modeX = true;\n\n }\n\n if ( pref.mode == 'ytotal' || pref.mode == 'total' ) {\n\n this.toAxes( function( axis ) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getMinValue() - ( axis.options.axisDataSpacing.min * axis.getInterval() );\n axis._pluginZoomMaxFinal = axis.getMaxValue() + ( axis.options.axisDataSpacing.max * axis.getInterval() );\n\n }, false, false, true );\n\n modeY = true;\n\n }\n\n let x, y;\n\n if ( pref.mode == 'gradualX' || pref.mode == 'gradualY' || pref.mode == 'gradual' || pref.mode == 'gradualXY' ) {\n\n x = false,\n y = false;\n\n if ( pref.mode == 'gradualX' || pref.mode == 'gradual' || pref.mode == 'gradualXY' ) {\n x = true;\n modeX = true;\n }\n\n if ( pref.mode == 'gradualY' || pref.mode == 'gradual' || pref.mode == 'gradualXY' ) {\n y = true;\n modeY = true;\n }\n\n this.toAxes( function( axis ) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getCurrentMin() - ( axis.getCurrentMax() - axis.getCurrentMin() );\n axis._pluginZoomMaxFinal = axis.getCurrentMax() + ( axis.getCurrentMax() - axis.getCurrentMin() );\n\n }, false, x, y );\n\n }\n\n this.transition( modeX, modeY, 'dblClick' );\n return;\n }\n\n var xAxis = this.graph.getXAxis(),\n yAxis = this.graph.getYAxis();\n\n if ( pref.mode == 'xtotal' ) {\n\n this.toAxes( 'setMinMaxToFitSeries', null, true, false );\n this.fullX = true;\n this.fullY = false;\n\n } else if ( pref.mode == 'ytotal' ) {\n\n this.toAxes( 'setMinMaxToFitSeries', null, false, true );\n this.fullX = false;\n this.fullY = true;\n\n } else if ( pref.mode == 'total' ) {\n\n this.toAxes( 'setMinMaxToFitSeries', null, true, true );\n\n this.fullX = true;\n this.fullY = true;\n // Nothing to do here\n /* this.graph._applyToAxes( function( axis ) {\n\n axis.emit( 'zoom', axis.currentAxisMin, axis.currentAxisMax, axis );\n\n }, null, true, true );\n*/\n } else {\n\n x -= this.graph.options.paddingLeft;\n y -= this.graph.options.paddingTop;\n\n var\n xMin = xAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n xActual = xAxis.getVal( x ),\n diffX = xMax - xMin,\n\n yMin = yAxis.getCurrentMin(),\n yMax = yAxis.getCurrentMax(),\n yActual = yAxis.getVal( y ),\n diffY = yMax - yMin;\n\n if ( pref.mode == 'gradualXY' || pref.mode == 'gradualX' ) {\n\n var ratio = ( xActual - xMin ) / ( xMax - xMin );\n xMin = Math.max( xAxis.getMinValue() - xAxis.getInterval() * xAxis.options.axisDataSpacing.min, xMin - diffX * ratio );\n xMax = Math.min( xAxis.getMaxValue() + xAxis.getInterval() * xAxis.options.axisDataSpacing.max, xMax + diffX * ( 1 - ratio ) );\n xAxis.setCurrentMin( xMin );\n xAxis.setCurrentMax( xMax );\n\n if ( xAxis.options.onZoom ) {\n xAxis.options.onZoom( xMin, xMax );\n }\n\n xAxis.cacheCurrentMin();\n xAxis.cacheCurrentMax();\n xAxis.cacheInterval();\n\n }\n\n if ( pref.mode == 'gradualXY' || pref.mode == 'gradualY' ) {\n\n var ratio = ( yActual - yMin ) / ( yMax - yMin );\n yMin = Math.max( yAxis.getMinValue() - yAxis.getInterval() * yAxis.options.axisDataSpacing.min, yMin - diffY * ratio );\n yMax = Math.min( yAxis.getMaxValue() + yAxis.getInterval() * yAxis.options.axisDataSpacing.max, yMax + diffY * ( 1 - ratio ) );\n yAxis.setCurrentMin( yMin );\n yAxis.setCurrentMax( yMax );\n\n if ( yAxis.options.onZoom ) {\n yAxis.options.onZoom( yMin, yMax );\n }\n\n yAxis.cacheCurrentMin();\n yAxis.cacheCurrentMax();\n yAxis.cacheInterval();\n\n }\n\n }\n\n graph.pluginYieldActiveState();\n\n this.graph.draw();\n /*\n this.emit( \"dblClick\", {\n graph: graph,\n x: x,\n y: y,\n pref: pref,\n e: e,\n mute: mute\n } );\n\n if ( this.options.onDblClick && !mute ) {\n this.options.onDblClick( graph, x, y, e, mute );\n }*/\n\n }\n\n transition( modeX, modeY, eventName ) {\n\n var self = this,\n maxTime = 500;\n\n if ( !self.gradualUnzoomStart ) {\n self.gradualUnzoomStart = Date.now();\n }\n\n window.requestAnimationFrame( function() {\n\n var dt = Date.now() - self.gradualUnzoomStart;\n\n if ( dt > maxTime ) {\n dt = maxTime;\n }\n var progress = Math.sin( dt / maxTime * Math.PI / 2 );\n\n self.toAxes( function( axis ) {\n\n axis.setCurrentMin( axis._pluginZoomMin + ( axis._pluginZoomMinFinal - axis._pluginZoomMin ) * progress );\n axis.setCurrentMax( axis._pluginZoomMax + ( axis._pluginZoomMaxFinal - axis._pluginZoomMax ) * progress );\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n\n }, false, modeX, modeY );\n\n self.graph.draw();\n\n if ( dt < maxTime ) {\n\n self.transition( modeX, modeY, eventName );\n self.emit( 'zooming' );\n\n } else {\n\n self.emit( 'zoomed' );\n self.graph.pluginYieldActiveState();\n\n if ( eventName ) {\n self.emit( eventName );\n }\n self.gradualUnzoomStart = 0;\n\n }\n\n } );\n }\n\n isFullX() {\n return this.fullX;\n }\n\n isFullY() {\n return this.fullY;\n }\n\n toAxes( func, params, tb, lr ) {\n\n var axes = this.options.axes;\n\n if ( !axes || ( axes == 'serieSelected' && !this.graph.getSelectedSerie() ) ) {\n axes = 'all';\n }\n\n switch ( axes ) {\n\n case 'all':\n this.graph._applyToAxes.apply( this.graph, arguments );\n break;\n\n case 'serieSelected':\n\n var serie = this.graph.getSelectedSerie();\n if ( serie ) {\n\n if ( tb ) {\n\n if ( typeof func == 'string' ) {\n serie.getXAxis()[ func ].apply( serie.getXAxis(), params );\n } else {\n func.apply( serie.getXAxis(), params );\n }\n }\n\n if ( lr ) {\n\n if ( typeof func == 'string' ) {\n serie.getYAxis()[ func ].apply( serie.getYAxis(), params );\n } else {\n func.apply( serie.getYAxis(), params );\n }\n\n }\n }\n\n break;\n\n default:\n\n if ( !Array.isArray( axes ) ) {\n axes = [ axes ];\n }\n\n for ( let axis of axes ) {\n\n if ( axis.isX() && tb ) { // Not the best check\n\n if ( typeof func == 'string' ) {\n axis[ func ].apply( axis, params );\n } else {\n func.apply( axis, params );\n }\n\n } else if ( axis.isY() && lr ) { // Not the best check\n\n if ( typeof func == 'string' ) {\n axis[ func ].apply( axis, params );\n } else {\n func.apply( axis, params );\n }\n\n }\n }\n break;\n }\n }\n\n}\n\nexport default PluginZoom;","var memory = {},\n memoryHead = {},\n memoryCount = {},\n memoryLimit = {};\n\nfunction emptyMemory( store ) {\n memory[ store ] = {};\n memoryCount[ store ] = 0;\n}\n\nfunction createStoreMemory( store, limit ) {\n limit = limit || 50;\n if ( !memory[ store ] ) {\n memory[ store ] = {};\n memoryCount[ store ] = 0;\n }\n\n memoryLimit[ store ] = limit;\n}\n\nfunction getFromMemory( store, index ) {\n var obj, head;\n\n if ( memory[ store ] && memory[ store ][ index ] ) {\n\n head = memoryHead[ store ];\n\n obj = memory[ store ][ index ];\n obj.prev = head;\n obj.next = head.next;\n head.next.prev = obj;\n head.next = obj;\n\n memoryHead[ store ] = obj;\n return obj.data;\n }\n}\n\nfunction storeInMemory( store, index, data ) {\n\n var toStore, toDelete, head;\n if ( memory[ store ] && memoryCount[ store ] !== undefined && memoryLimit[ store ] ) {\n head = memoryHead[ store ];\n\n if ( memory[ store ][ index ] ) {\n\n getFromMemory( store, index );\n memory[ store ][ index ].data.data = data;\n memory[ store ][ index ].data.timeout = Date.now();\n\n } else {\n\n toStore = {\n data: {\n data: data,\n timeout: Date.now()\n }\n };\n\n if ( typeof head == 'undefined' ) {\n toStore.prev = toStore;\n toStore.next = toStore;\n } else {\n toStore.prev = head.prev;\n toStore.next = head.next;\n head.next.prev = toStore;\n head.next = toStore;\n }\n\n memoryHead[ store ] = toStore;\n memory[ store ][ index ] = toStore;\n memoryCount[ store ]++;\n }\n\n // Remove oldest one\n if ( memoryCount[ store ] > memoryLimit[ store ] && head ) {\n toDelete = head.next;\n head.next.next.prev = head;\n head.next = head.next.next;\n toDelete.next.next = undefined;\n toDelete.next.prev = undefined;\n memoryCount[ store ]--;\n }\n\n return data;\n }\n}\n\nexport function create( store, limitMemory ) {\n createStoreMemory( store, limitMemory );\n}\n\nexport function get( store, index ) {\n var result;\n if ( ( result = getFromMemory( store, index ) ) != undefined ) {\n return result;\n }\n}\n\nexport function store( store, index, value ) {\n storeInMemory( store, index, value );\n return value;\n}\n\nexport function empty( store ) {\n emptyMemory( store );\n}\n\nexport function exist( store ) {\n return ( memory[ store ] );\n}\n\nexport default get;","import Graph from '../graph.core.js';\nimport LRU from '../graph.lru.js';\nimport Plugin from './graph.plugin.js';\nimport * as util from '../graph.util.js';\n\n/**\n * @class PluginTimeSerieManager\n * @implements Plugin\n */\nclass PluginTimeSerieManager extends Plugin {\n\n constructor() {\n\n super( ...arguments );\n\n this.series = [];\n this.plugins = [];\n this.currentSlots = {};\n\n this.requestLevels = new Map();\n this.update = ( noRecalculate, force ) => {\n\n this.series.forEach( function( serie ) {\n\n this.updateSerie( serie, noRecalculate );\n\n } );\n\n if ( !noRecalculate ) {\n this.recalculateSeries( force );\n }\n };\n\n }\n\n static\n default () {\n\n return {\n\n LRUName: 'PluginTimeSerieManager',\n intervals: [ 1000, 15000, 60000, 900000, 3600000, 8640000 ],\n maxParallelRequests: 3,\n optimalPxPerPoint: 2,\n nbPoints: 1000,\n url: ''\n };\n }\n\n /**\n * Init method\n * @private\n * @memberof PluginTimeSerieManager\n */\n init( graph, options ) {\n this.graph = graph;\n LRU.create( this.options.LRUName, 200 );\n this.requestsRunning = 0;\n\n }\n\n setURL( url ) {\n this.options.url = url;\n return this;\n }\n\n setAvailableIntervals() {\n this.options.intervals = arguments;\n }\n\n newSerie( serieName, serieOptions, serieType, dbElements, noZoneSerie ) {\n var s = this.graph.newSerie( serieName, serieOptions, serieType );\n\n this.currentSlots[ serieName ] = {\n min: 0,\n max: 0,\n interval: 0\n };\n\n s.on( 'hide', function() {\n\n if ( s._zoneSerie ) {\n\n s._zoneSerie.hide();\n }\n } );\n\n s.on( 'show', function() {\n\n if ( s._zoneSerie ) {\n s._zoneSerie.show();\n }\n } );\n\n s.setInfo( 'timeSerieManagerDBElements', dbElements );\n\n if ( !noZoneSerie ) {\n s._zoneSerie = this.graph.newSerie( serieName + '_zone', {}, Graph.SERIE_ZONE );\n }\n\n this.series.push( s );\n return s;\n }\n\n registerPlugin( plugin, event ) {\n\n var index;\n if ( ( index = this.plugins.indexOf( plugin ) ) > -1 ) {\n\n for ( var i = 1; i < arguments.length; i++ ) {\n plugin.removeListener( arguments[ i ], this.update );\n }\n }\n\n for ( var i = 1; i < arguments.length; i++ ) {\n plugin.on( arguments[ i ], this.update );\n }\n }\n\n updateSerie( serie, noRecalculate ) {\n\n var self = this;\n var from = serie.getXAxis().getCurrentMin();\n var to = serie.getXAxis().getCurrentMax();\n var priority = 1;\n\n var optimalInterval = this.getOptimalInterval( to - from );\n var optimalIntervalIndex = this.options.intervals.indexOf( optimalInterval );\n var interval;\n\n this.cleanRegister( optimalIntervalIndex );\n\n for ( var i = optimalIntervalIndex; i <= optimalIntervalIndex + 1; i++ ) {\n\n interval = this.options.intervals[ i ];\n var startSlotId = self.computeSlotID( from, interval );\n var endSlotId = self.computeSlotID( to, interval );\n\n var intervalMultipliers = [\n [ 2, 5, 6 ],\n [ 1, 2, 4 ],\n [ 0, 1, 3 ]\n ];\n\n intervalMultipliers.forEach( function( multiplier ) {\n\n var firstSlotId = startSlotId - multiplier[ 0 ] * ( endSlotId - startSlotId );\n var lastSlotId = endSlotId + multiplier[ 0 ] * ( endSlotId - startSlotId );\n\n var slotId = firstSlotId;\n\n while ( slotId <= lastSlotId ) {\n\n if ( self.computeTimeMin( slotId, interval ) > Date.now() ) {\n break;\n }\n\n self.register( serie, slotId, interval, interval == optimalInterval ? multiplier[ 1 ] : multiplier[ 2 ], true, noRecalculate );\n slotId++;\n }\n\n } );\n\n }\n\n this.processRequests();\n }\n\n cleanRegister( interval ) {\n\n if ( !this.requestLevels ) {\n return;\n }\n\n this.requestLevels.forEach( ( levelArray ) => {\n\n levelArray.forEach( ( levelElement, levelIndex ) => {\n\n if ( levelElement[ 4 ] < interval ) {\n levelArray.splice( levelIndex, 1 );\n }\n } );\n\n } );\n }\n\n register( serie, slotId, interval, priority, noProcess, noRecalculate ) {\n\n var id = this.computeUniqueID( serie, slotId, interval );\n\n var data = LRU.get( this.options.LRUName, id );\n\n if ( !data || ( this.computeTimeMax( slotId, interval ) > Date.now() && data.timeout < ( Date.now() - ( noRecalculate ? 5000 : 100000 ) ) ) && priority == 1 ) {\n\n this.request( serie, slotId, interval, priority, id, noProcess );\n }\n }\n\n request( serie, slotId, interval, priority, slotName, noProcess ) {\n\n for ( var i in this.requestLevels ) {\n\n if ( i == priority ) {\n continue;\n }\n\n if ( this.requestLevels[ i ][ slotName ] ) {\n\n if ( this.requestLevels[ i ][ slotName ][ 0 ] !== 1 ) { // If the request is not pending\n\n delete this.requestLevels[ i ][ slotName ];\n\n } else {\n this.requestLevels[ i ][ slotName ][ 5 ] = priority;\n }\n\n }\n }\n\n if ( this.requestLevels[ priority ] && this.requestLevels[ priority ][ slotName ] ) {\n return;\n }\n\n this.requestLevels[ priority ] = this.requestLevels[ priority ] || {};\n this.requestLevels[ priority ][ slotName ] = [ 0, slotName, serie.getName(), slotId, interval, priority, serie.getInfo( 'timeSerieManagerDBElements' ) ];\n\n if ( !noProcess ) {\n this.processRequests();\n }\n }\n\n processRequests() {\n\n if ( this.requestsRunning >= this.options.maxParallelRequests ) {\n return;\n }\n\n var self = this,\n currentLevelChecking = 1,\n requestToMake;\n\n while ( true ) {\n\n for ( var i in this.requestLevels[ currentLevelChecking ] ) {\n\n if ( this.requestLevels[ currentLevelChecking ][ i ][ 0 ] == 1 ) { // Running request\n continue;\n }\n\n requestToMake = this.requestLevels[ currentLevelChecking ][ i ];\n break;\n }\n\n if ( requestToMake ) {\n break;\n }\n\n currentLevelChecking++;\n\n if ( currentLevelChecking > 10 ) {\n return;\n }\n\n }\n\n this.requestsRunning++;\n\n if ( !requestToMake ) {\n return;\n }\n\n requestToMake[ 0 ] = 1;\n\n util.ajaxGet( {\n\n url: this.getURL( requestToMake ),\n method: 'GET',\n json: true\n\n } ).done( function( data ) {\n\n if ( data.status == 1 ) { // Success\n\n self.requestsRunning--;\n\n delete self.requestLevels[ currentLevelChecking ][ i ];\n\n LRU.store( self.options.LRUName, requestToMake[ 1 ], data.data ); // Element 1 is the unique ID\n self.processRequests();\n\n if ( requestToMake[ 5 ] == 1 && Object.keys( self.requestLevels[ 1 ] ).length == 0 ) {\n\n self.recalculateSeries( true );\n }\n }\n\n } );\n }\n\n computeTimeMax( slotId, interval ) {\n return ( slotId + 1 ) * ( interval * this.options.nbPoints );\n }\n\n computeTimeMin( slotId, interval ) {\n return ( slotId ) * ( interval * this.options.nbPoints );\n }\n\n getURL( requestElements ) {\n\n var url = this.options.url\n .replace( '', requestElements[ 2 ] )\n .replace( '', this.computeTimeMin( requestElements[ 3 ], requestElements[ 4 ] ) )\n .replace( '', this.computeTimeMax( requestElements[ 3 ], requestElements[ 4 ] ) )\n .replace( '', requestElements[ 4 ] );\n\n var dbElements = requestElements[ 6 ] || {};\n\n for ( var i in dbElements ) {\n url = url.replace( '<' + i + '>', dbElements[ i ] );\n }\n\n return url;\n }\n\n getOptimalInterval( totalspan ) {\n\n var optimalInterval = ( this.options.optimalPxPerPoint || 1 ) * totalspan / this.graph.getDrawingWidth(),\n diff = Infinity,\n optimalIntervalAmongAvailable;\n\n this.options.intervals.forEach( function( interval ) {\n\n var newDiff = Math.min( diff, Math.abs( interval - optimalInterval ) );\n if ( diff !== newDiff ) {\n\n optimalIntervalAmongAvailable = interval;\n diff = newDiff;\n }\n } );\n\n return optimalIntervalAmongAvailable || 1000;\n }\n\n computeUniqueID( serie, slotId, interval ) {\n var extra = '';\n var info = serie.getInfo( 'timeSerieManagerDBElements' );\n for ( var i in info ) {\n extra += ';' + i + ':' + info[ i ];\n }\n\n return serie.getName() + ';' + slotId + ';' + interval + extra;\n }\n\n computeSlotID( time, interval ) {\n return Math.floor( time / ( interval * this.options.nbPoints ) );\n }\n\n computeSlotTime( slotId, interval ) {\n return slotId * ( interval * this.options.nbPoints );\n }\n\n getZoneSerie( serie ) {\n return serie._zoneSerie;\n }\n\n updateZoneSerie( serieName ) {\n\n var serie = this.graph.getSerie( serieName );\n\n if ( !serie ) {\n return;\n }\n\n if ( !serie._zoneSerie ) {\n return;\n }\n\n serie._zoneSerie.setXAxis( serie.getXAxis() );\n serie._zoneSerie.setYAxis( serie.getYAxis() );\n serie._zoneSerie.setFillColor( serie.getLineColor() );\n serie._zoneSerie.setLineColor( serie.getLineColor() );\n serie._zoneSerie.setFillOpacity( 0.2 );\n serie._zoneSerie.setLineOpacity( 0.3 );\n }\n\n recalculateSeries( force ) {\n\n var self = this;\n\n if ( this.locked ) {\n return;\n }\n\n this.changed = false;\n\n this.series.map( function( serie ) {\n self.recalculateSerie( serie, force );\n } );\n\n /*if ( this.changed ) {\n self.graph._applyToAxes( \"scaleToFitAxis\", [ this.graph.getXAxis(), false, undefined, undefined, false, true ], false, true );\n }\n */\n this.changed = false;\n //self.graph.autoscaleAxes();\n\n self.graph.draw();\n }\n\n recalculateSerie( serie, force ) {\n\n var from = serie.getXAxis().getCurrentMin(),\n to = serie.getXAxis().getCurrentMax(),\n interval = this.getOptimalInterval( to - from );\n\n var startSlotId = this.computeSlotID( from, interval );\n var endSlotId = this.computeSlotID( to, interval );\n\n var data = [];\n var dataMinMax = [];\n\n if ( !force && interval == this.currentSlots[ serie.getName() ].interval && this.currentSlots[ serie.getName() ].min <= startSlotId && this.currentSlots[ serie.getName() ].max >= endSlotId ) {\n return;\n }\n\n startSlotId -= 2;\n endSlotId += 2;\n\n this.currentSlots[ serie.getName() ].min = startSlotId;\n this.currentSlots[ serie.getName() ].max = endSlotId;\n this.currentSlots[ serie.getName() ].interval = interval;\n\n var slotId = startSlotId;\n\n while ( slotId <= endSlotId ) {\n\n const lruData = LRU.get( this.options.LRUName, this.computeUniqueID( serie, slotId, interval ) );\n if ( lruData ) {\n\n data = data.concat( lruData.data.mean );\n dataMinMax = dataMinMax.concat( lruData.data.minmax );\n\n } else {\n\n this.recalculateSerieUpwards( serie, slotId, interval, data, dataMinMax );\n }\n\n slotId++;\n }\n\n this.changed = true;\n\n serie.setData( data );\n\n if ( serie._zoneSerie ) {\n serie._zoneSerie.setData( dataMinMax );\n }\n }\n\n setIntervalCheck( interval ) {\n\n if ( this.interval ) {\n clearInterval( this.interval );\n }\n\n this.update( true, true );\n this.interval = setInterval( () => {\n this.update( true, false );\n }, interval );\n }\n\n recalculateSerieUpwards( serie, downSlotId, downInterval, data, dataMinMax ) {\n\n var intervals = this.options.intervals.slice( 0 );\n intervals.sort();\n\n var nextInterval = intervals[ intervals.indexOf( downInterval ) + 1 ] || -1;\n if ( nextInterval < 0 ) {\n return [];\n }\n\n var newSlotTime = this.computeSlotTime( downSlotId, downInterval );\n var newSlotTimeEnd = this.computeSlotTime( downSlotId + 1, downInterval );\n var newSlotId = this.computeSlotID( newSlotTime, nextInterval ),\n start = false;\n\n const lruData = LRU.get( this.options.LRUName, this.computeUniqueID( serie, newSlotId, nextInterval ) );\n if ( lruData ) {\n\n for ( var i = 0, l = lruData.data.mean.length; i < l; i += 2 ) {\n\n if ( lruData.data.mean[ i ] < newSlotTime ) {\n continue;\n\n } else if ( start === false ) {\n start = i;\n }\n\n if ( lruData.data.mean[ i ] >= newSlotTimeEnd ) {\n\n data = data.concat( lruData.data.mean.slice( start, i ) );\n dataMinMax = data.concat( lruData.data.minmax.slice( start, i ) );\n\n return;\n }\n }\n }\n\n return this.recalculateSerieUpwards( serie, newSlotId, nextInterval, data, dataMinMax );\n }\n\n lockRedraw() {\n this.locked = true;\n }\n\n unlockRedraw() {\n this.locked = false;\n }\n\n isRedrawLocked() {\n return !!this.locked;\n }\n}\n\nexport default PluginTimeSerieManager;","import Plugin from './graph.plugin.js';\n\n/**\n * @class PluginSerieLineDifference\n * @implements Plugin\n */\nclass PluginSerieLineDifference extends Plugin {\n\n constructor() {\n super( ...arguments );\n }\n\n static\n default () {\n return {\n\n positiveStyle: {\n\n fillColor: 'green',\n fillOpacity: 0.2,\n strokeWidth: 0\n },\n\n negativeStyle: {\n fillColor: 'red',\n fillOpacity: 0.2,\n strokeWidth: 0\n },\n\n from: 0,\n to: 0\n };\n }\n\n /**\n * Init method\n * @private\n */\n init( graph, options ) {\n this.graph = graph;\n\n this.pathsPositive = [];\n this.pathsNegative = [];\n\n this.positivePolyline = this.graph.newShape( 'polyline' ).draw();\n\n this.positivePolyline.\n setFillColor( this.options.positiveStyle.fillColor ).\n setFillOpacity( this.options.positiveStyle.fillOpacity ).\n setStrokeWidth( this.options.positiveStyle.strokeWidth ).\n applyStyle();\n\n this.negativePolyline = this.graph.newShape( 'polyline' ).draw();\n\n this.negativePolyline.\n setFillColor( this.options.negativeStyle.fillColor ).\n setFillOpacity( this.options.negativeStyle.fillOpacity ).\n setStrokeWidth( this.options.negativeStyle.strokeWidth ).\n applyStyle();\n }\n\n /**\n * Assigns the two series for the shape. Postive values are defined when ```serieTop``` is higher than ```serieBottom```.\n * @param {SerieLine} serieTop - The top serie\n * @param {SerieLine} serieBottom - The bottom serie\n */\n setSeries( serieTop, serieBottom ) {\n this.serie1 = serieTop;\n this.serie2 = serieBottom;\n }\n\n /**\n * Assigns the boundaries\n */\n setBoundaries( from, to ) {\n this.options.from = from;\n this.options.to = to;\n }\n\n /**\n * @returns the starting value used to draw the zone\n */\n getFrom() {\n return this.options.from;\n }\n\n /**\n * @returns the ending value used to draw the zone\n */\n getTo() {\n return this.options.to;\n }\n\n /**\n * Calculates and draws the zone series\n * @returns {Plugin} The current plugin instance\n */\n draw() {\n\n var self = this;\n var s1 = this.serie1.searchClosestValue( this.getFrom() );\n var i1, j1, i2, j2, y, y2, crossing;\n\n var top = [];\n var bottom = [];\n\n var bottomBroken;\n\n if ( !s1 ) {\n i1 = 0;\n j1 = 0;\n } else {\n\n i1 = s1.dataIndex;\n j1 = s1.xAfterIndex * 2;\n }\n\n y = this.interpolate( this.serie1, this.getFrom() );\n top.push( this.getFrom() ); // x\n top.push( y ); // y\n\n y = this.interpolate( this.serie2, this.getFrom() );\n bottom.push( this.getFrom() ); // x\n bottom.push( y ); // y\n\n var s2;\n\n var order;\n\n function nextSet() {\n\n if ( order === true ) {\n self.pathsPositive.push( [ top, bottom ] );\n } else if ( order === false ) {\n self.pathsNegative.push( [ top, bottom ] );\n }\n\n top = [];\n bottom = [];\n order = undefined;\n }\n var ended;\n for ( ; i1 < this.serie1.data.length; i1++ ) {\n\n for ( ; j1 < this.serie1.data[ i1 ].length; j1 += 2 ) {\n\n if ( this.serie1.data[ i1 ][ j1 ] > this.getTo() ) { // FINISHED !\n\n y = this.interpolate( this.serie1, this.getTo() );\n y2 = this.interpolate( this.serie2, this.getTo() );\n\n crossing = this.computeCrossing(\n top[ top.length - 2 ], top[ top.length - 1 ],\n this.getTo(), y,\n bottom[ bottom.length - 2 ], bottom[ bottom.length - 1 ],\n this.getTo(), y2\n );\n\n if ( crossing ) {\n\n top.push( crossing.x );\n top.push( crossing.y );\n bottom.push( crossing.x );\n bottom.push( crossing.y );\n nextSet();\n top.push( crossing.x );\n top.push( crossing.y );\n bottom.push( crossing.x );\n bottom.push( crossing.y );\n\n order = this.serie1.data[ i1 ][ j1 + 1 ] > this.serie2.data[ i2 ][ j2 + 1 ];\n }\n\n top.push( this.getTo() ); // x\n top.push( y ); // y\n\n bottom.push( this.getTo() ); // x\n bottom.push( y2 ); // y\n\n ended = true;\n break;\n }\n\n if ( !s2 ) {\n s2 = this.serie2.searchClosestValue( this.serie1.data[ i1 ][ j1 ] ); // Finds the first point\n\n if ( s2 ) {\n i2 = s2.dataIndex;\n j2 = s2.xBeforeIndex * 2;\n\n // TODO: Add here first points\n\n y = this.interpolate( this.serie2, this.serie1.data[ i1 ][ j1 ] );\n\n top.push( this.serie1.data[ i1 ][ j1 ] ); // x\n top.push( this.serie1.data[ i1 ][ j1 + 1 ] ); // y\n\n bottom.push( this.serie1.data[ i1 ][ j1 ] ); // x\n bottom.push( y ); // y\n\n order = this.serie1.data[ i1 ][ j1 + 1 ] > y;\n\n } else {\n continue;\n }\n }\n\n bottomBroken = false;\n\n crossing = this.computeCrossing(\n top[ top.length - 2 ], top[ top.length - 1 ],\n this.serie1.data[ i1 ][ j1 ], this.serie1.data[ i1 ][ j1 + 1 ],\n bottom[ bottom.length - 2 ], bottom[ bottom.length - 1 ],\n this.serie2.data[ i2 ][ j2 ], this.serie2.data[ i2 ][ j2 + 1 ]\n );\n\n if ( crossing ) {\n\n top.push( crossing.x );\n top.push( crossing.y );\n bottom.push( crossing.x );\n bottom.push( crossing.y );\n nextSet();\n top.push( crossing.x );\n top.push( crossing.y );\n bottom.push( crossing.x );\n bottom.push( crossing.y );\n\n order = this.serie1.data[ i1 ][ j1 + 1 ] > this.serie2.data[ i2 ][ j2 + 1 ];\n }\n\n while ( this.serie2.data[ i2 ][ j2 ] < this.serie1.data[ i1 ][ j1 ] ) {\n\n bottom.push( this.serie2.data[ i2 ][ j2 ] );\n bottom.push( this.serie2.data[ i2 ][ j2 + 1 ] );\n\n j2 += 2;\n if ( j2 == this.serie2.data[ i2 ].length ) {\n bottomBroken = this.serie2.data[ i2 ][ j2 - 2 ];\n i2++;\n j2 = 0;\n break;\n }\n\n crossing = this.computeCrossing(\n top[ top.length - 2 ], top[ top.length - 1 ],\n this.serie1.data[ i1 ][ j1 ], this.serie1.data[ i1 ][ j1 + 1 ],\n bottom[ bottom.length - 2 ], bottom[ bottom.length - 1 ],\n this.serie2.data[ i2 ][ j2 ], this.serie2.data[ i2 ][ j2 + 1 ]\n );\n\n if ( crossing ) {\n\n top.push( crossing.x );\n top.push( crossing.y );\n bottom.push( crossing.x );\n bottom.push( crossing.y );\n nextSet();\n top.push( crossing.x );\n top.push( crossing.y );\n bottom.push( crossing.x );\n bottom.push( crossing.y );\n\n order = this.serie1.data[ i1 ][ j1 + 1 ] > this.serie2.data[ i2 ][ j2 + 1 ];\n }\n\n }\n\n if ( bottomBroken === false ) {\n top.push( this.serie1.data[ i1 ][ j1 ] );\n top.push( this.serie1.data[ i1 ][ j1 + 1 ] );\n } else {\n\n top.push( bottomBroken );\n top.push( this.interpolate( this.serie1, bottomBroken ) );\n\n s2 = false;\n j1 -= 2;\n nextSet();\n }\n\n }\n\n if ( ended ) {\n nextSet();\n break;\n }\n // End of X\n\n y = this.interpolate( this.serie2, top[ top.length - 2 ] );\n if ( y ) {\n bottom.push( top[ top.length - 2 ] );\n bottom.push( y );\n }\n\n nextSet();\n\n j1 = 0;\n s2 = false;\n }\n\n var d = this.pathsPositive.reduce( makePaths, '' );\n this.positivePolyline.setPointsPx( d ).redraw();\n\n var d = this.pathsNegative.reduce( makePaths, '' );\n this.negativePolyline.setPointsPx( d ).redraw();\n\n //pathsBottom.map( function( map ) { makePaths( map, self.options.negativeStyle ); } );\n\n function makePaths( d, path ) {\n\n for ( var i = 0; i < path[ 0 ].length; i += 2 ) {\n if ( i == 0 ) {\n d += 'M ';\n }\n d += ' ' + Math.round( self.serie1.getXAxis().getPx( path[ 0 ][ i ] ) ) + ', ' + Math.round( self.serie1.getYAxis().getPx( path[ 0 ][ i + 1 ] ) );\n if ( i < path[ 0 ].length - 2 ) {\n d += ' L ';\n }\n }\n\n for ( var i = path[ 1 ].length - 2; i >= 0; i -= 2 ) {\n d += ' L ' + Math.round( self.serie2.getXAxis().getPx( path[ 1 ][ i ] ) ) + ', ' + Math.round( self.serie2.getYAxis().getPx( path[ 1 ][ i + 1 ] ) );\n if ( i == 0 ) {\n d += ' z ';\n }\n }\n return d;\n }\n\n }\n\n /**\n * Finds the interpolated y value at point ```valX``` of the serie ```serie```\n * @returns {(Number|Boolean)} The interpolated y value is possible, ```false``` otherwise\n * @param {Serie} serie - The serie for which the y value should be computed\n * @param {Number} valX - The x value\n */\n interpolate( serie, valX ) {\n\n var value = serie.searchClosestValue( valX );\n\n if ( !value ) {\n return false;\n }\n\n if ( value.xMax == undefined ) {\n return value.yMin;\n }\n\n if ( value.xMin == undefined ) {\n return value.yMax;\n }\n\n var ratio = ( valX - value.xMin ) / ( value.xMax - value.xMin );\n return ( ( 1 - ratio ) * value.yMin + ratio * value.yMax );\n }\n\n /**\n * Finds the crossing point between two vector and returns it, or ```false``` if it is not within the x boundaries\n * @returns {(Object|Boolean)} An object containing the crossing point in the following format: ```{ x: xCrossing, y: yCrossing }``` or ```false``` if no crossing point can be found\n * @param {Number} x11 - First x point of the first vector\n * @param {Number} y11 - First y point of the first vector\n * @param {Number} x12 - Second x point of the first vector\n * @param {Number} y12 - Second y point of the first vector\n * @param {Number} x21 - First x point of the second vector\n * @param {Number} y21 - First y point of the second vector\n * @param {Number} y22 - Second x point of the second vector\n * @param {Number} y22 - Second y point of the second vector\n */\n computeCrossing( x11, y11, x12, y12, x21, y21, x22, y22 ) {\n var a1 = ( y12 - y11 ) / ( x12 - x11 );\n var a2 = ( y22 - y21 ) / ( x22 - x21 );\n\n var b1 = y12 - a1 * x12;\n var b2 = y22 - a2 * x22;\n\n if ( x11 == x12 || x21 == x22 ) {\n\n return false;\n }\n\n if ( a1 == a2 ) {\n return {\n x: x11,\n y1: y11,\n y2: y11\n };\n }\n\n var x = ( b1 - b2 ) / ( a2 - a1 );\n\n if ( x > x12 || x < x11 || x < x21 || x > x22 ) {\n return false;\n }\n\n return {\n x: x,\n y: a1 * x + b1\n };\n }\n\n /**\n * @returns The positive polyline\n */\n getPositivePolyline() {\n return this.positivePolyline;\n }\n\n /**\n * @returns The negative polyline\n */\n getNegativePolyline() {\n return this.negativePolyline;\n }\n\n}\n\nexport default PluginSerieLineDifference;","import Graph from '../graph.core.js';\nimport AxisX from '../graph.axis.x.js';\nimport AxisY from '../graph.axis.y.js';\nimport * as util from '../graph.util.js';\nimport SerieLine from '../series/graph.serie.line.js';\nimport SerieScatter from '../series/graph.serie.scatter.js';\nimport Plugin from './graph.plugin.js';\nimport Axis from '../graph.axis.js';\n\nclass SerieLineExtended extends SerieLine {\n\n constructor() {\n super( ...arguments );\n this.subSeries = [];\n }\n\n setData() {\n super.setData( ...arguments );\n this.subSeries.map( ( sub ) => {\n sub.data = this.data;\n } );\n return this;\n }\n\n draw() {\n this.eraseMarkers();\n return this;\n }\n\n getSymbolForLegend() {\n if ( !this.subSeries[ 0 ] ) {\n return false;\n }\n\n return this.subSeries[ 0 ].getSymbolForLegend();\n }\n\n getMarkerForLegend() {\n if ( !this.subSeries[ 0 ] ) {\n return false;\n }\n\n return this.subSeries[ 0 ].getMarkerForLegend();\n }\n}\n\nclass SerieScatterExtended extends SerieScatter {\n\n constructor() {\n super( ...arguments );\n this.subSeries = [];\n }\n\n setData() {\n super.setData( ...arguments );\n this.subSeries.map( ( sub ) => {\n sub.data = this.data;\n } );\n return this;\n }\n\n draw() {\n return this;\n }\n\n getSymbolForLegend() {\n if ( !this.subSeries[ 0 ] ) {\n return false;\n }\n\n return this.subSeries[ 0 ].getSymbolForLegend();\n }\n\n getMarkerForLegend() {\n if ( !this.subSeries[ 0 ] ) {\n return false;\n }\n\n return this.subSeries[ 0 ].getMarkerForLegend();\n }\n}\n\nvar excludingMethods = [\n 'constructor',\n 'init',\n 'draw',\n 'setLineColor',\n 'setLineWidth',\n 'setLineStyle',\n 'getLineColor',\n 'getLineWidth',\n 'getLineStyle',\n 'setMarkers',\n 'showMarkers',\n 'hideMarkers',\n 'getMarkerDom',\n 'getMarkerDomIndependant',\n 'getMarkerPath',\n 'eraseMarkers',\n '_recalculateMarkerPoints'\n];\nvar addMethods = [];\n\nObject.getOwnPropertyNames( SerieLine.prototype ).concat( addMethods ).map( function( i ) {\n\n if ( excludingMethods.indexOf( i ) > -1 ) {\n return;\n }\n\n SerieLineExtended.prototype[ i ] = ( function( j ) {\n\n return function() {\n\n var args = arguments;\n this.subSeries.map( ( subSerie ) => {\n subSerie[ j ]( ...args );\n } );\n };\n\n } )( i );\n} );\n\n/**\n * Axis splitting plugin\n * @augments Plugin\n */\nclass PluginAxisSplitting extends Plugin {\n\n constructor( options ) {\n super( ...arguments );\n this.series = new Map();\n }\n\n static defaults() {\n\n return {\n axes: {\n margins: {\n high: 5,\n low: 5\n }\n }\n };\n }\n\n init( graph ) {\n this.graph = graph;\n }\n\n /**\n * Creates a new bottom split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newXAxis( options ) {\n return this.newBottomAxis( options );\n }\n\n /**\n * Creates a new left split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newYAxis( options ) {\n return this.newLeftAxis( options );\n }\n\n /**\n * Creates a new top split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newTopAxis( options ) {\n options = this.getOptions( options );\n return new SplitXAxis( this.graph, 'top', options );\n }\n\n /**\n * Creates a new bottom split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newBottomAxis( options ) {\n options = this.getOptions( options );\n return new SplitXAxis( this.graph, 'bottom', options );\n }\n\n /**\n * Creates a new left split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newLeftAxis( options ) {\n options = this.getOptions( options );\n return new SplitYAxis( this.graph, 'left', options );\n }\n\n /**\n * Creates a new right split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newRightAxis( options ) {\n options = this.getOptions( options );\n return new SplitYAxis( this.graph, 'right', options );\n }\n\n getOptions( options ) {\n var defaults = {\n marginMin: this.options.axes.margins.low,\n marginMax: this.options.axes.margins.high,\n };\n return util.extend( true, defaults, options );\n }\n\n preDraw() {\n\n var xAxis, yAxis;\n\n // for ( let { serie } of this.series.values() ) {\n this.series.forEach( ( {\n serie\n } ) => {\n\n xAxis = serie.getXAxis();\n yAxis = serie.getYAxis();\n\n let splits = 1;\n\n if ( xAxis.splitNumber ) {\n splits *= xAxis.splitNumber;\n }\n\n if ( yAxis.splitNumber ) {\n splits *= yAxis.splitNumber;\n }\n\n while ( serie.subSeries.length < splits ) {\n\n const name = serie.getName() + '_' + serie.subSeries.length;\n\n const s = this.graph.newSerie( name, {}, serie.getType() || Graph.SERIE_LINE );\n\n s.excludedFromLegend = true;\n s.styles = serie.styles;\n s.data = serie.data; // Copy data\n\n if ( serie.getType() == Graph.SERIE_LINE ) {\n s.markerPoints = serie.markerPoints;\n s.markerFamilies = serie.markerFamilies;\n }\n\n serie.subSeries.push( s );\n }\n\n while ( serie.subSeries.length > splits ) {\n\n let subserie = this.graph.getSerie( serie.getName() + '_' + ( serie.subSeries.length - 1 ) );\n\n if ( subserie && subserie.kill ) {\n subserie.kill();\n }\n serie.subSeries.pop();\n\n }\n\n if ( !serie.getXAxis().splitNumber && serie.getXAxis().splitAxis ) {\n serie.getXAxis().splitAxis();\n }\n\n if ( !serie.getYAxis().splitNumber && serie.getYAxis().splitAxis ) {\n serie.getYAxis().splitAxis();\n }\n\n // Re-assign axes to the sub series\n serie.subSeries.map( ( sserie, index ) => {\n\n var xSubAxis, ySubAxis;\n\n //sserie.groupMarkers = firstSubSerie.groupMarkers;\n\n if ( serie.getXAxis().getSubAxis ) {\n let subAxisIndex = index % ( ( xAxis.splitNumber || 1 ) );\n xSubAxis = serie.getXAxis().getSubAxis( subAxisIndex );\n } else {\n xSubAxis = serie.getXAxis();\n }\n\n sserie.setXAxis( xSubAxis );\n\n if ( serie.getYAxis().getSubAxis ) {\n\n let subAxisIndex = Math.floor( index / ( ( xAxis.splitNumber || 1 ) ) );\n ySubAxis = serie.getYAxis().getSubAxis( subAxisIndex );\n } else {\n ySubAxis = serie.getYAxis();\n }\n\n sserie.setYAxis( ySubAxis );\n\n sserie.draw( true );\n } );\n //}\n\n } );\n\n }\n\n /**\n * Creates a new serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @param {String} type - The type of the serie\n * @return {Serie} The created serie\n */\n newSerie( name, options = {}, type ) {\n\n switch ( type ) {\n\n case 'line':\n return this.newLineSerie( name, options );\n break;\n\n case 'scatter':\n return this.newScatterSerie( name, options );\n break;\n }\n\n throw 'Cannot create a split serie of type ' + type;\n }\n\n /**\n * Creates a new line serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @return {Serie} The created serie\n */\n newLineSerie( name, options ) {\n var serieObj = {\n type: 'lineSerie',\n serie: new SerieLineExtended( name, options, 'line' )\n };\n this.series.set( name, serieObj );\n serieObj.serie.init( this.graph, name, options );\n this.graph.series.push( serieObj.serie );\n return serieObj.serie;\n }\n\n /**\n * Creates a new scatter serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @return {Serie} The created serie\n */\n newScatterSerie( name, options ) {\n var serieObj = {\n type: 'scatterSerie',\n serie: new SerieScatterExtended( name, options, 'scatter' )\n };\n this.series.set( name, serieObj );\n serieObj.serie.init( this.graph, options );\n this.graph.series.push( serieObj.serie );\n return serieObj.serie;\n }\n\n}\n\nvar defaultAxisConstructorOptions = {\n splitMarks: true\n};\n\nvar SplitAxis = function( mixin ) {\n\n var delegateMethods = [\n\n 'turnGridsOff',\n 'turnGridsOn',\n 'gridsOff',\n 'gridsOn',\n 'setEngineering',\n 'setScientificScaleExponent',\n 'setScientific',\n 'setLabelColor',\n 'setSecondaryGridDasharray',\n 'setPrimaryGridDasharray',\n 'setSecondaryGridsOpacity',\n 'setPrimaryGridOpacity',\n 'setSecondaryGridWidth',\n 'setPrimaryGridWidth',\n 'setSecondaryGridColor',\n 'setPrimaryGridColor',\n 'setTicksLabelColor',\n 'setSecondaryTicksColor',\n 'setPrimaryTicksColor',\n 'setAxisColor',\n 'secondaryGridOn',\n 'secondaryGridOff',\n 'primaryGridOff',\n 'primaryGridOn',\n 'setSecondaryGrid',\n 'setPrimaryGrid',\n 'setGrids',\n 'setTickPosition',\n 'setExponentialFactor',\n 'setExponentialLabelFactor',\n 'setGridLinesStyle',\n 'forcePrimaryTickUnitMin',\n 'forcePrimaryTickUnitMax',\n 'forcePrimaryTickUnit',\n 'flip',\n 'show',\n 'hide',\n 'setDisplay'\n ];\n\n /**\n * Split axis\n * @mixes AxisX\n * @mixes AxisY\n * @name SplitAxis\n * @static\n */\n var cl = class SplitAxis extends mixin {\n\n constructor( graph, position, options = {} ) {\n\n super( graph, position, options );\n this.axes = [];\n this.position = position;\n this.constructorOptions = util.extend( true, {}, defaultAxisConstructorOptions, options );\n\n this._splitVal = [];\n }\n\n /**\n * Calls a callback onto each chunk axes. The callback receives two parameters: 1) the ```axis``` itself and 2) the ```index``` of the axis in the stack\n * @param {Function} callback - The callback to be applied to each axes\n * @return {SplitAxis} The current axis instance\n */\n all( callback ) {\n\n if ( !( typeof callback == 'function' ) ) {\n return;\n }\n\n this.axes.map( callback );\n return this;\n }\n\n /**\n * Splits the axis into chunks at the positions defined as a list of parameters.\n * @param {Function} ...splits - The positions of axis splitting\n * @return {SplitAxis} The current axis instance\n * @example axis.splitAxis( 0.2, 0.5, 0.8 ); // Creates 4 chunks (0-20%, 20%-50%, 50%-80%, 80%-100%)\n */\n splitAxis( ...splits ) {\n\n splits.push( 1 );\n let splitNumber = splits.length;\n\n while ( this.axes.length > splitNumber ) {\n this.axes.pop().kill( true, true );\n }\n\n while ( this.axes.length < splitNumber ) {\n let axis = new( this.getConstructor() )( this.graph, this.position, this.constructorOptions );\n this.axes.push( axis );\n axis.zoomLock = true;\n axis.init( this.graph, this.constructorOptions );\n }\n\n let from = 0;\n let i = 0;\n for ( let axis of this.axes ) {\n\n axis.options.marginMin = 10;\n axis.options.marginMax = 10;\n\n if ( i == 0 ) {\n axis.options.marginMin = 0;\n }\n\n if ( i == this.axes.length - 1 ) {\n axis.options.marginMax = 0;\n }\n\n axis.setSpan( from, ( from = splits[ i ] ) );\n axis.setMinMaxFlipped();\n i++;\n }\n\n this._splits = splits;\n return this;\n }\n\n /**\n * Fixes the major tick interval of all axes based on the one provided as a parameter\n * @param {Number} axisIndex - The index of the reference axis (starting at 0)\n * @return {SplitAxis} The current axis instance\n */\n fixGridIntervalBasedOnAxis( axisIndex ) {\n\n this.fixGridFor = axisIndex;\n this.graph._axisHasChanged();\n return this;\n }\n\n /**\n * Spreads the chunks of the axis based on the relative interval of each one of them, so that the unit / px is constant for each chunk\n * @param {Boolean} bln - ```true``` to enable the spread, ```false``` otherwise\n * @return {SplitAxis} The current axis instance\n */\n splitSpread( bln ) {\n this.autoSpread = !!bln;\n return this;\n }\n\n hasAxis( axis ) {\n return this.axes.indexOf( axis ) > -1;\n }\n\n _splitSpread() {\n\n let splits = [],\n total = 0,\n currentSplit = 0;\n //console.log( this._splitVal );\n for ( let split of this._splitVal ) {\n total += split[ 1 ] - split[ 0 ];\n }\n\n for ( let split of this._splitVal ) {\n\n splits.push( currentSplit += ( split[ 1 ] - split[ 0 ] ) / total );\n }\n\n splits.pop();\n this.splitAxis( ...splits );\n }\n\n /**\n * Defines the boundaries of each chunk in axis unit.\n * @param {Array<(Array|Number)>} values - An array of either 2-component arrays (from-to) or number (mean)\n * @example axis.setChunkBoundaries( [ [ 12, 20 ], [ 100, 200 ] ] ); // First chunk from 12 to 20, second one from 100 to 200\n * @example axis.setChunkBoundaries( [ 12, [ 100, 200 ] ] ); // Second chunk from 100 to 200, first chunk with a mean at 12 and min / max determined by the relative widths of the chunks\n * @return {SplitAxis} The current axis instance\n */\n setChunkBoundaries( values ) {\n\n let index = 0,\n baseWidth,\n baseWidthIndex;\n\n for ( let axis of this.axes ) { // List all axes\n\n // Two elements in the array => becomes the new reference\n if ( Array.isArray( values[ index ] ) && values[ index ].length > 1 && !baseWidth ) {\n baseWidth = values[ index ][ 1 ] - values[ index ][ 0 ];\n baseWidthIndex = index;\n }\n\n if ( values[ index ].length == 1 || !Array.isArray( values[ index ] ) ) {\n axis._mean = values[ index ];\n\n if ( Array.isArray( axis._mean ) ) {\n axis._mean = axis._mean[ 0 ];\n }\n\n } else {\n\n axis\n .forceMin( values[ index ][ 0 ] )\n .forceMax( values[ index ][ 1 ] );\n }\n\n index++;\n }\n\n this._baseWidthVal = baseWidth;\n this._baseWidthIndex = baseWidthIndex;\n\n this._splitVal = values;\n\n this.graph._axisHasChanged();\n\n return this;\n }\n\n setMinMaxToFitSeries() {\n\n if ( !this._splitVal || this._splitVal.length < 1 ) {\n super.setMinMaxToFitSeries( ...arguments );\n this._splitVal[ 0 ] = this._splitVal[ 0 ] || [];\n this._splitVal[ this._splitVal.length - 1 ] = this._splitVal[ this._splitVal.length - 1 ] || [];\n\n this._splitVal[ 0 ][ 0 ] = this.getCurrentMin();\n this._splitVal[ this._splitVal.length - 1 ][ 1 ] = this.getCurrentMax();\n this.setChunkBoundaries( this._splitVal );\n }\n }\n\n draw() {\n\n if ( this.autoSpread ) {\n this._splitSpread();\n }\n\n let max = 0;\n let unit;\n let subAxis;\n let spanReference;\n\n if ( this._baseWidthIndex >= 0 && ( subAxis = this.getSubAxis( this._baseWidthIndex ) ) ) {\n spanReference = subAxis.getSpan();\n }\n\n subAxis = undefined;\n\n if ( this.fixGridFor >= 0 && ( subAxis = this.getSubAxis( this.fixGridFor ) ) ) {\n\n if ( subAxis._mean !== undefined ) {\n let width = ( subAxis.getSpan()[ 1 ] - subAxis.getSpan()[ 0 ] ) / ( spanReference[ 1 ] - spanReference[ 0 ] ) * this._baseWidthVal;\n subAxis.forceMin( subAxis._mean - width / 2 );\n subAxis.forceMax( subAxis._mean + width / 2 );\n }\n\n max = subAxis.draw();\n unit = subAxis.getPrimaryTickUnit();\n }\n\n this.axes.map( ( axis ) => {\n\n if ( subAxis === axis ) {\n return;\n }\n\n if ( axis._mean !== undefined ) {\n let width = ( axis.getSpan()[ 1 ] - axis.getSpan()[ 0 ] ) / ( spanReference[ 1 ] - spanReference[ 0 ] ) * this._baseWidthVal;\n axis.forceMin( axis._mean - width / 2 );\n axis.forceMax( axis._mean + width / 2 );\n }\n\n if ( unit ) {\n axis.forcePrimaryTickUnit( unit );\n }\n\n max = Math.max( max, axis.draw() );\n\n } );\n\n // this.drawLabel();\n this.writeUnit();\n\n return max;\n }\n\n setMinPx( min ) {\n\n super.setMinPx( min );\n for ( let axis of this.axes ) {\n axis.setMinPx( min );\n }\n }\n\n setMaxPx( max ) {\n\n super.setMaxPx( max );\n\n for ( let axis of this.axes ) {\n axis.setMaxPx( max );\n }\n }\n\n setShift() {\n\n super.setShift( ...arguments );\n\n for ( let axis of this.axes ) {\n axis.setShift( ...arguments );\n }\n }\n\n init() {\n super.init( ...arguments );\n this.splitAxis();\n }\n\n getAxisPosition() {\n var max = 0;\n\n this.axes.map( ( axis ) => {\n max = Math.max( max, axis.getAxisPosition() );\n } );\n\n return max;\n }\n\n getSubAxis( index ) {\n\n if ( this.axes.length <= index ) {\n throw 'Impossible to reach axis. Index ' + index + ' is out of range';\n }\n\n return this.axes[ index ];\n }\n\n get splitNumber() {\n return this._splits.length;\n }\n };\n\n delegateMethods.map( ( methodName ) => {\n\n cl.prototype[ methodName ] = ( function( method ) {\n\n return function() {\n //super[ method ]( ...arguments )\n\n this.axes.map( ( axis ) => {\n axis[ method ]( ...arguments );\n } );\n return this;\n };\n\n } )( methodName );\n } );\n\n return cl;\n};\n\nclass SplitXAxis extends SplitAxis( AxisX ) {\n\n constructor( graph, topbottom, options ) {\n super( ...arguments );\n this.topbottom = topbottom;\n }\n\n getConstructor() {\n return AxisX;\n }\n\n getAxisPosition() {\n var max = super.getAxisPosition( ...arguments );\n\n this.labelPosY = max;\n\n if ( this.getLabel() ) {\n max += this.graph.options.fontSize;\n }\n\n return max;\n }\n\n drawLabel() {\n super.drawLabel();\n this.label.setAttribute( 'y', ( this.top ? -1 : 1 ) * ( this.graph.options.fontSize + this.labelPosY ) );\n }\n\n draw() {\n var height = super.draw( ...arguments );\n this.drawLabel();\n return height;\n }\n\n}\n\nclass SplitYAxis extends SplitAxis( AxisY ) {\n\n constructor( graph, leftright, options ) {\n super( ...arguments );\n ///this.leftright = leftright;\n }\n\n getConstructor() {\n return AxisY;\n }\n /*\n draw() {\n\n if ( this.getLabel() ) {\n this.axes.map( ( axis ) => {\n axis.setAxisPosition( this.graph.options.fontSize );\n } ); // Extra shift allowed for the label\n //this.setShift( this.graph.options.fontSize );\n }\n return super.draw( ...arguments );\n }\n */\n drawLabel() {\n super.drawLabel();\n }\n\n equalizePosition( width ) {\n\n var widthAfter = width;\n\n if ( this.getLabel() ) {\n this.axes.map( ( axis ) => {\n widthAfter = Math.max( axis.equalizePosition( width ), widthAfter );\n } ); // Extra shift allowed for the label\n //this.setShift( this.graph.options.fontSize );\n }\n\n if ( this.getLabel() ) {\n this.placeLabel( this.left ? -widthAfter : widthAfter );\n return widthAfter + this.graph.options.fontSize;\n }\n }\n\n}\n\nutil.mix( SplitXAxis, new AxisX() );\nutil.mix( SplitYAxis, new AxisY() );\n\nexport default PluginAxisSplitting;","import * as util from '../graph.util.js';\nimport Plugin from './graph.plugin.js';\n\n/**\n * The intent of this plugin is to provide methods for the user to make the traces on the graph automatically different\n * Options to provide colorization, markers and line styles should be provided\n * @extends Plugin\n */\nclass PluginMakeTracesDifferent extends Plugin {\n\n constructor() {\n super( ...arguments );\n }\n\n init( graph, options ) {\n super.init( graph, options );\n }\n // Load this with defaults\n static\n default () {\n\n return {\n\n };\n }\n\n checkHSL( color ) {\n\n let result = {},\n hue, saturation, lightness;\n\n if ( ( hue = ( color.h || color.hue ) ) ) {\n\n if ( hue < 1 ) {\n hue = Math.round( hue * 360 );\n }\n\n result.hue = hue;\n } else {\n result.h = 0;\n }\n\n if ( ( saturation = ( color.s || color.saturation ) ) ) {\n\n if ( saturation > 1 ) {\n saturation /= 100;\n }\n\n result.saturation = saturation;\n } else {\n result.saturation = 0.75;\n }\n\n if ( ( lightness = ( color.lightness || color.l ) ) ) {\n\n if ( lightness > 1 ) {\n lightness /= 100;\n }\n\n result.lightness = lightness;\n } else {\n result.lightness = 0.5;\n }\n\n return result;\n }\n\n buildHSLString( hsl ) {\n return 'hsl( ' + Math.round( hsl.h ) + ', ' + Math.round( hsl.s * 100 ) + '%, ' + Math.round( hsl.l * 100 ) + '%)';\n }\n\n colorizeAll( options ) {\n\n let series,\n seriesLength;\n\n if ( options.serieTypes ) {\n\n if ( !Array.isArray( options.serieTypes ) ) {\n options.serieTypes = [ options.serieTypes ];\n }\n\n series = this.graph.allSeries( ...options.serieTypes );\n } else {\n series = this.graph.getSeries();\n }\n\n seriesLength = series.length;\n\n if ( !options.startingColorHSL ) {\n\n if ( options.colorHSL ) {\n options.startingColorHSL = this.checkHSL( options.colorHSL );\n } else {\n throw 'No starting color was provided. There must exist either options.colorHSL or options.startingColorHSL';\n }\n }\n\n if ( !options.endingColorHSL ) {\n\n if ( !options.affect || ![ 'h', 's', 'l', 'hue', 'saturation', 'lightness' ].include( options.affect ) ) {\n options.affect = 'h';\n }\n\n switch ( options.affect ) {\n\n case 'h':\n case 'hue':\n options.endingColorHSL = {\n h: options.startingColorHSL.h + 300,\n s: options.startingColorHSL.s,\n l: options.startingColorHSL.l\n };\n break;\n\n case 'saturation':\n case 's':\n let endS;\n\n if ( options.startingColorHSL.s > 0.5 ) {\n endS = 0;\n } else {\n endS = 1;\n }\n\n options.endingColorHSL = {\n h: options.startingColorHSL.h,\n s: endS,\n l: options.startingColorHSL.l\n };\n break;\n\n case 'lightness':\n case 'l':\n let endL;\n\n if ( options.startingColorHSL.l > 0.5 ) {\n endL = 0;\n } else {\n endL = 0.75;\n }\n\n options.endingColorHSL = {\n h: options.startingColorHSL.h,\n s: options.startingColorHSL.s,\n l: endL\n };\n break;\n }\n } else {\n options.endingColorHSL = Object.assign( {}, options.startingColorHSL, options.endingColorHSL );\n }\n\n return series.map( ( serie, index ) => {\n\n if ( !serie.setLineColor ) {\n throw 'The serie ' + serie.getName() + ' does not implement the method `startingColor`';\n }\n\n const colorString = this.buildHSLString( {\n h: options.startingColorHSL.h + index / ( seriesLength - 1 ) * ( options.endingColorHSL.h - options.startingColorHSL.h ),\n s: options.startingColorHSL.s + index / ( seriesLength - 1 ) * ( options.endingColorHSL.s - options.startingColorHSL.s ),\n l: options.startingColorHSL.l + index / ( seriesLength - 1 ) * ( options.endingColorHSL.l - options.startingColorHSL.l )\n } );\n\n serie.setLineColor( colorString );\n return colorString;\n } );\n }\n}\n\nexport default PluginMakeTracesDifferent;","import * as util from '../graph.util.js';\nimport Plugin from './graph.plugin.js';\n\n/*\n What is it ?\n It is a plugin for automatic peak detection on a line serie\n\n How to use ?\n Basic usage:\n\n let graph = new Graph(\"dom\", {\n plugins: {\n 'peakPicking': {}\n }\n }\n );\n\n let wv = Graph.newWaveform();\n wv.setData( [ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 ] );\n let s = graph.newSerie(\"serie\").setWaveform( wv ).autoAxis();\n\n graph.getPlugin('peakPicking').setSerie( s );\n graph.draw();\n*/\n\n/**\n * @extends Plugin\n */\nclass PluginPeakPicking extends Plugin {\n\n constructor() {\n super( ...arguments );\n }\n\n static\n default () {\n\n return {\n autoPeakPicking: false,\n autoPeakPickingNb: 4,\n autoPeakPickingMinDistance: 10,\n autoPeakPickingFormat: false,\n autoPeakPickingAllowAllY: false\n };\n }\n\n init( graph, options ) {\n\n super.init( graph, options );\n this.picks = [];\n\n for ( var n = 0, m = this.options.autoPeakPickingNb; n < m; n++ ) {\n\n var shape = this.graph.newShape( {\n type: 'label',\n label: {\n text: '',\n position: {\n x: 0\n },\n anchor: 'middle',\n\n },\n\n selectable: true,\n\n shapeOptions: {\n minPosY: 15\n }\n\n } );\n\n shape.draw();\n\n this.picks.push( shape );\n\n }\n\n }\n\n setSerie( serie ) {\n this.serie = serie;\n }\n\n serieRemoved( serie ) {\n\n if ( this.serie == serie ) {\n this.picks.map( ( pick ) => {\n pick.kill();\n } );\n }\n }\n\n preDraw() {\n\n if ( !this.serie ) {\n return;\n }\n\n this.detectedPeaks = [];\n this.lastYPeakPicking = false;\n }\n\n postDraw() {\n\n if ( !this.serie ) {\n return;\n }\n let lookForMaxima = true;\n let lookForMinima = false;\n let lastYPeakPicking;\n let peaks = [];\n\n let waveform = this.serie.getWaveform();\n\n if ( !waveform ) {\n throw 'The serie must have a waveform for the peak picking to work';\n }\n\n let length = waveform.getLength(),\n i = 0,\n y;\n\n for ( ; i < length; i++ ) {\n\n y = waveform.getY( i );\n\n if ( this.serie.options.lineToZero ) {\n peaks.push( [ waveform.getX( i ), y ] );\n continue;\n }\n\n if ( !lastYPeakPicking ) {\n lastYPeakPicking = [ waveform.getX( i ), y ];\n continue;\n }\n\n if ( ( y >= lastYPeakPicking[ 1 ] && lookForMaxima ) || ( y <= lastYPeakPicking[ 1 ] && lookForMinima ) ) {\n\n lastYPeakPicking = [ waveform.getX( i ), y ];\n\n } else if ( ( y < lastYPeakPicking[ 1 ] && lookForMaxima ) || ( y > lastYPeakPicking[ 1 ] && lookForMinima ) ) {\n\n if ( lookForMinima ) {\n lookForMinima = false;\n lookForMaxima = true;\n\n } else {\n\n lookForMinima = true;\n lookForMaxima = false;\n\n peaks.push( lastYPeakPicking );\n lastYPeakPicking = false;\n }\n\n lastYPeakPicking = [ waveform.getX( i ), y ];\n\n }\n }\n\n var ys = peaks;\n var x,\n px,\n passed = [],\n px,\n l = ys.length,\n k, m,\n index;\n\n i = 0;\n\n var selected = this.graph.selectedShapes.map( function( shape ) {\n return shape.getProp( 'xval' );\n } );\n\n ys.sort( function( a, b ) {\n return b[ 1 ] - a[ 1 ];\n } );\n\n m = 0;\n\n for ( ; i < l; i++ ) {\n\n x = ys[ i ][ 0 ];\n px = this.serie.getX( x );\n k = 0;\n y = this.serie.getY( ys[ i ][ 1 ] );\n\n if ( px < this.serie.getXAxis().getMinPx() || px > this.serie.getXAxis().getMaxPx() ) {\n continue;\n }\n\n if ( !this.options.autoPeakPickingAllowAllY && ( y > this.serie.getYAxis().getMinPx() || y < this.serie.getYAxis().getMaxPx() ) ) {\n\n continue;\n }\n\n // Distance check\n for ( ; k < passed.length; k++ ) {\n if ( Math.abs( passed[ k ] - px ) < this.options.autoPeakPickingMinDistance ) {\n break;\n }\n }\n if ( k < passed.length ) {\n continue;\n }\n\n // Distance check end\n\n // If the retained one has already been selected somewhere, continue;\n if ( ( index = selected.indexOf( x ) ) > -1 ) {\n passed.push( px );\n continue;\n }\n\n if ( !this.picks[ m ] ) {\n return;\n }\n\n //console.log( this.getYAxis().getDataMax(), this.getYAxis().getCurrentMin(), y );\n // this.picks[ m ].show();\n\n if ( this.serie.getYAxis().getPx( ys[ i ][ 1 ] ) - 20 < 0 ) {\n\n this.picks[ m ].setLabelPosition( {\n x: x,\n y: '5px',\n } );\n\n this.picks[ m ].setLabelBaseline( 'hanging' );\n\n } else {\n\n this.picks[ m ].setLabelBaseline( 'no-change' );\n\n this.picks[ m ].setLabelPosition( {\n x: x,\n y: ys[ i ][ 1 ],\n dy: '-15px'\n } );\n\n }\n\n this.picks[ m ].setProp( 'xval', x );\n\n if ( this.options.autoPeakPickingFormat ) {\n\n this.picks[ m ].setLabelText( this.options.autoPeakPickingFormat.call( this.picks[ m ], x, m ) );\n } else {\n this.picks[ m ].setLabelText( String( Math.round( x * 1000 ) / 1000 ) );\n }\n\n this.picks[ m ].makeLabels();\n\n m++;\n while ( this.picks[ m ] && this.picks[ m ].isSelected() ) {\n m++;\n }\n\n if ( passed.length == this.options.autoPeakPickingNb ) {\n break;\n }\n }\n }\n\n /**\n * Hides the automatic peak picking (see the autoPeakPicking option)\n * @memberof SerieLine\n */\n hidePeakPicking( lock ) {\n\n if ( !this._hidePeakPickingLocked ) {\n this._hidePeakPickingLocked = lock;\n }\n\n if ( !this.graph.picks ) {\n return;\n }\n for ( var i = 0; i < this.graph.picks.length; i++ ) {\n this.graph.picks[ i ].hide();\n }\n }\n\n /**\n * Shows the automatic peak picking (see the autoPeakPicking option)\n * @memberof SerieLine\n */\n showPeakPicking( unlock ) {\n\n if ( this._hidePeakPickingLocked && !unlock ) {\n return;\n }\n\n if ( !this.graph.picks ) {\n return;\n }\n\n for ( var i = 0; i < this.graph.picks.length; i++ ) {\n this.graph.picks[ i ].show();\n }\n }\n\n killPeakPicking() {\n\n if ( this.picks ) {\n for ( var i = 0, l = this.picks.length; i < l; i++ ) {\n this.picks[ i ].kill();\n }\n }\n }\n}\n\nexport default PluginPeakPicking;","import Graph from './graph.core.js';\nimport GraphPosition from './graph.position.js';\nimport GraphLegend from './graph.legend.js';\n\nimport AxisX from './graph.axis.x.js';\nimport AxisY from './graph.axis.y.js';\nimport AxisXBar from './graph.axis.x.bar.js';\nimport AxisXTime from './graph.axis.x.time.js';\n\nimport SerieLine from './series/graph.serie.line.js';\nimport SerieLine3D from './series/graph.serie.line.3d.js';\nimport SerieBar from './series/graph.serie.bar.js';\nimport SerieBox from './series/graph.serie.box.js';\nimport SerieLineColor from './series/graph.serie.line.colored.js';\nimport SerieScatter from './series/graph.serie.scatter.js';\nimport SerieZone from './series/graph.serie.zone.js';\nimport SerieZone3D from './series/graph.serie.zone.3d.js';\nimport SerieDensityMap from './series/graph.serie.densitymap.js';\nimport SerieContour from './series/graph.serie.contour.js';\n\nimport Shape from './shapes/graph.shape.js';\nimport ShapeAreaUnderCurve from './shapes/graph.shape.areaundercurve.js';\nimport ShapeArrow from './shapes/graph.shape.arrow.js';\nimport ShapeEllipse from './shapes/graph.shape.ellipse.js';\nimport ShapeLabel from './shapes/graph.shape.label.js';\nimport ShapePolyline from './shapes/graph.shape.polyline.js';\nimport ShapeLine from './shapes/graph.shape.line.js';\nimport ShapeNMRIntegral from './shapes/graph.shape.nmrintegral.js';\nimport ShapePeakIntegration2D from './shapes/graph.shape.peakintegration2d.js';\nimport ShapeRect from './shapes/graph.shape.rect.js';\nimport ShapeCross from './shapes/graph.shape.cross.js';\nimport ShapePeakBoundariesCenter from './shapes/graph.shape.peakboundariescenter.js';\nimport ShapeHTML from './shapes/graph.shape.html.js';\n\nimport GraphPlugin from './plugins/graph.plugin.js';\nimport GraphPluginDrag from './plugins/graph.plugin.drag.js';\nimport GraphPluginShape from './plugins/graph.plugin.shape.js';\nimport GraphPluginSelectScatter from './plugins/graph.plugin.selectScatter.js';\nimport GraphPluginZoom from './plugins/graph.plugin.zoom.js';\nimport GraphPluginTimeSerieManager from './plugins/graph.plugin.timeseriemanager.js';\nimport GraphPluginSerieLineDifference from './plugins/graph.plugin.serielinedifference.js';\nimport GraphPluginAxisSplitting from './plugins/graph.plugin.axissplitting.js';\nimport GraphPluginMakeTracesDifferent from './plugins/graph.plugin.makeTracesDifferent.js';\nimport GraphPluginPeakPicking from './plugins/graph.plugin.peakpicking.js';\n\nimport Waveform from './util/waveform.js';\nimport FitLM from './util/fit_lm.js';\n\n// Corrent naming is important here !\n\nGraph.registerConstructor( 'graph.position', GraphPosition );\n\nGraph.registerConstructor( 'graph.axis.x', AxisX );\nGraph.registerConstructor( 'graph.axis.y', AxisY );\nGraph.registerConstructor( 'graph.axis.x.bar', AxisXBar );\nGraph.registerConstructor( 'graph.axis.x.time', AxisXTime );\n\nGraph.registerConstructor( 'graph.serie.line', SerieLine );\nGraph.registerConstructor( 'graph.serie.line.3d', SerieLine3D );\nGraph.registerConstructor( 'graph.serie.line.color', SerieLineColor );\nGraph.registerConstructor( 'graph.serie.contour', SerieContour );\nGraph.registerConstructor( 'graph.serie.bar', SerieBar );\nGraph.registerConstructor( 'graph.serie.box', SerieBox );\nGraph.registerConstructor( 'graph.serie.scatter', SerieScatter );\nGraph.registerConstructor( 'graph.serie.zone', SerieZone );\nGraph.registerConstructor( 'graph.serie.zone.3d', SerieZone3D );\nGraph.registerConstructor( 'graph.serie.densitymap', SerieDensityMap );\n\nGraph.registerConstructor( Graph.SERIE_LINE, SerieLine );\nGraph.registerConstructor( Graph.SERIE_LINE_3D, SerieLine3D );\nGraph.registerConstructor( Graph.SERIE_LINE_COLORED, SerieLineColor );\nGraph.registerConstructor( Graph.SERIE_CONTOUR, SerieContour );\nGraph.registerConstructor( Graph.SERIE_BAR, SerieBar );\nGraph.registerConstructor( Graph.SERIE_BOX, SerieBox );\nGraph.registerConstructor( Graph.SERIE_SCATTER, SerieScatter );\nGraph.registerConstructor( Graph.SERIE_ZONE, SerieZone );\nGraph.registerConstructor( Graph.SERIE_ZONE_3D, SerieZone3D );\nGraph.registerConstructor( Graph.SERIE_DENSITYMAP, SerieDensityMap );\n\n//Graph.registerConstructor( \"graph.serie.line.broken\", GraphSerieLineBroken );\n\nGraph.registerConstructor( 'graph.plugin.shape', GraphPluginShape );\nGraph.registerConstructor( 'graph.plugin.drag', GraphPluginDrag );\nGraph.registerConstructor( 'graph.plugin.zoom', GraphPluginZoom );\nGraph.registerConstructor( 'graph.plugin.selectScatter', GraphPluginSelectScatter );\nGraph.registerConstructor( 'graph.plugin.timeSerieManager', GraphPluginTimeSerieManager );\nGraph.registerConstructor( 'graph.plugin.serielinedifference', GraphPluginSerieLineDifference );\nGraph.registerConstructor( 'graph.plugin.serieLineDifference', GraphPluginSerieLineDifference );\nGraph.registerConstructor( 'graph.plugin.axissplitting', GraphPluginAxisSplitting );\nGraph.registerConstructor( 'graph.plugin.makeTracesDifferent', GraphPluginMakeTracesDifferent );\nGraph.registerConstructor( 'graph.plugin.peakPicking', GraphPluginPeakPicking );\n\nGraph.registerConstructor( 'graph.shape', Shape );\nGraph.registerConstructor( 'graph.shape.areaundercurve', ShapeAreaUnderCurve );\nGraph.registerConstructor( 'graph.shape.arrow', ShapeArrow );\nGraph.registerConstructor( 'graph.shape.ellipse', ShapeEllipse );\nGraph.registerConstructor( 'graph.shape.label', ShapeLabel );\nGraph.registerConstructor( 'graph.shape.polyline', ShapePolyline );\nGraph.registerConstructor( 'graph.shape.line', ShapeLine );\nGraph.registerConstructor( 'graph.shape.nmrintegral', ShapeNMRIntegral );\nGraph.registerConstructor( 'graph.shape.html', ShapeHTML );\nGraph.registerConstructor( 'graph.shape.peakintegration2d', ShapePeakIntegration2D );\n// Graph.registerConstructor( \"graph.shape.peakinterval\", GraphShapePeakInterval );\n// Graph.registerConstructor( \"graph.shape.peakinterval2\", GraphShapePeakInterval2 );\n// Graph.registerConstructor( \"graph.shape.rangex\", GraphShapeRangeX );\nGraph.registerConstructor( 'graph.shape.rect', ShapeRect );\nGraph.registerConstructor( 'graph.shape.rectangle', ShapeRect );\nGraph.registerConstructor( 'graph.shape.cross', ShapeCross );\n//Graph.registerConstructor( \"graph.shape.zoom2d\", GraphShapeZoom2D );\nGraph.registerConstructor( 'graph.shape.peakboundariescenter', ShapePeakBoundariesCenter );\n\n// Graph.registerConstructor( \"graph.toolbar\", GraphToolbar );\nGraph.registerConstructor( 'graph.legend', GraphLegend );\nGraph.registerConstructor( 'graph.waveform', Waveform );\n\nexport default Graph;"],"names":["_parsePx","px","indexOf","parseInt","replace","isNumeric","n","isNaN","parseFloat","isFinite","Position","x","y","dx","dy","graph","xAxis","yAxis","serie","hasXAxis","hasYAxis","throw","_compute","relativeTo","_relativeTo","relativeToComputed","parsed","pos","getXAxis","getYAxis","i","axis","val","dval","undefined","warn","closest","searchClosestValue","getName","getY","yMin","getPx","def","_parsePercent","_getPositionPx","getRelPx","value","getDrawingWidth","getDrawingHeight","getPos","percent","v","mode","delta","ref","refd","refPx","deltaPx","getValPosition","getRelVal","rel","getMaxValue","getMinValue","getMinPx","getMaxPx","check","callback","posObject","position","setAttributeTo","to","params","ns","setAttributeNS","setAttribute","mapEventEmission","options","source","eventName","substring","toLowerCase","on","j","apply","arguments","guid","c","r","Math","random","toString","throwError","message","error","obj","Array","isArray","hue2rgb","p","q","t","hslToRgb","h","s","l","g","b","round","saveDomAttributes","attributes","identification","_savedAttributesIds","_savedAttributes","_attributes","push","getAttribute","hasSavedAttribute","dom","attr","overwriteDomAttribute","attribute","newValue","restoreDomAttributes","splice","attrs","length","debounce","func","wait","immediate","timeout","context","args","later","callNow","setTimeout","SVGParser","svgString","parser","DOMParser","doc","parseFromString","getOffset","el","rect","getBoundingClientRect","top","left","setCSS","element","values","style","ajaxGet","Promise","resolve","reject","request","XMLHttpRequest","open","type","url","json","setRequestHeader","onload","status","response","responseText","JSON","parse","Error","onerror","send","hasOwn","Object","prototype","hasOwnProperty","toStr","arr","call","isPlainObject","hasOwnConstructor","hasIsPrototypeOf","constructor","key","extend","name","src","copy","copyIsArray","clone","target","deep","mix","baseClass","mixin","prop","emptyDom","firstChild","removeChild","EventEmitter","proto","indexOfListener","listeners","listener","alias","aliasClosure","getListeners","evt","events","_getEvents","RegExp","test","flattenListeners","flatListeners","getListenersAsObject","addListener","listenerIsWrapped","addOnceListener","once","defineEvent","defineEvents","evts","removeListener","index","off","addListeners","manipulateListeners","removeListeners","remove","single","multiple","removeEvent","_events","removeAllListeners","emitEvent","_getOnceReturnValue","trigger","emit","slice","setOnceReturnValue","_onceReturnValue","FitHost","DELTAP","BIGVAL","WEIGHT","setYData","dataY","setXData","dataX","setWeight","weight","setInitialParams","subsetIndex","setSubset","setFunction","function","progress","hookIteration","data","parms","map","NPARMS","fromIndex","toIndex","_from","_to","f","_hookIteration","buildFit","_func","NPTS","getLength","arrY","getDataY","arrX","getDataX","resid","fill","jac","log","join","LM","_result","done","param","sumsq","dp","computeResiduals","FACTOR","d","k","nudge","getResidualElement","xmin","getMin","xmax","getMax","fit","waveformResult","waveform","setData","gH","gnadj","gnpnts","hook","LMITER","LMBOOST","LMSHRINK","LAMBDAZERO","LAMBDAMAX","LMTOL","sos","sosprev","lambda","myH","nadj","npts","beta","alpha","amatrix","niter","bLMiter","buildJacobian","getJacobianElement","rrise","gaussj","a","N","det","big","save","L","ik","jk","abs","Waveform","xOffset","xScale","forEach","setXWaveform","newData","_makeArray","warnNaN","nanable","isNaNAllowed","_setData","optimized","dataInUse","getScale","getShift","xdata","computeXMinMax","wave","append","getX","offset","scale","_typedArrayClass","getTypedArrayClass","isUnsigned","from","hasXWaveform","getXWaveform","setTypedArrayClass","Float32Array","Float64Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","minX","maxX","minY","maxY","prepend","unshift","recalculateMinMaxNewPoint","monotoneous","getMonotoneousAscending","_monotoneousAscending","monoDir","_monotoneous","min","max","b1","b2","useDataToUse","roundingMethod","getIndexFromData","dataInUseType","xval","getData","valCollection","isAscending","isMonotoneous","trace","binarySearch","getXScale","getXShift","shift","setShift","setScale","self","resolver","rejector","FitLM","results","init","temp","sum","deltaTot","diff","_integrateP","fromX","toX","integrateP","getIndexFromX","p0","p1","getAverageP","average","_integrateX","dir","requireMonotonicity","reverse","requireXMonotonicity","inverting","dataMinMax","resampleSum","resampleMin","resampleMax","resampleNum","resample_x_start","resample_x_px_start","x_px","doing_mean","firstPointIndex","xPosition","resampleToPx","xpos","yData","xIndex","xData","xIndexF","floor","indexStart","getXMonotoneousAscending","numberOrWave","_arithmetic","DIVIDE","divide","MULTIPLY","multiply","logBase","E","base","valY","ADD","add","SUBTRACT","subtract","method","operator","_waveArithmetic","_numberArithmetic","num","operation","yDataThis","interpolate","direction","_dataAggregating","_dataAggregated","_dataAggregationDirection","toUpperCase","pow2","pow2floor","aggregator","then","event","aggregates","pxWidth","level","pow2ceil","alsoDuplicateXWave","newWaveform","rescaleX","xShift","duplicate","setXShift","setXScale","fromP","toP","xRef","xWithin","indexPlus","indexMinus","findLocalMinMaxIndex","tmp","curr","currI","Number","NEGATIVE_INFINITY","POSITIVE_INFINITY","text","console","unit","setUnit","xunit","getUnit","getXUnit","lastLvlIndex","rangeP","lvlIndex","indices","findLevel","ceil","rangeX","below","increment","box","edge","rounding","getIndexInterpolate","factor","total","minValue","maxValue","ratio","Symbol","valueBefore","valueAfter","indexBefore","indexAfter","haystack","seedA","seedB","seedInt","nanDirection","GraphOptionsDefault","defaultScatterStyle","_constructors","Map","Graph","wrapper","_creation","util","_drawn","HTMLElement","document","getElementById","bind","setWrapper","prevented","shapes","shapesLocked","plugins","pluginAction","plugin","mouseActions","selectedShapes","series","_axesHaveChanged","padding","paddingTop","paddingBottom","paddingLeft","paddingRight","currentAction","nsxlink","getTopAxis","getLeftAxis","getRightAxis","getBottomAxis","_pluginsInit","appendChild","outline","height","width","wrapperStyle","getComputedStyle","w","setSize","_resize","title","domTitle","textContent","display","onlyIfAxesHaveChanged","force","sizeSet","executeRedrawSlaves","haveAxesChanged","hasSizeChanged","_pluginsExecute","drawn","updateLegend","drawSeries","redraw","_lockUpdate","legend","update","draw","skipResize","setWidth","setHeight","useCache","innerHeight","innerWidth","offsetCached","bottom","right","_getAxis","setBottomAxis","setLeftAxis","kill","noRedraw","noSerieKill","isX","isY","axisGroup","group","groupPrimaryGrids","gridPrimary","groupSecondaryGrids","gridSecondary","hasTopAxis","hasBottomAxis","hasLeftAxis","hasRightAxis","hasAxis","axisList","_applyToAxes","autoscaleAxes","setMinMaxToFitSeries","color","rectEvent","state","getCurrentMin","getCurrentMax","setCurrentMin","setCurrentMax","savedName","savedAxisState","getAxisState","recallAxisState","minmax","usingZValues","valSeries","getBoundaryAxisFromSeries","func2use","infinity2use","Infinity","serieValue","getSeriesFromAxis","isShown","axisvars","getBoundaryAxis","setMaxValueData","setMinValueData","tb","lr","ax","_applyToAxis","axes","linkedToAxis","getConstructor","SERIE_LINE","getSerie","makeSerie","types","filter","include","getType","drawSerie","removeSeries","resetSeries","selectName","selectedSerie","selectionType","unselectSerie","triggerEvent","select","unselect","toolbarData","toolbar","shapeType","shapeData","mute","shapeProperties","prevent","_id","shape","_data","properties","setProperties","props","setProp","setPosition","GraphPosition","fillColor","setFillColor","fillOpacity","setFillOpacity","strokeColor","setStrokeColor","strokeWidth","setStrokeWidth","layer","setLayer","locked","lock","movable","selectable","resizable","handles","selectOnMouseDown","selectOnClick","transforms","addTransform","highlightOnMouseOver","labelEditable","labels","label","showLabel","setLabelText","setLabelPosition","setLabelColor","setLabelSize","size","setLabelAngle","angle","setLabelBaseline","baseline","setLabelAnchor","anchor","setLabelBackgroundColor","backgroundColor","setLabelBackgroundOpacity","backgroundOpacity","setSerie","createHandles","applyStyle","varArgs","isSelectable","shapesUniqueSelection","unselectShapes","_select","cancelUnselectShape","_unselect","unselectShape","isHTML","insertBefore","_dom","getLayer","groupMain","layers","createElementNS","prevLayer","plotGroup","nextSibling","focus","movingElement","bypassHandleMouse","closingLines","els","line","closeColor","graphingZone","e","action","enabled","keyCode","keyCheck","ctrl","meta","alt","shiftKey","ctrlKey","metaKey","altKey","forcedPlugin","funcName","which","activePlugin","pluginName","pluginOptions","onlyIfRequired","requireDelayedUpdate","zAxis","groupGrids","refAxisX","refAxisY","x0","y0","getZProj","maxZ","updateDataMinMaxAxes","sort","getZPos","sa","sb","appendSerieToDom","menuElements","onContextMenuListen","moving","resizing","arg","clientX","clientY","_sizeChanged","requireLegendUpdate","drawingSpaceWidth","drawingSpaceHeight","drawingSpaceMinX","drawingSpaceMinY","drawingSpaceMaxX","drawingSpaceMaxY","trackingLine","enable","sOptions","addSerieToTrackingLine","disableTracking","noLine","trackingObject","newShape","trackingLineShapeOptions","serieO","assign","enableTracking","show","getPosition","trueX","_trackingLegend","_trackingLegendSerie","textMethod","output","valueToHtml","yValue","hide","trackingShape","renderer","_katexRenderer","katexValue","katexElement","div","createElement","fromJSON","schema","schemaAxis","axisOptions","labelValue","unitWrapperAfter","unitWrapperBefore","forcedMin","forcedMax","flip","flipped","_jsGraphIndex","schemaSerie","serieType","serieOptions","serieAxis","SERIE_LINE_COLORED","SERIE_SCATTER","SERIE_BOX","orientation","newSerie","id","lineStyle","entries","styleName","styleSerie","lineWidth","lineColor","setStyle","defaultStyle","defaultStyles","styles","individualStyles","styleNames","Set","keys","concat","eachStyleElement","zoom","points","setMarkers","setColors","errorBarsXAbove","errorBarsXBelow","errorBarsYAbove","errorBarsYBelow","errorBoxesXAbove","errorBoxesXBelow","errorBoxesYAbove","errorBoxesYBelow","errorX","errorBarX","errorBoxX","errorY","errorBarY","errorBoxY","setErrorBarXAbove","setErrorBarStyle","setErrorBoxXAbove","setErrorBoxXBelow","setErrorBoxAbove","setErrorBoxBelow","setErrorBoxStyle","setXAxis","setYAxis","autoAxis","boxes","setWaveform","getWidth","getHeight","axesPositions","axesExport","allaxes","axisPosition","seriesExport","toType","SERIE_BAR","exportData","isFlipped","linestyle","stylename","styleObj","markers","getLabel","registerConstructor","constructorName","has","set","softFail","get","getAxisLevelFromSpan","span","possible","m","refreshDrawingZone","levels","_painted","hideGroup","showGroup","floating","getSpan","setLevel","getAxisPosition","shiftTop","reduce","prev","shiftBottom","current","getLevel","setMinPx","setMaxPx","shift2","equalizePosition","shiftLeft","shiftRight","floatingAxis","getFloatingAxis","floatingValue","getFloatingValue","floatingPx","clipRect","getPaddingTop","getPaddingLeft","drawLines","redrawShapes","_handleKey","_pluginExecute","checkKeyActions","parameters","methodName","keyComb","keyActions","isActionAllowed","preventDefault","stopPropagation","removeSelectedShape","keepInDom","doDom","fontFamily","fontSize","defs","groupEvent","setTitle","updateGraphingZone","_makeClosingLines","clip","markerArrow","pathArrow","markerHorizontalSplit","getId","path","markerVerticalSplit","vertLineArrow","pathVertLine","_registerEvents","addEventListener","coords","_getXY","deltaY","wheelDeltaY","wheelDelta","_handleMouseDown","_handleMouseMove","handleMouseMove","snapToSerie","xClosest","getSeries","onMouseMoveData","checkMouseActions","executed","_serieExecute","xValue","justCreated","_makeTrackingLegend","withinPx","withinVal","getVal","yClosest","serieShape","getLineWidth","getLineColor","forceParentDom","onCreated","onChanged","magnet","magnetOptions","within","minmaxpos","findLocalMinMax","txt","innerHTML","forceTrackingLegendMode","toY","skip","start","Date","now","offsetHeight","startX","marginLeft","startY","marginTop","offsetWidth","next","requestAnimationFrame","_trackingLegendMove","borderRadius","boxShadow","border","pointerEvents","getWrapper","getDom","_handleDblClick","pref","dblclick","_handleMouseUp","handleMouseUp","_handleClick","jsGraphIsShape","shapesUnselectOnClick","inst","_availableAxes","axisInstance","time","bar","broken","_closeLine","x1","x2","y1","y2","close","isDisplayed","_handleMouseWheel","coordX","coordY","_handleMouseLeave","handleMouseLeave","SERIE_CONTOUR","SERIE_ZONE","SERIE_DENSITYMAP","SERIE_LINE_3D","SERIE_ZONE_3D","TICKS_OUTSIDE","TICKS_INSIDE","TICKS_CENTERED","legendDefaults","Legend","svg","subG","groups","rectBottom","setEvents","eyeId","eyeCrossedId","eyeClosed","eye","adoptNode","documentElement","alignToX","alignToY","bln","autoPosition","setAutoPosition","posX","posY","excludedFromLegend","bbox","getBBox","cursor","poscoords","compute","getPaddingRight","transformX","transformY","_setPosition","isDelayedUpdate","_requiredUpdate","hasChildNodes","lastChild","fullWidth","getSymbolForLegend","marker","getMarkerForLegend","getTextForLegend","isHideable","eyeUse","hideShapesOnHideSerie","isSelected","selectSerie","buildLegendBox","calculatePosition","isSerieHideable","seriesHideable","hideable","isSerieSelectable","shapesToggleable","mousedown","elementMoving","mousemove","deltaX","frame","frameColor","frameWidth","frameRounding","svgElement","defaults","Axis","overwriteoptions","unitModificationTimeTicks","hasChanged","_lines","groupTicks","groupTickLabels","labelTspan","preunit","unitTspan","expTspan","expTspanExp","setTickPosition","tickPosition","gridLinePath","setGridLinesStyle","groupSeries","widthHeightTick","ticks","ticksLabels","tickScaling","currentTick","lastCurrentTick","totalDelta","handleMouseMoveLocal","addLabel","_axisHasChanged","bool","hideWhenNoSeriesShown","accumulator","_hidden","killAxis","atValues","lineAt","thisValue","foreignValue","preference","adaptTo","adapt","foreign","currentAxisMin","currentAxisMax","_zoomed","axisDataSpacing","getInterval","use","val1","val2","setAxisDataSpacing","minPx","setMinMaxFlipped","maxPx","minPxFlipped","maxPxFlipped","dataMin","dataMax","noRescale","nbTicksPrimary","nb","nbTicksSecondary","mouseVal","_doZoomVal","zoomLock","_zoomLocked","forceLock","_doZoom","px1","px2","cacheCurrentMin","cacheCurrentMax","cacheInterval","_hasChanged","_serieShift","_serieScale","nbTick","valrange","pxPerTick","nbTicks","unitPerTick","unitModification","breaked","decimals","numberToNatural","pow","possibleTicks","unitPerTickCorrect","noNotify","interval","logScale","getForcedMin","getForcedMax","cache","cachedInterval","cachedCurrentMin","cachedCurrentMax","widthPx","getCurrentInterval","scientificScale","scientificScaleExponent","scientificExponent","primary","secondary","letter","useKatexForLabel","hasKatexRenderer","unitDecade","getEngineeringExponent","getExponentGreekLetter","engineeringScale","writeUnit","string","preunitTspan","renderWithKatex","hideTicks","resetTicksLength","widthHeight","drawLinkedToAxisTicksWrapper","drawLinearTicksWrapper","drawLogTicks","removeUselessTicks","removeUselessTickLabels","findAxesLinkedTo","_drawLine","_hideLine","tickPrimaryUnit","primaryTickUnit","getUnitPerTick","getNbTicksPrimary","maxPrimaryTickUnit","minPrimaryTickUnit","drawTicks","secondaryTicks","primaryInterval","incrTick","tickRatio","ticklabelratio","_widthLabels","_draw","secondaryIncr","subIncrTick","loop","shiftToZero","loop2","drawTickWrapper","getMaxSizeTick","tick","lastCurrentTickLabel","currentTickLabel","tickLabel","primaryGrid","secondaryGrid","gridLine","getPrimaryGridColor","getSecondaryGridColor","getPrimaryGridWidth","getSecondaryGridWidth","getPrimaryGridOpacity","getSecondaryGridOpacity","dasharray","getPrimaryGridDasharray","getSecondaryGridDasharray","setGridLineStyle","incr","optsMain","drawTick","scalingFunction","opts","delta2","String","exp","toFixed","getExponentialFactor","getExponentialLabelFactor","modifyUnit","dec","unitInTicks","noScaling","noUnits","valueToText","umin","getModifiedValue","units","valueRounded","exponentialFactor","exponentialLabelFactor","font","labelFont","_level","tickPx1","tickPx2","setPrimaryGrid","setSecondaryGrid","setGrids","gridsOff","gridsOn","axisColor","offsetValue","tickLabelOffset","primaryTicksColor","secondaryTicksColor","ticksLabelColor","primaryGridColor","secondaryGridColor","primaryGridWidth","secondaryGridWidth","opacity","primaryGridOpacity","secondaryGridOpacity","primaryGridDasharray","secondaryGridDasharray","labelColor","overwrite","exponential","tspan","before","after","engineeringScaling","getValue","getDeltaPx","AxisX","topbottom","forcedPos","nextTick","getPrimaryTicksColor","getSecondaryTicksColor","nextGridLine","nextTickLabel","getTicksLabelColor","dominantBaseline","setTickContent","getLabelColor","tickWidth","drawSpecifics","drawLabel","getAxisColor","splitMarks","marginMax","marginMin","zValue","shiftX","AxisY","leftright","shiftPosition","tickMargin","longestTick","getComputedTextLength","getAdditionalWidth","fullwidthlabel","placeLabel","xshift","isLeft","excludeSerie","end","maxV","minV","shiftY","AxisXBar","categories","_barCategories","elements","forceMin","forceMax","setSeries","setCategoryConfig","_getUsedCategories","usedCategories","getUsedCategories","cat","dispatchedCategories","scategories","setDataIndices","axisFormat","dateFormat","token","timezone","timezoneClip","pad","len","getWeek","onejan","date","mask","utc","dF","SyntaxError","masks","default","_","D","H","M","o","getTimezoneOffset","flags","i18n","dayNames","monthNames","match","pop","$0","getClosestIncrement","basis","roundDate","format","setSeconds","getSeconds","setMilliseconds","setMinutes","getMinutes","setHours","getHours","setDate","getDate","setMonth","getMonth","incrementDate","setFullYear","getFullYear","getGroup","number","line1","line2","cloneNode","hideGroups","getDateText","renderGroup","x1B","x2B","substr","GraphTimeAxis","widthTime","timePerPx","maxVal","minVal","currentFormat","threshold","xVal1","xVal2","dateFirst","currentDate","increments","getTime","Serie","redrawShapesAfterDraw","getShapesOfSerie","oneDimensional","howmany","noLegendUpdate","removeSerieFromDom","_removeSerie","hideShapes","hidden","hideImpl","doesHideWhenNoSeriesShown","showShapes","showImpl","selected","xaxis","yaxis","getXMin","getXMax","dataHasChanged","lineForLegend","applyLineStyle","setLegendSymbolStyle","textForLegend","layerIndex","newLayer","styleHasChanged","_changedStyles","_dataHasChanged","infos","additionalData","hoverCallback","outCallback","_tracker","_trackingCallback","_trackingOutCallback","_trackerDom","_type","_excludedFromLegend","categoryIndices","nbCategories","hasErrorBars","ErrorBarMixin","origin","errorstyle","errorbarStyle","_setErrorStyle","errorboxStyle","errorstyles","pairs","makePath","strokeOpacity","all","paths","xpx","ypx","getErrorBarXBelow","makeBarX","getErrorBarXAbove","getErrorBarYBelow","makeBarY","getErrorBarYAbove","getErrorBoxXBelow","makeBoxX","getErrorBoxXAbove","getErrorBoxYBelow","makeBoxY","getErrorBoxYAbove","doErrorDraw","SerieLine","markerFamilies","unselected","extendStyles","markersDom","shown","_isMinOrMax","groupLines","domMarker","markerLabel","markerLabelSquare","domMarkerHover","domMarkerSelect","markerHovered","groupMarkerSelected","markerPoints","lines","groupMarkers","independantMarkers","initExtended1","selectableOnClick","applyLineStyles","toggledOn","toggleMarker","onMouseOverMarker","markersOffHover","onMouseOutMarker","hover","_on","setMarkerStyleTo","getMarkerCurrentFamily","getMarkerPath","split","onSelectMarker","onUnselectMarker","onToggleMarker","searchIndexByPxXY","areMarkersShown","pxPerP","degradationPx","axisCheck","currentLineId","counter","currentLine","resampleForDisplay","_dataToUse","getDataToUseFlat","hasAggregation","numberOfPointsInTotal","getDataMax","getDataMin","promise","selectAggregatedData","_xDataToUse","_afterLinesGroup","hasDataChanged","drawInit","slotToUse","_slotToUse","removeLinesGroup","eraseMarkers","lookForMaxima","lookForMinima","markerFamily","pos0","hasErrors","errorDrawInit","errorDraw","removeExtraLines","insertMarkers","insertLinesGroup","hasStyleChanged","updateStyle","afterDraw","lastX","lastY","xpx2","ypx2","xMin","xMax","yMax","yLeftCrossingRatio","yLeftCrossing","yRightCrossingRatio","yRightCrossing","xTopCrossingRatio","xTopCrossing","xBottomCrossingRatio","xBottomCrossing","yscale","pointOutside","lastPointOutside","pointOnAxis","_markersShown","markersShown","isXMonotoneous","isXMonotoneousAscending","yshift","_createLine","overflowX","overflowY","lineToZero","counter2","_addPoint","cloned","children","ret","family","z","markerCurrentFamily","getMarkerDom","move","allowMarker","errorAddPoint","getLineDashArray","removeAttribute","_getMarkerIndexFromEvent","onClickOnMarker","oldDist","xyindex","dist","p_x","p_y","valX","indexX","getIndexFromXY","returnObj","doMarker","getMouseVal","intY","trackMouse","getFlip","trackMouseLabel","trackMouseLabelRouding","xExact","indexClosest","start2","end2","v1","v2","initJ","maxJ","dataIndex","xBeforeIndexArr","applyToSelected","setLineStyle","getStyle","styleTarget","styleOrigin","_recalculateMarkerPoints","setLineWidth","setLineColor","showMarkers","families","_extendMarkers","recalculatePoints","markerPath","markersIndependant","currentMarkersSelectionType","markerForLegend","parentNode","xmonotoneous","drawMarkerXY","markerDom","getMarkerDomIndependent","Serie3DMixin","zpos","useZValues","getZCorrectedValue","valFinal","wf","getWaveforms","SerieLine3D","zPos","setZPos","SerieBar","pathDom","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","_checkY","getFillColor","getFillOpacity","errorAddPointBarChart","SerieBox","axisref","axisval","methodref","methodval","blnX","_checkX","Q2","Q3","Q1","whiskers","outliers","styleValue","_set","_style","_gstyle","axis2","boxOtherDimension","mean","boxAbove","boxBelow","barAbove","barBelow","maxBoxWidth","_linkedToScatterSeries","scatter_serie","lineMean","applyMeanStyle","rectAbove","rectBelow","boxPos","applyBoxStyle","whiskerAbove","whiskerBelow","outliervalue","outlier","setOutlierStyle","applyWhiskerStyle","above","getBoxAboveLineColor","getBoxAboveLineWidth","getBoxAboveFillColor","getBoxAboveFillOpacity","getBoxBelowLineColor","getBoxBelowLineWidth","getBoxBelowFillColor","getBoxBelowFillOpacity","getBarAboveLineColor","getBarAboveLineWidth","getBarBelowLineColor","getBarBelowLineWidth","getMeanLineColor","getMeanLineWidth","getOutlierLineColor","getOutlierLineWidth","getOutlierFillColor","getOutlierFillOpacity","extremity","xymode","scatter_serie_cat","SerieLineColor","colors","toBreak","eraseLines","latchLines","xpxbefore","ypxbefore","xbefore","ybefore","_rgb","object","SerieScatter","shapesDetails","groupPoints","selectedStyleGeneral","selectedStyleModifiers","parentElement","MAX_VALUE","MIN_VALUE","dataCategory","getMaxY","getMinY","symbol","doShape","modifiers","isCategory","extraStyle","stdStylePerso","stdStyle","selection","noSetPosition","modifier","styleAll","selectPoint","setOn","selectPoints","selectionStyle","allStyles","SerieZone","groupZones","lineZone","clipId","waveforms","buffer","xminpx","xmaxpx","yminpx","ymaxpx","ymin","ymax","getLineOpacity","lineOpacity","SerieZone3D","SerieDensityMap","rects","recalculateBinsOnDraw","numX","fromY","numY","densitymap","indexY","binMin","binMax","maxIndexX","maxIndexY","compX","compY","exactX","exactY","indexXLow","indexXHigh","indexYLow","indexYHigh","calculateDensity","pxPerBinX","pxPerBinY","weightedDensityMap","calculationDensityMap","densityMapCalculation","calculateDensityAdvanced","widthValues","axisGetter","weighing","weighted","pxPerBin","dimension","numBins","densityMapCalculate","calculateDensityWeighted","colorMapMin","colorMapMax","callbackColorMapMinMax","colorStops","numColors","methods","colorMap","opacities","first","slices","colorMapNum","colorMapHSV","binValue","colorIndex","autoColorMapBinBoundaries","setColorMapBinBoundaries","deltaXPx","deltaYPx","getColorIndex","drawRects","SerieContour","negativeDelta","positiveDelta","negativeThreshold","positiveThreshold","datas","segments","_addData","domLine","minZ","zValues","incrXFlip","incrYFlip","setColorTo","onMouseWheel","fixed","positive","hasNegative","_shapeZoom","hideHandleNeg","setHandleNeg","showHandleNeg","setHandlePos","lineColors","hsl","fromPositive","toPositive","fromNegative","toNegative","rgb","overwriteValue","Shape","_selected","createDom","classes","masker","maskPath","maskingId","maskDomWrapper","maskDom","handleMouseOver","handleMouseOut","handleMouseDown","handleClick","handleDblClick","initImpl","keepDom","_inDom","removeShapeFromDom","_removeShape","stopElementMoving","className","makeClasses","autoAxes","getProp","preventRedraw","appendToDom","makeLabels","applyPosition","redrawImpl","updateLabels","_applyTransforms","getRelativePosition","relativePosition","result","exec","getLabelPosition","noForce","overwriteSavedProp","applySelectedStyle","attributeName","attributeValue","added","addProp","resetProp","setDom","getProps","applyGenericStyle","sortFunction","transformString","transform","computePosition","setDomGroup","_labels","_labelsBackground","bg","labelDblClickListener","labelIndex","_applyLabelData","visible","currAngle","labelData","_getLabelAnchor","_selectStatus","setter","isLocked","handlesInDom","hideHandles","hasHandles","hasStaticHandles","addHandles","setHandles","getSelectStyle","style2","selectStyle","staticHandles","callbackEach","handle","isResizable","handleSelected","isMovable","selectShape","moved","_mouseCoords","handleMouseDownImpl","preventUnselect","handleMouseMoveImpl","resize","handleMouseUpImpl","highlight","unHighlight","saveDomName","getHighlightAttributes","highlightImpl","unHighlightImpl","_highlightAttributes","maskingShape","getMaskingID","position2","_getPosition","isLabelEditable","shapeLabel","previousValue","getLabelText","blurEvent","nextValue","removeEventListener","changed","_forcedParentDom","appendShapeToDom","displayLabel","ShapeSurfaceUnderCurve","_createHandles","deltaPosition","resizingPosition","posXY","posXY2","v3","firstX","firstY","xBeforeIndex","ShapeLine","GraphShape","getStrokeColor","getStrokeWidth","currentPos2x","currentPos2y","currentPos1x","currentPos1y","pos2","posToChange","vertical","horizontal","noX","noY","forcedCoords","forced","setEventReceptacle","areHandlesInDom","ShapeArrow","nbHandles","ShapeEllipse","posR","newPosition","posComputed","rx","ry","triggerChange","ShapeLabel","ShapePolyline","pxPoints","ShapeNMRIntegral","_domShadow","xVal","yVal","getAxis","baseLine","pos1","hideLabel","getWaveform","index1","index2","index3","getReductionType","firstXVal","firstYVal","lastXVal","lastYVal","getDataInUse","condition","incrementation","_sumVal","integrate","sumVal","py","lastPointX","lastPointY","_sum","firstPointX","firstPointY","ratioLabel","updateIntegralValue","handleCondition","xor","forceValue","toPrecision","_ratio","ShapeRectangle","sides","currentX","currentY","currentW","currentH","updateMask","invX","invY","pos2X","pos2Y","_staticHandles","ShapePeakIntegration2D","ShapeRect","setBindableToDom","ShapeCross","getFromData","ShapePeakBoundaries","lineHeight","line3","rectBoundary","redrawLines","posLeft","posRight","posCenter","posYPx","redrawY","lineHeihgt","ShapeHTML","content","_renderer","currentPosX","currentPosY","Plugin","PluginDrag","totaltime","_draggingX","_draggingY","_lastDraggingX","_lastDraggingY","stopAnimation","dragX","dragY","dt","speedX","speedY","_pluginDragMin","_pluginDragMax","accelerationX","accelerationY","persistanceX","persistanceY","_persistanceMove","PluginShape","shapeInfo","count","currentShape","currentShapeEvent","onCreate","PluginSelectScatter","_path","xs","ys","findPoints","j2","unselectPoint","PluginZoom","_zoomingGroup","_zoomingSquare","zoomMode","_zoomingMode","_backedUpZoomMode","_zoomingXStart","_zoomingYStart","forcedY","onZoomStart","onZoomMove","removeZone","_x","_y","transition","smooth","modeX","modeY","fullX","toAxes","_pluginZoomMin","_pluginZoomMax","_pluginZoomMinFinal","_pluginZoomMaxFinal","fullY","pluginYieldActiveState","doX","doY","xActual","diffX","yActual","diffY","onZoom","maxTime","gradualUnzoomStart","sin","PI","getSelectedSerie","memory","memoryHead","getFromMemory","store","head","PluginTimeSerieManager","currentSlots","requestLevels","noRecalculate","updateSerie","recalculateSeries","create","LRUName","requestsRunning","intervals","serieName","dbElements","noZoneSerie","_zoneSerie","setInfo","optimalInterval","getOptimalInterval","optimalIntervalIndex","cleanRegister","startSlotId","computeSlotID","endSlotId","intervalMultipliers","multiplier","firstSlotId","lastSlotId","slotId","computeTimeMin","register","processRequests","levelArray","levelElement","levelIndex","priority","noProcess","computeUniqueID","LRU","computeTimeMax","slotName","getInfo","maxParallelRequests","currentLevelChecking","requestToMake","getURL","nbPoints","requestElements","totalspan","optimalPxPerPoint","optimalIntervalAmongAvailable","newDiff","extra","info","setLineOpacity","recalculateSerie","lruData","recalculateSerieUpwards","setInterval","downSlotId","downInterval","nextInterval","newSlotTime","computeSlotTime","newSlotTimeEnd","newSlotId","PluginSerieLineDifference","pathsPositive","pathsNegative","positivePolyline","positiveStyle","negativePolyline","negativeStyle","serieTop","serieBottom","serie1","serie2","s1","getFrom","i1","j1","i2","crossing","bottomBroken","xAfterIndex","s2","order","nextSet","ended","getTo","computeCrossing","makePaths","setPointsPx","x11","y11","x12","y12","x21","y21","x22","y22","a1","a2","SerieLineExtended","subSeries","sub","SerieScatterExtended","excludingMethods","addMethods","getOwnPropertyNames","subSerie","PluginAxisSplitting","newBottomAxis","newLeftAxis","getOptions","SplitXAxis","SplitYAxis","margins","low","high","splits","splitNumber","subserie","splitAxis","sserie","xSubAxis","ySubAxis","getSubAxis","subAxisIndex","newLineSerie","newScatterSerie","serieObj","defaultAxisConstructorOptions","SplitAxis","delegateMethods","cl","constructorOptions","_splitVal","setSpan","_splits","axisIndex","fixGridFor","autoSpread","currentSplit","baseWidth","baseWidthIndex","_mean","_baseWidthVal","_baseWidthIndex","setChunkBoundaries","_splitSpread","subAxis","spanReference","getPrimaryTickUnit","forcePrimaryTickUnit","labelPosY","widthAfter","PluginMakeTracesDifferent","hue","saturation","lightness","seriesLength","serieTypes","allSeries","startingColorHSL","colorHSL","checkHSL","endingColorHSL","affect","endS","endL","colorString","buildHSLString","PluginPeakPicking","picks","autoPeakPickingNb","pick","detectedPeaks","lastYPeakPicking","peaks","passed","autoPeakPickingAllowAllY","autoPeakPickingMinDistance","autoPeakPickingFormat","_hidePeakPickingLocked","unlock","AxisXTime","GraphPluginShape","GraphPluginDrag","GraphPluginZoom","GraphPluginSelectScatter","GraphPluginTimeSerieManager","GraphPluginSerieLineDifference","GraphPluginAxisSplitting","GraphPluginMakeTracesDifferent","GraphPluginPeakPicking","ShapeAreaUnderCurve","ShapePeakBoundariesCenter","GraphLegend"],"mappings":";;AAAA,SAASA,QAAT,CAAmBC,EAAnB,EAAwB;MACjBA,MAAMA,GAAGC,OAAT,IAAoBD,GAAGC,OAAH,CAAY,IAAZ,IAAqB,CAAC,CAA/C,EAAmD;WAC1CC,SAAUF,GAAGG,OAAH,CAAY,IAAZ,EAAkB,EAAlB,CAAV,CAAP;;SAEK,KAAP;;;AAGF,SAASC,SAAT,CAAoBC,CAApB,EAAwB;SACf,CAACC,MAAOC,WAAYF,CAAZ,CAAP,CAAD,IAA6BG,SAAUH,CAAV,CAApC;;;;;;;AA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AACAr/C,QAAMoY,mBAAN,CAA2B,yBAA3B,EAAsD+oC,gBAAtD;AACAnhD,QAAMoY,mBAAN,CAA2B,kBAA3B,EAA+C+sC,SAA/C;AACAnlD,QAAMoY,mBAAN,CAA2B,+BAA3B,EAA4D+rC,sBAA5D;;;;AAIAnkD,QAAMoY,mBAAN,CAA2B,kBAA3B,EAA+CgsC,cAA/C;AACApkD,QAAMoY,mBAAN,CAA2B,uBAA3B,EAAoDgsC,cAApD;AACApkD,QAAMoY,mBAAN,CAA2B,mBAA3B,EAAgDksC,UAAhD;;AAEAtkD,QAAMoY,mBAAN,CAA2B,kCAA3B,EAA+Dm+C,mBAA/D;;;AAGAv2D,QAAMoY,mBAAN,CAA2B,cAA3B,EAA2Co+C,MAA3C;AACAx2D,QAAMoY,mBAAN,CAA2B,gBAA3B,EAA6CnlB,QAA7C;;;;"} \ No newline at end of file diff --git a/dist/jsgraph-module.min.js b/dist/jsgraph-module.min.js index 6a3008755..ec607aac0 100644 --- a/dist/jsgraph-module.min.js +++ b/dist/jsgraph-module.min.js @@ -1,2 +1,2 @@ -function _parsePx(e){return e&&e.indexOf&&-1r&&(r+=1),1i?i*(1+t):i+t-i*t,l=2*i-o;s=hue2rgb(l,o,e+1/3),r=hue2rgb(l,o,e),n=hue2rgb(l,o,e-1/3)}return[a(255*s),a(255*r),a(255*n)]}function saveDomAttributes(e,t,r){if(e)for(var a in e._savedAttributesIds=e._savedAttributesIds||[],-1'function'==typeof e?e(this.data,this.dataX):e),this.NPARMS=e.length}setSubset(e,t){e!==void 0&&t!==void 0&&(this._from=e,this._to=t)}hookIteration(e){this._hookIteration=(t)=>{let i=this.buildFit(t,200);e(i)}}setFunction(e){this._func=e}init(){if(void 0!==this._from&&void 0!==this._to){if(this._from>=this._to)throw'Impossible to fit negative subranges. The starting index must be lower than the ending index';if(this.NPTS=this._to-this._from+1,this.data&&this.data.getLength()<=this._to)throw'Wave Y has not enough point to be fitted to subrange ['+this._from+', '+this._to+']';if(0>this._from)throw'Impossible to fit a subrange with negative indices'}else this.NPTS=this.data.getLength(),this._from=0,this._to=this.data.getLength()-1;if(this.dataX&&this.dataX.getLength()<=this._to)throw'Wave X has not enough point to be fitted to subrange ['+this._from+', '+this._to+']';this.arrY=this.data.getDataY(),this.arrX=this.dataX?this.dataX.getDataY():this.data.getDataX(),this.resid=Array(this.NPTS).fill(0),this.jac=Array(this.NPTS).fill(0),this.jac=this.jac.map(()=>Array(this.NPARMS))}fit(){return this.log('Starting the fit with initial parameter list {'+this.parms.join()+'};'),new LM(this,this.NPARMS,this.NPTS,this._hookIteration),this.log('Fit successful. Output parameters {'+this.parms.join()+'};'),this._result=this.buildFit(this.parms,200),this.options.done&&this.options.done(this.parms,this._result),this._result}func(e,t){return this._func(e,t)}computeResiduals(){for(var e=0,t=0;ta*(i-e)/(t-1)+e)}for(var a=Array(r.length),s=0,i=r.length;sArray(this.nadj)),this.amatrix=this.amatrix.map(()=>Array(this.nadj)),this.lambda=this.LAMBDAZERO;var a=0,s=!1;do s=this.bLMiter(),r&&r(this.myH.params),a++;while(!s&&a=r){this.lambda*=this.LMSHRINK;break}for(var a=0;a-this.LMTOL||this.lambda>this.LAMBDAMAX}gaussj(e,t){var r=Math.abs,a=1,s=Array(100),n=Array(100),o,l,p,i,d,g;for(d=0;dd)for(i=0;id)for(p=0;pd)for(p=0;pd)for(i=0;i{};else{var queue={},aggregatorWorker;let e=function(){var e=Math.max,t=Math.min,r=Math.floor;onmessage=function(a){const s=a.data.data,n=a.data.maxX,o=a.data.minX,p=a.data.maxY,d=a.data.minY,g=a.data.direction;let c=a.data.numPoints,u=s.length,l=0,i=-4,h=[],x=[],m=[],y=[],b,A,f,k,S,M,C;b=a.data.xdata?function(e){return a.data.xdata[e]}:function(e){return e*a.data.xScale+a.data.xOffset};let v={};if('x'==g)for(const a=c/(n-o);l{queue[t]=e});return aggregatorWorker.postMessage(e),i}}var aggregator=dataAggregator;class Waveform{constructor(e=[],t=0,i=1){this.xOffset=t,this.xScale=i,this.errors={nb:0,bars:{above:null,below:null},boxes:{above:null,below:null}},this.setData(e),this.BELOW=Waveform.BELOW,this.ABOVE=Waveform.ABOVE,this.BOX=Waveform.BOX,this.BAR=Waveform.BAR}setData(e,t=null){if(Array.isArray(e[0])){let t=[],i=[];e.forEach((e)=>{t.push(e[0]),i.push(e[1])}),this.setXWaveform(t),e=i}let i=this._makeArray(e.length),r=!1;const a=this.isNaNAllowed();return e.map((e,t)=>{var s=Number.isNaN;(!a&&s(e[0])||s(e[1]))&&(r=!0),i[t]=e}),r&&this.warn('Trying to assign NaN values to a typed array that does not support NaNs. 0\'s will be used instead'),this._setData(i),t&&this.setXWaveform(t),this}getY(e,t=!1){return t&&this.dataInUse?this.dataInUse.y[e]*this.getScale()+this.getShift():this.data[e]*this.getScale()+this.getShift()}setXWaveform(e){if(!(e instanceof Waveform))if(Array.isArray(e))e=new Waveform(e);else throw'Cannot set X waveform. Data is not a valid array.';return this.xdata=e,this.computeXMinMax(),this}hasXWaveform(){return!!this.xdata}getXWaveform(){if(this.xdata)return this.xdata;let e=new Waveform,t=[];for(var r=0;rthis.maxX||this.maxX===void 0)&&(this.maxX=e),(tthis.maxY||this.maxY===void 0)&&(this.maxY=t)}prepend(e,t){return'function'==typeof e&&(e=e(this)),'function'==typeof t&&(t=t(this)),this.xdata?this.xdata.prepend(null,e):null===e?this.xOffset-=this.xScale:(this.xdata=this.getXWaveform(),this.xdata.prepend(null,e)),this.data.unshift(t),this.recalculateMinMaxNewPoint(e,t),this}append(e,t){return this.data||(this.data=[]),'function'==typeof e&&(e=e(this)),'function'==typeof t&&(t=t(this)),this.xdata?this.xdata.append(null,e):null!==e&&(this.xdata=this.getXWaveform(),this.xdata.append(null,e)),this.monotoneous&&(t>=this.data[this.data.y]&&!1===this.getMonotoneousAscending()?this.monotoneous=!1:t<=this.data[this.data.y]&&!0===this.getMonotoneousAscending()&&(this.monotoneous=!1)),(1==this.data.length||void 0===this._monotoneousAscending)&&(this.monotoneous=!0,this._monotoneousAscending=t==this.data[0]?void 0:t>this.data[0]),this.data.push(t),this.recalculateMinMaxNewPoint(e,t),this}_makeArray(e){const t=this.getTypedArrayClass();return t?new t(e):Array(e)}_setData(e=this.data){var t=Math.max,r=Math.min;const a=e.length;let s=1,i=e[1]>e[0],n=e[0],o=e[0];for(this._monotoneous=!0;se[s-1]&&(this._monotoneous=!1),e[s]===e[s]&&(n=r(e[s],n),o=t(e[s],o));if(this._monotoneous&&(this._monotoneousAscending=e[1]>e[0]),this.hasErrorBars()){for(s=0;st){let i=e;e=t,t=i}var r=t-e+1,a=0;let s=0,n;for(var o=this.getData();e<=t;e++)o.length-1>e&&(n=this.getX(e+1)-this.getX(e),s+=n,a+=o[e]*n);return[a,r,s]}integrateP(e,t){var i=this._integrateP(e,t);return i[0]}integrate(e,t){return this.integrateP(this.getIndexFromX(e),this.getIndexFromX(t))}average(e=0,t=this.getLength()-1){return this.getAverageP(e,t)}mean(){return this.average()}getAverageP(e,t){var i=this._integrateP(e,t);return i[0]/i[2]}getAverageX(e,t){var i=this._integrateX(e,t);return i[0]/i[2]}checkMonotonicity(){let e=1,t=this.getData();const i=this.data.length;for(let r=t[1]>t[0];et[e-1])return this._monotoneous=!1;return this._monotoneousAscending=t[1]>t[0],this._monotoneous=!0}requireXMonotonicity(){this.xdata&&this.xdata.requireMonotonicity()}requireMonotonicity(){if(!this.isMonotoneous())throw'The wave must be monotonic'}isMonotoneous(){return!!this._monotoneous}isXMonotoneous(){return!this.xdata||this.xdata.isMonotoneous()}invert(e){let t=e||this.data;return t.reverse(),this.isMonotoneous()&&(this._monotoneousAscending=!this._monotoneousAscending),t}resampleForDisplay(e){let t=0;this.requireXMonotonicity();let i=!1,r=this.getDataY(),a={x:[],y:[]},s=[],n=!1,o=0,p,d,g,c,u,h,x,m;const y=this.getLength();if(!e.xPosition)throw'No position calculation method provided';if(!e.resampleToPx)throw'No "resampleToPx" method was provided. Unit: px per point';if(e.minX>e.maxX){let t=e.minX;e.minX=e.maxX,e.maxX=t}for((this.xdata&&!this.xdata.getMonotoneousAscending()||!this.xdata&&-0>this.xScale)&&(i=!0,t=y);i?0m){o=t;continue}if(x=e.xPosition(m),!n){for(o?(a.x.push(m),a.y.push(r[o])):o=t;isNaN(r[t]);)i?t--:t++;p=d=g=r[o],c=1,h=x,u=m,o=0,n=!0;continue}if(Math.abs(x-h)>e.resampleToPx||t==y||0==t||isNaN(r[t])){let t=(u+m)/2;if(a.x.push(t),a.y.push(p/c),s.push(t,d,g),void 0!==e.maxX&&m>e.maxX)break;n=!1;continue}p+=r[t],c++,d=Math.min(d,r[t]),g=Math.max(g,r[t])}return this.dataInUseType='resampled',this.dataInUse=a,s}interpolate(e){let t=this.getDataY(),i;if(e=(e-this.getXShift())/this.getXScale(),this.xdata){let i=this.xdata.getData(),r=binarySearch(e,i,!this.xdata.getMonotoneousAscending());return i[r]==e?t[r]:(e-i[r])/(i[r+1]-i[r])*(t[r+1]-t[r])+t[r]}else{i=(e-this.xOffset)/this.xScale;let r=Math.floor(i);return(i-r)*(t[r+1]-t[r])+t[r]}}getMonotoneousAscending(){return this.isMonotoneous()?this._monotoneousAscending:'The waveform is not monotoneous'}getXMonotoneousAscending(){return this.xdata?this.xdata.getMonotoneousAscending():0t(e)/i)}add(e){return this._arithmetic(e,ADD)}addBy(){return this.add(...arguments)}subtract(e){return this._arithmetic(e,SUBTRACT)}subtractBy(){return this.subtract(...arguments)}math(e){for(var t=0;t{this._dataAggregated=e.aggregates,console.log(this._dataAggregated),this._dataAggregating=!1})}hasAggregation(){return!!this._dataAggregated}selectAggregatedData(e){if(2>e)return!1;2147483647=e&&this.data[a]s&&(s=this.getY(o),n=o)}else{s=Number.POSITIVE_INFINITY;for(var o=e;o<=t;o++)this.getY(o)o)break;if(!(nt.rangeP[1]-(r-1)/2)break;if(a=this.getAverageP(n-(r-1)/2,n+(r-1)/2),void 0==s){s=a=e&&s){if(s=!1,'ascending'==t.edge||'both'==t.edge)for(i=n+(r-1)/2;i>=n-(r-1)/2;i--)if(this.data[i]>=e&&this.data[i-1]=n-(r-1)/2;i--)if(this.data[i]<=e&&this.data[i-1]>e)switch(t.rounding){case'before':return i-1;break;case'after':return i;break;case'interpolate':return getIndexInterpolate(e,this.data[i],this.data[i-1],i,i-1);}}}}normalize(e){let t,r,a,s,n,o;if('max1'==e||'max100'==e){for(t=1,'max100'==e&&(t=100),s=this.data[0],o=1;os&&(s=this.data[o]);for(o=0;os?s=this.data[o]:this.data[o]>=1;)t<<=1;return t}function pow2floor(e){for(var t=1;e>>=1;)t<<=1;return t}function getIndexInterpolate(e,t,i,r,a){return(e-t)/(i-t)*(a-r)+r}function euclidianSearch(e,t,r,a,s=1,n=1){var o=Math.pow;let p=Number.MAX_VALUE,d=-1,g;for(var c=0,i=r.length;c=t.length-1)return t.length-1;if(0>=l)return 0;l+=i}if(l==a||t[l]==e||l==n)return l;if(t[l]<=e)r?n=l:a=l;else if(t[l]>e)r?a=l:n=l;else return!1;i*=-1}}Waveform.BELOW=Symbol(),Waveform.ABOVE=Symbol(),Waveform.BOX=Symbol(),Waveform.BAR=Symbol();const MULTIPLY=Symbol(),ADD=Symbol(),SUBTRACT=Symbol(),DIVIDE=Symbol(),GraphOptionsDefault={title:'',paddingTop:30,paddingBottom:5,paddingLeft:20,paddingRight:20,close:{left:!0,right:!0,top:!0,bottom:!0},closeColor:'black',fontSize:12,fontFamily:'Myriad Pro, Helvetica, Arial',plugins:{},pluginAction:{},mouseActions:[],keyActions:[],wheel:{},dblclick:{},shapesUnselectOnClick:!0,shapesUniqueSelection:!0},defaultScatterStyle={shape:'circle',r:4};var _constructors=new Map;class Graph$1 extends EventEmitter{constructor(e,t,r){for(var a in super(),this._creation=guid(),this._drawn=!1,e!==Object(e)||e instanceof HTMLElement?'string'==typeof e?e=document.getElementById(e):'number'==typeof e.length&&(e=e[0]):(r=t,t=e,e=null),this.options=extend({},GraphOptionsDefault,t),doDom.bind(this)(),e&&this.setWrapper(e),this.prevented=!1,this.axis={left:[],top:[],bottom:[],right:[]},this.shapes=[],this.shapesLocked=!1,this.plugins={},this.options.pluginAction)this.options.pluginAction.plugin=a,this.options.mouseActions.push(this.options.pluginAction);if(this.selectedShapes=[],this.series=[],this._axesHaveChanged=!0,this.options.hasOwnProperty('padding')&&isNumeric$1(this.options.padding)&&(this.options.paddingTop=this.options.paddingBottom=this.options.paddingLeft=this.options.paddingRight=this.options.padding),this.currentAction=!1,this.ns=Graph$1.ns,this.nsxlink=Graph$1.nsxlink,r)for(var a in r)for(var i=0,s=r[a].length;i{t.getXAxis()==e&&t.kill()})),e.isY()&&(-1<(r=this.axis.left.indexOf(e))&&this.axis.left.splice(r,1),-1<(r=this.axis.right.indexOf(e))&&this.axis.right.splice(r,1),!i&&this.series.forEach((t)=>{t.getYAxis()==e&&t.kill()})),this.axisGroup.removeChild(e.group),this.groupPrimaryGrids.removeChild(e.gridPrimary),this.groupSecondaryGrids.removeChild(e.gridSecondary),t||this.draw(!0)}hasXAxis(e){return this.hasTopAxis(e)||this.hasBottomAxis(e)}hasYAxis(e){return this.hasLeftAxis(e)||this.hasRightAxis(e)}hasTopAxis(e){return this.hasAxis(e,this.axis.top)}hasBottomAxis(e){return this.hasAxis(e,this.axis.bottom)}hasLeftAxis(e){return this.hasAxis(e,this.axis.left)}hasRightAxis(e){return this.hasAxis(e,this.axis.right)}hasAxis(e,t){for(var r=0,i=t.length;re.include(t.getType()))}drawSerie(e,t){if(!e.draw)throw new Error('Serie has no method draw');e.draw(t)}drawSeries(e){if(this.width&&this.height)for(var t=this.series.length-1;0<=t;t--)this.series[t].isShown()&&this.drawSerie(this.series[t],e)}resetSeries(){this.removeSeries()}killSeries(){this.resetSeries()}removeSeries(){for(;this.series[0];)this.series[0].kill(!0);this.series=[],this.legend&&this.legend.update()}selectSerie(e,t){'object'==typeof e||(e=this.getSerie(e));this.selectedSerie==e&&this.selectedSerie.selectionType==t||(this.selectedSerie!==e&&this.selectedSerie&&this.unselectSerie(this.selectedSerie),this.selectedSerie=e,this.triggerEvent('onSelectSerie',e),e.select(t||'selected'))}getSelectedSerie(){return this.selectedSerie}unselectSerie(e){e.unselect&&(e.unselect(),this.selectedSerie=!1,this.triggerEvent('onUnselectSerie',e))}getShapesOfSerie(e){for(var t=[],r=this.shapes.length-1;0<=r;r--)this.shapes[r].getSerie()==e&&t.push(this.shapes[r]);return t}makeToolbar(e){var t=this.getConstructor('graph.toolbar');return t?this.toolbar=new t(this,e):throwError('No constructor exists for toolbar')}getShapes(){return this.shapes||[]}newShape(e,t,r=!1,a){if(this.prevent(!1),!r&&(this.emit('beforeNewShape',t),this.prevent(!1)))return!1;'object'==typeof e&&(r=t,t=e,e=t.type),t=t||{},t._id=guid();var s;if(s='function'==typeof e?e:this.getConstructor('graph.shape.'+e),!s)return throwError('No constructor for this shape');var n=new s(this,t);if(!n)return throwError('Failed to construct shape.');if(n.type=e,n.graph=this,n._data=t,void 0!==t.properties&&n.setProperties(t.properties),n.init(this,a),void 0!==t.props)for(var o in t.props)n.setProp(o,t.props[o]);if(t.position)for(var o=0,i=t.position.length;o{n.addTransform(e,t)}),void 0!==t.highlightOnMouseOver&&n.setProp('highlightOnMouseOver',!0),t.labelEditable&&n.setProp('labelEditable',t.labelEditable),t.labels&&!t.label&&(t.label=t.labels),void 0!==t.label){Array.isArray(t.label)||(t.label=[t.label]);for(var o=0,i=t.label.length;o[e.getZPos(),e]);o.sort((e,t)=>t[0]-e[0]);let l=0;o.forEach((e)=>{e[1].setLayer(l),this.appendSerieToDom(e[1]),l++}),this.drawSeries(!0)}kill(){this.wrapper.removeChild(this.dom)}_removeSerie(e){this.series.splice(this.series.indexOf(e),1),this._pluginsExecute('serieRemoved',e)}contextListen(e,t,i){if(this.options.onContextMenuListen)return this.options.onContextMenuListen(e,t,i)}lockShapes(){this.shapesLocked=!0;for(var e=0,t=this.shapes.length;ethis.drawingSpaceWidth}getDrawingSpaceHeight(){return()=>this.drawingSpaceHeight}getDrawingSpaceMinX(){return()=>this.drawingSpaceMinX}getDrawingSpaceMinY(){return()=>this.drawingSpaceMinY}getDrawingSpaceMaxX(){return()=>this.drawingSpaceMaxX}getDrawingSpaceMaxY(){return()=>this.drawingSpaceMaxY}trackingLine(e){var t=this;return'boolean'==typeof e?void(this.options.trackingLine&&(this.options.trackingLine.enable=e)):(e&&(this.options.trackingLine=e),e.series=e.series||[],e.enable=void 0===e.enable||!!e.enable,'individual'==e.mode?e.series&&(!Array.isArray(e.series)&&('all'==e.series?e.series=this.series.map((e)=>({serie:e})):e.series=[e.series]),e.series.forEach((e)=>{if('object'!=typeof e.serie){if('object'!=typeof e)throw new Error('Misuse of the trackingLine() method. Each serie must be an object with the serie property: { series: [ { serie: jsGraphSerie, options: { ... someOptions } } ] }');e.serie=this.getSerie(e.serie)}e.serie&&t.addSerieToTrackingLine(e.serie,e)})):e.series.forEach((e)=>{e.serie.disableTracking()}),!e.noLine)?(this.trackingObject||(this.trackingObject=this.newShape('line',extend(!0,{position:[{y:'min'},{y:'max'}],stroke:'black',layer:-1},e.trackingLineShapeOptions))),this.trackingObject.draw(),this.trackingObject):void 0}addSerieToTrackingLine(e,t){this.options.trackingLine||this.trackingLine({mode:'individual'}),this.options.trackingLine.series.forEach((t,i)=>{t.serie==e&&this.options.trackingLine.series.splice(i,1)}),this.options.trackingLine.series.push(Object.assign({serie:e},t)),e.enableTracking((e,i,r,a)=>{this.options.trackingLine.enable&&i&&(this.trackingObject&&(this.trackingObject.show(),this.trackingObject.getPosition(0).x=i.trueX,this.trackingObject.getPosition(1).x=i.trueX,this.trackingObject.redraw()),e._trackingLegend=_trackingLegendSerie(this,{serie:e},r,a,e._trackingLegend,t.textMethod?t.textMethod:(e)=>{for(var t in e)return e[t].serie.serie.getName()+': '+e[t].serie.serie.getYAxis().valueToHtml(e[t].yValue)},i.trueX),e._trackingLegend&&(e._trackingLegend.style.display='block'))},(e)=>{this.trackingObject&&this.trackingObject.hide(),e.trackingShape&&e.trackingShape.hide(),e._trackingLegend&&(e._trackingLegend.style.display='none'),e._trackingLegend=_trackingLegendSerie(this,{serie:e},!1,!1,e._trackingLegend,!1,!1)})}setKatexRenderer(e){this._katexRenderer=e}hasKatexRenderer(){return!!this._katexRenderer}renderWithKatex(e,t){if(this._katexRenderer){t?t.removeChild(t.firstChild):t=document.createElementNS(Graph$1.ns,'foreignObject');let i=document.createElement('div');return t.appendChild(i),this._katexRenderer(e,i),t}return!1}static fromJSON(e,t){let i={},r={left:[],top:[],right:[],bottom:[]},a,s;return e.title&&(i.title=e.title),e.axis&&e.axis.forEach(function(e){e.type||throwError('Axis type is required (top, bottom, left or right)');var t={};e.label&&(t.labelValue=e.label),void 0!==e.unit&&(t.unit=e.unit),void 0!==e.unitWrapperAfter&&(t.unitWrapperAfter=e.unitWrapperAfter),void 0!==e.unitWrapperBefore&&(t.unitWrapperBefore=e.unitWrapperBefore),void 0!==e.min&&(t.forcedMin=e.min),void 0!==e.max&&(t.forcedMax=e.max),void 0!==e.flip&&(t.flipped=e.flip),r[e.type].push(t),e._jsGraphIndex=r[e.type].length-1}),a=new Graph$1(t,i,r),e.width&&a.setWidth(e.width),e.height&&a.setHeight(e.width),a._resize(),e.data&&e.data.forEach(function(t){var r=t.type,n={},o,p;let d;switch(t.type){case'bar':throwError('Bar charts not supported'),r=!1;break;case'color':r=Graph$1.SERIE_LINE_COLORED;break;case'scatter':r=Graph$1.SERIE_SCATTER;break;case'box':r=Graph$1.SERIE_BOX,('x'==t.orientation||'y'==t.orientation)&&(n.orientation=t.orientation);break;default:r=Graph$1.SERIE_LINE;}if(r!==Graph$1.SERIE_BOX&&(d=Graph$1.newWaveform()),!r)return void throwError('No valid serie type was found');if(o=a.newSerie(t.id||t.label||guid(),n,r),t.lineStyle){let e;Array.isArray(e)&&(e={unselected:e}),Object.entries(e).forEach(([e,t])=>{var i={};r===Graph$1.SERIE_LINE?(void 0!==t.lineWidth&&(i.lineWidth=t.lineWidth),void 0!==t.color&&(i.lineColor=t.color),t.lineStyle&&(i.lineStyle=t.lineStyle),o.setStyle(i,e)):void 0})}let g={},c={};if(t.defaultStyle&&(g=t.defaultStyle),t.defaultStyles&&(c=t.defaultStyles),t.styles){let e=Array.isArray(t.styles)?{unselected:t.styles}:t.styles;let i=new Set(Object.keys(c).concat(Object.keys(e)));i.forEach((t)=>{let i=[],a;e&&e[t]&&(i=e[t],!Array.isArray(i)&&(i=[i]),a=i.map(function(e){switch(r){case Graph$1.SERIE_LINE:return{type:e.shape,zoom:e.zoom,strokeWidth:e.lineWidth,strokeColor:e.lineColor,fillColor:e.color,points:e.points};break;case Graph$1.SERIE_BOX:return e;break;case Graph$1.SERIE_SCATTER:return e;}})),r===Graph$1.SERIE_LINE?o.setMarkers(a,t):r===Graph$1.SERIE_SCATTER?o.setStyle(Object.assign({},defaultScatterStyle,g,c[t]||{}),a,t):r===Graph$1.SERIE_BOX?o.setStyle(a[0],t||'unselected'):void 0})}if(t.color&&r==Graph$1.SERIE_LINE_COLORED&&o.setColors(t.color),r!==Graph$1.SERIE_BOX&&d.setData(t.y,t.x),!!o){let n=[],l=[],g=[],c=[],h=[],x=[],m=[],y=[];if(void 0!==d){if(t.errorX)for(var u=0,i=t.errorX.length;u{this.axis[e]&&(t=t.concat(this.axis[e].map((t)=>({type:e,label:t.options.label,unit:t.options.unit,min:t.options.forcedMin,max:t.options.forcedMax,flip:t.options.flipped}))),'top'==e||'bottom'==e?i.x=i.x.concat(this.axis[e]):i.y=i.y.concat(this.axis[e]))}),e.axis=t;let r=(e)=>{switch(e){case Graph$1.SERIE_LINE:return'line';break;case Graph$1.SERIE_BAR:return'bar';break;case Graph$1.SERIE_LINE_COLORED:return'color';break;case Graph$1.SERIE_SCATTER:return'scatter';}},a=(e,t)=>{let r=[];switch(e.getType()){case Graph$1.SERIE_LINE:for(var a=0;a{let t=[],s=[];if(e.getType()==Graph$1.SERIE_LINE)for(var n in e.styles){s.push({styleName:n,color:e.styles[n].lineColor,lineWidth:e.styles[n].lineWidth,lineStyle:e.styles[n].lineStyle});let i={styleName:n,styles:[]};t.push(i),i.styles=i.styles.concat((e.styles[n].markers||[]).map((e)=>({shape:e.type,zoom:e.zoom,lineWidth:e.strokeWidth,lineColor:e.strokeColor,color:e.fillColor,points:e.points})))}return{label:e.getLabel(),id:e.getName(),type:r(e.getType()),x:a(e,!0),y:a(e,!1),xAxis:i.x.indexOf(e.getXAxis()),yAxis:i.y.indexOf(e.getYAxis()),style:t,lineStyle:s}})),e}static registerConstructor(e,t){return _constructors.has(e)?throwError('Constructor '+t+' already exists.'):void _constructors.set(e,t)}static getConstructor(e,t=!1){return _constructors.has(e)?_constructors.get(e):!t&&throwError('Constructor "'+e+'" doesn\'t exist')}static newWaveform(){return new Waveform(...arguments)}static waveform(){return new Waveform(...arguments)}}Graph$1.prototype.getConstructor=Graph$1.getConstructor;function makeSerie(e,t,i,r){var a=e.getConstructor(r,!0);if(a||'string'!=typeof r||(a=e.getConstructor('graph.serie.'+r,!0)),a){var s=new a(e,t,i);e.appendSerieToDom(s)}else return throwError('No constructor exists for the serie type provided. Use Graph.registerConstructor( name, constructor ) first is you use your own series');return s}function getAxisLevelFromSpan(e,t){for(var r=0,i=t.length,a;rt[r][s][1]&&e[1]>t[r][s][1]||(a=!1);if(a)return t[r].push(e),r}return t.push([e]),t.length-1}function refreshDrawingZone(e){var t=Math.max,i={top:[],bottom:[],left:[],right:[]},r={top:[],bottom:[],left:[],right:[]};e._painted=!0,e._applyToAxes(function(e,a){if(!e.isShown())return void e.hideGroup();if(e.showGroup(),!e.floating){var s=getAxisLevelFromSpan(e.getSpan(),r[a]);e.setLevel(s),i[a][s]=t(e.getAxisPosition(),i[a][s]||0)}},!1,!0,!1);var a=i.top.reduce(function(e,t){return e+t},0),s=i.bottom.reduce(function(e,t){return e+t},0);e.drawingSpaceHeight=e.getDrawingHeight()-a-s,[i.top,i.bottom].map(function(e){e.reduce(function(t,i,r){return e[r]=t+i,t+i},0)}),e._applyToAxes(function(e,t){!e.isShown()||e.floating||e.setShift(i[t][e.getLevel()])},!1,!0,!1),e._applyToAxes(function(n,o){if(n.isShown()?n.showGroup():n.hideGroup(),n.setMinPx(a),n.setMaxPx(e.getDrawingHeight(!0)-s),!n.floating){let e=n.linkedToAxis?0:n.draw();if(n.isShown()){var l=getAxisLevelFromSpan(n.getSpan(),r[o]);n.setLevel(l),i[o][l]=t(e,i[o][l]||0)}}},!1,!1,!0);var n=extend(!0,{},i);e._applyToAxes(function(e,r){!e.isShown()||e.floating||(n[r][e.getLevel()]=t(i[r][e.getLevel()],e.equalizePosition(i[r][e.getLevel()])))},!1,!1,!0),i=n;var o=i.left.reduce(function(e,t){return e+t},0),l=i.right.reduce(function(e,t){return e+t},0);e.drawingSpaceWidth=e.getDrawingWidth()-o-l,[i.left,i.right].map(function(e){e.reduce(function(t,i,r){return e[r]=t+i,t+i},0)}),e._applyToAxes((e,t)=>{!e.isShown()||e.floating||e.setShift(i[t][e.getLevel()])},!1,!1,!0),e._applyToAxes(function(t){!t.isShown(),t.setMinPx(o),t.setMaxPx(e.getDrawingWidth(!0)-l);t.floating||!t.linkedToAxis&&t.draw()},!1,!0,!1),e._applyToAxes(function(e){if(e.floating){var t=e.getFloatingAxis(),i=e.getFloatingValue(),r=t.getPx(i);e.setShift(r),e.linkedToAxis||e.draw()}},!1,!0,!0),_closeLine(e,'right',e.getDrawingWidth(!0),e.getDrawingWidth(!0),a,e.getDrawingHeight(!0)-s),_closeLine(e,'left',0,0,a,e.getDrawingHeight(!0)-s),_closeLine(e,'top',o,e.getDrawingWidth(!0)-l,0,0),_closeLine(e,'bottom',o,e.getDrawingWidth(!0)-l,e.getDrawingHeight(!0)-s,e.getDrawingHeight(!0)-s),e.clipRect.setAttribute('y',a),e.clipRect.setAttribute('x',o),e.clipRect.setAttribute('width',e.getDrawingWidth()-o-l),e.clipRect.setAttribute('height',e.getDrawingHeight()-a-s),e.rectEvent.setAttribute('y',a+e.getPaddingTop()),e.rectEvent.setAttribute('x',o+e.getPaddingLeft()),e.rectEvent.setAttribute('width',e.drawingSpaceWidth),e.rectEvent.setAttribute('height',e.drawingSpaceHeight),e.drawingSpaceMinX=o+e.getPaddingLeft(),e.drawingSpaceMinY=a+e.getPaddingTop(),e.drawingSpaceMaxX=e.getDrawingWidth()-l+e.getPaddingLeft(),e.drawingSpaceMaxY=e.getDrawingHeight()-s+e.getPaddingTop(),e._applyToAxes(function(e){e.isShown()&&e.drawLines()},!1,!0,!0),e.shift=i,e.redrawShapes()}function _handleKey(e,t,i){return console.log(t,i),e.forcedPlugin?(e.activePlugin=e.forcedPlugin,void e._pluginExecute(e.activePlugin,i,[e,t])):void checkKeyActions(e,t,[e,t],i)}function checkKeyActions(t,r,e,a){var s=t.options.keyActions,n,i;for(n=0,i=s.length;n{e.kill(s[n].keepInDom)}))}return!1}function doDom(){this.dom=document.createElementNS(Graph$1.ns,'svg'),this.dom.setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:xlink','http://www.w3.org/1999/xlink'),setAttributeTo(this.dom,{xmlns:Graph$1.ns,"font-family":this.options.fontFamily,"font-size":this.options.fontSize});try{setAttributeTo(this.dom,{"data-jsgraph-version":'v<%= pkg.version %>'})}catch(t){}this.defs=document.createElementNS(Graph$1.ns,'defs'),this.dom.appendChild(this.defs),this.groupEvent=document.createElementNS(Graph$1.ns,'g'),this.rectEvent=document.createElementNS(Graph$1.ns,'rect'),setAttributeTo(this.rectEvent,{"pointer-events":'fill',fill:'transparent'}),this.groupEvent.appendChild(this.rectEvent),this.dom.appendChild(this.groupEvent),this.domTitle=document.createElementNS(Graph$1.ns,'text'),this.setTitle(this.options.title),setAttributeTo(this.domTitle,{"text-anchor":'middle',y:20}),this.groupEvent.appendChild(this.domTitle),this.graphingZone=document.createElementNS(Graph$1.ns,'g'),this.updateGraphingZone(),this.groupEvent.appendChild(this.graphingZone),this.axisGroup=document.createElementNS(Graph$1.ns,'g'),this.graphingZone.appendChild(this.axisGroup),this.groupGrids=document.createElementNS(Graph$1.ns,'g'),this.groupPrimaryGrids=document.createElementNS(Graph$1.ns,'g'),this.groupSecondaryGrids=document.createElementNS(Graph$1.ns,'g'),this.axisGroup.appendChild(this.groupGrids),this.groupGrids.appendChild(this.groupSecondaryGrids),this.groupGrids.appendChild(this.groupPrimaryGrids),this.plotGroup=document.createElementNS(Graph$1.ns,'g'),this.graphingZone.appendChild(this.plotGroup),this.layers=[],this._makeClosingLines(),this.clip=document.createElementNS(Graph$1.ns,'clipPath'),this.clip.setAttribute('id','_clipplot'+this._creation),this.defs.appendChild(this.clip),this.clipRect=document.createElementNS(Graph$1.ns,'rect'),this.clip.appendChild(this.clipRect),this.clip.setAttribute('clipPathUnits','userSpaceOnUse'),this.markerArrow=document.createElementNS(this.ns,'marker'),this.markerArrow.setAttribute('viewBox','0 0 10 10'),this.markerArrow.setAttribute('id','arrow'+this._creation),this.markerArrow.setAttribute('refX','6'),this.markerArrow.setAttribute('refY','5'),this.markerArrow.setAttribute('markerUnits','strokeWidth'),this.markerArrow.setAttribute('markerWidth','8'),this.markerArrow.setAttribute('markerHeight','6'),this.markerArrow.setAttribute('orient','auto');var e=document.createElementNS(Graph$1.ns,'path');e.setAttribute('d','M 0 0 L 10 5 L 0 10 z'),this.markerArrow.appendChild(e),this.defs.appendChild(this.markerArrow),this.markerHorizontalSplit=document.createElementNS(Graph$1.ns,'marker'),this.markerHorizontalSplit.setAttribute('viewBox','0 0 6 8'),this.markerHorizontalSplit.setAttribute('id','horionzalsplit_'+this.getId()),this.markerHorizontalSplit.setAttribute('refX','3'),this.markerHorizontalSplit.setAttribute('refY','4'),this.markerHorizontalSplit.setAttribute('markerUnits','strokeWidth'),this.markerHorizontalSplit.setAttribute('markerWidth','6'),this.markerHorizontalSplit.setAttribute('markerHeight','8');var t=document.createElementNS(Graph$1.ns,'line');t.setAttribute('x1','0'),t.setAttribute('y1','8'),t.setAttribute('x2','6'),t.setAttribute('y2','0'),t.setAttribute('stroke','black'),this.markerHorizontalSplit.appendChild(t),this.defs.appendChild(this.markerHorizontalSplit),this.markerVerticalSplit=document.createElementNS(Graph$1.ns,'marker'),this.markerVerticalSplit.setAttribute('viewBox','0 0 8 6'),this.markerVerticalSplit.setAttribute('id','verticalsplit_'+this.getId()),this.markerVerticalSplit.setAttribute('refX','4'),this.markerVerticalSplit.setAttribute('refY','3'),this.markerVerticalSplit.setAttribute('markerUnits','strokeWidth'),this.markerVerticalSplit.setAttribute('markerWidth','8'),this.markerVerticalSplit.setAttribute('markerHeight','6');var t=document.createElementNS(Graph$1.ns,'line');t.setAttribute('x1','0'),t.setAttribute('y1','0'),t.setAttribute('x2','8'),t.setAttribute('y2','6'),t.setAttribute('stroke','black'),this.markerVerticalSplit.appendChild(t),this.defs.appendChild(this.markerVerticalSplit),this.vertLineArrow=document.createElementNS(Graph$1.ns,'marker'),this.vertLineArrow.setAttribute('viewBox','0 0 10 10'),this.vertLineArrow.setAttribute('id','verticalline'+this._creation),this.vertLineArrow.setAttribute('refX','0'),this.vertLineArrow.setAttribute('refY','5'),this.vertLineArrow.setAttribute('markerUnits','strokeWidth'),this.vertLineArrow.setAttribute('markerWidth','20'),this.vertLineArrow.setAttribute('markerHeight','10'),this.vertLineArrow.setAttribute('orient','auto'),this.vertLineArrow.setAttribute('stroke-width','1px');var i=document.createElementNS(Graph$1.ns,'path');i.setAttribute('d','M 0 -10 L 0 10'),i.setAttribute('stroke','black'),this.vertLineArrow.appendChild(i),this.defs.appendChild(this.vertLineArrow),this.bypassHandleMouse=!1}function _registerEvents(t){if(!t.wrapper)throw'No wrapper exists. Cannot register the events.';t.dom.setAttribute('tabindex',0),t.dom.addEventListener('keydown',(i)=>{_handleKey(t,i,'keydown')}),t.dom.addEventListener('keypress',(i)=>{_handleKey(t,i,'keypress')}),t.dom.addEventListener('keyup',(i)=>{_handleKey(t,i,'keyup')}),t.dom.addEventListener('mousemove',(i)=>{var e=t._getXY(i);_handleMouseMove(t,e.x,e.y,i)}),t.dom.addEventListener('mouseleave',()=>{_handleMouseLeave(t)}),t.groupEvent.addEventListener('mousedown',(i)=>{if(t.focus(),!(3==i.which||i.ctrlKey)){var e=t._getXY(i);_handleMouseDown(t,e.x,e.y,i)}}),t.dom.addEventListener('mouseup',(i)=>{t.emit('mouseUp',i);var e=t._getXY(i);_handleMouseUp(t,e.x,e.y,i)}),t.wrapper.addEventListener('mouseup',(t)=>{t.stopPropagation()}),t.dom.addEventListener('dblclick',(i)=>{t.emit('dblClick',i);var e=t._getXY(i);_handleDblClick(t,e.x,e.y,i)}),t.groupEvent.addEventListener('click',(i)=>{if(!(3==i.which||i.ctrlKey)){var e=t._getXY(i);t.prevent(!1)||_handleClick(t,e.x,e.y,i)}}),t.groupEvent.addEventListener('mousewheel',(i)=>{var e=i.wheelDeltaY||i.wheelDelta||-i.deltaY,r=t._getXY(i);return _handleMouseWheel(t,e,r.x,r.y,i),!1}),t.groupEvent.addEventListener('wheel',(i)=>{var e=t._getXY(i),r=i.wheelDeltaY||i.wheelDelta||-i.deltaY;return _handleMouseWheel(t,r,e.x,e.y,i),!1})}function _handleMouseDown(t,i,r,a){return t.forcedPlugin?(t.activePlugin=t.forcedPlugin,void t._pluginExecute(t.activePlugin,'onMouseDown',[t,i,r,a])):void(t.activePlugin&&(t.activePlugin=!1),checkMouseActions(t,a,[t,i,r,a],'onMouseDown'))}function _handleMouseMove(t,r,a,s){if(t.bypassHandleMouse)return void t.bypassHandleMouse.handleMouseMove(s);if(!(t.activePlugin&&t._pluginExecute(t.activePlugin,'onMouseMove',[t,r,a,s]))){if(t._applyToAxes('handleMouseMove',[r-t.options.paddingLeft,s],!0,!1),t._applyToAxes('handleMouseMove',[a-t.options.paddingTop,s],!1,!0),!t.activePlugin){var e;if(t.options.trackingLine&&t.options.trackingLine.enable&&t.options.trackingLine.snapToSerie&&'common'==t.options.trackingLine.mode){var n=t.options.trackingLine.snapToSerie;if(e=n.handleMouseMove(!1,!0),this.trackingObject)if(!e)t.trackingObject.hide();else{t.trackingObject.show(),t.trackingObject.getPosition(0).x=e.xClosest,t.trackingObject.getPosition(1).x=e.xClosest,t.trackingObject.redraw();var r=n.getXAxis().getPx(e.xClosest)+t.options.paddingLeft}var o=t.options.trackingLine.series;o||(o=t.getSeries().map(function(e){return{serie:e,withinPx:20,withinVal:-1}})),t._trackingLegend=_trackingLegendSerie(t,o,r,a,t._trackingLegend,t.options.trackingLine.textMethod,e.xClosest)}}if(t.options.onMouseMoveData){for(var l={},p=0;p{var r=t.serie.handleMouseMove(n,!1);if(!r||!s)return t.serie.trackingShape&&t.serie.trackingShape.hide(),a;if(0t.serie.getXAxis().getVal(i-e.options.paddingLeft)/1e5)t.serie.trackingShape&&t.serie.trackingShape.hide();else{p[t.serie.getName()]={yValue:r.xClosest,xValue:r.yClosest,serie:t,index:r};let i;if(i=e.options.trackingLine&&e.options.trackingLine.serieShape?e.options.trackingLine.serieShape:{shape:'ellipse',properties:{rx:[3*t.serie.getLineWidth()+'px'],ry:[3*t.serie.getLineWidth()+'px']}},t.serie.trackingShape||(t.serie.trackingShape=e.newShape(i.shape,{fillColor:t.serie.getLineColor(),strokeColor:'White',strokeWidth:t.serie.getLineWidth()},!0,i.properties).setSerie(t.serie).forceParentDom(t.serie.groupMain).draw(),i.onCreated&&i.onCreated(t.serie.trackingShape),t.serie.trackingShape.on('changed',()=>{i.onChanged&&i.onChanged(t.serie.trackingShape)})),t.serie.trackingShape.show(),t.serie.trackingShape.getPosition(0).x=r.xClosest,i.magnet){let e=i.magnet,a=e.within,s;e.withinPx&&(a=t.serie.getXAxis().getRelVal(e.withinPx)),(s=t.serie.findLocalMinMax(r.xClosest,a,e.mode))&&(t.serie.trackingShape.getPosition(0).x=s)}t.serie.trackingShape.redraw()}}),!!e.options.trackingLine.legend){if(0==Object.keys(p).length||!s)a.style.display='none';else{'none'==a.style.display||l?forceTrackingLegendMode(e,a,i,r,!0):_trackingLegendMove(e,a,i,r),a.style.display='block';var d=s(p,n,i,r);a.innerHTML=d}return a}},forceTrackingLegendMode=function(e,t,i,r,a){function s(){var e=(Date.now()-n)/200;1e&&window.requestAnimationFrame(s)}var n=Date.now(),o=t.offsetHeight,l=parseInt(t.style.marginLeft.replace('px','')||0),p=parseInt(t.style.marginTop.replace('px','')||0);return i=i>e.getWidth()/2?i-i%10-20-t.offsetWidth:i-i%10+30,r=r-r%10+o/2,a?(t.style.marginLeft=i+'px',void(t.style.marginTop=r+'px')):void window.requestAnimationFrame(s)},_trackingLegendMove=debounce(forceTrackingLegendMode,50);function _makeTrackingLegend(e){var t=document.createElement('div');return t.setAttribute('class','trackingLegend'),t.style.position='absolute',t.style.borderRadius='4px',t.style.boxShadow='1px 1px 3px 0px rgba(100,100,100,0.6)',t.style.border='2px solid #333333',t.style.backgroundColor='rgba(255, 255, 255, 0.5 )',t.style.pointerEvents='none',t.style.paddingTop='5px',t.style.paddingBottom='5px',t.style.paddingLeft='10px',t.style.paddingRight='10px',e.getWrapper().insertBefore(t,e.getDom()),t}function _handleDblClick(t,i,r,a){t.options.dblclick;checkMouseActions(t,a,[i,r,a],'onDblClick')}function _handleMouseUp(t,i,r,a){return t.bypassHandleMouse?(t.bypassHandleMouse.handleMouseUp(a),void(t.activePlugin=!1)):void(t._pluginExecute(t.activePlugin,'onMouseUp',[t,i,r,a]),t.activePlugin=!1)}function _handleClick(t,i,r,a){t.emit('click',[t,i,r,a]),checkMouseActions(t,a,[i,r,a],'onClick'),a.target.jsGraphIsShape||t.prevent(!1)||!t.options.shapesUnselectOnClick||t.unselectShapes()}function _getAxis(e,t,i,r){var i=i||{},a={def:{x:e.getConstructor('graph.axis.x'),y:e.getConstructor('graph.axis.y')},time:{x:e.getConstructor('graph.axis.x.time')},bar:{x:e.getConstructor('graph.axis.x.bar')}},s;switch(i.type){case'time':var n=a.time;break;case'bar':var n=a.bar;break;case'broken':var n=a.broken;break;default:var n=a.def;}return'top'===r||'bottom'===r?s=n.x:'left'===r||'right'===r?s=n.y:void 0,t=t||0,'object'==typeof t&&(i=t,t=0),e.axis[r][t]||(e.axis[r][t]=new s(e,r,i),e.axis[r][t].init(e,i)),e.axis[r][t]}function _closeLine(e,t,i,r,a,s){if(!1!==e.options.close){var n=0;e.axis[t].map(function(e){e.isDisplayed()&&!e.floating&&n++}),(!0===e.options.close||e.options.close[t])&&0==n?(e.closingLines[t].setAttribute('display','block'),e.closingLines[t].setAttribute('x1',i),e.closingLines[t].setAttribute('x2',r),e.closingLines[t].setAttribute('y1',a),e.closingLines[t].setAttribute('y2',s)):e.closingLines[t].setAttribute('display','none')}}function _handleMouseWheel(t,i,r,a,s){checkMouseActions(t,s,[i,s,r,a],'onMouseWheel')&&(s.preventDefault(),s.stopPropagation())}function _handleMouseLeave(e){e.options.handleMouseLeave&&e.options.handleMouseLeave.call(e)}function haveAxesChanged(e){var t=e._axesHaveChanged;return e._axesHaveChanged=!1,t}function hasSizeChanged(e){var t=e._sizeChanged;return e._sizeChanged=!1,t}Graph$1.SERIE_LINE=Symbol(),Graph$1.SERIE_SCATTER=Symbol(),Graph$1.SERIE_CONTOUR=Symbol(),Graph$1.SERIE_BAR=Symbol(),Graph$1.SERIE_BOX=Symbol(),Graph$1.SERIE_ZONE=Symbol(),Graph$1.SERIE_LINE_COLORED=Symbol(),Graph$1.SERIE_ZONE=Symbol(),Graph$1.SERIE_DENSITYMAP=Symbol(),Graph$1.SERIE_LINE_3D=Symbol(),Graph$1.SERIE_ZONE_3D=Symbol(),Graph$1.TICKS_OUTSIDE=Symbol(),Graph$1.TICKS_INSIDE=Symbol(),Graph$1.TICKS_CENTERED=Symbol(),Graph$1.ns='http://www.w3.org/2000/svg',Graph$1.nsxlink='http://www.w3.org/1999/xlink';var legendDefaults={backgroundColor:'rgba(255, 255, 255, 0.8)',frame:!0,frameWidth:1,frameColor:'black',paddingTop:10,paddingLeft:10,paddingBottom:10,paddingRight:10,color:'black',frameRounding:0,movable:!1,shapesToggleable:!0,isSerieHideable:!0,isSerieSelectable:!0};class Legend{constructor(e,t){this.options=extend({},legendDefaults,t),this.graph=e,this.svg=document.createElementNS(this.graph.ns,'g'),this.subG=document.createElementNS(this.graph.ns,'g'),this.groups=[],this.rect=document.createElementNS(this.graph.ns,'rect'),this.rectBottom=document.createElementNS(this.graph.ns,'rect'),this.rect.setAttribute('x',0),this.rect.setAttribute('y',0),this.rectBottom.setAttribute('x',0),this.rectBottom.setAttribute('y',0),this.series=!1,this.svg.setAttribute('display','none'),this.pos={x:void 0,y:void 0,transformX:0,transformY:0},this.setEvents(),this.eyeId=guid(),this.eyeCrossedId=guid();var i=SVGParser(''),r=SVGParser('');this.svg.appendChild(document.adoptNode(r.documentElement.firstChild)),this.svg.appendChild(document.adoptNode(i.documentElement.firstChild)),this.svg.appendChild(this.subG),this.applyStyle()}setPosition(e,t,i){e&&(this.position=e,this.alignToX=t||'left',this.alignToY=i||'top')}setDraggable(e){this.options.movable=e}setAutoPosition(e){return-1<['bottom','left','top','right'].indexOf(e=e.toLowerCase())?(this.autoPosition=e,this):void(this.requireDelayedUpdate(),this.autoPosition=!1)}autoPosition(){return this.setAutoPosition(...arguments)}buildLegendBox(){var e=this.series||this.graph.getSeries(),t=0,r=this.options.paddingTop;this.autoPosition?this.graph.getDom().appendChild(this.getDom()):this.graph.graphingZone.appendChild(this.getDom());for(var a=0,i=e.length;athis.graph.getDrawingWidth()-this.options.paddingRight&&(r+=16,t=0)}this.groups[a].setAttribute('transform','translate( '+t+', '+r+')'),'bottom'==this.autoPosition||'top'==this.autoPosition?(t+=s.width+10,r+=0):(t=0,r+=16)}var s=getBBox(this.subG);switch(this.width=s.width+this.options.paddingRight+this.options.paddingLeft,this.height=s.height+this.options.paddingBottom+this.options.paddingTop,this.rect.setAttribute('width',this.width),this.rect.setAttribute('height',this.height),this.rect.setAttribute('fill','none'),this.rect.setAttribute('pointer-events','fill'),this.rect.setAttribute('display','none'),this.options.movable&&(this.rectBottom.style.cursor='move'),this.rectBottom.setAttribute('width',this.width),this.rectBottom.setAttribute('height',this.height),this.rectBottom.setAttribute('x',s.x-this.options.paddingLeft),this.rectBottom.setAttribute('y',s.y-this.options.paddingTop),this.position=this.position||{},this.autoPosition){case'bottom':this.position.y=this.graph.getHeight()+'px',this.position.x=(this.graph.drawingSpaceWidth-this.width)/2+this.graph.drawingSpaceMinX+'px',this.alignToY='bottom',this.alignToX=!1;break;case'left':this.position.x='6px',this.position.y=(this.graph.getHeight()-this.height)/2+'px',this.alignToX='left',this.alignToY=!1;break;case'right':this.position.x=this.graph.getWidth()+'px',this.position.y=(this.graph.getHeight()-this.height)/2+'px',this.alignToX='right',this.alignToY=!1;break;case'top':this.position.x=(this.graph.drawingSpaceWidth-this.width)/2+this.graph.drawingSpaceMinX+'px',this.position.y='10px',this.alignToY='top',this.alignToX=!1;}if(this.autoPosition){switch(this.autoPosition){case'bottom':this.graph.options.paddingBottom=this.height+10;break;case'left':this.graph.options.paddingLeft=this.width+5;break;case'right':this.graph.options.paddingRight=this.width+10;break;case'top':this.graph.options.paddingTop=this.height+14;}this.graph.updateGraphingZone(),this.graph.getDrawingHeight(),this.graph.getDrawingWidth()}this.bbox=s}calculatePosition(){var e=Position.check(this.position);let t=e.compute(this.graph,this.graph.getXAxis(),this.graph.getYAxis());t&&('max'==e.y&&(t.y+=this.graph.getPaddingTop()),'max'==e.x&&(t.x-=this.graph.getPaddingRight()),'right'==this.alignToX&&(t.x-=this.width,t.x-=this.bbox.x),'bottom'==this.alignToY?(t.y-=this.height,t.y-=this.bbox.y):t.y-=this.bbox.y,this.pos.transformX=t.x,this.pos.transformY=t.y,this._setPosition())}update(e){if(!(this.graph.isDelayedUpdate()||!this._requiredUpdate&&e)){this._requiredUpdate=!1;var t=this;for(this.applyStyle();this.subG.hasChildNodes();)this.subG.removeChild(this.subG.lastChild);this.svg.insertBefore(this.rectBottom,this.svg.firstChild);var r=this.series||this.graph.getSeries();if(0{t.preventDefault();var e=this.graph._getXY(t);this.handleMouseMoveLocal(e.x,e.y,t);for(var r=0,i=this.series.length;r{t.preventDefault();var e=this.graph._getXY(t);this.addLabel(this.getVal(e.x-this.graph.getPaddingLeft()))}),this.gridPrimary.setAttribute('clip-path','url(#_clipplot'+this.graph._creation+')'),this.gridSecondary.setAttribute('clip-path','url(#_clipplot'+this.graph._creation+')'),this.graph._axisHasChanged(this)}handleMouseMoveLocal(){}hide(){return this.options.display=!1,this}show(){return this.options.display=!0,this}setDisplay(e){return this.options.display=!!e,this}isDisplayed(){return this.options.hideWhenNoSeriesShown?this.graph.getSeriesFromAxis(this).reduce((e,t)=>e||t.isShown(),!1):this.options.display}isShown(){return this.isDisplayed(...arguments)}hideGroup(){this._hidden||(this._hidden=!0,this.group.setAttribute('display','none'))}showGroup(){this._hidden&&(this._hidden=!1,this.group.setAttribute('display','initial'))}kill(e,t){this.graph.killAxis(this,e,t)}setLineAt(e){return this.options.lineAt=e,this}adaptTo(e,t,i,r){return e?(this.options.adaptTo={axis:e,thisValue:t,foreignValue:i,preference:r},this.adapt(),this):(this.options.adaptTo=!1,this)}adapt(){if(this.options.adaptTo){var e=this.options.adaptTo.axis,t=this.options.adaptTo.thisValue,i=this.options.adaptTo.foreignValue;if((void 0===e.currentAxisMin||void 0===e.currentAxisMax)&&e.setMinMaxToFitSeries(),!1!==this.options.forcedMin&&!1==this.options.forcedMax||'max'!==this.options.adaptTo.preference){this.currentAxisMin=!1===this.options.forcedMin?this._zoomed?this.getCurrentMin():this.getMinValue()-(t-this.getMinValue())*(this.options.axisDataSpacing.min*(e.getCurrentMax()-e.getCurrentMin())/(i-e.getCurrentMin())):this.options.forcedMin,this.currentAxisMin==t&&(this.currentAxisMin-=this.options.axisDataSpacing.min*this.getInterval());var r=!1===this.options.forcedMin?this.currentAxisMin:this.options.forcedMin;this.currentAxisMax=(t-r)*(e.getCurrentMax()-e.getCurrentMin())/(i-e.getCurrentMin())+r}else{this.currentAxisMax=!1===this.options.forcedMax?this._zoomed?this.getCurrentMax():this.getMaxValue()+(this.getMaxValue()-t)*(this.options.axisDataSpacing.max*(e.getCurrentMax()-e.getCurrentMin())/(e.getCurrentMax()-i)):this.options.forcedMax,this.currentAxisMax==t&&(this.currentAxisMax+=this.options.axisDataSpacing.max*this.getInterval());var r=!1===this.options.forcedMax?this.currentAxisMax:this.options.forcedMax;this.currentAxisMin=(t-r)*(e.getCurrentMin()-e.getCurrentMax())/(i-e.getCurrentMax())+r}this.graph._axisHasChanged(this)}}setFloating(e,t){return this.floating=!0,this.floatingAxis=e,this.floatingValue=t,this}getFloatingAxis(){return this.floatingAxis}getFloatingValue(){return this.floatingValue}setAxisDataSpacing(e,t){return this.options.axisDataSpacing.min=e,this.options.axisDataSpacing.max=t||e,this}dataSpacing(){return this.setAxisDataSpacing(...arguments)}setAxisDataSpacingMin(e){this.options.axisDataSpacing.min=e}setAxisDataSpacingMax(e){this.options.axisDataSpacing.max=e}setMinPx(e){this.minPx=e,this.setMinMaxFlipped()}setMaxPx(e){this.maxPx=e,this.setMinMaxFlipped()}getMinPx(){return this.minPxFlipped}getMaxPx(){return this.maxPxFlipped}getMathMaxPx(){return this.maxPx}getMathMinPx(){return this.minPx}getMinValue(){return!1===this.options.forcedMin?this.dataMin:this.options.forcedMin}getMaxValue(){return!1===this.options.forcedMax?this.dataMax:this.options.forcedMax}setMinValueData(e){this.dataMin=e,isNaN(this.getCurrentMin())&&(this.setCurrentMin(this.getMinValue()),this.cache())}setMaxValueData(e){this.dataMax=e,isNaN(this.getCurrentMax())&&(this.setCurrentMax(this.getMaxValue()),this.cache())}getDataMax(){return this.dataMax}getDataMin(){return this.dataMin}forceMin(e,t=!1){return this.options.forcedMin=e,this.setCurrentMin(t?this.getCurrentMin():void 0),this.graph._axisHasChanged(this),this}forceMax(e,t=!1){return this.options.forcedMax=e,this.setCurrentMax(t?this.getCurrentMax():void 0),this.graph._axisHasChanged(this),this}getForcedMin(){return this.options.forcedMin}getForcedMax(){return this.options.forcedMax}forceToAxis(e){return e.getMaxValue&&e.getMinValue&&(this.options.forcedMin=e.getMinValue(),this.options.forcedMax=e.getMaxValue()),this}getNbTicksPrimary(){return this.options.nbTicksPrimary}setNbTicksPrimary(e){this.options.nbTicksPrimary=e}getNbTicksSecondary(){return this.options.nbTicksSecondary}setNbTicksSecondary(e){return this.options.nbTicksSecondary=e,this}handleMouseMove(e){this.mouseVal=this.getVal(e)}handleMouseWheel(t,i,e){t=Math.min(0.2,Math.max(-0.2,t)),'min'==e?e=this.getMinValue():'max'==e?e=this.getMaxValue():!e&&(e=0),this._doZoomVal((this.getCurrentMax()-e)*(1+t)+e,(this.getCurrentMin()-e)*(1+t)+e),this.graph.draw()}set zoomLock(e){this._zoomLocked=e}get zoomLock(){return this._zoomLocked||!1}zoom(e,t,i){return!i&&this.zoomLock?void 0:this._doZoomVal(e,t,!0)}_doZoomVal(e,t,i){return this._doZoom(this.getPx(e),this.getPx(t),e,t,i)}_doZoom(e,t,i,r,a){var i=void 0===i?this.getVal(e):i,r=void 0===r?this.getVal(t):r;return this.setCurrentMin(Math.min(i,r)),this.setCurrentMax(Math.max(i,r)),this.cacheCurrentMin(),this.cacheCurrentMax(),this.cacheInterval(),this._zoomed=!0,this.adapt(),this._hasChanged=!0,a||this.emit('zoom',[this.currentAxisMin,this.currentAxisMax,this]),this}getSerieShift(){return this._serieShift}getSerieScale(){return this._serieScale}getMouseVal(){return this.mouseVal}getUnitPerTick(e,t,i){var r=Math.pow,a=Math.abs,s=e/c;t=t?Math.min(t,e/10):e/10;var n=i/t;switch(this.options.unitModification){case'time':case'time:min.sec':{let e=!1,t,i,r,a;for(t=0,i=this.unitModificationTimeTicks.length;tthis.getForcedMax()||e===void 0))&&(e=this.getMaxValue()),this.currentAxisMax=e,this.options.logScale&&(this.currentAxisMax=Math.max(1e-50,e)),this.cacheCurrentMax(),this.cacheInterval(),this.graph._axisHasChanged(this)}flip(e){return this.options.flipped=e,this.setMinMaxFlipped(),this}isFlipped(){return this.options.flipped}_draw(){var e=Math.abs,t=this;(void 0===this.currentAxisMin||void 0===this.currentAxisMax)&&this.setMinMaxToFitSeries(!0);var i=e(this.getMaxPx()-this.getMinPx()),r=this.getCurrentInterval();if(!this.isShown())return this.line.setAttribute('display','none'),0;this.line.setAttribute('display','block'),this.scientificExponent=!0==this.options.scientificScale?this.options.scientificScaleExponent?this.options.scientificScaleExponent:Math.floor(Math.log(Math.max(e(this.getCurrentMax()),e(this.getCurrentMin())))/2.302585092994046):0,this.gridLinePath.primary='',this.gridLinePath.secondary='';let a;if(!this.options.useKatexForLabel||!this.graph.hasKatexRenderer())this.options.unitDecade&&this.options.unit&&0!==this.scientificExponent&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent))&&(a=this.getExponentGreekLetter(this.scientificExponent))?(this.preunit=a,this.unitTspan.setAttribute('dx',0)):0===this.scientificExponent||isNaN(this.scientificExponent)?(!this.options.unit&&this.unitTspan.setAttribute('display','none'),this.preunit='',this.expTspan.setAttribute('display','none'),this.expTspanExp.setAttribute('display','none')):(this.options.engineeringScale&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent)),this.preunit='',this.expTspan.setAttribute('display','visible'),this.expTspanExp.setAttribute('display','visible'),this.expTspan.textContent='x10',this.expTspanExp.textContent=this.scientificExponent),this.writeUnit();else{let e=this.getLabel();this.options.unitDecade&&this.options.unit&&0!==this.scientificExponent&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent))&&(a=this.getExponentGreekLetter(this.scientificExponent))?(e+=a,this.preunitTspan.innerHTML=a,this.preunitTspan.setAttribute('display','visible'),this.unitTspan.setAttribute('dx',0),e+=' '+a+' '+this.options.unit):0!==this.scientificExponent&&!isNaN(this.scientificExponent)&&(this.options.engineeringScale&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent)),e+=' \\cdot 10^'+this.scientificExponent+' '+this.options.unit),this.katexElement=this.graph.renderWithKatex(e,this.katexElement)}if(!!this.options.hideTicks)var s=0;else if(this.resetTicksLength(),this.linkedToAxis){this.linkedToAxis.deltaPx=10;var s=this.drawLinkedToAxisTicksWrapper(i,r)}else if(!this.options.logScale)var s=this.drawLinearTicksWrapper(i,r);else var s=this.drawLogTicks();this.removeUselessTicks(),this.removeUselessTickLabels(),this.gridPrimary.setAttribute('d',this.gridLinePath.primary),this.gridSecondary.setAttribute('d',this.gridLinePath.secondary);var n=this.graph.findAxesLinkedTo(this);return n.forEach(function(e){e.linkedToAxis&&(e.setMinPx(t.getMinPx()),e.setMaxPx(t.getMaxPx()),e.draw())}),s}drawLines(){this.options.lineAt&&Array.isArray(this.options.lineAt)&&this.options.lineAt.forEach((e,t)=>{!isNaN(e)&&this.getCurrentMin()<=e&&this.getCurrentMax()>=e?this._lines[t]=this._drawLine(e,this._lines[t]):this._hideLine(this._lines[t])})}writeUnit(){this.options.unit?(this.unitTspan.setAttribute('display','visible'),this.unitTspan.setAttribute('dx',5),this.expTspan.setAttribute('display','none'),this.expTspanExp.setAttribute('display','none'),this.unitTspan.innerHTML=(this.options.unitWrapperBefore+this.preunit+this.options.unit+this.options.unitWrapperAfter).replace(/\^([-+0-9]*)(.*)/g,'$1$2')):this.unitTspan.setAttribute('display','none')}getExponentGreekLetter(e){return 3===e?'k':6===e?'M':9===e?'G':12===e?'T':15===e?'E':-3===e?'m':-6===e?'μ':-9===e?'n':-12===e?'p':-15===e?'f':''}drawLinearTicksWrapper(e,t){let i;return this.options.primaryTickUnit?i=this.options.primaryTickUnit:(i=this.getUnitPerTick(e,this.getNbTicksPrimary(),t)[0],this.options.maxPrimaryTickUnit&&this.options.maxPrimaryTickUniti&&(i=this.options.minPrimaryTickUnit)),this.drawTicks(i,this.secondaryTicks())}forcePrimaryTickUnit(e){this.options.primaryTickUnit=e}forcePrimaryTickUnitMax(e){this.options.maxPrimaryTickUnit=e}forcePrimaryTickUnitMin(e){this.options.minPrimaryTickUnit=e}getPrimaryTickUnit(){return this.incrTick}setTickLabelRatio(e){this.options.ticklabelratio=e}doesHideWhenNoSeriesShown(){return this.options.hideWhenNoSeriesShown}draw(){this._widthLabels=0;var e=this._draw();return this._widthLabels+=e,e}drawTicks(e,t){var i=e,r=this.getCurrentMin(),a=this.getCurrentMax(),s=0,n,o,l;for(t&&(n=i/t),o=this.options.shiftToZero?this.dataMin-Math.ceil((this.dataMin-r)/i)*i:Math.floor(r/i)*i,this.incrTick=e;o<=a&&(s++,!(200a){l+=n;continue}this.drawTickWrapper(l,!1,1e-4>Math.abs(l-o-i/2)?2:3),l+=n}}if(oa){o+=e;continue}this.drawTickWrapper(o,!0,1),o+=e}return this.widthHeightTick=this.getMaxSizeTick(),this.widthHeightTick}nextTick(e,t){if(this.ticks[e]=this.ticks[e]||[],this.lastCurrentTick[e]=this.lastCurrentTick[e]||0,this.currentTick[e]=this.currentTick[e]||0,this.currentTick[e]>=this.ticks[e].length){var i=document.createElementNS(this.graph.ns,'line');this.groupTicks.appendChild(i),this.ticks[e].push(i),t(i)}var i=this.ticks[e][this.currentTick[e]];return this.currentTick[e]>=this.lastCurrentTick[e]&&i.setAttribute('display','visible'),this.currentTick[e]++,i}nextTickLabel(e){if(this.ticksLabels=this.ticksLabels||[],this.lastCurrentTickLabel=this.lastCurrentTickLabel||0,this.currentTickLabel=this.currentTickLabel||0,this.currentTickLabel>=this.ticksLabels.length){var t=document.createElementNS(this.graph.ns,'text');this.groupTickLabels.appendChild(t),this.ticksLabels.push(t),e(t)}var t=this.ticksLabels[this.currentTickLabel];return this.currentTickLabel>=this.lastCurrentTickLabel&&t.setAttribute('display','visible'),this.currentTickLabel++,t}removeUselessTicks(){for(var e in this.currentTick){for(var t=this.currentTick[e];ta&&(a=1e-50),20a&&(a=0);for(var n=0==a?0:Math.floor(t(a)/2.302585092994046),a=1,o;(o=a*e(10,n))i&&this.drawTickWrapper(o,!0,1,s),10==a?(a=1,n++):(1!=a&&o>i&&this.drawTickWrapper(o,!1,2,{overwrite:'',fontSize:'0.6em'}),a++);return this.widthHeightTick=this.getMaxSizeTick(),this.widthHeightTick}drawTickWrapper(e,t,i,r){this.drawTick(e,i,r)}linkToAxis(e,t,i){this.linkedToAxis={axis:e,scalingFunction:t,decimals:i||1}}drawLinkedToAxisTicksWrapper(e,i){var r=this.linkedToAxis,a=0,s,n,o,l;r.deltaPx||(r.deltaPx=10);do{if(s=r.scalingFunction(r.axis.getVal(a+this.getMinPx())),r.decimals&&(this.decimals=r.decimals),n=this.drawTick(s,1,{},a+this.getMinPx()),!n)throw console.error(s,a,this.getMinPx()),new Error('Unable to draw tick. Please report the test-case');if(o=8*(n[1].textContent+'').length,l=5*Math.round(o/5),l>r.deltaPx)return r.deltaPx=l,void this.drawLinkedToAxisTicksWrapper(e,i);a+=r.deltaPx}while(ae)){var e=(t(e)-t(this.getCurrentMin()))/(t(this.getCurrentMax())-t(this.getCurrentMin()))*(this.getMaxPx()-this.getMinPx())+this.getMinPx();return e}}getRoundedPx(e){return Math.round(10*this.getPx(e))/10}getVal(e){var t=Math.log;return this.options.logScale?Math.exp((e-this.getMinPx())/(this.getMaxPx()-this.getMinPx())*(t(this.getCurrentMax())-t(this.getCurrentMin()))+t(this.getCurrentMin())):(e-this.getMinPx())/(this.getMaxPx()-this.getMinPx())*this.getCurrentInterval()+this.getCurrentMin()}getRelPx(e){return e/this.getCurrentInterval()*(this.getMaxPx()-this.getMinPx())}getRelVal(e){return e/(this.getMaxPx()-this.getMinPx())*this.getCurrentInterval()}valueToText(e){var t=Math.pow;if(this.scientificExponent)return e/=t(10,this.scientificExponent),e.toFixed(1);if(e=e*t(10,this.getExponentialFactor())*t(10,this.getExponentialLabelFactor()),this.options.shiftToZero&&(e-=this.dataMin),this.options.ticklabelratio&&(e*=this.options.ticklabelratio),this.options.unitModification)return e=this.modifyUnit(e,this.options.unitModification),e;var i=this.decimals-this.getExponentialFactor()-this.getExponentialLabelFactor();return isNaN(e)?'':(e=0'+this.scientificExponent+''),this.options.unit&&!i&&(r+=this.options.unit.replace(/\^([-+0-9]*)/g,'$1')),r}getModifiedValue(e){return this.options.ticklabelratio&&(e*=this.options.ticklabelratio),this.options.shiftToZero&&(e-=this.getMinValue()*(this.options.ticklabelratio||1)),e}modifyUnit(e,t){var i=Math.floor,r=Math.round,a='',n=this.incrTick,o;switch(t){case'time':var l=this.getModifiedValue(this.getMaxValue()),p=[[60,'min'],[3600,'h'],[86400,'d']];if(3600>l?o=0:86400>l?o=1:2592000>l&&(o=2),!p[o])return!1;e/=p[o][0];var d=i(e);for(a=d+p[o][1],o--;n<1*p[o+1][0]&&-1{t.setAttribute('fill',e)}),this}getTicksLabelColor(){return this.options.ticksLabelColor||'black'}setPrimaryGridColor(e){return this.options.primaryGridColor=e,this.setGridLinesStyle(),this}getPrimaryGridColor(){return this.options.primaryGridColor}setSecondaryGridColor(e){return this.options.secondaryGridColor=e,this.setGridLinesStyle(),this}getSecondaryGridColor(){return this.options.secondaryGridColor}setPrimaryGridWidth(e){return this.options.primaryGridWidth=e,this.setGridLinesStyle(),this}getPrimaryGridWidth(){return this.options.primaryGridWidth}setSecondaryGridWidth(e){return this.options.secondaryGridWidth=e,this.setGridLinesStyle(),this}getSecondaryGridWidth(){return this.options.secondaryGridWidth}setPrimaryGridOpacity(e){return this.options.primaryGridOpacity=e,this}getPrimaryGridOpacity(){return this.options.primaryGridOpacity}setSecondaryGridOpacity(e){return this.options.secondaryGridOpacity=e,this}getSecondaryGridOpacity(){return this.options.secondaryGridOpacity}setPrimaryGridDasharray(e){return this.options.primaryGridDasharray=e,this}getPrimaryGridDasharray(){return this.options.primaryGridDasharray}setSecondaryGridDasharray(e){return this.options.secondaryGridDasharray=e,this}getSecondaryGridDasharray(){return this.options.secondaryGridDasharray}setLabelColor(e){return this.options.labelColor=e,this}getLabelColor(){return this.options.labelColor}setTickContent(e,t,i){if(i||(i={}),i.overwrite||!i.exponential)e.textContent=i.overwrite||this.valueToText(t);else{var r=Math.round(Math.log(t)/2.302585092994046),a=Math.floor(t*Math.pow(10,-r));e.textContent=1==a?'10':a+'x10';var s=document.createElementNS(this.graph.ns,'tspan');s.textContent=r,s.setAttribute('font-size','0.7em'),s.setAttribute('dy',-5),e.appendChild(s)}i.fontSize&&e.setAttribute('font-size',i.fontSize)}isX(){return!1}isY(){return!1}setUnit(e){return this.options.unit=e,this}setUnitInTicks(e){return this.options.unitInTicks=e,this}setUnitWrapper(e,t){return this.options.unitWrapperBefore=e,this.options.unitWrapperAfter=t,this}setUnitDecade(e){return this.options.unitDecade=e,this}setScientific(e){return this.options.scientificScale=e,this}setScientificScaleExponent(e){return this.options.scientificScaleExponent=e,this}setEngineering(e){return this.options.scientificScale=e,this.options.engineeringScale=e,this}getEngineeringExponent(e){return e-=0{e.setAttribute('y',(a.top?-1:1)*((1==a.options.tickPosition?8:20)+(a.top?10:0))+this.options.tickLabelOffset),e.setAttribute('text-anchor','middle'),'black'!==a.getTicksLabelColor()&&e.setAttribute('fill',a.getTicksLabelColor()),e.style.dominantBaseline='hanging'});o.setAttribute('x',s),this.setTickContent(o,e,i)}return[n,o]}}drawLabel(){'black'!==this.getLabelColor()&&this.label.setAttribute('fill',this.getLabelColor()),this.options.labelFont&&this.label.setAttribute('font-family',this.options.labelFont),this.label.setAttribute('text-anchor','middle'),this.label.setAttribute('style','display: initial;'),this.label.setAttribute('x',Math.abs(this.getMaxPx()+this.getMinPx())/2),this.label.setAttribute('y',(this.top?-1:1)*((1==this.options.tickPosition?10:25)+this.graph.options.fontSize)),this.labelTspan.textContent=this.getLabel()}draw(){var e=super.draw(...arguments);return this.drawSpecifics(),e}drawSpecifics(){this.drawLabel(),this.line.setAttribute('x1',this.getMinPx()),this.line.setAttribute('x2',this.getMaxPx()),this.line.setAttribute('y1',0),this.line.setAttribute('y2',0),this.line.setAttribute('stroke',this.getAxisColor()),this.top||(this.labelTspan.style.dominantBaseline='hanging',this.expTspan.style.dominantBaseline='hanging',this.expTspanExp.style.dominantBaseline='hanging',this.unitTspan.style.dominantBaseline='hanging');var e=this.getSpan();this.line.setAttribute('marker-start',this.options.splitMarks&&0!=e[0]?'url(#horionzalsplit_'+this.graph.getId()+')':''),this.line.setAttribute('marker-end',this.options.splitMarks&&1!=e[1]?'url(#horionzalsplit_'+this.graph.getId()+')':'')}_drawLine(e,t){let i=this.getPx(e);return t?t.setAttribute('display','initial'):t=document.createElementNS(this.graph.ns,'line'),t.setAttribute('x1',i),t.setAttribute('x2',i),t.setAttribute('y1',0),t.setAttribute('y2',this.graph.drawingSpaceHeight),t.setAttribute('stroke','black'),this.group.appendChild(t),t}_hideLine(e){e&&e.setAttribute('display','none')}handleMouseMoveLocal(e){e-=this.graph.getPaddingLeft(),this.mouseVal=this.getVal(e)}setMinMaxFlipped(){var e=this.maxPx-this.minPx;if(!isNaN(e)){var t=e*this.options.span[1]+this.minPx-this.options.marginMax,i=e*this.options.span[0]+this.minPx+this.options.marginMin;this.minPxFlipped=this.isFlipped()?t:i,this.maxPxFlipped=this.isFlipped()?i:t}}getZProj(e){return e*this.graph.options.zAxis.shiftX}}class AxisY extends Axis{constructor(e,t,i){super(e,t,i),this.leftright=t,this.left='left'==t}setAxisPosition(e){this.shiftPosition=e}getAxisPosition(){return this.shiftPosition||0}getAdditionalWidth(){let e=0;return this.getLabel()&&(e+=this.graph.options.fontSize),this.isShown()&&(e+=Math.abs(this.tickMargin)),e}isX(){return!1}isY(){return!0}resetTicksLength(){this.longestTick=[!1,0]}getMaxSizeTick(){return this.longestTick&&this.longestTick[0]?this.longestTick[0].getComputedTextLength()+5:0}draw(){this.tickMargin=this.left?-5-this.tickPx1*this.tickScaling[1]:2-this.tickPx1*this.tickScaling[1];var e=super.draw(...arguments);return e+=this.getAdditionalWidth(),this.drawSpecifics(e),this.fullwidthlabel=e,e}equalizePosition(e){return this.placeLabel(this.left?-e:e),this.getLabel()?e+this.graph.options.fontSize:0}drawTick(e,t,i,r){let a,s,n;a=r||this.getPos(e);void 0==a||isNaN(a)||(s=this.nextTick(t,(e)=>{e.setAttribute('x1',(this.left?1:-1)*this.tickPx1*this.tickScaling[t]),e.setAttribute('x2',(this.left?1:-1)*this.tickPx2*this.tickScaling[t]),1==t?e.setAttribute('stroke',this.getPrimaryTicksColor()):e.setAttribute('stroke',this.getSecondaryTicksColor())}),s.setAttribute('y1',a),s.setAttribute('y2',a),this.nextGridLine(1==t,0,this.graph.getDrawingWidth(),a,a),1==t&&(n=this.nextTickLabel((e)=>{e.setAttribute('x',this.tickMargin+this.options.tickLabelOffset),'black'!==this.getTicksLabelColor()&&e.setAttribute('fill',this.getTicksLabelColor()),this.left?e.setAttribute('text-anchor','end'):e.setAttribute('text-anchor','start'),e.style.dominantBaseline='central'}),n.setAttribute('y',a),this.setTickContent(n,e,i),(n.textContent+'').length>=this.longestTick[1]&&(this.longestTick[0]=n,this.longestTick[1]=(n.textContent+'').length)))}drawLabel(){'black'!==this.getLabelColor()&&this.label.setAttribute('fill',this.getLabelColor()),this.label.setAttribute('dominant-baseline',this.left?'auto':'auto'),this.labelTspan.textContent=this.getLabel()}placeLabel(e){this.label.setAttribute('transform','translate('+e+', '+Math.abs(this.getMaxPx()+this.getMinPx())/2+') rotate(-90)')}drawSpecifics(){this.line.setAttribute('y1',this.getMinPx()),this.line.setAttribute('y2',this.getMaxPx()),this.line.setAttribute('x1',0),this.line.setAttribute('x2',0),this.line.setAttribute('stroke',this.getAxisColor());var e=this.getSpan();this.line.setAttribute('marker-start',this.options.splitMarks&&0!=e[0]?'url(#verticalsplit_'+this.graph.getId()+')':''),this.line.setAttribute('marker-end',this.options.splitMarks&&1!=e[1]?'url(#verticalsplit_'+this.graph.getId()+')':'')}setShift(e){if(this.shift=e,!this.shift||!this.graph.getWidth())return;let t=this.shift;t=this.floating?t:this.isLeft()?t:this.graph.getWidth()-this.graph.getPaddingRight()-this.graph.getPaddingLeft()-t,this.group.setAttribute('transform','translate( '+t+' 0 )'),this.drawLabel()}isLeft(){return this.left}isRight(){return!this.left}isFlipped(){return!this.options.flipped}_drawLine(e,t){let i=this.getPx(e);return t?t.setAttribute('display','initial'):t=document.createElementNS(this.graph.ns,'line'),t.setAttribute('y1',i),t.setAttribute('y2',i),t.setAttribute('x1',0),t.setAttribute('x2',this.graph.drawingSpaceWidth),t.setAttribute('stroke','black'),this.group.appendChild(t),t}_hideLine(e){e&&e.setAttribute('display','none')}handleMouseMoveLocal(e,t){t-=this.graph.getPaddingTop(),this.mouseVal=this.getVal(t)}scaleToFitAxis(e,t,r,a,s,n){e&&e.isX()||(e=this.graph.getXAxis()),isNaN(r)&&(r=e.getCurrentMin()),isNaN(a)&&(a=e.getCurrentMax()),s===void 0&&(s=!0),n===void 0&&(n=!0),'number'==typeof t&&(a=r,r=t,t=!1);for(var o=-Infinity,p=Infinity,d=0,g=0,i=this.graph.series.length;g{let r=i.getUsedCategories();for(let a of r)e.hasOwnProperty(a)||(e[a]=1,t+=1),e[a]++,t++});let r=0;for(let t in e){let i=e[t];e[t]=r,r+=i}let i={};Array.prototype.map.call(this.series,(r)=>{let a=r.getUsedCategories(),s={};a.forEach((r)=>{i[r]=i[r]||0.5,s[r]=(e[r]+i[r])/t,i[r]++}),r.setDataIndices(s,t)})}getType(){return'category'}}var axisFormat=[{threshold:20,increments:{1:{increment:1,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:1,unit:'s',format:'MM:ss"s"'}}},{threshold:50,increments:{1:{increment:1,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:2,unit:'s',format:'MM:ss"s"'}}},{threshold:100,increments:{1:{increment:1,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:5,unit:'s',format:'MM:ss"s"'}}},{threshold:600,increments:{1:{increment:10,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:30,unit:'s',format:'MM:ss"s"'}}},{threshold:1e3,increments:{1:{increment:1,unit:'h',format:'HH"h"MM (dd/mm/yy)'},2:{increment:10,unit:'i',format:'MM"min"'}}},{threshold:1500,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:1,unit:'i',format:'H"h"MM'}}},{threshold:3e3,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:2,unit:'i',format:'H"h"MM'}}},{threshold:8e3,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:10,unit:'i',format:'H"h"MM'}}},{threshold:26400,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:20,unit:'i',format:'H"h"MM'}}},{threshold:86400,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:1,unit:'h',format:'H"h"MM'}}},{threshold:2e5,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:2,unit:'h',format:'H"h"MM'}}},{threshold:4e5,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:6,unit:'h',format:'H"h"MM'}}},{threshold:1.4e6,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:12,unit:'h',format:'HH"h"MM'}}},{threshold:6.4e6,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:1,unit:'d',format:'dd'}}},{threshold:1.24e7,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:2,unit:'d',format:'dd'}}},{threshold:43200000,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:7,unit:'d',format:'dd'}}},{threshold:69120000,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:15,unit:'d',format:'dd'}}},{threshold:86400000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:3,unit:'m',format:'mm/yyyy'}}},{threshold:172800000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:4,unit:'m',format:'mm/yyyy'}}},{threshold:864000000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:6,unit:'m',format:'mm/yyyy'}}},{threshold:1036800000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:1,unit:'y',format:'yyyy'}}}],dateFormat=function(){var e=Math.abs,t=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[WLloSZ]|"[^"]*"|'[^']*'/g,i=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,r=/[^-+\dA-Z]/g,a=function(e,t){for(e+='',t=t||2;e.lengthA?'a':'p',tt:12>A?'am':'pm',T:12>A?'A':'P',TT:12>A?'AM':'PM',Z:g?'UTC':((l+'').match(i)||['']).pop().replace(r,''),o:(0a)return void hideGroup(t);t.line.setAttribute('x1',s),t.line.setAttribute('x2',s),t.text.setAttribute('x',s),t.text.textContent=i;break;default:case 1:var p=o(r,l(a,s)),d=o(r,l(a,n));if(isNaN(d)||isNaN(p))return;for(t.line1.setAttribute('x1',p),t.line2.setAttribute('x1',d),t.line1.setAttribute('x2',p),t.line2.setAttribute('x2',d),t.text.setAttribute('x',(p+d)/2);8*i.length>d-p;)if(i=i.substr(0,i.length-2)+'.',1==i.length){i='';break}t.text.textContent=i;}}class GraphTimeAxis extends Axis{constructor(){super(...arguments)}init(e,t){super.init(e,t),this.wrapper={1:document.createElementNS(e.ns,'g'),2:document.createElementNS(e.ns,'g')},this.groups={1:[],2:[]};var i=document.createElementNS(e.ns,'rect');i.setAttribute('fill','#c0c0c0'),i.setAttribute('stroke','#808080'),i.setAttribute('height','20'),i.setAttribute('x','0'),i.setAttribute('y','0'),this.rect=i,this.wrapper[1].appendChild(this.rect),this.group.appendChild(this.wrapper[1]),this.group.appendChild(this.wrapper[2]),this.wrapper[1].setAttribute('transform','translate( 0, 25 )'),this.wrapper[2].setAttribute('transform','translate( 0, 00 )')}draw(){this.cacheCurrentMax(),this.cacheCurrentMin(),(void 0==this.currentAxisMin||void 0==this.currentAxisMax)&&this.setMinMaxToFitSeries(!0),this.line.setAttribute('x1',this.getMinPx()),this.line.setAttribute('x2',this.getMaxPx()),this.line.setAttribute('y1',0),this.line.setAttribute('y2',0);var e=this.maxPx-this.minPx,t=this.getCurrentInterval(),r=this.getCurrentMax(),a=this.getCurrentMin();if(this.rect.setAttribute('width',e),this.rect.setAttribute('x',this.minPx),!r||!a)return 0;var s;for(u=0;ut/e){s=axisFormat[u];break}s||(s=axisFormat[axisFormat.length-1]);var n=0,o,l,p,d,g,c,u;for(n=1;2>=n;n++){if(!isNumeric$1(a)){hideGroups(this,n,0);break}p=new Date(a),d=roundDate(p,s.increments[n]),u=0;do if(g=getDateText(d,s.increments[n].format),c=getGroup(this,n,u),o=this.getPx(d.getTime()),d=incrementDate(d,s.increments[n]),l=this.getPx(d.getTime()),renderGroup(n,c,g,this.getMinPx(),this.getMaxPx(),o,l),u++,100{e.redraw()}),this.emit('draw')}setData(e){if(e instanceof Waveform)return this.setWaveform(e);throw'Setting data other than waveforms in not supported by default. You must implemented this method in the inherited class.'}_addData(){return[]}clearData(){return this.setData(new Waveform),this}getData(){return this.data}setOptions(e){this.options=e||{}}setOption(e,t){this.options[e]=t}kill(e){return this.graph.removeSerieFromDom(this),this.graph._removeSerie(this),this.graph.legend&&!e&&this.graph.legend.update(),this.graph=void 0,this}hide(e,t=!1){if(this.hidden=!0,this.groupMain.setAttribute('display','none'),this.getSymbolForLegend().setAttribute('opacity',0.5),this.getTextForLegend().setAttribute('opacity',0.5),this.hideImpl(),e)for(var r=this.graph.getShapesOfSerie(this),a=0,i=r.length;ae;e++)arguments[e]&&this[arguments[e].isX()?'setXAxis':'setYAxis'](arguments[e]);return this.graph.updateDataMinMaxAxes(),this}getXAxis(){return this.xaxis}getYAxis(){return this.yaxis}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getWaveform(){return this.waveform}getWaveforms(){return[this.waveform]}setWaveform(e){if(!(e instanceof Waveform))throw'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance';return this.waveform=e,this.minX=this.waveform.getXMin(),this.maxX=this.waveform.getXMax(),this.minY=this.waveform.getMin(),this.maxY=this.waveform.getMax(),this.graph.updateDataMinMaxAxes(),this.dataHasChanged(),this}getSymbolForLegend(){if(!this.lineForLegend){var e=document.createElementNS(this.graph.ns,'line');this.applyLineStyle(e),e.setAttribute('x1',5),e.setAttribute('x2',25),e.setAttribute('y1',0),e.setAttribute('y2',0),e.setAttribute('cursor','pointer'),this.lineForLegend=e}return this.lineForLegend}setLegendSymbolStyle(){this.applyLineStyle(this.getSymbolForLegend())}updateStyle(){this.setLegendSymbolStyle(),this.graph.updateLegend()}getTextForLegend(){if(!this.textForLegend){var e=document.createElementNS(this.graph.ns,'text');e.setAttribute('cursor','pointer'),e.textContent=this.getLabel(),this.textForLegend=e}return this.textForLegend}getIndex(){return this.graph.series.indexOf(this)}getLabel(){return this.options.label||this.name}setLabel(e){return this.options.label=e,this.textForLegend&&(this.textForLegend.textContent=e),this.graph.requireLegendUpdate(),this}setFlip(e){return this.options.flip=e,this}getFlip(){return this.options.flip}isFlipped(){return this.options.flip}setLayer(e){let t=parseInt(e)||1;return t!==this.options.layer&&(this.options.layer=t,this.graph.appendSerieToDom(this)),this}getLayer(){return this.options.layer||1}setStyle(e,t='unselected'){this.styles[t]=e,this.styleHasChanged(t)}styleHasChanged(e='unselected'){if(this._changedStyles=this._changedStyles||{},!1===e)for(var t in this._changedStyles)this._changedStyles[t]=!1;else this._changedStyles[e||'unselected']=!0;return this.graph.requireLegendUpdate(),this}hasStyleChanged(e){return this._changedStyles=this._changedStyles||{},this._changedStyles[e||'unselected']}dataHasChanged(e){return this._dataHasChanged=void 0===e||e,this}hasDataChanged(){return this._dataHasChanged}setInfo(e,t){return this.infos=this.infos||{},this.infos[e]=t,this}getInfo(e){return(this.infos||{})[e]}setAdditionalData(e){return this.additionalData=e,this}getAdditionalData(){return this.additionalData}select(){return this.selected=!0,this}unselect(){return this.selected=!1,this}enableTracking(e,t){return this._tracker=!0,this._trackingCallback=e,this._trackingOutCallback=t,this}disableTracking(){return this._trackerDom&&(this._trackerDom.remove(),this._trackerDom=null),this._tracker=!1,this._trackingCallback=null,this}allowTrackingLine(e){e=e||{},this.graph.addSerieToTrackingLine(this,e)}getMarkerForLegend(){return!1}get type(){return this._type}getType(){return this._type}set excludedFromLegend(e){this._excludedFromLegend=e}get excludedFromLegend(){return!!this._excludedFromLegend}setDataIndices(e,t){this.categoryIndices=e,this.nbCategories=t}hasErrors(){return!!this.waveform&&this.waveform.hasErrorBars()}}var ErrorBarMixin={makeBarY:function(e,t,i){if(e&&void 0!==i){var r=isNumeric$1(i.width)?i.width:10;return' V '+e+' m -'+r/2+' 0 h '+r+' m -'+r/2+' 0 V '+t+' '}},makeBoxY:function(e,t,i){return e&&void 0!==i?' m 5 0 V '+e+' h -10 V '+t+' m 5 0 ':void 0},makeBarX:function(e,t,i){if(e&&void 0!==i){var r=isNumeric$1(i.width)?i.width:10;return' H '+e+' m 0 -'+r/2+' v '+r+' m 0 -'+r/2+' H '+t+' '}},makeBoxX:function(e,t,i){return e&&void 0!==i?' v 5 H '+e+' v -10 H '+t+' v 5 ':void 0},setErrorBarStyle:function(e){return this.errorbarStyle=this._setErrorStyle(e),this},setErrorBoxStyle:function(e){return this.errorboxStyle=this._setErrorStyle(e),this},_setErrorStyle(e={}){var t=[],i=[['y','top','bottom'],['x','left','right']],r=(e)=>{e.dom=document.createElementNS(this.graph.ns,'path'),e.dom.setAttribute('fill',e.fillColor||'none'),e.dom.setAttribute('stroke',e.strokeColor||'black'),e.dom.setAttribute('stroke-opacity',e.strokeOpacity||1),e.dom.setAttribute('fill-opacity',e.fillOpacity||1),e.dom.setAttribute('stroke-width',e.strokeWidth||1),this.groupMain.appendChild(e.dom)},t={};'string'==typeof e&&(e={});for(var a=0,s=i.length;a=n;n++)e[i[a][n]]&&(t[i[a][n]]=e[i[a][n]],r(t[i[a][n]]))}return t},errorDrawInit:function(){this.errorboxStyle&&(this.errorboxStyle.paths={top:'',bottom:'',left:'',right:''}),this.errorbarStyle&&(this.errorbarStyle.paths={top:'',bottom:'',left:'',right:''})},errorAddPoint:function(e,t,i,r,a){let s;(s=this.waveform.getErrorBarXBelow(e))&&(this.errorbarStyle.paths.left+=' M '+r+' '+a,this.errorbarStyle.paths.left+=this.makeBarX(this.getX(t-s),r,this.errorbarStyle.left)),(s=this.waveform.getErrorBarXAbove(e))&&(this.errorbarStyle.paths.right+=' M '+r+' '+a,this.errorbarStyle.paths.right+=this.makeBarX(this.getX(t+s),r,this.errorbarStyle.right)),(s=this.waveform.getErrorBarYBelow(e))&&(this.errorbarStyle.paths.bottom+=' M '+r+' '+a,this.errorbarStyle.paths.bottom+=this.makeBarY(this.getY(i-s),a,this.errorbarStyle.bottom)),(s=this.waveform.getErrorBarYAbove(e))&&(this.errorbarStyle.paths.top+=' M '+r+' '+a,this.errorbarStyle.paths.top+=this.makeBarY(this.getY(i+s),a,this.errorbarStyle.top)),(s=this.waveform.getErrorBoxXBelow(e))&&(this.errorboxStyle.paths.left+=' M '+r+' '+a,this.errorboxStyle.paths.left+=this.makeBoxX(this.getX(t-s),r,this.errorboxStyle.left)),(s=this.waveform.getErrorBoxXAbove(e))&&(this.errorboxStyle.paths.right+=' M '+r+' '+a,this.errorboxStyle.paths.right+=this.makeBoxX(this.getX(t+s),r,this.errorboxStyle.right)),(s=this.waveform.getErrorBoxYBelow(e))&&(this.errorboxStyle.paths.bottom+=' M '+r+' '+a,this.errorboxStyle.paths.bottom+=this.makeBoxY(this.getY(i-s),a,this.errorboxStyle.bottom)),(s=this.waveform.getErrorBoxYAbove(e))&&(this.errorboxStyle.paths.top+=' M '+r+' '+a,this.errorboxStyle.paths.top+=this.makeBoxY(this.getY(i+s),a,this.errorboxStyle.top))},errorAddPointBarChart:function(e,t,i,r){var a;this.error&&(a=this.error[e])&&this.doErrorDraw('y',a,t,r,i,r)},errorDraw:function(){if(this.errorbarStyle)for(var e in this.errorbarStyle.paths)this.errorbarStyle[e]&&this.errorbarStyle[e].dom&&this.errorbarStyle[e].dom.setAttribute('d',this.errorbarStyle.paths[e]);if(this.errorboxStyle)for(var e in this.errorboxStyle.paths)this.errorboxStyle[e]&&this.errorboxStyle[e].dom&&this.errorboxStyle[e].dom.setAttribute('d',this.errorboxStyle.paths[e])}};class SerieLine extends Serie{static default(){return{lineColor:'black',lineStyle:1,flip:!1,label:'',lineWidth:1,markers:!1,trackMouse:!1,trackMouseLabel:!1,trackMouseLabelRouding:1,lineToZero:!1,selectableOnClick:!1,markersIndependant:!1,overflowX:!1,overflowY:!1}}constructor(){super(...arguments),this.selectionType='unselected',this.markerFamilies={},mapEventEmission(this.options,this),this.styles={},this.styles.unselected={lineColor:this.options.lineColor,lineStyle:this.options.lineStyle,lineWidth:this.options.lineWidth,markers:this.options.markers},this.styles.selected={lineWidth:3},this.extendStyles(),this.markersDom=new Map,this.shown=!0,this.data=[],this._isMinOrMax={x:{min:!1,max:!1},y:{min:!1,max:!1}},this.groupLines=document.createElementNS(this.graph.ns,'g'),this.domMarker=document.createElementNS(this.graph.ns,'path'),this.domMarker.style.cursor='pointer',this.groupMain=document.createElementNS(this.graph.ns,'g'),this.additionalData={},this.marker=document.createElementNS(this.graph.ns,'circle'),this.marker.setAttribute('fill','black'),this.marker.setAttribute('r',3),this.marker.setAttribute('display','none'),this.markerLabel=document.createElementNS(this.graph.ns,'text'),this.markerLabelSquare=document.createElementNS(this.graph.ns,'rect'),this.markerLabelSquare.setAttribute('fill','white'),this.domMarkerHover={},this.domMarkerSelect={},this.markerHovered=0,this.groupMarkerSelected=document.createElementNS(this.graph.ns,'g'),this.markerPoints={},this.lines=[],this.groupMain.appendChild(this.groupLines),this.groupMain.appendChild(this.marker),this.groupMain.appendChild(this.groupMarkerSelected),this.groupMain.appendChild(this.markerLabelSquare),this.groupMain.appendChild(this.markerLabel),this.groupMarkers=document.createElementNS(this.graph.ns,'g'),this.groupMain.appendChild(this.groupMarkers),this.independantMarkers=[],this.initExtended1&&this.initExtended1(),this.groupLines.addEventListener('click',()=>{this.options.selectableOnClick&&(this.isSelected()?this.graph.unselectSerie(this):this.graph.selectSerie(this))}),this.options.markers&&this.setMarkers(this.options.markers,'unselected')}setWaveform(e){if(!(e instanceof Waveform))throw'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance';return this.waveform=e,this.minX=this.waveform.getXMin(),this.maxX=this.waveform.getXMax(),this.minY=this.waveform.getMin(),this.maxY=this.waveform.getMax(),this.graph.updateDataMinMaxAxes(),this.dataHasChanged(),this}setOptions(e){return this.options=extend(!0,{},SerieLine.prototype.defaults,e||{}),this.styles.unselected={lineColor:this.options.lineColor,lineStyle:this.options.lineStyle,markers:this.options.markers},this.applyLineStyles(),this}onMouseOverMarker(t,e){this.toggleMarker(e,!0,!0);this.options.onMouseOverMarker&&this.options.onMouseOverMarker(e,!!this.infos&&(this.infos[e]||!1),[this.waveform.getX(e),this.waveform.getY(e)])}onMouseOutMarker(t,e){this.markersOffHover(),this.options.onMouseOutMarker&&this.options.onMouseOutMarker(e,!!this.infos&&(this.infos[e]||!1),[this.waveform.getX(e),this.waveform.getY(e)])}toggleMarker(e,t,r){let a=e;var i;'undefined'==typeof t&&(i=r?!this.domMarkerHover[e]:!this.domMarkerSelect[e]);var s=this['domMarker'+(r?'Hover':'Select')];if(i||!0===t){if(!s[e]){var n=document.createElementNS(this.graph.ns,'path');this.setMarkerStyleTo(n,this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(a)]),this['domMarker'+(r?'Hover':'Select')][e]=n,this.groupMarkerSelected.appendChild(n)}else n=s[e];let t=this.getX(this.waveform.getX(a)),i=this.getY(this.waveform.getY(a));n.setAttribute('d','M '+t+' '+i+' '+this.getMarkerPath(this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(a)],1)),r&&this.markerHovered++}else if((!i||!1===t)&&(r&&this.domMarkerHover[e]&&!this.domMarkerSelect[e]||this.domMarkerSelect[e])){if(!s[e])return;this.groupMarkerSelected.removeChild(s[e]),delete s[e],r&&this.markerHovered--}return i}markersOffHover(){for(var e in this.domMarkerHover)this.toggleMarker(e.split(','),!1,!0);return this}markersOffSelect(){for(var e in this.domMarkerSelect)this.toggleMarker(e.split(','),!1,!1);return this}onClickOnMarker(t,e){var i=this.toggleMarker(e);i&&this.options.onSelectMarker&&this.options.onSelectMarker(e,!!this.infos&&(this.infos[e[0]]||!1)),!i&&this.options.onUnselectMarker&&this.options.onUnselectMarker(e,!!this.infos&&(this.infos[e[0]]||!1)),this.options.onToggleMarker&&this.options.onToggleMarker(e,!!this.infos&&(this.infos[e[0]]||!1),i)}_getMarkerIndexFromEvent(t){var e=this.graph._getXY(t);return this.searchIndexByPxXY(e.x-this.graph.getPaddingLeft(),e.y-this.graph.getPaddingTop())}onMouseWheel(){}empty(){for(var e=0,t=this.lines.length;e{this.draw(e)}),!1;if(!1===r)return!1;this._dataToUse=this.waveform.getDataToUseFlat()}return!0}removeLinesGroup(){this._afterLinesGroup=this.groupLines.nextSibling,this.groupMain.removeChild(this.groupLines)}insertLinesGroup(){if(!this._afterLinesGroup)throw'Could not find group after lines to insertion.';this.groupMain.insertBefore(this.groupLines,this._afterLinesGroup),this._afterLinesGroup=!1}removeExtraLines(){for(var e=this.currentLineId,t=this.lines.length;ec.length&&(i=c.length));vd&&r>d||(!this.options.overflowY&&hg&&a>g)&&!this.options.lineToZero){r=u,a=h,S=!0;continue}if(this.counter2=v,C&&this.getMarkerCurrentFamily(this.counter2),y=this.getX(u),b=this.getY(h),y!=x||b!=m){if(y!=y||b!=b){0g):!this.options.overflowX&&(ud)||!this.options.overflowY&&(hg),this.options.lineToZero){if(k=ud,k)continue;}else if(k||S){!1!==r&&!1!==a||S?(Y=[],l=(u-o)/(u-r),_=h-l*(h-a),P=(u-d)/(u-r),L=h-P*(h-a),w=(h-p)/(h-a),E=u-w*(u-r),X=(h-g)/(h-a),T=u-X*(u-r),1>l&&0p&&Y.push([o,_]),1>P&&0p&&Y.push([d,L]),1>w&&0o&&Y.push([E,p]),1>X&&0o&&Y.push([T,g]),0{var e=this.graph._getXY(t),i=this.handleMouseMove(!1,!1);this._trackingCallback(this,i,e.x,e.y)}),this.groupMain.addEventListener('mouseleave',()=>{this._trackingOutCallback(this)})}return this}kill(){super.kill()}getMarkerCurrentFamily(e){if(this.markerPoints&&this.markerPoints[this.selectionType]){for(var t=0,i;t=e&&(this.markerCurrentFamily=this.markerPoints[this.selectionType][t][2],i=this.markerFamilies[this.selectionType][this.markerCurrentFamily]);return!!i&&(this.getMarkerDom(i),this.markerCurrentFamily)}}setMarkerStyleTo(e,t){if(!e||!t)throw console.trace(),'Cannot set marker style. DOM does not exist.';e.setAttribute('fill',t.fillColor||'transparent'),e.setAttribute('stroke',t.strokeColor||this.getLineColor()),e.setAttribute('stroke-width',t.strokeWidth||1)}hideTrackingMarker(){this.marker.setAttribute('display','none'),this.markerLabel.setAttribute('display','none'),this.markerLabelSquare.setAttribute('display','none')}_addPoint(e,t,i,r,a,s,n){if(e===e&&t===t)return 0==this.counter?this.currentLine='M ':this.options.lineToZero||s?this.currentLine+='M ':this.currentLine+='L ',this.currentLine+=e,this.currentLine+=' ',this.currentLine+=t,this.currentLine+=' ',this.options.lineToZero&&void 0!==this.pos0&&(this.currentLine+='L ',this.currentLine+=e,this.currentLine+=' ',this.currentLine+=this.pos0,this.currentLine+=' '),this.hasErrors()&&this.errorAddPoint(a,i,r,e,t),this.markerPoints?void(this.markersShown()&&!1!==n&&this.markerFamily&&drawMarkerXY(this,this.markerFamily[this.markerCurrentFamily],e,t,this.markersDom.get(this.markerFamily[this.markerCurrentFamily])),this.counter++):void this.counter++}_createLine(){var e=this.currentLineId++,t;return this.lines[e]?t=this.lines[e]:(t=document.createElementNS(this.graph.ns,'path'),this.applyLineStyle(t),this.groupLines.appendChild(t),this.lines[e]=t),0==this.counter?t.setAttribute('d',''):t.setAttribute('d',this.currentLine),this.currentLine='M ',this.counter=0,t}applyLineStyles(){for(var e=0;e{this.onMouseOverMarker(i,t)}),i.addEventListener('mouseout',(i)=>{this.onMouseOutMarker(i,t)}),i.addEventListener('click',(i)=>{this.onClickOnMarker(i,t)}),this.independantMarkers[t]=i}return this.groupMarkers.appendChild(this.independantMarkers[t]),this.independantMarkers[t]}searchIndexByPxXY(e,t){for(var i=Math.pow,r=!1,a=!1,s=this._xDataToUse,n=0,o=this.waveform.getLength(),l,p,d;nthis.waveform.getX(i)?0:1,Object.assign(r,{indexMin:i+a,indexMax:i+a+1,indexClosest:i,xMin:this.waveform.getX(i+a),xMax:this.waveform.getX(i+a+1),yMin:this.waveform.getY(i+a),yMax:this.waveform.getY(i+a+1),xClosest:this.waveform.getX(i),yClosest:this.waveform.getY(i),xExact:e}),r}}handleMouseMove(e,t,i){var r=e||this.getXAxis().getMouseVal(),a=i||this.getYAxis().getMouseVal(),s=this.searchClosestValue(r,a);if(s){var n;if(s.xMax==s.xMin&&(n=s.yMin),t&&this.options.trackMouse){if(void 0==s.xMin)return!1;if(!this.marker)return;var o=this.getX(this.getFlip()?s.yClosest:s.xClosest),l=this.getY(this.getFlip()?s.xClosest:s.yClosest);if(isNaN(o)||isNaN(l))return;switch(this.marker.setAttribute('display','block'),this.marker.setAttribute('cx',o),this.marker.setAttribute('cy',l),this.markerLabel.setAttribute('display','block'),this.markerLabelSquare.setAttribute('display','block'),this.options.trackMouseLabel){case!1:break;default:this.markerLabel.textContent=this.options.trackMouseLabel.replace('',r.toFixed(this.options.trackMouseLabelRouding)).replace('',n.toFixed(this.options.trackMouseLabelRouding));}this.markerLabel.setAttribute('x',o+5),this.markerLabel.setAttribute('y',l-5),this.markerLabelSquare.setAttribute('x',o+5),this.markerLabelSquare.setAttribute('y',l-5-this.graph.options.fontSize),this.markerLabelSquare.setAttribute('width',this.markerLabel.getComputedTextLength()+2),this.markerLabelSquare.setAttribute('height',this.graph.options.fontSize+2)}return{xBefore:s.xMin,xAfter:s.xMax,yBefore:s.yMin,yAfter:s.yMax,trueX:s.xExact,indexClosest:s.indexClosest,interpolatedY:n,xClosest:s.xClosest,yClosest:s.yClosest}}}getMax(e,t){var r=Math.max,a=Math.min(e,t),s=r(e,t),n=this.searchClosestValue(a),o=this.searchClosestValue(s),l=-Infinity,p,i,d,g;if(n||(a=this.minX,n=this.searchClosestValue(a)),o||(s=this.maxX,o=this.searchClosestValue(s)),!n||!o)return-Infinity;for(p=n.dataIndex;p<=o.dataIndex;p++)for(d=p==n.dataIndex?n.xBeforeIndexArr:0,g=p==o.dataIndex?o.xBeforeIndexArr:this.data[p].length,i=d;i<=g;i+=2)l=r(l,this.data[p][i+1]);return l}getMin(e,t){var r=Math.min,a=r(e,t),s=Math.max(e,t),n=this.searchClosestValue(a),o=this.searchClosestValue(s),l=Infinity,p,i,d,g;if(n||(a=this.minX,n=this.searchClosestValue(a)),o||(s=this.maxX,o=this.searchClosestValue(s)),!n||!o)return Infinity;for(p=n.dataIndex;p<=o.dataIndex;p++)for(d=p==n.dataIndex?n.xBeforeIndexArr:0,g=p==o.dataIndex?o.xBeforeIndexArr:this.data[p].length,i=d;i<=g;i+=2)l=r(l,this.data[p][i+1]);return l}setStyle(e,t='unselected'){this.styles[t]=e,this.styleHasChanged(t)}setLineStyle(e,t='unselected',i){return this.styles[t]=this.styles[t]||{},this.styles[t].lineStyle=e,i&&this.setLineStyle(e,'selected'),this.styleHasChanged(t),this}getLineStyle(e){return this.getStyle(e).lineStyle}getLineDashArray(e=this.selectionType||'unselected'){switch(this.getStyle(e).lineStyle){case 2:return'1, 1';break;case 3:return'2, 2';break;case 4:return'3, 3';break;case 5:return'4, 4';break;case 6:return'5, 5';break;case 7:return'5 2';break;case 8:return'2 5';break;case 9:return'4 2 4 4';break;case 10:return'1,3,1';break;case 11:return'9 2';break;case 12:return'2 9';break;case 1:case!1:return!1;break;default:return this.styles[e].lineStyle;}this.styleHasChanged(e)}getStyle(e=this.selectionType||'unselected'){return this.styles[e]}extendStyles(){for(var e in this.styles){var t=this.styles[e];t&&(this.styles[e]=extend(!0,{},this.styles.unselected,t))}}extendStyle(e,t){var i=this.styles[e];this.styles[e]=extend(!0,{},this.styles[t||'unselected'],i||{}),this.styles[e].markers.map(function(e){e.dom&&(e.dom='')}),this._recalculateMarkerPoints(e,this.styles[e].markers),this.styleHasChanged(e)}setLineWidth(e,t,i){return t=t||'unselected',this.styles[t]=this.styles[t]||{},this.styles[t].lineWidth=e,i&&this.setLineWidth(e,'selected'),this.styleHasChanged(t),this}getLineWidth(e){return this.getStyle(e).lineWidth||1}setLineColor(e,t,i){return t=t||'unselected',this.styles[t]=this.styles[t]||{},this.styles[t].lineColor=e,i&&this.setLineColor(e,'selected'),this.styleHasChanged(t),this}getLineColor(e){return this.getStyle(e).lineColor||'black'}showMarkers(e,t){return e=e||'unselected',this.styles[e]=this.styles[e]||{},this.styles[e].showMarkers=!0,t&&this._drawn?this.draw(!0):this.styleHasChanged(e),this}hideMarkers(e,t){return e=e||'unselected',this.styles[e].showMarkers=!1,t&&this._drawn?this.draw(!0):this.styleHasChanged(e),this}markersShown(e){return!1!==this.getStyle(e).showMarkers}areMarkersShown(){return this.markersShown.apply(this,arguments)}isMarkersShown(){return this.markersShown.apply(this,arguments)}setMarkers(e,t,i){return this.styles[t||'unselected']=this.styles[t||'unselected']||{},this.showMarkers(t,!1),Array.isArray(e)||'object'!=typeof e?!e&&(e=[{type:1,zoom:1,points:'all'}]):e=[e],this.styles[t||'unselected'].markers=e,i&&(this.styles.selected.markers=extend(!0,{},e)),this._recalculateMarkerPoints(t,e),this.styleHasChanged(t),this.dataHasChanged(!0),this}setMarkersPoints(e,t,i){this._extendMarkers('points',e,t,i,!0)}setMarkersColor(e,t,i){this._extendMarkers('color',e,t,i)}setMarkersType(e,t,i){this._extendMarkers('type',e,t,i)}setMarkersZoom(e,t,i){this._extendMarkers('zoom',e,t,i)}setMarkersStrokeColor(e,t,i){this._extendMarkers('strokeColor',e,t,i)}setMarkersStrokeWidth(e,t,i){this._extendMarkers('strokeWidth',e,t,i)}setMarkersFillColor(e,t,i){this._extendMarkers('fillColor',e,t,i)}_extendMarkers(e,t,i,r,a){(i=i||0,r=r||'unselected',this.styles[r]&&this.styles[r].markers)&&(this.styles[r].markers[i][e]=t,a&&this._recalculateMarkerPoints(r,this.styles[r].markers),this.markersDom[this.styles[r].markers[i]]&&this.setMarkerStyleTo(this.markersDom[this.styles[r].markers[i]].dom,this.styles[r].markers[i]))}_recalculateMarkerPoints(e,t){for(var r=[[0,Infinity,null]],a=0,i=t.length;an(e)):this.data[l].outliers=[];return this.dataHasChanged(),this.graph.updateDataMinMaxAxes(),this}_style(e,t,i='unselected',r=!1){return this.styles[i]=this.styles[i]||{},this.styles[i][e]=t,r&&this._set(e,t,'selected'),this.styleHasChanged(i),this}_gstyle(e,t){return this.getStyle(t)[e]}getStyle(e='unselected'){return this.styles[e]||{}}setMeanLineColor(){return this._style('meanLineColor',...arguments)}getMeanLineColor(){return this._gstyle('meanLineColor',...arguments)}setStyle(e,t='unselected'){this.styles[t]=extend({},this.default().defaultStyle,this.styles.unselected,e),this.styleHasChanged(t)}setMeanLineWidth(){return this._style('meanLineWidth',...arguments)}getMeanLineWidth(){return this._gstyle('meanLineWidth',...arguments)}setBoxAboveLineColor(){return this._style('boxAboveLineColor',...arguments)}getBoxAboveLineColor(){return this._gstyle('boxAboveLineColor',...arguments)}setBoxBelowLineColor(){return this._style('boxBelowLineColor',...arguments)}getBoxBelowLineColor(){return this._gstyle('boxBelowLineColor',...arguments)}setBoxAboveLineWidth(){return this._style('boxAboveLineWidth',...arguments)}getBoxAboveLineWidth(){return this._gstyle('boxAboveLineWidth',...arguments)}setBoxBelowLineWidth(){return this._style('boxBelowLineWidth',...arguments)}getBoxBelowLineWidth(){return this._gstyle('boxBelowLineWidth',...arguments)}setBoxAboveFillColor(){return this._style('boxAboveFillColor',...arguments)}getBoxAboveFillColor(){return this._gstyle('boxAboveFillColor',...arguments)}setBoxBelowFillColor(){return this._style('boxBelowFillColor',...arguments)}getBoxBelowFillColor(){return this._gstyle('boxBelowFillColor',...arguments)}setBoxAboveFillOpacity(){return this._style('boxAboveFillOpacity',...arguments)}getBoxAboveFillOpacity(){return this._gstyle('boxAboveFillOpacity',...arguments)}setBoxBelowFillOpacity(){return this._style('boxBelowFillOpacity',...arguments)}getBoxBelowFillOpacity(){return this._gstyle('boxBelowFillOpacity',...arguments)}setBarAboveLineColor(){return this._style('barAboveLineColor',...arguments)}getBarAboveLineColor(){return this._gstyle('barAboveLineColor',...arguments)}setBarBelowLineColor(){return this._style('barBelowLineColor',...arguments)}getBarBelowLineColor(){return this._gstyle('barBelowLineColor',...arguments)}setBarAboveLineWidth(){return this._style('barAboveLineWidth',...arguments)}getBarAboveLineWidth(){return this._gstyle('barAboveLineWidth',...arguments)}setBarBelowLineWidth(){return this._style('barBelowLineWidth',...arguments)}getBarBelowLineWidth(){return this._gstyle('barBelowLineWidth',...arguments)}setOutlierLineColor(){return this._style('outlierLineColor',...arguments)}getOutlierLineColor(){return this._gstyle('outlierLineColor',...arguments)}setOutlierLineWidth(){return this._style('outlierLineWidth',...arguments)}getOutlierLineWidth(){return this._gstyle('outlierLineWidth',...arguments)}setOutlierFillColor(){return this._style('outlierFillColor',...arguments)}getOutlierFillColor(){return this._gstyle('outlierFillColor',...arguments)}setOutlierFillOpacity(){return this._style('outlierFillOpacity',...arguments)}getOutlierFillOpacity(){return this._gstyle('outlierFillOpacity',...arguments)}applyLineStyles(){this.applyLineStyle(this.pathDom)}applyLineStyle(e){e.setAttribute('stroke',this.getLineColor()),e.setAttribute('stroke-width',this.getLineWidth()),e.removeAttribute('stroke-dasharray'),e.setAttribute('fill',this.getFillColor()),e.setAttribute('fill-opacity',this.getFillOpacity()||1)}draw(){if(!this.data)return;let e='y'==this.options.orientation?this.getYAxis():this.getXAxis(),t='y'==this.options.orientation?this.getXAxis():this.getYAxis(),r,a,s,n,o,p,d,g;if(emptyDom(this.groupMain),'category'==t.getType())a=t.getRelPx(0.8/this.nbCategories);else{a=this.options.maxBoxWidth;for(var c=0,i=this.data.length;c{te.getPos(t));var l=document.createElementNS(this.graph.ns,'line');this.applyMeanStyle(l);var u=document.createElementNS(this.graph.ns,'rect'),h=document.createElementNS(this.graph.ns,'rect');'y'==this.options.orientation?(u.setAttribute('width',a),u.setAttribute('x',r[0]-a/2),h.setAttribute('width',a),h.setAttribute('x',r[0]-a/2),l.setAttribute('x1',r[0]-a/2),l.setAttribute('x2',r[0]+a/2),l.setAttribute('y1',s),l.setAttribute('y2',s)):(u.setAttribute('height',a),u.setAttribute('y',r[0]-a/2),h.setAttribute('height',a),h.setAttribute('y',r[0]-a/2),l.setAttribute('y1',r[0]-a/2),l.setAttribute('y2',r[0]+a/2),l.setAttribute('x1',s),l.setAttribute('x2',s)),this.boxPos(u,s,n,'x'==this.options.orientation),this.boxPos(h,s,o,'x'==this.options.orientation),this.applyBoxStyle(u,h);var x=document.createElementNS(this.graph.ns,'line'),m=document.createElementNS(this.graph.ns,'line');'y'==this.options.orientation?(void 0!==p&&(x.setAttribute('y1',n),x.setAttribute('y2',p),x.setAttribute('x1',r[0]),x.setAttribute('x2',r[0])),void 0!==d&&(m.setAttribute('y1',o),m.setAttribute('y2',d),m.setAttribute('x1',r[0]),m.setAttribute('x2',r[0]))):(void 0!==p&&(x.setAttribute('x1',n),x.setAttribute('x2',p),x.setAttribute('y1',r[0]),x.setAttribute('y2',r[0])),void 0!==d&&(m.setAttribute('x1',o),m.setAttribute('x2',d),m.setAttribute('y1',r[0]),m.setAttribute('y2',r[0]))),g.map((e)=>{let t=document.createElementNS(this.graph.ns,'circle');t.setAttribute('r',2),'y'==this.options.orientation?(t.setAttribute('cx',r[0]),t.setAttribute('cy',e)):(t.setAttribute('cy',r[0]),t.setAttribute('cx',e)),this.setOutlierStyle(t),this.groupMain.appendChild(t)}),void 0!==p&&this.groupMain.appendChild(x),void 0!==d&&this.groupMain.appendChild(m),void 0!==n&&this.groupMain.appendChild(u),void 0!==o&&this.groupMain.appendChild(h),this.groupMain.appendChild(l),this.applyWhiskerStyle(x,m)}}applyBoxStyle(e,t){e.setAttribute('stroke',this.getBoxAboveLineColor()),e.setAttribute('stroke-width',this.getBoxAboveLineWidth()),this.getBoxAboveFillColor()!==void 0&&e.setAttribute('fill',this.getBoxAboveFillColor()),this.getBoxAboveFillOpacity()!==void 0&&e.setAttribute('fill-opacity',this.getBoxAboveFillOpacity()),t.setAttribute('stroke',this.getBoxBelowLineColor()),t.setAttribute('stroke-width',this.getBoxBelowLineWidth()),this.getBoxBelowFillColor()!==void 0&&t.setAttribute('fill',this.getBoxBelowFillColor()),this.getBoxAboveFillOpacity()!==void 0&&t.setAttribute('fill-opacity',this.getBoxBelowFillOpacity())}applyWhiskerStyle(e,t){e.setAttribute('stroke',this.getBarAboveLineColor()),e.setAttribute('stroke-width',this.getBarAboveLineWidth()),t.setAttribute('stroke',this.getBarBelowLineColor()),t.setAttribute('stroke-width',this.getBarBelowLineWidth())}applyMeanStyle(e){e.setAttribute('stroke',this.getMeanLineColor()),e.setAttribute('stroke-width',this.getMeanLineWidth())}setOutlierStyle(e){e.setAttribute('stroke',this.getOutlierLineColor()),e.setAttribute('stroke-width',this.getOutlierLineWidth()),this.getBoxBelowFillColor()!==void 0&&e.setAttribute('fill',this.getOutlierFillColor()),this.getBoxAboveFillOpacity()!==void 0&&e.setAttribute('fill-opacity',this.getOutlierFillOpacity())}getCategoryIndex(e){if(!this.categories)throw new Error('No categories were defined. Probably axis.setSeries was not called');for(var t=0;ti?(e.setAttribute(r?'x':'y',i),e.setAttribute(r?'width':'height',t-i)):(e.setAttribute(r?'x':'y',t),e.setAttribute(r?'width':'height',i-t))}getUsedCategories(){let e='y'==this.options.orientation?'x':'y',t=this.data.map((t)=>t[e]);return Array.isArray(this._linkedToScatterSeries)&&this._linkedToScatterSeries.map((e)=>{e.getUsedCategories().map((e)=>{let i;-1<(i=t.indexOf(e))&&t.splice(i,1)})}),t}linkToScatterSerie(...e){this._linkedToScatterSeries=e}}class SerieLineColor extends SerieLine{constructor(){super(...arguments),this.lines=this.lines||{}}setColors(e){this.colors=e}_draw(){var t=this,e=this._dataToUse,r=0,i=!1,a=!1,s=this.getXAxis(),n=this.getYAxis(),o=s.getCurrentMin(),p=n.getCurrentMin(),d=s.getCurrentMax(),g=n.getCurrentMax(),c,u,h,m,x,u,y,b,A,f;for(this.eraseLines(),this.isFlipped(),this.currentLine='',h=this.waveform.getLength(),c=0;cd&&i>d||(xg&&a>g)&&!this.options.lineToZero){i=m,a=x;continue}if(this.counter2=c,this.markersShown()&&this.getMarkerCurrentFamily(this.counter2),A=this.getX(m),f=this.getY(x),A!=y||f!=b){if(isNaN(A)||isNaN(f)){0{var e=parseInt(t.target.parentElement.getAttribute('data-shapeid'));this.emit('mouseover',e,this.waveform.getX(e),this.waveform.getY(e))}),this.groupPoints.addEventListener('mouseout',(t)=>{var e=parseInt(t.target.parentElement.getAttribute('data-shapeid'));this.emit('mouseout',e,this.waveform.getX(e),this.waveform.getY(e))}),this.minX=t,this.minY=t,this.maxX=e,this.maxY=e,this.groupMain.appendChild(this.groupPoints),this.currentAction=!1,this.initExtended1&&this.initExtended1(),this.styles={},this.styles.unselected={},this.styles.selected={},this.styles.unselected.default={shape:'circle',cx:0,cy:0,r:3,stroke:'transparent',fill:'black'},this.styles.selected.default={shape:'circle',cx:0,cy:0,r:4,stroke:'transparent',fill:'black'}}setDataCategory(e){for(let t of e)this._checkY(t.y.getMaxY()),this._checkY(t.y.getMinY());return this.data=e,this.dataHasChanged(),this.graph.updateDataMinMaxAxes(),this}empty(){for(;this.groupPoints.firstChild;)this.groupPoints.removeChild(this.groupPoints.firstChild)}getSymbolForLegend(){if(this.symbol)return this.symbol;var e=document.createElementNS(this.graph.ns,'g');e.setAttribute('data-shapeid',-1);var t=this.doShape(e,this.styles.unselected.default),r=this.getStyle('unselected',-1,!0);for(var a in r[-1])'shape'!=a&&t.setAttribute(a,r[-1][a]);return e}setStyle(e,t,i='unselected'){return'string'==typeof t&&(i=t,t=!1),this.styles[i]=this.styles[i]||{},this.styles[i].all=e,this.styles[i].modifiers=t,this.styleHasChanged(i),this}draw(e){if(e||this.hasDataChanged()||this.hasStyleChanged('unselected')){var t=0,i='category'==this.getXAxis().getType(),r,a;this._drawn=!0,this.dataHasChanged(!1),this.styleHasChanged(!1),this.groupMain.removeChild(this.groupPoints);var s=[];if(t=0,this.hasErrors()&&this.errorDrawInit(),i){for(let e=0;tthis.getXAxis().getCurrentMax()||this.waveform.getY(t)this.getYAxis().getCurrentMax()){this.shapes[t]&&this.shapes[t].setAttribute('display','none');continue}this.shapes[t]&&this.shapes[t].setAttribute('display','initial'),r=this.getX(this.waveform.getX(t)),a=this.getY(this.waveform.getY(t)),this.hasErrors()&&this.errorAddPoint(t,this.waveform.getX(t),this.waveform.getY(t),r,a),this.shapesDetails[t]=this.shapesDetails[t]||[],this.shapesDetails[t][0]=r,this.shapesDetails[t][1]=a,s.push(t)}this.hasErrors()&&this.errorDraw(),this.applyStyle('unselected',s),this.groupMain.appendChild(this.groupPoints)}}_addPoint(e,t,i){let r=document.createElementNS(this.graph.ns,'g'),a;r.setAttribute('transform','translate('+e+', '+t+')'),r.setAttribute('data-shapeid',i),a=this.extraStyle&&this.extraStyle[i]?this.doShape(r,this.extraStyle[i]):this.stdStylePerso?this.doShape(r,this.stdStylePerso):this.doShape(r,this.stdStyle),this.shapes[i]=a,this.groupPoints.appendChild(r)}doShape(e,t){var i=document.createElementNS(this.graph.ns,t.shape);return e.appendChild(i),i}getStyle(e,t,r){var e=e||'unselected',a={},s;'number'==typeof t?s=[t]:Array.isArray(t)&&(s=t);var n,t,o,p,d;this.styles[e].all!==void 0&&(d=this.styles[e].all,'function'==typeof d?d=d():!1===d&&(d={}));for(var c=0,i=s.length;ce.x):[]}}mix(SerieScatter,ErrorBarMixin);class SerieZone extends Serie{static default(){return{fillColor:'rgba( 0, 0, 0, 0.1 )',lineColor:'rgba( 0, 0, 0, 1 )',lineWidth:'1px'}}constructor(){super(...arguments),this.selectionType='unselected',this.id=guid(),this.groupZones=document.createElementNS(this.graph.ns,'g'),this.groupMain=document.createElementNS(this.graph.ns,'g'),this.lineZone=document.createElementNS(this.graph.ns,'path'),this.lineZone.setAttribute('stroke','black'),this.lineZone.setAttribute('stroke-width','1px'),this.groupMain.appendChild(this.groupZones),this.groupZones.appendChild(this.lineZone),this.applyLineStyle(this.lineZone),this.styleHasChanged(),this.clip=document.createElementNS(this.graph.ns,'clipPath'),this.clipId=guid(),this.clip.setAttribute('id',this.clipId),this.graph.defs.appendChild(this.clip)}setWaveform(...e){var t=Math.max,i=Math.min;return this.waveforms=e,this.waveforms=this.waveforms.map((e)=>e instanceof Waveform?e:new Waveform(e)),this.minX=this.waveforms[0].getXMin(),this.maxX=this.waveforms[0].getXMax(),this.minY=this.waveforms[0].getMin(),this.maxY=this.waveforms[0].getMax(),this.waveforms.map((e)=>{this.minX=i(e.getXMin(),this.minX),this.maxX=t(e.getXMin(),this.maxX),this.minY=i(e.getMin(),this.minY),this.maxY=t(e.getMax(),this.maxY)}),this.graph.updateDataMinMaxAxes(),this.dataHasChanged(),this}setWaveforms(){return this.setWaveform(...arguments)}getWaveforms(){return this.waveforms}setMinMaxWaveforms(e,t){return this.waveforms=[e,t.reverse()],this}empty(){for(;this.group.firstChild;)this.group.removeChild(this.group.firstChild)}draw(e){if(e||this.hasDataChanged()){if(!this.waveforms)return;let e=0,t=0,i=0,r=0,a=0,s='',n=!1,o;const l=this.getXAxis().getMinPx(),p=this.getXAxis().getMaxPx(),d=this.getYAxis().getMinPx(),g=this.getYAxis().getMaxPx(),c=this.getXAxis().getCurrentMin(),u=this.getXAxis().getCurrentMax(),h=this.getYAxis().getCurrentMin(),x=this.getYAxis().getCurrentMax();this.groupMain.removeChild(this.groupZones);for(let l of this.waveforms)for(a=0;ax&&(r=this.getY(x)),e===e){if(t!==t){if(0==s.length)continue;s+='L '+i+', '+this.getY(l.getMinY()),n=!0;continue}if(r=this.getY(t),i=this.getX(e),eu){o=[e,t[a],i,r];continue}n&&(s+=' M '+i+', '+this.getY(l.getMinY())+' ',n=!1),0r||c>n||0>i||0>c))&&(o[i]=o[i]||[],o[i][c]=o[i][c]+1||1,l=o[i][c]d?o[i][c]:d);return this.maxIndexX=r,this.maxIndexY=n,this.binMin=l,this.binMax=d,this.deltaX=t,this.deltaY=s,this.fromX=e,this.fromY=a,this.numX=r,this.numY=n,this.densitymap=o,o}setDensityMap(e,t,r,a,s,n){var o=this.data.length,l=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,d,i;for(d=0;dp?e[d][i]:p;return this.maxIndexX=e.length,this.maxIndexY=e[0].length,this.binMin=l,this.binMax=p,this.deltaX=r,this.deltaY=n,this.fromX=t,this.fromY=s,this.numX=this.maxIndexX,this.numY=this.maxIndexY,this.densitymap=e,e}calculateDensityWeighted(e,t,r,a,s,n){var o=Math.floor,p=[],d=this.data.length,l=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,c,i,u,h,x,m,y,b,A,f,k;for(c=0;cr||u>n||0>i||0>u))&&(p[b]=p[b]||[],p[A]=p[A]||[],p[b][f]=p[b][f]||0,p[A][f]=p[A][f]||0,p[b][k]=p[b][k]||0,p[A][k]=p[A][k]||0,p[b][f]+=h*x,p[A][f]+=(1-h)*x,p[b][k]+=h*(1-x),p[A][k]+=(1-h)*(1-x),l=p[b][f]g?p[b][f]:g,l=p[A][f]g?p[A][f]:g,l=p[b][k]g?p[b][k]:g,l=p[A][k]g?p[A][k]:g);return this.maxIndexX=r,this.maxIndexY=n,this.binMin=l,this.binMax=g,this.deltaX=t,this.deltaY=s,this.fromX=e,this.fromY=a,this.numX=r,this.numY=n,this.densitymap=p,p}autoBins(e,t){return this.numX=e||400,this.numY=t||this.numX,this.calculateDensity(this.minX,(this.maxX-this.minX)/e,e,this.minY,(this.maxY-this.minY)/t,t),this.recalculateBinsOnDraw=!1,this}setPxPerBin(e,t,i){return e&&this.calculationDensityMap({from:'min',to:'max',pxPerBin:e,weighted:i}),t&&this.calculationDensityMap(!1,{from:'min',to:'max',pxPerBin:t,weighted:i}),this}setBinsFromTo(e,t,i,r){return this.densityMapCalculation=this.densityMapCalculation||{},this.densityMapCalculation[e]={from:t,to:i,numBins:r},this.calculationDensityMap(),this}calculationDensityMap(e,t){this.method=this.calculateDensityAdvanced,this.densityMapCalculation=this.densityMapCalculation||{},e&&(this.densityMapCalculation.x=e),t&&(this.densityMapCalculation.y=t)}calculateDensityAdvanced(){var e=Math.abs,t={x:{from:0,num:0,delta:0,weighing:!1},y:{from:0,num:0,delta:0,weighing:!1}},r={x:this.graph.drawingSpaceWidth,y:this.graph.drawingSpaceHeight},a={x:this.getXAxis,y:this.getYAxis},s=!1;for(var n in this.densityMapCalculation)if(this.densityMapCalculation[n].weighted&&(s=!0,t[n].weighing=!0),this.densityMapCalculation[n].pxPerBin){var i='min'==this.densityMapCalculation[n].from?a[n].call(this).getCurrentMin():this.densityMapCalculation[n].from,o='max'==this.densityMapCalculation[n].to?a[n].call(this).getCurrentMax():this.densityMapCalculation[n].to,l=e(a[n].call(this).getRelPx(o-i));t[n].num=Math.ceil(r[n]/this.densityMapCalculation[n].pxPerBin),t[n].from=i-e(a[n].call(this).getRelVal((t[n].num*this.densityMapCalculation[n].pxPerBin-l)/2)),t[n].delta=e(a[n].call(this).getRelVal(this.densityMapCalculation[n].pxPerBin))}else t[n].num=this.densityMapCalculation[n].numBins||400,t[n].from='min'==this.densityMapCalculation[n].from?a[n].call(this).getCurrentMin():this.densityMapCalculation[n].from,t[n].delta=this.densityMapCalculation[n].to?(('max'==this.densityMapCalculation[n].to?a[n].call(this).getCurrentMax():this.densityMapCalculation[n].to)-t[n].from)/t[n].num:this.densityMapCalculate[n].delta;(s?this.calculateDensityWeighted:this.calculateDensity).call(this,t.x.from,t.x.delta,t.x.num,t.y.from,t.y.delta,t.y.num)}setColorMapBinBoundaries(e,t){return this.colorMapMin=e,this.colorMapMax=t,this}autoColorMapBinBoundaries(){return this.colorMapMin=this.binMin,this.colorMapMax=this.binMax,this}onRedrawColorMapBinBoundaries(e){return this.callbackColorMapMinMax=e,this}colorMapHSL(e,t,r){var a=Math.log,s=Math.round;r=r||'linear';for(var n={exp:function(e){return(Math.exp(1*(e/t))-1)/(2.718281828459045-1)},log:function(e){return(a(e+1)-0)/(a(t+1)-0)},linear:function(e){return(e-0)/(t-0)}},o=0,l=[],p=[],d={h:null,s:null,l:null,a:null},g=e.length-1,c=0,i,u;c<=t;c++){for(var h in i=n[r](c),u=Math.floor(i*g),u==e.length-1&&(u=g-1),i=(i-u/g)/(1/g),d)d[h]=(e[u+1][h]-e[u][h])*i+e[u][h];l[o]='hsl('+d.h+', '+s(100*d.s)+'%, '+s(100*d.l)+'%)',p[o]=d.a,o++}return this.opacities=p,this.colorMap=l,this.colorMapNum=t,this}autoColorMapHSL(e,t='linear'){return this.colorMapHSV(e,100,t),this}getColorIndex(e){return Math.max(0,Math.min(this.colorMapNum,Math.floor((e-this.colorMapMin)/(this.colorMapMax-this.colorMapMin)*this.colorMapNum)))}draw(){var e;if(this.method&&this.method(),!this.callbackColorMapMinMax||void 0==this.colorMapMin||void 0==this.colorMapMax||'auto'==this.callbackColorMapMinMax)this.autoColorMapBinBoundaries();else{var t=this.callbackColorMapMinMax(this.binMin,this.binMax);this.setColorMapBinBoundaries(t[0],t[1])}for(var r=this.getXAxis().getRelPx(this.deltaX),a=this.getYAxis().getRelPx(this.deltaY),s=0;sy&&d[r+2+u]>y||d[r+c]>m&&d[r+2+c]>m||(n=this.getX(d[r+c]),o=this.getY(d[r+u]),a=this.getX(d[r+2+c]),s=this.getY(d[r+2+u]),a!=n||s!=o)&&(this.currentLine+='M ',this.currentLine+=n,this.currentLine+=' ',this.currentLine+=o,this.currentLine+='L ',this.currentLine+=a,this.currentLine+=' ',this.currentLine+=s,this.counter++);this.currentLine+=' z',p=this._createLine(),p.setAttribute('data-zvalue',this.data[t].zValue),this.zValues[this.data[t].zValue]={dom:p},this.minZ=Math.min(this.minZ,this.data[t].zValue),this.maxZ=Math.max(this.maxZ,this.data[t].zValue)}for(t++,t=this.currentLine+1;t=this.positiveThreshold||0>=l&&l<=this.negativeThreshold?'block':'none');this._shapeZoom&&(this.options.hasNegative?(this._shapeZoom.setHandleNeg(-s(this.negativeDelta,3),this.minZ),this._shapeZoom.showHandleNeg()):this._shapeZoom.hideHandleNeg(),this._shapeZoom.setHandlePos(s(this.positiveDelta,3),this.maxZ))}setDynamicColor(e){this.lineColors=e,this.styleHasChanged()}setNegative(e){this.options.hasNegative=e,e&&(this.negativeThreshold=0)}setColorTo(e,t,r,a){if(this.lineColors){var s={h:0,s:0,l:0};for(var n in s)s[n]=0{this.group.removeChild(e)}),this._labelsBackground.map((e)=>{this.group.removeChild(e)}),this._labels=[],this._labelsBackground[e]=[];for(var e=0;void 0!==this.getProp('labelText',e);)this._labels[e]||(this._labels[e]=document.createElementNS(this.graph.ns,'text'),this._labels[e].setAttribute('data-label-i',e),this._labels[e].jsGraphIsShape=this,this._labelsBackground[e]=document.createElementNS(this.graph.ns,'rect'),this._labelsBackground[e].setAttribute('data-label-i',e),this._labelsBackground[e].jsGraphIsShape=this,this.group.appendChild(this._labelsBackground[e]),this.group.appendChild(this._labels[e]),this._labels[e].addEventListener('dblclick',(t)=>{t.stopPropagation(),this.labelDblClickListener(t)}),this._labelsBackground[e].addEventListener('dblclick',(t)=>{t.stopPropagation(),this.labelDblClickListener(t)})),e++;return this.updateLabels(),this}isLabelEditable(e){return this.getProp('labelEditable',e||0)}updateLabels(){this._labels=this._labels||[];for(var e=0,t=this._labels.length;e{var s=this,e=document.createElementNS(s.graph.ns,t);if(e.jsGraphIsShape=!0,r)for(var n in r)e.setAttribute(n,r[n]);e.addEventListener('mousedown',(t)=>{s.isResizable()&&(t.preventDefault(),t.stopPropagation(),s.graph.emit('beforeShapeResize',s),this.emit('beforeShapeResize'),!s.graph.prevent(!1)&&(s.resizing=!0,s.handleSelected=i,s.handleMouseDown(t)))}),a&&a(s.handles[i]),s.handles[i]=e}).call(this,s);return this.handles}}createHandles(){this.hasStaticHandles()&&(this.addHandles(),this.setHandles())}handleMouseDownImpl(){}handleMouseMoveImpl(){}handleMouseUpImpl(){}handleCreateImpl(){}handleMouseDown(t){if(!this.isLocked())return(this.isMovable()||this.isResizable())&&this.graph.elementMoving(this),this.getProp('selectOnMouseDown')&&this.graph.selectShape(this),this.isMovable()&&!this.resizing&&(this.graph.emit('beforeShapeMove',self),!this.graph.prevent(!1)&&(this.moving=!0,this.moved=!1)),this._mouseCoords=this.graph._getXY(t),this.handleMouseDownImpl(t,this._mouseCoords)}handleClick(t){return this.graph.emit('shapeClicked',this),this.emit('shapeClicked'),!!this.isSelectable()&&void(!t.shiftKey&&this.graph.unselectShapes(),this.getProp('selectOnClick')&&this.graph.selectShape(this))}handleMouseMove(t){if((this.resizing||this.moving)&&!this.isSelected()&&this.graph.selectShape(this),this.graph.emit('beforeShapeMouseMove',this),this.emit('beforeShapeMouseMove'),this.graph.prevent(!1)||!this._mouseCoords)return!1;this.moved=!0;var e=this.graph._getXY(t),i=this.getXAxis().getRelVal(e.x-this._mouseCoords.x),r=this.getYAxis().getRelVal(e.y-this._mouseCoords.y);(0!=i||0!==r)&&(this.preventUnselect=!0),this._mouseCoords=e;var a=this.handleMouseMoveImpl(t,i,r,e.x-this._mouseCoords.x,e.y-this._mouseCoords.y);return a}handleMouseUp(t){return this.moving&&this.moved&&(this.graph.emit('shapeMoved',this),this.emit('shapeMoved')),(this.handleSelected||this.resize)&&(this.graph.emit('shapeResized',this),this.emit('shapeResized')),this.moving=!1,this.resizing=!1,this.handleSelected=!1,this.graph.elementMoving(!1),this.handleMouseUpImpl(t)}handleDblClick(){}handleMouseOver(){!this.getProp('highlightOnMouseOver')||this.moving||this.resizing||this.highlight(),this.graph.emit('shapeMouseOver',this)}handleMouseOut(){this.getProp('highlightOnMouseOver')&&this.unHighlight(),this.graph.emit('shapeMouseOut',this)}lock(){return this.setProp('locked',!0),this}unlock(){return this.setProp('locked',!1),this}isLocked(){return this.getProp('locked')||this.graph.shapesLocked}movable(){this.setProp('movable',!0)}unmovable(){return this.setProp('movable',!1),!1}isMovable(){return this.getProp('movable')}resizable(){this.setProp('resizable',!0)}unresizable(){this.setProp('resizable',!1)}isResizable(){return this.getProp('resizable')}selectable(){this.setProp('selectable',!0)}unselectable(){this.graph.unselectShape(this),this.setProp('selectable',!1)}isSelectable(){return this.getProp('selectable')}highlight(e,t){return e||(e=this.getHighlightAttributes()),t||(t='highlight'),saveDomAttributes(this._dom,e,t),this.highlightImpl(),this}unHighlight(e){return e||(e='highlight'),restoreDomAttributes(this._dom,e),this.unHighlightImpl(),this}highlightImpl(){}unHighlightImpl(){}getHighlightAttributes(){return this._highlightAttributes}setHighlightAttributes(e){return this._highlightAttributes=e,this}getMaskingID(){return this.maskingId}maskWith(e){const t=e.getMaskingID();t?this._dom.setAttribute('mask','url(#'+t+')'):this._dom.removeAttribute('mask')}updateMask(){var e=Math.min,t=Math.abs}labelDblClickListener(t){var e=parseInt(t.target.getAttribute('data-label-i')),i=this;if(isNaN(e))return;if(!this.isLabelEditable(e))return;t.preventDefault(),t.stopPropagation();var r=document.createElement('input');r.setAttribute('type','text'),r.setAttribute('value',i.getProp('labelText',e)),i.graph.wrapper.prepend(r),r.select(),setCSS(r,{position:'absolute',marginTop:parseInt(t.target.getAttribute('y').replace('px',''))+this.graph.getPaddingTop()-10+'px',marginLeft:parseInt(t.target.getAttribute('x').replace('px',''))+this.graph.getPaddingLeft()-50+'px',textAlign:'center',width:'100px'});const a=i.getLabelText(e),s=function(){i.setLabelText(r.value,e),i._labels[e].textContent=r.value;const t=r.value;r.remove(),r.removeEventListener('blur',s),r=!1,i.changed('shapeLabelChanged',{previousValue:a,nextValue:t})};r.addEventListener('blur',s),r.addEventListener('keyup',function(t){13===t.keyCode&&s()}),r.addEventListener('keypress',function(t){t.stopPropagation()}),r.addEventListener('keydown',function(t){t.stopPropagation()}),r.focus()}appendToDom(){return this._forcedParentDom?this._forcedParentDom.appendChild(this.group):this.graph.appendShapeToDom(this),this}forceParentDom(e){return this._forcedParentDom=e,this}isHTML(){return!1}}Shape.prototype.computePosition=Shape.prototype.calculatePosition,Shape.prototype.showLabel=Shape.prototype.displayLabel,Shape.prototype.remove=Shape.prototype.kill;class ShapeSurfaceUnderCurve extends Shape{createDom(){this._dom=document.createElementNS(this.graph.ns,'path')}createHandles(){this._createHandles(2,'line',{"stroke-width":'3',stroke:'transparent',"pointer-events":'stroke',cursor:'ew-resize'})}handleMouseMoveImpl(t,e){if(!this.isLocked()){if(this.moving)this.getPosition(0).deltaPosition('x',e,this.getXAxis()),this.getPosition(1).deltaPosition('x',e,this.getXAxis());else if(this.serie&&this.handleSelected){this.resizingPosition=1==this.handleSelected?this.getPosition(0):this.getPosition(1);var i=this.serie.searchClosestValue(this.getXAxis().getVal(this.graph._getXY(t).x-this.graph.getPaddingLeft()));if(!i)return;this.resizingPosition.x!=i.xMin&&(this.preventUnselect=!0),this.resizingPosition.x=i.xMin}else this.handleSelected&&(this.resizingPosition=1==this.handleSelected?this.getPosition(0):this.getPosition(1),this.resizingPosition.deltaPosition('x',e,this.getXAxis()));this.applyPosition()}}applyPosition(){var e=Math.min;if(this.serie){var t=this.computePosition(0),r=this.computePosition(1),a=Math.abs(t.x-r.x),s=e(t.x,r.x);if(2>a||0>s+a||s>this.graph.getDrawingWidth())return this.setDom('d',''),!1;var n=this.serie.searchClosestValue(this.getPosition(0).x),o=this.serie.searchClosestValue(this.getPosition(1).x),l=0,p=Number.MAX_VALUE,d,g,i,c,u,h,s,x;if(!n||!o)return!1;for(n.xBeforeIndex>o.xBeforeIndex&&(d=n,n=o,o=d),this.counter=0,g=n.dataIndex;g<=o.dataIndex;g++){for(this.currentLine='',c=g==n.dataIndex?n.xBeforeIndexArr:0,u=g==o.dataIndex?o.xBeforeIndexArr:this.serie.data[g].length,h=0,c==u&&u++,i=c;i<=u;i+=2)s=this.serie.getX(this.serie.data[g][i+0]),x=this.serie.getY(this.serie.data[g][i+1]),l=Math.max(this.serie.data[g][i+1],l),p=e(this.serie.data[g][i+1],p),i==c&&(this.firstX=s,this.firstY=x),this.currentLine+=0this.serie.getXAxis().getCurrentMax()&&c.x>this.serie.getXAxis().getCurrentMax())return this.setDom('d',''),this._domShadow.setAttribute('d',''),this.hideLabel(0),!1;this.showLabel(0);let u=0,h=this.serie.getWaveform(),x;if(!h)return;let m=h.getIndexFromX(g[e],!0,Math.floor),y=h.getIndexFromX(c[e],!0,Math.ceil),b=!1,A;m==y&&('aggregate'==h.getReductionType()?y+=4:y++),y=m:x<=y;x+=w){if(o=h.getX(x,!0),p=h.getY(x,!0),s=this.serie.getX(o),n=this.serie.getY(p),u+=h.getY(x,!0),k||(k=s,S=n,M=h.getX(x),C=h.getY(x)),void 0==v){v=s,_=h.getX(x),P=h.getY(x);continue}v=s,t.push([s,n,u]),_=o}_=!1,P=!1,v=!1,0==u&&(u=1),this._sumVal=h.integrate(g.x,c.x),d=this.ratio?this.ratio*(this.sumVal/u):200/u;let E;if(0!=t.length){for(var X=0,i=t.length;Xu/2&&t[X][2]<=u/2||t[X-1][2]=u/2)){let e=a-(t[X-1][2]+t[X][2])/2*d;this.setPosition({x:t[X][0]+'px',y:e+'px'},3),this.setLabelPosition(this.getPosition(3),0)}r+=' L '+t[X][0]+', '+E+' ',this.lastPointX=t[X][0],this.lastPointY=E}return this.points=t,this._sum=u,r=this.serie.isFlipped()?' M '+a+', '+k+' '+r:' M '+k+', '+a+' '+r,this.firstPointX=k,this.firstPointY=a,this.setDom('d',r),this._domShadow.setAttribute('d',r),this.firstX=k,this.firstY=S,this.ratioLabel&&this.updateIntegralValue(this.ratioLabel)||this.updateLabels(),this.changed(),this.handleCondition=!this.xor(-1==w,b),this.setHandles(),this.updateIntegralValue(),!0}}updateIntegralValue(e=this.ratioLabel,t){return e&&(this.ratioLabel=e),void 0!==t&&(this.ratioLabel=t/this.sumVal),this.setLabelText(e?(Math.round(100*this.sumVal*e)/100).toPrecision(3):'N/A',0),this.updateLabels(),this.ratioLabel}getAxis(){return this._data.axis||'x'}set ratio(e){this._ratio=e}get ratio(){return this._ratio}get sum(){return this._sum}get sumVal(){return this._sumVal}selectStyle(){this.setDom('stroke-width','2px')}selectHandles(){}setHandles(){void 0!=this.points&&this.isSelected()&&(this.addHandles(),this.handleCondition?(this.handles[1].setAttribute('x',this.firstPointX),this.handles[1].setAttribute('y',this.firstPointY),this.handles[2].setAttribute('x',this.lastPointX),this.handles[2].setAttribute('y',this.lastPointY)):(this.handles[2].setAttribute('x',this.firstPointX),this.handles[2].setAttribute('y',this.firstPointY),this.handles[1].setAttribute('x',this.lastPointX),this.handles[1].setAttribute('y',this.lastPointY)))}handleMouseMoveImpl(t,e){if(!this.isLocked()){var i=this.getPosition(0),r=this.getPosition(1),a;return 1==this.handleSelected?a=i:2==this.handleSelected&&(a=r),a&&!this._data.vertical&&a.deltaPosition('x',e,this.getXAxis()),this.moving&&(i.x&&i.deltaPosition('x',e,this.getXAxis()),r.x&&r.deltaPosition('x',e,this.getXAxis())),this.rectEvent&&this.setEventReceptacle(),this.redraw(),this.changed(),!0}}}class ShapeRectangle extends Shape{constructor(e,t){super(e,t)}createDom(){return this._dom=document.createElementNS(this.graph.ns,'rect'),this.getStrokeColor()||this.setStrokeColor('black'),this.getStrokeWidth()||this.setStrokeWidth(1),this.getFillColor()||this.setFillColor('transparent'),this}createHandles(){if(this.hasHandles()){var e=this.getProp('handles');switch('object'!=typeof e&&(e={}),e.type||(e.type='corners'),e.type){case'sides':extend(e,{sides:{top:!0,bottom:!0,left:!0,right:!0}});var t=0;for(var r in e.sides)e.sides[r]&&t++;this._createHandles(t,'g').map(function(e){var t=document.createElementNS(self.graph.ns,'rect');t.setAttribute('x','-3'),t.setAttribute('width','6'),t.setAttribute('y','-6'),t.setAttribute('height','12'),t.setAttribute('stroke','black'),t.setAttribute('fill','white'),t.setAttribute('cursor','pointer'),e.appendChild(t)});var t=1;for(var r in e.sides)e.sides[r]&&(this.handles[r]=this['handle'+t],this.sides[t]=r,t++);break;case'corners':this._createHandles(4,'rect',{transform:'translate(-3 -3)',width:6,height:6,stroke:'black',fill:'white'}),this.handles&&(this.handles[2].setAttribute('cursor','nesw-resize'),this.handles[4].setAttribute('cursor','nesw-resize'),this.handles[1].setAttribute('cursor','nwse-resize'),this.handles[3].setAttribute('cursor','nwse-resize'));break;case'seamlessX':this._createHandles(2,'rect',{transform:'translate(-3 -3)',stroke:'transparent',fill:'transparent',width:'20px',cursor:'ew-resize'});}return super.createHandles(),this}}applyPosition(){var e=this.computePosition(0),t=this.computePosition(1),i,r,a,s;return e.xi(a.x-r.x)||i(s.x-r.x)>i(a.x-r.x))&&(s.x=r.x+0.1*(a.x-r.x));break;case 2:a.deltaPosition('x',e,this.getXAxis()),(i(s.x-a.x)>i(a.x-r.x)||i(s.x-r.x)>i(a.x-r.x))&&(s.x=a.x+0.1*(r.x-a.x));break;case 3:if(s.deltaPosition('x',e,this.getXAxis()),i(s.x-a.x)>i(a.x-r.x)||i(s.x-r.x)>i(a.x-r.x))return;}this.setLabelPosition({y:this.getLabelPosition(0).y,x:s.x}),this.updateLabels(),this.redrawLines(),this.setHandles()}}applyPosition(){return this.redrawLines(),!0}}class ShapeHTML extends Shape{constructor(e,t){super(e,t)}createDom(){this._dom=document.createElement('div'),this._dom.setAttribute('style','position: absolute');let e=document.createElement('div');this._dom.appendChild(e),this.div=e}createHandles(){}setHeight(e){this.setProp('height',e)}setWidth(e){this.setProp('width',e)}setContent(e){this.setProp('content',e)}setRenderer(e){this._renderer=e}redraw(){this._renderer?this._renderer(this.div):this.div.innerHTML=this.getProp('content'),super.redraw(...arguments)}applyPosition(){var e=this.calculatePosition(0);if(e&&isNumeric$1(e.x)&&isNumeric$1(e.y))return this._dom.style.left=e.x+'px',this._dom.style.top=e.y+'px',this.currentPosX=e.x,this.currentPosY=e.y,!0}handleMouseMoveImpl(){return!0}setHandles(){}isHTML(){return!0}}class Plugin extends EventEmitter{static default(){return{}}constructor(e){super(...arguments),this.options=Object.assign({},Plugin.default(),this.constructor.default(),e)}init(e){this.graph=e}onMouseDown(){}onMouseUp(){}onMouseMove(){}}class PluginDrag extends Plugin{static default(){return{dragX:!0,dragY:!0,persistanceX:!1,persistanceY:!1}}init(e){this.graph=e,this.time=null,this.totaltime=2e3}onMouseDown(e,t,i){return this._draggingX=t,this._draggingY=i,this._lastDraggingX=this._draggingX,this._lastDraggingY=this._draggingY,this.stopAnimation=!0,this.moved=!1,!0}onMouseMove(e,t,i){var r=t-this._draggingX,a=i-this._draggingY;this.options.dragX&&e._applyToAxes(function(e){e.setCurrentMin(e.getVal(e.getMinPx()-r)),e.setCurrentMax(e.getVal(e.getMaxPx()-r))},!1,!0,!1),this.options.dragY&&e._applyToAxes(function(e){e.setCurrentMin(e.getVal(e.getMinPx()-a)),e.setCurrentMax(e.getVal(e.getMaxPx()-a))},!1,!1,!0),this._lastDraggingX=this._draggingX,this._lastDraggingY=this._draggingY,this._draggingX=t,this._draggingY=i,this.moved=!0,this.time=Date.now(),this.emit('dragging'),e.draw(!0)}onMouseUp(e,t,i){var r=Date.now()-this.time;return t==this._lastDraggingX||i==this._lastDraggingY?void(this.moved&&this.emit('dragged')):(this.speedX=(t-this._lastDraggingX)/r,this.speedY=(i-this._lastDraggingY)/r,isNaN(this.speedX)||isNaN(this.speedY)?void this.emit('dragged'):void(e._applyToAxes(function(e){e._pluginDragMin=e.getCurrentMin(),e._pluginDragMax=e.getCurrentMax()},!1,!0,!0),this.stopAnimation=!1,this.accelerationX=-this.speedX/this.totaltime,this.accelerationY=-this.speedY/this.totaltime,this.options.persistanceX||this.options.persistanceY?this._persistanceMove(e):this.emit('dragged')))}_persistanceMove(e){var t=this;return t.stopAnimation?void t.emit('dragged'):void window.requestAnimationFrame(function(){var i=Date.now()-t.time,r=(0.5*t.accelerationX*i+t.speedX)*i,a=(0.5*t.accelerationY*i+t.speedY)*i;t.options.persistanceX&&e._applyToAxes(function(e){e.setCurrentMin(-e.getRelVal(r)+e._pluginDragMin),e.setCurrentMax(-e.getRelVal(r)+e._pluginDragMax),e.cacheCurrentMin(),e.cacheCurrentMax(),e.cacheInterval()},!1,!0,!1),t.options.persistanceY&&e._applyToAxes(function(e){e.setCurrentMin(-e.getRelVal(a)+e._pluginDragMin),e.setCurrentMax(-e.getRelVal(a)+e._pluginDragMax),e.cacheCurrentMin(),e.cacheCurrentMax(),e.cacheInterval()},!1,!1,!0),e.draw(),i{console.log(this.currentShape),this.currentShape||e.emit('newShape',a,l)})}}}onMouseMove(t,i,r,a){if(this.currentShape){console.log('mv'),this.count++;var e=this.currentShape;this.currentShape=!1,t.selectedSerie&&!e.serie&&e.setSerie(t.selectedSerie),e.resizing=!0,e.options&&e.options.onCreate&&e.options.onCreate.call(e),e.draw(),t.selectShape(e),e.handleMouseDown(this.currentShapeEvent,!0),e.handleSelected=this.options.handleSelected||1,e.handleMouseMove(a,!0)}}onMouseUp(){this.currentShape&&(this.currentShape.kill(),this.currentShape=!1)}}class PluginSelectScatter extends Plugin{constructor(){super(...arguments)}static default(){return{}}init(e){this._path=document.createElementNS(e.ns,'path'),setAttributeTo(this._path,{display:'none',fill:'rgba(0,0,0,0.1)',stroke:'rgba(0,0,0,1)',"shape-rendering":'crispEdges',x:0,y:0,height:0,width:0,d:''}),this.graph=e,e.dom.appendChild(this._path)}setSerie(e){this.serie=e}onMouseDown(e,t,i){this.serie&&(this.path='M '+t+' '+i+' ',this.currentX=t,this.currentY=i,this.xs=[this.serie.getXAxis().getVal(t-e.getPaddingLeft())],this.ys=[this.serie.getYAxis().getVal(i-e.getPaddingTop())],this._path.setAttribute('d',''),this._path.setAttribute('display','block'))}onMouseMove(e,t,i){var r=Math.pow;25e.getY(a)||this.ys[n]>e.getY(a)&&this.ys[s](e.getY(a)-this.ys[n])/(this.ys[s]-this.ys[n])*(this.xs[s]-this.xs[n])+this.xs[n]&&r++;1==r%2?(t.push(a),this.serie.selectPoint(a,!0,'selected')):this.serie.unselectPoint(a)}this.selected=t,this.emit('selectionProcess',t)}onMouseUp(){this._path.setAttribute('display','none'),this.emit('selectionEnd',this.selected)}}class PluginZoom extends Plugin{constructor(){super(...arguments)}static default(){return{axes:'all'}}init(e){this._zoomingGroup=document.createElementNS(e.ns,'g'),this._zoomingSquare=document.createElementNS(e.ns,'rect'),this._zoomingSquare.setAttribute('display','none'),setAttributeTo(this._zoomingSquare,{display:'none',fill:'rgba(171,12,12,0.2)',stroke:'rgba(171,12,12,1)',"shape-rendering":'crispEdges',x:0,y:0,height:0,width:0,"pointer-events":'none'}),this.graph=e,e.groupEvent.appendChild(this._zoomingGroup),this._zoomingGroup.appendChild(this._zoomingSquare)}onMouseDown(t,i,r,a,e){var s=this.options.zoomMode;if(s){switch(this._zoomingMode=s,void 0===i&&(this._backedUpZoomMode=this._zoomingMode,this._zoomingMode='y',i=0),void 0===r&&(this._backedUpZoomMode=this._zoomingMode,this._zoomingMode='x',r=0),this._zoomingXStart=i,this._zoomingYStart=r,this.x1=i-t.getPaddingLeft(),this.y1=r-t.getPaddingTop(),this._zoomingSquare.setAttribute('width',0),this._zoomingSquare.setAttribute('height',0),this._zoomingSquare.setAttribute('display','block'),this._zoomingMode){case'x':this._zoomingSquare.setAttribute('y',t.options.paddingTop),this._zoomingSquare.setAttribute('height',t.getDrawingHeight()-t.shift.bottom);break;case'y':this._zoomingSquare.setAttribute('x',t.options.paddingLeft),this._zoomingSquare.setAttribute('width',t.getDrawingWidth());break;case'forceY2':this.y2=t.getYAxis().getPx(this.options.forcedY)+t.options.paddingTop;}this.options.onZoomStart&&!e&&this.options.onZoomStart(t,i,r,a,e)}}onMouseMove(t,i,r,a,e){var s=Math.min,n=Math.abs;switch(this._zoomingMode){case'xy':this._zoomingSquare.setAttribute('x',s(this._zoomingXStart,i)),this._zoomingSquare.setAttribute('y',s(this._zoomingYStart,r)),this._zoomingSquare.setAttribute('width',n(this._zoomingXStart-i)),this._zoomingSquare.setAttribute('height',n(this._zoomingYStart-r));break;case'forceY2':this._zoomingSquare.setAttribute('y',s(this._zoomingYStart,this.y2)),this._zoomingSquare.setAttribute('height',n(this._zoomingYStart-this.y2)),this._zoomingSquare.setAttribute('x',s(this._zoomingXStart,i)),this._zoomingSquare.setAttribute('width',n(this._zoomingXStart-i));break;case'x':this._zoomingSquare.setAttribute('x',s(this._zoomingXStart,i)),this._zoomingSquare.setAttribute('width',n(this._zoomingXStart-i));break;case'y':this._zoomingSquare.setAttribute('y',s(this._zoomingYStart,r)),this._zoomingSquare.setAttribute('height',n(this._zoomingYStart-r));}this.options.onZoomMove&&!e&&this.options.onZoomMove(t,i,r,a,e)}onMouseUp(t,i,r,a,s){var n=Math.max,o=Math.min,l=this;this.removeZone();var p=i-t.options.paddingLeft,d=r-t.options.paddingTop;if((this.emit('beforeZoom',{graph:t,x:i,y:r,e:a,mute:s}),!t.prevent(!1))&&(0!=i-this._zoomingXStart||'y'==this._zoomingMode)&&(0!=r-this._zoomingYStart||'x'==this._zoomingMode))if(this.options.transition||this.options.smooth){let e=!1,t=!1;('x'==this._zoomingMode||'xy'==this._zoomingMode||'forceY2'==this._zoomingMode)&&(this.fullX=!1,this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=o(e.getVal(p),e.getVal(l.x1)),e._pluginZoomMaxFinal=n(e.getVal(p),e.getVal(l.x1))},!1,!0,!1),e=!0),('y'==this._zoomingMode||'xy'==this._zoomingMode)&&(this.fullY=!1,this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=o(e.getVal(d),e.getVal(l.y1)),e._pluginZoomMaxFinal=n(e.getVal(d),e.getVal(l.y1))},!1,!1,!0),t=!0),'forceY2'==this._zoomingMode&&(this.fullY=!1,this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=o(e.getVal(l.y2),e.getVal(l.y1)),e._pluginZoomMaxFinal=n(e.getVal(l.y2),e.getVal(l.y1))},!1,!1,!0),t=!0),this.transition(e,t,'zoomEnd')}else{switch(this._zoomingMode){case'x':this.fullX=!1,this.toAxes('_doZoom',[p,this.x1],!0,!1);break;case'y':this.fullY=!1,this.toAxes('_doZoom',[d,this.y1],!1,!0);break;case'xy':this.fullX=!1,this.fullY=!1,this.toAxes('_doZoom',[p,this.x1],!0,!1),this.toAxes('_doZoom',[d,this.y1],!1,!0);break;case'forceY2':this.fullX=!1,this.fullY=!1,this.toAxes('_doZoom',[p,this.x1],!0,!1),this.toAxes('_doZoom',[this.y1,this.y2],!1,!0);}t.draw(),this._backedUpZoomMode&&(this._zoomingMode=this._backedUpZoomMode),this.emit('zoomed'),t.pluginYieldActiveState()}}removeZone(){this._zoomingSquare.setAttribute('display','none')}onMouseWheel(t,i,e,r,a){a||(a={}),a.baseline||(a.baseline=0);let s=a.baseline;'mousePosition'==a.baseline&&(s=this.graph.getYAxis().getVal(r),console.log(s));var n='x'==a.direction,o='y'===a.direction;this.toAxes('handleMouseWheel',[t,i,s],n,o),this.graph.drawSeries()}onDblClick(t,i,r,a,s){var n=Math.max,o=Math.min,l=this.graph;if(this.emit('beforeDblClick',{graph:l,x:t,y:i,pref:a,e:r,mute:s}),!l.prevent(!1)){if(this.options.transition||this.options.smooth){var p=!1,d=!1;('xtotal'==a.mode||'total'==a.mode)&&(this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=e.getMinValue()-e.options.axisDataSpacing.min*e.getInterval(),e._pluginZoomMaxFinal=e.getMaxValue()+e.options.axisDataSpacing.max*e.getInterval()},!1,!0,!1),p=!0),('ytotal'==a.mode||'total'==a.mode)&&(this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=e.getMinValue()-e.options.axisDataSpacing.min*e.getInterval(),e._pluginZoomMaxFinal=e.getMaxValue()+e.options.axisDataSpacing.max*e.getInterval()},!1,!1,!0),d=!0);let e,t;return('gradualX'==a.mode||'gradualY'==a.mode||'gradual'==a.mode||'gradualXY'==a.mode)&&(e=!1,t=!1,('gradualX'==a.mode||'gradual'==a.mode||'gradualXY'==a.mode)&&(e=!0,p=!0),('gradualY'==a.mode||'gradual'==a.mode||'gradualXY'==a.mode)&&(t=!0,d=!0),this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=e.getCurrentMin()-(e.getCurrentMax()-e.getCurrentMin()),e._pluginZoomMaxFinal=e.getCurrentMax()+(e.getCurrentMax()-e.getCurrentMin())},!1,e,t)),void this.transition(p,d,'dblClick')}var g=this.graph.getXAxis(),c=this.graph.getYAxis();if('xtotal'==a.mode)this.toAxes('setMinMaxToFitSeries',null,!0,!1),this.fullX=!0,this.fullY=!1;else if('ytotal'==a.mode)this.toAxes('setMinMaxToFitSeries',null,!1,!0),this.fullX=!1,this.fullY=!0;else if('total'==a.mode)this.toAxes('setMinMaxToFitSeries',null,!0,!0),this.fullX=!0,this.fullY=!0;else{t-=this.graph.options.paddingLeft,i-=this.graph.options.paddingTop;var u=g.getCurrentMin(),h=g.getCurrentMax(),m=g.getVal(t),b=h-u,A=c.getCurrentMin(),f=c.getCurrentMax(),k=c.getVal(i),S=f-A;if('gradualXY'==a.mode||'gradualX'==a.mode){var M=(m-u)/(h-u);u=n(g.getMinValue()-g.getInterval()*g.options.axisDataSpacing.min,u-b*M),h=o(g.getMaxValue()+g.getInterval()*g.options.axisDataSpacing.max,h+b*(1-M)),g.setCurrentMin(u),g.setCurrentMax(h),g.options.onZoom&&g.options.onZoom(u,h),g.cacheCurrentMin(),g.cacheCurrentMax(),g.cacheInterval()}if('gradualXY'==a.mode||'gradualY'==a.mode){var M=(k-A)/(f-A);A=n(c.getMinValue()-c.getInterval()*c.options.axisDataSpacing.min,A-S*M),f=o(c.getMaxValue()+c.getInterval()*c.options.axisDataSpacing.max,f+S*(1-M)),c.setCurrentMin(A),c.setCurrentMax(f),c.options.onZoom&&c.options.onZoom(A,f),c.cacheCurrentMin(),c.cacheCurrentMax(),c.cacheInterval()}}l.pluginYieldActiveState(),this.graph.draw()}}transition(e,t,i){var r=this,a=500;r.gradualUnzoomStart||(r.gradualUnzoomStart=Date.now()),window.requestAnimationFrame(function(){var s=Date.now()-r.gradualUnzoomStart;s>a&&(s=a);var n=Math.sin(s/a*Math.PI/2);r.toAxes(function(e){e.setCurrentMin(e._pluginZoomMin+(e._pluginZoomMinFinal-e._pluginZoomMin)*n),e.setCurrentMax(e._pluginZoomMax+(e._pluginZoomMaxFinal-e._pluginZoomMax)*n),e.cacheCurrentMin(),e.cacheCurrentMax(),e.cacheInterval()},!1,e,t),r.graph.draw(),s{this.series.forEach(function(t){this.updateSerie(t,e)}),e||this.recalculateSeries(t)}}static default(){return{LRUName:'PluginTimeSerieManager',intervals:[1000,15000,60000,900000,3600000,8640000],maxParallelRequests:3,optimalPxPerPoint:2,nbPoints:1e3,url:''}}init(e){this.graph=e,get.create(this.options.LRUName,200),this.requestsRunning=0}setURL(e){return this.options.url=e,this}setAvailableIntervals(){this.options.intervals=arguments}newSerie(e,t,i,r,a){var n=this.graph.newSerie(e,t,i);return this.currentSlots[e]={min:0,max:0,interval:0},n.on('hide',function(){n._zoneSerie&&n._zoneSerie.hide()}),n.on('show',function(){n._zoneSerie&&n._zoneSerie.show()}),n.setInfo('timeSerieManagerDBElements',r),a||(n._zoneSerie=this.graph.newSerie(e+'_zone',{},Graph$1.SERIE_ZONE)),this.series.push(n),n}registerPlugin(e){var t;if(-1<(t=this.plugins.indexOf(e)))for(var r=1;rDate.now());)r.register(e,p,l,l==n?a[1]:a[2],!0,t),p++})}this.processRequests()}cleanRegister(e){this.requestLevels&&this.requestLevels.forEach((t)=>{t.forEach((i,r)=>{i[4]Date.now()&&o.timeout=this.options.maxParallelRequests)){for(var e=this,t=1,r;;){for(var a in this.requestLevels[t])if(1!=this.requestLevels[t][a][0]){r=this.requestLevels[t][a];break}if(r)break;if(t++,10',e[2]).replace('',this.computeTimeMin(e[3],e[4])).replace('',this.computeTimeMax(e[3],e[4])).replace('',e[4]),r=e[6]||{};for(var a in r)t=t.replace('<'+a+'>',r[a]);return t}getOptimalInterval(e){var t=(this.options.optimalPxPerPoint||1)*e/this.graph.getDrawingWidth(),i=Infinity,r;return this.options.intervals.forEach(function(e){var a=Math.min(i,Math.abs(e-t));i!==a&&(r=e,i=a)}),r||1e3}computeUniqueID(e,t,r){var a='',s=e.getInfo('timeSerieManagerDBElements');for(var n in s)a+=';'+n+':'+s[n];return e.getName()+';'+t+';'+r+a}computeSlotID(e,t){return Math.floor(e/(t*this.options.nbPoints))}computeSlotTime(e,t){return e*(t*this.options.nbPoints)}getZoneSerie(e){return e._zoneSerie}updateZoneSerie(e){var t=this.graph.getSerie(e);t&&t._zoneSerie&&(t._zoneSerie.setXAxis(t.getXAxis()),t._zoneSerie.setYAxis(t.getYAxis()),t._zoneSerie.setFillColor(t.getLineColor()),t._zoneSerie.setLineColor(t.getLineColor()),t._zoneSerie.setFillOpacity(0.2),t._zoneSerie.setLineOpacity(0.3))}recalculateSeries(e){var t=this;this.locked||(this.changed=!1,this.series.map(function(i){t.recalculateSerie(i,e)}),this.changed=!1,t.graph.draw())}recalculateSerie(e,t){var i=e.getXAxis().getCurrentMin(),r=e.getXAxis().getCurrentMax(),a=this.getOptimalInterval(r-i),s=this.computeSlotID(i,a),n=this.computeSlotID(r,a),o=[],l=[];if(!(!t&&a==this.currentSlots[e.getName()].interval&&this.currentSlots[e.getName()].min<=s&&this.currentSlots[e.getName()].max>=n)){s-=2,n+=2,this.currentSlots[e.getName()].min=s,this.currentSlots[e.getName()].max=n,this.currentSlots[e.getName()].interval=a;for(var p=s;p<=n;){const t=get.get(this.options.LRUName,this.computeUniqueID(e,p,a));t?(o=o.concat(t.data.mean),l=l.concat(t.data.minmax)):this.recalculateSerieUpwards(e,p,a,o,l),p++}this.changed=!0,e.setData(o),e._zoneSerie&&e._zoneSerie.setData(l)}}setIntervalCheck(e){this.interval&&clearInterval(this.interval),this.update(!0,!0),this.interval=setInterval(()=>{this.update(!0,!1)},e)}recalculateSerieUpwards(e,t,r,a,s){var n=this.options.intervals.slice(0);n.sort();var o=n[n.indexOf(r)+1]||-1;if(0>o)return[];var p=this.computeSlotTime(t,r),d=this.computeSlotTime(t+1,r),g=this.computeSlotID(p,o),c=!1;const u=get.get(this.options.LRUName,this.computeUniqueID(e,g,o));if(u)for(var h=0,i=u.data.mean.length;h=d)return a=a.concat(u.data.mean.slice(c,h)),void(s=a.concat(u.data.minmax.slice(c,h)))}return this.recalculateSerieUpwards(e,g,o,a,s)}lockRedraw(){this.locked=!0}unlockRedraw(){this.locked=!1}isRedrawLocked(){return!!this.locked}}class PluginSerieLineDifference extends Plugin{constructor(){super(...arguments)}static default(){return{positiveStyle:{fillColor:'green',fillOpacity:0.2,strokeWidth:0},negativeStyle:{fillColor:'red',fillOpacity:0.2,strokeWidth:0},from:0,to:0}}init(e){this.graph=e,this.pathsPositive=[],this.pathsNegative=[],this.positivePolyline=this.graph.newShape('polyline').draw(),this.positivePolyline.setFillColor(this.options.positiveStyle.fillColor).setFillOpacity(this.options.positiveStyle.fillOpacity).setStrokeWidth(this.options.positiveStyle.strokeWidth).applyStyle(),this.negativePolyline=this.graph.newShape('polyline').draw(),this.negativePolyline.setFillColor(this.options.negativeStyle.fillColor).setFillOpacity(this.options.negativeStyle.fillOpacity).setStrokeWidth(this.options.negativeStyle.strokeWidth).applyStyle()}setSeries(e,t){this.serie1=e,this.serie2=t}setBoundaries(e,t){this.options.from=e,this.options.to=t}getFrom(){return this.options.from}getTo(){return this.options.to}draw(){function e(){!0===y?a.pathsPositive.push([s,n]):!1===y&&a.pathsNegative.push([s,n]),s=[],n=[],y=void 0}function t(e,t){for(var s=0;sthis.getTo()){c=this.interpolate(this.serie1,this.getTo()),u=this.interpolate(this.serie2,this.getTo()),h=this.computeCrossing(s[s.length-2],s[s.length-1],this.getTo(),c,n[n.length-2],n[n.length-1],this.getTo(),u),h&&(s.push(h.x),s.push(h.y),n.push(h.x),n.push(h.y),e(),s.push(h.x),s.push(h.y),n.push(h.x),n.push(h.y),y=this.serie1.data[o][l+1]>this.serie2.data[p][g+1]),s.push(this.getTo()),s.push(c),n.push(this.getTo()),n.push(u),b=!0;break}if(!m)if(m=this.serie2.searchClosestValue(this.serie1.data[o][l]),m)p=m.dataIndex,g=2*m.xBeforeIndex,c=this.interpolate(this.serie2,this.serie1.data[o][l]),s.push(this.serie1.data[o][l]),s.push(this.serie1.data[o][l+1]),n.push(this.serie1.data[o][l]),n.push(c),y=this.serie1.data[o][l+1]>c;else continue;for(x=!1,h=this.computeCrossing(s[s.length-2],s[s.length-1],this.serie1.data[o][l],this.serie1.data[o][l+1],n[n.length-2],n[n.length-1],this.serie2.data[p][g],this.serie2.data[p][g+1]),h&&(s.push(h.x),s.push(h.y),n.push(h.x),n.push(h.y),e(),s.push(h.x),s.push(h.y),n.push(h.x),n.push(h.y),y=this.serie1.data[o][l+1]>this.serie2.data[p][g+1]);this.serie2.data[p][g]this.serie2.data[p][g+1])}!1===x?(s.push(this.serie1.data[o][l]),s.push(this.serie1.data[o][l+1])):(s.push(x),s.push(this.interpolate(this.serie1,x)),m=!1,l-=2,e())}if(b){e();break}c=this.interpolate(this.serie2,s[s.length-2]),c&&(n.push(s[s.length-2]),n.push(c)),e(),l=0,m=!1}var A=this.pathsPositive.reduce(t,'');this.positivePolyline.setPointsPx(A).redraw();var A=this.pathsNegative.reduce(t,'');this.negativePolyline.setPointsPx(A).redraw()}interpolate(e,t){var i=e.searchClosestValue(t);if(!i)return!1;if(void 0==i.xMax)return i.yMin;if(void 0==i.xMin)return i.yMax;var r=(t-i.xMin)/(i.xMax-i.xMin);return(1-r)*i.yMin+r*i.yMax}computeCrossing(e,t,i,r,a,s,n,o){var l=(r-t)/(i-e),p=(o-s)/(n-a),d=r-l*i;if(e==i||a==n)return!1;if(l==p)return{x:e,y1:t,y2:t};var g=(d-(o-p*n))/(p-l);return g>i||gn?!1:{x:g,y:l*g+d}}getPositivePolyline(){return this.positivePolyline}getNegativePolyline(){return this.negativePolyline}}class SerieLineExtended extends SerieLine{constructor(){super(...arguments),this.subSeries=[]}setData(){return super.setData(...arguments),this.subSeries.map((e)=>{e.data=this.data}),this}draw(){return this.eraseMarkers(),this}getSymbolForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getSymbolForLegend()}getMarkerForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getMarkerForLegend()}}class SerieScatterExtended extends SerieScatter{constructor(){super(...arguments),this.subSeries=[]}setData(){return super.setData(...arguments),this.subSeries.map((e)=>{e.data=this.data}),this}draw(){return this}getSymbolForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getSymbolForLegend()}getMarkerForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getMarkerForLegend()}}var excludingMethods=['constructor','init','draw','setLineColor','setLineWidth','setLineStyle','getLineColor','getLineWidth','getLineStyle','setMarkers','showMarkers','hideMarkers','getMarkerDom','getMarkerDomIndependant','getMarkerPath','eraseMarkers','_recalculateMarkerPoints'],addMethods=[];Object.getOwnPropertyNames(SerieLine.prototype).concat(addMethods).map(function(e){-1{i[e](...t)})}}(e))});class PluginAxisSplitting extends Plugin{constructor(){super(...arguments),this.series=new Map}static defaults(){return{axes:{margins:{high:5,low:5}}}}init(e){this.graph=e}newXAxis(e){return this.newBottomAxis(e)}newYAxis(e){return this.newLeftAxis(e)}newTopAxis(e){return e=this.getOptions(e),new SplitXAxis(this.graph,'top',e)}newBottomAxis(e){return e=this.getOptions(e),new SplitXAxis(this.graph,'bottom',e)}newLeftAxis(e){return e=this.getOptions(e),new SplitYAxis(this.graph,'left',e)}newRightAxis(e){return e=this.getOptions(e),new SplitYAxis(this.graph,'right',e)}getOptions(e){var t={marginMin:this.options.axes.margins.low,marginMax:this.options.axes.margins.high};return extend(!0,t,e)}preDraw(){var e,t;this.series.forEach(({serie:i})=>{e=i.getXAxis(),t=i.getYAxis();let r=1;for(e.splitNumber&&(r*=e.splitNumber),t.splitNumber&&(r*=t.splitNumber);i.subSeries.lengthr;){let e=this.graph.getSerie(i.getName()+'_'+(i.subSeries.length-1));e&&e.kill&&e.kill(),i.subSeries.pop()}!i.getXAxis().splitNumber&&i.getXAxis().splitAxis&&i.getXAxis().splitAxis(),!i.getYAxis().splitNumber&&i.getYAxis().splitAxis&&i.getYAxis().splitAxis(),i.subSeries.map((t,r)=>{var a,s;if(i.getXAxis().getSubAxis){let t=r%(e.splitNumber||1);a=i.getXAxis().getSubAxis(t)}else a=i.getXAxis();if(t.setXAxis(a),i.getYAxis().getSubAxis){let t=Math.floor(r/(e.splitNumber||1));s=i.getYAxis().getSubAxis(t)}else s=i.getYAxis();t.setYAxis(s),t.draw(!0)})})}newSerie(e,t={},i){switch(i){case'line':return this.newLineSerie(e,t);break;case'scatter':return this.newScatterSerie(e,t);}throw'Cannot create a split serie of type '+i}newLineSerie(e,t){var i={type:'lineSerie',serie:new SerieLineExtended(e,t,'line')};return this.series.set(e,i),i.serie.init(this.graph,e,t),this.graph.series.push(i.serie),i.serie}newScatterSerie(e,t){var i={type:'scatterSerie',serie:new SerieScatterExtended(e,t,'scatter')};return this.series.set(e,i),i.serie.init(this.graph,t),this.graph.series.push(i.serie),i.serie}}var defaultAxisConstructorOptions={splitMarks:!0},SplitAxis=function(e){var t=Math.max,i=class extends e{constructor(e,t,i={}){super(e,t,i),this.axes=[],this.position=t,this.constructorOptions=extend(!0,{},defaultAxisConstructorOptions,i),this._splitVal=[]}all(e){if('function'==typeof e)return this.axes.map(e),this}splitAxis(...e){e.push(1);let t=e.length;for(;this.axes.length>t;)this.axes.pop().kill(!0,!0);for(;this.axes.lengththis._splitVal.length)&&(super.setMinMaxToFitSeries(...arguments),this._splitVal[0]=this._splitVal[0]||[],this._splitVal[this._splitVal.length-1]=this._splitVal[this._splitVal.length-1]||[],this._splitVal[0][0]=this.getCurrentMin(),this._splitVal[this._splitVal.length-1][1]=this.getCurrentMax(),this.setChunkBoundaries(this._splitVal))}draw(){this.autoSpread&&this._splitSpread();let e=0,i,r,a;if(0<=this._baseWidthIndex&&(r=this.getSubAxis(this._baseWidthIndex))&&(a=r.getSpan()),r=void 0,0<=this.fixGridFor&&(r=this.getSubAxis(this.fixGridFor))){if(void 0!==r._mean){let e=(r.getSpan()[1]-r.getSpan()[0])/(a[1]-a[0])*this._baseWidthVal;r.forceMin(r._mean-e/2),r.forceMax(r._mean+e/2)}e=r.draw(),i=r.getPrimaryTickUnit()}return this.axes.map((s)=>{if(r!==s){if(void 0!==s._mean){let e=(s.getSpan()[1]-s.getSpan()[0])/(a[1]-a[0])*this._baseWidthVal;s.forceMin(s._mean-e/2),s.forceMax(s._mean+e/2)}i&&s.forcePrimaryTickUnit(i),e=t(e,s.draw())}}),this.writeUnit(),e}setMinPx(e){super.setMinPx(e);for(let t of this.axes)t.setMinPx(e)}setMaxPx(e){super.setMaxPx(e);for(let t of this.axes)t.setMaxPx(e)}setShift(){super.setShift(...arguments);for(let e of this.axes)e.setShift(...arguments)}init(){super.init(...arguments),this.splitAxis()}getAxisPosition(){var e=0;return this.axes.map((i)=>{e=t(e,i.getAxisPosition())}),e}getSubAxis(e){if(this.axes.length<=e)throw'Impossible to reach axis. Index '+e+' is out of range';return this.axes[e]}get splitNumber(){return this._splits.length}};return['turnGridsOff','turnGridsOn','gridsOff','gridsOn','setEngineering','setScientificScaleExponent','setScientific','setLabelColor','setSecondaryGridDasharray','setPrimaryGridDasharray','setSecondaryGridsOpacity','setPrimaryGridOpacity','setSecondaryGridWidth','setPrimaryGridWidth','setSecondaryGridColor','setPrimaryGridColor','setTicksLabelColor','setSecondaryTicksColor','setPrimaryTicksColor','setAxisColor','secondaryGridOn','secondaryGridOff','primaryGridOff','primaryGridOn','setSecondaryGrid','setPrimaryGrid','setGrids','setTickPosition','setExponentialFactor','setExponentialLabelFactor','setGridLinesStyle','forcePrimaryTickUnitMin','forcePrimaryTickUnitMax','forcePrimaryTickUnit','flip','show','hide','setDisplay'].map((e)=>{i.prototype[e]=function(e){return function(){return this.axes.map((t)=>{t[e](...arguments)}),this}}(e)}),i};class SplitXAxis extends SplitAxis(AxisX){constructor(e,t){super(...arguments),this.topbottom=t}getConstructor(){return AxisX}getAxisPosition(){var e=super.getAxisPosition(...arguments);return this.labelPosY=e,this.getLabel()&&(e+=this.graph.options.fontSize),e}drawLabel(){super.drawLabel(),this.label.setAttribute('y',(this.top?-1:1)*(this.graph.options.fontSize+this.labelPosY))}draw(){var e=super.draw(...arguments);return this.drawLabel(),e}}class SplitYAxis extends SplitAxis(AxisY){constructor(){super(...arguments)}getConstructor(){return AxisY}drawLabel(){super.drawLabel()}equalizePosition(e){var t=e;if(this.getLabel()&&this.axes.map((i)=>{t=Math.max(i.equalizePosition(e),t)}),this.getLabel())return this.placeLabel(this.left?-t:t),t+this.graph.options.fontSize}}mix(SplitXAxis,new AxisX),mix(SplitYAxis,new AxisY);class PluginMakeTracesDifferent extends Plugin{constructor(){super(...arguments)}init(e,t){super.init(e,t)}static default(){return{}}checkHSL(e){let t={},i,r,a;return(i=e.h||e.hue)?(1>i&&(i=Math.round(360*i)),t.hue=i):t.h=0,(r=e.s||e.saturation)?(1{if(!t.setLineColor)throw'The serie '+t.getName()+' does not implement the method `startingColor`';const a=this.buildHSLString({h:e.startingColorHSL.h+r/(i-1)*(e.endingColorHSL.h-e.startingColorHSL.h),s:e.startingColorHSL.s+r/(i-1)*(e.endingColorHSL.s-e.startingColorHSL.s),l:e.startingColorHSL.l+r/(i-1)*(e.endingColorHSL.l-e.startingColorHSL.l)});return t.setLineColor(a),a})}}class PluginPeakPicking extends Plugin{constructor(){super(...arguments)}static default(){return{autoPeakPicking:!1,autoPeakPickingNb:4,autoPeakPickingMinDistance:10,autoPeakPickingFormat:!1,autoPeakPickingAllowAllY:!1}}init(e,t){super.init(e,t),this.picks=[];for(var i=0,r=this.options.autoPeakPickingNb,a;i{e.kill()})}preDraw(){this.serie&&(this.detectedPeaks=[],this.lastYPeakPicking=!1)}postDraw(){if(!this.serie)return;let e=!0,t=!1,r=[],a=this.serie.getWaveform(),s;if(!a)throw'The serie must have a waveform for the peak picking to work';let n=a.getLength(),o=0,i;for(;o=s[1]&&e||i<=s[1]&&t?s=[a.getX(o),i]:(is[1]&&t)&&(t?(t=!1,e=!0):(t=!0,e=!1,r.push(s),s=!1),s=[a.getX(o),i])}var p=r,d=[],g=p.length,l,c,c,u,h,m;o=0;var y=this.graph.selectedShapes.map(function(e){return e.getProp('xval')});for(p.sort(function(e,t){return t[1]-e[1]}),h=0;othis.serie.getXAxis().getMaxPx()))&&!(!this.options.autoPeakPickingAllowAllY&&(i>this.serie.getYAxis().getMinPx()||ithis.serie.getYAxis().getPx(p[o][1])-20?(this.picks[h].setLabelPosition({x:l,y:'5px'}),this.picks[h].setLabelBaseline('hanging')):(this.picks[h].setLabelBaseline('no-change'),this.picks[h].setLabelPosition({x:l,y:p[o][1],dy:'-15px'})),this.picks[h].setProp('xval',l),this.options.autoPeakPickingFormat?this.picks[h].setLabelText(this.options.autoPeakPickingFormat.call(this.picks[h],l,h)):this.picks[h].setLabelText(Math.round(1e3*l)/1e3+''),this.picks[h].makeLabels(),h++;this.picks[h]&&this.picks[h].isSelected();)h++;if(d.length==this.options.autoPeakPickingNb)break}}}hidePeakPicking(e){if(this._hidePeakPickingLocked||(this._hidePeakPickingLocked=e),!!this.graph.picks)for(var t=0;tr&&(r+=1),1i?i*(1+t):i+t-i*t,l=2*i-o;s=hue2rgb(l,o,e+1/3),r=hue2rgb(l,o,e),n=hue2rgb(l,o,e-1/3)}return[a(255*s),a(255*r),a(255*n)]}function saveDomAttributes(e,t,r){if(e)for(var a in e._savedAttributesIds=e._savedAttributesIds||[],-1'function'==typeof e?e(this.data,this.dataX):e),this.NPARMS=e.length}setSubset(e,t){e!==void 0&&t!==void 0&&(this._from=e,this._to=t)}hookIteration(e){this._hookIteration=(t)=>{let i=this.buildFit(t,200);e(i)}}setFunction(e){this._func=e}init(){if(void 0!==this._from&&void 0!==this._to){if(this._from>=this._to)throw'Impossible to fit negative subranges. The starting index must be lower than the ending index';if(this.NPTS=this._to-this._from+1,this.data&&this.data.getLength()<=this._to)throw'Wave Y has not enough point to be fitted to subrange ['+this._from+', '+this._to+']';if(0>this._from)throw'Impossible to fit a subrange with negative indices'}else this.NPTS=this.data.getLength(),this._from=0,this._to=this.data.getLength()-1;if(this.dataX&&this.dataX.getLength()<=this._to)throw'Wave X has not enough point to be fitted to subrange ['+this._from+', '+this._to+']';this.arrY=this.data.getDataY(),this.arrX=this.dataX?this.dataX.getDataY():this.data.getDataX(),this.resid=Array(this.NPTS).fill(0),this.jac=Array(this.NPTS).fill(0),this.jac=this.jac.map(()=>Array(this.NPARMS))}fit(){return this.log('Starting the fit with initial parameter list {'+this.parms.join()+'};'),new LM(this,this.NPARMS,this.NPTS,this._hookIteration),this.log('Fit successful. Output parameters {'+this.parms.join()+'};'),this._result=this.buildFit(this.parms,200),this.options.done&&this.options.done(this.parms,this._result),this._result}func(e,t){return this._func(e,t)}computeResiduals(){for(var e=0,t=0;ta*(i-e)/(t-1)+e)}for(var a=Array(r.length),s=0,i=r.length;sArray(this.nadj)),this.amatrix=this.amatrix.map(()=>Array(this.nadj)),this.lambda=this.LAMBDAZERO;var a=0,s=!1;do s=this.bLMiter(),r&&r(this.myH.params),a++;while(!s&&a=r){this.lambda*=this.LMSHRINK;break}for(var a=0;a-this.LMTOL||this.lambda>this.LAMBDAMAX}gaussj(e,t){var r=Math.abs,a=1,s=Array(100),n=Array(100),o,l,p,i,d,g;for(d=0;dd)for(i=0;id)for(p=0;pd)for(p=0;pd)for(i=0;i{t.push(e[0]),i.push(e[1])}),this.setXWaveform(t),e=i}let i=this._makeArray(e.length),r=!1;const a=this.isNaNAllowed();return e.map((e,t)=>{a||e[0]===e[0]&&e[1]===e[1]||(r=!0),i[t]=e}),r&&this.warn('Trying to assign NaN values to a typed array that does not support NaNs. 0\'s will be used instead'),this._setData(i),t&&this.setXWaveform(t),this}getY(e,t){return t&&this.dataInUse?this.dataInUse.y[e]*this.getScale()+this.getShift():this.data[e]*this.getScale()+this.getShift()}setXWaveform(e){if(!(e instanceof Waveform))if(Array.isArray(e))e=new Waveform(e);else throw'Cannot set X waveform. Data is not a valid array.';return this.xdata=e,this.computeXMinMax(),this}hasXWaveform(){return!!this.xdata}getXWaveform(){if(this.xdata)return this.xdata;for(var e=new Waveform,t=0;tthis.maxX||this.maxX===void 0)&&(this.maxX=e),(tthis.maxY||this.maxY===void 0)&&(this.maxY=t)}prepend(e,t){return'function'==typeof e&&(e=e(this)),'function'==typeof t&&(t=t(this)),this.xdata?this.xdata.prepend(null,e):null===e?this.xOffset-=this.xScale:(this.xdata=this.getXWaveform(),this.xdata.prepend(null,e)),this.data.unshift(t),this.recalculateMinMaxNewPoint(e,t),this}append(e,t){return'function'==typeof e&&(e=e(this)),'function'==typeof t&&(t=t(this)),this.xdata?this.xdata.append(null,e):null!==e&&(this.xdata=this.getXWaveform(),this.xdata.append(null,e)),this.monotoneous&&(t>this.data[this.data.y]&&!1===this.getMonotoneousAscending()?this.monotoneous=!1:tthis.data[0]),this.data.push(t),this.recalculateMinMaxNewPoint(e,t),this}_makeArray(e){const t=this.getTypedArrayClass();return t?new t(e):Array(e)}_setData(e){const t=e.length;let r=1,i=e[1]>e[0],a=e[0],s=e[0];for(this._monotoneous=!0;re[r-1]&&(this._monotoneous=!1),e[r]===e[r]&&(a=Math.min(e[r],a),s=Math.max(e[r],s));this._monotoneous&&(this._monotoneousAscending=e[1]>e[0]),this.minY=a,this.maxY=s,this.data=e,this.computeXMinMax()}computeXMinMax(){if(this.data)if(this.xdata)this.minX=this.xdata.getMin(),this.maxX=this.xdata.getMax();else{const e=this.xOffset+this.xScale*this.getLength(),t=this.xOffset;this.minX=Math.min(e,t),this.maxX=Math.max(e,t)}}getDataInUse(){return this.dataInUse||this.data}getIndexFromVal(e,t=!1,i=Math.round){let r=t&&this.dataInUse?this.dataInUse.y:this.data;let a;return a=this.getIndexFromData(e,r,this.data.getMonotoneousAscending(),i),t&&this.dataInUse&&'aggregateY'==this.dataInUseType?a-a%4:a}getIndexFromX(e,t=!1,i=Math.round){let r;t&&this.dataInUse?r=this.dataInUse.x:this.xdata&&(r=this.xdata.getData());let a;return a=this.hasXWaveform()?this.xdata.getIndexFromData(e,r,this.xdata.getMonotoneousAscending(),i):Math.max(0,Math.min(this.getLength()-1,i((e-this.xOffset)/this.xScale))),t&&this.dataInUse&&'aggregateX'==this.dataInUseType?a-a%4:a}getIndexFromData(e,t,i){if(!this.isMonotoneous())throw console.trace(),'Impossible to get the index from a non-monotoneous wave !';return e-=this.getShift(),e/=this.getScale(),binarySearch(e,t,!i)}getReductionType(){return this.dataInUseType}getXMin(){return this.minX*this.getXScale()+this.getXShift()}getXMax(){return this.maxX*this.getXScale()+this.getXShift()}getYMin(){return this.minY*this.getScale()+this.getShift()}getYMax(){return this.maxY*this.getScale()+this.getShift()}getMin(){return this.minY*this.getScale()+this.getShift()}getMax(){return this.maxY*this.getScale()+this.getShift()}getMinX(){return this.minX*this.getXScale()+this.getXShift()}getMaxX(){return this.maxX*this.getXScale()+this.getXShift()}getMinY(){return this.minY*this.getScale()+this.getShift()}getMaxY(){return this.maxY*this.getScale()+this.getShift()}getDataY(){return this.data}getData(e){return e&&this.dataInUse?this.dataInUse.y:this.data}setShift(e=0){return this.shift=e,this}getShift(){return this.shift||0}getScale(){return this.scale||1}setScale(e=1){return this.scale=e,this}setXShift(e=0){return this.hasXWaveform?(this.getXWaveform().setShift(e),this):this}getXShift(e=0){return this.hasXWaveform?this.getXWaveform().getShift():0}setXScale(e=1){return this.hasXWaveform?(this.getXWaveform().setScale(e),this):this}getXScale(){return this.hasXWaveform?this.getXWaveform().getScale():1}getLength(){return this.data.length}getDataToUseFlat(){let e=0,t,r;if(this.dataInUse){t=this.dataInUse.x.length,r=Array(2*t).fill(0);for(var a=0;at){let i=e;e=t,t=i}var r=t-e+1,a=0;let s=0,n;for(var o=this.getData();e<=t;e++)o.length-1>e&&(n=this.getX(e+1)-this.getX(e),s+=n,a+=o[e]*n);return[a,r,s]}integrateP(e,t){var i=this._integrateP(e,t);return i[0]}integrate(e,t){return this.integrateP(this.getIndexFromX(e),this.getIndexFromX(t))}average(e=0,t=this.getLength()-1){return this.getAverageP(e,t)}mean(){return this.average()}getAverageP(e,t){var i=this._integrateP(e,t);return i[0]/i[2]}getAverageX(e,t){var i=this._integrateX(e,t);return i[0]/i[2]}checkMonotonicity(){let e=1,t=this.getData();const i=this.data.length;for(let r=t[1]>t[0];et[e-1])return this._monotoneous=!1;return this._monotoneousAscending=t[1]>t[0],this._monotoneous=!0}requireXMonotonicity(){this.xdata&&this.xdata.requireMonotonicity()}requireMonotonicity(){if(!this.isMonotoneous())throw'The wave must be monotonic'}isMonotoneous(){return!!this._monotoneous}isXMonotoneous(){return!this.xdata||this.xdata.isMonotoneous()}invert(){let e=dataY||this.data;return e.reverse(),this.isMonotoneous()&&(this._monotoneousAscending=!this._monotoneousAscending),e}resampleForDisplay(e){let t=0;this.requireXMonotonicity();let i=!1,r=this.getDataY(),a={x:[],y:[]},s=[],n=!1,o=0,p,d,g,c,u,h,x,m;const y=this.getLength();if(!e.xPosition)throw'No position calculation method provided';if(!e.resampleToPx)throw'No "resampleToPx" method was provided. Unit: px per point';if(e.minX>e.maxX){let t=e.minX;e.minX=e.maxX,e.maxX=t}for((this.xdata&&!this.xdata.getMonotoneousAscending()||!this.xdata&&-0>this.xScale)&&(i=!0,t=y);i?0m){o=t;continue}if(x=e.xPosition(m),!n){for(o?(a.x.push(m),a.y.push(r[o])):o=t;isNaN(r[t]);)i?t--:t++;p=d=g=r[o],c=1,h=x,u=m,o=0,n=!0;continue}if(Math.abs(x-h)>e.resampleToPx||t==y||0==t||isNaN(r[t])){let t=(u+m)/2;if(a.x.push(t),a.y.push(p/c),s.push(t,d,g),void 0!==e.maxX&&m>e.maxX)break;n=!1;continue}p+=r[t],c++,d=Math.min(d,r[t]),g=Math.max(g,r[t])}return this.dataInUseType='resampled',this.dataInUse=a,s}interpolate(e){let t=this.getDataY(),i;if(this.xdata){let r=this.xdata.getData();return i=binarySearch(e,r,!this.xdata.getMonotoneousAscending()),r[i]==e?t[i]:(e-r[i])/(r[i+1]-r[i])*(t[i+1]-t[i])+t[i]}else{i=(e-this.xOffset)/this.xScale;let r=Math.floor(i);return(i-r)*(t[r+1]-t[r])+t[r]}}interpolateIndex_X(e){this.getDataY();if(this.xdata){let t=this.xdata.getData(),i=Math.floor(e);return(e-i)*(t[i+1]-t[i])+t[i]}}getMonotoneousAscending(){return this.isMonotoneous()?this._monotoneousAscending:'The waveform is not monotoneous'}getXMonotoneousAscending(){return this.xdata?this.xdata.getMonotoneousAscending():0t(e)/i)}add(e){return this._arithmetic(e,ADD)}addBy(){return this.add(...arguments)}subtract(e){return this._arithmetic(e,SUBTRACT)}subtractBy(){return this.subtract(...arguments)}math(e){for(var t=0;t{this._dataAggregated=e.aggregates,this._dataAggregating=!1})}hasAggregation(){return!!this._dataAggregated}selectAggregatedData(e){if(2>e)return!1;var t=pow2ceil(e);return this._dataAggregated[t]?(this.dataInUseType='aggregate'+this._dataAggregationDirection,void(this.dataInUse=this._dataAggregated[t])):this._dataAggregating?this._dataAggregating:void(this.dataInUseType='none',this.dataInUse={y:this.data,x:this.getXWaveform().data})}duplicate(e){var t=new Waveform;return t._setData(this.getDataY().slice()),t.rescaleX(this.xOffset,this.xShift),t.setShift(this.getShift()),t.setScale(this.getScale()),this.xdata?(e?t.setXWaveform(this.xdata.duplicate()):t.setXWaveform(this.xdata),t.setXShift(this.getXShift()),t.setXScale(this.getXScale())):(t.xOffset=this.xOffset,t.xScale=this.xScale),t}subrangeX(e,t){if(!this.xdata){let t=this.getIndexFromX(e),i=this.getIndexFromX(i);return new Waveform().setData(this.data.slice(t,i)).rescaleX(this.xOffset,this.xScale)}for(var r=new Waveform,a=0,i=this.data.length;a=e&&this.data[a]s&&(s=this.getY(o),n=o)}else{s=Number.POSITIVE_INFINITY;for(var o=e;o<=t;o++)this.getY(o)o)break;if(!(nt.rangeP[1]-(r-1)/2)break;if(a=this.getAverageP(n-(r-1)/2,n+(r-1)/2),void 0==s){s=a=e&&s){if(s=!1,'ascending'==t.edge||'both'==t.edge)for(i=n+(r-1)/2;i>=n-(r-1)/2;i--)if(this.data[i]>=e&&this.data[i-1]<=e)switch(t.rounding){case'before':return i-1;break;case'after':return i;break;case'interpolate':return getIndexInterpolate(e,this.data[i],this.data[i-1],i,i-1);}}else if(a<=e&&!s&&(s=!0,'descending'==t.edge||'both'==t.edge))for(i=n+(r-1)/2;i>=n-(r-1)/2;i--)if(this.data[i]<=e&&this.data[i-1]>=e)switch(t.rounding){case'before':return i-1;break;case'after':return i;break;case'interpolate':return getIndexInterpolate(e,this.data[i],this.data[i-1],i,i-1);}}}}normalize(e){let t,r,a,s,n,o;if('max1'==e||'max100'==e){for(t=1,'max100'==e&&(t=100),s=this.data[0],o=1;os&&(s=this.data[o]);for(o=0;os?s=this.data[o]:this.data[o]>=1;)t<<=1;return t}function pow2floor(e){for(var t=1;e>>=1;)t<<=1;return t}function getIndexInterpolate(e,t,i,r,a){return(e-t)/(i-t)*(a-r)+r}function binarySearch(e,t,r){let a=0,s=t.length,n=s-1,o=0,i=1,l;if(t[a]==e)return a;if(t[n]==e)return n;for(;;){if(o++,100=t.length-1)return t.length-1;if(0>=l)return 0;l+=i}if(l==a||t[l]==e||l==n)return l;if(t[l]<=e)r?n=l:a=l;else if(t[l]>e)r?a=l:n=l;else return!1;i*=-1}}const GraphOptionsDefault={title:'',paddingTop:30,paddingBottom:5,paddingLeft:20,paddingRight:20,close:{left:!0,right:!0,top:!0,bottom:!0},closeColor:'black',fontSize:12,fontFamily:'Myriad Pro, Helvetica, Arial',plugins:{},pluginAction:{},mouseActions:[],keyActions:[],wheel:{},dblclick:{},shapesUnselectOnClick:!0,shapesUniqueSelection:!0},defaultScatterStyle={shape:'circle',r:4};var _constructors=new Map;class Graph$1 extends EventEmitter{constructor(e,t,r){for(var a in super(),this._creation=guid(),this._drawn=!1,e!==Object(e)||e instanceof HTMLElement?'string'==typeof e?e=document.getElementById(e):'number'==typeof e.length&&(e=e[0]):(r=t,t=e,e=null),this.options=extend$1({},GraphOptionsDefault,t),doDom.bind(this)(),e&&this.setWrapper(e),this.prevented=!1,this.axis={left:[],top:[],bottom:[],right:[]},this.shapes=[],this.shapesLocked=!1,this.plugins={},this.options.pluginAction)this.options.pluginAction.plugin=a,this.options.mouseActions.push(this.options.pluginAction);if(this.selectedShapes=[],this.series=[],this._axesHaveChanged=!0,this.options.hasOwnProperty('padding')&&isNumeric$1(this.options.padding)&&(this.options.paddingTop=this.options.paddingBottom=this.options.paddingLeft=this.options.paddingRight=this.options.padding),this.currentAction=!1,this.ns=Graph$1.ns,this.nsxlink=Graph$1.nsxlink,r)for(var a in r)for(var i=0,s=r[a].length;i{t.getXAxis()==e&&t.kill()})),e.isY()&&(-1<(r=this.axis.left.indexOf(e))&&this.axis.left.splice(r,1),-1<(r=this.axis.right.indexOf(e))&&this.axis.right.splice(r,1),!i&&this.series.forEach((t)=>{t.getYAxis()==e&&t.kill()})),this.axisGroup.removeChild(e.group),this.groupPrimaryGrids.removeChild(e.gridPrimary),this.groupSecondaryGrids.removeChild(e.gridSecondary),t||this.draw(!0)}hasXAxis(e){return this.hasTopAxis(e)||this.hasBottomAxis(e)}hasYAxis(e){return this.hasLeftAxis(e)||this.hasRightAxis(e)}hasTopAxis(e){return this.hasAxis(e,this.axis.top)}hasBottomAxis(e){return this.hasAxis(e,this.axis.bottom)}hasLeftAxis(e){return this.hasAxis(e,this.axis.left)}hasRightAxis(e){return this.hasAxis(e,this.axis.right)}hasAxis(e,t){for(var r=0,i=t.length;re.include(t.getType()))}drawSerie(e,t){if(!e.draw)throw new Error('Serie has no method draw');e.draw(t)}drawSeries(e){if(this.width&&this.height)for(var t=this.series.length-1;0<=t;t--)this.series[t].isShown()&&this.drawSerie(this.series[t],e)}resetSeries(){this.removeSeries()}killSeries(){this.resetSeries()}removeSeries(){for(;this.series[0];)this.series[0].kill(!0);this.series=[],this.legend&&this.legend.update()}selectSerie(e,t){'object'==typeof e||(e=this.getSerie(e));this.selectedSerie==e&&this.selectedSerie.selectionType==t||(this.selectedSerie!==e&&this.selectedSerie&&this.unselectSerie(this.selectedSerie),this.selectedSerie=e,this.triggerEvent('onSelectSerie',e),e.select(t||'selected'))}getSelectedSerie(){return this.selectedSerie}unselectSerie(e){e.unselect&&(e.unselect(),this.selectedSerie=!1,this.triggerEvent('onUnselectSerie',e))}getShapesOfSerie(e){for(var t=[],r=this.shapes.length-1;0<=r;r--)this.shapes[r].getSerie()==e&&t.push(this.shapes[r]);return t}makeToolbar(e){var t=this.getConstructor('graph.toolbar');return t?this.toolbar=new t(this,e):throwError('No constructor exists for toolbar')}getShapes(){return this.shapes||[]}newShape(e,t,r=!1,a){if(this.prevent(!1),!r&&(this.emit('beforeNewShape',t),this.prevent(!1)))return!1;'object'==typeof e&&(r=t,t=e,e=t.type),t=t||{},t._id=guid();var s;if(s='function'==typeof e?e:this.getConstructor('graph.shape.'+e),!s)return throwError('No constructor for this shape');var n=new s(this,t);if(!n)return throwError('Failed to construct shape.');if(n.type=e,n.graph=this,n._data=t,void 0!==t.properties&&n.setProperties(t.properties),n.init(this,a),void 0!==t.props)for(var o in t.props)n.setProp(o,t.props[o]);if(t.position)for(var o=0,i=t.position.length;o{n.addTransform(e,t)}),void 0!==t.highlightOnMouseOver&&n.setProp('highlightOnMouseOver',!0),t.labelEditable&&n.setProp('labelEditable',t.labelEditable),t.labels&&!t.label&&(t.label=t.labels),void 0!==t.label){Array.isArray(t.label)||(t.label=[t.label]);for(var o=0,i=t.label.length;o[e.getZPos(),e]);o.sort((e,t)=>t[0]-e[0]);let l=0;o.forEach((e)=>{e[1].setLayer(l),this.appendSerieToDom(e[1]),l++}),this.drawSeries(!0)}kill(){this.wrapper.removeChild(this.dom)}_removeSerie(e){this.series.splice(this.series.indexOf(e),1),this._pluginsExecute('serieRemoved',e)}contextListen(e,t,i){if(this.options.onContextMenuListen)return this.options.onContextMenuListen(e,t,i)}lockShapes(){this.shapesLocked=!0;for(var e=0,t=this.shapes.length;ethis.drawingSpaceWidth}getDrawingSpaceHeight(){return()=>this.drawingSpaceHeight}getDrawingSpaceMinX(){return()=>this.drawingSpaceMinX}getDrawingSpaceMinY(){return()=>this.drawingSpaceMinY}getDrawingSpaceMaxX(){return()=>this.drawingSpaceMaxX}getDrawingSpaceMaxY(){return()=>this.drawingSpaceMaxY}trackingLine(e){var t=this;return'boolean'==typeof e?void(this.options.trackingLine&&(this.options.trackingLine.enable=e)):(e&&(this.options.trackingLine=e),e.series=e.series||[],e.enable=void 0===e.enable||!!e.enable,'individual'==e.mode?e.series&&(!Array.isArray(e.series)&&('all'==e.series?e.series=this.series.map((e)=>({serie:e})):e.series=[e.series]),e.series.forEach((e)=>{if('object'!=typeof e.serie){if('object'!=typeof e)throw new Error('Misuse of the trackingLine() method. Each serie must be an object with the serie property: { series: [ { serie: jsGraphSerie, options: { ... someOptions } } ] }');e.serie=this.getSerie(e.serie)}e.serie&&t.addSerieToTrackingLine(e.serie,e)})):e.series.forEach((e)=>{e.serie.disableTracking()}),!e.noLine)?(this.trackingObject||(this.trackingObject=this.newShape('line',extend$1(!0,{position:[{y:'min'},{y:'max'}],stroke:'black',layer:-1},e.trackingLineShapeOptions))),this.trackingObject.draw(),this.trackingObject):void 0}addSerieToTrackingLine(e,t){this.options.trackingLine||this.trackingLine({mode:'individual'}),this.options.trackingLine.series.forEach((t,i)=>{t.serie==e&&this.options.trackingLine.series.splice(i,1)}),this.options.trackingLine.series.push(Object.assign({serie:e},t)),e.enableTracking((e,i,r,a)=>{this.options.trackingLine.enable&&i&&(this.trackingObject&&(this.trackingObject.show(),this.trackingObject.getPosition(0).x=i.trueX,this.trackingObject.getPosition(1).x=i.trueX,this.trackingObject.redraw()),e._trackingLegend=_trackingLegendSerie(this,{serie:e},r,a,e._trackingLegend,t.textMethod?t.textMethod:(e)=>{for(var t in e)return e[t].serie.serie.getName()+': '+e[t].serie.serie.getYAxis().valueToHtml(e[t].yValue)},i.trueX),e._trackingLegend&&(e._trackingLegend.style.display='block'))},(e)=>{this.trackingObject&&this.trackingObject.hide(),e.trackingShape&&e.trackingShape.hide(),e._trackingLegend&&(e._trackingLegend.style.display='none'),e._trackingLegend=_trackingLegendSerie(this,{serie:e},!1,!1,e._trackingLegend,!1,!1)})}setKatexRenderer(e){this._katexRenderer=e}hasKatexRenderer(){return!!this._katexRenderer}renderWithKatex(e,t){if(this._katexRenderer){t?t.removeChild(t.firstChild):t=document.createElementNS(Graph$1.ns,'foreignObject');let i=document.createElement('div');return t.appendChild(i),this._katexRenderer(e,i),t}return!1}static fromJSON(e,t){let i={},r={left:[],top:[],right:[],bottom:[]},a,s;return e.title&&(i.title=e.title),e.axis&&e.axis.forEach(function(e){e.type||throwError('Axis type is required (top, bottom, left or right)');var t={};e.label&&(t.labelValue=e.label),void 0!==e.unit&&(t.unit=e.unit),void 0!==e.unitWrapperAfter&&(t.unitWrapperAfter=e.unitWrapperAfter),void 0!==e.unitWrapperBefore&&(t.unitWrapperBefore=e.unitWrapperBefore),void 0!==e.min&&(t.forcedMin=e.min),void 0!==e.max&&(t.forcedMax=e.max),void 0!==e.flip&&(t.flipped=e.flip),r[e.type].push(t),e._jsGraphIndex=r[e.type].length-1}),a=new Graph$1(t,i,r),e.width&&a.setWidth(e.width),e.height&&a.setHeight(e.width),a._resize(),e.data&&e.data.forEach(function(t){var r=t.type,n={},o,p;let d;switch(t.type){case'bar':throwError('Bar charts not supported'),r=!1;break;case'color':r=Graph$1.SERIE_LINE_COLORED;break;case'scatter':r=Graph$1.SERIE_SCATTER;break;case'box':r=Graph$1.SERIE_BOX,('x'==t.orientation||'y'==t.orientation)&&(n.orientation=t.orientation);break;default:r=Graph$1.SERIE_LINE;}if(r!==Graph$1.SERIE_BOX&&(d=Graph$1.newWaveform()),!r)return void throwError('No valid serie type was found');if(o=a.newSerie(t.id||t.label||guid(),n,r),t.lineStyle){let e;Array.isArray(e)&&(e={unselected:e}),Object.entries(e).forEach(([e,t])=>{var i={};r===Graph$1.SERIE_LINE?(void 0!==t.lineWidth&&(i.lineWidth=t.lineWidth),void 0!==t.color&&(i.lineColor=t.color),t.lineStyle&&(i.lineStyle=t.lineStyle),o.setStyle(i,e)):void 0})}let g={},c={};if(t.defaultStyle&&(g=t.defaultStyle),t.defaultStyles&&(c=t.defaultStyles),t.styles){let e=Array.isArray(t.styles)?{unselected:t.styles}:t.styles;let i=new Set(Object.keys(c).concat(Object.keys(e)));i.forEach((t)=>{let i=[],a;e&&e[t]&&(i=e[t],!Array.isArray(i)&&(i=[i]),a=i.map(function(e){switch(r){case Graph$1.SERIE_LINE:return{type:e.shape,zoom:e.zoom,strokeWidth:e.lineWidth,strokeColor:e.lineColor,fillColor:e.color,points:e.points};break;case Graph$1.SERIE_BOX:return e;break;case Graph$1.SERIE_SCATTER:return e;}})),r===Graph$1.SERIE_LINE?o.setMarkers(a,t):r===Graph$1.SERIE_SCATTER?o.setStyle(Object.assign({},defaultScatterStyle,g,c[t]||{}),a,t):r===Graph$1.SERIE_BOX?o.setStyle(a[0],t||'unselected'):void 0})}if(t.color&&r==Graph$1.SERIE_LINE_COLORED&&o.setColors(t.color),r!==Graph$1.SERIE_BOX&&d.setData(t.y,t.x),!!o){let n=[],l=[],g=[],c=[],h=[],x=[],m=[],y=[];if(void 0!==d){if(t.errorX)for(var u=0,i=t.errorX.length;u{this.axis[e]&&(t=t.concat(this.axis[e].map((t)=>({type:e,label:t.options.label,unit:t.options.unit,min:t.options.forcedMin,max:t.options.forcedMax,flip:t.options.flipped}))),'top'==e||'bottom'==e?i.x=i.x.concat(this.axis[e]):i.y=i.y.concat(this.axis[e]))}),e.axis=t;let r=(e)=>{switch(e){case Graph$1.SERIE_LINE:return'line';break;case Graph$1.SERIE_BAR:return'bar';break;case Graph$1.SERIE_LINE_COLORED:return'color';break;case Graph$1.SERIE_SCATTER:return'scatter';}},a=(e,t)=>{let r=[];switch(e.getType()){case Graph$1.SERIE_LINE:for(var a=0;a{let t=[],s=[];if(e.getType()==Graph$1.SERIE_LINE)for(var n in e.styles){s.push({styleName:n,color:e.styles[n].lineColor,lineWidth:e.styles[n].lineWidth,lineStyle:e.styles[n].lineStyle});let i={styleName:n,styles:[]};t.push(i),i.styles=i.styles.concat((e.styles[n].markers||[]).map((e)=>({shape:e.type,zoom:e.zoom,lineWidth:e.strokeWidth,lineColor:e.strokeColor,color:e.fillColor,points:e.points})))}return{label:e.getLabel(),id:e.getName(),type:r(e.getType()),x:a(e,!0),y:a(e,!1),xAxis:i.x.indexOf(e.getXAxis()),yAxis:i.y.indexOf(e.getYAxis()),style:t,lineStyle:s}})),e}static registerConstructor(e,t){return _constructors.has(e)?throwError('Constructor '+t+' already exists.'):void _constructors.set(e,t)}static getConstructor(e,t=!1){return _constructors.has(e)?_constructors.get(e):!t&&throwError('Constructor "'+e+'" doesn\'t exist')}static newWaveform(){return new Waveform(...arguments)}static waveform(){return new Waveform(...arguments)}}Graph$1.prototype.getConstructor=Graph$1.getConstructor;function makeSerie(e,t,i,r){var a=e.getConstructor(r,!0);if(a||'string'!=typeof r||(a=e.getConstructor('graph.serie.'+r,!0)),a){var s=new a(e,t,i);e.appendSerieToDom(s)}else return throwError('No constructor exists for the serie type provided. Use Graph.registerConstructor( name, constructor ) first is you use your own series');return s}function getAxisLevelFromSpan(e,t){for(var r=0,i=t.length,a;rt[r][s][1]&&e[1]>t[r][s][1]||(a=!1);if(a)return t[r].push(e),r}return t.push([e]),t.length-1}function refreshDrawingZone(e){var t=Math.max,i={top:[],bottom:[],left:[],right:[]},r={top:[],bottom:[],left:[],right:[]};e._painted=!0,e._applyToAxes(function(e,a){if(!e.isShown())return void e.hideGroup();if(e.showGroup(),!e.floating){var s=getAxisLevelFromSpan(e.getSpan(),r[a]);e.setLevel(s),i[a][s]=t(e.getAxisPosition(),i[a][s]||0)}},!1,!0,!1);var a=i.top.reduce(function(e,t){return e+t},0),s=i.bottom.reduce(function(e,t){return e+t},0);e.drawingSpaceHeight=e.getDrawingHeight()-a-s,[i.top,i.bottom].map(function(e){e.reduce(function(t,i,r){return e[r]=t+i,t+i},0)}),e._applyToAxes(function(e,t){!e.isShown()||e.floating||e.setShift(i[t][e.getLevel()])},!1,!0,!1),e._applyToAxes(function(n,o){if(n.isShown()?n.showGroup():n.hideGroup(),n.setMinPx(a),n.setMaxPx(e.getDrawingHeight(!0)-s),!n.floating){let e=n.linkedToAxis?0:n.draw();if(n.isShown()){var l=getAxisLevelFromSpan(n.getSpan(),r[o]);n.setLevel(l),i[o][l]=t(e,i[o][l]||0)}}},!1,!1,!0);var n=extend$1(!0,{},i);e._applyToAxes(function(e,r){!e.isShown()||e.floating||(n[r][e.getLevel()]=t(i[r][e.getLevel()],e.equalizePosition(i[r][e.getLevel()])))},!1,!1,!0),i=n;var o=i.left.reduce(function(e,t){return e+t},0),l=i.right.reduce(function(e,t){return e+t},0);e.drawingSpaceWidth=e.getDrawingWidth()-o-l,[i.left,i.right].map(function(e){e.reduce(function(t,i,r){return e[r]=t+i,t+i},0)}),e._applyToAxes((e,t)=>{!e.isShown()||e.floating||e.setShift(i[t][e.getLevel()])},!1,!1,!0),e._applyToAxes(function(t){!t.isShown(),t.setMinPx(o),t.setMaxPx(e.getDrawingWidth(!0)-l);t.floating||!t.linkedToAxis&&t.draw()},!1,!0,!1),e._applyToAxes(function(e){if(e.floating){var t=e.getFloatingAxis(),i=e.getFloatingValue(),r=t.getPx(i);e.setShift(r),e.linkedToAxis||e.draw()}},!1,!0,!0),_closeLine(e,'right',e.getDrawingWidth(!0),e.getDrawingWidth(!0),a,e.getDrawingHeight(!0)-s),_closeLine(e,'left',0,0,a,e.getDrawingHeight(!0)-s),_closeLine(e,'top',o,e.getDrawingWidth(!0)-l,0,0),_closeLine(e,'bottom',o,e.getDrawingWidth(!0)-l,e.getDrawingHeight(!0)-s,e.getDrawingHeight(!0)-s),e.clipRect.setAttribute('y',a),e.clipRect.setAttribute('x',o),e.clipRect.setAttribute('width',e.getDrawingWidth()-o-l),e.clipRect.setAttribute('height',e.getDrawingHeight()-a-s),e.rectEvent.setAttribute('y',a+e.getPaddingTop()),e.rectEvent.setAttribute('x',o+e.getPaddingLeft()),e.rectEvent.setAttribute('width',e.drawingSpaceWidth),e.rectEvent.setAttribute('height',e.drawingSpaceHeight),e.drawingSpaceMinX=o+e.getPaddingLeft(),e.drawingSpaceMinY=a+e.getPaddingTop(),e.drawingSpaceMaxX=e.getDrawingWidth()-l+e.getPaddingLeft(),e.drawingSpaceMaxY=e.getDrawingHeight()-s+e.getPaddingTop(),e._applyToAxes(function(e){e.isShown()&&e.drawLines()},!1,!0,!0),e.shift=i,e.redrawShapes()}function _handleKey(e,t,i){return console.log(t,i),e.forcedPlugin?(e.activePlugin=e.forcedPlugin,void e._pluginExecute(e.activePlugin,i,[e,t])):void checkKeyActions(e,t,[e,t],i)}function checkKeyActions(t,r,e,a){var s=t.options.keyActions,n,i;for(n=0,i=s.length;n{e.kill(s[n].keepInDom)}))}return!1}function doDom(){this.dom=document.createElementNS(Graph$1.ns,'svg'),this.dom.setAttributeNS('http://www.w3.org/2000/xmlns/','xmlns:xlink','http://www.w3.org/1999/xlink'),setAttributeTo(this.dom,{xmlns:Graph$1.ns,"font-family":this.options.fontFamily,"font-size":this.options.fontSize});try{setAttributeTo(this.dom,{"data-jsgraph-version":'v<%= pkg.version %>'})}catch(t){}this.defs=document.createElementNS(Graph$1.ns,'defs'),this.dom.appendChild(this.defs),this.groupEvent=document.createElementNS(Graph$1.ns,'g'),this.rectEvent=document.createElementNS(Graph$1.ns,'rect'),setAttributeTo(this.rectEvent,{"pointer-events":'fill',fill:'transparent'}),this.groupEvent.appendChild(this.rectEvent),this.dom.appendChild(this.groupEvent),this.domTitle=document.createElementNS(Graph$1.ns,'text'),this.setTitle(this.options.title),setAttributeTo(this.domTitle,{"text-anchor":'middle',y:20}),this.groupEvent.appendChild(this.domTitle),this.graphingZone=document.createElementNS(Graph$1.ns,'g'),this.updateGraphingZone(),this.groupEvent.appendChild(this.graphingZone),this.axisGroup=document.createElementNS(Graph$1.ns,'g'),this.graphingZone.appendChild(this.axisGroup),this.groupGrids=document.createElementNS(Graph$1.ns,'g'),this.groupPrimaryGrids=document.createElementNS(Graph$1.ns,'g'),this.groupSecondaryGrids=document.createElementNS(Graph$1.ns,'g'),this.axisGroup.appendChild(this.groupGrids),this.groupGrids.appendChild(this.groupSecondaryGrids),this.groupGrids.appendChild(this.groupPrimaryGrids),this.plotGroup=document.createElementNS(Graph$1.ns,'g'),this.graphingZone.appendChild(this.plotGroup),this.layers=[],this._makeClosingLines(),this.clip=document.createElementNS(Graph$1.ns,'clipPath'),this.clip.setAttribute('id','_clipplot'+this._creation),this.defs.appendChild(this.clip),this.clipRect=document.createElementNS(Graph$1.ns,'rect'),this.clip.appendChild(this.clipRect),this.clip.setAttribute('clipPathUnits','userSpaceOnUse'),this.markerArrow=document.createElementNS(this.ns,'marker'),this.markerArrow.setAttribute('viewBox','0 0 10 10'),this.markerArrow.setAttribute('id','arrow'+this._creation),this.markerArrow.setAttribute('refX','6'),this.markerArrow.setAttribute('refY','5'),this.markerArrow.setAttribute('markerUnits','strokeWidth'),this.markerArrow.setAttribute('markerWidth','8'),this.markerArrow.setAttribute('markerHeight','6'),this.markerArrow.setAttribute('orient','auto');var e=document.createElementNS(Graph$1.ns,'path');e.setAttribute('d','M 0 0 L 10 5 L 0 10 z'),this.markerArrow.appendChild(e),this.defs.appendChild(this.markerArrow),this.markerHorizontalSplit=document.createElementNS(Graph$1.ns,'marker'),this.markerHorizontalSplit.setAttribute('viewBox','0 0 6 8'),this.markerHorizontalSplit.setAttribute('id','horionzalsplit_'+this.getId()),this.markerHorizontalSplit.setAttribute('refX','3'),this.markerHorizontalSplit.setAttribute('refY','4'),this.markerHorizontalSplit.setAttribute('markerUnits','strokeWidth'),this.markerHorizontalSplit.setAttribute('markerWidth','6'),this.markerHorizontalSplit.setAttribute('markerHeight','8');var t=document.createElementNS(Graph$1.ns,'line');t.setAttribute('x1','0'),t.setAttribute('y1','8'),t.setAttribute('x2','6'),t.setAttribute('y2','0'),t.setAttribute('stroke','black'),this.markerHorizontalSplit.appendChild(t),this.defs.appendChild(this.markerHorizontalSplit),this.markerVerticalSplit=document.createElementNS(Graph$1.ns,'marker'),this.markerVerticalSplit.setAttribute('viewBox','0 0 8 6'),this.markerVerticalSplit.setAttribute('id','verticalsplit_'+this.getId()),this.markerVerticalSplit.setAttribute('refX','4'),this.markerVerticalSplit.setAttribute('refY','3'),this.markerVerticalSplit.setAttribute('markerUnits','strokeWidth'),this.markerVerticalSplit.setAttribute('markerWidth','8'),this.markerVerticalSplit.setAttribute('markerHeight','6');var t=document.createElementNS(Graph$1.ns,'line');t.setAttribute('x1','0'),t.setAttribute('y1','0'),t.setAttribute('x2','8'),t.setAttribute('y2','6'),t.setAttribute('stroke','black'),this.markerVerticalSplit.appendChild(t),this.defs.appendChild(this.markerVerticalSplit),this.vertLineArrow=document.createElementNS(Graph$1.ns,'marker'),this.vertLineArrow.setAttribute('viewBox','0 0 10 10'),this.vertLineArrow.setAttribute('id','verticalline'+this._creation),this.vertLineArrow.setAttribute('refX','0'),this.vertLineArrow.setAttribute('refY','5'),this.vertLineArrow.setAttribute('markerUnits','strokeWidth'),this.vertLineArrow.setAttribute('markerWidth','20'),this.vertLineArrow.setAttribute('markerHeight','10'),this.vertLineArrow.setAttribute('orient','auto'),this.vertLineArrow.setAttribute('stroke-width','1px');var i=document.createElementNS(Graph$1.ns,'path');i.setAttribute('d','M 0 -10 L 0 10'),i.setAttribute('stroke','black'),this.vertLineArrow.appendChild(i),this.defs.appendChild(this.vertLineArrow),this.bypassHandleMouse=!1}function _registerEvents(t){if(!t.wrapper)throw'No wrapper exists. Cannot register the events.';t.dom.setAttribute('tabindex',0),t.dom.addEventListener('keydown',(i)=>{_handleKey(t,i,'keydown')}),t.dom.addEventListener('keypress',(i)=>{_handleKey(t,i,'keypress')}),t.dom.addEventListener('keyup',(i)=>{_handleKey(t,i,'keyup')}),t.dom.addEventListener('mousemove',(i)=>{var e=t._getXY(i);_handleMouseMove(t,e.x,e.y,i)}),t.dom.addEventListener('mouseleave',()=>{_handleMouseLeave(t)}),t.groupEvent.addEventListener('mousedown',(i)=>{if(t.focus(),!(3==i.which||i.ctrlKey)){var e=t._getXY(i);_handleMouseDown(t,e.x,e.y,i)}}),t.dom.addEventListener('mouseup',(i)=>{t.emit('mouseUp',i);var e=t._getXY(i);_handleMouseUp(t,e.x,e.y,i)}),t.wrapper.addEventListener('mouseup',(t)=>{t.stopPropagation()}),t.dom.addEventListener('dblclick',(i)=>{t.emit('dblClick',i);var e=t._getXY(i);_handleDblClick(t,e.x,e.y,i)}),t.groupEvent.addEventListener('click',(i)=>{if(!(3==i.which||i.ctrlKey)){var e=t._getXY(i);t.prevent(!1)||_handleClick(t,e.x,e.y,i)}}),t.groupEvent.addEventListener('mousewheel',(i)=>{var e=i.wheelDeltaY||i.wheelDelta||-i.deltaY,r=t._getXY(i);return _handleMouseWheel(t,e,r.x,r.y,i),!1}),t.groupEvent.addEventListener('wheel',(i)=>{var e=t._getXY(i),r=i.wheelDeltaY||i.wheelDelta||-i.deltaY;return _handleMouseWheel(t,r,e.x,e.y,i),!1})}function _handleMouseDown(t,i,r,a){return t.forcedPlugin?(t.activePlugin=t.forcedPlugin,void t._pluginExecute(t.activePlugin,'onMouseDown',[t,i,r,a])):void(t.activePlugin&&(t.activePlugin=!1),checkMouseActions(t,a,[t,i,r,a],'onMouseDown'))}function _handleMouseMove(t,r,a,s){if(t.bypassHandleMouse)return void t.bypassHandleMouse.handleMouseMove(s);if(!(t.activePlugin&&t._pluginExecute(t.activePlugin,'onMouseMove',[t,r,a,s]))){if(t._applyToAxes('handleMouseMove',[r-t.options.paddingLeft,s],!0,!1),t._applyToAxes('handleMouseMove',[a-t.options.paddingTop,s],!1,!0),!t.activePlugin){var e;if(t.options.trackingLine&&t.options.trackingLine.enable&&t.options.trackingLine.snapToSerie&&'common'==t.options.trackingLine.mode){var n=t.options.trackingLine.snapToSerie;if(e=n.handleMouseMove(!1,!0),this.trackingObject)if(!e)t.trackingObject.hide();else{t.trackingObject.show(),t.trackingObject.getPosition(0).x=e.xClosest,t.trackingObject.getPosition(1).x=e.xClosest,t.trackingObject.redraw();var r=n.getXAxis().getPx(e.xClosest)+t.options.paddingLeft}var o=t.options.trackingLine.series;o||(o=t.getSeries().map(function(e){return{serie:e,withinPx:20,withinVal:-1}})),t._trackingLegend=_trackingLegendSerie(t,o,r,a,t._trackingLegend,t.options.trackingLine.textMethod,e.xClosest)}}if(t.options.onMouseMoveData){for(var l={},p=0;p{var r=t.serie.handleMouseMove(n,!1);if(!r||!s)return t.serie.trackingShape&&t.serie.trackingShape.hide(),a;if(0t.serie.getXAxis().getVal(i-e.options.paddingLeft)/1e5)t.serie.trackingShape&&t.serie.trackingShape.hide();else{p[t.serie.getName()]={yValue:r.xClosest,xValue:r.yClosest,serie:t,index:r};let i;if(i=e.options.trackingLine&&e.options.trackingLine.serieShape?e.options.trackingLine.serieShape:{shape:'ellipse',properties:{rx:[3*t.serie.getLineWidth()+'px'],ry:[3*t.serie.getLineWidth()+'px']}},t.serie.trackingShape||(t.serie.trackingShape=e.newShape(i.shape,{fillColor:t.serie.getLineColor(),strokeColor:'White',strokeWidth:t.serie.getLineWidth()},!0,i.properties).setSerie(t.serie).forceParentDom(t.serie.groupMain).draw(),i.onCreated&&i.onCreated(t.serie.trackingShape),t.serie.trackingShape.on('changed',()=>{i.onChanged&&i.onChanged(t.serie.trackingShape)})),t.serie.trackingShape.show(),t.serie.trackingShape.getPosition(0).x=r.xClosest,i.magnet){let e=i.magnet,a=e.within,s;e.withinPx&&(a=t.serie.getXAxis().getRelVal(e.withinPx)),(s=t.serie.findLocalMinMax(r.xClosest,a,e.mode))&&(t.serie.trackingShape.getPosition(0).x=s)}t.serie.trackingShape.redraw()}}),!!e.options.trackingLine.legend){if(0==Object.keys(p).length||!s)a.style.display='none';else{'none'==a.style.display||l?forceTrackingLegendMode(e,a,i,r,!0):_trackingLegendMove(e,a,i,r),a.style.display='block';var d=s(p,n,i,r);a.innerHTML=d}return a}},forceTrackingLegendMode=function(e,t,i,r,a){function s(){var e=(Date.now()-n)/200;1e&&window.requestAnimationFrame(s)}var n=Date.now(),o=t.offsetHeight,l=parseInt(t.style.marginLeft.replace('px','')||0),p=parseInt(t.style.marginTop.replace('px','')||0);return i=i>e.getWidth()/2?i-i%10-20-t.offsetWidth:i-i%10+30,r=r-r%10+o/2,a?(t.style.marginLeft=i+'px',void(t.style.marginTop=r+'px')):void window.requestAnimationFrame(s)},_trackingLegendMove=debounce(forceTrackingLegendMode,50);function _makeTrackingLegend(e){var t=document.createElement('div');return t.setAttribute('class','trackingLegend'),t.style.position='absolute',t.style.borderRadius='4px',t.style.boxShadow='1px 1px 3px 0px rgba(100,100,100,0.6)',t.style.border='2px solid #333333',t.style.backgroundColor='rgba(255, 255, 255, 0.5 )',t.style.pointerEvents='none',t.style.paddingTop='5px',t.style.paddingBottom='5px',t.style.paddingLeft='10px',t.style.paddingRight='10px',e.getWrapper().insertBefore(t,e.getDom()),t}function _handleDblClick(t,i,r,a){t.options.dblclick;checkMouseActions(t,a,[i,r,a],'onDblClick')}function _handleMouseUp(t,i,r,a){return t.bypassHandleMouse?(t.bypassHandleMouse.handleMouseUp(a),void(t.activePlugin=!1)):void(t._pluginExecute(t.activePlugin,'onMouseUp',[t,i,r,a]),t.activePlugin=!1)}function _handleClick(t,i,r,a){t.emit('click',[t,i,r,a]),checkMouseActions(t,a,[i,r,a],'onClick'),a.target.jsGraphIsShape||t.prevent(!1)||!t.options.shapesUnselectOnClick||t.unselectShapes()}function _getAxis(e,t,i,r){var i=i||{},a={def:{x:e.getConstructor('graph.axis.x'),y:e.getConstructor('graph.axis.y')},time:{x:e.getConstructor('graph.axis.x.time')},bar:{x:e.getConstructor('graph.axis.x.bar')}},s;switch(i.type){case'time':var n=a.time;break;case'bar':var n=a.bar;break;case'broken':var n=a.broken;break;default:var n=a.def;}return'top'===r||'bottom'===r?s=n.x:'left'===r||'right'===r?s=n.y:void 0,t=t||0,'object'==typeof t&&(i=t,t=0),e.axis[r][t]||(e.axis[r][t]=new s(e,r,i),e.axis[r][t].init(e,i)),e.axis[r][t]}function _closeLine(e,t,i,r,a,s){if(!1!==e.options.close){var n=0;e.axis[t].map(function(e){e.isDisplayed()&&!e.floating&&n++}),(!0===e.options.close||e.options.close[t])&&0==n?(e.closingLines[t].setAttribute('display','block'),e.closingLines[t].setAttribute('x1',i),e.closingLines[t].setAttribute('x2',r),e.closingLines[t].setAttribute('y1',a),e.closingLines[t].setAttribute('y2',s)):e.closingLines[t].setAttribute('display','none')}}function _handleMouseWheel(t,i,r,a,s){checkMouseActions(t,s,[i,s,r,a],'onMouseWheel')&&(s.preventDefault(),s.stopPropagation())}function _handleMouseLeave(e){e.options.handleMouseLeave&&e.options.handleMouseLeave.call(e)}function haveAxesChanged(e){var t=e._axesHaveChanged;return e._axesHaveChanged=!1,t}function hasSizeChanged(e){var t=e._sizeChanged;return e._sizeChanged=!1,t}Graph$1.SERIE_LINE=Symbol(),Graph$1.SERIE_SCATTER=Symbol(),Graph$1.SERIE_CONTOUR=Symbol(),Graph$1.SERIE_BAR=Symbol(),Graph$1.SERIE_BOX=Symbol(),Graph$1.SERIE_ZONE=Symbol(),Graph$1.SERIE_LINE_COLORED=Symbol(),Graph$1.SERIE_ZONE=Symbol(),Graph$1.SERIE_DENSITYMAP=Symbol(),Graph$1.SERIE_LINE_3D=Symbol(),Graph$1.SERIE_ZONE_3D=Symbol(),Graph$1.TICKS_OUTSIDE=Symbol(),Graph$1.TICKS_INSIDE=Symbol(),Graph$1.TICKS_CENTERED=Symbol(),Graph$1.ns='http://www.w3.org/2000/svg',Graph$1.nsxlink='http://www.w3.org/1999/xlink';var legendDefaults={backgroundColor:'rgba(255, 255, 255, 0.8)',frame:!0,frameWidth:1,frameColor:'black',paddingTop:10,paddingLeft:10,paddingBottom:10,paddingRight:10,color:'black',frameRounding:0,movable:!1,shapesToggleable:!0,isSerieHideable:!0,isSerieSelectable:!0};class Legend{constructor(e,t){this.options=extend$1({},legendDefaults,t),this.graph=e,this.svg=document.createElementNS(this.graph.ns,'g'),this.subG=document.createElementNS(this.graph.ns,'g'),this.groups=[],this.rect=document.createElementNS(this.graph.ns,'rect'),this.rectBottom=document.createElementNS(this.graph.ns,'rect'),this.rect.setAttribute('x',0),this.rect.setAttribute('y',0),this.rectBottom.setAttribute('x',0),this.rectBottom.setAttribute('y',0),this.series=!1,this.svg.setAttribute('display','none'),this.pos={x:void 0,y:void 0,transformX:0,transformY:0},this.setEvents(),this.eyeId=guid(),this.eyeCrossedId=guid();var i=SVGParser(''),r=SVGParser('');this.svg.appendChild(document.adoptNode(r.documentElement.firstChild)),this.svg.appendChild(document.adoptNode(i.documentElement.firstChild)),this.svg.appendChild(this.subG),this.applyStyle()}setPosition(e,t,i){e&&(this.position=e,this.alignToX=t||'left',this.alignToY=i||'top')}setDraggable(e){this.options.movable=e}setAutoPosition(e){return-1<['bottom','left','top','right'].indexOf(e=e.toLowerCase())?(this.autoPosition=e,this):void(this.requireDelayedUpdate(),this.autoPosition=!1)}autoPosition(){return this.setAutoPosition(...arguments)}buildLegendBox(){var e=this.series||this.graph.getSeries(),t=0,r=this.options.paddingTop;this.autoPosition?this.graph.getDom().appendChild(this.getDom()):this.graph.graphingZone.appendChild(this.getDom());for(var a=0,i=e.length;athis.graph.getDrawingWidth()-this.options.paddingRight&&(r+=16,t=0)}this.groups[a].setAttribute('transform','translate( '+t+', '+r+')'),'bottom'==this.autoPosition||'top'==this.autoPosition?(t+=s.width+10,r+=0):(t=0,r+=16)}var s=getBBox(this.subG);switch(this.width=s.width+this.options.paddingRight+this.options.paddingLeft,this.height=s.height+this.options.paddingBottom+this.options.paddingTop,this.rect.setAttribute('width',this.width),this.rect.setAttribute('height',this.height),this.rect.setAttribute('fill','none'),this.rect.setAttribute('pointer-events','fill'),this.rect.setAttribute('display','none'),this.options.movable&&(this.rectBottom.style.cursor='move'),this.rectBottom.setAttribute('width',this.width),this.rectBottom.setAttribute('height',this.height),this.rectBottom.setAttribute('x',s.x-this.options.paddingLeft),this.rectBottom.setAttribute('y',s.y-this.options.paddingTop),this.position=this.position||{},this.autoPosition){case'bottom':this.position.y=this.graph.getHeight()+'px',this.position.x=(this.graph.drawingSpaceWidth-this.width)/2+this.graph.drawingSpaceMinX+'px',this.alignToY='bottom',this.alignToX=!1;break;case'left':this.position.x='6px',this.position.y=(this.graph.getHeight()-this.height)/2+'px',this.alignToX='left',this.alignToY=!1;break;case'right':this.position.x=this.graph.getWidth()+'px',this.position.y=(this.graph.getHeight()-this.height)/2+'px',this.alignToX='right',this.alignToY=!1;break;case'top':this.position.x=(this.graph.drawingSpaceWidth-this.width)/2+this.graph.drawingSpaceMinX+'px',this.position.y='10px',this.alignToY='top',this.alignToX=!1;}if(this.autoPosition){switch(this.autoPosition){case'bottom':this.graph.options.paddingBottom=this.height+10;break;case'left':this.graph.options.paddingLeft=this.width+5;break;case'right':this.graph.options.paddingRight=this.width+10;break;case'top':this.graph.options.paddingTop=this.height+14;}this.graph.updateGraphingZone(),this.graph.getDrawingHeight(),this.graph.getDrawingWidth()}this.bbox=s}calculatePosition(){var e=Position.check(this.position);let t=e.compute(this.graph,this.graph.getXAxis(),this.graph.getYAxis());t&&('max'==e.y&&(t.y+=this.graph.getPaddingTop()),'max'==e.x&&(t.x-=this.graph.getPaddingRight()),'right'==this.alignToX&&(t.x-=this.width,t.x-=this.bbox.x),'bottom'==this.alignToY?(t.y-=this.height,t.y-=this.bbox.y):t.y-=this.bbox.y,this.pos.transformX=t.x,this.pos.transformY=t.y,this._setPosition())}update(e){if(!(this.graph.isDelayedUpdate()||!this._requiredUpdate&&e)){this._requiredUpdate=!1;var t=this;for(this.applyStyle();this.subG.hasChildNodes();)this.subG.removeChild(this.subG.lastChild);this.svg.insertBefore(this.rectBottom,this.svg.firstChild);var r=this.series||this.graph.getSeries();if(0{t.preventDefault();var e=this.graph._getXY(t);this.handleMouseMoveLocal(e.x,e.y,t);for(var r=0,i=this.series.length;r{t.preventDefault();var e=this.graph._getXY(t);this.addLabel(this.getVal(e.x-this.graph.getPaddingLeft()))}),this.gridPrimary.setAttribute('clip-path','url(#_clipplot'+this.graph._creation+')'),this.gridSecondary.setAttribute('clip-path','url(#_clipplot'+this.graph._creation+')'),this.graph._axisHasChanged(this)}handleMouseMoveLocal(){}hide(){return this.options.display=!1,this}show(){return this.options.display=!0,this}setDisplay(e){return this.options.display=!!e,this}isDisplayed(){return this.options.hideWhenNoSeriesShown?this.graph.getSeriesFromAxis(this).reduce((e,t)=>e||t.isShown(),!1):this.options.display}isShown(){return this.isDisplayed(...arguments)}hideGroup(){this._hidden||(this._hidden=!0,this.group.setAttribute('display','none'))}showGroup(){this._hidden&&(this._hidden=!1,this.group.setAttribute('display','initial'))}kill(e,t){this.graph.killAxis(this,e,t)}setLineAt(e){return this.options.lineAt=e,this}adaptTo(e,t,i,r){return e?(this.options.adaptTo={axis:e,thisValue:t,foreignValue:i,preference:r},this.adapt(),this):(this.options.adaptTo=!1,this)}adapt(){if(this.options.adaptTo){var e=this.options.adaptTo.axis,t=this.options.adaptTo.thisValue,i=this.options.adaptTo.foreignValue;if((void 0===e.currentAxisMin||void 0===e.currentAxisMax)&&e.setMinMaxToFitSeries(),!1!==this.options.forcedMin&&!1==this.options.forcedMax||'max'!==this.options.adaptTo.preference){this.currentAxisMin=!1===this.options.forcedMin?this._zoomed?this.getCurrentMin():this.getMinValue()-(t-this.getMinValue())*(this.options.axisDataSpacing.min*(e.getCurrentMax()-e.getCurrentMin())/(i-e.getCurrentMin())):this.options.forcedMin,this.currentAxisMin==t&&(this.currentAxisMin-=this.options.axisDataSpacing.min*this.getInterval());var r=!1===this.options.forcedMin?this.currentAxisMin:this.options.forcedMin;this.currentAxisMax=(t-r)*(e.getCurrentMax()-e.getCurrentMin())/(i-e.getCurrentMin())+r}else{this.currentAxisMax=!1===this.options.forcedMax?this._zoomed?this.getCurrentMax():this.getMaxValue()+(this.getMaxValue()-t)*(this.options.axisDataSpacing.max*(e.getCurrentMax()-e.getCurrentMin())/(e.getCurrentMax()-i)):this.options.forcedMax,this.currentAxisMax==t&&(this.currentAxisMax+=this.options.axisDataSpacing.max*this.getInterval());var r=!1===this.options.forcedMax?this.currentAxisMax:this.options.forcedMax;this.currentAxisMin=(t-r)*(e.getCurrentMin()-e.getCurrentMax())/(i-e.getCurrentMax())+r}this.graph._axisHasChanged(this)}}setFloating(e,t){return this.floating=!0,this.floatingAxis=e,this.floatingValue=t,this}getFloatingAxis(){return this.floatingAxis}getFloatingValue(){return this.floatingValue}setAxisDataSpacing(e,t){return this.options.axisDataSpacing.min=e,this.options.axisDataSpacing.max=t||e,this}dataSpacing(){return this.setAxisDataSpacing(...arguments)}setAxisDataSpacingMin(e){this.options.axisDataSpacing.min=e}setAxisDataSpacingMax(e){this.options.axisDataSpacing.max=e}setMinPx(e){this.minPx=e,this.setMinMaxFlipped()}setMaxPx(e){this.maxPx=e,this.setMinMaxFlipped()}getMinPx(){return this.minPxFlipped}getMaxPx(){return this.maxPxFlipped}getMathMaxPx(){return this.maxPx}getMathMinPx(){return this.minPx}getMinValue(){return!1===this.options.forcedMin?this.dataMin:this.options.forcedMin}getMaxValue(){return!1===this.options.forcedMax?this.dataMax:this.options.forcedMax}setMinValueData(e){this.dataMin=e,isNaN(this.getCurrentMin())}setMaxValueData(e){this.dataMax=e,isNaN(this.getCurrentMax())}getDataMax(){return this.dataMax}getDataMin(){return this.dataMin}forceMin(e,t=!1){return this.options.forcedMin=e,this.setCurrentMin(t?this.getCurrentMin():void 0),this.graph._axisHasChanged(this),this}forceMax(e,t=!1){return this.options.forcedMax=e,this.setCurrentMax(t?this.getCurrentMax():void 0),this.graph._axisHasChanged(this),this}getForcedMin(){return this.options.forcedMin}getForcedMax(){return this.options.forcedMax}forceToAxis(e){return e.getMaxValue&&e.getMinValue&&(this.options.forcedMin=e.getMinValue(),this.options.forcedMax=e.getMaxValue()),this}getNbTicksPrimary(){return this.options.nbTicksPrimary}setNbTicksPrimary(e){this.options.nbTicksPrimary=e}getNbTicksSecondary(){return this.options.nbTicksSecondary}setNbTicksSecondary(e){return this.options.nbTicksSecondary=e,this}handleMouseMove(e){this.mouseVal=this.getVal(e)}handleMouseWheel(t,i,e){t=Math.min(0.2,Math.max(-0.2,t)),'min'==e?e=this.getMinValue():'max'==e?e=this.getMaxValue():!e&&(e=0),this._doZoomVal((this.getCurrentMax()-e)*(1+t)+e,(this.getCurrentMin()-e)*(1+t)+e),this.graph.draw()}set zoomLock(e){this._zoomLocked=e}get zoomLock(){return this._zoomLocked||!1}zoom(e,t,i){return!i&&this.zoomLock?void 0:this._doZoomVal(e,t,!0)}_doZoomVal(e,t,i){return this._doZoom(this.getPx(e),this.getPx(t),e,t,i)}_doZoom(e,t,i,r,a){var i=void 0===i?this.getVal(e):i,r=void 0===r?this.getVal(t):r;return this.setCurrentMin(Math.min(i,r)),this.setCurrentMax(Math.max(i,r)),this.cacheCurrentMin(),this.cacheCurrentMax(),this.cacheInterval(),this._zoomed=!0,this.adapt(),this._hasChanged=!0,a||this.emit('zoom',[this.currentAxisMin,this.currentAxisMax,this]),this}getSerieShift(){return this._serieShift}getSerieScale(){return this._serieScale}getMouseVal(){return this.mouseVal}getUnitPerTick(e,t,i){var r=Math.pow,a=Math.abs,s=e/c;t=t?Math.min(t,e/10):e/10;var n=i/t;switch(this.options.unitModification){case'time':case'time:min.sec':{let e=!1,t,i,r,a;for(t=0,i=this.unitModificationTimeTicks.length;tthis.getForcedMax()||e===void 0))&&(e=this.getMaxValue()),this.currentAxisMax=e,this.options.logScale&&(this.currentAxisMax=Math.max(1e-50,e)),this.cacheCurrentMax(),this.cacheInterval(),this.graph._axisHasChanged(this)}flip(e){return this.options.flipped=e,this.setMinMaxFlipped(),this}isFlipped(){return this.options.flipped}_draw(){var e=Math.abs,t=this;(void 0===this.currentAxisMin||void 0===this.currentAxisMax)&&this.setMinMaxToFitSeries(!0);var i=e(this.getMaxPx()-this.getMinPx()),r=this.getCurrentInterval();if(!this.isShown())return this.line.setAttribute('display','none'),0;this.line.setAttribute('display','block'),this.scientificExponent=!0==this.options.scientificScale?this.options.scientificScaleExponent?this.options.scientificScaleExponent:Math.floor(Math.log(Math.max(e(this.getCurrentMax()),e(this.getCurrentMin())))/2.302585092994046):0,this.gridLinePath.primary='',this.gridLinePath.secondary='';let a;if(!this.options.useKatexForLabel||!this.graph.hasKatexRenderer())this.options.unitDecade&&this.options.unit&&0!==this.scientificExponent&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent))&&(a=this.getExponentGreekLetter(this.scientificExponent))?(this.preunit=a,this.unitTspan.setAttribute('dx',0)):0===this.scientificExponent||isNaN(this.scientificExponent)?(!this.options.unit&&this.unitTspan.setAttribute('display','none'),this.preunit='',this.expTspan.setAttribute('display','none'),this.expTspanExp.setAttribute('display','none')):(this.options.engineeringScale&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent)),this.preunit='',this.expTspan.setAttribute('display','visible'),this.expTspanExp.setAttribute('display','visible'),this.expTspan.textContent='x10',this.expTspanExp.textContent=this.scientificExponent),this.writeUnit();else{let e=this.getLabel();this.options.unitDecade&&this.options.unit&&0!==this.scientificExponent&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent))&&(a=this.getExponentGreekLetter(this.scientificExponent))?(e+=a,this.preunitTspan.innerHTML=a,this.preunitTspan.setAttribute('display','visible'),this.unitTspan.setAttribute('dx',0),e+=' '+a+' '+this.options.unit):0!==this.scientificExponent&&!isNaN(this.scientificExponent)&&(this.options.engineeringScale&&(this.scientificExponent=this.getEngineeringExponent(this.scientificExponent)),e+=' \\cdot 10^'+this.scientificExponent+' '+this.options.unit),this.katexElement=this.graph.renderWithKatex(e,this.katexElement)}if(!!this.options.hideTicks)var s=0;else if(this.resetTicksLength(),this.linkedToAxis){this.linkedToAxis.deltaPx=10;var s=this.drawLinkedToAxisTicksWrapper(i,r)}else if(!this.options.logScale)var s=this.drawLinearTicksWrapper(i,r);else var s=this.drawLogTicks();this.removeUselessTicks(),this.removeUselessTickLabels(),this.gridPrimary.setAttribute('d',this.gridLinePath.primary),this.gridSecondary.setAttribute('d',this.gridLinePath.secondary);var n=this.graph.findAxesLinkedTo(this);return n.forEach(function(e){e.linkedToAxis&&(e.setMinPx(t.getMinPx()),e.setMaxPx(t.getMaxPx()),e.draw())}),s}drawLines(){this.options.lineAt&&Array.isArray(this.options.lineAt)&&this.options.lineAt.forEach((e,t)=>{!isNaN(e)&&this.getCurrentMin()<=e&&this.getCurrentMax()>=e?this._lines[t]=this._drawLine(e,this._lines[t]):this._hideLine(this._lines[t])})}writeUnit(){this.options.unit?(this.unitTspan.setAttribute('display','visible'),this.unitTspan.setAttribute('dx',5),this.expTspan.setAttribute('display','none'),this.expTspanExp.setAttribute('display','none'),this.unitTspan.innerHTML=(this.options.unitWrapperBefore+this.preunit+this.options.unit+this.options.unitWrapperAfter).replace(/\^([-+0-9]*)(.*)/g,'$1$2')):this.unitTspan.setAttribute('display','none')}getExponentGreekLetter(e){return 3===e?'k':6===e?'M':9===e?'G':12===e?'T':15===e?'E':-3===e?'m':-6===e?'μ':-9===e?'n':-12===e?'p':-15===e?'f':''}drawLinearTicksWrapper(e,t){let i;return this.options.primaryTickUnit?i=this.options.primaryTickUnit:(i=this.getUnitPerTick(e,this.getNbTicksPrimary(),t)[0],this.options.maxPrimaryTickUnit&&this.options.maxPrimaryTickUniti&&(i=this.options.minPrimaryTickUnit)),this.drawTicks(i,this.secondaryTicks())}forcePrimaryTickUnit(e){this.options.primaryTickUnit=e}forcePrimaryTickUnitMax(e){this.options.maxPrimaryTickUnit=e}forcePrimaryTickUnitMin(e){this.options.minPrimaryTickUnit=e}getPrimaryTickUnit(){return this.incrTick}setTickLabelRatio(e){this.options.ticklabelratio=e}doesHideWhenNoSeriesShown(){return this.options.hideWhenNoSeriesShown}draw(){this._widthLabels=0;var e=this._draw();return this._widthLabels+=e,e}drawTicks(e,t){var i=e,r=this.getCurrentMin(),a=this.getCurrentMax(),s=0,n,o,l;for(t&&(n=i/t),o=this.options.shiftToZero?this.dataMin-Math.ceil((this.dataMin-r)/i)*i:Math.floor(r/i)*i,this.incrTick=e;o<=a&&(s++,!(200a){l+=n;continue}this.drawTickWrapper(l,!1,1e-4>Math.abs(l-o-i/2)?2:3),l+=n}}if(oa){o+=e;continue}this.drawTickWrapper(o,!0,1),o+=e}return this.widthHeightTick=this.getMaxSizeTick(),this.widthHeightTick}nextTick(e,t){if(this.ticks[e]=this.ticks[e]||[],this.lastCurrentTick[e]=this.lastCurrentTick[e]||0,this.currentTick[e]=this.currentTick[e]||0,this.currentTick[e]>=this.ticks[e].length){var i=document.createElementNS(this.graph.ns,'line');this.groupTicks.appendChild(i),this.ticks[e].push(i),t(i)}var i=this.ticks[e][this.currentTick[e]];return this.currentTick[e]>=this.lastCurrentTick[e]&&i.setAttribute('display','visible'),this.currentTick[e]++,i}nextTickLabel(e){if(this.ticksLabels=this.ticksLabels||[],this.lastCurrentTickLabel=this.lastCurrentTickLabel||0,this.currentTickLabel=this.currentTickLabel||0,this.currentTickLabel>=this.ticksLabels.length){var t=document.createElementNS(this.graph.ns,'text');this.groupTickLabels.appendChild(t),this.ticksLabels.push(t),e(t)}var t=this.ticksLabels[this.currentTickLabel];return this.currentTickLabel>=this.lastCurrentTickLabel&&t.setAttribute('display','visible'),this.currentTickLabel++,t}removeUselessTicks(){for(var e in this.currentTick){for(var t=this.currentTick[e];ta&&(a=1e-50),20a&&(a=0);for(var n=0==a?0:Math.floor(t(a)/2.302585092994046),a=1,o;(o=a*e(10,n))i&&this.drawTickWrapper(o,!0,1,s),10==a?(a=1,n++):(1!=a&&o>i&&this.drawTickWrapper(o,!1,2,{overwrite:'',fontSize:'0.6em'}),a++);return this.widthHeightTick=this.getMaxSizeTick(),this.widthHeightTick}drawTickWrapper(e,t,i,r){this.drawTick(e,i,r)}linkToAxis(e,t,i){this.linkedToAxis={axis:e,scalingFunction:t,decimals:i||1}}drawLinkedToAxisTicksWrapper(e,i){var r=this.linkedToAxis,a=0,s,n,o,l;r.deltaPx||(r.deltaPx=10);do{if(s=r.scalingFunction(r.axis.getVal(a+this.getMinPx())),r.decimals&&(this.decimals=r.decimals),n=this.drawTick(s,1,{},a+this.getMinPx()),!n)throw console.error(s,a,this.getMinPx()),new Error('Unable to draw tick. Please report the test-case');if(o=8*(n[1].textContent+'').length,l=5*Math.round(o/5),l>r.deltaPx)return r.deltaPx=l,void this.drawLinkedToAxisTicksWrapper(e,i);a+=r.deltaPx}while(ae)){var e=(t(e)-t(this.getCurrentMin()))/(t(this.getCurrentMax())-t(this.getCurrentMin()))*(this.getMaxPx()-this.getMinPx())+this.getMinPx();return e}}getRoundedPx(e){return Math.round(10*this.getPx(e))/10}getVal(e){var t=Math.log;return this.options.logScale?Math.exp((e-this.getMinPx())/(this.getMaxPx()-this.getMinPx())*(t(this.getCurrentMax())-t(this.getCurrentMin()))+t(this.getCurrentMin())):(e-this.getMinPx())/(this.getMaxPx()-this.getMinPx())*this.getCurrentInterval()+this.getCurrentMin()}getRelPx(e){return e/this.getCurrentInterval()*(this.getMaxPx()-this.getMinPx())}getRelVal(e){return e/(this.getMaxPx()-this.getMinPx())*this.getCurrentInterval()}valueToText(e){var t=Math.pow;if(this.scientificExponent)return e/=t(10,this.scientificExponent),e.toFixed(1);if(e=e*t(10,this.getExponentialFactor())*t(10,this.getExponentialLabelFactor()),this.options.shiftToZero&&(e-=this.dataMin),this.options.ticklabelratio&&(e*=this.options.ticklabelratio),this.options.unitModification)return e=this.modifyUnit(e,this.options.unitModification),e;var i=this.decimals-this.getExponentialFactor()-this.getExponentialLabelFactor();return isNaN(e)?'':(e=0'+this.scientificExponent+''),this.options.unit&&!i&&(r+=this.options.unit.replace(/\^([-+0-9]*)/g,'$1')),r}getModifiedValue(e){return this.options.ticklabelratio&&(e*=this.options.ticklabelratio),this.options.shiftToZero&&(e-=this.getMinValue()*(this.options.ticklabelratio||1)),e}modifyUnit(e,t){var i=Math.floor,r=Math.round,a='',n=this.incrTick,o;switch(t){case'time':var l=this.getModifiedValue(this.getMaxValue()),p=[[60,'min'],[3600,'h'],[86400,'d']];if(3600>l?o=0:86400>l?o=1:2592000>l&&(o=2),!p[o])return!1;e/=p[o][0];var d=i(e);for(a=d+p[o][1],o--;n<1*p[o+1][0]&&-1{t.setAttribute('fill',e)}),this}getTicksLabelColor(){return this.options.ticksLabelColor||'black'}setPrimaryGridColor(e){return this.options.primaryGridColor=e,this.setGridLinesStyle(),this}getPrimaryGridColor(){return this.options.primaryGridColor}setSecondaryGridColor(e){return this.options.secondaryGridColor=e,this.setGridLinesStyle(),this}getSecondaryGridColor(){return this.options.secondaryGridColor}setPrimaryGridWidth(e){return this.options.primaryGridWidth=e,this.setGridLinesStyle(),this}getPrimaryGridWidth(){return this.options.primaryGridWidth}setSecondaryGridWidth(e){return this.options.secondaryGridWidth=e,this.setGridLinesStyle(),this}getSecondaryGridWidth(){return this.options.secondaryGridWidth}setPrimaryGridOpacity(e){return this.options.primaryGridOpacity=e,this}getPrimaryGridOpacity(){return this.options.primaryGridOpacity}setSecondaryGridOpacity(e){return this.options.secondaryGridOpacity=e,this}getSecondaryGridOpacity(){return this.options.secondaryGridOpacity}setPrimaryGridDasharray(e){return this.options.primaryGridDasharray=e,this}getPrimaryGridDasharray(){return this.options.primaryGridDasharray}setSecondaryGridDasharray(e){return this.options.secondaryGridDasharray=e,this}getSecondaryGridDasharray(){return this.options.secondaryGridDasharray}setLabelColor(e){return this.options.labelColor=e,this}getLabelColor(){return this.options.labelColor}setTickContent(e,t,i){if(i||(i={}),i.overwrite||!i.exponential)e.textContent=i.overwrite||this.valueToText(t);else{var r=Math.round(Math.log(t)/2.302585092994046),a=Math.floor(t*Math.pow(10,-r));e.textContent=1==a?'10':a+'x10';var s=document.createElementNS(this.graph.ns,'tspan');s.textContent=r,s.setAttribute('font-size','0.7em'),s.setAttribute('dy',-5),e.appendChild(s)}i.fontSize&&e.setAttribute('font-size',i.fontSize)}isX(){return!1}isY(){return!1}setUnit(e){return this.options.unit=e,this}setUnitInTicks(e){return this.options.unitInTicks=e,this}setUnitWrapper(e,t){return this.options.unitWrapperBefore=e,this.options.unitWrapperAfter=t,this}setUnitDecade(e){return this.options.unitDecade=e,this}setScientific(e){return this.options.scientificScale=e,this}setScientificScaleExponent(e){return this.options.scientificScaleExponent=e,this}setEngineering(e){return this.options.scientificScale=e,this.options.engineeringScale=e,this}getEngineeringExponent(e){return e-=0{e.setAttribute('y',(a.top?-1:1)*((1==a.options.tickPosition?8:20)+(a.top?10:0))+this.options.tickLabelOffset),e.setAttribute('text-anchor','middle'),'black'!==a.getTicksLabelColor()&&e.setAttribute('fill',a.getTicksLabelColor()),e.style.dominantBaseline='hanging'});o.setAttribute('x',s),this.setTickContent(o,e,i)}return[n,o]}}drawLabel(){'black'!==this.getLabelColor()&&this.label.setAttribute('fill',this.getLabelColor()),this.options.labelFont&&this.label.setAttribute('font-family',this.options.labelFont),this.label.setAttribute('text-anchor','middle'),this.label.setAttribute('style','display: initial;'),this.label.setAttribute('x',Math.abs(this.getMaxPx()+this.getMinPx())/2),this.label.setAttribute('y',(this.top?-1:1)*((1==this.options.tickPosition?10:25)+this.graph.options.fontSize)),this.labelTspan.textContent=this.getLabel()}draw(){var e=super.draw(...arguments);return this.drawSpecifics(),e}drawSpecifics(){this.drawLabel(),this.line.setAttribute('x1',this.getMinPx()),this.line.setAttribute('x2',this.getMaxPx()),this.line.setAttribute('y1',0),this.line.setAttribute('y2',0),this.line.setAttribute('stroke',this.getAxisColor()),this.top||(this.labelTspan.style.dominantBaseline='hanging',this.expTspan.style.dominantBaseline='hanging',this.expTspanExp.style.dominantBaseline='hanging',this.unitTspan.style.dominantBaseline='hanging');var e=this.getSpan();this.line.setAttribute('marker-start',this.options.splitMarks&&0!=e[0]?'url(#horionzalsplit_'+this.graph.getId()+')':''),this.line.setAttribute('marker-end',this.options.splitMarks&&1!=e[1]?'url(#horionzalsplit_'+this.graph.getId()+')':'')}_drawLine(e,t){let i=this.getPx(e);return t?t.setAttribute('display','initial'):t=document.createElementNS(this.graph.ns,'line'),t.setAttribute('x1',i),t.setAttribute('x2',i),t.setAttribute('y1',0),t.setAttribute('y2',this.graph.drawingSpaceHeight),t.setAttribute('stroke','black'),this.group.appendChild(t),t}_hideLine(e){e&&e.setAttribute('display','none')}handleMouseMoveLocal(e){e-=this.graph.getPaddingLeft(),this.mouseVal=this.getVal(e)}setMinMaxFlipped(){var e=this.maxPx-this.minPx;if(!isNaN(e)){var t=e*this.options.span[1]+this.minPx-this.options.marginMax,i=e*this.options.span[0]+this.minPx+this.options.marginMin;this.minPxFlipped=this.isFlipped()?t:i,this.maxPxFlipped=this.isFlipped()?i:t}}getZProj(e){return e*this.graph.options.zAxis.shiftX}}class AxisY extends Axis{constructor(e,t,i){super(e,t,i),this.leftright=t,this.left='left'==t}setAxisPosition(e){this.shiftPosition=e}getAxisPosition(){return this.shiftPosition||0}getAdditionalWidth(){let e=0;return this.getLabel()&&(e+=this.graph.options.fontSize),this.isShown()&&(e+=Math.abs(this.tickMargin)),e}isX(){return!1}isY(){return!0}resetTicksLength(){this.longestTick=[!1,0]}getMaxSizeTick(){return this.longestTick&&this.longestTick[0]?this.longestTick[0].getComputedTextLength()+5:0}draw(){this.tickMargin=this.left?-5-this.tickPx1*this.tickScaling[1]:2-this.tickPx1*this.tickScaling[1];var e=super.draw(...arguments);return e+=this.getAdditionalWidth(),this.drawSpecifics(e),this.fullwidthlabel=e,e}equalizePosition(e){return this.placeLabel(this.left?-e:e),this.getLabel()?e+this.graph.options.fontSize:0}drawTick(e,t,i,r){let a,s,n;a=r||this.getPos(e);void 0==a||isNaN(a)||(s=this.nextTick(t,(e)=>{e.setAttribute('x1',(this.left?1:-1)*this.tickPx1*this.tickScaling[t]),e.setAttribute('x2',(this.left?1:-1)*this.tickPx2*this.tickScaling[t]),1==t?e.setAttribute('stroke',this.getPrimaryTicksColor()):e.setAttribute('stroke',this.getSecondaryTicksColor())}),s.setAttribute('y1',a),s.setAttribute('y2',a),this.nextGridLine(1==t,0,this.graph.getDrawingWidth(),a,a),1==t&&(n=this.nextTickLabel((e)=>{e.setAttribute('x',this.tickMargin+this.options.tickLabelOffset),'black'!==this.getTicksLabelColor()&&e.setAttribute('fill',this.getTicksLabelColor()),this.left?e.setAttribute('text-anchor','end'):e.setAttribute('text-anchor','start'),e.style.dominantBaseline='central'}),n.setAttribute('y',a),this.setTickContent(n,e,i),(n.textContent+'').length>=this.longestTick[1]&&(this.longestTick[0]=n,this.longestTick[1]=(n.textContent+'').length)))}drawLabel(){'black'!==this.getLabelColor()&&this.label.setAttribute('fill',this.getLabelColor()),this.label.setAttribute('dominant-baseline',this.left?'auto':'auto'),this.labelTspan.textContent=this.getLabel()}placeLabel(e){this.label.setAttribute('transform','translate('+e+', '+Math.abs(this.getMaxPx()+this.getMinPx())/2+') rotate(-90)')}drawSpecifics(){this.line.setAttribute('y1',this.getMinPx()),this.line.setAttribute('y2',this.getMaxPx()),this.line.setAttribute('x1',0),this.line.setAttribute('x2',0),this.line.setAttribute('stroke',this.getAxisColor());var e=this.getSpan();this.line.setAttribute('marker-start',this.options.splitMarks&&0!=e[0]?'url(#verticalsplit_'+this.graph.getId()+')':''),this.line.setAttribute('marker-end',this.options.splitMarks&&1!=e[1]?'url(#verticalsplit_'+this.graph.getId()+')':'')}setShift(e){if(this.shift=e,!this.shift||!this.graph.getWidth())return;let t=this.shift;t=this.floating?t:this.isLeft()?t:this.graph.getWidth()-this.graph.getPaddingRight()-this.graph.getPaddingLeft()-t,this.group.setAttribute('transform','translate( '+t+' 0 )'),this.drawLabel()}isLeft(){return this.left}isRight(){return!this.left}isFlipped(){return!this.options.flipped}_drawLine(e,t){let i=this.getPx(e);return t?t.setAttribute('display','initial'):t=document.createElementNS(this.graph.ns,'line'),t.setAttribute('y1',i),t.setAttribute('y2',i),t.setAttribute('x1',0),t.setAttribute('x2',this.graph.drawingSpaceWidth),t.setAttribute('stroke','black'),this.group.appendChild(t),t}_hideLine(e){e&&e.setAttribute('display','none')}handleMouseMoveLocal(e,t){t-=this.graph.getPaddingTop(),this.mouseVal=this.getVal(t)}scaleToFitAxis(e,t,r,a,s,n){e&&e.isX()||(e=this.graph.getXAxis()),isNaN(r)&&(r=e.getCurrentMin()),isNaN(a)&&(a=e.getCurrentMax()),s===void 0&&(s=!0),n===void 0&&(n=!0),'number'==typeof t&&(a=r,r=t,t=!1);for(var o=-Infinity,p=Infinity,d=0,g=0,i=this.graph.series.length;g{let r=i.getUsedCategories();for(let a of r)e.hasOwnProperty(a)||(e[a]=1,t+=1),e[a]++,t++});let r=0;for(let t in e){let i=e[t];e[t]=r,r+=i}let i={};Array.prototype.map.call(this.series,(r)=>{let a=r.getUsedCategories(),s={};a.forEach((r)=>{i[r]=i[r]||0.5,s[r]=(e[r]+i[r])/t,i[r]++}),r.setDataIndices(s,t)})}getType(){return'category'}}var axisFormat=[{threshold:20,increments:{1:{increment:1,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:1,unit:'s',format:'MM:ss"s"'}}},{threshold:50,increments:{1:{increment:1,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:2,unit:'s',format:'MM:ss"s"'}}},{threshold:100,increments:{1:{increment:1,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:5,unit:'s',format:'MM:ss"s"'}}},{threshold:600,increments:{1:{increment:10,unit:'i',format:'HH"h"MM (dd/mm/yy)'},2:{increment:30,unit:'s',format:'MM:ss"s"'}}},{threshold:1e3,increments:{1:{increment:1,unit:'h',format:'HH"h"MM (dd/mm/yy)'},2:{increment:10,unit:'i',format:'MM"min"'}}},{threshold:1500,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:1,unit:'i',format:'H"h"MM'}}},{threshold:3e3,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:2,unit:'i',format:'H"h"MM'}}},{threshold:8e3,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:10,unit:'i',format:'H"h"MM'}}},{threshold:26400,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:20,unit:'i',format:'H"h"MM'}}},{threshold:86400,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:1,unit:'h',format:'H"h"MM'}}},{threshold:2e5,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:2,unit:'h',format:'H"h"MM'}}},{threshold:4e5,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:6,unit:'h',format:'H"h"MM'}}},{threshold:1.4e6,increments:{1:{increment:1,unit:'d',format:'dd/mm/yyyy'},2:{increment:12,unit:'h',format:'HH"h"MM'}}},{threshold:6.4e6,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:1,unit:'d',format:'dd'}}},{threshold:1.24e7,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:2,unit:'d',format:'dd'}}},{threshold:43200000,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:7,unit:'d',format:'dd'}}},{threshold:69120000,increments:{1:{increment:1,unit:'m',format:'mmmm yyyy'},2:{increment:15,unit:'d',format:'dd'}}},{threshold:86400000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:3,unit:'m',format:'mm/yyyy'}}},{threshold:172800000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:4,unit:'m',format:'mm/yyyy'}}},{threshold:864000000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:6,unit:'m',format:'mm/yyyy'}}},{threshold:1036800000,increments:{1:{increment:1,unit:'y',format:'yyyy'},2:{increment:1,unit:'y',format:'yyyy'}}}],dateFormat=function(){var e=Math.abs,t=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[WLloSZ]|"[^"]*"|'[^']*'/g,i=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,r=/[^-+\dA-Z]/g,a=function(e,t){for(e+='',t=t||2;e.lengthA?'a':'p',tt:12>A?'am':'pm',T:12>A?'A':'P',TT:12>A?'AM':'PM',Z:g?'UTC':((l+'').match(i)||['']).pop().replace(r,''),o:(0a)return void hideGroup(t);t.line.setAttribute('x1',s),t.line.setAttribute('x2',s),t.text.setAttribute('x',s),t.text.textContent=i;break;default:case 1:var p=o(r,l(a,s)),d=o(r,l(a,n));if(isNaN(d)||isNaN(p))return;for(t.line1.setAttribute('x1',p),t.line2.setAttribute('x1',d),t.line1.setAttribute('x2',p),t.line2.setAttribute('x2',d),t.text.setAttribute('x',(p+d)/2);8*i.length>d-p;)if(i=i.substr(0,i.length-2)+'.',1==i.length){i='';break}t.text.textContent=i;}}class GraphTimeAxis extends Axis{constructor(){super(...arguments)}init(e,t){super.init(e,t),this.wrapper={1:document.createElementNS(e.ns,'g'),2:document.createElementNS(e.ns,'g')},this.groups={1:[],2:[]};var i=document.createElementNS(e.ns,'rect');i.setAttribute('fill','#c0c0c0'),i.setAttribute('stroke','#808080'),i.setAttribute('height','20'),i.setAttribute('x','0'),i.setAttribute('y','0'),this.rect=i,this.wrapper[1].appendChild(this.rect),this.group.appendChild(this.wrapper[1]),this.group.appendChild(this.wrapper[2]),this.wrapper[1].setAttribute('transform','translate( 0, 25 )'),this.wrapper[2].setAttribute('transform','translate( 0, 00 )')}draw(){this.cacheCurrentMax(),this.cacheCurrentMin(),(void 0==this.currentAxisMin||void 0==this.currentAxisMax)&&this.setMinMaxToFitSeries(!0),this.line.setAttribute('x1',this.getMinPx()),this.line.setAttribute('x2',this.getMaxPx()),this.line.setAttribute('y1',0),this.line.setAttribute('y2',0);var e=this.maxPx-this.minPx,t=this.getCurrentInterval(),r=this.getCurrentMax(),a=this.getCurrentMin();if(this.rect.setAttribute('width',e),this.rect.setAttribute('x',this.minPx),!r||!a)return 0;var s;for(u=0;ut/e){s=axisFormat[u];break}s||(s=axisFormat[axisFormat.length-1]);var n=0,o,l,p,d,g,c,u;for(n=1;2>=n;n++){if(!isNumeric$1(a)){hideGroups(this,n,0);break}p=new Date(a),d=roundDate(p,s.increments[n]),u=0;do if(g=getDateText(d,s.increments[n].format),c=getGroup(this,n,u),o=this.getPx(d.getTime()),d=incrementDate(d,s.increments[n]),l=this.getPx(d.getTime()),renderGroup(n,c,g,this.getMinPx(),this.getMaxPx(),o,l),u++,100{e.redraw()}),this.emit('draw')}setData(e){if(e instanceof Waveform)return this.setWaveform(e);throw'Setting data other than waveforms in not supported by default. You must implemented this method in the inherited class.'}_addData(){return[]}clearData(){return this.setData(new Waveform),this}getData(){return this.data}setOptions(e){this.options=e||{}}setOption(e,t){this.options[e]=t}kill(e){return this.graph.removeSerieFromDom(this),this.graph._removeSerie(this),this.graph.legend&&!e&&this.graph.legend.update(),this.graph=void 0,this}hide(e,t=!1){if(this.hidden=!0,this.groupMain.setAttribute('display','none'),this.getSymbolForLegend().setAttribute('opacity',0.5),this.getTextForLegend().setAttribute('opacity',0.5),this.hideImpl(),e)for(var r=this.graph.getShapesOfSerie(this),a=0,i=r.length;ae;e++)arguments[e]&&this[arguments[e].isX()?'setXAxis':'setYAxis'](arguments[e]);return this.graph.updateDataMinMaxAxes(),this}getXAxis(){return this.xaxis}getYAxis(){return this.yaxis}getMinX(){return this.minX}getMaxX(){return this.maxX}getMinY(){return this.minY}getMaxY(){return this.maxY}getWaveform(){return this.waveform}getWaveforms(){return[this.waveform]}setWaveform(e){if(!(e instanceof Waveform))throw console.trace(),console.error(e),new Error('Cannot assign waveform to serie. Waveform is not of the proper Waveform instance');return this.waveform=e,this.minX=this.waveform.getXMin(),this.maxX=this.waveform.getXMax(),this.minY=this.waveform.getMin(),this.maxY=this.waveform.getMax(),this.graph.updateDataMinMaxAxes(),this.dataHasChanged(),this}getSymbolForLegend(){if(!this.lineForLegend){var e=document.createElementNS(this.graph.ns,'line');this.applyLineStyle(e),e.setAttribute('x1',5),e.setAttribute('x2',25),e.setAttribute('y1',0),e.setAttribute('y2',0),e.setAttribute('cursor','pointer'),this.lineForLegend=e}return this.lineForLegend}setLegendSymbolStyle(){this.applyLineStyle(this.getSymbolForLegend())}updateStyle(){this.setLegendSymbolStyle(),this.graph.updateLegend()}getTextForLegend(){if(!this.textForLegend){var e=document.createElementNS(this.graph.ns,'text');e.setAttribute('cursor','pointer'),e.textContent=this.getLabel(),this.textForLegend=e}return this.textForLegend}getIndex(){return this.graph.series.indexOf(this)}getLabel(){return this.options.label||this.name}setLabel(e){return this.options.label=e,this.textForLegend&&(this.textForLegend.textContent=e),this.graph.requireLegendUpdate(),this}setFlip(e){return this.options.flip=e,this}getFlip(){return this.options.flip}isFlipped(){return this.options.flip}setLayer(e){let t=parseInt(e)||1;return t!==this.options.layer&&(this.options.layer=t,this.graph.appendSerieToDom(this)),this}getLayer(){return this.options.layer||1}setStyle(e,t='unselected'){this.styles[t]=e,this.styleHasChanged(t)}styleHasChanged(e='unselected'){if(this._changedStyles=this._changedStyles||{},!1===e)for(var t in this._changedStyles)this._changedStyles[t]=!1;else this._changedStyles[e||'unselected']=!0;return this.graph.requireLegendUpdate(),this}hasStyleChanged(e){return this._changedStyles=this._changedStyles||{},this._changedStyles[e||'unselected']}dataHasChanged(e){return this._dataHasChanged=void 0===e||e,this}hasDataChanged(){return this._dataHasChanged}setInfo(e,t){return this.infos=this.infos||{},this.infos[e]=t,this}getInfo(e){return(this.infos||{})[e]}setAdditionalData(e){return this.additionalData=e,this}getAdditionalData(){return this.additionalData}select(){return this.selected=!0,this}unselect(){return this.selected=!1,this}enableTracking(e,t){return this._tracker=!0,this._trackingCallback=e,this._trackingOutCallback=t,this}disableTracking(){return this._trackerDom&&(this._trackerDom.remove(),this._trackerDom=null),this._tracker=!1,this._trackingCallback=null,this}allowTrackingLine(e){e=e||{},this.graph.addSerieToTrackingLine(this,e)}getMarkerForLegend(){return!1}get type(){return this._type}getType(){return this._type}set excludedFromLegend(e){this._excludedFromLegend=e}get excludedFromLegend(){return!!this._excludedFromLegend}setDataIndices(e,t){this.categoryIndices=e,this.nbCategories=t}hasErrors(){return!!this.waveform&&this.waveform.hasErrorBars()}}var ErrorBarMixin={makeBarY:function(e,t,i){if(e&&void 0!==i){var r=isNumeric$1(i.width)?i.width:10;return' V '+e+' m -'+r/2+' 0 h '+r+' m -'+r/2+' 0 V '+t+' '}},makeBoxY:function(e,t,i){return e&&void 0!==i?' m 5 0 V '+e+' h -10 V '+t+' m 5 0 ':void 0},makeBarX:function(e,t,i){if(e&&void 0!==i){var r=isNumeric$1(i.width)?i.width:10;return' H '+e+' m 0 -'+r/2+' v '+r+' m 0 -'+r/2+' H '+t+' '}},makeBoxX:function(e,t,i){return e&&void 0!==i?' v 5 H '+e+' v -10 H '+t+' v 5 ':void 0},setErrorBarStyle:function(e){return this.errorbarStyle=this._setErrorStyle(e),this},setErrorBoxStyle:function(e){return this.errorboxStyle=this._setErrorStyle(e),this},_setErrorStyle(e={}){var t=[],i=[['y','top','bottom'],['x','left','right']],r=(e)=>{e.dom=document.createElementNS(this.graph.ns,'path'),e.dom.setAttribute('fill',e.fillColor||'none'),e.dom.setAttribute('stroke',e.strokeColor||'black'),e.dom.setAttribute('stroke-opacity',e.strokeOpacity||1),e.dom.setAttribute('fill-opacity',e.fillOpacity||1),e.dom.setAttribute('stroke-width',e.strokeWidth||1),this.groupMain.appendChild(e.dom)},t={};'string'==typeof e&&(e={});for(var a=0,s=i.length;a=n;n++)e[i[a][n]]&&(t[i[a][n]]=e[i[a][n]],r(t[i[a][n]]))}return t},errorDrawInit:function(){this.errorboxStyle&&(this.errorboxStyle.paths={top:'',bottom:'',left:'',right:''}),this.errorbarStyle&&(this.errorbarStyle.paths={top:'',bottom:'',left:'',right:''})},errorAddPoint:function(e,t,i,r,a){let s;(s=this.waveform.getErrorBarXBelow(e))&&(this.errorbarStyle.paths.left+=' M '+r+' '+a,this.errorbarStyle.paths.left+=this.makeBarX(this.getX(t-s),r,this.errorbarStyle.left)),(s=this.waveform.getErrorBarXAbove(e))&&(this.errorbarStyle.paths.right+=' M '+r+' '+a,this.errorbarStyle.paths.right+=this.makeBarX(this.getX(t+s),r,this.errorbarStyle.right)),(s=this.waveform.getErrorBarYBelow(e))&&(this.errorbarStyle.paths.bottom+=' M '+r+' '+a,this.errorbarStyle.paths.bottom+=this.makeBarY(this.getY(i-s),a,this.errorbarStyle.bottom)),(s=this.waveform.getErrorBarYAbove(e))&&(this.errorbarStyle.paths.top+=' M '+r+' '+a,this.errorbarStyle.paths.top+=this.makeBarY(this.getY(i+s),a,this.errorbarStyle.top)),(s=this.waveform.getErrorBoxXBelow(e))&&(this.errorboxStyle.paths.left+=' M '+r+' '+a,this.errorboxStyle.paths.left+=this.makeBoxX(this.getX(t-s),r,this.errorboxStyle.left)),(s=this.waveform.getErrorBoxXAbove(e))&&(this.errorboxStyle.paths.right+=' M '+r+' '+a,this.errorboxStyle.paths.right+=this.makeBoxX(this.getX(t+s),r,this.errorboxStyle.right)),(s=this.waveform.getErrorBoxYBelow(e))&&(this.errorboxStyle.paths.bottom+=' M '+r+' '+a,this.errorboxStyle.paths.bottom+=this.makeBoxY(this.getY(i-s),a,this.errorboxStyle.bottom)),(s=this.waveform.getErrorBoxYAbove(e))&&(this.errorboxStyle.paths.top+=' M '+r+' '+a,this.errorboxStyle.paths.top+=this.makeBoxY(this.getY(i+s),a,this.errorboxStyle.top))},errorAddPointBarChart:function(e,t,i,r){var a;this.error&&(a=this.error[e])&&this.doErrorDraw('y',a,t,r,i,r)},errorDraw:function(){if(this.errorbarStyle)for(var e in this.errorbarStyle.paths)this.errorbarStyle[e]&&this.errorbarStyle[e].dom&&this.errorbarStyle[e].dom.setAttribute('d',this.errorbarStyle.paths[e]);if(this.errorboxStyle)for(var e in this.errorboxStyle.paths)this.errorboxStyle[e]&&this.errorboxStyle[e].dom&&this.errorboxStyle[e].dom.setAttribute('d',this.errorboxStyle.paths[e])}};class SerieLine extends Serie{static default(){return{lineColor:'black',lineStyle:1,flip:!1,label:'',lineWidth:1,markers:!1,trackMouse:!1,trackMouseLabel:!1,trackMouseLabelRouding:1,lineToZero:!1,selectableOnClick:!1,markersIndependant:!1,overflowX:!1,overflowY:!1}}constructor(){super(...arguments),this.selectionType='unselected',this.markerFamilies={},mapEventEmission(this.options,this),this.styles={},this.styles.unselected={lineColor:this.options.lineColor,lineStyle:this.options.lineStyle,lineWidth:this.options.lineWidth,markers:this.options.markers},this.styles.selected={lineWidth:3},this.extendStyles(),this.markersDom=new Map,this.shown=!0,this.data=[],this._isMinOrMax={x:{min:!1,max:!1},y:{min:!1,max:!1}},this.groupLines=document.createElementNS(this.graph.ns,'g'),this.domMarker=document.createElementNS(this.graph.ns,'path'),this.domMarker.style.cursor='pointer',this.groupMain=document.createElementNS(this.graph.ns,'g'),this.additionalData={},this.marker=document.createElementNS(this.graph.ns,'circle'),this.marker.setAttribute('fill','black'),this.marker.setAttribute('r',3),this.marker.setAttribute('display','none'),this.markerLabel=document.createElementNS(this.graph.ns,'text'),this.markerLabelSquare=document.createElementNS(this.graph.ns,'rect'),this.markerLabelSquare.setAttribute('fill','white'),this.domMarkerHover={},this.domMarkerSelect={},this.markerHovered=0,this.groupMarkerSelected=document.createElementNS(this.graph.ns,'g'),this.markerPoints={},this.lines=[],this.groupMain.appendChild(this.groupLines),this.groupMain.appendChild(this.marker),this.groupMain.appendChild(this.groupMarkerSelected),this.groupMain.appendChild(this.markerLabelSquare),this.groupMain.appendChild(this.markerLabel),this.groupMarkers=document.createElementNS(this.graph.ns,'g'),this.groupMain.appendChild(this.groupMarkers),this.independantMarkers=[],this.initExtended1&&this.initExtended1(),this.groupLines.addEventListener('click',()=>{this.options.selectableOnClick&&(this.isSelected()?this.graph.unselectSerie(this):this.graph.selectSerie(this))}),this.options.markers&&this.setMarkers(this.options.markers,'unselected')}setOptions(e){return this.options=extend$1(!0,{},SerieLine.prototype.defaults,e||{}),this.styles.unselected={lineColor:this.options.lineColor,lineStyle:this.options.lineStyle,markers:this.options.markers},this.applyLineStyles(),this}onMouseOverMarker(t,e){this.toggleMarker(e,!0,!0);this.options.onMouseOverMarker&&this.options.onMouseOverMarker(e,!!this.infos&&(this.infos[e]||!1),[this.waveform.getX(e),this.waveform.getY(e)])}onMouseOutMarker(t,e){this.markersOffHover(),this.options.onMouseOutMarker&&this.options.onMouseOutMarker(e,!!this.infos&&(this.infos[e]||!1),[this.waveform.getX(e),this.waveform.getY(e)])}toggleMarker(e,t,r){let a=e;var i;'undefined'==typeof t&&(i=r?!this.domMarkerHover[e]:!this.domMarkerSelect[e]);var s=this['domMarker'+(r?'Hover':'Select')];if(i||!0===t){if(!s[e]){var n=document.createElementNS(this.graph.ns,'path');this.setMarkerStyleTo(n,this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(a)]),this['domMarker'+(r?'Hover':'Select')][e]=n,this.groupMarkerSelected.appendChild(n)}else n=s[e];let t=this.getX(this.waveform.getX(a)),i=this.getY(this.waveform.getY(a));n.setAttribute('d','M '+t+' '+i+' '+this.getMarkerPath(this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(a)],1)),r&&this.markerHovered++}else if((!i||!1===t)&&(r&&this.domMarkerHover[e]&&!this.domMarkerSelect[e]||this.domMarkerSelect[e])){if(!s[e])return;this.groupMarkerSelected.removeChild(s[e]),delete s[e],r&&this.markerHovered--}return i}markersOffHover(){for(var e in this.domMarkerHover)this.toggleMarker(e.split(','),!1,!0);return this}markersOffSelect(){for(var e in this.domMarkerSelect)this.toggleMarker(e.split(','),!1,!1);return this}onClickOnMarker(t,e){var i=this.toggleMarker(e);i&&this.options.onSelectMarker&&this.options.onSelectMarker(e,!!this.infos&&(this.infos[e[0]]||!1)),!i&&this.options.onUnselectMarker&&this.options.onUnselectMarker(e,!!this.infos&&(this.infos[e[0]]||!1)),this.options.onToggleMarker&&this.options.onToggleMarker(e,!!this.infos&&(this.infos[e[0]]||!1),i)}_getMarkerIndexFromEvent(t){var e=this.graph._getXY(t);return this.searchIndexByPxXY(e.x-this.graph.getPaddingLeft(),e.y-this.graph.getPaddingTop())}onMouseWheel(){}empty(){for(var e=0,t=this.lines.length;e{this.draw(e)}),!1;if(!1===r)return!1;this._dataToUse=this.waveform.getDataToUseFlat()}return!0}removeLinesGroup(){this._afterLinesGroup=this.groupLines.nextSibling,this.groupMain.removeChild(this.groupLines)}insertLinesGroup(){if(!this._afterLinesGroup)throw'Could not find group after lines to insertion.';this.groupMain.insertBefore(this.groupLines,this._afterLinesGroup),this._afterLinesGroup=!1}removeExtraLines(){for(var e=this.currentLineId,t=this.lines.length;ec.length&&(i=c.length));vd&&r>d||(!this.options.overflowY&&hg&&a>g)&&!this.options.lineToZero){r=u,a=h,k=!0;continue}if(this.counter2=v,C&&this.getMarkerCurrentFamily(this.counter2),y=this.getX(u),b=this.getY(h),y!=x||b!=m){if(y!=y||b!=b){0g):!this.options.overflowX&&(ud)||!this.options.overflowY&&(hg),this.options.lineToZero){if(S=ud,S)continue;}else if(S||k){!1!==r&&!1!==a||k?(Y=[],l=(u-o)/(u-r),_=h-l*(h-a),P=(u-d)/(u-r),L=h-P*(h-a),w=(h-p)/(h-a),T=u-w*(u-r),E=(h-g)/(h-a),X=u-E*(u-r),1>l&&0p&&Y.push([o,_]),1>P&&0p&&Y.push([d,L]),1>w&&0o&&Y.push([T,p]),1>E&&0o&&Y.push([X,g]),0{var e=this.graph._getXY(t),i=this.handleMouseMove(!1,!1);this._trackingCallback(this,i,e.x,e.y)}),this.groupMain.addEventListener('mouseleave',()=>{this._trackingOutCallback(this)})}return this}kill(){super.kill()}getMarkerCurrentFamily(e){if(this.markerPoints&&this.markerPoints[this.selectionType]){for(var t=0,i;t=e&&(this.markerCurrentFamily=this.markerPoints[this.selectionType][t][2],i=this.markerFamilies[this.selectionType][this.markerCurrentFamily]);return!!i&&(this.getMarkerDom(i),this.markerCurrentFamily)}}setMarkerStyleTo(e,t){if(!e||!t)throw console.trace(),'Cannot set marker style. DOM does not exist.';e.setAttribute('fill',t.fillColor||'transparent'),e.setAttribute('stroke',t.strokeColor||this.getLineColor()),e.setAttribute('stroke-width',t.strokeWidth||1)}hideTrackingMarker(){this.marker.setAttribute('display','none'),this.markerLabel.setAttribute('display','none'),this.markerLabelSquare.setAttribute('display','none')}_addPoint(e,t,i,r,a,s,n){if(e===e&&t===t)return 0==this.counter?this.currentLine='M ':this.options.lineToZero||s?this.currentLine+='M ':this.currentLine+='L ',this.currentLine+=e,this.currentLine+=' ',this.currentLine+=t,this.currentLine+=' ',this.options.lineToZero&&void 0!==this.pos0&&(this.currentLine+='L ',this.currentLine+=e,this.currentLine+=' ',this.currentLine+=this.pos0,this.currentLine+=' '),this.hasErrors()&&this.errorAddPoint(a,i,r,e,t),this.markerPoints?void(this.markersShown()&&!1!==n&&this.markerFamily&&drawMarkerXY(this,this.markerFamily[this.markerCurrentFamily],e,t,this.markersDom.get(this.markerFamily[this.markerCurrentFamily])),this.counter++):void this.counter++}_createLine(){var e=this.currentLineId++,t;return this.lines[e]?t=this.lines[e]:(t=document.createElementNS(this.graph.ns,'path'),this.applyLineStyle(t),this.groupLines.appendChild(t),this.lines[e]=t),0==this.counter?t.setAttribute('d',''):t.setAttribute('d',this.currentLine),this.currentLine='M ',this.counter=0,t}applyLineStyles(){for(var e=0;e{this.onMouseOverMarker(i,t)}),i.addEventListener('mouseout',(i)=>{this.onMouseOutMarker(i,t)}),i.addEventListener('click',(i)=>{this.onClickOnMarker(i,t)}),this.independantMarkers[t]=i}return this.groupMarkers.appendChild(this.independantMarkers[t]),this.independantMarkers[t]}searchIndexByPxXY(e,t){for(var i=Math.pow,r=!1,a=!1,s=this._xDataToUse,n=0,o=this.waveform.getLength(),l,p,d;nthis.waveform.getX(i)?0:1,Object.assign(r,{indexMin:i+a,indexMax:i+a+1,indexClosest:i,xMin:this.waveform.getX(i+a),xMax:this.waveform.getX(i+a+1),yMin:this.waveform.getY(i+a),yMax:this.waveform.getY(i+a+1),xClosest:this.waveform.getX(i),yClosest:this.waveform.getY(i),xExact:e}),r}}handleMouseMove(e,t,i){var r=e||this.getXAxis().getMouseVal(),a=i||this.getYAxis().getMouseVal(),s=this.searchClosestValue(r,a);if(s){var n;if(s.xMax==s.xMin&&(n=s.yMin),t&&this.options.trackMouse){if(void 0==s.xMin)return!1;if(!this.marker)return;var o=this.getX(this.getFlip()?s.yClosest:s.xClosest),l=this.getY(this.getFlip()?s.xClosest:s.yClosest);if(isNaN(o)||isNaN(l))return;switch(this.marker.setAttribute('display','block'),this.marker.setAttribute('cx',o),this.marker.setAttribute('cy',l),this.markerLabel.setAttribute('display','block'),this.markerLabelSquare.setAttribute('display','block'),this.options.trackMouseLabel){case!1:break;default:this.markerLabel.textContent=this.options.trackMouseLabel.replace('',r.toFixed(this.options.trackMouseLabelRouding)).replace('',n.toFixed(this.options.trackMouseLabelRouding));}this.markerLabel.setAttribute('x',o+5),this.markerLabel.setAttribute('y',l-5),this.markerLabelSquare.setAttribute('x',o+5),this.markerLabelSquare.setAttribute('y',l-5-this.graph.options.fontSize),this.markerLabelSquare.setAttribute('width',this.markerLabel.getComputedTextLength()+2),this.markerLabelSquare.setAttribute('height',this.graph.options.fontSize+2)}return{xBefore:s.xMin,xAfter:s.xMax,yBefore:s.yMin,yAfter:s.yMax,trueX:s.xExact,indexClosest:s.indexClosest,interpolatedY:n,xClosest:s.xClosest,yClosest:s.yClosest}}}getMax(e,t){var r=Math.max,a=Math.min(e,t),s=r(e,t),n=this.searchClosestValue(a),o=this.searchClosestValue(s),l=-Infinity,p,i,d,g;if(n||(a=this.minX,n=this.searchClosestValue(a)),o||(s=this.maxX,o=this.searchClosestValue(s)),!n||!o)return-Infinity;for(p=n.dataIndex;p<=o.dataIndex;p++)for(d=p==n.dataIndex?n.xBeforeIndexArr:0,g=p==o.dataIndex?o.xBeforeIndexArr:this.data[p].length,i=d;i<=g;i+=2)l=r(l,this.data[p][i+1]);return l}getMin(e,t){var r=Math.min,a=r(e,t),s=Math.max(e,t),n=this.searchClosestValue(a),o=this.searchClosestValue(s),l=Infinity,p,i,d,g;if(n||(a=this.minX,n=this.searchClosestValue(a)),o||(s=this.maxX,o=this.searchClosestValue(s)),!n||!o)return Infinity;for(p=n.dataIndex;p<=o.dataIndex;p++)for(d=p==n.dataIndex?n.xBeforeIndexArr:0,g=p==o.dataIndex?o.xBeforeIndexArr:this.data[p].length,i=d;i<=g;i+=2)l=r(l,this.data[p][i+1]);return l}setStyle(e,t='unselected'){this.styles[t]=e,this.styleHasChanged(t)}setLineStyle(e,t='unselected',i){return this.styles[t]=this.styles[t]||{},this.styles[t].lineStyle=e,i&&this.setLineStyle(e,'selected'),this.styleHasChanged(t),this}getLineStyle(e){return this.getStyle(e).lineStyle}getLineDashArray(e=this.selectionType||'unselected'){switch(this.getStyle(e).lineStyle){case 2:return'1, 1';break;case 3:return'2, 2';break;case 4:return'3, 3';break;case 5:return'4, 4';break;case 6:return'5, 5';break;case 7:return'5 2';break;case 8:return'2 5';break;case 9:return'4 2 4 4';break;case 10:return'1,3,1';break;case 11:return'9 2';break;case 12:return'2 9';break;case 1:case!1:return!1;break;default:return this.styles[e].lineStyle;}this.styleHasChanged(e)}getStyle(e=this.selectionType||'unselected'){return this.styles[e]}extendStyles(){for(var e in this.styles){var t=this.styles[e];t&&(this.styles[e]=extend$1(!0,{},this.styles.unselected,t))}}extendStyle(e,t){var i=this.styles[e];this.styles[e]=extend$1(!0,{},this.styles[t||'unselected'],i||{}),this.styles[e].markers.map(function(e){e.dom&&(e.dom='')}),this._recalculateMarkerPoints(e,this.styles[e].markers),this.styleHasChanged(e)}setLineWidth(e,t,i){return t=t||'unselected',this.styles[t]=this.styles[t]||{},this.styles[t].lineWidth=e,i&&this.setLineWidth(e,'selected'),this.styleHasChanged(t),this}getLineWidth(e){return this.getStyle(e).lineWidth||1}setLineColor(e,t,i){return t=t||'unselected',this.styles[t]=this.styles[t]||{},this.styles[t].lineColor=e,i&&this.setLineColor(e,'selected'),this.styleHasChanged(t),this}getLineColor(e){return this.getStyle(e).lineColor||'black'}showMarkers(e,t){return e=e||'unselected',this.styles[e]=this.styles[e]||{},this.styles[e].showMarkers=!0,t&&this._drawn?this.draw(!0):this.styleHasChanged(e),this}hideMarkers(e,t){return e=e||'unselected',this.styles[e].showMarkers=!1,t&&this._drawn?this.draw(!0):this.styleHasChanged(e),this}markersShown(e){return!1!==this.getStyle(e).showMarkers}areMarkersShown(){return this.markersShown.apply(this,arguments)}isMarkersShown(){return this.markersShown.apply(this,arguments)}setMarkers(e,t,i){return this.styles[t||'unselected']=this.styles[t||'unselected']||{},this.showMarkers(t,!1),Array.isArray(e)||'object'!=typeof e?!e&&(e=[{type:1,zoom:1,points:'all'}]):e=[e],this.styles[t||'unselected'].markers=e,i&&(this.styles.selected.markers=extend$1(!0,{},e)),this._recalculateMarkerPoints(t,e),this.styleHasChanged(t),this.dataHasChanged(!0),this}setMarkersPoints(e,t,i){this._extendMarkers('points',e,t,i,!0)}setMarkersColor(e,t,i){this._extendMarkers('color',e,t,i)}setMarkersType(e,t,i){this._extendMarkers('type',e,t,i)}setMarkersZoom(e,t,i){this._extendMarkers('zoom',e,t,i)}setMarkersStrokeColor(e,t,i){this._extendMarkers('strokeColor',e,t,i)}setMarkersStrokeWidth(e,t,i){this._extendMarkers('strokeWidth',e,t,i)}setMarkersFillColor(e,t,i){this._extendMarkers('fillColor',e,t,i)}_extendMarkers(e,t,i,r,a){(i=i||0,r=r||'unselected',this.styles[r]&&this.styles[r].markers)&&(this.styles[r].markers[i][e]=t,a&&this._recalculateMarkerPoints(r,this.styles[r].markers),this.markersDom[this.styles[r].markers[i]]&&this.setMarkerStyleTo(this.markersDom[this.styles[r].markers[i]].dom,this.styles[r].markers[i]))}_recalculateMarkerPoints(e,t){for(var r=[[0,Infinity,null]],a=0,i=t.length;an(e)):this.data[l].outliers=[];return this.dataHasChanged(),this.graph.updateDataMinMaxAxes(),this}_style(e,t,i='unselected',r=!1){return this.styles[i]=this.styles[i]||{},this.styles[i][e]=t,r&&this._set(e,t,'selected'),this.styleHasChanged(i),this}_gstyle(e,t){return this.getStyle(t)[e]}getStyle(e='unselected'){return this.styles[e]||{}}setMeanLineColor(){return this._style('meanLineColor',...arguments)}getMeanLineColor(){return this._gstyle('meanLineColor',...arguments)}setStyle(e,t='unselected'){this.styles[t]=extend$1({},this.default().defaultStyle,this.styles.unselected,e),this.styleHasChanged(t)}setMeanLineWidth(){return this._style('meanLineWidth',...arguments)}getMeanLineWidth(){return this._gstyle('meanLineWidth',...arguments)}setBoxAboveLineColor(){return this._style('boxAboveLineColor',...arguments)}getBoxAboveLineColor(){return this._gstyle('boxAboveLineColor',...arguments)}setBoxBelowLineColor(){return this._style('boxBelowLineColor',...arguments)}getBoxBelowLineColor(){return this._gstyle('boxBelowLineColor',...arguments)}setBoxAboveLineWidth(){return this._style('boxAboveLineWidth',...arguments)}getBoxAboveLineWidth(){return this._gstyle('boxAboveLineWidth',...arguments)}setBoxBelowLineWidth(){return this._style('boxBelowLineWidth',...arguments)}getBoxBelowLineWidth(){return this._gstyle('boxBelowLineWidth',...arguments)}setBoxAboveFillColor(){return this._style('boxAboveFillColor',...arguments)}getBoxAboveFillColor(){return this._gstyle('boxAboveFillColor',...arguments)}setBoxBelowFillColor(){return this._style('boxBelowFillColor',...arguments)}getBoxBelowFillColor(){return this._gstyle('boxBelowFillColor',...arguments)}setBoxAboveFillOpacity(){return this._style('boxAboveFillOpacity',...arguments)}getBoxAboveFillOpacity(){return this._gstyle('boxAboveFillOpacity',...arguments)}setBoxBelowFillOpacity(){return this._style('boxBelowFillOpacity',...arguments)}getBoxBelowFillOpacity(){return this._gstyle('boxBelowFillOpacity',...arguments)}setBarAboveLineColor(){return this._style('barAboveLineColor',...arguments)}getBarAboveLineColor(){return this._gstyle('barAboveLineColor',...arguments)}setBarBelowLineColor(){return this._style('barBelowLineColor',...arguments)}getBarBelowLineColor(){return this._gstyle('barBelowLineColor',...arguments)}setBarAboveLineWidth(){return this._style('barAboveLineWidth',...arguments)}getBarAboveLineWidth(){return this._gstyle('barAboveLineWidth',...arguments)}setBarBelowLineWidth(){return this._style('barBelowLineWidth',...arguments)}getBarBelowLineWidth(){return this._gstyle('barBelowLineWidth',...arguments)}setOutlierLineColor(){return this._style('outlierLineColor',...arguments)}getOutlierLineColor(){return this._gstyle('outlierLineColor',...arguments)}setOutlierLineWidth(){return this._style('outlierLineWidth',...arguments)}getOutlierLineWidth(){return this._gstyle('outlierLineWidth',...arguments)}setOutlierFillColor(){return this._style('outlierFillColor',...arguments)}getOutlierFillColor(){return this._gstyle('outlierFillColor',...arguments)}setOutlierFillOpacity(){return this._style('outlierFillOpacity',...arguments)}getOutlierFillOpacity(){return this._gstyle('outlierFillOpacity',...arguments)}applyLineStyles(){this.applyLineStyle(this.pathDom)}applyLineStyle(e){e.setAttribute('stroke',this.getLineColor()),e.setAttribute('stroke-width',this.getLineWidth()),e.removeAttribute('stroke-dasharray'),e.setAttribute('fill',this.getFillColor()),e.setAttribute('fill-opacity',this.getFillOpacity()||1)}draw(){if(!this.data)return;let e='y'==this.options.orientation?this.getYAxis():this.getXAxis(),t='y'==this.options.orientation?this.getXAxis():this.getYAxis(),r,a,s,n,o,p,d,g;if(emptyDom(this.groupMain),'category'==t.getType())a=t.getRelPx(0.8/this.nbCategories);else{a=this.options.maxBoxWidth;for(var c=0,i=this.data.length;c{te.getPos(t));var l=document.createElementNS(this.graph.ns,'line');this.applyMeanStyle(l);var u=document.createElementNS(this.graph.ns,'rect'),h=document.createElementNS(this.graph.ns,'rect');'y'==this.options.orientation?(u.setAttribute('width',a),u.setAttribute('x',r[0]-a/2),h.setAttribute('width',a),h.setAttribute('x',r[0]-a/2),l.setAttribute('x1',r[0]-a/2),l.setAttribute('x2',r[0]+a/2),l.setAttribute('y1',s),l.setAttribute('y2',s)):(u.setAttribute('height',a),u.setAttribute('y',r[0]-a/2),h.setAttribute('height',a),h.setAttribute('y',r[0]-a/2),l.setAttribute('y1',r[0]-a/2),l.setAttribute('y2',r[0]+a/2),l.setAttribute('x1',s),l.setAttribute('x2',s)),this.boxPos(u,s,n,'x'==this.options.orientation),this.boxPos(h,s,o,'x'==this.options.orientation),this.applyBoxStyle(u,h);var x=document.createElementNS(this.graph.ns,'line'),m=document.createElementNS(this.graph.ns,'line');'y'==this.options.orientation?(void 0!==p&&(x.setAttribute('y1',n),x.setAttribute('y2',p),x.setAttribute('x1',r[0]),x.setAttribute('x2',r[0])),void 0!==d&&(m.setAttribute('y1',o),m.setAttribute('y2',d),m.setAttribute('x1',r[0]),m.setAttribute('x2',r[0]))):(void 0!==p&&(x.setAttribute('x1',n),x.setAttribute('x2',p),x.setAttribute('y1',r[0]),x.setAttribute('y2',r[0])),void 0!==d&&(m.setAttribute('x1',o),m.setAttribute('x2',d),m.setAttribute('y1',r[0]),m.setAttribute('y2',r[0]))),g.map((e)=>{let t=document.createElementNS(this.graph.ns,'circle');t.setAttribute('r',2),'y'==this.options.orientation?(t.setAttribute('cx',r[0]),t.setAttribute('cy',e)):(t.setAttribute('cy',r[0]),t.setAttribute('cx',e)),this.setOutlierStyle(t),this.groupMain.appendChild(t)}),void 0!==p&&this.groupMain.appendChild(x),void 0!==d&&this.groupMain.appendChild(m),void 0!==n&&this.groupMain.appendChild(u),void 0!==o&&this.groupMain.appendChild(h),this.groupMain.appendChild(l),this.applyWhiskerStyle(x,m)}}applyBoxStyle(e,t){e.setAttribute('stroke',this.getBoxAboveLineColor()),e.setAttribute('stroke-width',this.getBoxAboveLineWidth()),this.getBoxAboveFillColor()!==void 0&&e.setAttribute('fill',this.getBoxAboveFillColor()),this.getBoxAboveFillOpacity()!==void 0&&e.setAttribute('fill-opacity',this.getBoxAboveFillOpacity()),t.setAttribute('stroke',this.getBoxBelowLineColor()),t.setAttribute('stroke-width',this.getBoxBelowLineWidth()),this.getBoxBelowFillColor()!==void 0&&t.setAttribute('fill',this.getBoxBelowFillColor()),this.getBoxAboveFillOpacity()!==void 0&&t.setAttribute('fill-opacity',this.getBoxBelowFillOpacity())}applyWhiskerStyle(e,t){e.setAttribute('stroke',this.getBarAboveLineColor()),e.setAttribute('stroke-width',this.getBarAboveLineWidth()),t.setAttribute('stroke',this.getBarBelowLineColor()),t.setAttribute('stroke-width',this.getBarBelowLineWidth())}applyMeanStyle(e){e.setAttribute('stroke',this.getMeanLineColor()),e.setAttribute('stroke-width',this.getMeanLineWidth())}setOutlierStyle(e){e.setAttribute('stroke',this.getOutlierLineColor()),e.setAttribute('stroke-width',this.getOutlierLineWidth()),this.getBoxBelowFillColor()!==void 0&&e.setAttribute('fill',this.getOutlierFillColor()),this.getBoxAboveFillOpacity()!==void 0&&e.setAttribute('fill-opacity',this.getOutlierFillOpacity())}getCategoryIndex(e){if(!this.categories)throw new Error('No categories were defined. Probably axis.setSeries was not called');for(var t=0;ti?(e.setAttribute(r?'x':'y',i),e.setAttribute(r?'width':'height',t-i)):(e.setAttribute(r?'x':'y',t),e.setAttribute(r?'width':'height',i-t))}getUsedCategories(){let e='y'==this.options.orientation?'x':'y',t=this.data.map((t)=>t[e]);return Array.isArray(this._linkedToScatterSeries)&&this._linkedToScatterSeries.map((e)=>{e.getUsedCategories().map((e)=>{let i;-1<(i=t.indexOf(e))&&t.splice(i,1)})}),t}linkToScatterSerie(...e){this._linkedToScatterSeries=e}}class SerieLineColor extends SerieLine{constructor(){super(...arguments),this.lines=this.lines||{}}setColors(e){this.colors=e}_draw(){var t=this,e=this._dataToUse,r=0,i=!1,a=!1,s=this.getXAxis(),n=this.getYAxis(),o=s.getCurrentMin(),p=n.getCurrentMin(),d=s.getCurrentMax(),g=n.getCurrentMax(),c,u,h,m,x,u,y,b,A,f;for(this.eraseLines(),this.isFlipped(),this.currentLine='',h=this.waveform.getLength(),c=0;cd&&i>d||(xg&&a>g)&&!this.options.lineToZero){i=m,a=x;continue}if(this.counter2=c,this.markersShown()&&this.getMarkerCurrentFamily(this.counter2),A=this.getX(m),f=this.getY(x),A!=y||f!=b){if(isNaN(A)||isNaN(f)){0{var e=parseInt(t.target.parentElement.getAttribute('data-shapeid'));this.emit('mouseover',e,this.waveform.getX(e),this.waveform.getY(e))}),this.groupPoints.addEventListener('mouseout',(t)=>{var e=parseInt(t.target.parentElement.getAttribute('data-shapeid'));this.emit('mouseout',e,this.waveform.getX(e),this.waveform.getY(e))}),this.minX=t,this.minY=t,this.maxX=e,this.maxY=e,this.groupMain.appendChild(this.groupPoints),this.currentAction=!1,this.initExtended1&&this.initExtended1(),this.styles={},this.styles.unselected={},this.styles.selected={},this.styles.unselected.default={shape:'circle',cx:0,cy:0,r:3,stroke:'transparent',fill:'black'},this.styles.selected.default={shape:'circle',cx:0,cy:0,r:4,stroke:'transparent',fill:'black'}}setDataCategory(e){for(let t of e)this._checkY(t.y.getMaxY()),this._checkY(t.y.getMinY());return this.data=e,this.dataHasChanged(),this.graph.updateDataMinMaxAxes(),this}empty(){for(;this.groupPoints.firstChild;)this.groupPoints.removeChild(this.groupPoints.firstChild)}getSymbolForLegend(){if(this.symbol)return this.symbol;var e=document.createElementNS(this.graph.ns,'g');e.setAttribute('data-shapeid',-1);var t=this.doShape(e,this.styles.unselected.default),r=this.getStyle('unselected',-1,!0);for(var a in r[-1])'shape'!=a&&t.setAttribute(a,r[-1][a]);return e}setStyle(e,t,i='unselected'){return'string'==typeof t&&(i=t,t=!1),this.styles[i]=this.styles[i]||{},this.styles[i].all=e,this.styles[i].modifiers=t,this.styleHasChanged(i),this}draw(e){if(e||this.hasDataChanged()||this.hasStyleChanged('unselected')){var t=0,i='category'==this.getXAxis().getType(),r,a;this._drawn=!0,this.dataHasChanged(!1),this.styleHasChanged(!1),this.groupMain.removeChild(this.groupPoints);var s=[];if(t=0,this.hasErrors()&&this.errorDrawInit(),i){for(let e=0;tthis.getXAxis().getCurrentMax()||this.waveform.getY(t)this.getYAxis().getCurrentMax()){this.shapes[t]&&this.shapes[t].setAttribute('display','none');continue}this.shapes[t]&&this.shapes[t].setAttribute('display','initial'),r=this.getX(this.waveform.getX(t)),a=this.getY(this.waveform.getY(t)),this.hasErrors()&&this.errorAddPoint(t,this.waveform.getX(t),this.waveform.getY(t),r,a),this.shapesDetails[t]=this.shapesDetails[t]||[],this.shapesDetails[t][0]=r,this.shapesDetails[t][1]=a,s.push(t)}this.hasErrors()&&this.errorDraw(),this.applyStyle('unselected',s),this.groupMain.appendChild(this.groupPoints)}}_addPoint(e,t,i){let r=document.createElementNS(this.graph.ns,'g'),a;r.setAttribute('transform','translate('+e+', '+t+')'),r.setAttribute('data-shapeid',i),a=this.extraStyle&&this.extraStyle[i]?this.doShape(r,this.extraStyle[i]):this.stdStylePerso?this.doShape(r,this.stdStylePerso):this.doShape(r,this.stdStyle),this.shapes[i]=a,this.groupPoints.appendChild(r)}doShape(e,t){var i=document.createElementNS(this.graph.ns,t.shape);return e.appendChild(i),i}getStyle(e,t,r){var e=e||'unselected',a={},s;'number'==typeof t?s=[t]:Array.isArray(t)&&(s=t);var n,t,o,p,d;this.styles[e].all!==void 0&&(d=this.styles[e].all,'function'==typeof d?d=d():!1===d&&(d={}));for(var c=0,i=s.length;ce.x):[]}}mix(SerieScatter,ErrorBarMixin);class SerieZone extends Serie{static default(){return{fillColor:'rgba( 0, 0, 0, 0.1 )',lineColor:'rgba( 0, 0, 0, 1 )',lineWidth:'1px'}}constructor(){super(...arguments),this.selectionType='unselected',this.id=guid(),this.groupZones=document.createElementNS(this.graph.ns,'g'),this.groupMain=document.createElementNS(this.graph.ns,'g'),this.lineZone=document.createElementNS(this.graph.ns,'path'),this.lineZone.setAttribute('stroke','black'),this.lineZone.setAttribute('stroke-width','1px'),this.groupMain.appendChild(this.groupZones),this.groupZones.appendChild(this.lineZone),this.applyLineStyle(this.lineZone),this.styleHasChanged(),this.clip=document.createElementNS(this.graph.ns,'clipPath'),this.clipId=guid(),this.clip.setAttribute('id',this.clipId),this.graph.defs.appendChild(this.clip)}setWaveform(...e){var t=Math.max,i=Math.min;return this.waveforms=e,this.waveforms=this.waveforms.map((e)=>e instanceof Waveform?e:new Waveform(e)),this.minX=this.waveforms[0].getXMin(),this.maxX=this.waveforms[0].getXMax(),this.minY=this.waveforms[0].getMin(),this.maxY=this.waveforms[0].getMax(),this.waveforms.map((e)=>{this.minX=i(e.getXMin(),this.minX),this.maxX=t(e.getXMin(),this.maxX),this.minY=i(e.getMin(),this.minY),this.maxY=t(e.getMax(),this.maxY)}),this.graph.updateDataMinMaxAxes(),this.dataHasChanged(),this}setWaveforms(){return this.setWaveform(...arguments)}getWaveforms(){return this.waveforms}setMinMaxWaveforms(e,t){return this.waveforms=[e,t.reverse()],this}empty(){for(;this.group.firstChild;)this.group.removeChild(this.group.firstChild)}draw(e){if(e||this.hasDataChanged()){if(!this.waveforms)return;let e=0,t=0,i=0,r=0,a=0,s='',n=!1,o;const l=this.getXAxis().getMinPx(),p=this.getXAxis().getMaxPx(),d=this.getYAxis().getMinPx(),g=this.getYAxis().getMaxPx(),c=this.getXAxis().getCurrentMin(),u=this.getXAxis().getCurrentMax(),h=this.getYAxis().getCurrentMin(),x=this.getYAxis().getCurrentMax();this.groupMain.removeChild(this.groupZones);for(let l of this.waveforms)for(a=0;ax&&(r=this.getY(x)),e===e){if(t!==t){if(0==s.length)continue;s+='L '+i+', '+this.getY(l.getMinY()),n=!0;continue}if(r=this.getY(t),i=this.getX(e),eu){o=[e,t[a],i,r];continue}n&&(s+=' M '+i+', '+this.getY(l.getMinY())+' ',n=!1),0r||c>n||0>i||0>c))&&(o[i]=o[i]||[],o[i][c]=o[i][c]+1||1,l=o[i][c]d?o[i][c]:d);return this.maxIndexX=r,this.maxIndexY=n,this.binMin=l,this.binMax=d,this.deltaX=t,this.deltaY=s,this.fromX=e,this.fromY=a,this.numX=r,this.numY=n,this.densitymap=o,o}setDensityMap(e,t,r,a,s,n){var o=this.data.length,l=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,d,i;for(d=0;dp?e[d][i]:p;return this.maxIndexX=e.length,this.maxIndexY=e[0].length,this.binMin=l,this.binMax=p,this.deltaX=r,this.deltaY=n,this.fromX=t,this.fromY=s,this.numX=this.maxIndexX,this.numY=this.maxIndexY,this.densitymap=e,e}calculateDensityWeighted(e,t,r,a,s,n){var o=Math.floor,p=[],d=this.data.length,l=Number.POSITIVE_INFINITY,g=Number.NEGATIVE_INFINITY,c,i,u,h,x,m,y,b,A,f,S;for(c=0;cr||u>n||0>i||0>u))&&(p[b]=p[b]||[],p[A]=p[A]||[],p[b][f]=p[b][f]||0,p[A][f]=p[A][f]||0,p[b][S]=p[b][S]||0,p[A][S]=p[A][S]||0,p[b][f]+=h*x,p[A][f]+=(1-h)*x,p[b][S]+=h*(1-x),p[A][S]+=(1-h)*(1-x),l=p[b][f]g?p[b][f]:g,l=p[A][f]g?p[A][f]:g,l=p[b][S]g?p[b][S]:g,l=p[A][S]g?p[A][S]:g);return this.maxIndexX=r,this.maxIndexY=n,this.binMin=l,this.binMax=g,this.deltaX=t,this.deltaY=s,this.fromX=e,this.fromY=a,this.numX=r,this.numY=n,this.densitymap=p,p}autoBins(e,t){return this.numX=e||400,this.numY=t||this.numX,this.calculateDensity(this.minX,(this.maxX-this.minX)/e,e,this.minY,(this.maxY-this.minY)/t,t),this.recalculateBinsOnDraw=!1,this}setPxPerBin(e,t,i){return e&&this.calculationDensityMap({from:'min',to:'max',pxPerBin:e,weighted:i}),t&&this.calculationDensityMap(!1,{from:'min',to:'max',pxPerBin:t,weighted:i}),this}setBinsFromTo(e,t,i,r){return this.densityMapCalculation=this.densityMapCalculation||{},this.densityMapCalculation[e]={from:t,to:i,numBins:r},this.calculationDensityMap(),this}calculationDensityMap(e,t){this.method=this.calculateDensityAdvanced,this.densityMapCalculation=this.densityMapCalculation||{},e&&(this.densityMapCalculation.x=e),t&&(this.densityMapCalculation.y=t)}calculateDensityAdvanced(){var e=Math.abs,t={x:{from:0,num:0,delta:0,weighing:!1},y:{from:0,num:0,delta:0,weighing:!1}},r={x:this.graph.drawingSpaceWidth,y:this.graph.drawingSpaceHeight},a={x:this.getXAxis,y:this.getYAxis},s=!1;for(var n in this.densityMapCalculation)if(this.densityMapCalculation[n].weighted&&(s=!0,t[n].weighing=!0),this.densityMapCalculation[n].pxPerBin){var i='min'==this.densityMapCalculation[n].from?a[n].call(this).getCurrentMin():this.densityMapCalculation[n].from,o='max'==this.densityMapCalculation[n].to?a[n].call(this).getCurrentMax():this.densityMapCalculation[n].to,l=e(a[n].call(this).getRelPx(o-i));t[n].num=Math.ceil(r[n]/this.densityMapCalculation[n].pxPerBin),t[n].from=i-e(a[n].call(this).getRelVal((t[n].num*this.densityMapCalculation[n].pxPerBin-l)/2)),t[n].delta=e(a[n].call(this).getRelVal(this.densityMapCalculation[n].pxPerBin))}else t[n].num=this.densityMapCalculation[n].numBins||400,t[n].from='min'==this.densityMapCalculation[n].from?a[n].call(this).getCurrentMin():this.densityMapCalculation[n].from,t[n].delta=this.densityMapCalculation[n].to?(('max'==this.densityMapCalculation[n].to?a[n].call(this).getCurrentMax():this.densityMapCalculation[n].to)-t[n].from)/t[n].num:this.densityMapCalculate[n].delta;(s?this.calculateDensityWeighted:this.calculateDensity).call(this,t.x.from,t.x.delta,t.x.num,t.y.from,t.y.delta,t.y.num)}setColorMapBinBoundaries(e,t){return this.colorMapMin=e,this.colorMapMax=t,this}autoColorMapBinBoundaries(){return this.colorMapMin=this.binMin,this.colorMapMax=this.binMax,this}onRedrawColorMapBinBoundaries(e){return this.callbackColorMapMinMax=e,this}colorMapHSL(e,t,r){var a=Math.log,s=Math.round;r=r||'linear';for(var n={exp:function(e){return(Math.exp(1*(e/t))-1)/(2.718281828459045-1)},log:function(e){return(a(e+1)-0)/(a(t+1)-0)},linear:function(e){return(e-0)/(t-0)}},o=0,l=[],p=[],d={h:null,s:null,l:null,a:null},g=e.length-1,c=0,i,u;c<=t;c++){for(var h in i=n[r](c),u=Math.floor(i*g),u==e.length-1&&(u=g-1),i=(i-u/g)/(1/g),d)d[h]=(e[u+1][h]-e[u][h])*i+e[u][h];l[o]='hsl('+d.h+', '+s(100*d.s)+'%, '+s(100*d.l)+'%)',p[o]=d.a,o++}return this.opacities=p,this.colorMap=l,this.colorMapNum=t,this}autoColorMapHSL(e,t='linear'){return this.colorMapHSV(e,100,t),this}getColorIndex(e){return Math.max(0,Math.min(this.colorMapNum,Math.floor((e-this.colorMapMin)/(this.colorMapMax-this.colorMapMin)*this.colorMapNum)))}draw(){var e;if(this.method&&this.method(),!this.callbackColorMapMinMax||void 0==this.colorMapMin||void 0==this.colorMapMax||'auto'==this.callbackColorMapMinMax)this.autoColorMapBinBoundaries();else{var t=this.callbackColorMapMinMax(this.binMin,this.binMax);this.setColorMapBinBoundaries(t[0],t[1])}for(var r=this.getXAxis().getRelPx(this.deltaX),a=this.getYAxis().getRelPx(this.deltaY),s=0;sy&&d[r+2+u]>y||d[r+c]>m&&d[r+2+c]>m||(n=this.getX(d[r+c]),o=this.getY(d[r+u]),a=this.getX(d[r+2+c]),s=this.getY(d[r+2+u]),a!=n||s!=o)&&(this.currentLine+='M ',this.currentLine+=n,this.currentLine+=' ',this.currentLine+=o,this.currentLine+='L ',this.currentLine+=a,this.currentLine+=' ',this.currentLine+=s,this.counter++);this.currentLine+=' z',p=this._createLine(),p.setAttribute('data-zvalue',this.data[t].zValue),this.zValues[this.data[t].zValue]={dom:p},this.minZ=Math.min(this.minZ,this.data[t].zValue),this.maxZ=Math.max(this.maxZ,this.data[t].zValue)}for(t++,t=this.currentLine+1;t=this.positiveThreshold||0>=l&&l<=this.negativeThreshold?'block':'none');this._shapeZoom&&(this.options.hasNegative?(this._shapeZoom.setHandleNeg(-s(this.negativeDelta,3),this.minZ),this._shapeZoom.showHandleNeg()):this._shapeZoom.hideHandleNeg(),this._shapeZoom.setHandlePos(s(this.positiveDelta,3),this.maxZ))}setDynamicColor(e){this.lineColors=e,this.styleHasChanged()}setNegative(e){this.options.hasNegative=e,e&&(this.negativeThreshold=0)}setColorTo(e,t,r,a){if(this.lineColors){var s={h:0,s:0,l:0};for(var n in s)s[n]=0{this.group.removeChild(e)}),this._labelsBackground.map((e)=>{this.group.removeChild(e)}),this._labels=[],this._labelsBackground[e]=[];for(var e=0;void 0!==this.getProp('labelText',e);)this._labels[e]||(this._labels[e]=document.createElementNS(this.graph.ns,'text'),this._labels[e].setAttribute('data-label-i',e),this._labels[e].jsGraphIsShape=this,this._labelsBackground[e]=document.createElementNS(this.graph.ns,'rect'),this._labelsBackground[e].setAttribute('data-label-i',e),this._labelsBackground[e].jsGraphIsShape=this,this.group.appendChild(this._labelsBackground[e]),this.group.appendChild(this._labels[e]),this._labels[e].addEventListener('dblclick',(t)=>{t.stopPropagation(),this.labelDblClickListener(t)}),this._labelsBackground[e].addEventListener('dblclick',(t)=>{t.stopPropagation(),this.labelDblClickListener(t)})),e++;return this.updateLabels(),this}isLabelEditable(e){return this.getProp('labelEditable',e||0)}updateLabels(){this._labels=this._labels||[];for(var e=0,t=this._labels.length;e{var s=this,e=document.createElementNS(s.graph.ns,t);if(e.jsGraphIsShape=!0,r)for(var n in r)e.setAttribute(n,r[n]);e.addEventListener('mousedown',(t)=>{s.isResizable()&&(t.preventDefault(),t.stopPropagation(),s.graph.emit('beforeShapeResize',s),this.emit('beforeShapeResize'),!s.graph.prevent(!1)&&(s.resizing=!0,s.handleSelected=i,s.handleMouseDown(t)))}),a&&a(s.handles[i]),s.handles[i]=e}).call(this,s);return this.handles}}createHandles(){this.hasStaticHandles()&&(this.addHandles(),this.setHandles())}handleMouseDownImpl(){}handleMouseMoveImpl(){}handleMouseUpImpl(){}handleCreateImpl(){}handleMouseDown(t){if(!this.isLocked())return(this.isMovable()||this.isResizable())&&this.graph.elementMoving(this),this.getProp('selectOnMouseDown')&&this.graph.selectShape(this),this.isMovable()&&!this.resizing&&(this.graph.emit('beforeShapeMove',self),!this.graph.prevent(!1)&&(this.moving=!0,this.moved=!1)),this._mouseCoords=this.graph._getXY(t),this.handleMouseDownImpl(t,this._mouseCoords)}handleClick(t){return this.graph.emit('shapeClicked',this),this.emit('shapeClicked'),!!this.isSelectable()&&void(!t.shiftKey&&this.graph.unselectShapes(),this.getProp('selectOnClick')&&this.graph.selectShape(this))}handleMouseMove(t){if((this.resizing||this.moving)&&!this.isSelected()&&this.graph.selectShape(this),this.graph.emit('beforeShapeMouseMove',this),this.emit('beforeShapeMouseMove'),this.graph.prevent(!1)||!this._mouseCoords)return!1;this.moved=!0;var e=this.graph._getXY(t),i=this.getXAxis().getRelVal(e.x-this._mouseCoords.x),r=this.getYAxis().getRelVal(e.y-this._mouseCoords.y);(0!=i||0!==r)&&(this.preventUnselect=!0),this._mouseCoords=e;var a=this.handleMouseMoveImpl(t,i,r,e.x-this._mouseCoords.x,e.y-this._mouseCoords.y);return a}handleMouseUp(t){return this.moving&&this.moved&&(this.graph.emit('shapeMoved',this),this.emit('shapeMoved')),(this.handleSelected||this.resize)&&(this.graph.emit('shapeResized',this),this.emit('shapeResized')),this.moving=!1,this.resizing=!1,this.handleSelected=!1,this.graph.elementMoving(!1),this.handleMouseUpImpl(t)}handleDblClick(){}handleMouseOver(){!this.getProp('highlightOnMouseOver')||this.moving||this.resizing||this.highlight(),this.graph.emit('shapeMouseOver',this)}handleMouseOut(){this.getProp('highlightOnMouseOver')&&this.unHighlight(),this.graph.emit('shapeMouseOut',this)}lock(){return this.setProp('locked',!0),this}unlock(){return this.setProp('locked',!1),this}isLocked(){return this.getProp('locked')||this.graph.shapesLocked}movable(){this.setProp('movable',!0)}unmovable(){return this.setProp('movable',!1),!1}isMovable(){return this.getProp('movable')}resizable(){this.setProp('resizable',!0)}unresizable(){this.setProp('resizable',!1)}isResizable(){return this.getProp('resizable')}selectable(){this.setProp('selectable',!0)}unselectable(){this.graph.unselectShape(this),this.setProp('selectable',!1)}isSelectable(){return this.getProp('selectable')}highlight(e,t){return e||(e=this.getHighlightAttributes()),t||(t='highlight'),saveDomAttributes(this._dom,e,t),this.highlightImpl(),this}unHighlight(e){return e||(e='highlight'),restoreDomAttributes(this._dom,e),this.unHighlightImpl(),this}highlightImpl(){}unHighlightImpl(){}getHighlightAttributes(){return this._highlightAttributes}setHighlightAttributes(e){return this._highlightAttributes=e,this}getMaskingID(){return this.maskingId}maskWith(e){const t=e.getMaskingID();t?this._dom.setAttribute('mask','url(#'+t+')'):this._dom.removeAttribute('mask')}updateMask(){var e=Math.min,t=Math.abs}labelDblClickListener(t){var e=parseInt(t.target.getAttribute('data-label-i')),i=this;if(isNaN(e))return;if(!this.isLabelEditable(e))return;t.preventDefault(),t.stopPropagation();var r=document.createElement('input');r.setAttribute('type','text'),r.setAttribute('value',i.getProp('labelText',e)),i.graph.wrapper.prepend(r),r.select(),setCSS(r,{position:'absolute',marginTop:parseInt(t.target.getAttribute('y').replace('px',''))+this.graph.getPaddingTop()-10+'px',marginLeft:parseInt(t.target.getAttribute('x').replace('px',''))+this.graph.getPaddingLeft()-50+'px',textAlign:'center',width:'100px'});const a=i.getLabelText(e),s=function(){i.setLabelText(r.value,e),i._labels[e].textContent=r.value;const t=r.value;r.remove(),r.removeEventListener('blur',s),r=!1,i.changed('shapeLabelChanged',{previousValue:a,nextValue:t})};r.addEventListener('blur',s),r.addEventListener('keyup',function(t){13===t.keyCode&&s()}),r.addEventListener('keypress',function(t){t.stopPropagation()}),r.addEventListener('keydown',function(t){t.stopPropagation()}),r.focus()}appendToDom(){return this._forcedParentDom?this._forcedParentDom.appendChild(this.group):this.graph.appendShapeToDom(this),this}forceParentDom(e){return this._forcedParentDom=e,this}isHTML(){return!1}}Shape.prototype.computePosition=Shape.prototype.calculatePosition,Shape.prototype.showLabel=Shape.prototype.displayLabel,Shape.prototype.remove=Shape.prototype.kill;class ShapeSurfaceUnderCurve extends Shape{createDom(){this._dom=document.createElementNS(this.graph.ns,'path')}createHandles(){this._createHandles(2,'line',{"stroke-width":'3',stroke:'transparent',"pointer-events":'stroke',cursor:'ew-resize'})}handleMouseMoveImpl(t,e){if(!this.isLocked()){if(this.moving)this.getPosition(0).deltaPosition('x',e,this.getXAxis()),this.getPosition(1).deltaPosition('x',e,this.getXAxis());else if(this.serie&&this.handleSelected){this.resizingPosition=1==this.handleSelected?this.getPosition(0):this.getPosition(1);var i=this.serie.searchClosestValue(this.getXAxis().getVal(this.graph._getXY(t).x-this.graph.getPaddingLeft()));if(!i)return;this.resizingPosition.x!=i.xMin&&(this.preventUnselect=!0),this.resizingPosition.x=i.xMin}else this.handleSelected&&(this.resizingPosition=1==this.handleSelected?this.getPosition(0):this.getPosition(1),this.resizingPosition.deltaPosition('x',e,this.getXAxis()));this.applyPosition()}}applyPosition(){var e=Math.min;if(this.serie){var t=this.computePosition(0),r=this.computePosition(1),a=Math.abs(t.x-r.x),s=e(t.x,r.x);if(2>a||0>s+a||s>this.graph.getDrawingWidth())return this.setDom('d',''),!1;var n=this.serie.searchClosestValue(this.getPosition(0).x),o=this.serie.searchClosestValue(this.getPosition(1).x),l=0,p=Number.MAX_VALUE,d,g,i,c,u,h,s,x;if(!n||!o)return!1;for(n.xBeforeIndex>o.xBeforeIndex&&(d=n,n=o,o=d),this.counter=0,g=n.dataIndex;g<=o.dataIndex;g++){for(this.currentLine='',c=g==n.dataIndex?n.xBeforeIndexArr:0,u=g==o.dataIndex?o.xBeforeIndexArr:this.serie.data[g].length,h=0,c==u&&u++,i=c;i<=u;i+=2)s=this.serie.getX(this.serie.data[g][i+0]),x=this.serie.getY(this.serie.data[g][i+1]),l=Math.max(this.serie.data[g][i+1],l),p=e(this.serie.data[g][i+1],p),i==c&&(this.firstX=s,this.firstY=x),this.currentLine+=0this.serie.getXAxis().getCurrentMax()&&c.x>this.serie.getXAxis().getCurrentMax())return this.setDom('d',''),this._domShadow.setAttribute('d',''),this.hideLabel(0),!1;this.showLabel(0);let u=0,h=this.serie.getWaveform(),x;if(!h)return;let m=h.getIndexFromX(g[e],!0,Math.floor),y=h.getIndexFromX(c[e],!0,Math.ceil),b=!1,A;m==y&&('aggregate'==h.getReductionType()?y+=4:y++),y=m:x<=y;x+=w){if(o=h.getX(x,!0),p=h.getY(x,!0),s=this.serie.getX(o),n=this.serie.getY(p),u+=h.getY(x,!0),S||(S=s,k=n,M=h.getX(x),C=h.getY(x)),void 0==v){v=s,_=h.getX(x),P=h.getY(x);continue}v=s,t.push([s,n,u]),_=o}_=!1,P=!1,v=!1,0==u&&(u=1),this._sumVal=h.integrate(g.x,c.x),d=this.ratio?this.ratio*(this.sumVal/u):200/u;let T;if(0!=t.length){for(var E=0,i=t.length;Eu/2&&t[E][2]<=u/2||t[E-1][2]=u/2)){let e=a-(t[E-1][2]+t[E][2])/2*d;this.setPosition({x:t[E][0]+'px',y:e+'px'},3),this.setLabelPosition(this.getPosition(3),0)}r+=' L '+t[E][0]+', '+T+' ',this.lastPointX=t[E][0],this.lastPointY=T}return this.points=t,this._sum=u,r=this.serie.isFlipped()?' M '+a+', '+S+' '+r:' M '+S+', '+a+' '+r,this.firstPointX=S,this.firstPointY=a,this.setDom('d',r),this._domShadow.setAttribute('d',r),this.firstX=S,this.firstY=k,this.serie.ratioLabel&&this.updateIntegralValue(this.serie.ratioLabel)||this.updateLabels(),this.changed(),this.handleCondition=!this.xor(-1==w,b),this.setHandles(),this.updateIntegralValue(),!0}}updateIntegralValue(e=this.serie.ratioLabel,t){return console.log(e),e&&(this.serie.ratioLabel=e),isNaN(t)||isNaN(this.sumVal)||!this.sumVal||(this.serie.ratioLabel=t/this.sumVal),this.setLabelText(e?(Math.round(100*this.sumVal*e)/100).toPrecision(3):'N/A',0),this.updateLabels(),this.serie.ratioLabel}getAxis(){return this._data.axis||'x'}set ratio(e){this._ratio=e}get ratio(){return this._ratio}get sum(){return this._sum}get sumVal(){return this._sumVal}selectStyle(){this.setDom('stroke-width','2px')}selectHandles(){}setHandles(){void 0!=this.points&&this.isSelected()&&(this.addHandles(),this.handleCondition?(this.handles[1].setAttribute('x',this.firstPointX),this.handles[1].setAttribute('y',this.firstPointY),this.handles[2].setAttribute('x',this.lastPointX),this.handles[2].setAttribute('y',this.lastPointY)):(this.handles[2].setAttribute('x',this.firstPointX),this.handles[2].setAttribute('y',this.firstPointY),this.handles[1].setAttribute('x',this.lastPointX),this.handles[1].setAttribute('y',this.lastPointY)))}handleMouseMoveImpl(t,e){if(!this.isLocked()){var i=this.getPosition(0),r=this.getPosition(1),a;return 1==this.handleSelected?a=i:2==this.handleSelected&&(a=r),a&&!this._data.vertical&&a.deltaPosition('x',e,this.getXAxis()),this.moving&&(i.x&&i.deltaPosition('x',e,this.getXAxis()),r.x&&r.deltaPosition('x',e,this.getXAxis())),this.rectEvent&&this.setEventReceptacle(),this.redraw(),this.changed(),!0}}}class ShapeRectangle extends Shape{constructor(e,t){super(e,t)}createDom(){return this._dom=document.createElementNS(this.graph.ns,'rect'),this.getStrokeColor()||this.setStrokeColor('black'),this.getStrokeWidth()||this.setStrokeWidth(1),this.getFillColor()||this.setFillColor('transparent'),this}createHandles(){if(this.hasHandles()){var e=this.getProp('handles');switch('object'!=typeof e&&(e={}),e.type||(e.type='corners'),e.type){case'sides':extend$1(e,{sides:{top:!0,bottom:!0,left:!0,right:!0}});var t=0;for(var r in e.sides)e.sides[r]&&t++;this._createHandles(t,'g').map(function(e){var t=document.createElementNS(self.graph.ns,'rect');t.setAttribute('x','-3'),t.setAttribute('width','6'),t.setAttribute('y','-6'),t.setAttribute('height','12'),t.setAttribute('stroke','black'),t.setAttribute('fill','white'),t.setAttribute('cursor','pointer'),e.appendChild(t)});var t=1;for(var r in e.sides)e.sides[r]&&(this.handles[r]=this['handle'+t],this.sides[t]=r,t++);break;case'corners':this._createHandles(4,'rect',{transform:'translate(-3 -3)',width:6,height:6,stroke:'black',fill:'white'}),this.handles&&(this.handles[2].setAttribute('cursor','nesw-resize'),this.handles[4].setAttribute('cursor','nesw-resize'),this.handles[1].setAttribute('cursor','nwse-resize'),this.handles[3].setAttribute('cursor','nwse-resize'));break;case'seamlessX':this._createHandles(2,'rect',{transform:'translate(-3 -3)',stroke:'transparent',fill:'transparent',width:'20px',cursor:'ew-resize'});}return super.createHandles(),this}}applyPosition(){var e=this.computePosition(0),t=this.computePosition(1),i,r,a,s;return e.xi(a.x-r.x)||i(s.x-r.x)>i(a.x-r.x))&&(s.x=r.x+0.1*(a.x-r.x));break;case 2:a.deltaPosition('x',e,this.getXAxis()),(i(s.x-a.x)>i(a.x-r.x)||i(s.x-r.x)>i(a.x-r.x))&&(s.x=a.x+0.1*(r.x-a.x));break;case 3:if(s.deltaPosition('x',e,this.getXAxis()),i(s.x-a.x)>i(a.x-r.x)||i(s.x-r.x)>i(a.x-r.x))return;}this.setLabelPosition({y:this.getLabelPosition(0).y,x:s.x}),this.updateLabels(),this.redrawLines(),this.setHandles()}}applyPosition(){return this.redrawLines(),!0}}class ShapeHTML extends Shape{constructor(e,t){super(e,t)}createDom(){this._dom=document.createElement('div'),this._dom.setAttribute('style','position: absolute');let e=document.createElement('div');this._dom.appendChild(e),this.div=e}createHandles(){}setHeight(e){this.setProp('height',e)}setWidth(e){this.setProp('width',e)}setContent(e){this.setProp('content',e)}setRenderer(e){this._renderer=e}redraw(){this._renderer?this._renderer(this.div):this.div.innerHTML=this.getProp('content'),super.redraw(...arguments)}applyPosition(){var e=this.calculatePosition(0);if(e&&isNumeric$1(e.x)&&isNumeric$1(e.y))return this._dom.style.left=e.x+'px',this._dom.style.top=e.y+'px',this.currentPosX=e.x,this.currentPosY=e.y,!0}handleMouseMoveImpl(){return!0}setHandles(){}isHTML(){return!0}}class Plugin extends EventEmitter{static default(){return{}}constructor(e){super(...arguments),this.options=Object.assign({},Plugin.default(),this.constructor.default(),e)}init(e){this.graph=e}onMouseDown(){}onMouseUp(){}onMouseMove(){}}class PluginDrag extends Plugin{static default(){return{dragX:!0,dragY:!0,persistanceX:!1,persistanceY:!1}}init(e){this.graph=e,this.time=null,this.totaltime=2e3}onMouseDown(e,t,i){return this._draggingX=t,this._draggingY=i,this._lastDraggingX=this._draggingX,this._lastDraggingY=this._draggingY,this.stopAnimation=!0,this.moved=!1,!0}onMouseMove(e,t,i){var r=t-this._draggingX,a=i-this._draggingY;this.options.dragX&&e._applyToAxes(function(e){e.setCurrentMin(e.getVal(e.getMinPx()-r)),e.setCurrentMax(e.getVal(e.getMaxPx()-r))},!1,!0,!1),this.options.dragY&&e._applyToAxes(function(e){e.setCurrentMin(e.getVal(e.getMinPx()-a)),e.setCurrentMax(e.getVal(e.getMaxPx()-a))},!1,!1,!0),this._lastDraggingX=this._draggingX,this._lastDraggingY=this._draggingY,this._draggingX=t,this._draggingY=i,this.moved=!0,this.time=Date.now(),this.emit('dragging'),e.draw(!0)}onMouseUp(e,t,i){var r=Date.now()-this.time;return t==this._lastDraggingX||i==this._lastDraggingY?void(this.moved&&this.emit('dragged')):(this.speedX=(t-this._lastDraggingX)/r,this.speedY=(i-this._lastDraggingY)/r,isNaN(this.speedX)||isNaN(this.speedY)?void this.emit('dragged'):void(e._applyToAxes(function(e){e._pluginDragMin=e.getCurrentMin(),e._pluginDragMax=e.getCurrentMax()},!1,!0,!0),this.stopAnimation=!1,this.accelerationX=-this.speedX/this.totaltime,this.accelerationY=-this.speedY/this.totaltime,this.options.persistanceX||this.options.persistanceY?this._persistanceMove(e):this.emit('dragged')))}_persistanceMove(e){var t=this;return t.stopAnimation?void t.emit('dragged'):void window.requestAnimationFrame(function(){var i=Date.now()-t.time,r=(0.5*t.accelerationX*i+t.speedX)*i,a=(0.5*t.accelerationY*i+t.speedY)*i;t.options.persistanceX&&e._applyToAxes(function(e){e.setCurrentMin(-e.getRelVal(r)+e._pluginDragMin),e.setCurrentMax(-e.getRelVal(r)+e._pluginDragMax),e.cacheCurrentMin(),e.cacheCurrentMax(),e.cacheInterval()},!1,!0,!1),t.options.persistanceY&&e._applyToAxes(function(e){e.setCurrentMin(-e.getRelVal(a)+e._pluginDragMin),e.setCurrentMax(-e.getRelVal(a)+e._pluginDragMax),e.cacheCurrentMin(),e.cacheCurrentMax(),e.cacheInterval()},!1,!1,!0),e.draw(),i{console.log(this.currentShape),this.currentShape||e.emit('newShape',a,l)})}}}onMouseMove(t,i,r,a){if(this.currentShape){console.log('mv'),this.count++;var e=this.currentShape;this.currentShape=!1,t.selectedSerie&&!e.serie&&e.setSerie(t.selectedSerie),e.resizing=!0,e.options&&e.options.onCreate&&e.options.onCreate.call(e),e.draw(),t.selectShape(e),e.handleMouseDown(this.currentShapeEvent,!0),e.handleSelected=this.options.handleSelected||1,e.handleMouseMove(a,!0)}}onMouseUp(){this.currentShape&&(this.currentShape.kill(),this.currentShape=!1)}}class PluginSelectScatter extends Plugin{constructor(){super(...arguments)}static default(){return{}}init(e){this._path=document.createElementNS(e.ns,'path'),setAttributeTo(this._path,{display:'none',fill:'rgba(0,0,0,0.1)',stroke:'rgba(0,0,0,1)',"shape-rendering":'crispEdges',x:0,y:0,height:0,width:0,d:''}),this.graph=e,e.dom.appendChild(this._path)}setSerie(e){this.serie=e}onMouseDown(e,t,i){this.serie&&(this.path='M '+t+' '+i+' ',this.currentX=t,this.currentY=i,this.xs=[this.serie.getXAxis().getVal(t-e.getPaddingLeft())],this.ys=[this.serie.getYAxis().getVal(i-e.getPaddingTop())],this._path.setAttribute('d',''),this._path.setAttribute('display','block'))}onMouseMove(e,t,i){var r=Math.pow;25e.getY(a)||this.ys[n]>e.getY(a)&&this.ys[s](e.getY(a)-this.ys[n])/(this.ys[s]-this.ys[n])*(this.xs[s]-this.xs[n])+this.xs[n]&&r++;1==r%2?(t.push(a),this.serie.selectPoint(a,!0,'selected')):this.serie.unselectPoint(a)}this.selected=t,this.emit('selectionProcess',t)}onMouseUp(){this._path.setAttribute('display','none'),this.emit('selectionEnd',this.selected)}}class PluginZoom extends Plugin{constructor(){super(...arguments)}static default(){return{axes:'all'}}init(e){this._zoomingGroup=document.createElementNS(e.ns,'g'),this._zoomingSquare=document.createElementNS(e.ns,'rect'),this._zoomingSquare.setAttribute('display','none'),setAttributeTo(this._zoomingSquare,{display:'none',fill:'rgba(171,12,12,0.2)',stroke:'rgba(171,12,12,1)',"shape-rendering":'crispEdges',x:0,y:0,height:0,width:0,"pointer-events":'none'}),this.graph=e,e.groupEvent.appendChild(this._zoomingGroup),this._zoomingGroup.appendChild(this._zoomingSquare)}onMouseDown(t,i,r,a,e){var s=this.options.zoomMode;if(s){switch(this._zoomingMode=s,void 0===i&&(this._backedUpZoomMode=this._zoomingMode,this._zoomingMode='y',i=0),void 0===r&&(this._backedUpZoomMode=this._zoomingMode,this._zoomingMode='x',r=0),this._zoomingXStart=i,this._zoomingYStart=r,this.x1=i-t.getPaddingLeft(),this.y1=r-t.getPaddingTop(),this._zoomingSquare.setAttribute('width',0),this._zoomingSquare.setAttribute('height',0),this._zoomingSquare.setAttribute('display','block'),this._zoomingMode){case'x':this._zoomingSquare.setAttribute('y',t.options.paddingTop),this._zoomingSquare.setAttribute('height',t.getDrawingHeight()-t.shift.bottom);break;case'y':this._zoomingSquare.setAttribute('x',t.options.paddingLeft),this._zoomingSquare.setAttribute('width',t.getDrawingWidth());break;case'forceY2':this.y2=t.getYAxis().getPx(this.options.forcedY)+t.options.paddingTop;}this.options.onZoomStart&&!e&&this.options.onZoomStart(t,i,r,a,e)}}onMouseMove(t,i,r,a,e){var s=Math.min,n=Math.abs;switch(this._zoomingMode){case'xy':this._zoomingSquare.setAttribute('x',s(this._zoomingXStart,i)),this._zoomingSquare.setAttribute('y',s(this._zoomingYStart,r)),this._zoomingSquare.setAttribute('width',n(this._zoomingXStart-i)),this._zoomingSquare.setAttribute('height',n(this._zoomingYStart-r));break;case'forceY2':this._zoomingSquare.setAttribute('y',s(this._zoomingYStart,this.y2)),this._zoomingSquare.setAttribute('height',n(this._zoomingYStart-this.y2)),this._zoomingSquare.setAttribute('x',s(this._zoomingXStart,i)),this._zoomingSquare.setAttribute('width',n(this._zoomingXStart-i));break;case'x':this._zoomingSquare.setAttribute('x',s(this._zoomingXStart,i)),this._zoomingSquare.setAttribute('width',n(this._zoomingXStart-i));break;case'y':this._zoomingSquare.setAttribute('y',s(this._zoomingYStart,r)),this._zoomingSquare.setAttribute('height',n(this._zoomingYStart-r));}this.options.onZoomMove&&!e&&this.options.onZoomMove(t,i,r,a,e)}onMouseUp(t,i,r,a,s){var n=Math.max,o=Math.min,l=this;this.removeZone();var p=i-t.options.paddingLeft,d=r-t.options.paddingTop;if((this.emit('beforeZoom',{graph:t,x:i,y:r,e:a,mute:s}),!t.prevent(!1))&&(0!=i-this._zoomingXStart||'y'==this._zoomingMode)&&(0!=r-this._zoomingYStart||'x'==this._zoomingMode))if(this.options.transition||this.options.smooth){let e=!1,t=!1;('x'==this._zoomingMode||'xy'==this._zoomingMode||'forceY2'==this._zoomingMode)&&(this.fullX=!1,this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=o(e.getVal(p),e.getVal(l.x1)),e._pluginZoomMaxFinal=n(e.getVal(p),e.getVal(l.x1))},!1,!0,!1),e=!0),('y'==this._zoomingMode||'xy'==this._zoomingMode)&&(this.fullY=!1,this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=o(e.getVal(d),e.getVal(l.y1)),e._pluginZoomMaxFinal=n(e.getVal(d),e.getVal(l.y1))},!1,!1,!0),t=!0),'forceY2'==this._zoomingMode&&(this.fullY=!1,this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=o(e.getVal(l.y2),e.getVal(l.y1)),e._pluginZoomMaxFinal=n(e.getVal(l.y2),e.getVal(l.y1))},!1,!1,!0),t=!0),this.transition(e,t,'zoomEnd')}else{switch(this._zoomingMode){case'x':this.fullX=!1,this.toAxes('_doZoom',[p,this.x1],!0,!1);break;case'y':this.fullY=!1,this.toAxes('_doZoom',[d,this.y1],!1,!0);break;case'xy':this.fullX=!1,this.fullY=!1,this.toAxes('_doZoom',[p,this.x1],!0,!1),this.toAxes('_doZoom',[d,this.y1],!1,!0);break;case'forceY2':this.fullX=!1,this.fullY=!1,this.toAxes('_doZoom',[p,this.x1],!0,!1),this.toAxes('_doZoom',[this.y1,this.y2],!1,!0);}t.draw(),this._backedUpZoomMode&&(this._zoomingMode=this._backedUpZoomMode),this.emit('zoomed'),t.pluginYieldActiveState()}}removeZone(){this._zoomingSquare.setAttribute('display','none')}onMouseWheel(t,i,e,r,a){a||(a={}),a.baseline||(a.baseline=0);let s=a.baseline;'mousePosition'==a.baseline&&(s=this.graph.getYAxis().getVal(r),console.log(s));var n='x'==a.direction,o='y'===a.direction;this.toAxes('handleMouseWheel',[t,i,s],n,o),this.graph.drawSeries()}onDblClick(t,i,r,a,s){var n=Math.max,o=Math.min,l=this.graph;if(this.emit('beforeDblClick',{graph:l,x:t,y:i,pref:a,e:r,mute:s}),!l.prevent(!1)){if(this.options.transition||this.options.smooth){var p=!1,d=!1;('xtotal'==a.mode||'total'==a.mode)&&(this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=e.getMinValue()-e.options.axisDataSpacing.min*e.getInterval(),e._pluginZoomMaxFinal=e.getMaxValue()+e.options.axisDataSpacing.max*e.getInterval()},!1,!0,!1),p=!0),('ytotal'==a.mode||'total'==a.mode)&&(this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=e.getMinValue()-e.options.axisDataSpacing.min*e.getInterval(),e._pluginZoomMaxFinal=e.getMaxValue()+e.options.axisDataSpacing.max*e.getInterval()},!1,!1,!0),d=!0);let e,t;return('gradualX'==a.mode||'gradualY'==a.mode||'gradual'==a.mode||'gradualXY'==a.mode)&&(e=!1,t=!1,('gradualX'==a.mode||'gradual'==a.mode||'gradualXY'==a.mode)&&(e=!0,p=!0),('gradualY'==a.mode||'gradual'==a.mode||'gradualXY'==a.mode)&&(t=!0,d=!0),this.toAxes(function(e){e._pluginZoomMin=e.getCurrentMin(),e._pluginZoomMax=e.getCurrentMax(),e._pluginZoomMinFinal=e.getCurrentMin()-(e.getCurrentMax()-e.getCurrentMin()),e._pluginZoomMaxFinal=e.getCurrentMax()+(e.getCurrentMax()-e.getCurrentMin())},!1,e,t)),void this.transition(p,d,'dblClick')}var g=this.graph.getXAxis(),c=this.graph.getYAxis();if('xtotal'==a.mode)this.toAxes('setMinMaxToFitSeries',null,!0,!1),this.fullX=!0,this.fullY=!1;else if('ytotal'==a.mode)this.toAxes('setMinMaxToFitSeries',null,!1,!0),this.fullX=!1,this.fullY=!0;else if('total'==a.mode)this.toAxes('setMinMaxToFitSeries',null,!0,!0),this.fullX=!0,this.fullY=!0;else{t-=this.graph.options.paddingLeft,i-=this.graph.options.paddingTop;var u=g.getCurrentMin(),h=g.getCurrentMax(),m=g.getVal(t),b=h-u,A=c.getCurrentMin(),f=c.getCurrentMax(),S=c.getVal(i),k=f-A;if('gradualXY'==a.mode||'gradualX'==a.mode){var M=(m-u)/(h-u);u=n(g.getMinValue()-g.getInterval()*g.options.axisDataSpacing.min,u-b*M),h=o(g.getMaxValue()+g.getInterval()*g.options.axisDataSpacing.max,h+b*(1-M)),g.setCurrentMin(u),g.setCurrentMax(h),g.options.onZoom&&g.options.onZoom(u,h),g.cacheCurrentMin(),g.cacheCurrentMax(),g.cacheInterval()}if('gradualXY'==a.mode||'gradualY'==a.mode){var M=(S-A)/(f-A);A=n(c.getMinValue()-c.getInterval()*c.options.axisDataSpacing.min,A-k*M),f=o(c.getMaxValue()+c.getInterval()*c.options.axisDataSpacing.max,f+k*(1-M)),c.setCurrentMin(A),c.setCurrentMax(f),c.options.onZoom&&c.options.onZoom(A,f),c.cacheCurrentMin(),c.cacheCurrentMax(),c.cacheInterval()}}l.pluginYieldActiveState(),this.graph.draw()}}transition(e,t,i){var r=this,a=500;r.gradualUnzoomStart||(r.gradualUnzoomStart=Date.now()),window.requestAnimationFrame(function(){var s=Date.now()-r.gradualUnzoomStart;s>a&&(s=a);var n=Math.sin(s/a*Math.PI/2);r.toAxes(function(e){e.setCurrentMin(e._pluginZoomMin+(e._pluginZoomMinFinal-e._pluginZoomMin)*n),e.setCurrentMax(e._pluginZoomMax+(e._pluginZoomMaxFinal-e._pluginZoomMax)*n),e.cacheCurrentMin(),e.cacheCurrentMax(),e.cacheInterval()},!1,e,t),r.graph.draw(),s{this.series.forEach(function(t){this.updateSerie(t,e)}),e||this.recalculateSeries(t)}}static default(){return{LRUName:'PluginTimeSerieManager',intervals:[1000,15000,60000,900000,3600000,8640000],maxParallelRequests:3,optimalPxPerPoint:2,nbPoints:1e3,url:''}}init(e){this.graph=e,get.create(this.options.LRUName,200),this.requestsRunning=0}setURL(e){return this.options.url=e,this}setAvailableIntervals(){this.options.intervals=arguments}newSerie(e,t,i,r,a){var n=this.graph.newSerie(e,t,i);return this.currentSlots[e]={min:0,max:0,interval:0},n.on('hide',function(){n._zoneSerie&&n._zoneSerie.hide()}),n.on('show',function(){n._zoneSerie&&n._zoneSerie.show()}),n.setInfo('timeSerieManagerDBElements',r),a||(n._zoneSerie=this.graph.newSerie(e+'_zone',{},Graph$1.SERIE_ZONE)),this.series.push(n),n}registerPlugin(e){var t;if(-1<(t=this.plugins.indexOf(e)))for(var r=1;rDate.now());)r.register(e,p,l,l==n?a[1]:a[2],!0,t),p++})}this.processRequests()}cleanRegister(e){this.requestLevels&&this.requestLevels.forEach((t)=>{t.forEach((i,r)=>{i[4]Date.now()&&o.timeout=this.options.maxParallelRequests)){for(var e=this,t=1,r;;){for(var a in this.requestLevels[t])if(1!=this.requestLevels[t][a][0]){r=this.requestLevels[t][a];break}if(r)break;if(t++,10',e[2]).replace('',this.computeTimeMin(e[3],e[4])).replace('',this.computeTimeMax(e[3],e[4])).replace('',e[4]),r=e[6]||{};for(var a in r)t=t.replace('<'+a+'>',r[a]);return t}getOptimalInterval(e){var t=(this.options.optimalPxPerPoint||1)*e/this.graph.getDrawingWidth(),i=Infinity,r;return this.options.intervals.forEach(function(e){var a=Math.min(i,Math.abs(e-t));i!==a&&(r=e,i=a)}),r||1e3}computeUniqueID(e,t,r){var a='',s=e.getInfo('timeSerieManagerDBElements');for(var n in s)a+=';'+n+':'+s[n];return e.getName()+';'+t+';'+r+a}computeSlotID(e,t){return Math.floor(e/(t*this.options.nbPoints))}computeSlotTime(e,t){return e*(t*this.options.nbPoints)}getZoneSerie(e){return e._zoneSerie}updateZoneSerie(e){var t=this.graph.getSerie(e);t&&t._zoneSerie&&(t._zoneSerie.setXAxis(t.getXAxis()),t._zoneSerie.setYAxis(t.getYAxis()),t._zoneSerie.setFillColor(t.getLineColor()),t._zoneSerie.setLineColor(t.getLineColor()),t._zoneSerie.setFillOpacity(0.2),t._zoneSerie.setLineOpacity(0.3))}recalculateSeries(e){var t=this;this.locked||(this.changed=!1,this.series.map(function(i){t.recalculateSerie(i,e)}),this.changed=!1,t.graph.draw())}recalculateSerie(e,t){var i=e.getXAxis().getCurrentMin(),r=e.getXAxis().getCurrentMax(),a=this.getOptimalInterval(r-i),s=this.computeSlotID(i,a),n=this.computeSlotID(r,a),o=[],l=[];if(!(!t&&a==this.currentSlots[e.getName()].interval&&this.currentSlots[e.getName()].min<=s&&this.currentSlots[e.getName()].max>=n)){s-=2,n+=2,this.currentSlots[e.getName()].min=s,this.currentSlots[e.getName()].max=n,this.currentSlots[e.getName()].interval=a;for(var p=s;p<=n;){const t=get.get(this.options.LRUName,this.computeUniqueID(e,p,a));t?(o=o.concat(t.data.mean),l=l.concat(t.data.minmax)):this.recalculateSerieUpwards(e,p,a,o,l),p++}this.changed=!0,e.setData(o),e._zoneSerie&&e._zoneSerie.setData(l)}}setIntervalCheck(e){this.interval&&clearInterval(this.interval),this.update(!0,!0),this.interval=setInterval(()=>{this.update(!0,!1)},e)}recalculateSerieUpwards(e,t,r,a,s){var n=this.options.intervals.slice(0);n.sort();var o=n[n.indexOf(r)+1]||-1;if(0>o)return[];var p=this.computeSlotTime(t,r),d=this.computeSlotTime(t+1,r),g=this.computeSlotID(p,o),c=!1;const u=get.get(this.options.LRUName,this.computeUniqueID(e,g,o));if(u)for(var h=0,i=u.data.mean.length;h=d)return a=a.concat(u.data.mean.slice(c,h)),void(s=a.concat(u.data.minmax.slice(c,h)))}return this.recalculateSerieUpwards(e,g,o,a,s)}lockRedraw(){this.locked=!0}unlockRedraw(){this.locked=!1}isRedrawLocked(){return!!this.locked}}class PluginSerieLineDifference extends Plugin{constructor(){super(...arguments)}static default(){return{positiveStyle:{fillColor:'green',fillOpacity:0.2,strokeWidth:0},negativeStyle:{fillColor:'red',fillOpacity:0.2,strokeWidth:0},from:0,to:0}}init(e){this.graph=e,this.pathsPositive=[],this.pathsNegative=[],this.positivePolyline=this.graph.newShape('polyline').draw(),this.positivePolyline.setFillColor(this.options.positiveStyle.fillColor).setFillOpacity(this.options.positiveStyle.fillOpacity).setStrokeWidth(this.options.positiveStyle.strokeWidth).applyStyle(),this.negativePolyline=this.graph.newShape('polyline').draw(),this.negativePolyline.setFillColor(this.options.negativeStyle.fillColor).setFillOpacity(this.options.negativeStyle.fillOpacity).setStrokeWidth(this.options.negativeStyle.strokeWidth).applyStyle()}setSeries(e,t){this.serie1=e,this.serie2=t}setBoundaries(e,t){this.options.from=e,this.options.to=t}getFrom(){return this.options.from}getTo(){return this.options.to}draw(){function e(){!0===y?a.pathsPositive.push([s,n]):!1===y&&a.pathsNegative.push([s,n]),s=[],n=[],y=void 0}function t(e,t){for(var s=0;sthis.getTo()){c=this.interpolate(this.serie1,this.getTo()),u=this.interpolate(this.serie2,this.getTo()),h=this.computeCrossing(s[s.length-2],s[s.length-1],this.getTo(),c,n[n.length-2],n[n.length-1],this.getTo(),u),h&&(s.push(h.x),s.push(h.y),n.push(h.x),n.push(h.y),e(),s.push(h.x),s.push(h.y),n.push(h.x),n.push(h.y),y=this.serie1.data[o][l+1]>this.serie2.data[p][g+1]),s.push(this.getTo()),s.push(c),n.push(this.getTo()),n.push(u),b=!0;break}if(!m)if(m=this.serie2.searchClosestValue(this.serie1.data[o][l]),m)p=m.dataIndex,g=2*m.xBeforeIndex,c=this.interpolate(this.serie2,this.serie1.data[o][l]),s.push(this.serie1.data[o][l]),s.push(this.serie1.data[o][l+1]),n.push(this.serie1.data[o][l]),n.push(c),y=this.serie1.data[o][l+1]>c;else continue;for(x=!1,h=this.computeCrossing(s[s.length-2],s[s.length-1],this.serie1.data[o][l],this.serie1.data[o][l+1],n[n.length-2],n[n.length-1],this.serie2.data[p][g],this.serie2.data[p][g+1]),h&&(s.push(h.x),s.push(h.y),n.push(h.x),n.push(h.y),e(),s.push(h.x),s.push(h.y),n.push(h.x),n.push(h.y),y=this.serie1.data[o][l+1]>this.serie2.data[p][g+1]);this.serie2.data[p][g]this.serie2.data[p][g+1])}!1===x?(s.push(this.serie1.data[o][l]),s.push(this.serie1.data[o][l+1])):(s.push(x),s.push(this.interpolate(this.serie1,x)),m=!1,l-=2,e())}if(b){e();break}c=this.interpolate(this.serie2,s[s.length-2]),c&&(n.push(s[s.length-2]),n.push(c)),e(),l=0,m=!1}var A=this.pathsPositive.reduce(t,'');this.positivePolyline.setPointsPx(A).redraw();var A=this.pathsNegative.reduce(t,'');this.negativePolyline.setPointsPx(A).redraw()}interpolate(e,t){var i=e.searchClosestValue(t);if(!i)return!1;if(void 0==i.xMax)return i.yMin;if(void 0==i.xMin)return i.yMax;var r=(t-i.xMin)/(i.xMax-i.xMin);return(1-r)*i.yMin+r*i.yMax}computeCrossing(e,t,i,r,a,s,n,o){var l=(r-t)/(i-e),p=(o-s)/(n-a),d=r-l*i;if(e==i||a==n)return!1;if(l==p)return{x:e,y1:t,y2:t};var g=(d-(o-p*n))/(p-l);return g>i||gn?!1:{x:g,y:l*g+d}}getPositivePolyline(){return this.positivePolyline}getNegativePolyline(){return this.negativePolyline}}class SerieLineExtended extends SerieLine{constructor(){super(...arguments),this.subSeries=[]}setData(){return super.setData(...arguments),this.subSeries.map((e)=>{e.data=this.data}),this}draw(){return this.eraseMarkers(),this}getSymbolForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getSymbolForLegend()}getMarkerForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getMarkerForLegend()}}class SerieScatterExtended extends SerieScatter{constructor(){super(...arguments),this.subSeries=[]}setData(){return super.setData(...arguments),this.subSeries.map((e)=>{e.data=this.data}),this}draw(){return this}getSymbolForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getSymbolForLegend()}getMarkerForLegend(){return!!this.subSeries[0]&&this.subSeries[0].getMarkerForLegend()}}var excludingMethods=['constructor','init','draw','setLineColor','setLineWidth','setLineStyle','getLineColor','getLineWidth','getLineStyle','setMarkers','showMarkers','hideMarkers','getMarkerDom','getMarkerDomIndependant','getMarkerPath','eraseMarkers','_recalculateMarkerPoints'],addMethods=[];Object.getOwnPropertyNames(SerieLine.prototype).concat(addMethods).map(function(e){-1{i[e](...t)})}}(e))});class PluginAxisSplitting extends Plugin{constructor(){super(...arguments),this.series=new Map}static defaults(){return{axes:{margins:{high:5,low:5}}}}init(e){this.graph=e}newXAxis(e){return this.newBottomAxis(e)}newYAxis(e){return this.newLeftAxis(e)}newTopAxis(e){return e=this.getOptions(e),new SplitXAxis(this.graph,'top',e)}newBottomAxis(e){return e=this.getOptions(e),new SplitXAxis(this.graph,'bottom',e)}newLeftAxis(e){return e=this.getOptions(e),new SplitYAxis(this.graph,'left',e)}newRightAxis(e){return e=this.getOptions(e),new SplitYAxis(this.graph,'right',e)}getOptions(e){var t={marginMin:this.options.axes.margins.low,marginMax:this.options.axes.margins.high};return extend$1(!0,t,e)}preDraw(){var e,t;this.series.forEach(({serie:i})=>{e=i.getXAxis(),t=i.getYAxis();let r=1;for(e.splitNumber&&(r*=e.splitNumber),t.splitNumber&&(r*=t.splitNumber);i.subSeries.lengthr;){let e=this.graph.getSerie(i.getName()+'_'+(i.subSeries.length-1));e&&e.kill&&e.kill(),i.subSeries.pop()}!i.getXAxis().splitNumber&&i.getXAxis().splitAxis&&i.getXAxis().splitAxis(),!i.getYAxis().splitNumber&&i.getYAxis().splitAxis&&i.getYAxis().splitAxis(),i.subSeries.map((t,r)=>{var a,s;if(i.getXAxis().getSubAxis){let t=r%(e.splitNumber||1);a=i.getXAxis().getSubAxis(t)}else a=i.getXAxis();if(t.setXAxis(a),i.getYAxis().getSubAxis){let t=Math.floor(r/(e.splitNumber||1));s=i.getYAxis().getSubAxis(t)}else s=i.getYAxis();t.setYAxis(s),t.draw(!0)})})}newSerie(e,t={},i){switch(i){case'line':return this.newLineSerie(e,t);break;case'scatter':return this.newScatterSerie(e,t);}throw'Cannot create a split serie of type '+i}newLineSerie(e,t){var i={type:'lineSerie',serie:new SerieLineExtended(e,t,'line')};return this.series.set(e,i),i.serie.init(this.graph,e,t),this.graph.series.push(i.serie),i.serie}newScatterSerie(e,t){var i={type:'scatterSerie',serie:new SerieScatterExtended(e,t,'scatter')};return this.series.set(e,i),i.serie.init(this.graph,t),this.graph.series.push(i.serie),i.serie}}var defaultAxisConstructorOptions={splitMarks:!0},SplitAxis=function(e){var t=Math.max,i=class extends e{constructor(e,t,i={}){super(e,t,i),this.axes=[],this.position=t,this.constructorOptions=extend$1(!0,{},defaultAxisConstructorOptions,i),this._splitVal=[]}all(e){if('function'==typeof e)return this.axes.map(e),this}splitAxis(...e){e.push(1);let t=e.length;for(;this.axes.length>t;)this.axes.pop().kill(!0,!0);for(;this.axes.lengththis._splitVal.length)&&(super.setMinMaxToFitSeries(...arguments),this._splitVal[0]=this._splitVal[0]||[],this._splitVal[this._splitVal.length-1]=this._splitVal[this._splitVal.length-1]||[],this._splitVal[0][0]=this.getCurrentMin(),this._splitVal[this._splitVal.length-1][1]=this.getCurrentMax(),this.setChunkBoundaries(this._splitVal))}draw(){this.autoSpread&&this._splitSpread();let e=0,i,r,a;if(0<=this._baseWidthIndex&&(r=this.getSubAxis(this._baseWidthIndex))&&(a=r.getSpan()),r=void 0,0<=this.fixGridFor&&(r=this.getSubAxis(this.fixGridFor))){if(void 0!==r._mean){let e=(r.getSpan()[1]-r.getSpan()[0])/(a[1]-a[0])*this._baseWidthVal;r.forceMin(r._mean-e/2),r.forceMax(r._mean+e/2)}e=r.draw(),i=r.getPrimaryTickUnit()}return this.axes.map((s)=>{if(r!==s){if(void 0!==s._mean){let e=(s.getSpan()[1]-s.getSpan()[0])/(a[1]-a[0])*this._baseWidthVal;s.forceMin(s._mean-e/2),s.forceMax(s._mean+e/2)}i&&s.forcePrimaryTickUnit(i),e=t(e,s.draw())}}),this.writeUnit(),e}setMinPx(e){super.setMinPx(e);for(let t of this.axes)t.setMinPx(e)}setMaxPx(e){super.setMaxPx(e);for(let t of this.axes)t.setMaxPx(e)}setShift(){super.setShift(...arguments);for(let e of this.axes)e.setShift(...arguments)}init(){super.init(...arguments),this.splitAxis()}getAxisPosition(){var e=0;return this.axes.map((i)=>{e=t(e,i.getAxisPosition())}),e}getSubAxis(e){if(this.axes.length<=e)throw'Impossible to reach axis. Index '+e+' is out of range';return this.axes[e]}get splitNumber(){return this._splits.length}};return['turnGridsOff','turnGridsOn','gridsOff','gridsOn','setEngineering','setScientificScaleExponent','setScientific','setLabelColor','setSecondaryGridDasharray','setPrimaryGridDasharray','setSecondaryGridsOpacity','setPrimaryGridOpacity','setSecondaryGridWidth','setPrimaryGridWidth','setSecondaryGridColor','setPrimaryGridColor','setTicksLabelColor','setSecondaryTicksColor','setPrimaryTicksColor','setAxisColor','secondaryGridOn','secondaryGridOff','primaryGridOff','primaryGridOn','setSecondaryGrid','setPrimaryGrid','setGrids','setTickPosition','setExponentialFactor','setExponentialLabelFactor','setGridLinesStyle','forcePrimaryTickUnitMin','forcePrimaryTickUnitMax','forcePrimaryTickUnit','flip','show','hide','setDisplay'].map((e)=>{i.prototype[e]=function(e){return function(){return this.axes.map((t)=>{t[e](...arguments)}),this}}(e)}),i};class SplitXAxis extends SplitAxis(AxisX){constructor(e,t){super(...arguments),this.topbottom=t}getConstructor(){return AxisX}getAxisPosition(){var e=super.getAxisPosition(...arguments);return this.labelPosY=e,this.getLabel()&&(e+=this.graph.options.fontSize),e}drawLabel(){super.drawLabel(),this.label.setAttribute('y',(this.top?-1:1)*(this.graph.options.fontSize+this.labelPosY))}draw(){var e=super.draw(...arguments);return this.drawLabel(),e}}class SplitYAxis extends SplitAxis(AxisY){constructor(){super(...arguments)}getConstructor(){return AxisY}drawLabel(){super.drawLabel()}equalizePosition(e){var t=e;if(this.getLabel()&&this.axes.map((i)=>{t=Math.max(i.equalizePosition(e),t)}),this.getLabel())return this.placeLabel(this.left?-t:t),t+this.graph.options.fontSize}}mix(SplitXAxis,new AxisX),mix(SplitYAxis,new AxisY);class PluginMakeTracesDifferent extends Plugin{constructor(){super(...arguments)}init(e,t){super.init(e,t)}static default(){return{}}checkHSL(e){let t={},i,r,a;return(i=e.h||e.hue)?(1>i&&(i=Math.round(360*i)),t.hue=i):t.h=0,(r=e.s||e.saturation)?(1{if(!t.setLineColor)throw'The serie '+t.getName()+' does not implement the method `startingColor`';const a=this.buildHSLString({h:e.startingColorHSL.h+r/(i-1)*(e.endingColorHSL.h-e.startingColorHSL.h),s:e.startingColorHSL.s+r/(i-1)*(e.endingColorHSL.s-e.startingColorHSL.s),l:e.startingColorHSL.l+r/(i-1)*(e.endingColorHSL.l-e.startingColorHSL.l)});return t.setLineColor(a),a})}}class PluginPeakPicking extends Plugin{constructor(){super(...arguments)}static default(){return{autoPeakPicking:!1,autoPeakPickingNb:4,autoPeakPickingMinDistance:10,autoPeakPickingFormat:!1,autoPeakPickingAllowAllY:!1}}init(e,t){super.init(e,t),this.picks=[];for(var i=0,r=this.options.autoPeakPickingNb,a;i{e.kill()})}preDraw(){this.serie&&(this.detectedPeaks=[],this.lastYPeakPicking=!1)}postDraw(){if(!this.serie)return;let e=!0,t=!1,r=[],a=this.serie.getWaveform(),s;if(!a)throw'The serie must have a waveform for the peak picking to work';let n=a.getLength(),o=0,i;for(;o=s[1]&&e||i<=s[1]&&t?s=[a.getX(o),i]:(is[1]&&t)&&(t?(t=!1,e=!0):(t=!0,e=!1,r.push(s),s=!1),s=[a.getX(o),i])}var p=r,d=[],g=p.length,l,c,c,u,h,m;o=0;var y=this.graph.selectedShapes.map(function(e){return e.getProp('xval')});for(p.sort(function(e,t){return t[1]-e[1]}),h=0;othis.serie.getXAxis().getMaxPx()))&&!(!this.options.autoPeakPickingAllowAllY&&(i>this.serie.getYAxis().getMinPx()||ithis.serie.getYAxis().getPx(p[o][1])-20?(this.picks[h].setLabelPosition({x:l,y:'5px'}),this.picks[h].setLabelBaseline('hanging')):(this.picks[h].setLabelBaseline('no-change'),this.picks[h].setLabelPosition({x:l,y:p[o][1],dy:'-15px'})),this.picks[h].setProp('xval',l),this.options.autoPeakPickingFormat?this.picks[h].setLabelText(this.options.autoPeakPickingFormat.call(this.picks[h],l,h)):this.picks[h].setLabelText(Math.round(1e3*l)/1e3+''),this.picks[h].makeLabels(),h++;this.picks[h]&&this.picks[h].isSelected();)h++;if(d.length==this.options.autoPeakPickingNb)break}}}hidePeakPicking(e){if(this._hidePeakPickingLocked||(this._hidePeakPickingLocked=e),!!this.graph.picks)for(var t=0;t -1) {\n return parseInt(px.replace('px', ''));\n }\n return false;\n}\n\nfunction isNumeric(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n}\n\n/**\n * Utility class to compute positioning\n * @class\n */\nclass Position {\n\n constructor(x, y, dx, dy) {\n\n if (typeof x == 'object') {\n this.x = x.x;\n this.y = x.y;\n this.dx = x.dx;\n this.dy = x.dy;\n } else {\n this.x = x;\n this.y = y;\n this.dx = dx;\n this.dy = dy;\n }\n }\n\n duplicate() {\n return new Position(this.x, this.y, this.dx, this.dy);\n }\n\n /**\n * Computes the position of the position\n * @param {Graph} graph - The graph for which the position has to be computed\n * @param {AxisX} xAxis - The x axis to consider (has to belong to the graph)\n * @param {AxisY} yAxis - The y axis to consider (has to belong to the graph)\n * @param {Serie} [serie] - For non-existing y value, use a serie to compute it automatically from the serie data\n * @return {Object} An object in the format ```{x: xPx, y: yPx}``` containing the position in pixels of the position\n */\n compute(graph, xAxis, yAxis, serie) {\n\n if (!graph || !xAxis || !yAxis || !graph.hasXAxis || !graph.hasYAxis) {\n graph.throw();\n }\n\n if (!graph.hasXAxis(xAxis)) {\n throw 'Graph does not contain the x axis that was used as a parameter';\n }\n\n if (!graph.hasYAxis(yAxis)) {\n throw 'Graph does not contain the x axis that was used as a parameter';\n }\n\n return this._compute(graph, xAxis, yAxis, serie);\n }\n\n _compute(graph, xAxis, yAxis, serie) {\n\n var relativeTo = this._relativeTo;\n if (relativeTo) {\n var relativeToComputed = relativeTo._compute(graph, xAxis, yAxis, serie);\n }\n\n var parsed,\n pos = {\n x: false,\n y: false\n };\n\n if (!xAxis) {\n xAxis = graph.getXAxis();\n }\n\n if (!yAxis) {\n yAxis = graph.getYAxis();\n }\n\n for (var i in pos) {\n\n var axis = i == 'x' ? xAxis : yAxis;\n var val = this[i];\n var dval = this['d' + i];\n\n if (val === undefined && (dval !== undefined && relativeTo === undefined || relativeTo === undefined)) {\n\n if (i == 'x') {\n\n if (dval === undefined) {\n continue;\n }\n\n pos[i] = relativeTo ? relativeTo[i] : 0;\n } else if (this.x !== undefined && serie) {\n\n if (_parsePx(this.x) !== false) {\n console.warn('You have defined x in px and not y. Makes no sense. Returning 0 for y');\n pos[i] = 0;\n } else {\n\n var closest = serie.searchClosestValue(this.x);\n\n if (!closest) {\n console.warn('Could not find y position for x = ' + this.x + ' on serie \"' + serie.getName() + '\". Returning 0 for y.');\n pos[i] = 0;\n } else {\n pos[i] = serie.getY(closest.yMin);\n }\n }\n }\n } else if (val !== undefined) {\n\n pos[i] = this.getPx(val, axis);\n }\n\n if (dval !== undefined) {\n\n var def = val !== undefined || relativeToComputed == undefined || relativeToComputed[i] == undefined ? pos[i] : relativeToComputed[i];\n\n if (i == 'y' && relativeToComputed && relativeToComputed.x !== undefined && relativeToComputed.y == undefined) {\n\n if (!serie) {\n throw 'Error. No serie exists. Cannot find y value';\n return;\n }\n\n var closest = serie.searchClosestValue(relativeTo.x);\n if (closest) {\n def = serie.getY(closest.yMin);\n }\n\n //console.log( relativeTo.x, closest, serie.getY( closest.yMin ), def );\n }\n\n if (!def) {\n def = 0;\n }\n\n if ((parsed = _parsePx(dval)) !== false) {\n // dx in px => val + 10px\n\n pos[i] = def + parsed; // return integer (will be interpreted as px)\n } else if ((parsed = this._parsePercent(dval)) !== false) {\n\n pos[i] = def + this._getPositionPx(parsed, true, axis, graph); // returns xx%\n } else if (axis) {\n\n pos[i] = def + axis.getRelPx(dval); // px + unittopx\n }\n }\n }\n\n return pos;\n }\n\n _getPositionPx(value, x, axis, graph) {\n\n var parsed;\n\n if ((parsed = _parsePx(value)) !== false) {\n return parsed; // return integer (will be interpreted as px)\n }\n\n if ((parsed = this._parsePercent(value)) !== false) {\n return parsed / 100 * (x ? graph.getDrawingWidth() : graph.getDrawingHeight());\n } else if (axis) {\n return axis.getPos(value);\n }\n }\n\n _parsePercent(percent) {\n if (percent && percent.indexOf && percent.indexOf('%') > -1) {\n return percent;\n }\n return false;\n }\n\n /**\n * Computes the value in pixels of an amplitude (or a distance) for a certain axis\n * @param {Number} value - The value in axis unit\n * @param {Axis} Axis - The x axis to consider (has to belong to the graph)\n * @return {String} The value in pixels, e.g. \"20px\"\n */\n getDeltaPx(value, axis) {\n var v;\n if ((v = _parsePx(value)) !== false) {\n return v + 'px';\n } else {\n\n return axis.getRelPx(value) + 'px';\n }\n }\n\n deltaPosition(mode, delta, axis) {\n\n mode = mode == 'y' ? 'y' : 'x';\n var ref = this[mode],\n refd = this['d' + mode],\n refPx,\n deltaPx;\n\n if (ref !== undefined) {\n if ((refPx = _parsePx(ref)) !== false) {\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this[mode] = refPx + deltaPx + 'px';\n } else {\n this[mode] = refPx + axis.getRelPx(delta) + 'px';\n }\n } else {\n\n ref = this.getValPosition(ref, axis);\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this[mode] = ref + axis.getRelVal(deltaPx);\n } else {\n this[mode] = ref + delta;\n }\n }\n } else if (refd !== undefined) {\n\n if (mode == 'y' && ref === undefined && !this._relativeTo) {\n // This means that the shape is placed by the x value. Therefore, the dy is only a stand-off.\n // Therefore, we do nothing\n return;\n }\n\n if ((refPx = _parsePx(refd)) !== false) {\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this['d' + mode] = refPx + deltaPx + 'px';\n } else {\n this['d' + mode] = refPx + axis.getRelPx(delta) + 'px';\n }\n } else {\n\n refd = this.getValPosition(refd, axis);\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this['d' + mode] = refd + axis.getRelVal(deltaPx);\n } else {\n this['d' + mode] = refd + delta;\n }\n }\n }\n }\n\n getValPosition(rel, axis) {\n\n if (rel == 'max') {\n return axis.getMaxValue();\n }\n\n if (rel == 'min') {\n return axis.getMinValue();\n }\n\n return rel;\n }\n\n /**\n * Computes a value in pixels\n * @param {Number} value - The value in axis unit\n * @param {Axis} axis - The x or y axis to consider (has to belong to the graph)\n * @param {Boolean} rel - Whether or not the value is a distance\n * @return {(Number|String)} The computed value\n */\n getPx(value, axis, rel) {\n\n var parsed;\n\n if (typeof value == 'function') {\n\n return value(axis, rel);\n } else if ((parsed = _parsePx(value)) !== false) {\n\n return parsed; // return integer (will be interpreted as px)\n } else if ((parsed = this._parsePercent(value)) !== false) {\n\n return parsed; // returns xx%\n } else if (axis) {\n\n if (value == 'min') {\n\n return axis.getMinPx();\n } else if (value == 'max') {\n\n return axis.getMaxPx();\n } else if (rel) {\n\n return axis.getRelPx(value);\n } else if (isNumeric(value)) {\n\n return axis.getPos(value);\n }\n }\n }\n\n getPxRel(value, axis) {\n return this.getPx(value, axis, true);\n }\n\n /**\n * Assigns the current position as relative to another. This is used when a position is used with \"dx\" or \"dy\" and not \"x\" or \"y\"\n * @param {Position} pos - The reference position\n * @return {Position} The current position\n */\n relativeTo(pos) {\n this._relativeTo = Position.check(pos);\n return this;\n }\n\n /**\n * Checks if an object is a position. If not, creates a new Position instance with the ```pos``` object. If a new position is created, ```callback``` is fired with the position as a unique parameter. The return of the function, if not false, should be a ```Position``` instance which serves as the reference position.\n * @example Position.check( { x: 1, y: 2 }, function() { return someOtherPosition; } );\n * @param {(Object|Position)} pos - The position object or the object fed into the constructor\n * @param {Function} callback - The callback fired if a new position is created\n * @return {Position} The resulting position object\n */\n static check(pos, callback) {\n if (pos instanceof Position) {\n return pos;\n }\n\n var posObject = new Position(pos);\n\n if (pos && pos.relativeTo) {\n const position = callback(pos.relativeTo);\n if (position) {\n posObject.relativeTo(position);\n }\n }\n\n return posObject;\n }\n}\n\n/**\n * Easy set attribute method to apply to a SVG Element the attributes listed. Optional namespacing\n * @param {SVGElement} to - The SVG element to apply the attributes to\n * @param {Object} attr - A key/value hashmap of attributes\n * @param {String} [ ns = undefined ] - The namespace to use (with setAttributeNS). Default if without namespacing\n */\nfunction setAttributeTo(to, params, ns) {\n var i;\n\n if (ns) {\n for (i in params) {\n to.setAttributeNS(ns, i, params[i]);\n }\n } else {\n for (i in params) {\n to.setAttribute(i, params[i]);\n }\n }\n}\n\n/**\n * Maps old-style events defined within the creation (i.e. { onMouseOver: function() }) to modern event listening .on(\"mouseover\")\n * The function will read any object and select the ones starting with \"on\"\n * @params {Object} options - An option object to read the events from\n * @param {Object} source - The source object to which the options belong\n * @example util.mapEventEmission( this.options, this );\n */\nfunction mapEventEmission(options, source) {\n\n if (!source) {\n source = this;\n }\n\n var eventName;\n\n for (var i in options) {\n\n // Starts with onXXX\n if (i.indexOf('on') == 0 && typeof options[i] == 'function') {\n eventName = i.substring(2);\n eventName = eventName.substring(0, 1).toLowerCase() + eventName.substring(1);\n\n if (source.on) {\n\n (function (j) {\n\n source.on(eventName, function () {\n options[j].apply(source, arguments);\n });\n })(i);\n }\n }\n }\n}\n\n/**\n * @link http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript\n * @return {String} a random id\n */\nfunction guid() {\n //\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0,\n v = c == 'x' ? r : r & 0x3 | 0x8;\n return v.toString(16);\n });\n}\n\nfunction throwError(message) {\n console.error(message);\n}\n\nfunction warn(message) {\n console.warn(message);\n}\n\n/**\n * Checks if a variable is a numeric or not\n * @return {Boolean} true for a numeric value, false otherwise\n */\nfunction isNumeric$1(obj) {\n return !Array.isArray(obj) && obj - parseFloat(obj) + 1 >= 0;\n}\n\n/**\n * @see http://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion\n * Converts an HSL color value to RGB. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSL_color_space.\n * Assumes h, s, and l are contained in the set [0, 1] and\n * returns r, g, and b in the set [0, 255].\n *\n * @param Number h The hue\n * @param Number s The saturation\n * @param Number l The lightness\n * @return Array The RGB representation\n */\nfunction hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n}\n\nfunction hslToRgb(h, s, l) {\n var r, g, b;\n\n if (s == 0) {\n r = g = b = l; // achromatic\n } else {\n\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n\n return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];\n}\n\nfunction saveDomAttributes(to, attributes, identification) {\n\n if (!to) return;\n\n to._savedAttributesIds = to._savedAttributesIds || [];\n\n if (to._savedAttributesIds.indexOf(identification) > -1) {\n restoreDomAttributes(to, identification);\n }\n\n to._savedAttributes = to._savedAttributes || {};\n to._attributes = to._attributes || {};\n to._attributes[identification] = attributes;\n\n to._savedAttributesIds.push(identification);\n\n for (var i in attributes) {\n\n if (!to._savedAttributes[i]) {\n to._savedAttributes[i] = to.getAttribute(i);\n }\n\n to.setAttribute(i, attributes[i]);\n }\n}\n\nfunction hasSavedAttribute(dom, attr) {\n return dom._savedAttributes && dom._savedAttributes[attr] !== undefined;\n}\n\nfunction overwriteDomAttribute(dom, attribute, newValue) {\n if (hasSavedAttribute(dom, attribute)) {\n dom._savedAttributes[attribute] = newValue;\n }\n}\n\nfunction restoreDomAttributes(to, identification) {\n\n if (!to || !to._savedAttributesIds) {\n return;\n }\n\n to._savedAttributesIds.splice(to._savedAttributesIds.indexOf(identification), 1);\n delete to._attributes[identification];\n\n var attrs = {};\n\n for (var i in to._savedAttributes) {\n attrs[i] = to._savedAttributes[i];\n }\n\n for (var i = 0, l = to._savedAttributesIds.length; i < l; i++) {\n\n for (var j in to._attributes[to._savedAttributesIds[i]]) {\n attrs[j] = to._attributes[to._savedAttributesIds[i]][j];\n }\n }\n\n for (var j in attrs) {\n to.setAttribute(j, attrs[j]);\n }\n}\n\n// https://davidwalsh.name/function-debounce\nfunction debounce(func, wait, immediate) {\n var timeout;\n return function () {\n var context = this,\n args = arguments;\n var later = function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}\n\nfunction SVGParser(svgString) {\n\n var parser = new DOMParser();\n var doc = parser.parseFromString(svgString, 'image/svg+xml');\n // returns a SVGDocument, which also is a Document.\n\n return doc;\n}\n\n// http://stackoverflow.com/questions/5276953/what-is-the-most-efficient-way-to-reverse-an-array-in-javascript\n\n\n// jQuery.fn.offset\nfunction getOffset(el) {\n var rect = el.getBoundingClientRect();\n return {\n top: rect.top,\n left: rect.left\n };\n}\n\n// jQuery.fn.css\nfunction setCSS(element, values) {\n var style = element.style;\n for (var i in values) {\n style[i] = values[i];\n }\n}\n\nfunction ajaxGet(options) {\n return new Promise(function (resolve, reject) {\n var request = new XMLHttpRequest();\n request.open(options.type || 'GET', options.url, true);\n if (options.json) request.setRequestHeader('Accept', 'application/json');\n request.onload = function () {\n if (request.status === 200) {\n var response = request.responseText;\n if (options.json) response = JSON.parse(response);\n resolve(response);\n } else {\n reject(new Error('Request error: ' + request.status));\n }\n };\n request.onerror = function () {\n reject(new Error('Network error: ' + request.status));\n };\n request.send();\n });\n}\n\n// https://raw.githubusercontent.com/justmoon/node-extend/888f153645115d1c6aa9a7e346e8e9cd9a83de9b/index.js\n// Copyright (c) 2014 Stefan Thomas\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\n\nvar isArray = function isArray(arr) {\n if (typeof Array.isArray === 'function') {\n return Array.isArray(arr);\n }\n\n return toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n if (!obj || toStr.call(obj) !== '[object Object]') {\n return false;\n }\n\n var hasOwnConstructor = hasOwn.call(obj, 'constructor');\n var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n // Not own constructor property must be Object\n if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n return false;\n }\n\n // Own properties are enumerated firstly, so to speed up,\n // if last one is own, then all properties are own.\n var key;\n for (key in obj) {/**/}\n\n return typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\nfunction extend() {\n var options, name, src, copy, copyIsArray, clone;\n var target = arguments[0];\n var i = 1;\n var length = arguments.length;\n var deep = false;\n\n // Handle a deep copy situation\n if (typeof target === 'boolean') {\n deep = target;\n target = arguments[1] || {};\n // skip the boolean and the target\n i = 2;\n } else if (typeof target !== 'object' && typeof target !== 'function' || target == null) {\n target = {};\n }\n\n for (; i < length; ++i) {\n options = arguments[i];\n // Only deal with non-null/undefined values\n if (options != null) {\n // Extend the base object\n for (name in options) {\n src = target[name];\n copy = options[name];\n\n // Prevent never-ending loop\n if (target !== copy) {\n // Recurse if we're merging plain objects or arrays\n if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n if (copyIsArray) {\n copyIsArray = false;\n clone = src && isArray(src) ? src : [];\n } else {\n clone = src && isPlainObject(src) ? src : {};\n }\n\n // Never move original objects, clone them\n target[name] = extend(deep, clone, copy);\n\n // Don't bring in undefined values\n } else if (typeof copy !== 'undefined') {\n target[name] = copy;\n }\n }\n }\n }\n }\n\n // Return the modified object\n return target;\n}\n\nfunction mix(baseClass, mixin) {\n\n for (let prop in mixin) {\n\n if (mixin.hasOwnProperty(prop)) {\n baseClass.prototype[prop] = mixin[prop];\n }\n }\n}\n\nfunction emptyDom(dom) {\n while (dom.firstChild) {\n dom.removeChild(dom.firstChild);\n }\n}\n\n/*!\n * EventEmitter v4.2.9 - git.io/ee\n * Oliver Caldwell\n * MIT license\n * @preserve\n */\n\n/**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n\nfunction EventEmitter() {}\n\n// Shortcuts to improve speed and size\nvar proto = EventEmitter.prototype;\n\n/**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\nfunction indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n}\n\n/**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\nfunction alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n}\n\n/**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\nproto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n } else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n};\n\n/**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\nproto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n};\n\n/**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\nproto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n};\n\n/**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n};\n\n/**\n * Alias of addListener\n */\nproto.on = alias('addListener');\n\n/**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n};\n\n/**\n * Alias of addOnceListener.\n */\nproto.once = alias('addOnceListener');\n\n/**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n};\n\n/**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n};\n\n/**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n};\n\n/**\n * Alias of removeListener\n */\nproto.off = alias('removeListener');\n\n/**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n};\n\n/**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n};\n\n/**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n } else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n } else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n};\n\n/**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n } else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n } else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n};\n\n/**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\nproto.removeAllListeners = alias('removeEvent');\n\n/**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.emitEvent = function emitEvent(evt, args) {\n var listeners = this.getListenersAsObject(evt);\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n i = listeners[key].length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[key][i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n};\n\n/**\n * Alias of emitEvent\n */\nproto.trigger = alias('emitEvent');\n\n/**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n};\n\n/**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n};\n\n/**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\nproto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n } else {\n return true;\n }\n};\n\n/**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\nproto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n};\n\nclass FitHost {\n\n constructor(options) {\n\n this.DELTAP = 1e-6;\n this.BIGVAL = 9e99;\n this.WEIGHT = 1.0;\n\n this.setYData(options.dataY);\n this.setXData(options.dataX);\n this.setWeight(options.weight);\n this.setInitialParams(options.params);\n\n if (options.subsetIndex) {\n this.setSubset(...options.subsetIndex);\n }\n\n this.setFunction(options.function);\n\n if (options.progress) {\n this.hookIteration(options.progress);\n }\n\n this.options = options;\n }\n\n //[ [ x1, y1 ], [ x2, y2 ] ]\n setYData(data) {\n // Waveform instance\n this.data = data;\n }\n\n setXData(data) {\n // Waveform instance\n this.dataX = data;\n }\n\n setWeight(weight) {\n // Waveform instance\n this.weight = weight;\n }\n\n setInitialParams(params) {\n this.parms = params;\n\n this.parms = this.parms.map(el => {\n if (typeof el == 'function') {\n return el(this.data, this.dataX);\n } else {\n return el;\n }\n });\n this.NPARMS = params.length;\n }\n\n setSubset(fromIndex, toIndex) {\n if (fromIndex !== undefined && toIndex !== undefined) {\n this._from = fromIndex;\n this._to = toIndex;\n }\n }\n\n hookIteration(f) {\n this._hookIteration = params => {\n let data = this.buildFit(params, 200);\n f(data);\n };\n }\n\n setFunction(func) {\n this._func = func;\n }\n\n init() {\n\n // Get data length\n if (this._from !== undefined && this._to !== undefined) {\n\n if (this._from >= this._to) {\n throw 'Impossible to fit negative subranges. The starting index must be lower than the ending index';\n }\n\n this.NPTS = this._to - this._from + 1;\n\n if (this.data && this.data.getLength() <= this._to) {\n throw 'Wave Y has not enough point to be fitted to subrange [' + this._from + ', ' + this._to + ']';\n }\n\n if (this._from < 0) {\n throw 'Impossible to fit a subrange with negative indices';\n }\n } else {\n\n this.NPTS = this.data.getLength();\n this._from = 0;\n this._to = this.data.getLength() - 1;\n }\n\n if (this.dataX && this.dataX.getLength() <= this._to) {\n throw 'Wave X has not enough point to be fitted to subrange [' + this._from + ', ' + this._to + ']';\n }\n\n this.arrY = this.data.getDataY();\n\n if (this.dataX) {\n this.arrX = this.dataX.getDataY();\n } else {\n this.arrX = this.data.getDataX();\n }\n\n this.resid = new Array(this.NPTS).fill(0);\n this.jac = new Array(this.NPTS).fill(0);\n this.jac = this.jac.map(el => new Array(this.NPARMS));\n }\n\n fit() {\n\n this.log('Starting the fit with initial parameter list {' + this.parms.join() + '};');\n new LM(this, this.NPARMS, this.NPTS, this._hookIteration);\n this.log('Fit successful. Output parameters {' + this.parms.join() + '};');\n\n this._result = this.buildFit(this.parms, 200);\n\n if (this.options.done) {\n this.options.done(this.parms, this._result);\n }\n\n return this._result;\n }\n\n func(x, param) {\n return this._func(x, param);\n }\n\n computeResiduals() {\n var sumsq = 0;\n for (var i = 0; i < this.NPTS; i++) {\n this.resid[i] = (this.func(this.arrX[i + this._from], this.parms) - this.arrY[i + this._from]) * this.WEIGHT;\n sumsq += this.resid[i] * this.resid[i];\n }\n\n return sumsq;\n }\n\n log(message) {\n if (this.options.log) {\n console.log(message);\n }\n }\n\n //------the four mandated interface methods------------\n nudge(dp) {\n\n for (var j = 0; j < this.NPARMS; j++) {\n this.parms[j] += dp[j];\n }\n return this.computeResiduals();\n }\n\n buildJacobian() {\n // Allows LM to compute a new Jacobian.\n // Uses current parms[] and two-sided finite difference.\n // If current parms[] is bad, returns false.\n var delta = new Array(this.NPARMS);\n var FACTOR = 0.5 / this.DELTAP;\n var d = 0;\n\n for (var j = 0; j < this.NPARMS; j++) {\n for (var k = 0; k < this.NPARMS; k++) delta[k] = k == j ? this.DELTAP : 0.0;\n\n d = this.nudge(delta); // resid at pplus\n if (d == this.BIGVAL) {\n throw 'Bad dBuildJacobian() exit 2';\n }\n\n for (var i = 0; i < this.NPTS; i++) {\n this.jac[i][j] = this.getResidualElement(i);\n }\n\n for (var k = 0; k < this.NPARMS; k++) {\n delta[k] = k == j ? -2 * this.DELTAP : 0.0;\n }\n\n d = this.nudge(delta); // resid at pminus\n if (d == this.BIGVAL) {\n throw 'Bad dBuildJacobian(). exit 3';\n }\n\n for (var i = 0; i < this.NPTS; i++) this.jac[i][j] -= this.getResidualElement(i); // fetches resid[]\n\n for (var i = 0; i < this.NPTS; i++) this.jac[i][j] *= FACTOR;\n\n for (var k = 0; k < this.NPARMS; k++) delta[k] = k == j ? this.DELTAP : 0.0;\n\n d = this.nudge(delta);\n if (d == this.BIGVAL) {\n throw 'Bad dBuildJacobian(). exit 4';\n }\n }\n return true;\n }\n\n getResidualElement(i) {\n // Allows LM to see one element of the resid[] vector.\n return this.resid[i];\n }\n\n getJacobianElement(i, j) {\n // Allows LM to see one element of the Jacobian matrix.\n return this.jac[i][j];\n }\n\n buildFit(parms, length) {\n let x;\n\n if (!length) {\n x = this.arrX;\n } else {\n\n const xmin = this.dataX.getMin(this._from, this._to);\n const xmax = this.dataX.getMax(this._from, this._to);\n\n x = new Array(length).fill(0).map((el, index) => index * (xmax - xmin) / (length - 1) + xmin);\n }\n\n var fit = new Array(x.length);\n for (var i = 0, l = x.length; i < l; i++) {\n fit[i] = this.func(x[i], this.parms);\n }\n\n let waveformResult = this.options.waveform;\n waveformResult.setData(fit, x);\n //waveformResult.setXWaveform( x );\n\n return waveformResult;\n }\n}\n\nclass LM {\n\n constructor(gH, gnadj, gnpnts, hook) {\n\n this.LMITER = 100; // max number of L-M iterations\n this.LMBOOST = 2.0; // damping increase per failed step\n this.LMSHRINK = 0.10; // damping decrease per successful step\n this.LAMBDAZERO = 0.001; // initial damping\n this.LAMBDAMAX = 1E9; // max damping\n this.LMTOL = 1E-12; // exit tolerance\n this.BIGVAL = 9e99; // trouble flag\n\n this.sos;\n this.sosprev;\n this.lambda;\n\n this.myH = null; // overwritten by constructor\n this.nadj = 0; // overwritten by constructor\n this.npts = 0; // overwritten by constructor\n\n this.delta; // local parm change\n this.beta;\n this.alpha;\n this.amatrix;\n\n // Constructor sets up fields and drives iterations.\n this.myH = gH;\n this.nadj = gnadj;\n this.npts = gnpnts;\n\n this.delta = new Array(this.nadj).fill(0);\n this.beta = new Array(this.nadj).fill(0);\n\n this.alpha = new Array(this.nadj).fill(0);\n this.amatrix = new Array(this.nadj).fill(0);\n\n this.alpha = this.alpha.map(() => new Array(this.nadj));\n this.amatrix = this.amatrix.map(() => new Array(this.nadj));\n\n this.lambda = this.LAMBDAZERO;\n\n var niter = 0;\n var done = false;\n do {\n done = this.bLMiter();\n\n if (hook) {\n hook(this.myH.params);\n }\n\n niter++;\n } while (!done && niter < this.LMITER);\n }\n\n bLMiter() {\n // Each call performs one LM iteration.\n // Returns true if done with iterations; false=wants more.\n // Global nadj, npts; needs nadj, myH to be preset.\n // Ref: M.Lampton, Computers in Physics v.11 pp.110-115 1997.\n for (var k = 0; k < this.nadj; k++) this.delta[k] = 0.0;\n this.sos = this.myH.nudge(this.delta);\n if (this.sos == this.BIGVAL) {\n console.error(' bLMiter finds faulty initial nudge()');\n return false;\n }\n this.sosprev = this.sos;\n\n this.myH.log(' bLMiter..SumOfSquares= ' + this.sos);\n if (!this.myH.buildJacobian()) {\n console.error(' bLMiter finds buildJacobian()=false');\n return false;\n }\n\n for (var k = 0; k < this.nadj; k++) // get downhill gradient beta\n {\n this.beta[k] = 0.0;\n for (var i = 0; i < this.npts; i++) {\n this.beta[k] -= this.myH.getResidualElement(i) * this.myH.getJacobianElement(i, k);\n }\n }\n\n for (var k = 0; k < this.nadj; k++) // get curvature matrix alpha\n for (var j = 0; j < this.nadj; j++) {\n this.alpha[j][k] = 0.0;\n for (var i = 0; i < this.npts; i++) {\n this.alpha[j][k] += this.myH.getJacobianElement(i, j) * this.myH.getJacobianElement(i, k);\n }\n }\n var rrise = 0;\n do // inner damping loop searches for one downhill step\n {\n for (var k = 0; k < this.nadj; k++) {\n // copy and damp it\n for (var j = 0; j < this.nadj; j++) {\n this.amatrix[j][k] = this.alpha[j][k] + (j == k ? this.lambda : 0.0);\n }\n }\n\n this.gaussj(this.amatrix, this.nadj); // invert\n\n for (var k = 0; k < this.nadj; k++) // compute delta[]\n {\n this.delta[k] = 0.0;\n for (var j = 0; j < this.nadj; j++) this.delta[k] += this.amatrix[j][k] * this.beta[j];\n }\n this.sos = this.myH.nudge(this.delta); // try it out.\n if (this.sos == this.BIGVAL) {\n console.error(' LMinner failed SOS step');\n return false;\n }\n rrise = (this.sos - this.sosprev) / (1 + this.sos);\n if (rrise <= 0.0) // good step!\n {\n this.lambda *= this.LMSHRINK; // shrink lambda\n break; // leave lmInner.\n }\n for (var q = 0; q < this.nadj; q++) {\n // reverse course!\n this.delta[q] *= -1.0;\n }\n this.myH.nudge(this.delta); // sosprev should still be OK\n if (rrise < this.LMTOL) {\n // finished but keep prev parms\n break; // leave inner loop\n }\n this.lambda *= this.LMBOOST; // else try more damping.\n } while (this.lambda < this.LAMBDAMAX);\n return rrise > -this.LMTOL || this.lambda > this.LAMBDAMAX;\n }\n\n gaussj(a, N) {\n // Inverts the double array a[N][N] by Gauss-Jordan method\n // M.Lampton UCB SSL (c)2003, 2005\n\n var det = 1.0,\n big,\n save;\n var i, j, k, L;\n var ik = new Array(100);\n var jk = new Array(100);\n\n for (k = 0; k < N; k++) {\n big = 0.0;\n for (i = k; i < N; i++) for (j = k; j < N; j++) // find biggest element\n if (Math.abs(big) <= Math.abs(a[i][j])) {\n big = a[i][j];\n ik[k] = i;\n jk[k] = j;\n }\n if (big == 0.0) return 0.0;\n i = ik[k];\n if (i > k) for (j = 0; j < N; j++) // exchange rows\n {\n save = a[k][j];\n a[k][j] = a[i][j];\n a[i][j] = -save;\n }\n j = jk[k];\n if (j > k) for (i = 0; i < N; i++) {\n save = a[i][k];\n a[i][k] = a[i][j];\n a[i][j] = -save;\n }\n for (i = 0; i < N; i++) // build the inverse\n if (i != k) a[i][k] = -a[i][k] / big;\n for (i = 0; i < N; i++) for (j = 0; j < N; j++) if (i != k && j != k) a[i][j] += a[i][k] * a[k][j];\n for (j = 0; j < N; j++) if (j != k) a[k][j] /= big;\n a[k][k] = 1.0 / big;\n det *= big; // bomb point\n } // end k loop\n for (L = 0; L < N; L++) {\n k = N - L - 1;\n j = ik[k];\n if (j > k) for (i = 0; i < N; i++) {\n save = a[i][k];\n a[i][k] = -a[i][j];\n a[i][j] = save;\n }\n i = jk[k];\n if (i > k) for (j = 0; j < N; j++) {\n save = a[k][j];\n a[k][j] = -a[i][j];\n a[i][j] = save;\n }\n }\n return det;\n }\n}\n\n\n//module.export = FitHost\n\nvar dataAggregator;\n\nif (typeof URL === 'undefined' || typeof URL.createObjectURL === 'undefined' || typeof Blob === 'undefined' || typeof Worker === 'undefined') {\n dataAggregator = () => {};\n} else {\n var aggregatorWorker;\n var queue = {};\n\n let string = function () {\n\n onmessage = function (e) {\n\n const data = e.data.data,\n // The initial data\n maxX = e.data.maxX,\n minX = e.data.minX,\n maxY = e.data.maxY,\n minY = e.data.minY,\n direction = e.data.direction;\n\n let numPoints = e.data.numPoints; // Total number of points in the slot\n let l = data.length; // Number of data in the original buffer\n let i = 0;\n let k = -4;\n let slots = [];\n let dataAggregatedX = [];\n let dataAggregatedY = [];\n let aggregationSum = [];\n let getX;\n let slotNumber;\n let lastAggregationX;\n let lastAggregation;\n let lastAggregationSum;\n let newAggregation;\n let newAggregationX;\n\n if (e.data.xdata) {\n\n getX = function getX(index) {\n return e.data.xdata[index];\n };\n } else {\n getX = function getX(index) {\n return index * e.data.xScale + e.data.xOffset;\n };\n }\n\n let aggregations = {};\n\n // Direction x\n if (direction == 'x') {\n const dataPerSlot = numPoints / (maxX - minX); // Computed number of aggregation per slot\n\n for (; i < l; i++) {\n\n // dataPerSlot: 1 / 1000 ( compression by 1'000 )\n //console.log( dataPerSlot, getX( i ) );\n slotNumber = Math.floor((getX(i) - minX) * dataPerSlot);\n\n if (slots[k] !== slotNumber) {\n k += 4;\n slots[k] = slotNumber;\n\n let slotX = (slotNumber + 0.5) / dataPerSlot + minX;\n\n dataAggregatedX[k] = slotX;\n dataAggregatedX[k + 1] = slotX;\n dataAggregatedX[k + 2] = slotX;\n dataAggregatedX[k + 3] = slotX;\n\n dataAggregatedY[k] = data[i];\n dataAggregatedY[k + 1] = data[i];\n dataAggregatedY[k + 2] = data[i];\n dataAggregatedY[k + 3] = data[i];\n aggregationSum[k] = 0;\n }\n\n dataAggregatedY[k + 1] = Math.min(data[i], dataAggregatedY[k + 1]);\n dataAggregatedY[k + 2] = Math.max(data[i], dataAggregatedY[k + 2]);\n dataAggregatedY[k + 3] = data[i];\n aggregationSum[k] += data[i];\n }\n } else {\n // y\n\n const dataPerSlot = numPoints / (maxY - minY); // Computed number of aggregation per slot\n\n for (; i < l; i++) {\n\n // dataPerSlot: 1 / 1000 ( compression by 1'000 )\n //console.log( dataPerSlot, getX( i ) );\n slotNumber = Math.floor((data[i] - minY) * dataPerSlot);\n\n if (slots[k] !== slotNumber) {\n k += 4;\n slots[k] = slotNumber;\n\n let slotY = (slotNumber + 0.5) / dataPerSlot + minY;\n\n dataAggregatedY[k] = slotY;\n dataAggregatedY[k + 1] = slotY;\n dataAggregatedY[k + 2] = slotY;\n dataAggregatedY[k + 3] = slotY;\n\n dataAggregatedX[k] = data[i];\n dataAggregatedX[k + 1] = data[i];\n dataAggregatedX[k + 2] = data[i];\n dataAggregatedX[k + 3] = data[i];\n aggregationSum[k] = 0;\n }\n dataAggregatedX[k + 1] = Math.min(getX(i), dataAggregatedX[k + 1]);\n dataAggregatedX[k + 2] = Math.max(getX(i), dataAggregatedX[k + 2]);\n dataAggregatedX[k + 3] = getX(i);\n aggregationSum[k] += getX(i);\n }\n }\n\n aggregations[numPoints] = {\n x: dataAggregatedX,\n y: dataAggregatedY,\n sums: aggregationSum\n };\n\n lastAggregation = dataAggregatedY;\n lastAggregationX = dataAggregatedX;\n lastAggregationSum = aggregationSum;\n\n while (numPoints > 256) {\n\n numPoints /= 2;\n\n newAggregation = [];\n newAggregationX = [];\n\n k = 0;\n\n if (direction == 'x') {\n\n for (i = 0, l = lastAggregation.length - 8; i < l; i += 8) {\n\n newAggregationX[k] = (lastAggregationX[i] + lastAggregationX[i + 4]) / 2;\n newAggregationX[k + 1] = newAggregationX[k];\n newAggregationX[k + 2] = newAggregationX[k];\n newAggregationX[k + 3] = newAggregationX[k];\n\n newAggregation[k] = lastAggregation[i];\n newAggregation[k + 1] = Math.min(lastAggregation[i + 1], lastAggregation[i + 5]);\n newAggregation[k + 2] = Math.max(lastAggregation[i + 2], lastAggregation[i + 6]);\n newAggregation[k + 3] = lastAggregation[i + 7];\n\n aggregationSum[k] = (lastAggregationSum[i] + lastAggregationSum[i + 4]) / 2;\n\n k += 4;\n }\n } else {\n\n for (i = 0, l = lastAggregation.length - 8; i < l; i += 8) {\n\n newAggregation[k] = (lastAggregation[i] + lastAggregation[i + 4]) / 2;\n newAggregation[k + 1] = newAggregation[k];\n newAggregation[k + 2] = newAggregation[k];\n newAggregation[k + 3] = newAggregation[k];\n\n newAggregationX[k] = lastAggregationX[i];\n newAggregationX[k + 1] = Math.min(lastAggregationX[i + 1], lastAggregationX[i + 5]);\n newAggregationX[k + 2] = Math.max(lastAggregationX[i + 2], lastAggregationX[i + 6]);\n newAggregationX[k + 3] = lastAggregationX[i + 7];\n\n aggregationSum[k] = (lastAggregationSum[i] + lastAggregationSum[i + 4]) / 2;\n\n k += 4;\n }\n }\n\n aggregations[numPoints] = {\n x: newAggregationX,\n y: newAggregation,\n sums: aggregationSum\n };\n\n lastAggregation = newAggregation;\n lastAggregationX = newAggregationX;\n lastAggregationSum = aggregationSum;\n\n aggregationSum = [];\n }\n\n postMessage({\n aggregates: aggregations,\n _queueId: e.data._queueId\n });\n };\n }.toString();\n\n string = string.replace(/^\\s*function\\s*\\(\\s*\\)\\s*\\{/, '');\n string = string.replace(/}\\s*$/, '');\n /*\n if ( typeof URL == \"undefined\" ) {\n module.exports = function() {};\n } else {\n */\n\n var workerUrl = URL.createObjectURL(new Blob([string], {\n type: 'application/javascript'\n }));\n\n aggregatorWorker = new Worker(workerUrl);\n\n aggregatorWorker.onmessage = function (e) {\n\n var id = e.data._queueId;\n delete e.data._queueId;\n queue[id](e.data);\n delete queue[id];\n };\n\n dataAggregator = function (toOptimize) {\n\n var requestId = Date.now();\n toOptimize._queueId = requestId;\n\n var prom = new Promise(resolver => {\n queue[requestId] = resolver;\n });\n\n aggregatorWorker.postMessage(toOptimize);\n return prom;\n };\n}\n\nvar aggregator = dataAggregator;\n\nclass Waveform {\n\n constructor(data = [], xOffset = 0, xScale = 1) {\n\n this.xOffset = xOffset;\n this.xScale = xScale;\n\n // Error bar handling\n this.errors = {\n\n nb: 0,\n\n bars: {\n above: null,\n below: null\n },\n\n boxes: {\n above: null,\n below: null\n }\n };\n\n this.setData(data);\n\n this.BELOW = Waveform.BELOW;\n this.ABOVE = Waveform.ABOVE;\n this.BOX = Waveform.BOX;\n this.BAR = Waveform.BAR;\n }\n\n /** [ [ x1, y1 ], [ x2, y2 ] ] */\n\n /*\n setDataXY( data ) {\n let newData = [ this._makeArray( data.length ), this._makeArray( data.length ) ],\n warnNaN = false;\n const nanable = this.isNaNAllowed();\n data.map( ( el, index ) => {\n if ( !nanable && ( el[ 0 ] !== el[ 0 ] || el[ 1 ] !== el[ 1 ] ) ) {\n warnNaN = true;\n }\n newData[ 0 ][ index ] = el[ 0 ];\n newData[ 1 ][ index ] = el[ 1 ];\n } );\n if ( warnNaN ) {\n this.warn( \"Trying to assign NaN values to a typed array that does not support NaNs. 0's will be used instead\" );\n }\n this._setData( ...newData );\n return this;\n }\n */\n setData(data, dataX = null) {\n\n /* First, we must treat the case of the array of array for backward compatibility */\n if (Array.isArray(data[0])) {\n let x = [];\n let y = [];\n data.forEach(el => {\n x.push(el[0]);\n y.push(el[1]);\n });\n\n this.setXWaveform(x);\n data = y;\n }\n\n let newData = this._makeArray(data.length),\n warnNaN = false;\n\n const nanable = this.isNaNAllowed();\n\n data.map((el, index) => {\n\n if (!nanable && Number.isNaN(el[0]) || Number.isNaN(el[1])) {\n warnNaN = true;\n }\n\n newData[index] = el;\n });\n\n if (warnNaN) {\n this.warn(\"Trying to assign NaN values to a typed array that does not support NaNs. 0's will be used instead\");\n }\n\n this._setData(newData);\n\n if (dataX) {\n this.setXWaveform(dataX);\n }\n return this;\n }\n\n getY(index, optimized = false) {\n\n if (optimized && this.dataInUse) {\n return this.dataInUse.y[index] * this.getScale() + this.getShift();\n }\n\n return this.data[index] * this.getScale() + this.getShift();\n }\n\n /*\n flipXY() {\n let temp;\n temp = this.data.x;\n this.data.x = this.data.y;\n this.data.y = temp;\n this._setData( this.data.x, this.data.y );\n }*/\n\n setXWaveform(waveform) {\n\n if (!(waveform instanceof Waveform)) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n } else {\n throw 'Cannot set X waveform. Data is not a valid array.';\n }\n }\n\n this.xdata = waveform;\n this.computeXMinMax();\n return this;\n }\n\n hasXWaveform() {\n return !!this.xdata;\n }\n\n getXWaveform() {\n\n if (this.xdata) {\n return this.xdata;\n }\n\n let wave = new Waveform(),\n xs = [];\n for (var i = 0; i < this.getLength(); i += 1) {\n xs.push(this.getX(i));\n }\n\n wave.setData(xs);\n\n this.xdata = wave;\n return wave;\n }\n\n rescaleX(offset, scale) {\n this.xScale = scale;\n this.xOffset = offset;\n this.computeXMinMax();\n return this;\n }\n\n getTypedArrayClass() {\n return this._typedArrayClass || false;\n }\n\n setTypedArrayClass(constructor) {\n\n if (this.getTypedArrayClass() && this.isNaNAllowed() && !this.isNaNAllowed(constructor)) {\n this.warn('NaN values are not allowed by the new constructor (' + constructor.name + ') while it was allowed by the previous one (' + this._typedArrayClass.name + ')');\n }\n\n if (this.getTypedArrayClass() && this.isUnsigned() && !this.isUnsigned(constructor)) {\n this.warn('You are switching from signed values to unsigned values. You may experience data corruption if there were some negative values.');\n }\n\n this._typedArrayClass = constructor;\n\n if (this.data) {\n this._setData(constructor.from(this.data));\n }\n\n if (this.hasXWaveform()) {\n this.getXWaveform().setTypedArrayClass(constructor);\n }\n }\n\n isNaNAllowed(constructor = this._typedArrayClass) {\n\n // The following types accept NaNs\n return constructor == Array || constructor == Float32Array || constructor == Float64Array;\n }\n\n isUnsigned(constructor = this._typedArrayClass) {\n\n // The following types accept unsigned numbers\n return constructor == Uint8Array || constructor == Uint8ClampedArray || constructor == Uint16Array || constructor == Uint32Array;\n }\n\n recalculateMinMaxNewPoint(x, y) {\n if (x < this.minX || this.minX === undefined) {\n this.minX = x;\n }\n\n if (x > this.maxX || this.maxX === undefined) {\n this.maxX = x;\n }\n\n if (y < this.minY || this.minY === undefined) {\n this.minY = y;\n }\n\n if (y > this.maxY || this.maxY === undefined) {\n this.maxY = y;\n }\n }\n\n prepend(x, y) {\n\n if (typeof x == 'function') {\n x = x(this);\n }\n\n if (typeof y == 'function') {\n y = y(this);\n }\n\n if (this.xdata) {\n this.xdata.prepend(null, x);\n } else if (x !== null) {\n this.xdata = this.getXWaveform();\n this.xdata.prepend(null, x);\n } else {\n this.xOffset -= this.xScale;\n }\n\n this.data.unshift(y);\n this.recalculateMinMaxNewPoint(x, y);\n return this;\n }\n\n append(x, y) {\n\n if (!this.data) {\n this.data = [];\n }\n\n if (typeof x == 'function') {\n x = x(this);\n }\n\n if (typeof y == 'function') {\n y = y(this);\n }\n\n if (this.xdata) {\n this.xdata.append(null, x);\n } else if (x !== null) {\n this.xdata = this.getXWaveform();\n this.xdata.append(null, x);\n }\n\n if (this.monotoneous) {\n if (y >= this.data[this.data.y] && this.getMonotoneousAscending() === false) {\n this.monotoneous = false;\n } else if (y <= this.data[this.data.y] && this.getMonotoneousAscending() === true) {\n this.monotoneous = false;\n }\n }\n\n if (this.data.length == 1 || this._monotoneousAscending === undefined) {\n\n this.monotoneous = true;\n\n if (y == this.data[0]) {\n this._monotoneousAscending = undefined;\n } else {\n this._monotoneousAscending = y > this.data[0];\n }\n }\n\n this.data.push(y);\n this.recalculateMinMaxNewPoint(x, y);\n\n return this;\n }\n\n _makeArray(length) {\n\n const constructor = this.getTypedArrayClass();\n if (constructor) {\n return new constructor(length);\n }\n return new Array(length);\n }\n\n _setData(dataY = this.data) {\n\n const l = dataY.length;\n let i = 1,\n monoDir = dataY[1] > dataY[0],\n minY = dataY[0],\n maxY = dataY[0];\n\n this._monotoneous = true;\n\n for (; i < l; i++) {\n if (dataY[i] !== dataY[i - 1] && monoDir !== dataY[i] > dataY[i - 1]) {\n this._monotoneous = false;\n }\n\n if (dataY[i] === dataY[i]) {\n // NaN support\n minY = Math.min(dataY[i], minY);\n maxY = Math.max(dataY[i], maxY);\n }\n }\n\n if (this._monotoneous) {\n this._monotoneousAscending = dataY[1] > dataY[0];\n }\n\n if (this.hasErrorBars()) {\n // If prefer to loop again here\n\n for (i = 0; i < l; i++) {\n\n if (dataY[i] === dataY[i]) {\n // NaN support\n\n minY = Math.min(minY, dataY[i] - this.getMaxError(i, 'below'));\n maxY = Math.max(maxY, dataY[i] + this.getMaxError(i, 'above'));\n }\n }\n\n this.minY = minY;\n this.maxY = maxY;\n } else {\n this.minY = minY;\n this.maxY = maxY;\n }\n\n this.data = dataY;\n\n this.computeXMinMax();\n }\n\n computeXMinMax() {\n\n if (!this.data) {\n\n return;\n }\n\n if (!this.xdata) {\n\n const b1 = this.xOffset + this.xScale * this.getLength(),\n b2 = this.xOffset;\n\n this.minX = Math.min(b1, b2);\n this.maxX = Math.max(b1, b2);\n }\n }\n\n getDataInUse() {\n return this.dataInUse || this.data;\n }\n\n getIndexFromVal(val, useDataToUse = false, roundingMethod = Math.round) {\n\n let data;\n\n if (useDataToUse && this.dataInUse) {\n data = this.dataInUse.y;\n } else {\n data = this.data;\n }\n\n let position;\n\n position = this.getIndexFromData(val, data, this.data.getMonotoneousAscending(), roundingMethod);\n\n if (useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateY') {\n // In case of aggregation, round to the closest element of 4.\n return position - position % 4;\n }\n\n return position;\n }\n\n getIndexFromX(xval, useDataToUse = false, roundingMethod = Math.round) {\n\n let xdata;\n\n if (useDataToUse && this.dataInUse) {\n xdata = this.dataInUse.x;\n } else if (this.xdata) {\n xdata = this.xdata.data;\n }\n\n let position;\n\n if (this.hasXWaveform()) {\n // The x value HAS to be rescaled\n position = this.xdata.getIndexFromData(xval, xdata, this.xdata.getMonotoneousAscending(), roundingMethod);\n } else {\n position = Math.max(0, Math.min(this.getLength() - 1, roundingMethod((xval - this.xOffset) / this.xScale)));\n }\n\n if (useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateX') {\n // In case of aggregation, round to the closest element of 4.\n return position - position % 4;\n }\n\n return position;\n }\n\n getIndexFromXY(xval, yval, useDataToUse = false, roundingMethod = Math.round, scaleX, scaleY) {\n\n let xdata, ydata;\n\n if (useDataToUse && this.dataInUse) {\n\n xdata = this.dataInUse.x;\n ydata = this.dataInUse.y;\n } else if (this.xdata) {\n\n xdata = this.xdata.data;\n ydata = this.data;\n }\n\n let position;\n\n if (this.isXMonotoneous()) {\n // X lookup only\n\n if (this.hasXWaveform()) {\n // The x value HAS to be rescaled\n position = this.xdata.getIndexFromData(xval, xdata, this.xdata.getMonotoneousAscending(), roundingMethod);\n } else {\n position = Math.max(0, Math.min(this.getLength() - 1, roundingMethod((xval - this.xOffset) / this.xScale)));\n }\n } else if (!isNaN(yval)) {\n\n position = this.getIndexFromDataXY(xval, xdata, yval, ydata, scaleX, scaleY);\n } else {\n return;\n }\n\n if (useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateX') {\n // In case of aggregation, round to the closest element of 4.\n return position - position % 4;\n }\n\n return position;\n }\n\n getIndexFromData(val, valCollection, isAscending) {\n\n val -= this.getShift();\n val /= this.getScale();\n\n if (!this.isMonotoneous()) {\n console.trace();\n throw 'Impossible to get the index from a non-monotoneous wave !';\n }\n\n return binarySearch(val, valCollection, !isAscending);\n }\n\n getIndexFromDataXY(valX, dataX, valY, dataY, scaleX = 1, scaleY = 1) {\n\n valX -= this.getXShift();\n valX /= this.getXScale();\n\n valY -= this.getShift();\n valY /= this.getScale();\n\n return euclidianSearch(valX, valY, dataX, dataY, scaleX, scaleY);\n }\n\n getReductionType() {\n return this.dataInUseType;\n }\n\n getXMin() {\n return this.xdata ? this.xdata.getMin() : this.minX;\n }\n\n getXMax() {\n return this.xdata ? this.xdata.getMax() : this.maxX;\n }\n\n getYMin() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getYMax() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getMin() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getMax() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getMinX() {\n return this.getXMin();\n }\n\n getMaxX() {\n return this.getXMax();\n }\n\n getMinY() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getMaxY() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getDataY() {\n return this.data;\n }\n\n getData(optimized) {\n if (!optimized || !this.dataInUse) {\n return this.data;\n }\n return this.dataInUse.y;\n }\n\n setShift(shift = 0) {\n\n // We must update the min and the max of the y data\n //this.minY += ( shift - this.getShift() );\n //this.maxY += ( shift - this.getShift() );\n this.shift = shift;\n return this;\n }\n\n getShift() {\n return this.shift || 0;\n }\n\n getScale() {\n return this.scale || 1;\n }\n\n setScale(scale = 1) {\n\n // this.minY = ( this.minY - this.getShift() ) * scale;\n // this.maxY = ( this.maxY - this.getShift() ) * scale;\n this.scale = scale;\n }\n\n setXShift(shift = 0) {\n\n if (!this.hasXWaveform()) {\n return this;\n }\n\n // We must update the min and the max of the x data\n // That's important for when the data has already been set\n // this.minX += ( shift - this.getXShift() );\n // this.maxX += ( shift - this.getXShift() );\n this.getXWaveform().setShift(shift);\n return this;\n }\n\n getXShift(shift) {\n\n if (!this.hasXWaveform) {\n return 0;\n }\n\n return this.getXWaveform().getShift();\n }\n\n setXScale(scale = 1) {\n\n if (!this.hasXWaveform) {\n return this;\n }\n\n this.getXWaveform().setScale(scale);\n return this;\n }\n\n getXScale() {\n\n if (!this.hasXWaveform) {\n return 1;\n }\n\n return this.getXWaveform().getScale();\n }\n\n getLength() {\n if (!this.data) {\n return 0;\n }\n return this.data.length;\n }\n\n getDataToUseFlat() {\n\n let l;\n let j = 0;\n let arr;\n\n if (this.dataInUse) {\n\n l = this.dataInUse.x.length;\n arr = new Array(l * 2).fill(0);\n\n for (var i = 0; i < l; i += 1) {\n arr[j] = this.dataInUse.x[i];\n arr[j + 1] = this.dataInUse.y[i];\n j += 2;\n }\n } else {\n\n l = this.getLength();\n arr = new Array(l * 2).fill(0);\n for (var i = 0; i < l; i += 1) {\n arr[j + 1] = this.data[i];\n arr[j] = this.getX(i);\n j += 2;\n }\n }\n\n return arr;\n }\n\n fit(options) {\n\n var self = this;\n\n return new Promise(function (resolver, rejector) {\n\n var fit = new FitHost(Object.assign({}, {\n\n dataY: self,\n dataX: self.getXWaveform(),\n done: function (results) {\n resolver(results);\n },\n waveform: new Waveform()\n\n }, options));\n\n fit.init();\n fit.fit();\n });\n }\n\n getX(index, optimized) {\n\n if (optimized && this.dataInUse) {\n return this.dataInUse.x[index] * this.getXScale() + this.getXShift();\n }\n\n if (this.xdata) {\n return this.xdata.data[index] * this.getXScale() + this.getXShift();\n } else {\n return this.xOffset + index * this.xScale;\n }\n }\n\n getXRaw(index, optimized) {\n\n if (optimized && this.dataInUse) {\n return this.dataInUse.x[index];\n }\n\n if (this.xdata) {\n return this.xdata.data[index];\n } else {\n return index;\n }\n }\n\n _integrateP(from = 0, to = this.getLength() - 1) {\n\n from = Math.round(from);\n to = Math.round(to);\n\n if (from > to) {\n let temp = from;\n from = to;\n to = temp;\n }\n\n var l = to - from + 1;\n var sum = 0;\n\n let deltaTot = 0;\n let diff;\n var arrY = this.getData();\n\n for (; from <= to; from++) {\n\n if (arrY.length - 1 > from) {\n diff = this.getX(from + 1) - this.getX(from);\n deltaTot += diff;\n sum += arrY[from] * diff;\n }\n }\n\n return [sum, l, deltaTot];\n }\n\n integrateP(from, to) {\n var val = this._integrateP(from, to);\n return val[0];\n }\n\n integrate(fromX, toX) {\n return this.integrateP(this.getIndexFromX(fromX), this.getIndexFromX(toX));\n }\n\n average(p0 = 0, p1 = this.getLength() - 1) {\n return this.getAverageP(p0, p1);\n }\n\n mean() {\n return this.average();\n }\n\n getAverageP(from, to) {\n var sum = this._integrateP(from, to);\n return sum[0] / sum[2];\n }\n\n getAverageX(from, to) {\n var sum = this._integrateX(from, to);\n return sum[0] / sum[2];\n }\n\n checkMonotonicity() {\n\n let i = 1,\n data = this.getData();\n const l = this.data.length;\n let dir = data[1] > data[0];\n\n for (; i < l; i++) {\n if (data[i] !== data[i - 1] && dir !== data[i] > data[i - 1]) {\n return this._monotoneous = false;\n }\n }\n\n this._monotoneousAscending = data[1] > data[0];\n return this._monotoneous = true;\n }\n\n requireXMonotonicity() {\n if (this.xdata) {\n this.xdata.requireMonotonicity();\n }\n }\n\n requireMonotonicity() {\n if (!this.isMonotoneous()) {\n throw 'The wave must be monotonic';\n }\n }\n\n isMonotoneous() {\n return !!this._monotoneous;\n }\n\n isXMonotoneous() {\n if (this.xdata) {\n return this.xdata.isMonotoneous();\n }\n // Offset and scale is always monotoneous\n return true;\n }\n\n invert(data) {\n\n let d = data || this.data;\n d.reverse();\n\n if (this.isMonotoneous()) {\n this._monotoneousAscending = !this._monotoneousAscending;\n }\n\n return d;\n }\n\n resampleForDisplay(options) {\n // Serie redrawing\n\n let i = 0;\n\n this.requireXMonotonicity();\n\n let inverting = false,\n dataY = this.getDataY(),\n data = {\n x: [],\n y: []\n },\n dataMinMax = [],\n resampleSum,\n resampleMin,\n resampleMax,\n resampleNum,\n resample_x_start,\n resample_x_px_start,\n x_px,\n doing_mean = false,\n firstPointIndex = 0,\n xval;\n\n const l = this.getLength();\n\n if (!options.xPosition) {\n throw 'No position calculation method provided';\n }\n\n if (!options.resampleToPx) {\n throw 'No \"resampleToPx\" method was provided. Unit: px per point';\n }\n\n if (options.minX > options.maxX) {\n let temp = options.minX;\n options.minX = options.maxX;\n options.maxX = temp;\n }\n\n if (this.xdata && !this.xdata.getMonotoneousAscending() || !this.xdata && this.xScale < -0) {\n inverting = true;\n i = l;\n }\n\n for (; inverting ? i > 0 : i < l; inverting ? i-- : i++) {\n\n xval = this.getX(i);\n\n if (options.minX > xval) {\n\n firstPointIndex = i;\n continue;\n }\n\n x_px = options.xPosition(xval);\n\n if (!doing_mean) {\n\n if (!firstPointIndex) {\n\n firstPointIndex = i;\n } else {\n\n data.x.push(xval);\n data.y.push(dataY[firstPointIndex]);\n }\n\n while (isNaN(dataY[i])) {\n\n if (inverting) {\n i--;\n } else {\n i++;\n }\n }\n\n resampleSum = resampleMin = resampleMax = dataY[firstPointIndex];\n resampleNum = 1;\n resample_x_px_start = x_px;\n resample_x_start = xval;\n firstPointIndex = 0;\n\n doing_mean = true;\n\n continue;\n }\n\n if (Math.abs(x_px - resample_x_px_start) > options.resampleToPx || i == l || i == 0 || isNaN(dataY[i])) {\n\n let xpos = (resample_x_start + xval) / 2;\n\n data.x.push(xpos);\n data.y.push(resampleSum / resampleNum);\n\n dataMinMax.push(xpos, resampleMin, resampleMax);\n\n if (options.maxX !== undefined && xval > options.maxX) {\n\n break;\n }\n\n doing_mean = false;\n\n continue;\n }\n\n resampleSum += dataY[i];\n resampleNum++;\n\n resampleMin = Math.min(resampleMin, dataY[i]);\n resampleMax = Math.max(resampleMax, dataY[i]);\n }\n\n this.dataInUseType = 'resampled';\n this.dataInUse = data;\n return dataMinMax;\n }\n\n interpolate(x) {\n\n let xIndex;\n let yData = this.getDataY();\n\n x = (x - this.getXShift()) / this.getXScale();\n\n if (this.xdata) {\n let xData = this.xdata.getData(),\n xIndex = binarySearch(x, xData, !this.xdata.getMonotoneousAscending());\n\n if (xData[xIndex] == x) {\n return yData[xIndex];\n }\n return (x - xData[xIndex]) / (xData[xIndex + 1] - xData[xIndex]) * (yData[xIndex + 1] - yData[xIndex]) + yData[xIndex];\n } else {\n xIndex = (x - this.xOffset) / this.xScale;\n let xIndexF = Math.floor(xIndex);\n return (xIndex - xIndexF) * (yData[xIndexF + 1] - yData[xIndexF]) + yData[xIndexF];\n }\n }\n\n getMonotoneousAscending() {\n\n if (!this.isMonotoneous()) {\n return 'The waveform is not monotoneous';\n }\n\n return this._monotoneousAscending;\n }\n\n getXMonotoneousAscending() {\n if (this.xdata) {\n return this.xdata.getMonotoneousAscending();\n }\n\n return this.xScale > 0;\n }\n\n isXMonotoneousAscending() {\n return this.getXMonotoneousAscending(...arguments);\n }\n\n divide(numberOrWave) {\n return this._arithmetic(numberOrWave, DIVIDE);\n }\n\n divideBy() {\n return this.divide(...arguments);\n }\n\n multiply(numberOrWave) {\n return this._arithmetic(numberOrWave, MULTIPLY);\n }\n\n multiplyBy() {\n return this.multiply(...arguments);\n }\n\n log() {\n return this.logBase(10);\n }\n\n ln() {\n return this.logBase(Math.E);\n }\n\n logBase(base) {\n\n let logBase = Math.log(base);\n this.data.map(valY => {\n\n return Math.log(valY) / logBase;\n });\n }\n\n add(numberOrWave) {\n return this._arithmetic(numberOrWave, ADD);\n }\n\n addBy() {\n return this.add(...arguments);\n }\n\n subtract(numberOrWave) {\n return this._arithmetic(numberOrWave, SUBTRACT);\n }\n\n subtractBy() {\n return this.subtract(...arguments);\n }\n\n math(method) {\n\n for (var i = 0; i < this.getLength(); i++) {\n this.data[i] = method(this.getY(i), this.getX(i));\n }\n\n this._setData(this.data);\n return this;\n }\n\n _arithmetic(numberOrWave, operator) {\n\n if (numberOrWave instanceof Waveform) {\n return this._waveArithmetic(numberOrWave, operator);\n } else if (typeof numberOrWave == 'number') {\n\n return this._numberArithmetic(numberOrWave, operator);\n }\n }\n\n _numberArithmetic(num, operation) {\n\n let i = 0,\n l = this.getLength();\n\n if (operation == MULTIPLY) {\n\n for (; i < l; i++) {\n this.data[i] *= num;\n }\n\n this.minY *= num;\n this.maxY *= num;\n } else if (operation == DIVIDE) {\n\n for (; i < l; i++) {\n this.data[i] /= num;\n }\n\n this.minY /= num;\n this.maxY /= num;\n } else if (operation == ADD) {\n\n for (; i < l; i++) {\n this.data[i] += num;\n }\n\n this.minY += num;\n this.maxY += num;\n } else if (operation == SUBTRACT) {\n\n for (; i < l; i++) {\n this.data[i] -= num;\n }\n\n this.minY -= num;\n this.maxY -= num;\n }\n\n return this;\n }\n\n _waveArithmetic(wave, operation) {\n\n let yDataThis = this.getDataY(),\n i = 0;\n const l = this.getLength();\n this.requireXMonotonicity();\n wave.requireXMonotonicity();\n\n if (operation == MULTIPLY) {\n\n for (; i < l; i++) {\n yDataThis[i] *= wave.interpolate(this.getX(i));\n }\n } else if (operation == DIVIDE) {\n\n for (; i < l; i++) {\n yDataThis[i] /= wave.interpolate(this.getX(i));\n }\n } else if (operation == ADD) {\n\n for (; i < l; i++) {\n yDataThis[i] += wave.interpolate(this.getX(i));\n }\n } else if (operation == SUBTRACT) {\n\n for (; i < l; i++) {\n yDataThis[i] -= wave.interpolate(this.getX(i));\n }\n }\n\n this._setData(yDataThis);\n return this;\n }\n\n aggregate(direction = 'x') {\n\n this._dataAggregating = {};\n this._dataAggregated = {};\n this._dataAggregationDirection = direction.toUpperCase();\n\n var pow2 = pow2floor(this.getLength());\n\n this._dataAggregating = aggregator({\n\n minX: this.getMinX(),\n maxX: this.getMaxX(),\n minY: this.getMinY(),\n maxY: this.getMaxY(),\n data: this.data,\n xdata: this.xdata ? this.xdata.getData() : undefined,\n xScale: this.xScale,\n xOffset: this.xOffset,\n numPoints: pow2,\n direction: direction\n\n }).then(event => {\n\n this._dataAggregated = event.aggregates;\n console.log(this._dataAggregated);\n this._dataAggregating = false;\n });\n }\n\n hasAggregation() {\n return !!this._dataAggregated;\n }\n\n selectAggregatedData(pxWidth) {\n\n if (pxWidth < 2) {\n return false;\n }\n /*\n console.log( direction, this._dataAggregationDirection );\n if( direction !== this._dataAggregationDirection ) {\n throw \"The data is not aggregated in that direction\";\n }\n */\n\n if (pxWidth > 2147483647) {\n pxWidth = 2147483647;\n }\n var level = pow2ceil(pxWidth);\n\n if (this._dataAggregated[level]) {\n\n this.dataInUseType = 'aggregate' + this._dataAggregationDirection;\n this.dataInUse = this._dataAggregated[level];\n return;\n } else if (this._dataAggregating) {\n\n return this._dataAggregating;\n }\n\n this.dataInUseType = 'none';\n this.dataInUse = {\n y: this.data,\n x: this.getXWaveform().data\n };\n }\n\n duplicate(alsoDuplicateXWave) {\n var newWaveform = new Waveform();\n newWaveform._setData(this.getDataY().slice());\n newWaveform.rescaleX(this.xOffset, this.xShift);\n newWaveform.setShift(this.getShift());\n newWaveform.setScale(this.getScale());\n\n if (this.xdata) {\n if (alsoDuplicateXWave) {\n newWaveform.setXWaveform(this.xdata.duplicate());\n } else {\n newWaveform.setXWaveform(this.xdata);\n }\n\n newWaveform.setXShift(this.getXShift());\n newWaveform.setXScale(this.getXScale());\n } else {\n newWaveform.xOffset = this.xOffset;\n newWaveform.xScale = this.xScale;\n }\n\n return newWaveform;\n }\n\n subrangeX(fromX, toX) {\n\n if (!this.xdata) {\n // We can select the new range from there\n\n let fromP = this.getIndexFromX(fromX),\n toP = this.getIndexFromX(toP);\n\n return new Waveform().setData(this.data.slice(fromP, toP)).rescaleX(this.xOffset, this.xScale);\n } else {\n\n var waveform = new Waveform();\n\n for (var i = 0, l = this.data.length; i < l; i++) {\n\n if (this.data[i] >= fromX && this.data[i] < toX) {\n\n waveform.append(this.dataX[i], this.data[i]);\n }\n }\n\n return waveform;\n }\n }\n\n findLocalMinMax(xRef, xWithin, type) {\n\n let index = this.getIndexFromX(xRef),\n indexPlus = this.getIndexFromX(xRef + xWithin),\n indexMinus = this.getIndexFromX(xRef - xWithin);\n\n return this.findLocalMinMaxIndex(indexMinus, indexPlus, type);\n }\n\n findLocalMinMaxIndex(indexMinus, indexPlus, type) {\n\n let tmp;\n\n if (indexPlus < indexMinus) {\n tmp = indexPlus;\n indexPlus = indexMinus;\n indexMinus = tmp;\n }\n\n let curr, currI;\n\n if (type == 'max') {\n\n curr = Number.NEGATIVE_INFINITY;\n\n for (var i = indexMinus; i <= indexPlus; i++) {\n\n if (this.getY(i) > curr) {\n curr = this.getY(i);\n currI = i;\n }\n }\n } else {\n\n curr = Number.POSITIVE_INFINITY;\n\n for (var i = indexMinus; i <= indexPlus; i++) {\n\n if (this.getY(i) < curr) {\n curr = this.getY(i);\n currI = i;\n }\n }\n }\n\n if (currI == indexMinus || currI == indexPlus) {\n return false;\n }\n\n return this.getX(currI);\n }\n\n warn(text) {\n if (console) {\n console.warn(text);\n }\n }\n\n setUnit(unit) {\n this.unit = unit;\n return this;\n }\n\n setXUnit(unit) {\n if (this.hasXWaveform()) {\n this.xdata.setUnit(unit);\n }\n\n this.xunit = unit;\n return this;\n }\n\n getUnit() {\n return this.unit || '';\n }\n\n getXUnit() {\n if (this.hasXWaveform()) {\n return this.xdata.getUnit();\n }\n\n return this.xunit | '';\n }\n\n hasXUnit() {\n return this.getXUnit().length > 0;\n }\n\n hasUnit() {\n return this.getUnit().length > 0;\n }\n\n findLevels(level, options) {\n\n options = Object.assign({\n\n box: 1,\n edge: 'both',\n rounding: 'before',\n rangeP: [0, this.getLength()]\n\n }, options);\n\n var lastLvlIndex = options.rangeP[0];\n var lvlIndex;\n var indices = [];\n var i = 0;\n\n while (lvlIndex = this.findLevel(level, Object.assign({}, options, {\n rangeP: [lastLvlIndex, options.rangeP[1]]\n }))) {\n indices.push(lvlIndex);\n lastLvlIndex = Math.ceil(lvlIndex);\n\n i++;\n if (i > 1000) {\n return;\n }\n }\n\n return indices;\n }\n\n // Find the first level in the specified range\n findLevel(level, options) {\n\n options = Object.assign({\n\n box: 1,\n edge: 'both',\n direction: 'ascending',\n rounding: 'before',\n rangeP: [0, this.getLength()]\n\n }, options);\n\n if (options.rangeX) {\n options.rangeP = options.rangeX.map(this.getIndexFromX);\n }\n\n var value, below, i, j, l, increment;\n\n var box = options.box;\n\n if (box % 2 == 0) {\n box++;\n }\n\n if (options.direction == 'descending') {\n i = options.rangeP[1], l = options.rangeP[0], increment = -1;\n } else {\n i = options.rangeP[0], l = options.rangeP[1], increment = +1;\n }\n\n for (;; i += increment) {\n\n if (options.direction == 'descending') {\n if (i < l) {\n break;\n }\n } else {\n if (i > l) {\n break;\n }\n }\n\n if (i < options.rangeP[0] + (box - 1) / 2) {\n continue;\n }\n\n if (i > options.rangeP[1] - (box - 1) / 2) {\n break;\n }\n\n value = this.getAverageP(i - (box - 1) / 2, i + (box - 1) / 2);\n\n if (below === undefined) {\n below = value < level;\n continue;\n }\n // Crossing up\n if (value >= level && below) {\n\n below = false;\n\n if (options.edge == 'ascending' || options.edge == 'both') {\n // Found something\n\n for (j = i + (box - 1) / 2; j >= i - (box - 1) / 2; j--) {\n\n if (this.data[j] >= level && this.data[j - 1] < level) {\n // Find a crossing\n\n switch (options.rounding) {\n case 'before':\n return j - 1;\n break;\n\n case 'after':\n return j;\n break;\n\n case 'interpolate':\n return getIndexInterpolate(level, this.data[j], this.data[j - 1], j, j - 1);\n break;\n }\n }\n }\n }\n } else if (value <= level && !below) {\n\n below = true;\n\n if (options.edge == 'descending' || options.edge == 'both') {\n\n for (j = i + (box - 1) / 2; j >= i - (box - 1) / 2; j--) {\n\n if (this.data[j] <= level && this.data[j - 1] > level) {\n // Find a crossing\n\n switch (options.rounding) {\n case 'before':\n return j - 1;\n break;\n\n case 'after':\n return j;\n break;\n\n case 'interpolate':\n return getIndexInterpolate(level, this.data[j], this.data[j - 1], j, j - 1);\n break;\n }\n }\n }\n }\n }\n }\n }\n\n normalize(mode) {\n\n let factor, total, minValue, maxValue, ratio, i;\n\n if (mode == 'max1' || mode == 'max100') {\n\n factor = 1;\n\n if (mode == 'max100') {\n factor = 100;\n }\n\n maxValue = this.data[0];\n\n for (i = 1; i < this.getLength(); i++) {\n\n if (this.data[i] > maxValue) {\n\n maxValue = this.data[i];\n }\n }\n\n for (i = 0; i < this.getLength(); i++) {\n\n this.data[i] /= maxValue / factor;\n }\n } else if (mode == 'sum1') {\n\n total = 0;\n\n for (i = 0; i < this.getLength(); i++) {\n total += this.data[i];\n }\n\n for (i = 0; i < this.getLength(); i++) {\n\n this.data[i] /= total;\n }\n } else if (mode == 'max1min0') {\n\n maxValue = this.data[0], minValue = this.data[0];\n\n for (i = 1; i < this.getLength(); i++) {\n if (this.data[i] > maxValue) {\n\n maxValue = this.data[i];\n } else if (this.data[i] < minValue) {\n\n minValue = this.data[i];\n }\n }\n\n ratio = 1 / (maxValue - minValue);\n\n for (i = 0; i < this.getLength(); i++) {\n\n this.data[i] = (this.data[i] - minValue) * ratio;\n }\n }\n\n this.setData(this.data);\n }\n\n ////////////////////////////////////////////////////////////\n ///// HANDLING ERRORS ////////////////////////////////////\n ////////////////////////////////////////////////////////////\n\n setErrorBarX(waveform) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n var xWave = this.getXWaveform();\n xWave.setErrorBar(waveform);\n return this;\n }\n\n setErrorBarXBelow(waveform) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n var xWave = this.getXWaveform();\n xWave.setErrorBarBelow(waveform);\n return this;\n }\n\n setErrorBarXAbove(waveform) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n var xWave = this.getXWaveform();\n xWave.setErrorBarAbove(waveform);\n return this;\n }\n\n setErrorBoxX(waveform) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n var xWave = this.getXWaveform();\n xWave.setErrorBoxAbove(waveform);\n xWave.setErrorBoxBelow(waveform);\n return this;\n }\n\n setErrorBoxXBelow(waveform) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n var xWave = this.getXWaveform();\n\n xWave.setErrorBoxBelow(waveform);\n return this;\n }\n\n setErrorBoxXAbove(waveform) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n var xWave = this.getXWaveform();\n xWave.setErrorBoxAbove(waveform);\n return this;\n }\n\n setErrorBar(waveform, checkMinMax = true) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n this.errors.nb++;\n this.errors.nb++;\n this.errors.bars.bottom = waveform;\n this.errors.bars.top = waveform;\n\n if (checkMinMax) {\n this._setData();\n }\n }\n\n setErrorBarBelow(waveform, checkMinMax = true) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n this.errors.nb++;\n this.errors.bars.below = waveform;\n\n if (checkMinMax) {\n this._setData();\n }\n }\n\n setErrorBarAbove(waveform, checkMinMax = true) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n this.errors.nb++;\n this.errors.bars.above = waveform;\n\n if (checkMinMax) {\n this._setData();\n }\n }\n\n setErrorBox(waveform, checkMinMax = true) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n this.errors.nb++;\n this.errors.nb++;\n this.errors.boxes.above = waveform;\n this.errors.boxes.below = waveform;\n\n if (checkMinMax) {\n this._setData();\n }\n }\n\n setErrorBoxBelow(waveform, checkMinMax = true) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n this.errors.nb++;\n this.errors.boxes.below = waveform;\n\n if (checkMinMax) {\n this._setData();\n }\n }\n\n setErrorBoxAbove(waveform, checkMinMax = true) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n }\n\n this.errors.boxes.above = waveform;\n if (checkMinMax) {\n this._setData();\n }\n }\n\n getMaxError(i, side = Waveform.ABOVE) {\n\n return Math.max(this.getMaxErrorType(i, side, Waveform.BOX), this.getMaxErrorType(i, side, Waveform.BAR));\n }\n\n getMaxErrorType(i, side = Waveform.ABOVE, type = Waveform.BOX) {\n\n let stack;\n if (type == Waveform.BOX) {\n stack = this.errors.boxes;\n } else if (type == Waveform.BAR) {\n stack = this.errors.bars;\n } else {\n throw 'Unknown type of error';\n }\n\n let waveform;\n if (!(waveform = stack[side])) {\n if (side == Waveform.ABOVE) {\n if (stack[side] == Waveform.BELOW) {\n waveform = stack.below;\n }\n } else {\n if (stack[side] == Waveform.ABOVE) {\n waveform = stack.above;\n }\n }\n }\n\n if (!waveform) {\n return 0;\n }\n\n return waveform.getY(i);\n }\n\n getErrorBarXBelow(index) {\n return this.getErrorX(index, Waveform.BELOW, Waveform.BAR);\n }\n getErrorBarXAbove(index) {\n return this.getErrorX(index, Waveform.ABOVE, Waveform.BAR);\n }\n getErrorBoxXBelow(index) {\n return this.getErrorX(index, Waveform.BELOW, Waveform.BOX);\n }\n getErrorBoxXAbove(index) {\n return this.getErrorX(index, Waveform.ABOVE, Waveform.BOX);\n }\n\n getErrorBarYBelow(index) {\n return this.getError(index, Waveform.BELOW, Waveform.BAR);\n }\n getErrorBarYAbove(index) {\n return this.getError(index, Waveform.ABOVE, Waveform.BAR);\n }\n getErrorBoxYBelow(index) {\n return this.getError(index, Waveform.BELOW, Waveform.BOX);\n }\n getErrorBoxYAbove(index) {\n return this.getError(index, Waveform.ABOVE, Waveform.BOX);\n }\n\n getErrorX(index, side = Waveform.ABOVE, type = Waveform.BAR) {\n\n if (!this.hasXWaveform()) {\n return false;\n }\n\n return this.xdata.getError(index, side, type);\n }\n\n getError(index, side = Waveform.ABOVE, type = Waveform.BAR) {\n\n let errors = type == Waveform.BAR ? this.errors.bars : this.errors.boxes;\n\n if (!errors) {\n return false;\n }\n\n let wave;\n if (wave = side == Waveform.ABOVE ? errors.above : errors.below) {\n\n if (wave == Waveform.ABOVE && side == Waveform.BELOW) {\n wave = errors.above;\n } else if (wave == Waveform.BELOW && side == Waveform.ABOVE) {\n wave = errors.below;\n }\n\n if (!wave) {\n return false;\n }\n\n return wave.getY(index);\n }\n }\n\n hasErrorBars() {\n\n return this.errors.nb > 0 || this.hasXWaveform() && this.xdata.errors.nb > 0;\n }\n\n}\n// http://stackoverflow.com/questions/26965171/fast-nearest-power-of-2-in-javascript\nfunction pow2ceil(v) {\n v--;\n var p = 2;\n while (v >>= 1) {\n p <<= 1;\n }\n return p;\n}\n\nfunction pow2floor(v) {\n\n var p = 1;\n\n while (v >>= 1) {\n p <<= 1;\n }\n return p;\n}\n\nfunction getIndexInterpolate(value, valueBefore, valueAfter, indexBefore, indexAfter) {\n return (value - valueBefore) / (valueAfter - valueBefore) * (indexAfter - indexBefore) + indexBefore;\n}\n\nfunction euclidianSearch(targetX, targetY, haystackX, haystackY, scaleX = 1, scaleY = 1) {\n\n let distance = Number.MAX_VALUE,\n distance_i;\n\n let index = -1;\n\n for (var i = 0, l = haystackX.length; i < l; i++) {\n\n distance_i = Math.pow((targetX - haystackX[i]) * scaleX, 2) + Math.pow((targetY - haystackY[i]) * scaleY, 2);\n\n if (distance_i < distance) {\n\n index = i;\n distance = distance_i;\n }\n }\n\n return index;\n}\n\nfunction binarySearch(target, haystack, reverse) {\n\n let seedA = 0,\n length = haystack.length,\n seedB = length - 1,\n seedInt,\n i = 0,\n nanDirection = 1;\n\n if (haystack[seedA] == target) {\n return seedA;\n }\n\n if (haystack[seedB] == target) {\n return seedB;\n }\n\n while (true) {\n i++;\n if (i > 100) {\n throw 'Error loop';\n }\n\n seedInt = Math.floor((seedA + seedB) / 2);\n\n // seedInt -= seedInt % 2; // Always looks for an x.\n\n while (isNaN(haystack[seedInt])) {\n\n if (seedInt >= haystack.length - 1) {\n\n return haystack.length - 1;\n } else if (seedInt <= 0) {\n\n return 0;\n }\n\n seedInt += nanDirection;\n }\n\n if (seedInt == seedA || haystack[seedInt] == target || seedInt == seedB) {\n return seedInt;\n }\n\n // console.log(seedA, seedB, seedInt, haystack[seedInt]);\n if (haystack[seedInt] <= target) {\n if (reverse) {\n seedB = seedInt;\n } else {\n seedA = seedInt;\n }\n } else if (haystack[seedInt] > target) {\n if (reverse) {\n seedA = seedInt;\n } else {\n seedB = seedInt;\n }\n } else {\n return false;\n }\n\n nanDirection *= -1;\n }\n}\n\nWaveform.BELOW = Symbol();\nWaveform.ABOVE = Symbol();\n\nWaveform.BOX = Symbol();\nWaveform.BAR = Symbol();\n\nconst MULTIPLY = Symbol();\nconst ADD = Symbol();\nconst SUBTRACT = Symbol();\nconst DIVIDE = Symbol();\n\n\n//export default Waveform\n\n/**\n * Default graph parameters\n * @name Graph~GraphOptionsDefault\n * @name GraphOptions\n * @object\n * @static\n * @memberof Graph\n * @prop {String} title - Title of the graph\n * @prop {Number} paddingTop - The top padding\n * @prop {Number} paddingLeft - The left padding\n * @prop {Number} paddingRight - The right padding\n * @prop {Number} paddingBottom - The bottom padding\n * @prop {(Number|Boolean)} padding - A common padding value for top, bottom, left and right\n * @prop {Number} fontSize - The basic text size of the graphs\n * @prop {Number} fontFamily - The basic font family. Should be installed on the computer of the user\n * @prop {Object.} plugins - A list of plugins to import with their options\n * @prop {Object.} pluginAction - The default key combination to access those actions\n * @prop {Object.} mouseActions - Alias of pluginActions\n * @prop {Object.} keyActions - Defines what happens when keys are pressed\n * @prop {Object} wheel - Define the mouse wheel action\n * @prop {Object} dblclick - Define the double click action\n * @prop {Boolean} shapesUniqueSelection - true to allow only one shape to be selected at the time\n * @prop {Boolean} shapesUnselectOnClick - true to unselect all shapes on click\n */\nconst GraphOptionsDefault = {\n\n title: '',\n\n paddingTop: 30,\n paddingBottom: 5,\n paddingLeft: 20,\n paddingRight: 20,\n\n close: {\n left: true,\n right: true,\n top: true,\n bottom: true\n },\n\n closeColor: 'black',\n\n fontSize: 12,\n fontFamily: 'Myriad Pro, Helvetica, Arial',\n\n plugins: {},\n pluginAction: {},\n mouseActions: [],\n keyActions: [],\n wheel: {},\n dblclick: {},\n\n shapesUnselectOnClick: true,\n shapesUniqueSelection: true\n};\n\nconst defaultScatterStyle = {\n shape: 'circle',\n r: 4\n};\n\nvar _constructors = new Map();\n\n/**\n * Entry class of jsGraph that creates a new graph.\n * @extends EventEmitter\n * @tutorial basic\n */\nclass Graph$1 extends EventEmitter {\n\n /**\n * Graph constructor\n * @param {(HTMLElement|String)} [wrapper ] - The DOM Wrapper element its ```id``` property. If you do not use the wrapper during the graph creation, use it with the @link{Graph.setWrapper} method\n * @param {GraphOptions} [ options ] - The options of the graph\n * @param {Object} [ axis ] - The list of axes\n * @param {Array} axis.left - The list of left axes\n * @param {Array} axis.bottom - The list of bottom axes\n * @param {Array} axis.top - The list of top axes\n * @param {Array} axis.right - The list of right axes\n * @example var graph = new Graph(\"someDomID\");\n * @example var graph = new Graph(\"someOtherDomID\", { title: 'Graph title', paddingRight: 100 } );\n */\n constructor(wrapper, options, axis) {\n\n super();\n\n /*\n The unique ID of the graph\n @name Graph#uniqueid\n @type String\n */\n this._creation = guid();\n this._drawn = false;\n\n if (wrapper === Object(wrapper) && !(wrapper instanceof HTMLElement)) {\n // Wrapper is options\n axis = options;\n options = wrapper;\n wrapper = null;\n } else if (typeof wrapper == 'string') {\n wrapper = document.getElementById(wrapper);\n } else if (typeof wrapper.length == 'number') {\n wrapper = wrapper[0];\n }\n\n /**\n * @object\n * @memberof Graph\n * @name Graph#options\n * @type GraphOptions\n * @default {@link GraphOptionsDefault}\n * Access directly the options of the graph using this public object.\n * @example graph.options.mouseActions.push( { } );\n */\n this.options = extend({}, GraphOptionsDefault, options);\n // Options declaration must be placed before the doDom operation\n\n // doDom is a private method. We bind it to this thanks to ES6 features\n doDom.bind(this)();\n\n if (wrapper) {\n this.setWrapper(wrapper);\n }\n\n this.prevented = false;\n\n this.axis = {\n left: [],\n top: [],\n bottom: [],\n right: []\n };\n\n this.shapes = [];\n this.shapesLocked = false;\n this.plugins = {};\n\n for (var i in this.options.pluginAction) {\n this.options.pluginAction.plugin = i;\n this.options.mouseActions.push(this.options.pluginAction);\n }\n\n this.selectedShapes = [];\n\n this.series = [];\n //this._dom = wrapper;\n this._axesHaveChanged = true;\n\n if (this.options.hasOwnProperty('padding') && isNumeric$1(this.options.padding)) {\n this.options.paddingTop = this.options.paddingBottom = this.options.paddingLeft = this.options.paddingRight = this.options.padding;\n }\n\n this.currentAction = false;\n\n this.ns = Graph$1.ns;\n this.nsxlink = Graph$1.nsxlink;\n\n // Load all axes\n if (axis) {\n for (var i in axis) {\n for (var j = 0, l = axis[i].length; j < l; j++) {\n\n switch (i) {\n\n case 'top':\n this.getTopAxis(j, axis[i][j]);\n break;\n case 'left':\n this.getLeftAxis(j, axis[i][j]);\n break;\n case 'right':\n this.getRightAxis(j, axis[i][j]);\n break;\n case 'bottom':\n this.getBottomAxis(j, axis[i][j]);\n break;\n\n default:\n // Do not do anything\n break;\n }\n }\n }\n }\n\n this._pluginsInit();\n }\n\n setWrapper(wrapper) {\n\n if (!wrapper) {\n throw new Error('The wrapper DOM element was not found.');\n }\n\n if (!wrapper.appendChild) {\n throw new Error('The wrapper appears to be an invalid HTMLElement');\n }\n\n wrapper.style['-webkit-user-select'] = 'none';\n wrapper.style['-moz-user-select'] = 'none';\n wrapper.style['-o-user-select'] = 'none';\n wrapper.style['-ms-user-select'] = 'none';\n wrapper.style['user-select'] = 'none';\n\n wrapper.style.position = 'relative';\n wrapper.style.outline = 'none';\n\n // Why would that be necessary ?\n // wrapper.setAttribute( 'tabindex', 1 );\n\n this.wrapper = wrapper;\n\n // DOM\n\n if (!this.height || !this.width) {\n var wrapperStyle = getComputedStyle(wrapper);\n var w = parseInt(wrapperStyle.width, 10);\n var h = parseInt(wrapperStyle.height, 10);\n this.setSize(w, h);\n this._resize();\n }\n\n wrapper.appendChild(this.dom);\n\n _registerEvents(this);\n }\n /**\n * Returns the graph SVG wrapper element\n * @public\n * @return {SVGElement} The DOM element wrapping the graph\n */\n getDom() {\n return this.dom;\n }\n\n /**\n * Returns the unique id representing the graph\n * @public\n * @return {String} The unique ID of the graph\n */\n getId() {\n return this._creation;\n }\n\n /**\n * Returns the graph wrapper element passed during the graph creation\n * @public\n * @return {HTMLElement} The DOM element wrapping the graph\n */\n getWrapper() {\n return this.wrapper;\n }\n\n /**\n * Sets an option of the graph\n * @param {String} name - Option name\n * @param value - New option value\n * @returns {Graph} - Graph instance\n */\n setOption(name, val) {\n this.options[name] = val;\n return this;\n }\n\n /**\n * Sets the title of the graph\n */\n setTitle(title) {\n this.options.title = title;\n this.domTitle.textContent = title;\n }\n\n /**\n * Shows the title of the graph\n */\n displayTitle() {\n this.domTitle.setAttribute('display', 'inline');\n }\n\n /**\n * Hides the title of the graph\n */\n hideTitle() {\n this.domTitle.setAttribute('display', 'none');\n }\n\n hide() {\n if (this.dom.style.display !== 'none') {\n this.dom.style.display = 'none';\n }\n }\n\n show() {\n if (this.dom.style.display == 'none') {\n this.dom.style.display = 'initial';\n }\n }\n\n /**\n * Calls a repaint of the container. Used internally when zooming on the graph, or when .autoscaleAxes() is called (see {@link Graph#autoscaleAxes}).
\n * To be called after axes min/max are expected to have changed (e.g. after an axis.zoom( from, to )) has been called\n * @param {Boolean} onlyIfAxesHaveChanged - Triggers a redraw only if min/max values of the axes have changed.\n * @return {Boolean} if the redraw has been successful\n */\n redraw(onlyIfAxesHaveChanged, force) {\n\n if (!this.width || !this.height) {\n return;\n }\n\n if (!this.sizeSet) {\n this._resize();\n this.executeRedrawSlaves();\n return true;\n } else {\n\n if (!onlyIfAxesHaveChanged || force || haveAxesChanged(this) || hasSizeChanged(this)) {\n this.executeRedrawSlaves();\n refreshDrawingZone(this);\n return true;\n }\n }\n\n this.executeRedrawSlaves(true);\n return false;\n }\n\n executeRedrawSlaves() {\n this._pluginsExecute('preDraw');\n }\n\n /**\n * Draw the graph and the series. This method will only redraw what is necessary. You may trust its use when you have set new data to series, changed serie styles or called for a zoom on an axis.\n */\n draw(force) {\n\n this.drawn = true;\n this.updateLegend(true);\n this.drawSeries(this.redraw(true, force));\n\n this._pluginsExecute('postDraw');\n }\n\n /**\n * Prevents the graph, the series and the legend from redrawing automatically. Valid until {@link Graph#resumeUpdate} is called\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#resumeUpdate}\n * @see {@link Graph#doUpdate}\n * @since 1.16.19\n */\n delayUpdate() {\n this._lockUpdate = true;\n return this;\n }\n\n /**\n * Forces legend and graph update, even is {@link Graph#delayUpdate} has been called before.\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#delayUpdate}\n * @see {@link Graph#resumeUpdate}\n * @since 1.16.19\n */\n doUpdate() {\n if (this.legend) {\n this.legend.update();\n }\n this.draw();\n if (this.legend) {\n this.legend.update();\n }\n return this;\n }\n\n /**\n * Cancels the effect of {@link Graph#delayUpdate}, but does not redraw the graph automatically\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#delayUpdate}\n * @see {@link Graph#doUpdate}\n * @since 1.16.19\n */\n resumeUpdate() {\n this._lockUpdate = false;\n return this;\n }\n\n isDelayedUpdate() {\n return this._lockUpdate;\n }\n\n /**\n * Sets the total width of the graph\n * @param {Number} width - The new width of the graph\n * @param {Boolean} skipResize - true to defer graph repaint. Use {@link Graph#resize} to force repain later on. (Useful if many graph sizing operations are done successively)\n * @see Graph#setHeight\n * @see Graph#resize\n */\n setWidth(width, skipResize) {\n this.width = width;\n if (!skipResize) {\n this._resize();\n }\n }\n\n /**\n * Sets the total height of the graph\n * @param {Number} height - The new height of the graph\n * @param {Boolean} skipResize - true to defer graph repaint. Use {@link Graph#resize} to force repain later on. (Useful if many graph sizing operations are done successively)\n * @see Graph#setWidth\n * @see Graph#resize\n */\n setHeight(height, skipResize) {\n this.height = height;\n if (!skipResize) {\n this._resize();\n }\n }\n\n /**\n * Sets the new dimension of the graph and repaints it. If width and height are omitted, a simple refresh is done.\n * @param {Number} [ width ] - The new width of the graph\n * @param {Number} [ height ] - The new height of the graph\n * @see Graph#setWidth\n * @see Graph#setHeight\n * @return {Graph} The current graph\n */\n resize(w, h) {\n if (w && h) {\n this.setSize(w, h);\n }\n\n this._resize();\n return this;\n }\n\n /**\n * Sets the new dimension of the graph without repainting it. Use {@link Graph#resize} to perform the actual resizing of the graph.\n * @param {Number} [ width ] - The new width of the graph\n * @param {Number} [ height ] - The new height of the graph\n * @see Graph#setWidth\n * @see Graph#setHeight\n * @see Graph#resize\n */\n setSize(w, h) {\n this.setWidth(w, true);\n this.setHeight(h, true);\n this.getDrawingHeight();\n this.getDrawingWidth();\n }\n\n /**\n * Returns the width of the graph (set by setSize, setWidth or resize methods)\n * @return {Number} Width of the graph\n */\n getWidth() {\n return this.width;\n }\n\n /**\n * Returns the height of the graph (set by setSize, setHeight or resize methods)\n * @return {Number} Height of the graph\n */\n getHeight() {\n return this.height;\n }\n\n /**\n * Returns the top padding of the graph (space between the top of the svg container and the topmost axis)\n * @return {Number} paddingTop\n */\n getPaddingTop() {\n return this.options.paddingTop;\n }\n\n /**\n * Returns the left padding of the graph (space between the left of the svg container and the leftmost axis)\n * @return {Number} paddingTop\n */\n getPaddingLeft() {\n return this.options.paddingLeft;\n }\n\n /**\n * Returns the bottom padding of the graph (space between the bottom of the svg container and the bottommost axis)\n * @return {Number} paddingTop\n */\n getPaddingBottom() {\n return this.options.paddingBottom;\n }\n\n /**\n * Returns the right padding of the graph (space between the right of the svg container and the rightmost axis)\n * @return {Number} paddingRight\n */\n getPaddingRight() {\n return this.options.paddingRight;\n }\n\n /**\n * Returns the height of the drawable zone, including the space used by the axes\n * @param {Boolean} useCache - Use cached value. Useful if one is sure the graph hasn't changed dimension. Automatically called after a Graph.resize();\n * @returns {Number} Height of the graph\n */\n getDrawingHeight(useCache) {\n if (useCache && this.innerHeight) {\n return this.innerHeight;\n }\n return this.innerHeight = this.height - this.options.paddingTop - this.options.paddingBottom;\n }\n\n /**\n * Returns the width of the drawable zone, including the space used by the axes\n * @param {Boolean} useCache - Use cached value. Useful if one is sure the graph hasn't changed dimension. Automatically called after a Graph.resize();\n * @returns {Number} Width of the graph\n */\n getDrawingWidth(useCache) {\n if (useCache && this.innerWidth) {\n return this.innerWidth;\n }\n return this.innerWidth = this.width - this.options.paddingLeft - this.options.paddingRight;\n }\n\n /**\n * Caches the wrapper offset in the page.
\n * The position of the wrapper is used when processing most of mouse events and it is fetched via the jQuery function .offset().\n * If performance becomes a critical issue in your application, cacheOffset() should be used to store the offset position. It should be ensured that the graph doesn't move in the page. If one can know when the graph has moved, cacheOffset() should be called again to update the offset position.\n * @see Graph#uncacheOffset\n */\n cacheOffset() {\n this.offsetCached = getOffset(this.wrapper);\n }\n\n /**\n * Un-caches the wrapper offset value\n * @see Graph#cacheOffset\n */\n uncacheOffset() {\n this.offsetCached = false;\n }\n\n /**\n * Returns the x axis at a certain index. If any top axis exists and no bottom axis exists, returns or creates a top axis. Otherwise, creates or returns a bottom axis\n * Caution ! The options parameter will only be effective if an axis is created\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getXAxis(index, options) {\n if (this.axis.top.length > 0 && this.axis.bottom.length == 0) {\n return this.getTopAxis(index, options);\n }\n\n return this.getBottomAxis(index, options);\n }\n\n /**\n * Returns the y axis at a certain index. If any right axis exists and no left axis exists, returns or creates a right axis. Otherwise, creates or returns a left axis\n * Caution ! The options parameter will only be effective if an axis is created\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getYAxis(index, options) {\n\n if (this.axis.right.length > 0 && this.axis.left.length == 0) {\n return this.getRightAxis(index, options);\n }\n\n return this.getLeftAxis(index, options);\n }\n\n /**\n * Returns the top axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getTopAxis(index, options) {\n return _getAxis(this, index, options, 'top');\n }\n\n /**\n * Returns the bottom axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getBottomAxis(index, options) {\n return _getAxis(this, index, options, 'bottom');\n }\n\n /**\n * Returns the left axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getLeftAxis(index, options) {\n return _getAxis(this, index, options, 'left');\n }\n\n /**\n * Returns the right axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getRightAxis(index, options) {\n return _getAxis(this, index, options, 'right');\n }\n\n /**\n * Sets a bottom axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n */\n setXAxis(axis, index) {\n this.setBottomAxis(axis, index);\n }\n\n /**\n * Sets a left axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n */\n setYAxis(axis, index) {\n this.setLeftAxis(axis, index);\n }\n\n /**\n * Sets a left axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setTopAxis\n * @see Graph#setRightAxis\n * @see Graph#getLeftAxis\n * @see Graph#getYAxis\n */\n setLeftAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.left[index]) {\n this.axis.left[index].kill();\n }\n this.axis.left[index] = axis;\n }\n\n /**\n * Sets a right axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setLeftAxis\n * @see Graph#setTopAxis\n * @see Graph#getRightAxis\n * @see Graph#getYAxis\n */\n setRightAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.right[index]) {\n this.axis.right[index].kill();\n }\n this.axis.right[index] = axis;\n }\n\n /**\n * Sets a top axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setLeftAxis\n * @see Graph#setRightAxis\n * @see Graph#getBottomAxis\n * @see Graph#getXAxis\n */\n setTopAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.top[index]) {\n this.axis.top[index].kill();\n }\n this.axis.top[index] = axis;\n }\n\n /**\n * Sets a bottom axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setTopAxis\n * @see Graph#setLeftAxis\n * @see Graph#setRightAxis\n * @see Graph#getTopAxis\n * @see Graph#getXAxis\n */\n setBottomAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.bottom[index]) {\n this.axis.bottom[index].kill();\n }\n this.axis.bottom[index] = axis;\n }\n\n killAxis(axis, noRedraw = false, noSerieKill = false) {\n\n var index;\n\n if (axis.isX()) {\n\n if ((index = this.axis.bottom.indexOf(axis)) > -1) {\n this.axis.bottom.splice(index, 1);\n }\n\n if ((index = this.axis.top.indexOf(axis)) > -1) {\n this.axis.top.splice(index, 1);\n }\n\n if (!noSerieKill) {\n this.series.forEach(serie => {\n\n if (serie.getXAxis() == axis) {\n serie.kill();\n }\n });\n }\n }\n\n if (axis.isY()) {\n\n if ((index = this.axis.left.indexOf(axis)) > -1) {\n this.axis.left.splice(index, 1);\n }\n\n if ((index = this.axis.right.indexOf(axis)) > -1) {\n this.axis.right.splice(index, 1);\n }\n\n if (!noSerieKill) {\n this.series.forEach(serie => {\n\n if (serie.getYAxis() == axis) {\n serie.kill();\n }\n });\n }\n }\n\n this.axisGroup.removeChild(axis.group); // Removes all DOM\n this.groupPrimaryGrids.removeChild(axis.gridPrimary);\n this.groupSecondaryGrids.removeChild(axis.gridSecondary);\n\n if (!noRedraw) {\n this.draw(true);\n }\n }\n\n /**\n * Determines if an x axis belongs to the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasXAxis(axis) {\n return this.hasTopAxis(axis) || this.hasBottomAxis(axis);\n }\n\n /**\n * Determines if an x axis belongs to the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasYAxis(axis) {\n return this.hasLeftAxis(axis) || this.hasRightAxis(axis);\n }\n\n /**\n * Determines if an x axis belongs to top axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasTopAxis(axis) {\n return this.hasAxis(axis, this.axis.top);\n }\n\n /**\n * Determines if an x axis belongs to bottom axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasBottomAxis(axis) {\n return this.hasAxis(axis, this.axis.bottom);\n }\n\n /**\n * Determines if a y axis belongs to left axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasLeftAxis(axis) {\n return this.hasAxis(axis, this.axis.left);\n }\n\n /**\n * Determines if a y axis belongs to right axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasRightAxis(axis) {\n return this.hasAxis(axis, this.axis.right);\n }\n\n /**\n * Determines if an axis belongs to a list of axes\n * @param {Axis} axis - The axis instance to check\n * @param {Array} axisList - The list of axes to check\n * @private\n */\n hasAxis(axis, axisList) {\n for (var i = 0, l = axisList.length; i < l; i++) {\n if (axisList[i] == axis) {\n return true;\n }\n\n if (axisList[i].hasAxis(axis)) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Autoscales the x and y axes of the graph.\n * Does not repaint the canvas\n * @return {Graph} The current graph instance\n */\n autoscaleAxes() {\n\n this._applyToAxes('setMinMaxToFitSeries', null, true, true);\n\n //this._applyToAxes( \"scaleToFitAxis\", [ this.getYAxis() ], false, true )\n // X is not always ascending...\n return this;\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoscale() {\n return this.autoscaleAxes(...arguments);\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoScale() {\n return this.autoscaleAxes(...arguments);\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoScaleAxes() {\n return this.autoscaleAxes(...arguments);\n }\n\n // See #138\n /**\n * Autoscales a particular axis\n * @param {Axis} The axis to rescale\n * @return {Graph} The current graph instance\n */\n autoScaleAxis(axis) {\n if (!axis) {\n return this;\n }\n\n axis.setMinMaxToFitSeries();\n return this;\n }\n\n /**\n * Sets the background color\n * @param {String} color - An SVG accepted color for the background\n * @return {Graph} The current graph instance\n */\n setBackgroundColor(color) {\n\n this.rectEvent.setAttribute('fill', color);\n return this;\n }\n\n getAxisState() {\n\n var state = {};\n for (var i in this.axis) {\n state[i] = this.axis[i].map(function (axis) {\n return [axis.getCurrentMin(), axis.getCurrentMax()];\n });\n }\n return state;\n }\n\n setAxisState(state) {\n\n var j, l;\n for (var i in state) {\n\n if (!this.axis[i]) {\n continue;\n }\n\n for (j = 0, l = state[i].length; j < l; j++) {\n\n if (!this.axis[i][j]) {\n continue;\n }\n\n this.axis[i][j].setCurrentMin(state[i][j][0]);\n this.axis[i][j].setCurrentMax(state[i][j][1]);\n }\n }\n\n this.draw();\n }\n\n saveAxisState(savedName) {\n this.savedAxisState = this.savedAxisState || {};\n this.savedAxisState[savedName] = this.getAxisState();\n return this;\n }\n\n recallAxisState(savedName) {\n if (this.savedAxisState[savedName]) {\n this.recallAxisState(this.savedAxisState[savedName]);\n }\n return this;\n }\n\n _applyToAxis(type) {\n\n switch (type) {\n\n case 'string':\n return function (type, func, params) {\n // params.splice(1, 0, type);\n\n for (var i = 0; i < this.axis[type].length; i++) {\n this.axis[type][i][func].apply(this.axis[type][i], params);\n }\n };\n\n case 'function':\n return function (type, func, params) {\n for (var i = 0; i < this.axis[type].length; i++) {\n func.call(this, this.axis[type][i], type, params);\n }\n };\n\n default:\n throw new Error('You must either execute a function or provide a string that registers a function');\n }\n }\n\n /**\n * Calculates the minimal or maximal value of the axis. Currently, alias of getBoudaryAxisFromSeries\n */\n getBoundaryAxis(axis, minmax, usingZValues) {\n\n var valSeries = this.getBoundaryAxisFromSeries(axis, minmax, usingZValues);\n // var valShapes = this.getBoundaryAxisFromShapes( axis, xy, minmax );\n return valSeries;\n //return Math[ minmax ]( valSeries, valShapes );\n }\n\n /**\n * Calculates the minimal or maximal value of the axis, based on the series that belong to it. The value is computed so that all series just fit in the value.\n * @memberof Graph.prototype\n * @param {Axis} axis - The axis for which the value should be computed\n * @param {minmax} minmax - The minimum or maximum to look for. \"min\" for the minimum, anything else for the maximum\n * @returns {Number} The minimimum or maximum of the axis based on its series\n */\n getBoundaryAxisFromSeries(axis, minmax, usingZValues) {\n\n var min = minmax == 'min',\n val,\n func = axis.isX() ? ['getMinX', 'getMaxX'] : ['getMinY', 'getMaxY'],\n func2use = func[min ? 0 : 1],\n infinity2use = min ? +Infinity : -Infinity,\n serie,\n series,\n serieValue,\n i,\n l;\n\n val = infinity2use;\n series = this.getSeriesFromAxis(axis);\n\n for (i = 0, l = series.length; i < l; i++) {\n\n serie = series[i];\n\n if (!serie.isShown()) {\n continue;\n }\n\n serieValue = serie[func2use](usingZValues);\n val = Math[minmax](isNaN(val) ? infinity2use : val, isNaN(serieValue) ? infinity2use : serieValue);\n }\n\n return val;\n }\n\n /**\n * Returns all the series associated to an axis\n * @param {Axis} axis - The axis to which the series belong\n * @returns {Serie[]} An array containing the list of series that belong to the axis\n */\n getSeriesFromAxis(axis) {\n var series = [],\n i = this.series.length - 1;\n\n for (; i >= 0; i--) {\n if (this.series[i].getXAxis() == axis || this.series[i].getYAxis() == axis) {\n series.push(this.series[i]);\n }\n }\n\n return series;\n }\n\n /**\n * Determines the maximum and minimum of each axes, based on {@link Graph#getBoundaryAxis}. It is usually called internally, but if the data of series has changed, called this function to make sure that minimum / maximum of the axes are properly updated.\n * @see Graph#getBoundaryAxis\n */\n updateDataMinMaxAxes(usingZValues) {\n\n var axisvars = ['bottom', 'top', 'left', 'right'],\n axis,\n j,\n l,\n i;\n\n for (j = 0, l = axisvars.length; j < l; j++) {\n\n for (i = this.axis[axisvars[j]].length - 1; i >= 0; i--) {\n\n axis = this.axis[axisvars[j]][i];\n\n // 25.10.2017. Wait a second, this cannot be real. Even hidden axes must have min max values.\n // The data can be displayed while the axis is hidden\n // I assume this was added to cover another bug, but another approach must be chosen\n if (!axis.isShown()) {}\n // continue;\n\n\n //console.log( axisvars[ j ], this.getBoundaryAxisFromSeries( this.axis[ axisvars[ j ] ][ i ], xy, 'min'), this.getBoundaryAxisFromSeries( this.axis[ axisvars[ j ] ][ i ], xy, 'max') );\n\n let min = this.getBoundaryAxis(this.axis[axisvars[j]][i], 'min', usingZValues);\n let max = this.getBoundaryAxis(this.axis[axisvars[j]][i], 'max', usingZValues);\n\n if (isFinite(min)) {\n axis.setMinValueData(min);\n }\n\n if (isFinite(max)) {\n axis.setMaxValueData(max);\n }\n }\n }\n }\n\n /**\n * Function that is called from {@link Graph#_applyToAxes}\n * @function\n * @name AxisCallbackFunction\n * @param {Axis} axis - The axis of the function\n * @param {String} type - The type of the axis (left,right,top,bottom)\n * @param params - The params passed in the _applyToAxis function.\n * @see Graph#_applyToAxes\n */\n\n /**\n * Applies a function to axes. The function will be executed once for every axis.\n * If func is a string, the internal function belonging to the axis will be called, with the params array flattened out (in this case, params must be an array).\n * If func is a function, the function will be called with the axis, its type and params as parameters. See {@link AxisCallbackFunction} for more details.\n * @param {(AxisCallbackFunction|String)} func - The function or function name to execute\n * @param params - Extra parameters to pass to the function\n * @param {Boolean} topbottom=false - True to apply to function to top and bottom axes\n * @param {Boolean} leftright=false - True to apply to function to left and right axes\n */\n _applyToAxes(func, params, tb, lr) {\n\n var ax = [],\n i = 0,\n l;\n\n if (tb || tb == undefined) {\n ax.push('top');\n ax.push('bottom');\n }\n if (lr || lr == undefined) {\n ax.push('left');\n ax.push('right');\n }\n\n for (l = ax.length; i < l; i++) {\n this._applyToAxis(typeof func).call(this, ax[i], func, params);\n }\n }\n\n /**\n * Axes can be dependant of one another (for instance for unit conversions)\n * Finds and returns all the axes that are linked to a specific axis. Mostly used internally.\n * @param {Axis} axis - The axis that links one or multiple other dependant axes\n * @returns {Axis[]} The list of axes linked to the axis passed as parameter\n */\n findAxesLinkedTo(axis) {\n\n var axes = [];\n this._applyToAxes(function (a) {\n\n if (a.linkedToAxis && a.linkedToAxis.axis == axis) {\n axes.push(a);\n }\n }, {}, axis instanceof this.getConstructor('graph.axis.x'), axis instanceof this.getConstructor('graph.axis.y'));\n\n return axes;\n }\n\n _axisHasChanged() {\n this._axesHaveChanged = true;\n }\n\n /**\n * Creates a new serie.\n * If the a serie with the same name exists, returns this serie with update options.\n * The type of the serie is used to fetch the corresponding registered constructor registered with the name \"graph.serie.\", e.g \"line\" will fetch the \"graph.serie.line\" prototype (built-in)
\n * Built-in series types are \"line\", \"contour\", \"zone\" and \"scatter\".\n * @param {String} name - The name of the serie (unique)\n * @param {Object} options - The serie options\n * @param {Type} type - The type of the serie.\n * @returns {Serie} The newly created serie\n */\n newSerie(name, options, type) {\n\n let serie;\n\n if (typeof options !== 'object' && !type) {\n type = options;\n options = {};\n }\n\n if (!type) {\n type = Graph$1.SERIE_LINE;\n }\n\n if (serie = this.getSerie(name)) {\n return serie;\n }\n\n if (!(serie = makeSerie(this, name, options, type))) {\n return;\n }\n\n this.series.push(serie);\n this.emit('newSerie', serie);\n return serie;\n }\n\n /**\n * Looks for an existing serie by name or by index and returns it.\n * The index of the serie follows the creation sequence (0 for the first one, 1 for the second one, ...)\n * @param {(String|Number)} name - The name or the index of the serie\n * @returns {Serie}\n */\n getSerie(name) {\n\n if (typeof name == 'number') {\n return this.series[name] || false;\n }\n\n if (typeof name == 'function') {\n name = name();\n }\n\n var i = 0,\n l = this.series.length;\n\n for (; i < l; i++) {\n\n if (this.series[i].getName() == name || this.series[i] == name) {\n\n return this.series[i];\n }\n }\n\n return false;\n }\n\n /**\n * Returns all the series\n * @returns {Serie[]} An array of all the series\n */\n getSeries() {\n return this.series;\n }\n\n /**\n * Returns all the series that correspond to one or multiple types\n * @param {...Symbol} type - The serie types to select\n * @returns {Serie[]} An array of all the series\n * @example graph.allSeries( Graph.SERIE_LINE, Graph.SERIE_ZONE );\n */\n allSeries(...types) {\n\n return this.series.filter(serie => {\n return types.include(serie.getType());\n });\n }\n\n /**\n * Draws a specific serie\n * @param {Serie} serie - The serie to redraw\n * @param {Boolean} force - Forces redraw even if no data has changed\n */\n drawSerie(serie, force) {\n\n if (!serie.draw) {\n throw new Error('Serie has no method draw');\n }\n\n serie.draw(force);\n }\n\n /**\n * Redraws all visible series\n * @param {Boolean} force - Forces redraw even if no data has changed\n */\n drawSeries(force) {\n\n if (!this.width || !this.height) {\n return;\n }\n\n var i = this.series.length - 1;\n for (; i >= 0; i--) {\n if (this.series[i].isShown()) {\n this.drawSerie(this.series[i], force);\n }\n }\n }\n\n /**\n * @alias Graph#removeSeries\n */\n resetSeries() {\n this.removeSeries();\n }\n\n /**\n * @alias Graph#removeSeries\n */\n\n killSeries() {\n this.resetSeries();\n }\n\n /**\n * Removes all series from the graph\n */\n removeSeries() {\n while (this.series[0]) {\n this.series[0].kill(true);\n }\n this.series = [];\n\n if (this.legend) {\n this.legend.update();\n }\n }\n\n /**\n * Selects a serie. Only one serie per graph can be selected.\n * @param {Serie} serie - The serie to select\n * @param {String} selectName=\"selected\" - The name of the selection\n */\n selectSerie(serie, selectName) {\n\n if (!(typeof serie == 'object')) {\n serie = this.getSerie(serie);\n }\n\n if (this.selectedSerie == serie && this.selectedSerie.selectionType == selectName) {\n return;\n }\n\n if (this.selectedSerie !== serie && this.selectedSerie) {\n this.unselectSerie(this.selectedSerie);\n }\n\n this.selectedSerie = serie;\n this.triggerEvent('onSelectSerie', serie);\n\n serie.select(selectName || 'selected');\n }\n\n /**\n * Returns the selected serie\n * @returns {(Serie|undefined)} The selected serie\n */\n getSelectedSerie() {\n return this.selectedSerie;\n }\n\n /**\n * Unselects a serie\n * @param {Serie} serie - The serie to unselect\n */\n unselectSerie(serie) {\n\n if (!serie.unselect) {\n return;\n }\n\n serie.unselect();\n this.selectedSerie = false;\n this.triggerEvent('onUnselectSerie', serie);\n }\n\n /**\n * Returns all the shapes associated to a serie. Shapes can (but don't have to) be associated to a serie. The position of the shape can then be relative to the same axes as the serie.\n * @param {Serie} serie - The serie containing the shapes\n * @returns {Shape[]} An array containing a list of shapes associated to the serie\n */\n getShapesOfSerie(serie) {\n\n var shapes = [];\n var i = this.shapes.length - 1;\n\n for (; i >= 0; i--) {\n\n if (this.shapes[i].getSerie() == serie) {\n shapes.push(this.shapes[i]);\n }\n }\n\n return shapes;\n }\n makeToolbar(toolbarData) {\n\n var constructor = this.getConstructor('graph.toolbar');\n if (constructor) {\n return this.toolbar = new constructor(this, toolbarData);\n } else {\n return throwError('No constructor exists for toolbar');\n }\n }\n\n /**\n * Returns all shapes from the graph\n */\n getShapes() {\n return this.shapes || [];\n }\n\n /**\n * Creates a new shape. jsGraph will look for the registered constructor \"graph.shape.\".\n * @param {String} shapeType - The type of the shape\n * @param {Object} [shapeData] - The options passed to the shape creator\n * @param {Boolean} [mute=false] - true to create the shape quietly\n * @param {Object} [shapeProperties] - The native object containing the shape properties in the jsGraph format (caution when using it)\n * @returns {Shape} The created shape\n * @see Graph#getConstructor\n */\n newShape(shapeType, shapeData, mute = false, shapeProperties) {\n\n this.prevent(false);\n\n if (!mute) {\n\n this.emit('beforeNewShape', shapeData);\n\n if (this.prevent(false)) {\n return false;\n }\n }\n\n // Backward compatibility\n if (typeof shapeType == 'object') {\n mute = shapeData;\n shapeData = shapeType;\n shapeType = shapeData.type;\n }\n\n shapeData = shapeData || {};\n shapeData._id = guid();\n\n var constructor;\n if (typeof shapeType == 'function') {\n constructor = shapeType;\n } else {\n constructor = this.getConstructor('graph.shape.' + shapeType);\n }\n\n if (!constructor) {\n return throwError('No constructor for this shape');\n }\n\n var shape = new constructor(this, shapeData);\n\n if (!shape) {\n return throwError('Failed to construct shape.');\n }\n\n shape.type = shapeType;\n shape.graph = this;\n shape._data = shapeData;\n\n if (shapeData.properties !== undefined) {\n shape.setProperties(shapeData.properties);\n }\n\n shape.init(this, shapeProperties);\n\n if (shapeData.props !== undefined) {\n for (var i in shapeData.props) {\n shape.setProp(i, shapeData.props[i]);\n }\n }\n\n if (shapeData.position) {\n\n for (var i = 0, l = shapeData.position.length; i < l; i++) {\n shape.setPosition(new Position(shapeData.position[i]), i);\n }\n }\n\n /* Setting shape properties */\n if (shapeData.fillColor !== undefined) {\n shape.setFillColor(shapeData.fillColor);\n }\n\n if (shapeData.fillOpacity !== undefined) {\n shape.setFillOpacity(shapeData.fillOpacity);\n }\n\n if (shapeData.strokeColor !== undefined) {\n shape.setStrokeColor(shapeData.strokeColor);\n }\n\n if (shapeData.strokeWidth !== undefined) {\n shape.setStrokeWidth(shapeData.strokeWidth);\n }\n\n if (shapeData.layer !== undefined) {\n shape.setLayer(shapeData.layer);\n }\n\n if (shapeData.locked == true) {\n shape.lock();\n }\n\n if (shapeData.movable == true) {\n shape.movable();\n }\n\n if (shapeData.selectable == true) {\n shape.selectable();\n }\n\n if (shapeData.resizable == true) {\n shape.resizable();\n }\n\n if (shapeData.attributes !== undefined) {\n shape.setProp('attributes', shapeData.attributes);\n }\n\n if (shapeData.handles !== undefined) {\n shape.setProp('handles', shapeData.handles);\n }\n\n if (shapeData.selectOnMouseDown !== undefined) {\n shape.setProp('selectOnMouseDown', true);\n }\n\n if (shapeData.selectOnClick !== undefined) {\n shape.setProp('selectOnClick', true);\n }\n\n if (shapeData.transforms !== undefined && Array.isArray(shapeData.transforms)) {\n\n shapeData.transforms.forEach(({\n\n type,\n value\n\n }) => {\n\n shape.addTransform(type, value);\n });\n }\n\n if (shapeData.highlightOnMouseOver !== undefined) {\n shape.setProp('highlightOnMouseOver', true);\n }\n\n if (shapeData.labelEditable) {\n shape.setProp('labelEditable', shapeData.labelEditable);\n }\n\n if (shapeData.labels && !shapeData.label) {\n shapeData.label = shapeData.labels;\n }\n\n if (shapeData.label !== undefined) {\n\n if (!Array.isArray(shapeData.label)) {\n shapeData.label = [shapeData.label];\n }\n\n for (var i = 0, l = shapeData.label.length; i < l; i++) {\n\n shape.showLabel(i);\n shape.setLabelText(shapeData.label[i].text, i);\n shape.setLabelPosition(shapeData.label[i].position, i);\n shape.setLabelColor(shapeData.label[i].color || 'black', i);\n shape.setLabelSize(shapeData.label[i].size, i);\n shape.setLabelAngle(shapeData.label[i].angle || 0, i);\n shape.setLabelBaseline(shapeData.label[i].baseline || 'no-change', i);\n shape.setLabelAnchor(shapeData.label[i].anchor || 'start', i);\n shape.setLabelBackgroundColor(shapeData.label[i].backgroundColor || 'transparent', i);\n shape.setLabelBackgroundOpacity(shapeData.label[i].backgroundOpacity || 1, i);\n }\n }\n\n if (shapeData.serie) {\n shape.setSerie(this.getSerie(shapeData.serie));\n }\n shape.createHandles();\n shape.applyStyle();\n\n this.shapes.push(shape);\n\n if (!mute) {\n this.emit('newShape', shape, shapeData);\n }\n\n return shape;\n }\n\n /**\n * Creates a new position. Arguments are passed to the position constructor\n * @param {...*} varArgs\n * @see Position\n */\n newPosition(varArgs) {\n\n return new Position(...arguments);\n\n // 18 September 2016 Norman: What is that ?\n //Array.prototype.unshift.call( arguments, null );\n //return new( Function.prototype.bind.apply( GraphPosition, arguments ) )();\n }\n\n /**\n * Redraws all shapes. To be called if their definitions have changed\n */\n redrawShapes() {\n\n //this.graphingZone.removeChild(this.shapeZone);\n for (var i = 0, l = this.shapes.length; i < l; i++) {\n this.shapes[i].redraw();\n }\n //this.graphingZone.insertBefore(this.shapeZone, this.axisGroup);\n }\n\n /**\n * Removes all shapes from the graph\n */\n removeShapes() {\n for (var i = 0, l = this.shapes.length; i < l; i++) {\n if (this.shapes[i] && this.shapes[i].kill) {\n this.shapes[i].kill(true);\n }\n }\n this.shapes = [];\n }\n\n /**\n * Selects a shape\n * @param {Shape} shape - The shape to select\n * @param {Boolean} mute - Select the shape quietly\n */\n selectShape(shape, mute) {\n\n // Already selected. Returns false\n\n if (!shape) {\n return;\n }\n\n if (this.selectedShapes.indexOf(shape) > -1) {\n return false;\n }\n\n if (!shape.isSelectable()) {\n return false;\n }\n\n if (!mute) {\n this.emit('beforeShapeSelect', shape);\n }\n\n if (this.prevent(false)) {\n return;\n }\n\n if (this.selectedShapes.length > 0 && this.options.shapesUniqueSelection) {\n // Only one selected shape at the time\n\n this.unselectShapes(mute);\n }\n\n shape._select(mute);\n this.selectedShapes.push(shape);\n\n if (!mute) {\n this.emit('shapeSelect', shape);\n }\n }\n\n getSelectedShapes() {\n return this.selectedShapes;\n }\n\n /**\n * Unselects a shape\n * @param {Shape} shape - The shape to unselect\n * @param {Boolean} mute - Unselect the shape quietly\n */\n unselectShape(shape, mute) {\n\n if (this.selectedShapes.indexOf(shape) == -1) {\n return;\n }\n\n if (!mute) {\n this.emit('beforeShapeUnselect', shape);\n }\n\n if (this.cancelUnselectShape) {\n this.cancelUnselectShape = false;\n return;\n }\n\n shape._unselect();\n\n this.selectedShapes.splice(this.selectedShapes.indexOf(shape), 1);\n\n if (!mute) {\n this.emit('shapeUnselect', shape);\n }\n }\n\n /**\n * Unselects all shapes\n * @param {Boolean} [ mute = false ] - Mutes all unselection events\n * @return {Graph} The current graph instance\n */\n unselectShapes(mute) {\n\n while (this.selectedShapes[0]) {\n this.unselectShape(this.selectedShapes[0], mute);\n }\n\n return this;\n }\n\n _removeShape(shape) {\n this.shapes.splice(this.shapes.indexOf(shape), 1);\n }\n\n appendShapeToDom(shape) {\n\n if (shape.isHTML()) {\n this.wrapper.insertBefore(shape._dom, this.dom);\n }\n\n this.getLayer(shape.getLayer(), 'shape').appendChild(shape.group);\n }\n\n removeShapeFromDom(shape) {\n\n if (shape.isHTML()) {\n this.wrapper.removeChild(shape._dom);\n }\n\n this.getLayer(shape.getLayer(), 'shape').removeChild(shape.group);\n }\n\n appendSerieToDom(serie) {\n this.getLayer(serie.getLayer(), 'serie').appendChild(serie.groupMain);\n }\n\n removeSerieFromDom(serie) {\n this.getLayer(serie.getLayer(), 'serie').removeChild(serie.groupMain);\n }\n\n getLayer(layer, mode) {\n\n if (!this.layers[layer]) {\n\n this.layers[layer] = [];\n\n this.layers[layer][0] = document.createElementNS(Graph$1.ns, 'g');\n this.layers[layer][0].setAttribute('data-layer', layer);\n this.layers[layer][1] = document.createElementNS(Graph$1.ns, 'g');\n this.layers[layer][2] = document.createElementNS(Graph$1.ns, 'g');\n\n this.layers[layer][0].appendChild(this.layers[layer][1]);\n this.layers[layer][0].appendChild(this.layers[layer][2]);\n\n var i = 1,\n prevLayer;\n\n while (!(prevLayer = this.layers[layer - i]) && layer - i >= 0) {\n i++;\n }\n\n if (!prevLayer) {\n\n this.plotGroup.insertBefore(this.layers[layer][0], this.plotGroup.firstChild);\n } else if (prevLayer.nextSibling) {\n\n this.plotGroup.insertBefore(this.layers[layer][0], prevLayer.nextSibling);\n } else {\n\n this.plotGroup.appendChild(this.layers[layer][0]);\n }\n }\n\n return this.layers[layer][mode == 'shape' ? 2 : 1];\n }\n\n focus() {\n this.wrapper.focus();\n }\n\n elementMoving(movingElement) {\n this.bypassHandleMouse = movingElement;\n }\n\n stopElementMoving(element) {\n\n if (element && element == this.bypassHandleMouse) {\n this.bypassHandleMouse = false;\n } else if (!element) {\n this.bypassHandleMouse = false;\n }\n }\n\n _makeClosingLines() {\n\n this.closingLines = {};\n var els = ['top', 'bottom', 'left', 'right'],\n i = 0,\n l = 4;\n for (; i < l; i++) {\n var line = document.createElementNS(Graph$1.ns, 'line');\n line.setAttribute('stroke', this.options.closeColor);\n line.setAttribute('shape-rendering', 'crispEdges');\n line.setAttribute('stroke-linecap', 'square');\n line.setAttribute('display', 'none');\n this.closingLines[els[i]] = line;\n this.graphingZone.appendChild(line);\n }\n }\n\n isActionAllowed(e, action) {\n\n if (action.type !== e.type && (action.type !== undefined || e.type !== 'mousedown') && !((e.type === 'wheel' || e.type === 'mousewheel') && action.type == 'mousewheel')) {\n return;\n }\n\n if (action.enabled && (typeof action.enabled == 'function' ? !action.enabled(this) : !action.enabled)) {\n return;\n }\n\n if (action.key) {\n\n if (action.key !== e.keyCode) {\n\n let keyCheck = {\n 'backspace': 8,\n 'enter': 13,\n 'tab': 9,\n 'shift': 16,\n 'ctrl': 17,\n 'alt': 18,\n 'pause': 19,\n 'escape': 27,\n 'up': 33,\n 'down': 34,\n 'left': 37,\n 'right': 39\n };\n\n if (keyCheck[action.key] !== e.keyCode) {\n return;\n }\n }\n }\n\n if (action.shift === undefined) {\n action.shift = false;\n }\n\n if (action.ctrl === undefined) {\n action.ctrl = false;\n }\n\n if (action.meta === undefined) {\n action.meta = false;\n }\n\n if (action.alt === undefined) {\n action.alt = false;\n }\n\n return e.shiftKey == action.shift && e.ctrlKey == action.ctrl && e.metaKey == action.meta && e.altKey == action.alt;\n }\n\n forcePlugin(plugin) {\n this.forcedPlugin = plugin;\n }\n\n unforcePlugin() {\n this.forcedPlugin = false;\n }\n\n _pluginsExecute(funcName, ...args) {\n\n //\t\t\tArray.prototype.splice.apply(args, [0, 0, this]);\n\n for (var i in this.plugins) {\n\n if (this.plugins[i] && this.plugins[i][funcName]) {\n\n this.plugins[i][funcName].apply(this.plugins[i], args);\n }\n }\n }\n\n _pluginExecute(which, func, args) {\n\n //Array.prototype.splice.apply( args, [ 0, 0, this ] );\n if (!which) {\n return;\n }\n\n if (this.plugins[which] && this.plugins[which][func]) {\n\n this.plugins[which][func].apply(this.plugins[which], args);\n return true;\n }\n }\n\n pluginYieldActiveState() {\n this.activePlugin = false;\n }\n\n _serieExecute(serie, func, args) {\n\n if (typeof serie !== 'object') {\n serie = this.getSerie(serie);\n }\n\n if (typeof serie[func] == 'function') {\n serie.apply(serie, args);\n }\n }\n _pluginsInit() {\n\n var constructor, pluginName, pluginOptions;\n\n for (var i in this.options.plugins) {\n\n pluginName = i;\n pluginOptions = this.options.plugins[i];\n\n constructor = this.getConstructor('graph.plugin.' + pluginName);\n\n if (constructor) {\n\n //var options = util.extend( true, {}, constructor.defaults(), pluginOptions );\n this.plugins[pluginName] = new constructor(pluginOptions);\n\n mapEventEmission(this.plugins[pluginName].options, this.plugins[pluginName]);\n this.plugins[pluginName].init(this, pluginOptions);\n } else {\n throwError('Plugin \"' + pluginName + '\" has not been registered');\n }\n }\n }\n\n /**\n * Returns an initialized plugin\n * @param {String} pluginName\n * @returns {Plugin} The plugin which name is \n */\n getPlugin(pluginName) {\n var plugin = this.plugins[pluginName];\n\n if (!plugin) {\n return throwError('Plugin \"' + pluginName + '\" has not been loaded or properly registered');\n }\n\n return plugin;\n }\n triggerEvent() {\n var func = arguments[0];\n /*,\n args = Array.prototype.splice.apply( arguments, [ 0, 1 ] );\n */\n if (typeof this.options[func] == 'function') {\n return this.options[func].apply(this, arguments);\n }\n }\n\n /**\n * Creates a legend. Only one legend is allowed per graph\n * @param {Object} options - The legend options\n */\n makeLegend(options) {\n\n if (this.legend) {\n return this.legend;\n }\n\n var constructor = this.getConstructor('graph.legend');\n if (constructor) {\n this.legend = new constructor(this, options);\n } else {\n return throwError('Graph legend is not available as it has not been registered');\n }\n\n return this.legend;\n }\n\n /**\n * Redraws the legend if it exists\n * @param {Boolean} [ onlyIfRequired = false ] ```true``` to redraw the legend only when it actually needs to be updated\n * @return {Graph} The graph instance\n */\n updateLegend(onlyIfRequired = false) {\n\n if (!this.legend) {\n return;\n }\n\n this.legend.update(onlyIfRequired);\n return this;\n }\n\n /**\n * @returns {Legend} The legend item\n */\n getLegend() {\n if (!this.legend) {\n return;\n }\n\n return this.legend;\n }\n\n requireLegendUpdate() {\n\n if (!this.legend) {\n return;\n }\n\n this.legend.requireDelayedUpdate();\n }\n\n orthogonalProjectionSetup() {\n\n this.options.zAxis = extend(true, {\n maxZ: 10,\n minZ: 0,\n shiftX: -25,\n shiftY: -15,\n xAxis: this.getXAxis(),\n yAxis: this.getYAxis()\n });\n }\n\n orthogonalProjectionUpdate() {\n\n if (!this.zAxis) {\n this.zAxis = {\n g: document.createElementNS(Graph$1.ns, 'g'),\n l: document.createElementNS(Graph$1.ns, 'line')\n };\n\n this.zAxis.g.appendChild(this.zAxis.l);\n this.groupGrids.appendChild(this.zAxis.g);\n }\n\n let refAxisX = this.options.zAxis.xAxis;\n let refAxisY = this.options.zAxis.yAxis;\n\n var x0 = refAxisX.getMinPx();\n var y0 = refAxisY.getMinPx();\n\n var dx = refAxisX.getZProj(this.options.zAxis.maxZ);\n var dy = refAxisY.getZProj(this.options.zAxis.maxZ);\n\n this.zAxis.l.setAttribute('stroke', 'black');\n this.zAxis.l.setAttribute('x1', x0);\n this.zAxis.l.setAttribute('x2', x0 + dx);\n this.zAxis.l.setAttribute('y1', y0);\n this.zAxis.l.setAttribute('y2', y0 + dy);\n\n this.updateDataMinMaxAxes(true);\n\n var sort = this.series.map(serie => {\n return [serie.getZPos(), serie];\n });\n\n sort.sort((sa, sb) => {\n return sb[0] - sa[0];\n });\n\n let i = 0;\n sort.forEach(s => {\n s[1].setLayer(i);\n this.appendSerieToDom(s[1]);\n i++;\n });\n\n this.drawSeries(true);\n }\n\n /**\n * Kills the graph\n **/\n kill() {\n this.wrapper.removeChild(this.dom);\n }\n _removeSerie(serie) {\n this.series.splice(this.series.indexOf(serie), 1);\n this._pluginsExecute('serieRemoved', serie);\n }\n contextListen(target, menuElements, callback) {\n\n if (this.options.onContextMenuListen) {\n return this.options.onContextMenuListen(target, menuElements, callback);\n }\n }\n lockShapes() {\n this.shapesLocked = true;\n\n // Removes the current actions of the shapes\n for (var i = 0, l = this.shapes.length; i < l; i++) {\n this.shapes[i].moving = false;\n this.shapes[i].resizing = false;\n }\n }\n unlockShapes() {\n //\t\tconsole.log('unlock');\n this.shapesLocked = false;\n }\n prevent(arg) {\n var curr = this.prevented;\n if (arg != -1) {\n this.prevented = arg == undefined || arg;\n }\n return curr;\n }\n _getXY(e) {\n\n var x = e.clientX,\n y = e.clientY;\n\n var pos = this.offsetCached || getOffset(this.wrapper);\n\n x -= pos.left;\n y -= pos.top;\n\n return {\n x: x,\n y: y\n };\n }\n _resize() {\n\n if (!this.width || !this.height) {\n return;\n }\n\n this.getDrawingWidth();\n this.getDrawingHeight();\n\n this.sizeSet = true;\n this.dom.setAttribute('width', this.width);\n this.dom.setAttribute('height', this.height);\n this.domTitle.setAttribute('x', this.width / 2);\n\n this._sizeChanged = true;\n\n if (this.drawn) {\n this.requireLegendUpdate();\n this.draw(true);\n }\n }\n\n updateGraphingZone() {\n setAttributeTo(this.graphingZone, {\n 'transform': 'translate(' + this.options.paddingLeft + ', ' + this.options.paddingTop + ')'\n });\n\n this._sizeChanged = true;\n }\n\n // We have to proxy the methods in case they are called anonymously\n getDrawingSpaceWidth() {\n return () => this.drawingSpaceWidth;\n }\n\n getDrawingSpaceHeight() {\n return () => this.drawingSpaceHeight;\n }\n\n getDrawingSpaceMinX() {\n return () => this.drawingSpaceMinX;\n }\n\n getDrawingSpaceMinY() {\n return () => this.drawingSpaceMinY;\n }\n\n getDrawingSpaceMaxX() {\n return () => this.drawingSpaceMaxX;\n }\n\n getDrawingSpaceMaxY() {\n return () => this.drawingSpaceMaxY;\n }\n\n /**\n * Enables the line tracking\n * @param {Object|Boolean} options - Defines the tracking behavior. If a boolean, simply enables or disables the existing tracking.\n */\n trackingLine(options) {\n\n var self = this;\n\n if (typeof options === 'boolean') {\n\n if (this.options.trackingLine) {\n this.options.trackingLine.enable = options;\n }\n return;\n }\n\n if (options) {\n this.options.trackingLine = options;\n }\n\n options.series = options.series || [];\n options.enable = options.enable === undefined ? true : !!options.enable;\n\n // Individual tracking\n if (options.mode == 'individual') {\n\n if (options.series) {\n\n if (!Array.isArray(options.series)) {\n\n if (options.series == 'all') {\n\n options.series = this.series.map(serie => ({\n serie: serie\n }));\n } else {\n\n options.series = [options.series];\n }\n }\n\n options.series.forEach(sOptions => {\n\n if (typeof sOptions.serie !== 'object') {\n\n if (typeof sOptions !== 'object') {\n throw new Error('Misuse of the trackingLine() method. Each serie must be an object with the serie property: { series: [ { serie: jsGraphSerie, options: { ... someOptions } } ] }');\n }\n\n sOptions.serie = this.getSerie(sOptions.serie);\n }\n\n if (!sOptions.serie) {\n return;\n }\n\n self.addSerieToTrackingLine(sOptions.serie, sOptions);\n });\n }\n } else {\n\n options.series.forEach(serie => {\n serie.serie.disableTracking();\n });\n }\n\n if (options.noLine) {\n return;\n }\n\n if (!this.trackingObject) {\n // Avoid multiple creation of tracking lines\n\n // Creates a new shape called trackingLine, in the first layer (below everything)\n this.trackingObject = this.newShape('line', extend(true, {\n position: [{\n y: 'min'\n }, {\n y: 'max'\n }],\n stroke: 'black',\n layer: -1\n }, options.trackingLineShapeOptions));\n }\n\n this.trackingObject.draw();\n\n return this.trackingObject;\n }\n\n addSerieToTrackingLine(serie, options) {\n\n if (!this.options.trackingLine) {\n\n this.trackingLine({\n mode: 'individual'\n });\n }\n\n this.options.trackingLine.series.forEach((serieO, index) => {\n if (serieO.serie == serie) {\n this.options.trackingLine.series.splice(index, 1);\n }\n });\n\n this.options.trackingLine.series.push(Object.assign({\n serie: serie\n }, options));\n\n serie.enableTracking((serie, index, x, y) => {\n\n if (this.options.trackingLine.enable) {\n\n if (index) {\n\n if (this.trackingObject) {\n\n this.trackingObject.show();\n this.trackingObject.getPosition(0).x = index.trueX; //serie.getData()[ 0 ][ index.closestIndex * 2 ];\n this.trackingObject.getPosition(1).x = index.trueX; //serie.getData()[ 0 ][ index.closestIndex * 2 ];\n this.trackingObject.redraw();\n }\n\n serie._trackingLegend = _trackingLegendSerie(this, {\n serie: serie\n }, x, y, serie._trackingLegend, options.textMethod ? options.textMethod : output => {\n\n for (var i in output) {\n return output[i].serie.serie.getName() + ': ' + output[i].serie.serie.getYAxis().valueToHtml(output[i].yValue);\n }\n }, index.trueX);\n\n if (serie._trackingLegend) {\n serie._trackingLegend.style.display = 'block';\n }\n }\n }\n }, serie => {\n\n if (this.trackingObject) {\n this.trackingObject.hide();\n }\n\n if (serie.trackingShape) {\n serie.trackingShape.hide();\n }\n\n if (serie._trackingLegend) {\n serie._trackingLegend.style.display = 'none';\n }\n\n serie._trackingLegend = _trackingLegendSerie(this, {\n\n serie: serie\n\n }, false, false, serie._trackingLegend, false, false);\n });\n }\n\n /**\n * Pass here the katex.render method to be used later\n * @param {Function} renderer - katexRendered - renderer\n * @return {Graph} The current graph instance\n */\n setKatexRenderer(renderer) {\n this._katexRenderer = renderer;\n }\n\n hasKatexRenderer() {\n return !!this._katexRenderer;\n }\n\n renderWithKatex(katexValue, katexElement) {\n\n if (this._katexRenderer) {\n\n if (katexElement) {\n katexElement.removeChild(katexElement.firstChild);\n } else {\n katexElement = document.createElementNS(Graph$1.ns, 'foreignObject');\n }\n\n let div = document.createElement('div');\n\n katexElement.appendChild(div);\n this._katexRenderer(katexValue, div);\n\n return katexElement;\n }\n\n return false;\n }\n\n /**\n * Returns a graph created from a schema\n * @param {Object} schema - The schema (see https://github.com/cheminfo/json-chart/blob/master/chart-schema.json)\n * @param {HTMLElement} wrapper - The wrapping element\n * @returns {Graph} Newly created graph\n */\n static fromJSON(schema, wrapper) {\n\n let graph,\n options = {},\n axes = {\n left: [],\n top: [],\n right: [],\n bottom: []\n },\n style;\n\n if (schema.title) {\n options.title = schema.title;\n }\n\n if (schema.axis) {\n\n schema.axis.forEach(function (schemaAxis) {\n\n if (!schemaAxis.type) {\n throwError('Axis type is required (top, bottom, left or right)');\n }\n\n var axisOptions = {};\n if (schemaAxis.label) {\n axisOptions.labelValue = schemaAxis.label;\n }\n\n if (schemaAxis.unit !== undefined) {\n axisOptions.unit = schemaAxis.unit;\n }\n\n if (schemaAxis.unitWrapperAfter !== undefined) {\n axisOptions.unitWrapperAfter = schemaAxis.unitWrapperAfter;\n }\n\n if (schemaAxis.unitWrapperBefore !== undefined) {\n axisOptions.unitWrapperBefore = schemaAxis.unitWrapperBefore;\n }\n\n if (schemaAxis.min !== undefined) {\n axisOptions.forcedMin = schemaAxis.min;\n }\n\n if (schemaAxis.max !== undefined) {\n axisOptions.forcedMax = schemaAxis.max;\n }\n\n if (schemaAxis.flip !== undefined) {\n axisOptions.flipped = schemaAxis.flip;\n }\n\n axes[schemaAxis.type].push(axisOptions);\n schemaAxis._jsGraphIndex = axes[schemaAxis.type].length - 1;\n });\n }\n\n graph = new Graph$1(wrapper, options, axes);\n\n if (schema.width) {\n graph.setWidth(schema.width);\n }\n\n if (schema.height) {\n graph.setHeight(schema.width);\n }\n\n graph._resize();\n\n if (schema.data) {\n\n schema.data.forEach(function (schemaSerie) {\n\n var serieType = schemaSerie.type,\n serie,\n serieOptions = {},\n serieAxis;\n\n let waveform;\n\n switch (schemaSerie.type) {\n\n case 'bar':\n throwError('Bar charts not supported');\n serieType = false;\n break;\n\n case 'color':\n serieType = Graph$1.SERIE_LINE_COLORED;\n break;\n\n case 'scatter':\n serieType = Graph$1.SERIE_SCATTER;\n break;\n\n case 'box':\n serieType = Graph$1.SERIE_BOX;\n\n if (schemaSerie.orientation == 'x' || schemaSerie.orientation == 'y') {\n serieOptions.orientation = schemaSerie.orientation;\n }\n break;\n\n default:\n serieType = Graph$1.SERIE_LINE;\n break;\n }\n\n if (serieType !== Graph$1.SERIE_BOX) {\n waveform = Graph$1.newWaveform();\n }\n\n if (!serieType) {\n throwError('No valid serie type was found');\n return;\n }\n\n serie = graph.newSerie(schemaSerie.id || schemaSerie.label || guid(), serieOptions, serieType);\n\n if (schemaSerie.lineStyle) {\n\n let lineStyle;\n\n if (Array.isArray(lineStyle)) {\n lineStyle = {\n unselected: lineStyle\n };\n }\n\n Object.entries(lineStyle).forEach(([styleName, style]) => {\n\n var styleSerie = {};\n\n switch (serieType) {\n\n case Graph$1.SERIE_LINE:\n if (style.lineWidth !== undefined) {\n styleSerie.lineWidth = style.lineWidth;\n }\n\n if (style.color !== undefined) {\n styleSerie.lineColor = style.color;\n }\n\n if (style.lineStyle) {\n styleSerie.lineStyle = style.lineStyle;\n }\n\n serie.setStyle(styleSerie, styleName);\n break;\n }\n });\n }\n\n let defaultStyle = {};\n let defaultStyles = {};\n\n if (schemaSerie.defaultStyle) {\n defaultStyle = schemaSerie.defaultStyle;\n }\n\n if (schemaSerie.defaultStyles) {\n defaultStyles = schemaSerie.defaultStyles;\n }\n\n if (schemaSerie.styles) {\n\n let individualStyles;\n\n if (Array.isArray(schemaSerie.styles)) {\n individualStyles = {\n unselected: schemaSerie.styles\n };\n } else {\n individualStyles = schemaSerie.styles;\n }\n\n let styleNames = new Set(Object.keys(defaultStyles).concat(Object.keys(individualStyles)));\n\n styleNames.forEach(styleName => {\n\n let style = [],\n styles;\n\n if (individualStyles && individualStyles[styleName]) {\n\n style = individualStyles[styleName];\n\n if (!Array.isArray(style)) {\n style = [style];\n }\n\n styles = style.map(function (eachStyleElement) {\n\n switch (serieType) {\n\n case Graph$1.SERIE_LINE:\n\n return {\n type: eachStyleElement.shape,\n zoom: eachStyleElement.zoom,\n strokeWidth: eachStyleElement.lineWidth,\n strokeColor: eachStyleElement.lineColor,\n fillColor: eachStyleElement.color,\n points: eachStyleElement.points\n };\n\n break;\n\n case Graph$1.SERIE_BOX:\n\n return eachStyleElement;\n\n break;\n\n case Graph$1.SERIE_SCATTER:\n return eachStyleElement;\n\n break;\n }\n });\n }\n\n switch (serieType) {\n\n case Graph$1.SERIE_LINE:\n\n serie.setMarkers(styles, styleName);\n break;\n\n case Graph$1.SERIE_SCATTER:\n serie.setStyle(Object.assign({}, defaultScatterStyle, defaultStyle, defaultStyles[styleName] || {}), styles, styleName);\n break;\n\n case Graph$1.SERIE_BOX:\n\n serie.setStyle(styles[0], styleName || 'unselected');\n break;\n }\n });\n }\n\n if (schemaSerie.color && serieType == Graph$1.SERIE_LINE_COLORED) {\n serie.setColors(schemaSerie.color);\n }\n\n if (serieType !== Graph$1.SERIE_BOX) {\n waveform.setData(schemaSerie.y, schemaSerie.x);\n }\n\n if (!serie) {\n return;\n }\n\n let errorBarsXAbove = [],\n errorBarsXBelow = [],\n errorBarsYAbove = [],\n errorBarsYBelow = [],\n errorBoxesXAbove = [],\n errorBoxesXBelow = [],\n errorBoxesYAbove = [],\n errorBoxesYBelow = [];\n\n if (waveform !== undefined) {\n if (schemaSerie.errorX) {\n\n for (var i = 0, l = schemaSerie.errorX.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorX[i])) {\n\n errorBarsXAbove.push(schemaSerie.errorX[i][0]);\n errorBarsXBelow.push(schemaSerie.errorX[i][1]);\n } else {\n errorBarsXAbove.push(schemaSerie.errorX[i]);\n errorBarsXBelow.push(schemaSerie.errorX[i]);\n }\n }\n } else if (schemaSerie.errorBarX || schemaSerie.errorBoxX) {\n\n if (schemaSerie.errorBarX) {\n\n for (var i = 0, l = schemaSerie.errorBarX.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBarX[i])) {\n\n errorBarsXAbove.push(schemaSerie.errorBarX[i][0]);\n errorBarsXBelow.push(schemaSerie.errorBarX[i][1]);\n } else {\n errorBarsXAbove.push(schemaSerie.errorBarX[i]);\n errorBarsXBelow.push(schemaSerie.errorBarX[i]);\n }\n }\n }\n\n if (schemaSerie.errorBoxX) {\n\n for (var i = 0, l = schemaSerie.errorBoxX.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBoxX[i])) {\n\n errorBoxesXAbove.push(schemaSerie.errorBoxX[i][0]);\n errorBoxesXBelow.push(schemaSerie.errorBoxX[i][1]);\n } else {\n errorBoxesXAbove.push(schemaSerie.errorBoxX[i]);\n errorBoxesXBelow.push(schemaSerie.errorBoxX[i]);\n }\n }\n }\n }\n\n if (schemaSerie.errorY) {\n\n for (var i = 0, l = schemaSerie.errorY.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorY[i])) {\n\n errorBarsYAbove.push(schemaSerie.errorY[i][0]);\n errorBarsYBelow.push(schemaSerie.errorY[i][1]);\n } else {\n errorBarsYAbove.push(schemaSerie.errorY[i]);\n errorBarsYBelow.push(schemaSerie.errorY[i]);\n }\n }\n } else if (schemaSerie.errorBarY || schemaSerie.errorBoxY) {\n\n if (schemaSerie.errorBarY) {\n\n for (var i = 0, l = schemaSerie.errorBarY.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBarY[i])) {\n\n errorBarsYAbove.push(schemaSerie.errorBarY[i][0]);\n errorBarsYBelow.push(schemaSerie.errorBarY[i][1]);\n } else {\n errorBarsYAbove.push(schemaSerie.errorBarY[i]);\n errorBarsYBelow.push(schemaSerie.errorBarY[i]);\n }\n }\n }\n\n if (schemaSerie.errorBoxY) {\n\n for (var i = 0, l = schemaSerie.errorBoxY.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBoxY[i])) {\n\n errorBoxesYAbove.push(schemaSerie.errorBoxY[i][0]);\n errorBoxesYBelow.push(schemaSerie.errorBoxY[i][1]);\n } else {\n errorBoxesYAbove.push(schemaSerie.errorBoxY[i]);\n errorBoxesYBelow.push(schemaSerie.errorBoxY[i]);\n }\n }\n }\n }\n\n style = {};\n if (errorBarsXAbove.length > 0) {\n waveform.setErrorBarXAbove(Graph$1.newWaveform(errorBarsXAbove));\n style.right = {};\n }\n if (errorBarsXBelow.length > 0) {\n waveform.setErrorBarXAbove(Graph$1.newWaveform(errorBarsXAbove));\n style.left = {};\n }\n if (errorBarsYAbove.length > 0) {\n waveform.setErrorBarXAbove(Graph$1.newWaveform(errorBarsYAbove));\n style.top = {};\n }\n if (errorBarsYBelow.length > 0) {\n waveform.setErrorBarXAbove(Graph$1.newWaveform(errorBarsYAbove));\n style.bottom = {};\n }\n\n serie.setErrorBarStyle(style);\n\n style = {};\n if (errorBoxesXAbove.length > 0) {\n waveform.setErrorBoxXAbove(Graph$1.newWaveform(errorBoxesXAbove));\n style.right = {};\n }\n if (errorBoxesXBelow.length > 0) {\n waveform.setErrorBoxXBelow(Graph$1.newWaveform(errorBoxesXBelow));\n style.left = {};\n }\n if (errorBoxesYAbove.length > 0) {\n waveform.setErrorBoxAbove(Graph$1.newWaveform(errorBoxesYAbove));\n style.top = {};\n }\n if (errorBoxesYBelow.length > 0) {\n waveform.setErrorBoxBelow(Graph$1.newWaveform(errorBoxesYBelow));\n style.bottom = {};\n }\n serie.setErrorBoxStyle(style);\n }\n\n if (schema.axis) {\n serieAxis = schema.axis[schemaSerie.xAxis];\n\n if (!serieAxis || serieAxis.type !== 'top' && serieAxis.type !== 'bottom') {\n warn('No x axis found. Setting automatically');\n serie.setXAxis(graph.getXAxis(0));\n } else {\n if (serieAxis.type == 'top') {\n serie.setXAxis(graph.getTopAxis(serieAxis._jsGraphIndex));\n } else if (serieAxis.type == 'bottom') {\n serie.setXAxis(graph.getBottomAxis(serieAxis._jsGraphIndex));\n }\n }\n\n serieAxis = schema.axis[schemaSerie.yAxis];\n\n if (!serieAxis || serieAxis.type !== 'left' && serieAxis.type !== 'right') {\n warn('No y axis found. Setting automatically');\n serie.setYAxis(graph.getYAxis(0));\n } else {\n if (serieAxis.type == 'left') {\n serie.setYAxis(graph.getLeftAxis(serieAxis._jsGraphIndex));\n } else if (serieAxis.type == 'right') {\n serie.setYAxis(graph.getRightAxis(serieAxis._jsGraphIndex));\n }\n }\n } else {\n warn('No axes found. Setting automatically');\n serie.autoAxis();\n }\n\n switch (serieType) {\n\n case Graph$1.SERIE_BOX:\n\n serie.setData(schemaSerie.boxes);\n\n break;\n\n default:\n case Graph$1.SERIE_SCATTER:\n case Graph$1.SERIE_LINE_COLORED:\n case Graph$1.SERIE_LINE:\n\n serie.setWaveform(waveform);\n\n break;\n }\n });\n }\n\n graph.autoscaleAxes();\n graph.draw();\n\n return graph;\n }\n\n exportToSchema() {\n\n let schema = {};\n\n schema.title = this.options.title;\n\n schema.width = this.getWidth();\n schema.height = this.getHeight();\n\n let axesPositions = ['top', 'bottom', 'left', 'right'];\n let axesExport = [];\n let allaxes = {\n x: [],\n y: []\n };\n\n axesPositions.map(axisPosition => {\n\n if (!this.axis[axisPosition]) {\n return;\n }\n\n axesExport = axesExport.concat(this.axis[axisPosition].map(axis => {\n return {\n\n type: axisPosition,\n label: axis.options.label,\n unit: axis.options.unit,\n min: axis.options.forcedMin,\n max: axis.options.forcedMax,\n flip: axis.options.flipped\n\n };\n }));\n\n if (axisPosition == 'top' || axisPosition == 'bottom') {\n allaxes.x = allaxes.x.concat(this.axis[axisPosition]);\n } else {\n allaxes.y = allaxes.y.concat(this.axis[axisPosition]);\n }\n });\n\n schema.axis = axesExport;\n\n let seriesExport = [];\n\n let toType = type => {\n switch (type) {\n\n case Graph$1.SERIE_LINE:\n return 'line';\n break;\n\n case Graph$1.SERIE_BAR:\n return 'bar';\n break;\n\n case Graph$1.SERIE_LINE_COLORED:\n return 'color';\n break;\n\n case Graph$1.SERIE_SCATTER:\n return 'scatter';\n break;\n }\n };\n\n let exportData = (serie, x) => {\n\n let data = [];\n\n switch (serie.getType()) {\n\n case Graph$1.SERIE_LINE:\n\n for (var i = 0; i < serie.data.length; i++) {\n\n for (var j = 0; j < serie.data[i].length - 1; j += 2) {\n\n data.push(serie.data[i][j + (x && serie.isFlipped() || !x && !serie.isFlipped() ? 1 : 0)]);\n }\n }\n break;\n\n case Graph$1.SERIE_SCATTER:\n\n for (var j = 0; j < serie.data.length - 1; j += 2) {\n\n data.push(serie.data[i + (x && serie.isFlipped() || !x && !serie.isFlipped() ? 1 : 0)]);\n }\n\n break;\n }\n\n return data;\n };\n\n schema.data = seriesExport.concat(this.series.map(serie => {\n\n let style = [];\n let linestyle = [];\n\n if (serie.getType() == Graph$1.SERIE_LINE) {\n\n for (var stylename in serie.styles) {\n linestyle.push({\n styleName: stylename,\n color: serie.styles[stylename].lineColor,\n lineWidth: serie.styles[stylename].lineWidth,\n lineStyle: serie.styles[stylename].lineStyle\n });\n\n let styleObj = {\n styleName: stylename,\n styles: []\n };\n style.push(styleObj);\n\n styleObj.styles = styleObj.styles.concat((serie.styles[stylename].markers || []).map(markers => {\n return {\n shape: markers.type,\n zoom: markers.zoom,\n lineWidth: markers.strokeWidth,\n lineColor: markers.strokeColor,\n color: markers.fillColor,\n points: markers.points\n };\n }));\n }\n }\n\n return {\n label: serie.getLabel(),\n id: serie.getName(),\n type: toType(serie.getType()),\n x: exportData(serie, true),\n y: exportData(serie, false),\n xAxis: allaxes.x.indexOf(serie.getXAxis()),\n yAxis: allaxes.y.indexOf(serie.getYAxis()),\n style: style,\n lineStyle: linestyle\n };\n }));\n\n return schema;\n }\n\n /**\n * Registers a constructor to jsGraph. Constructors are used on a later basis by jsGraph to create series, shapes or plugins\n * @param {String} constructorName - The name of the constructor\n * @param {Function} constructor - The constructor method\n * @see Graph.getConstructor\n * @static\n */\n static registerConstructor(constructorName, constructor) {\n\n if (_constructors.has(constructorName)) {\n return throwError('Constructor ' + constructor + ' already exists.');\n }\n\n _constructors.set(constructorName, constructor);\n }\n\n /**\n * Returns a registered constructor\n * @param {String} constructorName - The constructor name to look for\n * @param {Boolean} [softFail = false ] - Fails silently if the constructor doesn't exist, and returns false\n * @returns {Function} The registered constructor\n * @throws Error\n * @see Graph.registerConstructor\n * @static\n */\n static getConstructor(constructorName, softFail = false) {\n\n if (!_constructors.has(constructorName)) {\n\n if (softFail) {\n return false;\n }\n\n return throwError('Constructor \"' + constructorName + \"\\\" doesn't exist\");\n }\n\n return _constructors.get(constructorName);\n }\n\n static newWaveform() {\n return new Waveform(...arguments);\n }\n\n static waveform() {\n return new Waveform(...arguments);\n }\n}\n\n// Adds getConstructor to the prototype. Cannot do that in ES6 classes\nGraph$1.prototype.getConstructor = Graph$1.getConstructor;\n\nfunction makeSerie(graph, name, options, type) {\n\n var constructor = graph.getConstructor(type, true);\n if (!constructor && typeof type == 'string') {\n constructor = graph.getConstructor('graph.serie.' + type, true);\n }\n\n if (constructor) {\n\n var serie = new constructor(graph, name, options);\n //serie.init( graph, name, options );\n graph.appendSerieToDom(serie);\n } else {\n\n return throwError('No constructor exists for the serie type provided. Use Graph.registerConstructor( name, constructor ) first is you use your own series');\n }\n\n return serie;\n}\n\nfunction getAxisLevelFromSpan(span, level) {\n\n for (var i = 0, l = level.length; i < l; i++) {\n\n var possible = true;\n for (var k = 0, m = level[i].length; k < m; k++) {\n\n if (!(span[0] < level[i][k][0] && span[1] < level[i][k][0] || span[0] > level[i][k][1] && span[1] > level[i][k][1])) {\n possible = false;\n }\n }\n\n if (possible) {\n\n level[i].push(span);\n return i;\n }\n }\n\n level.push([span]);\n return level.length - 1;\n}\n\nfunction refreshDrawingZone(graph) {\n\n var shift = {\n top: [],\n bottom: [],\n left: [],\n right: []\n };\n\n var levels = {\n top: [],\n bottom: [],\n left: [],\n right: []\n };\n\n graph._painted = true;\n // Apply to top and bottom\n\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n axis.hideGroup();\n return;\n } else {\n axis.showGroup();\n }\n\n if (axis.floating) {\n return;\n }\n\n var level = getAxisLevelFromSpan(axis.getSpan(), levels[position]);\n axis.setLevel(level);\n\n shift[position][level] = Math.max(axis.getAxisPosition(), shift[position][level] || 0);\n }, false, true, false);\n\n var shiftTop = shift.top.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n var shiftBottom = shift.bottom.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n graph.drawingSpaceHeight = graph.getDrawingHeight() - shiftTop - shiftBottom;\n\n [shift.top, shift.bottom].map(function (arr) {\n arr.reduce(function (prev, current, index) {\n arr[index] = prev + current;\n return prev + current;\n }, 0);\n });\n\n // Apply to top and bottom\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown() || axis.floating) {\n return;\n }\n\n axis.setShift(shift[position][axis.getLevel()]);\n }, false, true, false);\n\n // Applied to left and right\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n axis.hideGroup();\n // Don't return here. We need to go through the draw method as the axis must be assigned minPx and maxPx values.\n // This is because some series can still be visible although the axis isn't.\n } else {\n axis.showGroup();\n }\n\n axis.setMinPx(shiftTop);\n axis.setMaxPx(graph.getDrawingHeight(true) - shiftBottom);\n\n if (axis.floating) {\n return;\n }\n\n // First we need to draw it in order to determine the width to allocate\n // graph is done to accomodate 0 and 100000 without overlapping any element in the DOM (label, ...)\n\n // Let's not draw dependant axes yet\n let drawn = !axis.linkedToAxis ? axis.draw() : 0;\n\n if (!axis.isShown()) {\n return;\n }\n // Get axis position gives the extra shift that is common\n var level = getAxisLevelFromSpan(axis.getSpan(), levels[position]);\n axis.setLevel(level);\n shift[position][level] = Math.max(drawn, shift[position][level] || 0);\n }, false, false, true);\n\n var shift2 = extend(true, {}, shift);\n\n // Applied to left and right\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown() || axis.floating) {\n return;\n }\n\n shift2[position][axis.getLevel()] = Math.max(shift[position][axis.getLevel()], axis.equalizePosition(shift[position][axis.getLevel()]));\n }, false, false, true);\n\n shift = shift2;\n\n var shiftLeft = shift.left.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n var shiftRight = shift.right.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n graph.drawingSpaceWidth = graph.getDrawingWidth() - shiftLeft - shiftRight;\n\n [shift.left, shift.right].map(function (arr) {\n arr.reduce(function (prev, current, index) {\n arr[index] = prev + current;\n return prev + current;\n }, 0);\n });\n\n // Apply to left and right\n graph._applyToAxes((axis, position) => {\n\n if (!axis.isShown() || axis.floating) {\n return;\n }\n axis.setShift(shift[position][axis.getLevel()]);\n }, false, false, true);\n\n // Apply to top and bottom\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n // return;\n }\n\n axis.setMinPx(shiftLeft);\n axis.setMaxPx(graph.getDrawingWidth(true) - shiftRight);\n\n if (axis.floating) {\n return;\n }\n\n if (!axis.linkedToAxis) {\n axis.draw();\n }\n }, false, true, false);\n\n // Floating axes\n graph._applyToAxes(function (axis) {\n\n if (!axis.floating) {\n return;\n }\n\n var floatingAxis = axis.getFloatingAxis();\n var floatingValue = axis.getFloatingValue();\n var floatingPx = floatingAxis.getPx(floatingValue);\n\n axis.setShift(floatingPx);\n\n if (!axis.linkedToAxis) {\n axis.draw();\n }\n }, false, true, true);\n\n _closeLine(graph, 'right', graph.getDrawingWidth(true), graph.getDrawingWidth(true), shiftTop, graph.getDrawingHeight(true) - shiftBottom);\n _closeLine(graph, 'left', 0, 0, shiftTop, graph.getDrawingHeight(true) - shiftBottom);\n _closeLine(graph, 'top', shiftLeft, graph.getDrawingWidth(true) - shiftRight, 0, 0);\n _closeLine(graph, 'bottom', shiftLeft, graph.getDrawingWidth(true) - shiftRight, graph.getDrawingHeight(true) - shiftBottom, graph.getDrawingHeight(true) - shiftBottom);\n\n graph.clipRect.setAttribute('y', shiftTop);\n graph.clipRect.setAttribute('x', shiftLeft);\n graph.clipRect.setAttribute('width', graph.getDrawingWidth() - shiftLeft - shiftRight);\n graph.clipRect.setAttribute('height', graph.getDrawingHeight() - shiftTop - shiftBottom);\n\n graph.rectEvent.setAttribute('y', shiftTop + graph.getPaddingTop());\n graph.rectEvent.setAttribute('x', shiftLeft + graph.getPaddingLeft());\n\n graph.rectEvent.setAttribute('width', graph.drawingSpaceWidth);\n graph.rectEvent.setAttribute('height', graph.drawingSpaceHeight);\n\n graph.drawingSpaceMinX = shiftLeft + graph.getPaddingLeft(); // + \"px\";\n graph.drawingSpaceMinY = shiftTop + graph.getPaddingTop(); // + \"px\";\n graph.drawingSpaceMaxX = graph.getDrawingWidth() - shiftRight + graph.getPaddingLeft(); // + \"px\";\n graph.drawingSpaceMaxY = graph.getDrawingHeight() - shiftBottom + graph.getPaddingTop(); // + \"px\";\n\n // Apply to top and bottom\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n return;\n }\n\n axis.drawLines();\n }, false, true, true);\n\n /*\n graph.shapeZoneRect.setAttribute('x', shift[1]);\n graph.shapeZoneRect.setAttribute('y', shift[2]);\n graph.shapeZoneRect.setAttribute('width', graph.getDrawingWidth() - shift[2] - shift[3]);\n graph.shapeZoneRect.setAttribute('height', graph.getDrawingHeight() - shift[1] - shift[0]);\n */\n graph.shift = shift;\n graph.redrawShapes(); // Not sure this should be automatic here. The user should be clever.\n}\n\nfunction _handleKey(graph, event, type) {\n\n console.log(event, type);\n if (graph.forcedPlugin) {\n\n graph.activePlugin = graph.forcedPlugin;\n graph._pluginExecute(graph.activePlugin, type, [graph, event]);\n return;\n }\n\n checkKeyActions(graph, event, [graph, event], type);\n}\n\n// Similar to checkMouseActions\nfunction checkKeyActions(graph, e, parameters, methodName) {\n\n var keyComb = graph.options.keyActions,\n i,\n l;\n\n for (i = 0, l = keyComb.length; i < l; i++) {\n\n if (keyComb[i].plugin) {\n // Is it a plugin ?\n\n if (graph.forcedPlugin == keyComb[i].plugin || graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n graph.activePlugin = keyComb[i].plugin; // Lease the mouse action to the current action\n graph._pluginExecute(keyComb[i].plugin, methodName, parameters);\n\n e.preventDefault();\n e.stopPropagation();\n\n return true;\n }\n } else if (keyComb[i].callback && graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n keyComb[i].callback.apply(graph, parameters);\n return true;\n }\n\n if (keyComb[i].removeSelectedShape && graph.isActionAllowed(e, keyComb[i])) {\n\n e.preventDefault();\n e.stopPropagation();\n\n graph.selectedShapes.map(shape => {\n\n shape.kill(keyComb[i].keepInDom);\n });\n }\n\n /* else if ( keyComb[ i ].series ) {\n var series;\n if ( keyComb[ i ].series === 'all' ) {\n series = graph.series;\n }\n if ( !Array.isArray( keyComb[ i ].series ) ) {\n series = [ series ];\n }\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n for ( var j = 0; j < series.length; i++ ) {\n graph._serieExecute( series[ i ], methodName, parameters );\n }\n return true;\n }*/\n }\n\n return false;\n}\n\nfunction doDom() {\n\n // Create SVG element, set the NS\n this.dom = document.createElementNS(Graph$1.ns, 'svg');\n this.dom.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xlink', 'http://www.w3.org/1999/xlink');\n //this.dom.setAttributeNS(this.ns, 'xmlns:xlink', this.nsxml);\n setAttributeTo(this.dom, {\n 'xmlns': Graph$1.ns,\n 'font-family': this.options.fontFamily,\n 'font-size': this.options.fontSize\n });\n\n try {\n setAttributeTo(this.dom, {\n 'data-jsgraph-version': 'v<%= pkg.version %>'\n });\n } catch (e) {\n // ignore\n }\n\n this.defs = document.createElementNS(Graph$1.ns, 'defs');\n this.dom.appendChild(this.defs);\n\n this.groupEvent = document.createElementNS(Graph$1.ns, 'g');\n\n this.rectEvent = document.createElementNS(Graph$1.ns, 'rect');\n setAttributeTo(this.rectEvent, {\n 'pointer-events': 'fill',\n 'fill': 'transparent'\n });\n this.groupEvent.appendChild(this.rectEvent);\n\n this.dom.appendChild(this.groupEvent);\n\n // Handling graph title\n this.domTitle = document.createElementNS(Graph$1.ns, 'text');\n this.setTitle(this.options.title);\n setAttributeTo(this.domTitle, {\n 'text-anchor': 'middle',\n 'y': 20\n });\n this.groupEvent.appendChild(this.domTitle);\n //\n\n this.graphingZone = document.createElementNS(Graph$1.ns, 'g');\n this.updateGraphingZone();\n\n this.groupEvent.appendChild(this.graphingZone);\n\n /* this.shapeZoneRect = document.createElementNS(this.ns, 'rect');\n //this.shapeZoneRect.setAttribute('pointer-events', 'fill');\n this.shapeZoneRect.setAttribute('fill', 'transparent');\n this.shapeZone.appendChild(this.shapeZoneRect);\n */\n this.axisGroup = document.createElementNS(Graph$1.ns, 'g');\n this.graphingZone.appendChild(this.axisGroup);\n\n this.groupGrids = document.createElementNS(Graph$1.ns, 'g');\n\n // With the z stacking, this should probably be removed\n //this.groupGrids.setAttribute( 'clip-path', 'url(#_clipplot' + this._creation + ')' );\n\n this.groupPrimaryGrids = document.createElementNS(Graph$1.ns, 'g');\n this.groupSecondaryGrids = document.createElementNS(Graph$1.ns, 'g');\n\n this.axisGroup.appendChild(this.groupGrids);\n\n this.groupGrids.appendChild(this.groupSecondaryGrids);\n this.groupGrids.appendChild(this.groupPrimaryGrids);\n\n this.plotGroup = document.createElementNS(Graph$1.ns, 'g');\n this.graphingZone.appendChild(this.plotGroup);\n\n // 5 September 2014. I encountered a case here shapeZone must be above plotGroup\n /*this.shapeZone = document.createElementNS( this.ns, 'g' );\n this.graphingZone.appendChild( this.shapeZone );\n */\n\n this.layers = [];\n\n this._makeClosingLines();\n\n this.clip = document.createElementNS(Graph$1.ns, 'clipPath');\n this.clip.setAttribute('id', '_clipplot' + this._creation);\n this.defs.appendChild(this.clip);\n\n this.clipRect = document.createElementNS(Graph$1.ns, 'rect');\n this.clip.appendChild(this.clipRect);\n this.clip.setAttribute('clipPathUnits', 'userSpaceOnUse');\n\n this.markerArrow = document.createElementNS(this.ns, 'marker');\n this.markerArrow.setAttribute('viewBox', '0 0 10 10');\n this.markerArrow.setAttribute('id', 'arrow' + this._creation);\n this.markerArrow.setAttribute('refX', '6');\n this.markerArrow.setAttribute('refY', '5');\n this.markerArrow.setAttribute('markerUnits', 'strokeWidth');\n this.markerArrow.setAttribute('markerWidth', '8');\n this.markerArrow.setAttribute('markerHeight', '6');\n this.markerArrow.setAttribute('orient', 'auto');\n //this.markerArrow.setAttribute('fill', 'context-stroke');\n //this.markerArrow.setAttribute('stroke', 'context-stroke');\n\n var pathArrow = document.createElementNS(Graph$1.ns, 'path');\n pathArrow.setAttribute('d', 'M 0 0 L 10 5 L 0 10 z');\n //pathArrow.setAttribute( 'fill', 'context-stroke' );\n this.markerArrow.appendChild(pathArrow);\n\n this.defs.appendChild(this.markerArrow);\n\n // Horionzal split marker for axis\n this.markerHorizontalSplit = document.createElementNS(Graph$1.ns, 'marker');\n this.markerHorizontalSplit.setAttribute('viewBox', '0 0 6 8');\n this.markerHorizontalSplit.setAttribute('id', 'horionzalsplit_' + this.getId());\n this.markerHorizontalSplit.setAttribute('refX', '3');\n this.markerHorizontalSplit.setAttribute('refY', '4');\n this.markerHorizontalSplit.setAttribute('markerUnits', 'strokeWidth');\n this.markerHorizontalSplit.setAttribute('markerWidth', '6');\n this.markerHorizontalSplit.setAttribute('markerHeight', '8');\n\n var path = document.createElementNS(Graph$1.ns, 'line');\n path.setAttribute('x1', '0');\n path.setAttribute('y1', '8');\n\n path.setAttribute('x2', '6');\n path.setAttribute('y2', '0');\n\n path.setAttribute('stroke', 'black');\n this.markerHorizontalSplit.appendChild(path);\n\n this.defs.appendChild(this.markerHorizontalSplit);\n\n // Vertical split marker for axis\n this.markerVerticalSplit = document.createElementNS(Graph$1.ns, 'marker');\n this.markerVerticalSplit.setAttribute('viewBox', '0 0 8 6');\n this.markerVerticalSplit.setAttribute('id', 'verticalsplit_' + this.getId());\n this.markerVerticalSplit.setAttribute('refX', '4');\n this.markerVerticalSplit.setAttribute('refY', '3');\n this.markerVerticalSplit.setAttribute('markerUnits', 'strokeWidth');\n this.markerVerticalSplit.setAttribute('markerWidth', '8');\n this.markerVerticalSplit.setAttribute('markerHeight', '6');\n\n var path = document.createElementNS(Graph$1.ns, 'line');\n\n path.setAttribute('x1', '0');\n path.setAttribute('y1', '0');\n\n path.setAttribute('x2', '8');\n path.setAttribute('y2', '6');\n\n path.setAttribute('stroke', 'black');\n this.markerVerticalSplit.appendChild(path);\n this.defs.appendChild(this.markerVerticalSplit);\n\n this.vertLineArrow = document.createElementNS(Graph$1.ns, 'marker');\n this.vertLineArrow.setAttribute('viewBox', '0 0 10 10');\n this.vertLineArrow.setAttribute('id', 'verticalline' + this._creation);\n this.vertLineArrow.setAttribute('refX', '0');\n this.vertLineArrow.setAttribute('refY', '5');\n this.vertLineArrow.setAttribute('markerUnits', 'strokeWidth');\n this.vertLineArrow.setAttribute('markerWidth', '20');\n this.vertLineArrow.setAttribute('markerHeight', '10');\n this.vertLineArrow.setAttribute('orient', 'auto');\n //this.vertLineArrow.setAttribute('fill', 'context-stroke');\n //this.vertLineArrow.setAttribute('stroke', 'context-stroke');\n this.vertLineArrow.setAttribute('stroke-width', '1px');\n\n var pathVertLine = document.createElementNS(Graph$1.ns, 'path');\n pathVertLine.setAttribute('d', 'M 0 -10 L 0 10');\n pathVertLine.setAttribute('stroke', 'black');\n\n this.vertLineArrow.appendChild(pathVertLine);\n\n this.defs.appendChild(this.vertLineArrow);\n\n // Removed with z stacking ?\n // this.plotGroup.setAttribute( 'clip-path', 'url(#_clipplot' + this._creation + ')' );\n\n this.bypassHandleMouse = false;\n}\n\nfunction _registerEvents(graph) {\n if (!graph.wrapper) {\n throw 'No wrapper exists. Cannot register the events.';\n }\n\n graph.dom.setAttribute('tabindex', 0);\n\n graph.dom.addEventListener('keydown', e => {\n _handleKey(graph, e, 'keydown');\n });\n\n graph.dom.addEventListener('keypress', e => {\n _handleKey(graph, e, 'keypress');\n });\n\n graph.dom.addEventListener('keyup', e => {\n _handleKey(graph, e, 'keyup');\n });\n // Not sure this has to be prevented\n\n // August 17th, 2017: I extended the graph.groupEvent to the more general graph.dom to make the zoom plugin more\n // intuitive. Let us see if it breaks another example...\n graph.dom.addEventListener('mousemove', e => {\n //e.preventDefault();\n var coords = graph._getXY(e);\n _handleMouseMove(graph, coords.x, coords.y, e);\n });\n\n graph.dom.addEventListener('mouseleave', e => {\n\n _handleMouseLeave(graph);\n });\n\n graph.groupEvent.addEventListener('mousedown', e => {\n\n graph.focus();\n\n // e.preventDefault();\n if (e.which == 3 || e.ctrlKey) {\n return;\n }\n\n var coords = graph._getXY(e);\n _handleMouseDown(graph, coords.x, coords.y, e);\n });\n\n graph.dom.addEventListener('mouseup', e => {\n\n graph.emit('mouseUp', e);\n var coords = graph._getXY(e);\n\n _handleMouseUp(graph, coords.x, coords.y, e);\n });\n\n graph.wrapper.addEventListener('mouseup', e => {\n e.stopPropagation();\n });\n\n graph.dom.addEventListener('dblclick', e => {\n\n graph.emit('dblClick', e);\n var coords = graph._getXY(e);\n\n _handleDblClick(graph, coords.x, coords.y, e);\n });\n\n graph.groupEvent.addEventListener('click', e => {\n\n // Cancel right click or Command+Click\n if (e.which == 3 || e.ctrlKey) {\n return;\n }\n\n // e.preventDefault();\n var coords = graph._getXY(e);\n\n if (!graph.prevent(false)) {\n _handleClick(graph, coords.x, coords.y, e);\n }\n\n //}, 200 );\n });\n\n graph.groupEvent.addEventListener('mousewheel', e => {\n\n var deltaY = e.wheelDeltaY || e.wheelDelta || -e.deltaY;\n var coords = graph._getXY(e);\n _handleMouseWheel(graph, deltaY, coords.x, coords.y, e);\n\n return false;\n });\n\n graph.groupEvent.addEventListener('wheel', e => {\n\n var coords = graph._getXY(e);\n var deltaY = e.wheelDeltaY || e.wheelDelta || -e.deltaY;\n _handleMouseWheel(graph, deltaY, coords.x, coords.y, e);\n\n return false;\n });\n}\n\nfunction _handleMouseDown(graph, x, y, e) {\n\n if (graph.forcedPlugin) {\n\n graph.activePlugin = graph.forcedPlugin;\n graph._pluginExecute(graph.activePlugin, 'onMouseDown', [graph, x, y, e]);\n return;\n }\n\n if (graph.activePlugin) {\n graph.activePlugin = false;\n }\n\n checkMouseActions(graph, e, [graph, x, y, e], 'onMouseDown');\n}\n\nfunction _handleMouseMove(graph, x, y, e) {\n\n if (graph.bypassHandleMouse) {\n graph.bypassHandleMouse.handleMouseMove(e);\n return;\n }\n\n if (graph.activePlugin && graph._pluginExecute(graph.activePlugin, 'onMouseMove', [graph, x, y, e])) {\n return;\n }\n\n //\t\t\treturn;\n\n graph._applyToAxes('handleMouseMove', [x - graph.options.paddingLeft, e], true, false);\n graph._applyToAxes('handleMouseMove', [y - graph.options.paddingTop, e], false, true);\n\n if (!graph.activePlugin) {\n var index;\n\n // Takes care of the tracking line\n if (graph.options.trackingLine && graph.options.trackingLine.enable && graph.options.trackingLine.snapToSerie) {\n\n if (graph.options.trackingLine.mode == 'common') {\n\n var snapToSerie = graph.options.trackingLine.snapToSerie;\n index = snapToSerie.handleMouseMove(false, true);\n\n if (this.trackingObject) {\n\n if (!index) {\n\n graph.trackingObject.hide();\n } else {\n\n graph.trackingObject.show();\n\n graph.trackingObject.getPosition(0).x = index.xClosest;\n graph.trackingObject.getPosition(1).x = index.xClosest;\n graph.trackingObject.redraw();\n\n var x = snapToSerie.getXAxis().getPx(index.xClosest) + graph.options.paddingLeft;\n }\n }\n\n var series = graph.options.trackingLine.series;\n\n // Gets a default value\n if (!series) {\n\n series = graph.getSeries().map(function (serie) {\n return {\n serie: serie,\n withinPx: 20,\n withinVal: -1\n };\n });\n }\n\n graph._trackingLegend = _trackingLegendSerie(graph, series, x, y, graph._trackingLegend, graph.options.trackingLine.textMethod, index.xClosest);\n }\n }\n }\n // End takes care of the tracking line\n\n if (graph.options.onMouseMoveData) {\n var results = {};\n\n for (var i = 0; i < graph.series.length; i++) {\n\n results[graph.series[i].getName()] = graph.series[i].handleMouseMove(false, true);\n }\n\n graph.options.onMouseMoveData.call(graph, e, results);\n }\n\n checkMouseActions(graph, e, [graph, x, y, e], 'onMouseMove');\n}\n\nfunction checkMouseActions(graph, e, parameters, methodName) {\n\n var keyComb = graph.options.mouseActions,\n i,\n l,\n executed = false;\n\n for (i = 0, l = keyComb.length; i < l; i++) {\n\n if (keyComb[i].plugin) {\n // Is it a plugin ?\n\n if (graph.forcedPlugin == keyComb[i].plugin || graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n // Lease the mouse action to the current action\n // 25.10.2017: Except for mousewheel. See #111\n if (e.type !== 'wheel' && e.type !== 'mousewheel') {\n graph.activePlugin = keyComb[i].plugin;\n }\n\n graph._pluginExecute(keyComb[i].plugin, methodName, parameters);\n executed = true;\n continue;\n }\n } else if (keyComb[i].callback && graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n keyComb[i].callback.apply(graph, parameters);\n executed = true;\n continue;\n } else if (keyComb[i].series) {\n\n var series;\n if (keyComb[i].series === 'all') {\n series = graph.series;\n }\n\n if (!Array.isArray(keyComb[i].series)) {\n series = [series];\n }\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n for (var j = 0; j < series.length; i++) {\n graph._serieExecute(series[i], methodName, parameters);\n }\n executed = true;\n continue;\n }\n }\n\n return executed;\n}\n\nvar _trackingLegendSerie = function (graph, serie, x, y, legend, textMethod, xValue) {\n\n var justCreated = false;\n\n if (!Array.isArray(serie)) {\n serie = [serie];\n }\n\n var output = [];\n\n if (!legend && graph.options.trackingLine.legend) {\n justCreated = true;\n legend = _makeTrackingLegend(graph);\n }\n\n serie.map(serie => {\n\n var index = serie.serie.handleMouseMove(xValue, false);\n\n if (!index || !textMethod) {\n\n if (serie.serie.trackingShape) {\n serie.serie.trackingShape.hide();\n }\n\n return legend;\n }\n\n // Should we display the dot ?\n if (serie.withinPx > 0 && Math.abs(x - graph.options.paddingLeft - serie.serie.getXAxis().getPx(index.xClosest)) - serie.withinPx > 1e-14 || serie.withinVal > 0 && Math.abs(serie.serie.getXAxis().getVal(x - graph.options.paddingLeft) - index.xClosest) - serie.withinVal > serie.serie.getXAxis().getVal(x - graph.options.paddingLeft) / 100000) {\n\n if (serie.serie.trackingShape) {\n serie.serie.trackingShape.hide();\n }\n } else {\n\n output[serie.serie.getName()] = {\n\n yValue: index.xClosest,\n xValue: index.yClosest,\n serie: serie,\n index: index\n\n };\n\n let serieShape;\n if (graph.options.trackingLine && graph.options.trackingLine.serieShape) {\n serieShape = graph.options.trackingLine.serieShape;\n } else {\n serieShape = {\n shape: 'ellipse',\n properties: {\n rx: [serie.serie.getLineWidth() * 3 + 'px'],\n ry: [serie.serie.getLineWidth() * 3 + 'px']\n }\n };\n }\n\n if (!serie.serie.trackingShape) {\n\n serie.serie.trackingShape = graph.newShape(serieShape.shape, {\n fillColor: serie.serie.getLineColor(),\n strokeColor: 'White',\n strokeWidth: serie.serie.getLineWidth()\n }, true, serieShape.properties).setSerie(serie.serie).forceParentDom(serie.serie.groupMain).draw();\n\n serieShape.onCreated && serieShape.onCreated(serie.serie.trackingShape);\n\n serie.serie.trackingShape.on('changed', () => {\n\n serieShape.onChanged && serieShape.onChanged(serie.serie.trackingShape);\n });\n }\n\n serie.serie.trackingShape.show();\n serie.serie.trackingShape.getPosition(0).x = index.xClosest;\n\n if (serieShape.magnet) {\n\n let magnetOptions = serieShape.magnet,\n val = magnetOptions.within,\n minmaxpos;\n\n if (magnetOptions.withinPx) {\n val = serie.serie.getXAxis().getRelVal(magnetOptions.withinPx);\n }\n\n if (minmaxpos = serie.serie.findLocalMinMax(index.xClosest, val, magnetOptions.mode)) {\n\n serie.serie.trackingShape.getPosition(0).x = minmaxpos;\n }\n }\n\n serie.serie.trackingShape.redraw();\n }\n }); // End map\n\n if (!graph.options.trackingLine.legend) {\n return;\n }\n\n if (Object.keys(output).length == 0 || !textMethod) {\n legend.style.display = 'none';\n } else {\n\n if (legend.style.display == 'none' || justCreated) {\n\n forceTrackingLegendMode(graph, legend, x, y, true);\n } else {\n _trackingLegendMove(graph, legend, x, y);\n }\n\n legend.style.display = 'block';\n var txt = textMethod(output, xValue, x, y);\n\n legend.innerHTML = txt;\n\n //legend.innerHTML = textMethod( output, xValue, x, y );\n }\n\n return legend;\n};\n\nvar forceTrackingLegendMode = function (graph, legend, toX, toY, skip) {\n\n var ratio = 0,\n start = Date.now(),\n h = legend.offsetHeight,\n startX = parseInt(legend.style.marginLeft.replace('px', '') || 0),\n startY = parseInt(legend.style.marginTop.replace('px', '') || 0);\n\n toX = toX > graph.getWidth() / 2 ? toX - toX % 10 - 20 - legend.offsetWidth : toX - toX % 10 + 30;\n toY = toY - toY % 10 + h / 2;\n\n if (skip) {\n legend.style.marginLeft = toX + 'px';\n legend.style.marginTop = toY + 'px';\n return;\n }\n\n function next() {\n\n var progress = (Date.now() - start) / 200;\n if (progress > 1) {\n progress = 1;\n }\n\n legend.style.marginLeft = (toX - startX) * progress + startX + 'px';\n legend.style.marginTop = (toY - startY) * progress + startY + 'px';\n\n if (progress < 1) {\n window.requestAnimationFrame(next);\n }\n }\n\n window.requestAnimationFrame(next);\n};\n\nvar _trackingLegendMove = debounce(forceTrackingLegendMode, 50);\n\nfunction _makeTrackingLegend(graph) {\n\n var group = document.createElement('div');\n group.setAttribute('class', 'trackingLegend');\n group.style.position = 'absolute';\n group.style.borderRadius = '4px';\n group.style.boxShadow = '1px 1px 3px 0px rgba(100,100,100,0.6)';\n group.style.border = '2px solid #333333';\n group.style.backgroundColor = 'rgba(255, 255, 255, 0.5 )';\n group.style.pointerEvents = 'none';\n group.style.paddingTop = '5px';\n group.style.paddingBottom = '5px';\n group.style.paddingLeft = '10px';\n group.style.paddingRight = '10px';\n\n graph.getWrapper().insertBefore(group, graph.getDom());\n\n return group;\n}\n\nfunction _handleDblClick(graph, x, y, e) {\n //\tvar _x = x - graph.options.paddingLeft;\n //\tvar _y = y - graph.options.paddingTop;\n var pref = graph.options.dblclick;\n checkMouseActions(graph, e, [x, y, e], 'onDblClick');\n /*\n if ( !pref || !pref.type ) {\n return;\n }\n switch ( pref.type ) {\n case 'plugin':\n var plugin;\n if ( ( plugin = graph.plugins[ pref.plugin ] ) ) {\n plugin.onDblClick( graph, x, y, pref.options, e );\n }\n break;\n }*/\n}\n\nfunction _handleMouseUp(graph, x, y, e) {\n\n if (graph.bypassHandleMouse) {\n graph.bypassHandleMouse.handleMouseUp(e);\n graph.activePlugin = false;\n return;\n }\n\n graph._pluginExecute(graph.activePlugin, 'onMouseUp', [graph, x, y, e]);\n graph.activePlugin = false;\n}\n\nfunction _handleClick(graph, x, y, e) {\n\n graph.emit('click', [graph, x, y, e]);\n // Not on a shape\n checkMouseActions(graph, e, [x, y, e], 'onClick');\n\n if (!e.target.jsGraphIsShape && !graph.prevent(false) && graph.options.shapesUnselectOnClick) {\n\n graph.unselectShapes();\n }\n}\n\nfunction _getAxis(graph, num, options, pos) {\n\n var options = options || {};\n var inst;\n\n var _availableAxes = {\n\n def: {\n x: graph.getConstructor('graph.axis.x'),\n y: graph.getConstructor('graph.axis.y')\n },\n\n time: {\n x: graph.getConstructor('graph.axis.x.time')\n },\n\n bar: {\n x: graph.getConstructor('graph.axis.x.bar')\n }\n };\n\n switch (options.type) {\n\n case 'time':\n var axisInstance = _availableAxes.time;\n break;\n\n case 'bar':\n var axisInstance = _availableAxes.bar;\n break;\n\n case 'broken':\n var axisInstance = _availableAxes.broken;\n break;\n\n default:\n var axisInstance = _availableAxes.def;\n break;\n }\n\n switch (pos) {\n\n case 'top':\n case 'bottom':\n inst = axisInstance.x;\n break;\n\n case 'left':\n case 'right':\n inst = axisInstance.y;\n break;\n }\n\n num = num || 0;\n\n if (typeof num == 'object') {\n options = num;\n num = 0;\n }\n\n if (!graph.axis[pos][num]) {\n\n graph.axis[pos][num] = new inst(graph, pos, options);\n graph.axis[pos][num].init(graph, options);\n }\n\n return graph.axis[pos][num];\n}\n\nfunction _closeLine(graph, mode, x1, x2, y1, y2) {\n\n if (graph.options.close === false) {\n return;\n }\n\n var l = 0;\n\n graph.axis[mode].map(function (g) {\n\n if (g.isDisplayed() && !g.floating) {\n l++;\n }\n });\n\n if ((graph.options.close === true || graph.options.close[mode]) && l == 0) {\n\n graph.closingLines[mode].setAttribute('display', 'block');\n graph.closingLines[mode].setAttribute('x1', x1);\n graph.closingLines[mode].setAttribute('x2', x2);\n graph.closingLines[mode].setAttribute('y1', y1);\n graph.closingLines[mode].setAttribute('y2', y2);\n } else {\n\n graph.closingLines[mode].setAttribute('display', 'none');\n }\n}\n\nfunction _handleMouseWheel(graph, delta, coordX, coordY, e) {\n if (checkMouseActions(graph, e, [delta, e, coordX, coordY], 'onMouseWheel')) {\n e.preventDefault();\n e.stopPropagation();\n }\n}\n\nfunction _handleMouseLeave(graph) {\n if (graph.options.handleMouseLeave) {\n graph.options.handleMouseLeave.call(graph);\n }\n}\n\nfunction haveAxesChanged(graph) {\n var temp = graph._axesHaveChanged;\n graph._axesHaveChanged = false;\n return temp;\n}\n\nfunction hasSizeChanged(graph) {\n var temp = graph._sizeChanged;\n graph._sizeChanged = false;\n return temp;\n}\n\n// Constants\nGraph$1.SERIE_LINE = Symbol();\nGraph$1.SERIE_SCATTER = Symbol();\nGraph$1.SERIE_CONTOUR = Symbol();\nGraph$1.SERIE_BAR = Symbol();\nGraph$1.SERIE_BOX = Symbol();\nGraph$1.SERIE_ZONE = Symbol();\nGraph$1.SERIE_LINE_COLORED = Symbol();\nGraph$1.SERIE_ZONE = Symbol();\nGraph$1.SERIE_DENSITYMAP = Symbol();\nGraph$1.SERIE_LINE_3D = Symbol();\nGraph$1.SERIE_ZONE_3D = Symbol();\n\nGraph$1.TICKS_OUTSIDE = Symbol();\nGraph$1.TICKS_INSIDE = Symbol();\nGraph$1.TICKS_CENTERED = Symbol();\n\nGraph$1.ns = 'http://www.w3.org/2000/svg';\nGraph$1.nsxlink = 'http://www.w3.org/1999/xlink';\n\n/**\n * Default legend configuration\n * @name LegendOptionsDefault\n * @object\n * @static\n * @prop {Boolean} frame - true to display a frame around the legend\n * @prop {Number} frameWidth - The width of the frame stroke\n * @prop {String} frameColor - The stroke color of the frame\n * @prop {String} backgroundColor - The background color of the frame\n * @prop {Number} paddingLeft - The left padding\n * @prop {Number} paddingRight - The right padding\n * @prop {Number} paddingTop - The top padding\n * @prop {Number} paddingBottom - The bottom padding\n * @prop {Boolean} shapesToggleable - true to toggle the shapes linked to serie with its status (shown or hidden)\n * @prop {Boolean} isSerieHideable - true to allow series to be hidden through the legend\n * @prop {Boolean} isSerieSelectable - true to allow series to be selected through the legend\n */\nvar legendDefaults = {\n\n backgroundColor: 'rgba(255, 255, 255, 0.8)',\n frame: true,\n frameWidth: 1,\n frameColor: 'black',\n paddingTop: 10,\n paddingLeft: 10,\n paddingBottom: 10,\n paddingRight: 10,\n color: 'black',\n frameRounding: 0,\n\n movable: false,\n\n shapesToggleable: true,\n isSerieHideable: true,\n isSerieSelectable: true\n\n};\n\n/**\n * Legend constructor. You should not call this method directly, but rather use {@link graph.makeLegend}\n * @example var legend = graph.makeLegend( { backgroundColor: 'rgba(255, 255, 255, 0.8)',\n * frame: true,\n * frameWidth: 1,\n * frameColor: 'black',\n * paddingTop: 10,\n * paddingLeft: 10,\n * paddingBottom: 10,\n * paddingRight: 10,\n * frameRounding: 3,\n *\n * movable: false,\n *\n * shapesToggleable: true,\n * isSerieHideable: true,\n * isSerieSelectable: true\n * } );\n */\nclass Legend {\n\n constructor(graph, options) {\n\n this.options = extend({}, legendDefaults, options);\n\n this.graph = graph;\n this.svg = document.createElementNS(this.graph.ns, 'g');\n this.subG = document.createElementNS(this.graph.ns, 'g');\n\n this.groups = [];\n this.rect = document.createElementNS(this.graph.ns, 'rect');\n this.rectBottom = document.createElementNS(this.graph.ns, 'rect');\n\n this.rect.setAttribute('x', 0);\n this.rect.setAttribute('y', 0);\n\n this.rectBottom.setAttribute('x', 0);\n this.rectBottom.setAttribute('y', 0);\n\n this.series = false;\n\n this.svg.setAttribute('display', 'none');\n this.pos = {\n x: undefined,\n y: undefined,\n transformX: 0,\n transformY: 0\n };\n\n this.setEvents();\n\n this.eyeId = guid();\n this.eyeCrossedId = guid();\n\n var eyeClosed = SVGParser('');\n // var eyeClosed = util.SVGParser('');\n\n /* var eyeClosed = document.createElementNS( this.graph.ns, \"symbol\");\n eyeClosed.setAttribute('id', this.eyeId );\n eyeClosed.setAttribute(\"viewBox\", '0 0 100 100');\n var rect = document.createElementNS( this.graph.ns, \"rect\" );\n rect.setAttribute('width', 100 );\n rect.setAttribute('height', 100 );\n rect.setAttribute('x', 0 );\n rect.setAttribute('y', 0 );\n rect.setAttribute('fill', 'black');\n eyeClosed.appendChild( rect );\n */\n var eye = SVGParser('');\n\n this.svg.appendChild(document.adoptNode(eye.documentElement.firstChild));\n this.svg.appendChild(document.adoptNode(eyeClosed.documentElement.firstChild));\n\n this.svg.appendChild(this.subG);\n\n this.applyStyle();\n }\n\n /**\n * Sets the position of the legend\n * @param {Position} position - the position to set the legend to versus the graph main axes ({@link Graph#getXAxis} and {@link Graph#getYAxis})\n * @param {String} alignToX - \"right\" or \"left\". References the legend right or left boundary using the position parameter\n * @param {String} alignToY - \"top\" or \"bottom\". References the legend top or bottom boundary using the position parameter\n * @example legend.setPosition( { x: 'max', y: '0px' }, 'right', 'top' ); // The rightmost side of the legend will at the maximum value of the axis, and will be positioned at the top\n */\n setPosition(position, alignToX, alignToY) {\n\n if (!position) {\n return;\n }\n\n this.position = position;\n this.alignToX = alignToX || 'left';\n this.alignToY = alignToY || 'top';\n }\n\n setDraggable(bln) {\n this.options.movable = bln;\n }\n\n setAutoPosition(position) {\n\n if (['bottom', 'left', 'top', 'right'].indexOf(position = position.toLowerCase()) > -1) {\n this.autoPosition = position;\n return this;\n }\n\n this.requireDelayedUpdate();\n this.autoPosition = false;\n }\n\n autoPosition() {\n return this.setAutoPosition(...arguments);\n }\n\n buildLegendBox() {\n\n var series = this.series || this.graph.getSeries(),\n posX = 0,\n posY = this.options.paddingTop;\n\n if (!this.autoPosition) {\n this.graph.graphingZone.appendChild(this.getDom());\n } else {\n this.graph.getDom().appendChild(this.getDom());\n }\n\n for (var i = 0, l = series.length; i < l; i++) {\n\n if (series[i].excludedFromLegend && !this.series) {\n continue;\n }\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n\n var bbox = getBBox(this.groups[i]);\n\n if (posX + bbox.width > this.graph.getDrawingWidth() - this.options.paddingRight) {\n posY += 16;\n posX = 0;\n }\n }\n\n this.groups[i].setAttribute('transform', 'translate( ' + posX + ', ' + posY + ')');\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n\n posX += bbox.width + 10;\n posY += 0;\n } else {\n\n posX = 0;\n posY += 16;\n }\n }\n\n var bbox = getBBox(this.subG);\n\n /* Independant on box position */\n this.width = bbox.width + this.options.paddingRight + this.options.paddingLeft;\n this.height = bbox.height + this.options.paddingBottom + this.options.paddingTop;\n\n this.rect.setAttribute('width', this.width);\n this.rect.setAttribute('height', this.height);\n this.rect.setAttribute('fill', 'none');\n this.rect.setAttribute('pointer-events', 'fill');\n\n this.rect.setAttribute('display', 'none');\n\n if (this.options.movable) {\n this.rectBottom.style.cursor = 'move';\n }\n\n this.rectBottom.setAttribute('width', this.width);\n this.rectBottom.setAttribute('height', this.height);\n\n this.rectBottom.setAttribute('x', bbox.x - this.options.paddingLeft);\n this.rectBottom.setAttribute('y', bbox.y - this.options.paddingTop);\n /* End independant on box position */\n\n this.position = this.position || {};\n\n switch (this.autoPosition) {\n\n case 'bottom':\n this.position.y = this.graph.getHeight() + 'px';\n // Try to center with respect to the drawing space, not the full graph. It's useful when the graph is fairly asymmetric (i.e. multiple axes on 1 side)\n this.position.x = (this.graph.drawingSpaceWidth - this.width) / 2 + this.graph.drawingSpaceMinX + 'px';\n this.alignToY = 'bottom';\n this.alignToX = false;\n break;\n\n case 'left':\n this.position.x = '6px';\n this.position.y = (this.graph.getHeight() - this.height) / 2 + 'px';\n this.alignToX = 'left';\n this.alignToY = false;\n break;\n\n case 'right':\n this.position.x = this.graph.getWidth() + 'px';\n this.position.y = (this.graph.getHeight() - this.height) / 2 + 'px';\n this.alignToX = 'right';\n this.alignToY = false;\n break;\n\n case 'top':\n this.position.x = (this.graph.drawingSpaceWidth - this.width) / 2 + this.graph.drawingSpaceMinX + 'px';\n this.position.y = '10px';\n this.alignToY = 'top';\n this.alignToX = false;\n break;\n }\n\n if (this.autoPosition) {\n switch (this.autoPosition) {\n\n case 'bottom':\n this.graph.options.paddingBottom = this.height + 10;\n break;\n\n case 'left':\n this.graph.options.paddingLeft = this.width + 5;\n break;\n\n case 'right':\n this.graph.options.paddingRight = this.width + 10;\n break;\n\n case 'top':\n this.graph.options.paddingTop = this.height + 14;\n break;\n }\n\n this.graph.updateGraphingZone();\n this.graph.getDrawingHeight();\n this.graph.getDrawingWidth();\n // this.graph.redraw( false );\n }\n\n this.bbox = bbox;\n }\n\n calculatePosition() {\n\n var pos = Position.check(this.position);\n let poscoords = pos.compute(this.graph, this.graph.getXAxis(), this.graph.getYAxis());\n\n if (!poscoords) {\n return;\n }\n\n if (pos.y == 'max') {\n poscoords.y += this.graph.getPaddingTop();\n }\n\n if (pos.x == 'max') {\n poscoords.x -= this.graph.getPaddingRight();\n }\n\n if (this.alignToX == 'right') {\n poscoords.x -= this.width;\n poscoords.x -= this.bbox.x;\n } else {\n //poscoords.x -= this.bbox.x;\n }\n\n if (this.alignToY == 'bottom') {\n poscoords.y -= this.height;\n poscoords.y -= this.bbox.y;\n } else {\n\n poscoords.y -= this.bbox.y;\n }\n\n this.pos.transformX = poscoords.x;\n this.pos.transformY = poscoords.y;\n\n this._setPosition();\n }\n\n /**\n * Updates the legend position and content\n */\n update(onlyIfRequired) {\n\n if (this.graph.isDelayedUpdate() || !this._requiredUpdate && onlyIfRequired) {\n return;\n }\n\n this._requiredUpdate = false;\n\n var self = this;\n\n this.applyStyle();\n\n while (this.subG.hasChildNodes()) {\n this.subG.removeChild(this.subG.lastChild);\n }\n\n this.svg.insertBefore(this.rectBottom, this.svg.firstChild);\n\n var series = this.series || this.graph.getSeries();\n\n if (series.length > 0) {\n this.svg.setAttribute('display', 'block');\n } else {\n return;\n }\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n var fullWidth = this.graph.getDrawingWidth();\n }\n\n for (var i = 0, l = series.length; i < l; i++) {\n\n if (series[i].excludedFromLegend && !this.series) {\n continue;\n }\n\n (function (j) {\n\n var g,\n line,\n text;\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n var fullWidth = this.graph.getDrawingWidth();\n }\n\n g = document.createElementNS(self.graph.ns, 'g');\n var rect = document.createElementNS(self.graph.ns, 'rect');\n\n self.subG.appendChild(g);\n\n g.appendChild(rect);\n\n var line = series[j].getSymbolForLegend();\n var marker = series[j].getMarkerForLegend();\n var text = series[j].getTextForLegend();\n\n var dx = 35;\n\n if (this.isHideable()) {\n dx += 20;\n\n var eyeUse = document.createElementNS(self.graph.ns, 'use');\n eyeUse.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', '#' + (series[i].isShown() ? this.eyeId : this.eyeCrossedId));\n eyeUse.setAttribute('width', 15);\n eyeUse.setAttribute('height', 15);\n eyeUse.setAttribute('x', 35);\n eyeUse.setAttribute('y', -8);\n\n eyeUse.addEventListener('click', function (e) {\n e.stopPropagation();\n\n var id;\n if (series[j].isShown()) {\n series[j].hide(self.options.hideShapesOnHideSerie);\n id = self.eyeCrossedId;\n } else {\n series[j].show(self.options.hideShapesOnHideSerie);\n id = self.eyeId;\n }\n\n eyeUse.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', '#' + id);\n });\n }\n\n text.setAttribute('transform', 'translate(' + dx + ', 3)');\n\n text.setAttribute('color', this.options.color);\n\n if (line) {\n g.appendChild(line);\n }\n\n if (series[j].getType() == 'scatter') {\n line.setAttribute('transform', 'translate( 20, 0 )');\n }\n\n if (marker) {\n g.appendChild(marker);\n }\n\n if (eyeUse) {\n g.appendChild(eyeUse);\n }\n\n g.appendChild(text);\n\n var bbox = getBBox(g);\n\n rect.setAttribute('x', bbox.x);\n rect.setAttribute('y', bbox.y);\n rect.setAttribute('width', bbox.width);\n rect.setAttribute('height', bbox.height);\n rect.setAttribute('fill', 'none');\n rect.setAttribute('pointer-events', 'fill');\n\n self.groups[j] = g;\n\n g.addEventListener('click', function (e) {\n\n var serie = series[j];\n\n if (!serie.isShown()) {\n return;\n }\n\n if (self.isSelectable() && !serie.isSelected()) {\n\n self.graph.selectSerie(serie);\n } else {\n\n self.graph.unselectSerie(serie);\n }\n\n e.preventDefault();\n e.stopPropagation();\n });\n }).call(this, i);\n }\n\n this.svg.appendChild(this.rect);\n this.buildLegendBox();\n this.calculatePosition();\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be hidden or not\n */\n isHideable() {\n return this.options.isSerieHideable;\n }\n\n notHideable() {\n this.options.isSerieHideable = false;\n return this;\n }\n\n hideable() {\n this.options.isSerieHideable = true;\n return this;\n }\n\n set seriesHideable(hideable) {\n this.options.isSerieHideable = !!hideable;\n }\n\n /**\n * @type {Boolean}\n */\n get seriesHideable() {\n return this.options.isSerieHideable;\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be selected or not\n */\n isSelectable() {\n return this.options.isSerieSelectable;\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be t or not\n */\n isToggleShapes() {\n return this.options.shapesToggleable;\n }\n\n /**\n * @return {SVGGroupElement} The SVG group element wrapping the legend\n */\n getDom() {\n return this.svg;\n }\n\n setEvents() {\n\n var self = this;\n var pos = this.pos;\n\n var mousedown = function (e) {\n\n e.stopPropagation();\n console.log('down');\n if (self.options.movable) {\n pos.x = e.clientX;\n pos.y = e.clientY;\n\n e.preventDefault();\n self.mousedown = true;\n self.graph.elementMoving(self);\n\n self.rect.setAttribute('display', 'block');\n }\n };\n\n var mousemove = function (e) {\n self.handleMouseMove(e);\n };\n\n this.svg.addEventListener('mousedown', mousedown);\n this.svg.addEventListener('click', function (e) {\n e.stopPropagation();\n });\n this.svg.addEventListener('dblclick', function (e) {\n e.stopPropagation();\n });\n this.svg.addEventListener('mousemove', mousemove);\n //this.rect.addEventListener( 'mousemove', mousemove );\n }\n\n handleMouseUp(e) {\n\n e.stopPropagation();\n e.preventDefault();\n this.mousedown = false;\n this.rect.setAttribute('display', 'none');\n this.graph.elementMoving(false);\n }\n\n handleMouseMove(e) {\n\n if (!this.mousedown) {\n return;\n }\n\n var pos = this.pos;\n\n var deltaX = e.clientX - pos.x;\n var deltaY = e.clientY - pos.y;\n\n pos.transformX += deltaX;\n pos.transformY += deltaY;\n\n pos.x = e.clientX;\n pos.y = e.clientY;\n\n e.stopPropagation();\n e.preventDefault();\n\n this._setPosition();\n }\n\n _setPosition() {\n\n var pos = this.pos;\n if (!isNaN(pos.transformX) && !isNaN(pos.transformY) && pos.transformX !== false && pos.transformY !== false) {\n this.svg.setAttribute('transform', 'translate(' + pos.transformX + ', ' + pos.transformY + ')');\n }\n }\n\n /**\n * Re-applies the legend style\n */\n applyStyle() {\n\n if (this.options.frame) {\n this.rectBottom.setAttribute('stroke', this.options.frameColor);\n this.rectBottom.setAttribute('stroke-width', this.options.frameWidth + 'px');\n this.rectBottom.setAttribute('rx', this.options.frameRounding);\n this.rectBottom.setAttribute('ry', this.options.frameRounding);\n }\n\n this.rectBottom.setAttribute('fill', this.options.backgroundColor);\n }\n\n /**\n * Re-applies the legend style\n * @param {...(GraphSerie|GraphSerie[])} a serie or an array of series\n */\n fixSeries() {\n var series = [];\n\n if (arguments[0] === false) {\n this.series = false;\n this.update();\n return;\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n if (Array.isArray(arguments[i])) {\n series = series.concat(arguments[i]);\n } else {\n series.push(arguments[i]);\n }\n }\n\n this.update();\n this.series = series;\n }\n\n fixSeriesAdd(serie) {\n this.series = this.series || [];\n this.series.push(serie);\n }\n\n requireDelayedUpdate() {\n this._requiredUpdate = true;\n }\n\n}\n\nfunction getBBox(svgElement) {\n // Firefox throws when trying to call getBBox() on elements\n // that are not yet rendered.\n try {\n return svgElement.getBBox();\n } catch (e) {\n return {\n height: 0,\n width: 0,\n x: 0,\n y: 0\n };\n }\n}\n\n/**\n * Default graph parameters\n * @name AxisOptionsDefault\n * @object\n * @static\n * @memberof Axis\n * @prop {Boolean} display - Whether to display or not the axis\n * @prop {Boolean} flipped - Flips the axis (maximum and minimum will be inverted)\n * @prop {Numner} axisDataSpacing.min - The spacing of the at the bottom of the axis. The value is multiplied by the (max - min) values given by the series (0.1 means 10% of the serie width / height).\n * @prop {Number} axisDataSpacing.max - The spacing of the at the top of the axis. The value is multiplied by the (max - min) values given by the series (0.1 means 10% of the serie width / height).\n * @prop {String} unitModification - Used to change the units of the axis in a defined way. Currently, \"time\" and \"time:min.sec\" are supported. They will display the value in days, hours, minutes and seconds and the data should be expressed in seconds.\n * @prop {Boolean} primaryGrid - Whether or not to display the primary grid (on the main ticks)\n * @prop {Boolean} secondaryGrid - Whether or not to display the secondary grid (on the secondary ticks)\n * @prop {Number} tickPosition - Sets the position of the ticks with regards to the axis ( 1 = inside, 2 = centered, 3 = outside ).\n * @prop {Number} nbTicksPrimary - The number of primary ticks to use (approximately)\n * @prop {Number} nbTicksSecondary - The number of secondary ticks to use (approximately)\n * @prop {Number} ticklabelratio - Scaling factor on the labels under each primary ticks\n * @prop {Number} exponentialFactor - Scales the labels under each primary ticks by 10^(exponentialFactor)\n * @prop {Number} exponentialLabelFactor - Scales the axis label by 10^(exponentialFactor)\n * @prop {Boolean} logScale - Display the axis in log scale (base 10)\n * @prop {(Number|Boolean)} forcedMin - Use a number to force the minimum value of the axis (becomes independant of its series)\n * @prop {(Number|Boolean)} forcedMax - Use a number to force the maximum value of the axis (becomes independant of its series)\n */\nconst defaults = {\n lineAt: false,\n display: true,\n flipped: false,\n axisDataSpacing: {\n min: 0.1,\n max: 0.1\n },\n unitModification: false,\n primaryGrid: true,\n secondaryGrid: true,\n\n primaryGridColor: '#f0f0f0',\n secondaryGridColor: '#f0f0f0',\n\n primaryGridWidth: 1,\n secondaryGridWidth: 1,\n\n hideWhenNoSeriesShown: false,\n shiftToZero: false,\n tickPosition: 1,\n nbTicksPrimary: 3,\n nbTicksSecondary: 10,\n ticklabelratio: 1,\n exponentialFactor: 0,\n exponentialLabelFactor: 0,\n logScale: false,\n forcedMin: false,\n forcedMax: false,\n\n span: [0, 1],\n marginMin: 0,\n marginMax: 0,\n\n scientificScale: false,\n scientificScaleExponent: false,\n engineeringScale: false,\n\n unitInTicks: false,\n unit: false,\n unitWrapperBefore: '',\n unitWrapperAfter: '',\n\n splitMarks: false,\n\n tickLabelOffset: 0,\n\n useKatexForLabel: false\n};\n\n/**\n * Axis constructor. Usually not instanced directly, but for custom made axes, that's possible\n * @class Axis\n * @static\n * @augments EventEmitter\n * @example function myAxis() {};\n * myAxis.prototype = new Graph.getConstructor(\"axis\");\n * graph.setBottomAxis( new myAxis( { } ) );\n */\nclass Axis extends EventEmitter {\n\n constructor() {\n\n super();\n }\n\n init(graph, options, overwriteoptions) {\n\n this.unitModificationTimeTicks = [[1, [1, 2, 5, 10, 20, 30]], [60, [1, 2, 5, 10, 20, 30]], [3600, [1, 2, 6, 12]], [3600 * 24, [1, 2, 3, 4, 5, 10, 20, 40]]];\n\n this.graph = graph;\n this.options = extend(true, {}, defaults, overwriteoptions, options);\n\n this.group = document.createElementNS(this.graph.ns, 'g');\n this.hasChanged = true;\n\n this.rectEvent = document.createElementNS(this.graph.ns, 'rect');\n this.rectEvent.setAttribute('pointer-events', 'fill');\n this.rectEvent.setAttribute('fill', 'transparent');\n this.group.appendChild(this.rectEvent);\n\n this.graph.axisGroup.appendChild(this.group); // Adds to the main axiszone\n\n // Lines at a certain value\n this._lines = [];\n\n this.line = document.createElementNS(this.graph.ns, 'line');\n this.line.setAttribute('stroke', 'black');\n this.line.setAttribute('shape-rendering', 'crispEdges');\n this.line.setAttribute('stroke-linecap', 'square');\n this.groupTicks = document.createElementNS(this.graph.ns, 'g');\n this.groupTickLabels = document.createElementNS(this.graph.ns, 'g');\n\n this.group.appendChild(this.groupTicks);\n this.group.appendChild(this.groupTickLabels);\n this.group.appendChild(this.line);\n\n this.label = document.createElementNS(this.graph.ns, 'text');\n\n this.labelTspan = document.createElementNS(this.graph.ns, 'tspan'); // Contains the main label\n this.preunit = ''; //document.createElementNS( this.graph.ns, 'tspan' ); // Contains the scaling unit\n this.unitTspan = document.createElementNS(this.graph.ns, 'tspan'); // Contains the unit\n this.expTspan = document.createElementNS(this.graph.ns, 'tspan'); // Contains the exponent (x10)\n this.expTspanExp = document.createElementNS(this.graph.ns, 'tspan'); // Contains the exponent value\n\n this.label.appendChild(this.labelTspan);\n //this.label.appendChild( this.preunitTspan );\n this.label.appendChild(this.unitTspan);\n this.label.appendChild(this.expTspan);\n this.label.appendChild(this.expTspanExp);\n\n this.expTspan.setAttribute('dx', 6);\n this.expTspanExp.setAttribute('dy', -5);\n this.expTspanExp.setAttribute('font-size', '0.8em');\n\n this.label.setAttribute('text-anchor', 'middle');\n\n this.setTickPosition(this.options.tickPosition);\n\n this.gridLinePath = {\n primary: '',\n secondary: ''\n };\n\n this.gridPrimary = document.createElementNS(this.graph.ns, 'path');\n this.gridSecondary = document.createElementNS(this.graph.ns, 'path');\n\n this.graph.groupPrimaryGrids.appendChild(this.gridPrimary);\n this.graph.groupSecondaryGrids.appendChild(this.gridSecondary);\n\n this.setGridLinesStyle();\n\n this.group.appendChild(this.label);\n\n this.groupSeries = document.createElementNS(this.graph.ns, 'g');\n this.group.appendChild(this.groupSeries);\n\n this.widthHeightTick = 0;\n\n this.ticks = {};\n this.ticksLabels = [];\n this.tickScaling = {\n 1: 3,\n 2: 2,\n 3: 1,\n 4: 0.5\n };\n\n this.currentTick = {};\n this.lastCurrentTick = {};\n\n this.series = [];\n this.totalDelta = 0;\n this.currentAction = false;\n\n this.group.addEventListener('mousemove', e => {\n e.preventDefault();\n var coords = this.graph._getXY(e);\n this.handleMouseMoveLocal(coords.x, coords.y, e);\n\n for (var i = 0, l = this.series.length; i < l; i++) {\n this.series[i].handleMouseMove(false, true);\n }\n });\n\n this.labels = [];\n this.group.addEventListener('click', e => {\n e.preventDefault();\n var coords = this.graph._getXY(e);\n this.addLabel(this.getVal(coords.x - this.graph.getPaddingLeft()));\n });\n\n //this.clip = document.createElementNS( this.graph.ns, 'clipPath' );\n //this.clip.setAttribute( 'id', '_clip' + this.axisRand );\n //this.graph.defs.appendChild( this.clip );\n /*\n this.clipRect = document.createElementNS( this.graph.ns, 'rect' );\n this.clip.appendChild( this.clipRect );\n this.clip.setAttribute( 'clipPathUnits', 'userSpaceOnUse' );\n */\n this.gridPrimary.setAttribute('clip-path', 'url(#_clipplot' + this.graph._creation + ')');\n this.gridSecondary.setAttribute('clip-path', 'url(#_clipplot' + this.graph._creation + ')');\n this.graph._axisHasChanged(this);\n }\n\n handleMouseMoveLocal() {}\n\n /**\n * Hides the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n hide() {\n this.options.display = false;\n return this;\n }\n\n /**\n * Shows the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n show() {\n this.options.display = true;\n return this;\n }\n\n /**\n * Shows or hides the axis\n * @memberof Axis\n * @param {Boolean} display - true to display the axis, false to hide it\n * @return {Axis} The current axis\n */\n setDisplay(bool) {\n this.options.display = !!bool;\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Boolean} A boolean indicating the displayed state of the axis\n */\n isDisplayed() {\n\n if (!this.options.hideWhenNoSeriesShown) {\n return this.options.display;\n }\n\n return this.graph.getSeriesFromAxis(this).reduce((accumulator, serie) => {\n return accumulator || serie.isShown();\n }, false);\n }\n\n isShown() {\n\n return this.isDisplayed(...arguments);\n }\n\n hideGroup() {\n if (this._hidden) {\n return;\n }\n this._hidden = true;\n this.group.setAttribute('display', 'none');\n }\n\n showGroup() {\n if (!this._hidden) {\n return;\n }\n this._hidden = false;\n this.group.setAttribute('display', 'initial');\n }\n\n kill(noRedraw, noSerieKill) {\n this.graph.killAxis(this, noRedraw, noSerieKill);\n }\n /**\n * Forces the appearence of a straight perpendicular line at value 0\n * @param {Array} atValues - An array of x or y values where the lines are displayed\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setLineAt(atValues) {\n this.options.lineAt = atValues;\n return this;\n }\n\n // Used to adapt the 0 of the axis to the zero of another axis that has the same direction\n\n /**\n * Aligns ```thisValue``` of the axis to ```foreignValue``` of another axis\n * @param {(Axis|Boolean)} axis - The axis with which the 0 should be aligned. Use \"false\" to deactivate the adapt to 0 mode.\n * @param {Number} thisValue - The value of the current axis that should be aligned\n * @param {Number} foreignValue - The value of the reference axis that should be aligned\n * @param {String} preference - \"min\" or \"max\". Defined the boundary that should behave the more normally\n * @memberof Axis\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n adaptTo(axis, thisValue, foreignValue, preference) {\n\n if (!axis) {\n this.options.adaptTo = false;\n return this;\n }\n\n this.options.adaptTo = {\n axis: axis,\n thisValue: thisValue,\n foreignValue: foreignValue,\n preference: preference\n };\n\n this.adapt();\n\n return this;\n }\n\n /**\n * Adapts maximum and minimum of the axis if options.adaptTo is defined\n * @memberof Axis\n * @returns {Axis} The current axis\n * @since 1.13.2\n */\n adapt() {\n\n if (!this.options.adaptTo) {\n return;\n }\n\n var axis = this.options.adaptTo.axis,\n current = this.options.adaptTo.thisValue,\n foreign = this.options.adaptTo.foreignValue;\n\n if (axis.currentAxisMin === undefined || axis.currentAxisMax === undefined) {\n axis.setMinMaxToFitSeries();\n }\n\n if (this.options.forcedMin !== false && this.options.forcedMax == false || this.options.adaptTo.preference !== 'max') {\n\n if (this.options.forcedMin !== false) {\n this.currentAxisMin = this.options.forcedMin;\n } else {\n this.currentAxisMin = this._zoomed ? this.getCurrentMin() : this.getMinValue() - (current - this.getMinValue()) * (this.options.axisDataSpacing.min * (axis.getCurrentMax() - axis.getCurrentMin()) / (foreign - axis.getCurrentMin()));\n }\n\n if (this.currentAxisMin == current) {\n this.currentAxisMin -= this.options.axisDataSpacing.min * this.getInterval();\n }\n\n var use = this.options.forcedMin !== false ? this.options.forcedMin : this.currentAxisMin;\n this.currentAxisMax = (current - use) * (axis.getCurrentMax() - axis.getCurrentMin()) / (foreign - axis.getCurrentMin()) + use;\n } else {\n\n if (this.options.forcedMax !== false) {\n this.currentAxisMax = this.options.forcedMax;\n } else {\n this.currentAxisMax = this._zoomed ? this.getCurrentMax() : this.getMaxValue() + (this.getMaxValue() - current) * (this.options.axisDataSpacing.max * (axis.getCurrentMax() - axis.getCurrentMin()) / (axis.getCurrentMax() - foreign));\n }\n\n if (this.currentAxisMax == current) {\n this.currentAxisMax += this.options.axisDataSpacing.max * this.getInterval();\n }\n\n var use = this.options.forcedMax !== false ? this.options.forcedMax : this.currentAxisMax;\n\n this.currentAxisMin = (current - use) * (axis.getCurrentMin() - axis.getCurrentMax()) / (foreign - axis.getCurrentMax()) + use;\n }\n\n this.graph._axisHasChanged(this);\n }\n\n // Floating axis. Adapts axis position orthogonally to another axis at a defined value. Not taken into account for margins\n\n /**\n * Makes the axis floating (not aligned to the right or the left anymore). You need to specify another axis (perpendicular) and a value at which this axis should be located\n * @param {Axis} axis - The axis on which the current axis should be aligned to\n * @param {Number} value - The value on which the current axis should be aligned\n * @memberof Axis\n * @return {Axis} The current axis\n * @example graph.getYAxis().setFloat( graph.getBottomAxis(), 0 ); // Alignes the y axis with the origin of the bottom axis\n */\n setFloating(axis, value) {\n\n this.floating = true;\n this.floatingAxis = axis;\n this.floatingValue = value;\n\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Axis} The axis referencing the floating value of the current axis\n */\n getFloatingAxis() {\n return this.floatingAxis;\n }\n\n /**\n * @memberof Axis\n * @return {Axis} The value to which the current axis is aligned to\n */\n getFloatingValue() {\n return this.floatingValue;\n }\n\n /**\n * Sets the axis data spacing\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} min - The spacing at the axis min value\n * @param {Number} [ max = min ] - The spacing at the axis max value. If omitted, will be equal to the \"min\" parameter\n * @return {Axis} The current axis\n */\n setAxisDataSpacing(val1, val2) {\n this.options.axisDataSpacing.min = val1;\n this.options.axisDataSpacing.max = val2 || val1;\n return this;\n }\n\n dataSpacing() {\n return this.setAxisDataSpacing(...arguments);\n }\n\n /**\n * Sets the axis data spacing at the minimum of the axis\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} min - The spacing at the axis min value\n * @return {Axis} The current axis\n */\n setAxisDataSpacingMin(val) {\n this.options.axisDataSpacing.min = val;\n }\n\n /**\n * Sets the axis data spacing at the maximum of the axis\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} max - The spacing at the axis max value\n * @return {Axis} The current axis\n */\n setAxisDataSpacingMax(val) {\n this.options.axisDataSpacing.max = val;\n }\n\n setMinPx(px) {\n\n this.minPx = px;\n this.setMinMaxFlipped();\n }\n\n setMaxPx(px) {\n\n this.maxPx = px;\n this.setMinMaxFlipped();\n }\n\n /**\n * @memberof Axis\n * @return {Number} The position in px of the bottom of the axis\n */\n getMinPx() {\n return this.minPxFlipped;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The position in px of the top of the axis\n */\n getMaxPx() {\n return this.maxPxFlipped;\n }\n\n getMathMaxPx() {\n return this.maxPx;\n }\n\n getMathMinPx() {\n return this.minPx;\n }\n\n // Returns the true minimum of the axis. Either forced in options or the one from the data\n\n /**\n * Retrieves the minimum possible value of the axis. Can be set by \"forcedMin\", \"adapt0ToAxis\" or by the values of the series the axis contains. Does not take into account any zooming.\n * @memberof Axis\n * @return {Number} The minimum possible value of the axis\n */\n getMinValue() {\n return this.options.forcedMin !== false ? this.options.forcedMin : this.dataMin;\n }\n\n /**\n * Retrieves the maximum possible value of the axis. Can be set by \"forcedMax\", \"adapt0ToAxis\" or by the values of the series the axis contains. Does not take into account any zooming.\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getMaxValue() {\n return this.options.forcedMax !== false ? this.options.forcedMax : this.dataMax;\n }\n\n setMinValueData(min) {\n this.dataMin = min;\n\n // 25.10.2017. This is to help in the case there's no autoscaling\n if (isNaN(this.getCurrentMin())) {\n this.setCurrentMin(this.getMinValue());\n this.cache();\n }\n }\n\n setMaxValueData(max) {\n this.dataMax = max;\n\n // 25.10.2017. This is to help in the case there's no autoscaling\n if (isNaN(this.getCurrentMax())) {\n this.setCurrentMax(this.getMaxValue());\n this.cache();\n }\n }\n\n /**\n * Retrieves the maximum possible value of the axis based only on the data. Does not take into account the possible axis forcing\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getDataMax() {\n return this.dataMax;\n }\n\n /**\n * Retrieves the minimum possible value of the axis based only on the data. Does not take into account the possible axis forcing\n * @memberof Axis\n * @return {Number} The minimum possible value of the axis\n */\n getDataMin() {\n return this.dataMin;\n }\n\n /**\n * Forces the minimum value of the axis (no more dependant on the serie values)\n * @memberof Axis\n * @param {Number} min - The minimum value of the axis\n * @param {Boolean} noRescale - ```true``` to prevent the axis to rescale to set this minimum. Rescales anyway if current min is lower than the value. Defaults to ```false```\n * @return {Axis} The current axis\n */\n forceMin(min, noRescale = false) {\n this.options.forcedMin = min;\n this.setCurrentMin(noRescale ? this.getCurrentMin() : undefined);\n this.graph._axisHasChanged(this);\n return this;\n }\n\n /**\n * Forces the maximum value of the axis (no more dependant on the serie values).\n * @memberof Axis\n * @param {Number} max - The maximum value of the axis\n * @param {Boolean} noRescale - ```true``` to prevent the axis to rescale to set this maximum. Rescales anyway if current max is higher than the value\n * @return {Axis} The current axis\n */\n forceMax(max, noRescale = false) {\n this.options.forcedMax = max;\n this.setCurrentMax(noRescale ? this.getCurrentMax() : undefined);\n this.graph._axisHasChanged(this);\n return this;\n }\n\n /**\n * Retrieves the forced minimum of the axis\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getForcedMin() {\n return this.options.forcedMin;\n }\n\n /**\n * Retrieves the forced minimum of the axis\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getForcedMax() {\n return this.options.forcedMax;\n }\n\n /**\n * Forces the min and max values of the axis to the min / max values of another axis\n * @param {Axis} axis - The axis from which the min / max values are retrieved.\n * @memberof Axis\n * @return {Axis} The current axis\n */\n forceToAxis(axis) {\n if (axis.getMaxValue && axis.getMinValue) {\n this.options.forcedMin = axis.getMinValue();\n this.options.forcedMax = axis.getMaxValue();\n }\n\n return this;\n }\n\n getNbTicksPrimary() {\n return this.options.nbTicksPrimary;\n }\n\n setNbTicksPrimary(nb) {\n this.options.nbTicksPrimary = nb;\n }\n\n getNbTicksSecondary() {\n return this.options.nbTicksSecondary;\n }\n\n setNbTicksSecondary(nb) {\n this.options.nbTicksSecondary = nb;\n return this;\n }\n\n handleMouseMove(px) {\n this.mouseVal = this.getVal(px);\n }\n\n handleMouseWheel(delta, e, baseline) {\n\n delta = Math.min(0.2, Math.max(-0.2, delta));\n\n if (baseline == 'min') {\n baseline = this.getMinValue();\n } else if (baseline == 'max') {\n baseline = this.getMaxValue();\n } else if (!baseline) {\n baseline = 0;\n }\n\n this._doZoomVal((this.getCurrentMax() - baseline) * (1 + delta) + baseline, (this.getCurrentMin() - baseline) * (1 + delta) + baseline);\n\n this.graph.draw();\n //\tthis.graph.drawSeries(true);\n }\n\n set zoomLock(bln) {\n this._zoomLocked = bln;\n }\n\n get zoomLock() {\n return this._zoomLocked || false;\n }\n\n /**\n * Performs a zoom on the axis, without redraw afterwards\n * @param {Number} val1 - The new axis minimum\n * @param {Number} val2 - The new axis maximum\n * @memberof Axis\n * @return {Axis} The current axis\n * @example\n * graph.getBottomAxis().zoom( 50, 70 ); // Axis boundaries will be 50 and 70 after next redraw\n * graph.redraw();\n * @example\n * graph.getBottomAxis().forceMin( 0 ).forceMax( 100 ).zoom( 50, 70 ); // Axis boundaries will be 50 and 70 after next redraw\n * graph.draw();\n * graph.autoscaleAxes(); // New bottom axis boundaries will be 0 and 100, not 50 and 70 !\n * graph.draw();\n */\n zoom(val1, val2, forceLock) {\n\n if (!forceLock && this.zoomLock) {\n return;\n }\n\n return this._doZoomVal(val1, val2, true);\n }\n\n _doZoomVal(val1, val2, mute) {\n\n return this._doZoom(this.getPx(val1), this.getPx(val2), val1, val2, mute);\n }\n\n _doZoom(px1, px2, val1, val2, mute) {\n\n //if(this.options.display || 1 == 1) {\n var val1 = val1 !== undefined ? val1 : this.getVal(px1);\n var val2 = val2 !== undefined ? val2 : this.getVal(px2);\n\n this.setCurrentMin(Math.min(val1, val2));\n this.setCurrentMax(Math.max(val1, val2));\n\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n\n this._zoomed = true;\n\n this.adapt();\n\n this._hasChanged = true;\n\n // New method\n if (!mute) {\n this.emit('zoom', [this.currentAxisMin, this.currentAxisMax, this]);\n }\n\n return this;\n }\n\n getSerieShift() {\n return this._serieShift;\n }\n\n getSerieScale() {\n return this._serieScale;\n }\n\n getMouseVal() {\n return this.mouseVal;\n }\n\n getUnitPerTick(px, nbTick, valrange) {\n\n var pxPerTick = px / nbTicks; // 1000 / 100 = 10 px per tick\n if (!nbTick) {\n nbTick = px / 10;\n } else {\n nbTick = Math.min(nbTick, px / 10);\n }\n\n // So now the question is, how many units per ticks ?\n // Say, we have 0.0004 unit per tick\n var unitPerTick = valrange / nbTick;\n\n switch (this.options.unitModification) {\n\n case 'time':\n case 'time:min.sec':\n {\n\n //const max = this.getModifiedValue( this.getMaxValue() );/*,\n /*units = [\n [ 60, 'min' ],\n [ 3600, 'h' ],\n [ 3600 * 24, 'd' ]\n ];*/\n\n let i, l, k, m;\n let breaked = false;\n for (i = 0, l = this.unitModificationTimeTicks.length; i < l; i++) {\n for (k = 0, m = this.unitModificationTimeTicks[i][1].length; k < m; k++) {\n if (unitPerTick < this.unitModificationTimeTicks[i][0] * this.unitModificationTimeTicks[i][1][k]) {\n breaked = true;\n break;\n }\n }\n if (breaked) {\n break;\n }\n }\n\n //i and k contain the good variable;\n if (i !== this.unitModificationTimeTicks.length) {\n unitPerTickCorrect = this.unitModificationTimeTicks[i][0] * this.unitModificationTimeTicks[i][1][k];\n } else {\n unitPerTickCorrect = 1;\n }\n\n break;\n }\n default:\n {\n\n // We take the log\n var decimals = Math.floor(Math.log(unitPerTick) / Math.log(10));\n /*\n Example:\n 13'453 => Math.log10() = 4.12 => 4\n 0.0000341 => Math.log10() = -4.46 => -5\n */\n\n var numberToNatural = unitPerTick * Math.pow(10, -decimals);\n\n /*\n Example:\n 13'453 (4) => 1.345\n 0.0000341 (-5) => 3.41\n */\n\n this.decimals = -decimals;\n\n var possibleTicks = [1, 2, 5, 10];\n var closest = false;\n for (let i = possibleTicks.length - 1; i >= 0; i--) {\n if (!closest || Math.abs(possibleTicks[i] - numberToNatural) < Math.abs(closest - numberToNatural)) {\n closest = possibleTicks[i];\n }\n }\n\n // Ok now closest is the number of unit per tick in the natural number\n /*\n Example:\n 13'453 (4) (1.345) => 1\n 0.0000341 (-5) (3.41) => 5\n */\n\n // Let's scale it back\n var unitPerTickCorrect = closest * Math.pow(10, decimals);\n\n /*\n Example:\n 13'453 (4) (1.345) (1) => 10'000\n 0.0000341 (-5) (3.41) (5) => 0.00005\n */\n break;\n }\n }\n\n var nbTicks = valrange / unitPerTickCorrect;\n\n var pxPerTick = px / nbTick;\n return [unitPerTickCorrect, nbTicks, pxPerTick];\n }\n\n /**\n * Resets the min and max of the serie to fit the series it contains\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setMinMaxToFitSeries(noNotify) {\n\n var interval = this.getInterval();\n\n if (this.options.logScale) {\n\n this.currentAxisMin = Math.max(1e-50, this.getMinValue() * 0.9);\n this.currentAxisMax = Math.max(1e-50, this.getMaxValue() * 1.1);\n } else {\n\n this.currentAxisMin = this.getMinValue();\n this.currentAxisMax = this.getMaxValue();\n\n if (this.getForcedMin() === false) {\n this.currentAxisMin -= this.options.axisDataSpacing.min * interval;\n }\n\n if (this.getForcedMax() === false) {\n this.currentAxisMax += this.options.axisDataSpacing.max * interval;\n }\n }\n\n if (isNaN(this.currentAxisMin) || isNaN(this.currentAxisMax)) {\n this.currentAxisMax = undefined;\n this.currentAxisMin = undefined;\n }\n\n this.cache();\n\n this._zoomed = false;\n\n this.adapt();\n\n if (!noNotify) {\n this.graph._axisHasChanged(this);\n }\n\n this.emit('zoomOutFull', [this.currentAxisMin, this.currentAxisMax, this]);\n\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Number} the maximum interval ( max - min ) of the axis ( not nessarily the current one )\n */\n getInterval() {\n return this.getMaxValue() - this.getMinValue();\n }\n\n /**\n * @memberof Axis\n * @return {Number} the maximum interval ( max - min ) of the axis ( not nessarily the current one )\n */\n getCurrentInterval() {\n return this.cachedInterval;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The current minimum value of the axis\n */\n getCurrentMin() {\n return this.cachedCurrentMin;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The current maximum value of the axis\n */\n getCurrentMax() {\n return this.cachedCurrentMax;\n }\n\n /**\n * Caches the current axis minimum\n * @memberof Axis\n */\n cacheCurrentMin() {\n this.cachedCurrentMin = this.currentAxisMin == this.currentAxisMax ? this.options.logScale ? this.currentAxisMin / 10 : this.currentAxisMin - 1 : this.currentAxisMin;\n }\n\n /**\n * Caches the current axis maximum\n * @memberof Axis\n */\n cacheCurrentMax() {\n this.cachedCurrentMax = this.currentAxisMax == this.currentAxisMin ? this.options.logScale ? this.currentAxisMax * 10 : this.currentAxisMax + 1 : this.currentAxisMax;\n }\n\n /**\n * Caches the current interval\n * @memberof Axis\n */\n cacheInterval() {\n this.cachedInterval = this.cachedCurrentMax - this.cachedCurrentMin;\n }\n\n cache() {\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n }\n\n /**\n * Sets the current minimum value of the axis. If lower that the forced value, the forced value is used\n * @memberof Axis\n * @param {Number} val - The new minimum value\n * @return {Axis} The current axis\n */\n setCurrentMin(val) {\n\n if (val === undefined || this.getForcedMin() !== false && (val < this.getForcedMin() || val === undefined)) {\n val = this.getMinValue();\n }\n\n this.currentAxisMin = val;\n if (this.options.logScale) {\n this.currentAxisMin = Math.max(1e-50, val);\n }\n\n this.cacheCurrentMin();\n this.cacheInterval();\n\n this.graph._axisHasChanged(this);\n return this;\n }\n\n /**\n * Sets the current maximum value of the axis. If higher that the forced value, the forced value is used\n * @memberof Axis\n * @param {Number} val - The new maximum value\n * @return {Axis} The current axis\n */\n setCurrentMax(val) {\n\n if (val === undefined || this.getForcedMax() !== false && (val > this.getForcedMax() || val === undefined)) {\n val = this.getMaxValue();\n }\n\n this.currentAxisMax = val;\n\n if (this.options.logScale) {\n this.currentAxisMax = Math.max(1e-50, val);\n }\n\n this.cacheCurrentMax();\n this.cacheInterval();\n\n this.graph._axisHasChanged(this);\n }\n\n /**\n * Sets the flipping state of the axis. If enabled, the axis is descending rather than ascending.\n * @memberof Axis\n * @param {Boolean} flip - The new flipping state of the axis\n * @return {Axis} The current axis\n */\n flip(flip) {\n this.options.flipped = flip;\n this.setMinMaxFlipped();\n return this;\n }\n /*\n setMinMaxFlipped() {\n var interval = this.maxPx - this.minPx;\n var maxPx = this.maxPx - interval * this.options.span[ 0 ];\n var minPx = this.maxPx - interval * this.options.span[ 1 ];\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n // this.minPx = minPx;\n //this.maxPx = maxPx;\n }\n */\n /**\n * @memberof Axis\n * @return {Boolean} The current flipping state of the axis\n */\n isFlipped() {\n return this.options.flipped;\n }\n\n _draw() {\n // Redrawing of the axis\n\n var self = this;\n // var visible;\n\n // this.drawInit();\n\n if (this.currentAxisMin === undefined || this.currentAxisMax === undefined) {\n this.setMinMaxToFitSeries(true); // We reset the min max as a function of the series\n }\n\n // this.cache();\n\n // this.setSlaveAxesBoundaries();\n\n // The data min max is stored in this.dataMin, this.dataMax\n\n //var widthPx = this.maxPx - this.minPx;\n var widthPx = Math.abs(this.getMaxPx() - this.getMinPx());\n var valrange = this.getCurrentInterval();\n\n /* Number of px per unit */\n /* Example: width: 1000px\n /* \t\t\t10 - 100 => 11.11\n /*\t\t\t0 - 2 => 500\n /*\t\t\t0 - 0.00005 => 20'000'000\n */\n\n if (!this.isShown()) {\n this.line.setAttribute('display', 'none');\n return 0;\n }\n\n this.line.setAttribute('display', 'block');\n\n if (this.options.scientificScale == true) {\n\n if (this.options.scientificScaleExponent) {\n\n this.scientificExponent = this.options.scientificScaleExponent;\n } else {\n this.scientificExponent = Math.floor(Math.log(Math.max(Math.abs(this.getCurrentMax()), Math.abs(this.getCurrentMin()))) / Math.log(10));\n }\n } else {\n this.scientificExponent = 0;\n }\n\n /************************************/\n /*** DRAWING LABEL ******************/\n /************************************/\n\n this.gridLinePath.primary = '';\n this.gridLinePath.secondary = '';\n\n /*\n var label;\n if ( label = this.getLabel() ) {\n // Sets the label\n this.labelTspan.textContent = label;\n }\n */\n let letter;\n if (!this.options.useKatexForLabel || !this.graph.hasKatexRenderer()) {\n\n if (this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && (this.scientificExponent = this.getEngineeringExponent(this.scientificExponent)) && (letter = this.getExponentGreekLetter(this.scientificExponent))) {\n\n this.preunit = letter;\n this.unitTspan.setAttribute('dx', 0);\n } else if (this.scientificExponent !== 0 && !isNaN(this.scientificExponent)) {\n\n if (this.options.engineeringScale) {\n this.scientificExponent = this.getEngineeringExponent(this.scientificExponent);\n }\n\n this.preunit = '';\n\n this.expTspan.setAttribute('display', 'visible');\n this.expTspanExp.setAttribute('display', 'visible');\n\n this.expTspan.textContent = 'x10';\n this.expTspanExp.textContent = this.scientificExponent;\n } else {\n\n if (!this.options.unit) {\n this.unitTspan.setAttribute('display', 'none');\n }\n\n this.preunit = '';\n this.expTspan.setAttribute('display', 'none');\n this.expTspanExp.setAttribute('display', 'none');\n }\n\n this.writeUnit();\n } else {\n\n let string = this.getLabel();\n /*,\n domEl;*/\n\n if (this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && (this.scientificExponent = this.getEngineeringExponent(this.scientificExponent)) && (letter = this.getExponentGreekLetter(this.scientificExponent))) {\n\n string += letter;\n this.preunitTspan.innerHTML = letter;\n this.preunitTspan.setAttribute('display', 'visible');\n this.unitTspan.setAttribute('dx', 0);\n\n string += ' ' + letter + ' ' + this.options.unit;\n } else if (this.scientificExponent !== 0 && !isNaN(this.scientificExponent)) {\n\n if (this.options.engineeringScale) {\n this.scientificExponent = this.getEngineeringExponent(this.scientificExponent);\n }\n string += ' \\\\cdot 10^' + this.scientificExponent + ' ' + this.options.unit;\n }\n\n this.katexElement = this.graph.renderWithKatex(string, this.katexElement);\n }\n\n if (!this.options.hideTicks) {\n\n this.resetTicksLength();\n\n if (this.linkedToAxis) {\n // px defined, linked to another axis\n\n this.linkedToAxis.deltaPx = 10;\n var widthHeight = this.drawLinkedToAxisTicksWrapper(widthPx, valrange);\n } else if (!this.options.logScale) {\n // So the setting is: How many ticks in total ? Then we have to separate it\n\n var widthHeight = this.drawLinearTicksWrapper(widthPx, valrange);\n } else {\n\n var widthHeight = this.drawLogTicks();\n }\n } else {\n var widthHeight = 0;\n }\n\n this.removeUselessTicks();\n this.removeUselessTickLabels();\n\n this.gridPrimary.setAttribute('d', this.gridLinePath.primary);\n this.gridSecondary.setAttribute('d', this.gridLinePath.secondary);\n\n // Looks for axes linked to this current axis\n var axes = this.graph.findAxesLinkedTo(this);\n axes.forEach(function (axis) {\n\n if (!axis.linkedToAxis) {\n return;\n }\n axis.setMinPx(self.getMinPx());\n axis.setMaxPx(self.getMaxPx());\n\n axis.draw();\n });\n\n /************************************/\n /*** DRAW CHILDREN IMPL SPECIFIC ****/\n /************************************/\n\n // this.drawSpecifics();\n\n return widthHeight;\n }\n\n drawLines() {\n\n if (this.options.lineAt && Array.isArray(this.options.lineAt)) {\n\n this.options.lineAt.forEach((val, index) => {\n\n if (!isNaN(val) && this.getCurrentMin() <= val && this.getCurrentMax() >= val) {\n\n this._lines[index] = this._drawLine(val, this._lines[index]);\n } else {\n this._hideLine(this._lines[index]);\n }\n });\n }\n }\n\n writeUnit() {\n if (this.options.unit) {\n\n this.unitTspan.setAttribute('display', 'visible');\n this.unitTspan.setAttribute('dx', 5);\n\n this.expTspan.setAttribute('display', 'none');\n this.expTspanExp.setAttribute('display', 'none');\n this.unitTspan.innerHTML = (this.options.unitWrapperBefore + this.preunit + this.options.unit + this.options.unitWrapperAfter).replace(/\\^([-+0-9]*)(.*)/g, \"$1$2\");\n } else {\n this.unitTspan.setAttribute('display', 'none');\n }\n }\n\n getExponentGreekLetter(val) {\n\n switch (val) {\n\n case 3:\n {\n return 'k';\n }\n\n case 6:\n {\n return 'M';\n }\n case 9:\n {\n return 'G';\n }\n case 12:\n {\n return 'T';\n }\n case 15:\n {\n return 'E';\n }\n case -3:\n {\n return 'm';\n }\n case -6:\n {\n return 'μ';\n }\n case -9:\n {\n return 'n';\n }\n case -12:\n {\n return 'p';\n }\n case -15:\n {\n return 'f';\n }\n default:\n {\n return '';\n }\n }\n }\n\n drawLinearTicksWrapper(widthPx, valrange) {\n\n let tickPrimaryUnit;\n\n if (this.options.primaryTickUnit) {\n\n tickPrimaryUnit = this.options.primaryTickUnit;\n } else {\n\n tickPrimaryUnit = this.getUnitPerTick(widthPx, this.getNbTicksPrimary(), valrange)[0];\n\n if (this.options.maxPrimaryTickUnit && this.options.maxPrimaryTickUnit < tickPrimaryUnit) {\n tickPrimaryUnit = this.options.maxPrimaryTickUnit;\n } else if (this.options.minPrimaryTickUnit && this.options.minPrimaryTickUnit > tickPrimaryUnit) {\n tickPrimaryUnit = this.options.minPrimaryTickUnit;\n }\n }\n\n // We need to get here the width of the ticks to display the axis properly, with the correct shift\n return this.drawTicks(tickPrimaryUnit, this.secondaryTicks());\n }\n\n forcePrimaryTickUnit(primaryInterval) {\n this.options.primaryTickUnit = primaryInterval;\n }\n\n forcePrimaryTickUnitMax(value) {\n this.options.maxPrimaryTickUnit = value;\n }\n\n forcePrimaryTickUnitMin(value) {\n this.options.minPrimaryTickUnit = value;\n }\n\n getPrimaryTickUnit() {\n return this.incrTick;\n }\n\n setTickLabelRatio(tickRatio) {\n this.options.ticklabelratio = tickRatio;\n }\n\n doesHideWhenNoSeriesShown() {\n return this.options.hideWhenNoSeriesShown;\n }\n\n draw() {\n\n this._widthLabels = 0;\n var drawn = this._draw();\n this._widthLabels += drawn;\n return drawn;\n }\n\n drawTicks(primary, secondary) {\n\n var unitPerTick = primary,\n min = this.getCurrentMin(),\n max = this.getCurrentMax(),\n secondaryIncr,\n incrTick,\n subIncrTick,\n loop = 0;\n\n if (secondary) {\n secondaryIncr = unitPerTick / secondary;\n }\n\n incrTick = this.options.shiftToZero ? this.dataMin - Math.ceil((this.dataMin - min) / unitPerTick) * unitPerTick : Math.floor(min / unitPerTick) * unitPerTick;\n this.incrTick = primary;\n\n while (incrTick <= max) {\n\n loop++;\n if (loop > 200) {\n break;\n }\n\n if (secondary) {\n\n subIncrTick = incrTick + secondaryIncr;\n this.subIncrTick = subIncrTick;\n //widthHeight = Math.max(widthHeight, this.drawTick(subIncrTick, 1));\n var loop2 = 0;\n\n while (subIncrTick < incrTick + unitPerTick) {\n loop2++;\n if (loop2 > 100) {\n break;\n }\n\n if (subIncrTick < min || subIncrTick > max) {\n subIncrTick += secondaryIncr;\n continue;\n }\n\n this.drawTickWrapper(subIncrTick, false, Math.abs(subIncrTick - incrTick - unitPerTick / 2) < 1e-4 ? 2 : 3);\n\n subIncrTick += secondaryIncr;\n }\n }\n\n if (incrTick < min || incrTick > max) {\n incrTick += primary;\n continue;\n }\n\n this.drawTickWrapper(incrTick, true, 1);\n incrTick += primary;\n }\n\n this.widthHeightTick = this.getMaxSizeTick();\n return this.widthHeightTick;\n }\n\n nextTick(level, callback) {\n\n this.ticks[level] = this.ticks[level] || [];\n this.lastCurrentTick[level] = this.lastCurrentTick[level] || 0;\n this.currentTick[level] = this.currentTick[level] || 0;\n\n if (this.currentTick[level] >= this.ticks[level].length) {\n var tick = document.createElementNS(this.graph.ns, 'line');\n this.groupTicks.appendChild(tick);\n this.ticks[level].push(tick);\n\n callback(tick);\n }\n\n var tick = this.ticks[level][this.currentTick[level]];\n\n if (this.currentTick[level] >= this.lastCurrentTick[level]) {\n tick.setAttribute('display', 'visible');\n }\n\n this.currentTick[level]++;\n\n return tick;\n }\n\n nextTickLabel(callback) {\n\n this.ticksLabels = this.ticksLabels || [];\n this.lastCurrentTickLabel = this.lastCurrentTickLabel || 0;\n this.currentTickLabel = this.currentTickLabel || 0;\n\n if (this.currentTickLabel >= this.ticksLabels.length) {\n\n var tickLabel = document.createElementNS(this.graph.ns, 'text');\n this.groupTickLabels.appendChild(tickLabel);\n this.ticksLabels.push(tickLabel);\n callback(tickLabel);\n }\n\n var tickLabel = this.ticksLabels[this.currentTickLabel];\n\n if (this.currentTickLabel >= this.lastCurrentTickLabel) {\n tickLabel.setAttribute('display', 'visible');\n }\n\n this.currentTickLabel++;\n\n return tickLabel;\n }\n\n removeUselessTicks() {\n\n for (var j in this.currentTick) {\n\n for (var i = this.currentTick[j]; i < this.ticks[j].length; i++) {\n this.ticks[j][i].setAttribute('display', 'none');\n }\n\n this.lastCurrentTick[j] = this.currentTick[j];\n this.currentTick[j] = 0;\n }\n }\n\n removeUselessTickLabels() {\n\n for (var i = this.currentTickLabel; i < this.ticksLabels.length; i++) {\n this.ticksLabels[i].setAttribute('display', 'none');\n }\n\n this.lastCurrentTickLabel = this.currentTickLabel;\n this.currentTickLabel = 0;\n }\n /*\n doGridLine() {\n var gridLine = document.createElementNS( this.graph.ns, 'line' );\n this.groupGrids.appendChild( gridLine );\n return gridLine;\n };*/\n\n nextGridLine(primary, x1, x2, y1, y2) {\n\n if (!(primary && this.options.primaryGrid || !primary && this.options.secondaryGrid)) {\n return;\n }\n\n this.gridLinePath[primary ? 'primary' : 'secondary'] += 'M ' + x1 + ' ' + y1 + ' L ' + x2 + ' ' + y2;\n }\n\n setGridLineStyle(gridLine, primary) {\n\n gridLine.setAttribute('shape-rendering', 'crispEdges');\n gridLine.setAttribute('stroke', primary ? this.getPrimaryGridColor() : this.getSecondaryGridColor());\n gridLine.setAttribute('stroke-width', primary ? this.getPrimaryGridWidth() : this.getSecondaryGridWidth());\n gridLine.setAttribute('stroke-opacity', primary ? this.getPrimaryGridOpacity() : this.getSecondaryGridOpacity());\n\n var dasharray;\n if (dasharray = primary ? this.getPrimaryGridDasharray() : this.getSecondaryGridDasharray()) {\n gridLine.setAttribute('stroke-dasharray', dasharray);\n }\n }\n\n setGridLinesStyle() {\n this.setGridLineStyle(this.gridPrimary, true);\n this.setGridLineStyle(this.gridSecondary, false);\n return this;\n }\n\n resetTicksLength() {}\n\n secondaryTicks() {\n return this.options.nbTicksSecondary;\n }\n\n drawLogTicks() {\n var min = this.getCurrentMin(),\n max = this.getCurrentMax();\n var incr = Math.min(min, max);\n var max = Math.max(min, max);\n\n if (incr < 1e-50) {\n incr = 1e-50;\n }\n\n if (Math.log(incr) - Math.log(max) > 20) {\n max = Math.pow(10, Math.log(incr) * 20);\n }\n\n var optsMain = {\n fontSize: '1.0em',\n exponential: true,\n overwrite: false\n };\n\n if (incr < 0) {\n incr = 0;\n }\n\n var pow = incr == 0 ? 0 : Math.floor(Math.log(incr) / Math.log(10));\n var incr = 1,\n val;\n while ((val = incr * Math.pow(10, pow)) < max) {\n if (incr == 1) {\n // Superior power\n if (val > min) this.drawTickWrapper(val, true, 1, optsMain);\n }\n if (incr == 10) {\n incr = 1;\n pow++;\n } else {\n\n if (incr != 1 && val > min) {\n\n this.drawTickWrapper(val, false, 2, {\n overwrite: '',\n fontSize: '0.6em'\n });\n }\n\n incr++;\n }\n }\n\n this.widthHeightTick = this.getMaxSizeTick();\n return this.widthHeightTick;\n }\n\n drawTickWrapper(value, label, level, options) {\n\n //var pos = this.getPos( value );\n\n this.drawTick(value, level, options);\n }\n\n /**\n * Used to scale the master axis into the slave axis\n * @function SlaveAxisScalingFunction\n * @param {Number} val - The master value to convert into a slave value\n * @returns undefined\n */\n\n /**\n * Makes this axis a slave. This can be used to show the same data with different units, specifically when a conversion function exists from axis -> slaveAxis but not in reverse. This axis should actually have no series.\n * @param {Axis} axis - The master axis\n * @param {SlaveAxisScalingFunction} scalingFunction - The scaling function used to map masterValue -> slaveValue\n * @param {Number} decimals - The number of decimals to round the value to\n * @memberof Axis\n * @return {Number} The width or height used by the axis (used internally)\n */\n linkToAxis(axis, scalingFunction, decimals) {\n\n this.linkedToAxis = {\n axis: axis,\n scalingFunction: scalingFunction,\n decimals: decimals || 1\n };\n }\n\n drawLinkedToAxisTicksWrapper(widthPx, valrange) {\n\n var opts = this.linkedToAxis,\n px = 0,\n val,\n t,\n l,\n delta2;\n\n // Redrawing the main axis ? Why ?\n //opts.axis.draw();\n\n if (!opts.deltaPx) {\n opts.deltaPx = 10;\n }\n\n do {\n\n val = opts.scalingFunction(opts.axis.getVal(px + this.getMinPx()));\n\n if (opts.decimals) {\n this.decimals = opts.decimals;\n }\n\n t = this.drawTick(val, 1, {}, px + this.getMinPx());\n\n if (!t) {\n console.error(val, px, this.getMinPx());\n throw new Error('Unable to draw tick. Please report the test-case');\n }\n\n l = String(t[1].textContent).length * 8;\n delta2 = Math.round(l / 5) * 5;\n\n if (delta2 > opts.deltaPx) {\n opts.deltaPx = delta2;\n // this.drawInit();\n this.drawLinkedToAxisTicksWrapper(widthPx, valrange);\n return;\n }\n\n px += opts.deltaPx;\n } while (px < widthPx);\n }\n\n /**\n * Transform a value into pixels, according to the axis scaling. The value is referenced to the drawing wrapper, not the the axis minimal value\n * @param {Number} value - The value to translate into pixels\n * @memberof Axis\n * @return {Number} The value transformed into pixels\n */\n getPos(value) {\n return this.getPx(value);\n }\n\n /**\n * @alias Axis~getPos\n */\n getPx(value) {\n // if(this.getMaxPx() == undefined)\n // console.log(this);\n //console.log(this.getMaxPx(), this.getMinPx(), this.getCurrentInterval());\n // Ex 50 / (100) * (1000 - 700) + 700\n\n //console.log( value, this.getCurrentMin(), this.getMaxPx(), this.getMinPx(), this.getCurrentInterval() );\n if (!this.options.logScale) {\n\n return (value - this.getCurrentMin()) / this.getCurrentInterval() * (this.getMaxPx() - this.getMinPx()) + this.getMinPx();\n } else {\n // 0 if value = min\n // 1 if value = max\n\n if (value < 0) return;\n\n var value = (Math.log(value) - Math.log(this.getCurrentMin())) / (Math.log(this.getCurrentMax()) - Math.log(this.getCurrentMin())) * (this.getMaxPx() - this.getMinPx()) + this.getMinPx();\n\n return value;\n }\n }\n\n /**\n * @alias Axis~getPos\n */\n getRoundedPx(value) {\n // if(this.getMaxPx() == undefined)\n // console.log(this);\n //console.log(this.getMaxPx(), this.getMinPx(), this.getCurrentInterval());\n // Ex 50 / (100) * (1000 - 700) + 700\n\n //console.log( value, this.getCurrentMin(), this.getMaxPx(), this.getMinPx(), this.getCurrentInterval() );\n return Math.round(this.getPx(value) * 10) / 10;\n }\n\n /**\n * Transform a pixel position (referenced to the graph zone, not to the axis minimum) into a value, according to the axis scaling.\n * @param {Number} pixels - The number of pixels to translate into a value\n * @memberof Axis\n * @return {Number} The axis value corresponding to the pixel position\n */\n getVal(px) {\n\n if (!this.options.logScale) {\n\n return (px - this.getMinPx()) / (this.getMaxPx() - this.getMinPx()) * this.getCurrentInterval() + this.getCurrentMin();\n } else {\n\n return Math.exp((px - this.getMinPx()) / (this.getMaxPx() - this.getMinPx()) * (Math.log(this.getCurrentMax()) - Math.log(this.getCurrentMin())) + Math.log(this.getCurrentMin()));\n }\n }\n\n /**\n * Transform a delta value into pixels\n * @param {Number} value - The value to translate into pixels\n * @return {Number} The value transformed into pixels\n * @example graph.getBottomAxis().forceMin( 20 ).forceMax( 50 ).getRelPx( 2 ); // Returns how many pixels will be covered by 2 units. Let's assume 600px of width, it's ( 2 / 30 ) * 600 = 40px\n */\n getRelPx(delta) {\n\n return delta / this.getCurrentInterval() * (this.getMaxPx() - this.getMinPx());\n }\n\n /**\n * Transform a delta pixels value into value\n * @param {Number} pixels - The pixel to convert into a value\n * @return {Number} The delta value corresponding to delta pixels\n * @see Axis~getRelPx\n * @example graph.getBottomAxis().forceMin( 20 ).forceMax( 50 ).getRelVal( 40 ); // Returns 2 (for 600px width)\n */\n getRelVal(px) {\n return px / (this.getMaxPx() - this.getMinPx()) * this.getCurrentInterval();\n }\n\n valueToText(value) {\n\n if (this.scientificExponent) {\n\n value /= Math.pow(10, this.scientificExponent);\n return value.toFixed(1);\n } else {\n\n value = value * Math.pow(10, this.getExponentialFactor()) * Math.pow(10, this.getExponentialLabelFactor());\n if (this.options.shiftToZero) {\n value -= this.dataMin;\n }\n if (this.options.ticklabelratio) {\n value *= this.options.ticklabelratio;\n }\n if (this.options.unitModification) {\n value = this.modifyUnit(value, this.options.unitModification);\n return value;\n }\n\n var dec = this.decimals - this.getExponentialFactor() - this.getExponentialLabelFactor();\n\n if (isNaN(value)) {\n return '';\n }\n\n if (dec > 0) {\n value = value.toFixed(dec);\n } else {\n value = value.toFixed(0);\n }\n\n if (this.options.unitInTicks && this.options.unit) {\n value += ' ' + this.options.unit;\n }\n\n return value;\n }\n }\n\n /**\n * Computes a value and returns it in HTML formatting\n * @memberof Axis\n * @param {Number} value - The value to compute\n * @param {Boolean} noScaling - Does not display scaling\n * @param {Boolean} noUnits - Does not display units\n * @return {String} An HTML string containing the computed value\n * @example graph.getXAxis().setUnit( \"m\" ).setUnitDecade( true ).setScientific( true );\n * graph.getXAxis().valueToHtml( 3500 ); // Returns \"3.5 km\"\n * @see Axis#valueToText\n */\n valueToHtml(value, noScaling, noUnits) {\n\n var text = this.valueToText(value);\n var letter;\n\n if (this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && (this.scientificExponent = this.getEngineeringExponent(this.scientificExponent)) && (letter = this.getExponentGreekLetter(this.scientificExponent))) {\n\n text += letter;\n } else if (this.scientificExponent !== 0 && !isNaN(this.scientificExponent) && !noScaling) {\n text += 'x10';\n text += '' + this.scientificExponent + '';\n }\n\n if (this.options.unit && !noUnits) {\n\n text += this.options.unit.replace(/\\^([-+0-9]*)/g, '$1');\n }\n\n return text;\n }\n\n getModifiedValue(value) {\n if (this.options.ticklabelratio) {\n value *= this.options.ticklabelratio;\n }\n\n if (this.options.shiftToZero) {\n value -= this.getMinValue() * (this.options.ticklabelratio || 1);\n }\n\n return value;\n }\n\n modifyUnit(value, mode) {\n\n var text = '';\n var incr = this.incrTick;\n var umin;\n\n switch (mode) {\n\n case 'time':\n // val must be in seconds => transform in hours / days / months\n var max = this.getModifiedValue(this.getMaxValue()),\n units = [[60, 'min'], [3600, 'h'], [3600 * 24, 'd']];\n\n if (max < 3600) {\n // to minutes\n umin = 0;\n } else if (max < 3600 * 24) {\n umin = 1;\n } else if (max < 3600 * 24 * 30) {\n umin = 2;\n }\n\n if (!units[umin]) {\n return false;\n }\n\n value = value / units[umin][0];\n var valueRounded = Math.floor(value);\n text = valueRounded + units[umin][1];\n\n // Addind lower unit for precision\n umin--;\n while (incr < 1 * units[umin + 1][0] && umin > -1) {\n\n value = (value - valueRounded) * units[umin + 1][0] / units[umin][0];\n valueRounded = Math.round(value);\n text += ' ' + valueRounded + units[umin][1];\n umin--;\n }\n\n break;\n\n case 'time:min.sec':\n value = value / 60;\n var valueRounded = Math.floor(value);\n var s = Math.round((value - valueRounded) * 60) + '';\n s = s.length == 1 ? '0' + s : s;\n text = valueRounded + '.' + s;\n break;\n\n default:\n break;\n }\n\n return text;\n }\n\n getExponentialFactor() {\n return this.options.exponentialFactor;\n }\n\n setExponentialFactor(value) {\n this.options.exponentialFactor = value;\n }\n\n setExponentialLabelFactor(value) {\n this.options.exponentialLabelFactor = value;\n }\n\n getExponentialLabelFactor() {\n return this.options.exponentialLabelFactor;\n }\n\n /**\n * Sets the label of the axis\n * @param {Number} label - The label to display under the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setLabel(label) {\n this.options.labelValue = label;\n return this;\n }\n\n setLabelFont(font) {\n this.options.labelFont = font;\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {String} The label value\n */\n getLabel() {\n return this.options.labelValue;\n }\n\n setSpan(_from, _to) {\n\n this.options.span = [_from, _to];\n return this;\n }\n\n getSpan() {\n return this.options.span;\n }\n\n setLevel(level) {\n this._level = level;\n return this;\n }\n\n getLevel() {\n return this._level;\n }\n\n setShift(shift) {\n this.shift = shift;\n }\n\n getShift() {\n return this.shift;\n }\n\n /**\n * Changes the tick position\n * @param {Number} pos - The new position ( \"outside\", \"centered\" or \"inside\" )\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setTickPosition(pos) {\n switch (pos) {\n case 3:\n case 'outside':\n case Graph$1.TICKS_OUTSIDE:\n {\n pos = 3;\n break;\n }\n\n case 2:\n case 'centered':\n case Graph$1.TICKS_CENTERED:\n {\n pos = 2;\n break;\n }\n\n case 1:\n case 'inside':\n case Graph$1.TICKS_INSIDE:\n default:\n {\n pos = 1;\n break;\n }\n }\n\n this.options.tickPosition = pos;\n\n switch (this.options.tickPosition) {\n case 3:\n this.tickPx1 = -2;\n this.tickPx2 = 0;\n break;\n\n case 2:\n this.tickPx1 = -1;\n this.tickPx2 = 1;\n break;\n\n default:\n case 1:\n this.tickPx1 = 0;\n this.tickPx2 = 2;\n break;\n }\n\n return this;\n }\n\n /**\n * Displays or hides the axis grids\n * @param {Boolean} on - true to enable the grids, false to disable them\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setGrids(on) {\n this.options.primaryGrid = on;\n this.options.secondaryGrid = on;\n return this;\n }\n\n /**\n * Displays or hides the axis primary grid\n * @param {Boolean} on - true to enable the grids, false to disable it\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setPrimaryGrid(on) {\n this.options.primaryGrid = on;\n return this;\n }\n\n /**\n * Displays or hides the axis secondary grid\n * @param {Boolean} on - true to enable the grids, false to disable it\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setSecondaryGrid(on) {\n this.options.secondaryGrid = on;\n return this;\n }\n\n /**\n * Enables primary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n primaryGridOn() {\n return this.setPrimaryGrid(true);\n }\n\n /**\n * Disables primary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n primaryGridOff() {\n return this.setPrimaryGrid(false);\n }\n\n /**\n * Enables secondary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n secondaryGridOn() {\n return this.setSecondaryGrid(true);\n }\n\n /**\n * Disables secondary grid\n * @return {Axis} The current axis\n */\n secondaryGridOff() {\n return this.setSecondaryGrid(false);\n }\n\n /**\n * Enables all the grids\n * @return {Axis} The current axis\n */\n gridsOn() {\n return this.setGrids(true);\n }\n\n /**\n * Disables all the grids\n * @return {Axis} The current axis\n */\n gridsOff() {\n return this.setGrids(false);\n }\n\n /**\n * @alias Axis#gridsOff\n */\n turnGridsOff() {\n return this.gridsOff(...arguments);\n }\n\n /**\n * @alias Axis#gridsOn\n */\n turnGridsOn() {\n return this.gridsOn(...arguments);\n }\n\n /**\n * Sets the axis color\n * @memberof Axis\n * @param {String} color - The color to set the axis\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setAxisColor(color) {\n this.options.axisColor = color;\n return this;\n }\n\n /**\n * Gets the axis color\n * @memberof Axis\n * @return {String} The color of the axis\n * @since 1.13.2\n */\n getAxisColor() {\n return this.options.axisColor || 'black';\n }\n\n setTickLabelOffset(offsetValue) {\n this.options.tickLabelOffset = offsetValue;\n return this;\n }\n\n /**\n * Sets the color of the main ticks\n * @memberof Axis\n * @param {String} color - The new color of the primary ticks\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setPrimaryTicksColor(color) {\n this.options.primaryTicksColor = color;\n return this;\n }\n\n /**\n * Gets the color of the main ticks\n * @memberof Axis\n * @return {String} The color of the primary ticks\n * @since 1.13.2\n */\n getPrimaryTicksColor() {\n return this.options.primaryTicksColor || 'black';\n }\n\n /**\n * Sets the color of the secondary ticks\n * @memberof Axis\n * @param {String} color - The new color of the secondary ticks\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setSecondaryTicksColor(color) {\n this.options.secondaryTicksColor = color;\n return this;\n }\n\n /**\n * Gets the color of the secondary ticks\n * @memberof Axis\n * @return {String} The color of the secondary ticks\n * @since 1.13.2\n */\n getSecondaryTicksColor() {\n return this.options.secondaryTicksColor || 'black';\n }\n\n /**\n * Sets the color of the tick labels\n * @memberof Axis\n * @param {String} color - The new color of the tick labels\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setTicksLabelColor(color) {\n this.options.ticksLabelColor = color;\n if (Array.isArray(this.ticksLabels)) {\n this.ticksLabels.forEach(tick => {\n tick.setAttribute('fill', color);\n });\n }\n return this;\n }\n\n /**\n * Gets the color of the tick labels\n * @memberof Axis\n * @return {String} The color of the tick labels\n * @since 1.13.2\n */\n getTicksLabelColor() {\n return this.options.ticksLabelColor || 'black';\n }\n\n /**\n * Sets the color of the primary grid\n * @memberof Axis\n * @param {String} color - The primary grid color\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridColor(color) {\n this.options.primaryGridColor = color;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the color of the primary grid\n * @memberof Axis\n * @return {String} color - The primary grid color\n * @since 1.13.3\n */\n getPrimaryGridColor() {\n return this.options.primaryGridColor;\n }\n\n /**\n * Sets the color of the primary grid\n * @memberof Axis\n * @param {String} color - The primary grid color\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridColor(color) {\n this.options.secondaryGridColor = color;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the color of the secondary grid\n * @memberof Axis\n * @return {String} color - The secondary grid color\n * @since 1.13.3\n */\n getSecondaryGridColor() {\n return this.options.secondaryGridColor;\n }\n\n /**\n * Sets the width of the primary grid lines\n * @memberof Axis\n * @param {Number} width - The width of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridWidth(width) {\n this.options.primaryGridWidth = width;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the width of the primary grid lines\n * @memberof Axis\n * @return {Number} width - The width of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridWidth() {\n return this.options.primaryGridWidth;\n }\n\n /**\n * Sets the width of the secondary grid lines\n * @memberof Axis\n * @param {Number} width - The width of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridWidth(width) {\n this.options.secondaryGridWidth = width;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the width of the secondary grid lines\n * @memberof Axis\n * @return {Number} width - The width of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridWidth() {\n return this.options.secondaryGridWidth;\n }\n\n /**\n * Sets the opacity of the primary grid lines\n * @memberof Axis\n * @param {Number} opacity - The opacity of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridOpacity(opacity) {\n this.options.primaryGridOpacity = opacity;\n return this;\n }\n\n /**\n * Gets the opacity of the primary grid lines\n * @memberof Axis\n * @return {Number} opacity - The opacity of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridOpacity() {\n return this.options.primaryGridOpacity;\n }\n\n /**\n * Sets the opacity of the secondary grid lines\n * @memberof Axis\n * @param {Number} opacity - The opacity of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridOpacity(opacity) {\n this.options.secondaryGridOpacity = opacity;\n return this;\n }\n\n /**\n * Gets the opacity of the secondary grid lines\n * @memberof Axis\n * @return {Number} opacity - The opacity of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridOpacity() {\n return this.options.secondaryGridOpacity;\n }\n\n /**\n * Sets the dasharray of the primary grid lines\n * @memberof Axis\n * @param {String} dasharray - The dasharray of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridDasharray(dasharray) {\n this.options.primaryGridDasharray = dasharray;\n return this;\n }\n\n /**\n * Gets the dasharray of the primary grid lines\n * @memberof Axis\n * @return {String} dasharray - The dasharray of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridDasharray() {\n return this.options.primaryGridDasharray;\n }\n\n /**\n * Sets the dasharray of the secondary grid lines\n * @memberof Axis\n * @param {String} dasharray - The dasharray of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridDasharray(dasharray) {\n this.options.secondaryGridDasharray = dasharray;\n return this;\n }\n\n /**\n * Gets the dasharray of the secondary grid lines\n * @memberof Axis\n * @return {String} dasharray - The dasharray of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridDasharray() {\n return this.options.secondaryGridDasharray;\n }\n\n /**\n * Sets the color of the label\n * @memberof Axis\n * @param {String} color - The new color of the label\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setLabelColor(color) {\n this.options.labelColor = color;\n return this;\n }\n\n /**\n * Gets the color of the label\n * @memberof Axis\n * @return {String} The color of the label\n * @since 1.13.2\n */\n getLabelColor() {\n return this.options.labelColor;\n }\n\n setTickContent(dom, val, options) {\n if (!options) options = {};\n\n if (options.overwrite || !options.exponential) {\n\n dom.textContent = options.overwrite || this.valueToText(val);\n } else {\n var log = Math.round(Math.log(val) / Math.log(10));\n var unit = Math.floor(val * Math.pow(10, -log));\n\n dom.textContent = unit != 1 ? unit + 'x10' : '10';\n var tspan = document.createElementNS(this.graph.ns, 'tspan');\n tspan.textContent = log;\n tspan.setAttribute('font-size', '0.7em');\n tspan.setAttribute('dy', -5);\n dom.appendChild(tspan);\n }\n\n if (options.fontSize) {\n dom.setAttribute('font-size', options.fontSize);\n }\n }\n\n /**\n * @memberof Axis\n * @returns {Boolean} true if it is an x axis, false otherwise\n */\n isX() {\n return false;\n }\n\n /**\n * @memberof Axis\n * @returns {Boolean} true if it is an y axis, false otherwise\n */\n isY() {\n return false;\n }\n\n /**\n * Sets the unit of the axis\n * @param {String} unit - The unit of the axis\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setUnit(unit) {\n this.options.unit = unit;\n return this;\n }\n\n /**\n * Places the unit in every tick\n * @param {Boolean} bool - ```true``` to place the unit, ```false``` otherwise\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 2.0.44\n */\n setUnitInTicks(bool) {\n this.options.unitInTicks = bool;\n return this;\n }\n\n /**\n * Sets characters wrapping the unit\n * @param {String} before - The string to insert before\n * @param {String} after - The string to insert after\n * @return {Axis} The current axis\n * @memberof Axis\n * @example axis.setUnitWrapper(\"[\", \"]\").setUnit('m'); // Will display [m]\n * @since 1.13.3\n */\n setUnitWrapper(before, after) {\n this.options.unitWrapperBefore = before;\n this.options.unitWrapperAfter = after;\n return this;\n }\n\n /**\n * Allows the unit to scale with thousands\n * @param {Boolean} on - Enables this mode\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setUnitDecade(on) {\n this.options.unitDecade = on;\n return this;\n }\n\n /**\n * Enable the scientific mode for the axis values. This way, big numbers can be avoided, e.g. \"1000000000\" would be displayed 1 with 109 or \"G\" shown on near the axis unit.\n * @param {Boolean} on - Enables the scientific mode\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setScientific(on) {\n this.options.scientificScale = on;\n return this;\n }\n\n /**\n * In the scientific mode, forces the axis to take a specific power of ten. Useful if you want to show kilometers instead of meters for example. In this case you would use \"3\" as a value.\n * @param {Number} scientificScaleExponent - Forces the scientific scale to take a defined power of ten\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n * @see Axis#setScientific\n */\n setScientificScaleExponent(scientificScaleExponent) {\n this.options.scientificScaleExponent = scientificScaleExponent;\n return this;\n }\n\n /**\n * The engineer scaling is similar to the scientific scaling ({@link Axis#setScientificScale}) but allowing only mupltiples of 3 to be used to scale the axis (for instance, go from grams to kilograms while skipping decagrams and hexagrams)\n * @param {Boolean} engineeringScaling - true to turn on the engineering scaling\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n * @see Axis#setScientific\n */\n setEngineering(engineeringScaling) {\n //bool\n this.options.scientificScale = engineeringScaling;\n this.options.engineeringScale = engineeringScaling;\n return this;\n }\n\n /**\n * Calculates the closest engineering exponent from a scientific exponent\n * @param {Number} scientificExponent - The exponent of 10 based on which the axis will be scaled\n * @return {Number} The appropriate engineering exponent\n * @memberof Axis\n * @since 1.13.3\n * @private\n */\n getEngineeringExponent(scientificExponent) {\n\n if (scientificExponent > 0) {\n scientificExponent -= scientificExponent % 3;\n } else {\n scientificExponent -= (3 - -scientificExponent % 3) % 3;\n }\n\n return scientificExponent;\n }\n\n /**\n * Enables log scaling\n * @param {Boolean} logScale - ```true``` to enable the log scaling, ```false``` to disable it\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setLogScale(log) {\n this.options.logScale = log;\n return this;\n }\n\n isZoomed() {\n return !(this.currentAxisMin == this.getMinValue() || this.currentAxisMax == this.getMaxValue());\n }\n\n hasAxis() {\n return false;\n }\n\n getType() {\n return null;\n }\n\n useKatexForLabel(use = true) {\n this.options.useKatexForLabel = use;\n return this;\n }\n\n}\n\n/**\n * @alias Axis#getVal\n */\nAxis.prototype.getValue = Axis.prototype.getVal;\n\n/**\n * @alias Axis#getRelPx\n */\nAxis.prototype.getDeltaPx = Axis.prototype.getRelPx;\n\n/**\n * Generic constructor of a y axis\n * @augments Axis\n */\nclass AxisX extends Axis {\n\n constructor(graph, topbottom, options = {}) {\n\n super(graph, topbottom, options);\n this.top = topbottom == 'top';\n }\n\n /**\n * @private\n * Returns the position of the axis, used by refreshDrawingZone in core module\n */\n getAxisPosition() {\n\n if (!this.options.display) {\n return 0;\n }\n\n let size;\n\n if (this.options.tickLabelOffset == 0) {\n // Normal mode, no offset\n size = this.options.tickPosition == 1 ? 8 : 20;\n size += this.graph.options.fontSize * 1;\n } else {\n // With an offset, and ticks inside, axis position is actually 0. Otherwise, it's the heights of the ticks\n size = this.options.tickPosition == 1 ? 0 : 12;\n }\n\n if (this.getLabel()) {\n size += this.graph.options.fontSize;\n }\n\n return size;\n }\n\n /**\n * @returns {Boolean} always ```true```\n */\n isX() {\n return true;\n }\n\n /**\n * @returns {Boolean} always ```false```\n */\n isY() {\n return false;\n }\n\n /**\n * @private\n * Used to set the x position of the axis\n */\n setShift(shift) {\n\n this.shift = shift;\n if (this.getShift() === undefined || !this.graph.getDrawingHeight()) {\n return;\n }\n\n this.group.setAttribute('transform', 'translate(0 ' + (this.floating ? this.getShift() : this.top ? this.shift : this.graph.getDrawingHeight() - this.shift) + ')');\n }\n\n /**\n * Caclulates the maximum tick height\n * @return {Number} The maximum tick height\n */\n getMaxSizeTick() {\n return (this.top ? -1 : 1) * (this.options.tickPosition == 1 ? 10 : 10);\n }\n\n /**\n * Draws a tick. Mostly used internally but it can be useful if you want to make your own axes\n * @param {Number} value - The value in axis unit to place the tick\n * @param {Number} level - The importance of the tick\n * @param {Object} options - Further options to be passed to ```setTickContent```\n * @param {Number} forcedPos - Forces the position of the tick (for axis dependency)\n */\n drawTick(value, level, options, forcedPos) {\n\n var self = this,\n val;\n\n val = forcedPos || this.getPos(value);\n\n if (val == undefined || isNaN(val)) {\n return;\n }\n\n var tick = this.nextTick(level, function (tick) {\n\n tick.setAttribute('y1', (self.top ? 1 : -1) * self.tickPx1 * self.tickScaling[level]);\n tick.setAttribute('y2', (self.top ? 1 : -1) * self.tickPx2 * self.tickScaling[level]);\n\n if (level == 1) {\n tick.setAttribute('stroke', self.getPrimaryTicksColor());\n } else {\n tick.setAttribute('stroke', self.getSecondaryTicksColor());\n }\n });\n\n // tick.setAttribute( 'shape-rendering', 'crispEdges' );\n tick.setAttribute('x1', val);\n tick.setAttribute('x2', val);\n\n this.nextGridLine(level == 1, val, val, 0, this.graph.getDrawingHeight());\n\n // this.groupTicks.appendChild( tick );\n if (level == 1) {\n var tickLabel = this.nextTickLabel(tickLabel => {\n\n tickLabel.setAttribute('y', (self.top ? -1 : 1) * ((self.options.tickPosition == 1 ? 8 : 20) + (self.top ? 10 : 0)) + this.options.tickLabelOffset);\n tickLabel.setAttribute('text-anchor', 'middle');\n if (self.getTicksLabelColor() !== 'black') {\n tickLabel.setAttribute('fill', self.getTicksLabelColor());\n }\n tickLabel.style.dominantBaseline = 'hanging';\n });\n\n tickLabel.setAttribute('x', val);\n this.setTickContent(tickLabel, value, options);\n }\n // this.ticks.push( tick );\n\n return [tick, tickLabel];\n }\n\n drawLabel() {\n // Place label correctly\n\n if (this.getLabelColor() !== 'black') {\n this.label.setAttribute('fill', this.getLabelColor());\n }\n\n if (this.options.labelFont) {\n this.label.setAttribute('font-family', this.options.labelFont);\n }\n\n this.label.setAttribute('text-anchor', 'middle');\n this.label.setAttribute('style', 'display: initial;');\n this.label.setAttribute('x', Math.abs(this.getMaxPx() + this.getMinPx()) / 2);\n this.label.setAttribute('y', (this.top ? -1 : 1) * ((this.options.tickPosition == 1 ? 10 : 25) + this.graph.options.fontSize));\n this.labelTspan.textContent = this.getLabel();\n }\n\n draw() {\n var tickWidth = super.draw(...arguments);\n this.drawSpecifics();\n\n return tickWidth;\n }\n /**\n * Paints the label, the axis line and anything else specific to x axes\n */\n drawSpecifics() {\n\n // Adjusts group shift\n //this.group.setAttribute('transform', 'translate(0 ' + this.getShift() + ')');\n\n this.drawLabel();\n\n this.line.setAttribute('x1', this.getMinPx());\n this.line.setAttribute('x2', this.getMaxPx());\n this.line.setAttribute('y1', 0);\n this.line.setAttribute('y2', 0);\n\n this.line.setAttribute('stroke', this.getAxisColor());\n\n if (!this.top) {\n\n this.labelTspan.style.dominantBaseline = 'hanging';\n this.expTspan.style.dominantBaseline = 'hanging';\n this.expTspanExp.style.dominantBaseline = 'hanging';\n\n this.unitTspan.style.dominantBaseline = 'hanging';\n // this.preunitTspan.style.dominantBaseline = 'hanging';\n }\n\n var span = this.getSpan();\n this.line.setAttribute('marker-start', !this.options.splitMarks || span[0] == 0 ? '' : 'url(#horionzalsplit_' + this.graph.getId() + ')');\n this.line.setAttribute('marker-end', !this.options.splitMarks || span[1] == 1 ? '' : 'url(#horionzalsplit_' + this.graph.getId() + ')');\n }\n\n /**\n * @private\n */\n _drawLine(pos, line) {\n\n let px = this.getPx(pos);\n\n if (!line) {\n line = document.createElementNS(this.graph.ns, 'line');\n } else {\n line.setAttribute('display', 'initial');\n }\n\n line.setAttribute('x1', px);\n line.setAttribute('x2', px);\n\n line.setAttribute('y1', 0);\n line.setAttribute('y2', this.graph.drawingSpaceHeight);\n\n line.setAttribute('stroke', 'black');\n this.group.appendChild(line);\n\n return line;\n }\n\n _hideLine(line) {\n if (!line) {\n return;\n }\n line.setAttribute('display', 'none');\n }\n\n /**\n * @private\n */\n handleMouseMoveLocal(x) {\n // handleMouseMoveLocal( x, y, e )\n x -= this.graph.getPaddingLeft();\n this.mouseVal = this.getVal(x);\n }\n\n /**\n * Caches the minimum px and maximum px position of the axis. Includes axis spans and flipping. Mostly used internally\n */\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n\n if (isNaN(interval)) {\n return;\n }\n\n var maxPx = interval * this.options.span[1] + this.minPx - this.options.marginMax;\n var minPx = interval * this.options.span[0] + this.minPx + this.options.marginMin;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n }\n\n getZProj(zValue) {\n return zValue * this.graph.options.zAxis.shiftX;\n }\n\n}\n\n/**\n * Generic constructor of a y axis\n * @extends Axis\n */\nclass AxisY extends Axis {\n\n constructor(graph, leftright, options) {\n\n super(graph, leftright, options);\n this.leftright = leftright;\n this.left = leftright == 'left';\n }\n\n /**\n * @private\n */\n setAxisPosition(shift) {\n this.shiftPosition = shift;\n }\n\n getAxisPosition() {\n return this.shiftPosition || 0;\n }\n\n getAdditionalWidth() {\n let pos = 0;\n if (this.getLabel()) {\n pos += this.graph.options.fontSize;\n }\n\n if (this.isShown()) {\n pos += Math.abs(this.tickMargin);\n }\n return pos;\n }\n\n /**\n * @returns {Boolean} always ```false```\n */\n isX() {\n return false;\n }\n\n /**\n * @returns {Boolean} always ```true```\n */\n isY() {\n return true;\n }\n\n /**\n * @private\n */\n resetTicksLength() {\n this.longestTick = [false, 0];\n }\n\n /**\n * @private\n */\n getMaxSizeTick() {\n // Gives an extra margin of 5px\n return this.longestTick && this.longestTick[0] ? this.longestTick[0].getComputedTextLength() + 5 : 0; //(this.left ? 10 : 0);\n }\n\n draw() {\n\n this.tickMargin = this.left ? -5 - this.tickPx1 * this.tickScaling[1] : 2 - this.tickPx1 * this.tickScaling[1];\n var tickWidth = super.draw(...arguments);\n tickWidth += this.getAdditionalWidth();\n this.drawSpecifics(tickWidth);\n\n this.fullwidthlabel = tickWidth;\n\n return tickWidth;\n }\n\n equalizePosition(width) {\n\n this.placeLabel(this.left ? -width : width);\n\n if (this.getLabel()) {\n return width + this.graph.options.fontSize;\n }\n\n return 0;\n }\n\n /**\n * @private\n */\n drawTick(value, level, options, forcedPos) {\n let pos, tick, tickLabel;\n\n pos = forcedPos || this.getPos(value);\n\n if (pos == undefined || isNaN(pos)) {\n return;\n }\n\n tick = this.nextTick(level, tick => {\n\n tick.setAttribute('x1', (this.left ? 1 : -1) * this.tickPx1 * this.tickScaling[level]);\n tick.setAttribute('x2', (this.left ? 1 : -1) * this.tickPx2 * this.tickScaling[level]);\n\n if (level == 1) {\n tick.setAttribute('stroke', this.getPrimaryTicksColor());\n } else {\n tick.setAttribute('stroke', this.getSecondaryTicksColor());\n }\n });\n\n tick.setAttribute('y1', pos);\n tick.setAttribute('y2', pos);\n\n this.nextGridLine(level == 1, 0, this.graph.getDrawingWidth(), pos, pos);\n\n // this.groupTicks.appendChild( tick );\n if (level == 1) {\n tickLabel = this.nextTickLabel(tickLabel => {\n\n tickLabel.setAttribute('x', this.tickMargin + this.options.tickLabelOffset);\n if (this.getTicksLabelColor() !== 'black') {\n tickLabel.setAttribute('fill', this.getTicksLabelColor());\n }\n\n if (this.left) {\n tickLabel.setAttribute('text-anchor', 'end');\n } else {\n tickLabel.setAttribute('text-anchor', 'start');\n }\n tickLabel.style.dominantBaseline = 'central';\n });\n\n tickLabel.setAttribute('y', pos);\n this.setTickContent(tickLabel, value, options);\n\n if (String(tickLabel.textContent).length >= this.longestTick[1]) {\n this.longestTick[0] = tickLabel;\n this.longestTick[1] = String(tickLabel.textContent).length;\n }\n }\n }\n\n drawLabel() {\n\n if (this.getLabelColor() !== 'black') {\n this.label.setAttribute('fill', this.getLabelColor());\n }\n\n this.label.setAttribute('dominant-baseline', !this.left ? 'auto' : 'auto');\n this.labelTspan.textContent = this.getLabel();\n }\n\n placeLabel(y) {\n this.label.setAttribute('transform', 'translate(' + y + ', ' + Math.abs(this.getMaxPx() + this.getMinPx()) / 2 + ') rotate(-90)');\n }\n\n /**\n * @private\n */\n drawSpecifics() {\n // Place label correctly\n //this.label.setAttribute('x', (this.getMaxPx() - this.getMinPx()) / 2);\n /*\n if ( !this.left ) {\n this.labelTspan.style.dominantBaseline = 'hanging';\n this.expTspan.style.dominantBaseline = 'hanging';\n this.expTspanExp.style.dominantBaseline = 'hanging';\n this.unitTspan.style.dominantBaseline = 'hanging';\n this.preunitTspan.style.dominantBaseline = 'hanging';\n }\n */\n this.line.setAttribute('y1', this.getMinPx());\n this.line.setAttribute('y2', this.getMaxPx());\n this.line.setAttribute('x1', 0);\n this.line.setAttribute('x2', 0);\n\n this.line.setAttribute('stroke', this.getAxisColor());\n\n var span = this.getSpan();\n this.line.setAttribute('marker-start', !this.options.splitMarks || span[0] == 0 ? '' : 'url(#verticalsplit_' + this.graph.getId() + ')');\n this.line.setAttribute('marker-end', !this.options.splitMarks || span[1] == 1 ? '' : 'url(#verticalsplit_' + this.graph.getId() + ')');\n }\n\n /**\n * @private\n */\n setShift(shift) {\n\n this.shift = shift;\n\n if (!this.shift || !this.graph.getWidth()) {\n return;\n }\n\n let xshift = this.shift;\n xshift = this.floating ? xshift : this.isLeft() ? xshift : this.graph.getWidth() - this.graph.getPaddingRight() - this.graph.getPaddingLeft() - xshift;\n this.group.setAttribute('transform', 'translate( ' + xshift + ' 0 )');\n this.drawLabel();\n }\n\n /**\n * @private\n */\n isLeft() {\n return this.left;\n }\n\n /**\n * @private\n */\n isRight() {\n return !this.left;\n }\n\n /**\n * @private\n */\n isFlipped() {\n return !this.options.flipped;\n }\n\n /**\n * @private\n */\n _drawLine(pos, line) {\n\n let px = this.getPx(pos);\n\n if (!line) {\n line = document.createElementNS(this.graph.ns, 'line');\n } else {\n line.setAttribute('display', 'initial');\n }\n\n line.setAttribute('y1', px);\n line.setAttribute('y2', px);\n\n line.setAttribute('x1', 0);\n line.setAttribute('x2', this.graph.drawingSpaceWidth);\n\n line.setAttribute('stroke', 'black');\n this.group.appendChild(line);\n\n return line;\n }\n\n _hideLine(line) {\n if (!line) {\n return;\n }\n\n line.setAttribute('display', 'none');\n }\n\n /**\n * @private\n */\n handleMouseMoveLocal(x, y) {\n y -= this.graph.getPaddingTop();\n this.mouseVal = this.getVal(y);\n }\n\n /**\n * Scales the axis with respect to the series contained in an x axis\n * @param {Axis} [ axis = graph.getXAxis() ] - The X axis to use as a reference\n * @param {Serie} [ excludeSerie ] - A serie to exclude\n * @param {Number} [ start = xaxis.getCurrentMin() ] - The start of the boundary\n * @param {Number} [ end = xaxis.getCurrentMax() ] - The end of the boundary\n * @param {Boolean} [ min = true ] - Adapt the min\n * @param {Boolean} [ max = true ] - Adapt the max\n * @returns {Axis} The current axis\n */\n scaleToFitAxis(axis, excludeSerie, start, end, min, max) {\n //console.log( axis instanceof GraphAxis );\n if (!axis || !axis.isX()) {\n axis = this.graph.getXAxis();\n }\n\n if (isNaN(start)) {\n start = axis.getCurrentMin();\n }\n\n if (isNaN(end)) {\n end = axis.getCurrentMax();\n }\n\n if (min === undefined) {\n min = true;\n }\n\n if (max === undefined) {\n max = true;\n }\n\n if (typeof excludeSerie == 'number') {\n end = start;\n start = excludeSerie;\n excludeSerie = false;\n }\n\n var maxV = -Infinity,\n minV = Infinity,\n j = 0;\n\n for (var i = 0, l = this.graph.series.length; i < l; i++) {\n\n if (!this.graph.series[i].isShown()) {\n continue;\n }\n\n if (this.graph.series[i] == excludeSerie) {\n continue;\n }\n\n if (!(this.graph.series[i].getXAxis() == axis) || this.graph.series[i].getYAxis() !== this) {\n continue;\n }\n\n j++;\n\n maxV = max ? Math.max(maxV, this.graph.series[i].getMax(start, end)) : 0;\n minV = min ? Math.min(minV, this.graph.series[i].getMin(start, end)) : 0;\n }\n\n if (j == 0) {\n\n this.setMinMaxToFitSeries(); // No point was found\n } else {\n\n // If we wanted originally to resize min and max. Otherwise we use the current value\n minV = min ? minV : this.getCurrentMin();\n maxV = max ? maxV : this.getCurrentMax();\n\n var interval = maxV - minV;\n\n minV -= this.options.axisDataSpacing.min * interval;\n maxV += this.options.axisDataSpacing.max * interval;\n\n this._doZoomVal(minV, maxV);\n }\n\n return this;\n }\n\n /**\n * Caches the minimum px and maximum px position of the axis. Includes axis spans and flipping. Mostly used internally\n * @return {Axis} The current axis instance\n */\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n\n if (isNaN(interval)) {\n return;\n }\n\n var maxPx = this.maxPx - interval * this.options.span[0] - this.options.marginMin;\n var minPx = this.maxPx - interval * this.options.span[1] + this.options.marginMax;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n }\n\n getZProj(zValue) {\n return zValue * this.graph.options.zAxis.shiftY;\n }\n\n}\n\n/**\n * Generic constructor of a y axis\n * @class AxisXBar\n * @augments Axis\n */\nclass AxisXBar extends AxisX {\n\n constructor(graph, topbottom, options = {}) {\n super(graph, topbottom, options);\n }\n\n /**\n * @param {Object[]} categories - Categories array\n * @param {(String|Number)} categories[].title - The title of the category (to be dispalyed)\n * @param {(String|Number)} categories[].name - The name of the category (to indentify series)\n * @returns {AxisBar} The current axis instance\n */\n set categories(categories) {\n this._barCategories = categories;\n return this;\n }\n\n draw() {\n\n var self = this,\n tickLabel,\n elements = this._barCategories;\n\n this.forceMin(0);\n this.forceMax(1);\n\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n\n if (!elements) {\n return;\n }\n\n if (!Array.isArray(elements)) {\n elements = [elements];\n }\n\n // this.drawInit();\n\n //var widthPerElement = width / elements.length;\n for (var i = 0; i <= elements.length; i++) {\n this.drawTick(i / elements.length, 2);\n\n if (i < elements.length) {\n tickLabel = this.nextTickLabel(function (tickLabel) {\n\n tickLabel.setAttribute('y', (self.top ? -1 : 1) * ((self.options.tickPosition == 1 ? 8 : 20) + (self.top ? 10 : 0)));\n tickLabel.setAttribute('text-anchor', 'middle');\n if (self.getTicksLabelColor() !== 'black') {\n tickLabel.setAttribute('fill', self.getTicksLabelColor());\n }\n tickLabel.style.dominantBaseline = 'hanging';\n });\n\n tickLabel.setAttribute('x', this.getPos((i + 0.5) / elements.length));\n tickLabel.textContent = elements[i].title;\n }\n }\n\n this.drawSpecifics();\n return this;\n }\n\n /**\n * Sets the series automatically\n * @returns {AxisBar} The current axis instance\n */\n autoSeries() {\n\n let series = [];\n for (let serie of this.graph.series) {\n if (serie.getXAxis() == this) {\n series.push(serie);\n }\n }\n\n this.setSeries(...series);\n return this;\n }\n\n /**\n * Sets the series that should belong to the axis\n * @param {...(Series|Number|String)} series - List of series identified either by their instance, or their index (string or number)\n * @returns {AxisBar} The current axis instance\n */\n setSeries() {\n\n var self = this;\n this.series = arguments;\n\n Array.prototype.map.call(this.series, function (serie, index) {\n\n if (!(typeof serie == 'object')) {\n serie = self.graph.getSerie(serie);\n }\n\n if (serie.setCategoryConfig) {\n serie.setCategoryConfig(index, self._barCategories, self.series.length);\n }\n });\n\n this._getUsedCategories();\n\n return this;\n }\n\n _getUsedCategories() {\n\n let categories = {},\n total = 0;\n\n Array.prototype.map.call(this.series, serie => {\n let usedCategories = serie.getUsedCategories();\n for (let cat of usedCategories) {\n\n if (!categories.hasOwnProperty(cat)) {\n categories[cat] = 1;\n total += 1;\n }\n\n categories[cat]++;\n total++;\n }\n });\n\n let accumulator = 0;\n for (let i in categories) {\n let temp = categories[i];\n categories[i] = accumulator;\n accumulator += temp;\n }\n\n let dispatchedCategories = {};\n\n Array.prototype.map.call(this.series, serie => {\n\n let scategories = serie.getUsedCategories(),\n indices = {};\n\n scategories.forEach(cat => {\n\n dispatchedCategories[cat] = dispatchedCategories[cat] || 0.5;\n indices[cat] = (categories[cat] + dispatchedCategories[cat]) / total;\n dispatchedCategories[cat]++;\n });\n\n serie.setDataIndices(indices, total);\n });\n }\n\n getType() {\n return 'category';\n }\n}\n\nvar axisFormat = [{\n\n threshold: 20,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 seconds\n increment: 1,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n}, {\n\n threshold: 50,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 2 seconds\n increment: 2,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n}, {\n\n threshold: 100,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 5 seconds\n increment: 5,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n}, {\n\n threshold: 600,\n increments: {\n\n 1: {\n increment: 10, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 seconds\n increment: 30,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n}, { // One day\n\n threshold: 1000,\n increments: {\n\n 1: { // 1h\n increment: 1,\n unit: 'h',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 minutes\n increment: 10,\n unit: 'i',\n format: 'MM\"min\"'\n }\n }\n}, { // One day\n\n threshold: 1500,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 1,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 3000,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 2,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 8000,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 10,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 26400,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 20,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 86400,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 1,\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 200000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 2, // One day on the first axis\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 6, // One day on the first axis\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 1400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 12, // One day on the first axis\n unit: 'h',\n format: 'HH\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 6400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n}, { // One day\n\n threshold: 12400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 2, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n}, { // One day\n\n threshold: 86400000 * 0.5,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 7, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n}, { // One day\n\n threshold: 86400000 * 0.8,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 15, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n}, { // One month\n\n threshold: 86400000 * 1,\n increments: {\n\n 1: {\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 3, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n}, { // One month\n\n threshold: 86400000 * 2,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 4, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n}, { // One month\n\n threshold: 86400000 * 10,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 6, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n}, { // One month\n\n threshold: 86400000 * 12,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 1, // One day on the first axis\n unit: 'y',\n format: 'yyyy'\n }\n }\n}];\n\n/*\n * Date Format 1.2.3\n * (c) 2007-2009 Steven Levithan \n * MIT license\n *\n * Includes enhancements by Scott Trenda \n * and Kris Kowal \n *\n * Accepts a date, a mask, or a date and a mask.\n * Returns a formatted version of the given date.\n * The date defaults to the current date/time.\n * The mask defaults to dateFormat.masks.default.\n */\n\nvar dateFormat = function () {\n var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\\1?|[WLloSZ]|\"[^\"]*\"|'[^']*'/g,\n timezone = /\\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\\d{4})?)\\b/g,\n timezoneClip = /[^-+\\dA-Z]/g,\n pad = function (val, len) {\n val = String(val);\n len = len || 2;\n while (val.length < len) val = '0' + val;\n return val;\n },\n getWeek = function (d, f) {\n var onejan = new Date(d[f + 'FullYear'](), 0, 1);\n return Math.ceil(((d - onejan) / 86400000 + onejan[f + 'Day']() + 1) / 7);\n };\n\n // Regexes and supporting functions are cached through closure\n return function (date, mask, utc) {\n var dF = dateFormat;\n\n // You can't provide utc if you skip other args (use the \"UTC:\" mask prefix)\n if (arguments.length == 1 && Object.prototype.toString.call(date) == '[object String]' && !/\\d/.test(date)) {\n mask = date;\n date = undefined;\n }\n\n // Passing date through Date applies Date.parse, if necessary\n date = date ? new Date(date) : new Date();\n if (isNaN(date)) throw SyntaxError('invalid date:' + date);\n\n mask = String(dF.masks[mask] || mask || dF.masks.default);\n\n // Allow setting the utc argument via the mask\n if (mask.slice(0, 4) == 'UTC:') {\n mask = mask.slice(4);\n utc = true;\n }\n\n var _ = utc ? 'getUTC' : 'get',\n d = date[_ + 'Date'](),\n D = date[_ + 'Day'](),\n m = date[_ + 'Month'](),\n y = date[_ + 'FullYear'](),\n H = date[_ + 'Hours'](),\n M = date[_ + 'Minutes'](),\n s = date[_ + 'Seconds'](),\n L = date[_ + 'Milliseconds'](),\n o = utc ? 0 : date.getTimezoneOffset(),\n flags = {\n d: d,\n dd: pad(d),\n ddd: dF.i18n.dayNames[D],\n dddd: dF.i18n.dayNames[D + 7],\n m: m + 1,\n mm: pad(m + 1),\n mmm: dF.i18n.monthNames[m],\n mmmm: dF.i18n.monthNames[m + 12],\n yy: String(y).slice(2),\n yyyy: y,\n h: H % 12 || 12,\n hh: pad(H % 12 || 12),\n H: H,\n HH: pad(H),\n M: M,\n MM: pad(M),\n s: s,\n ss: pad(s),\n l: pad(L, 3),\n L: pad(L > 99 ? Math.round(L / 10) : L),\n t: H < 12 ? 'a' : 'p',\n tt: H < 12 ? 'am' : 'pm',\n T: H < 12 ? 'A' : 'P',\n TT: H < 12 ? 'AM' : 'PM',\n Z: utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),\n o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),\n S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],\n W: getWeek(date, _)\n };\n\n return mask.replace(token, function ($0) {\n return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);\n });\n };\n}();\n\n// Some common format strings\ndateFormat.masks = {\n 'default': 'ddd mmm dd yyyy HH:MM:ss',\n shortDate: 'm/d/yy',\n mediumDate: 'mmm d, yyyy',\n longDate: 'mmmm d, yyyy',\n fullDate: 'dddd, mmmm d, yyyy',\n shortTime: 'h:MM TT',\n mediumTime: 'h:MM:ss TT',\n longTime: 'h:MM:ss TT Z',\n isoDate: 'yyyy-mm-dd',\n isoTime: 'HH:MM:ss',\n isoDateTime: \"yyyy-mm-dd'T'HH:MM:ss\",\n isoUtcDateTime: \"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'\"\n};\n\n// Internationalization strings\ndateFormat.i18n = {\n dayNames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n};\n\n/* END DATE FORMAT */\n\nfunction getClosestIncrement(value, basis) {\n return Math.round(value / basis) * basis;\n}\n\nfunction roundDate(date, format) {\n\n switch (format.unit) {\n\n case 's':\n // Round at n hour\n\n date.setSeconds(getClosestIncrement(date.getSeconds(), format.increment));\n date.setMilliseconds(0);\n\n break;\n\n case 'i':\n // Round at n hour\n\n date.setMinutes(getClosestIncrement(date.getMinutes(), format.increment));\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'h':\n // Round at n hour\n\n date.setHours(getClosestIncrement(date.getHours(), format.increment));\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'd':\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n\n date.setDate(getClosestIncrement(date.getDate(), format.increment));\n\n break;\n\n case 'm':\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n\n date.setMonth(getClosestIncrement(date.getMonth(), format.increment));\n\n break;\n\n case 'y':\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n date.setMonth(0);\n\n //date.setYear( getClosest( date.getDate(), format.increment ) );\n\n break;\n\n default:\n {\n throw new Error('Date format not recognized');\n }\n }\n\n return date;\n}\n\nfunction incrementDate(date, format) {\n\n switch (format.unit) {\n\n case 's':\n\n date.setSeconds(date.getSeconds() + format.increment);\n date.setMilliseconds(0);\n\n break;\n\n case 'i':\n\n date.setMinutes(date.getMinutes() + format.increment);\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'h':\n // Round at n hour\n\n date.setHours(date.getHours() + format.increment);\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'd':\n\n date.setDate(date.getDate() + format.increment);\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n\n break;\n\n case 'm':\n\n date.setMonth(date.getMonth() + format.increment);\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n\n break;\n\n case 'y':\n\n date.setFullYear(date.getFullYear() + format.increment);\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n date.setMonth(0);\n\n break;\n\n default:\n {\n throw new Error('Date format not recognized');\n }\n }\n\n return date;\n}\n\nfunction getGroup(axis, level, number) {\n\n if (axis.groups[level][number]) {\n axis.groups[level][number].group.setAttribute('display', 'block');\n return axis.groups[level][number];\n }\n\n var g = {\n\n group: document.createElementNS(axis.graph.ns, 'g'),\n text: document.createElementNS(axis.graph.ns, 'text')\n };\n\n var line = document.createElementNS(axis.graph.ns, 'line');\n\n line.setAttribute('stroke', 'black');\n line.setAttribute('y1', 0);\n switch (level) {\n\n case 2:\n\n line.setAttribute('y2', 6);\n g.text.setAttribute('y', 15);\n\n g.line = line;\n\n g.group.appendChild(g.line);\n break;\n\n default:\n case 1:\n\n line.setAttribute('y2', 20);\n g.text.setAttribute('y', 10);\n\n g.line1 = line;\n g.line2 = line.cloneNode();\n\n g.group.appendChild(g.line1);\n g.group.appendChild(g.line2);\n\n break;\n }\n\n g.text.setAttribute('text-anchor', 'middle');\n g.text.setAttribute('dominant-baseline', 'middle');\n\n g.group.appendChild(g.text);\n\n axis.getWrapper(level).appendChild(g.group);\n\n return axis.groups[level][number] = g;\n}\n\nfunction hideGroups(axis, level, from) {\n\n for (; from < axis.groups[level].length; from++) {\n\n hideGroup(axis.groups[level][from]);\n }\n}\n\nfunction hideGroup(group) {\n group.group.setAttribute('display', 'none');\n}\n\nfunction getDateText(date, format) {\n\n return dateFormat(date, format);\n}\n\nfunction renderGroup(level, group, text, minPx, maxPx, x1, x2) {\n\n switch (level) {\n\n case 2:\n\n if (x1 < minPx || x1 > maxPx) {\n\n hideGroup(group);\n return;\n }\n\n group.line.setAttribute('x1', x1);\n group.line.setAttribute('x2', x1);\n group.text.setAttribute('x', x1);\n group.text.textContent = text;\n\n break;\n\n default:\n case 1:\n\n var x1B = Math.max(minPx, Math.min(maxPx, x1)),\n x2B = Math.max(minPx, Math.min(maxPx, x2));\n\n if (isNaN(x2B) || isNaN(x1B)) {\n return;\n }\n\n group.line1.setAttribute('x1', x1B);\n group.line2.setAttribute('x1', x2B);\n\n group.line1.setAttribute('x2', x1B);\n group.line2.setAttribute('x2', x2B);\n\n group.text.setAttribute('x', (x1B + x2B) / 2);\n\n while (text.length * 8 > x2B - x1B) {\n\n text = text.substr(0, text.length - 2) + '.';\n\n if (text.length == 1) {\n text = '';\n break;\n }\n }\n\n group.text.textContent = text;\n break;\n }\n}\n\nclass GraphTimeAxis extends Axis {\n\n constructor() {\n\n super(...arguments);\n }\n\n init(graph, options) {\n\n super.init(graph, options);\n\n this.wrapper = {\n 1: document.createElementNS(graph.ns, 'g'),\n 2: document.createElementNS(graph.ns, 'g')\n };\n this.groups = {\n 1: [],\n 2: []\n };\n\n var rect = document.createElementNS(graph.ns, 'rect');\n rect.setAttribute('fill', '#c0c0c0');\n rect.setAttribute('stroke', '#808080');\n rect.setAttribute('height', '20');\n rect.setAttribute('x', '0');\n rect.setAttribute('y', '0');\n\n this.rect = rect;\n\n this.wrapper[1].appendChild(this.rect);\n\n // this.init( graph, options );\n\n this.group.appendChild(this.wrapper[1]);\n this.group.appendChild(this.wrapper[2]);\n\n this.wrapper[1].setAttribute('transform', 'translate( 0, 25 )');\n this.wrapper[2].setAttribute('transform', 'translate( 0, 00 )');\n }\n\n draw() {\n // Redrawing of the axis\n\n //this.drawInit();\n\n this.cacheCurrentMax();\n this.cacheCurrentMin();\n\n if (this.currentAxisMin == undefined || this.currentAxisMax == undefined) {\n this.setMinMaxToFitSeries(true); // We reset the min max as a function of the series\n }\n\n this.line.setAttribute('x1', this.getMinPx());\n this.line.setAttribute('x2', this.getMaxPx());\n this.line.setAttribute('y1', 0);\n this.line.setAttribute('y2', 0);\n\n var widthPx = this.maxPx - this.minPx;\n var widthTime = this.getCurrentInterval();\n\n var timePerPx = widthTime / widthPx;\n\n var maxVal = this.getCurrentMax();\n var minVal = this.getCurrentMin();\n\n this.rect.setAttribute('width', widthPx);\n this.rect.setAttribute('x', this.minPx);\n\n if (!maxVal || !minVal) {\n return 0;\n }\n\n var currentFormat;\n\n for (i = 0; i < axisFormat.length; i++) {\n\n if (axisFormat[i].threshold > timePerPx) {\n currentFormat = axisFormat[i];\n\n break;\n }\n }\n\n if (!currentFormat) {\n currentFormat = axisFormat[axisFormat.length - 1];\n }\n\n var xVal1,\n xVal2,\n level = 0,\n dateFirst,\n currentDate,\n text,\n group,\n i;\n\n for (level = 1; level <= 2; level++) {\n\n if (!isNumeric$1(minVal)) {\n hideGroups(this, level, 0);\n break;\n }\n\n dateFirst = new Date(minVal);\n\n currentDate = roundDate(dateFirst, currentFormat.increments[level]);\n\n i = 0;\n\n do {\n /** @ignore */\n text = getDateText(currentDate, currentFormat.increments[level].format);\n group = getGroup(this, level, i);\n\n xVal1 = this.getPx(currentDate.getTime());\n currentDate = incrementDate(currentDate, currentFormat.increments[level]);\n xVal2 = this.getPx(currentDate.getTime());\n\n renderGroup(level, group, text, this.getMinPx(), this.getMaxPx(), xVal1, xVal2);\n\n i++;\n if (i > 100) {\n break;\n }\n } while (currentDate.getTime() < maxVal);\n\n hideGroups(this, level, i);\n }\n }\n\n isX() {\n return true;\n }\n\n getWrapper(level) {\n return this.wrapper[level];\n }\n\n setShift(shift) {\n this.shift = shift;\n this.group.setAttribute('transform', 'translate(0 ' + (this.top ? this.shift : this.graph.getDrawingHeight() - this.shift) + ')');\n }\n\n getAxisPosition() {\n return 60;\n }\n\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n var maxPx = interval * this.options.span[1] + this.minPx;\n var minPx = interval * this.options.span[0] + this.minPx;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n }\n\n}\n\n/**\n * Serie class to be extended\n * @static\n */\nclass Serie extends EventEmitter {\n\n static default() {\n\n return {\n redrawShapesAfterDraw: false\n };\n }\n\n constructor(graph, name, options) {\n\n super(...arguments);\n this.graph = graph;\n this.name = name;\n this.options = Object.assign({}, Serie.default(), this.constructor.default(), options);\n\n //if( new.target.default ) {\n //console.log( new.target.default() );\n //}\n }\n\n draw() {}\n\n beforeDraw() {}\n\n afterDraw() {\n\n if (this.options.redrawShapesAfterDraw) {\n this.graph.getShapesOfSerie(this).forEach(shape => {\n shape.redraw();\n });\n }\n\n this.emit('draw');\n }\n\n /**\n * Sets data to the serie\n * @memberof Serie\n * @param {(Object|Array|Array[])} data - The data of the serie\n * @param {Boolean} [ oneDimensional=false ] - In some cases you may need to force the 1D type. This is required when one uses an array or array to define the data (see examples)\n * @param{String} [ type=float ] - Specify the type of the data. Use int to save memory (half the amount of bytes allocated to the data).\n * @example serie.setData( [ [ x1, y1 ], [ x2, y2 ], ... ] );\n * @example serie.setData( [ x1, y1, x2, y2, ... ] ); // Faster\n * @example serie.setData( [ [ x1, y1, x2, y2, ..., xn, yn ] , [ xm, ym, x(m + 1), y(m + 1), ...] ], true ) // 1D array with a gap in the middle\n * @example serie.setData( { x: x0, dx: spacing, y: [ y1, y2, y3, y4 ] } ); // Data with equal x separation. Fastest way\n */\n setData(data, oneDimensional, type) {\n\n if (data instanceof Waveform) {\n return this.setWaveform(data);\n }\n\n throw 'Setting data other than waveforms in not supported by default. You must implemented this method in the inherited class.';\n }\n\n _addData(type, howmany) {\n return [];\n }\n\n /**\n * Removes all the data from the serie, without redrawing\n * @returns {Serie} The current serie\n */\n clearData() {\n this.setData(new Waveform());\n return this;\n }\n\n /**\n * Returns the data in its current form\n * @returns {Array.<(Float64Array|Int32Array)>} An array containing the data chunks. Has only one member if the data has no gaps\n * @memberof Serie\n */\n getData() {\n return this.data;\n }\n\n /**\n * Sets the options of the serie (no extension of default options)\n * @param {Object} options - The options of the serie\n * @memberof Serie\n */\n setOptions(options) {\n this.options = options || {};\n }\n\n /**\n * Sets the options of the serie (no extension of default options)\n * @param {String} name - The option name\n * @param value - The option value\n * @memberof Serie\n * @example serie.setOption('selectableOnClick', true );\n */\n setOption(name, value) {\n this.options[name] = value;\n }\n\n /**\n * Removes the serie from the graph. The method doesn't perform any axis autoscaling or repaint of the graph. This should be done manually.\n * @return {Serie} The current serie instance\n * @memberof Serie\n */\n kill(noLegendUpdate) {\n\n this.graph.removeSerieFromDom(this);\n this.graph._removeSerie(this);\n\n if (this.graph.legend && !noLegendUpdate) {\n\n this.graph.legend.update();\n }\n\n this.graph = undefined;\n return this;\n }\n\n /**\n * Hides the serie\n * @memberof Serie\n * @param {Boolean} [ hideShapes = false ] - true to hide the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n hide(hideShapes, mute = false) {\n\n this.hidden = true;\n this.groupMain.setAttribute('display', 'none');\n\n this.getSymbolForLegend().setAttribute('opacity', 0.5);\n this.getTextForLegend().setAttribute('opacity', 0.5);\n\n this.hideImpl();\n\n if (hideShapes) {\n var shapes = this.graph.getShapesOfSerie(this);\n for (var i = 0, l = shapes.length; i < l; i++) {\n shapes[i].hide();\n }\n }\n\n if (!mute) {\n this.emit('hide');\n }\n\n if (this.getXAxis().doesHideWhenNoSeriesShown() || this.getYAxis().doesHideWhenNoSeriesShown()) {\n this.graph.draw(true);\n }\n\n return this;\n }\n\n /**\n * Shows the serie\n * @memberof Serie\n * @param {Boolean} [showShapes=false] - true to show the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n show(showShapes, mute = false) {\n\n this.hidden = false;\n this.groupMain.setAttribute('display', 'block');\n\n this.getSymbolForLegend().setAttribute('opacity', 1);\n this.getTextForLegend().setAttribute('opacity', 1);\n\n this.showImpl();\n\n this.draw(true);\n\n if (showShapes) {\n var shapes = this.graph.getShapesOfSerie(this);\n for (var i = 0, l = shapes.length; i < l; i++) {\n shapes[i].show();\n }\n }\n\n if (!mute) {\n this.emit('show');\n }\n\n if (this.getXAxis().doesHideWhenNoSeriesShown() || this.getYAxis().doesHideWhenNoSeriesShown()) {\n this.graph.draw(true);\n }\n return this;\n }\n\n hideImpl() {}\n showImpl() {}\n\n /**\n * Toggles the display of the serie (effectively, calls .show() and .hide() alternatively on each call)\n * @memberof Serie\n * @param {Boolean} [hideShapes=false] - true to hide the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n toggleDisplay() {\n\n if (!this.isShown()) {\n this.show();\n } else {\n this.hide();\n }\n\n return this;\n }\n\n /**\n * Determines if the serie is currently visible\n * @memberof Serie\n * @returns {Boolean} The current visibility status of the serie\n */\n isShown() {\n return !this.hidden;\n }\n\n /**\n * Checks that axes assigned to the serie have been defined and have proper values\n * @memberof Serie\n */\n axisCheck() {\n\n if (!this.getXAxis() || !this.getYAxis()) {\n throw 'No axis exist for this serie. Check that they were properly assigned';\n }\n\n if (isNaN(this.getXAxis().getCurrentMin()) || isNaN(this.getXAxis().getCurrentMax()) || isNaN(this.getYAxis().getCurrentMin()) || isNaN(this.getYAxis().getCurrentMax())) {\n throw 'Axis min and max values are not defined. Try autoscaling';\n }\n }\n /**\n * Returns the x position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The x position in px corresponding to the x value\n */\n getX(val) {\n return (val = this.getXAxis().getPx(val)) - val % 0.2;\n }\n\n /**\n * Returns the y position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The y position in px corresponding to the y value\n */\n getY(val) {\n return (val = this.getYAxis().getPx(val)) - val % 0.2;\n }\n\n /**\n * Returns the selection state of the serie. Generic for most serie types\n * @memberof Serie\n * @returns {Boolean} true if the serie is selected, false otherwise\n */\n isSelected() {\n return this.selected || this.selectionType !== 'unselected';\n }\n\n _checkX(val) {\n this.minX = Math.min(this.minX, val);\n this.maxX = Math.max(this.maxX, val);\n }\n\n _checkY(val) {\n this.minY = Math.min(this.minY, val);\n this.maxY = Math.max(this.maxY, val);\n }\n\n /**\n * Getter for the serie name\n * @memberof Serie\n * @returns {String} The serie name\n */\n getName() {\n return this.name;\n }\n\n /* AXIS */\n\n /**\n * Assigns axes automatically, based on {@link Graph#getXAxis} and {@link Graph#getYAxis}.\n * @memberof Serie\n * @returns {Serie} The current serie\n */\n autoAxis() {\n\n if (this.isFlipped()) {\n\n this.setXAxis(this.graph.getYAxis());\n this.setYAxis(this.graph.getXAxis());\n } else {\n\n this.setXAxis(this.graph.getXAxis());\n this.setYAxis(this.graph.getYAxis());\n }\n\n // After axes have been assigned, the graph axes should update their min/max\n this.graph.updateDataMinMaxAxes();\n return this;\n }\n\n autoAxes() {\n return this.autoAxis(...arguments);\n }\n\n /**\n * Assigns an x axis to the serie\n * @memberof Serie\n * @param {Axis|Number} axis - The axis to use as an x axis. If an integer, {@link Graph#getXAxis} or {@link Graph#getYAxis} will be used\n * @returns {Serie} The current serie\n * @example serie.setXAxis( graph.getTopAxis( 1 ) ); // Assigns the second top axis to the serie\n */\n setXAxis(axis) {\n\n if (typeof axis == 'number') {\n this.xaxis = this.isFlipped() ? this.graph.getYAxis(axis) : this.graph.getXAxis(axis);\n } else {\n this.xaxis = axis;\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Assigns an y axis to the serie\n * @memberof Serie\n * @param {Axis|Number} axis - The axis to use as an y axis. If an integer, {@link Graph#getXAxis} or {@link Graph#getYAxis} will be used\n * @returns {Serie} The current serie\n * @example serie.setYAxis( graph.getLeftAxis( 4 ) ); // Assigns the 5th left axis to the serie\n */\n setYAxis(axis) {\n if (typeof axis == 'number') {\n this.xaxis = this.isFlipped() ? this.graph.getXAxis(axis) : this.graph.getYAxis(axis);\n } else {\n this.yaxis = axis;\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Assigns two axes to the serie\n * @param {GraphAxis} axis1 - First axis to assign to the serie (x or y)\n * @param {GraphAxis} axis2 - Second axis to assign to the serie (y or x)\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setAxes() {\n\n for (var i = 0; i < 2; i++) {\n\n if (arguments[i]) {\n this[arguments[i].isX() ? 'setXAxis' : 'setYAxis'](arguments[i]);\n }\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * @returns {GraphAxis} The x axis assigned to the serie\n * @memberof Serie\n */\n getXAxis() {\n return this.xaxis;\n }\n\n /**\n * @returns {GraphAxis} The y axis assigned to the serie\n * @memberof Serie\n */\n getYAxis() {\n return this.yaxis;\n }\n\n /* */\n\n /* DATA MIN MAX */\n\n /**\n * @returns {Number} Lowest x value of the serie's data\n * @memberof Serie\n */\n getMinX() {\n return this.minX;\n }\n\n /**\n * @returns {Number} Highest x value of the serie's data\n * @memberof Serie\n */\n getMaxX() {\n return this.maxX;\n }\n\n /**\n * @returns {Number} Lowest y value of the serie's data\n * @memberof Serie\n */\n getMinY() {\n return this.minY;\n }\n\n /**\n * @returns {Number} Highest y value of the serie's data\n * @memberof Serie\n */\n getMaxY() {\n return this.maxY;\n }\n\n getWaveform() {\n return this.waveform;\n }\n\n getWaveforms() {\n return [this.waveform];\n }\n\n setWaveform(waveform) {\n\n if (!(waveform instanceof Waveform)) {\n throw 'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance';\n }\n\n this.waveform = waveform;\n\n this.minX = this.waveform.getXMin();\n this.maxX = this.waveform.getXMax();\n this.minY = this.waveform.getMin();\n this.maxY = this.waveform.getMax();\n\n this.graph.updateDataMinMaxAxes();\n this.dataHasChanged();\n\n return this;\n }\n\n /**\n * Computes and returns a line SVG element with the same line style as the serie, or width 20px\n * @returns {SVGElement}\n * @memberof Serie\n */\n getSymbolForLegend() {\n\n if (!this.lineForLegend) {\n\n var line = document.createElementNS(this.graph.ns, 'line');\n this.applyLineStyle(line);\n\n line.setAttribute('x1', 5);\n line.setAttribute('x2', 25);\n line.setAttribute('y1', 0);\n line.setAttribute('y2', 0);\n\n line.setAttribute('cursor', 'pointer');\n\n this.lineForLegend = line;\n }\n\n return this.lineForLegend;\n }\n\n /**\n * Explicitely applies the line style to the SVG element returned by {@link Serie#getSymbolForLegend}\n * @see Serie#getSymbolForLegend\n * @returns {SVGElement}\n * @memberof Serie\n */\n setLegendSymbolStyle() {\n this.applyLineStyle(this.getSymbolForLegend());\n }\n\n /**\n * @alias Serie#setLegendSymbolStyle\n * @memberof Serie\n */\n updateStyle() {\n this.setLegendSymbolStyle();\n this.graph.updateLegend();\n }\n\n /**\n * Computes and returns a text SVG element with the label of the serie as a text, translated by 35px\n * @returns {SVGElement}\n * @memberof Serie\n * @see Serie#getLabel\n */\n getTextForLegend() {\n\n if (!this.textForLegend) {\n\n var text = document.createElementNS(this.graph.ns, 'text');\n text.setAttribute('cursor', 'pointer');\n text.textContent = this.getLabel();\n\n this.textForLegend = text;\n }\n\n return this.textForLegend;\n }\n\n /**\n * @returns {Number} The current index of the serie\n * @memberof Serie\n */\n getIndex() {\n return this.graph.series.indexOf(this);\n }\n\n /**\n * @returns {String} The label or, alternatively - the name of the serie\n * @memberof Serie\n */\n getLabel() {\n return this.options.label || this.name;\n }\n\n /**\n * Sets the label of the serie. Note that this does not automatically updates the legend\n * @param {String} label - The new label of the serie\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setLabel(label) {\n this.options.label = label;\n\n if (this.textForLegend) {\n this.textForLegend.textContent = label;\n }\n\n this.graph.requireLegendUpdate();\n return this;\n }\n\n /* FLIP */\n\n /**\n * Assigns the flipping value of the serie. A flipped serie will have inverted axes. However this method does not automatically re-assigns the axes of the serie. Call {@link Serie#autoAxis} to re-assign the axes automatically, or any other axis setting method.\n * @param {Boolean} [flipped=false] - true to flip the serie\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setFlip(flipped) {\n this.options.flip = flipped;\n return this;\n }\n\n /**\n * @returns {Boolean} true if the serie is flipped, false otherwise\n * @memberof Serie\n */\n getFlip() {\n return this.options.flip;\n }\n\n /**\n * @alias Serie#getFlip\n * @memberof Serie\n */\n isFlipped() {\n return this.options.flip;\n }\n\n /**\n * Sets the layer onto which the serie should be displayed. This method does not trigger a graph redraw.\n * @memberof Serie\n * @param {Number} layerIndex=1 - The index of the layer into which the serie will be drawn\n * @returns {Serie} The current serie\n */\n setLayer(layerIndex) {\n let newLayer = parseInt(layerIndex) || 1;\n\n if (newLayer !== this.options.layer) {\n this.options.layer = newLayer;\n this.graph.appendSerieToDom(this);\n }\n\n return this;\n }\n\n /**\n * Sets the layer onto which the serie should be displayed. This method does not trigger a graph redraw.\n * @memberof Serie\n * @returns {Nunber} The index of the layer into which the serie will be drawn\n */\n getLayer() {\n return this.options.layer || 1;\n }\n\n setStyle(style, selectionType = 'unselected') {\n this.styles[selectionType] = style;\n this.styleHasChanged(selectionType);\n }\n\n /**\n * Notifies jsGraph that the style of the serie has changed and needs to be redrawn on the next repaint\n * @param {String} selectionType - The selection for which the style may have changed\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n styleHasChanged(selectionType = 'unselected') {\n this._changedStyles = this._changedStyles || {};\n\n if (selectionType === false) {\n for (var i in this._changedStyles) {\n this._changedStyles[i] = false;\n }\n } else {\n this._changedStyles[selectionType || 'unselected'] = true;\n }\n\n this.graph.requireLegendUpdate();\n return this;\n }\n\n /**\n * Checks if the style has changed for a selection type\n * @param {String} selectionType - The selection for which the style may have changed\n * @returns {Boolean} true if the style has changed\n * @private\n * @memberof Serie\n */\n hasStyleChanged(selectionType) {\n this._changedStyles = this._changedStyles || {};\n return this._changedStyles[selectionType || 'unselected'];\n }\n\n /**\n * Notifies jsGraph that the data of the serie has changed\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n dataHasChanged(arg) {\n this._dataHasChanged = arg === undefined || arg;\n return this;\n }\n\n /**\n * Checks if the data has changed\n * @returns {Boolean} true if the data has changed\n * @private\n * @memberof Serie\n */\n hasDataChanged() {\n return this._dataHasChanged;\n }\n\n /**\n * Set a key/value arbitrary information to the serie. It is particularly useful if you have this serie has a reference through an event for instance, and you want to retrieve data associated to it\n * @param {String} prop - The property\n * @param value - The value\n * @returns {Serie} The current serie\n * @see Serie#getInfo\n * @memberof Serie\n */\n setInfo(prop, value) {\n this.infos = this.infos || {};\n this.infos[prop] = value;\n return this;\n }\n\n /**\n * Retrives an information value from its key\n * @param {String} prop - The property\n * @returns The value associated to the prop parameter\n * @see Serie#setInfo\n * @memberof Serie\n */\n getInfo(prop, value) {\n return (this.infos || {})[prop];\n }\n\n /**\n * @deprecated\n * @memberof Serie\n */\n setAdditionalData(data) {\n this.additionalData = data;\n return this;\n }\n\n /**\n * @deprecated\n * @memberof Serie\n */\n getAdditionalData() {\n return this.additionalData;\n }\n\n /**\n * Flags the serie as selected\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n select() {\n this.selected = true;\n return this;\n }\n\n /**\n * Flags the serie as unselected\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n unselect() {\n this.selected = false;\n return this;\n }\n\n /**\n * Allows mouse tracking of the serie\n * @memberof Serie\n * @returns {Serie} The current serie\n * @param {Function} hoverCallback - Function to be called when the mouse enters the serie area\n * @param {Function} outCallback - Function to be called when the mouse exits the serie area\n * @private\n */\n enableTracking(hoverCallback, outCallback) {\n this._tracker = true;\n this._trackingCallback = hoverCallback;\n this._trackingOutCallback = outCallback;\n\n return this;\n }\n\n /**\n * Disables mouse tracking of the serie\n * @memberof Serie\n * @returns {Serie} The current serie\n * @private\n */\n disableTracking() {\n\n if (this._trackerDom) {\n this._trackerDom.remove();\n this._trackerDom = null;\n }\n\n this._tracker = false;\n this._trackingCallback = null;\n return this;\n }\n\n /**\n * Allows mouse tracking of the serie\n * @memberof Serie\n * @param {Object} options - The tracking line options\n * @returns {Serie} The current serie\n */\n allowTrackingLine(options) {\n\n options = options || {};\n this.graph.addSerieToTrackingLine(this, options);\n }\n\n getMarkerForLegend() {\n return false;\n }\n\n get type() {\n return this._type;\n }\n\n getType() {\n return this._type;\n }\n\n set excludedFromLegend(bln) {\n this._excludedFromLegend = bln;\n }\n\n get excludedFromLegend() {\n return !!this._excludedFromLegend;\n }\n\n setDataIndices(categories, nb) {\n this.categoryIndices = categories;\n this.nbCategories = nb;\n }\n\n hasErrors() {\n if (!this.waveform) {\n return false;\n }\n\n return this.waveform.hasErrorBars();\n }\n}\n\nvar ErrorBarMixin = {\n /*\n doErrorDraw: function( orientation, error, originVal, originPx, xpx, ypx ) {\n if ( !( error instanceof Array ) ) {\n error = [ error ];\n }\n var functionName = orientation == 'y' ? 'getY' : 'getX';\n var bars = orientation == 'y' ? [ 'top', 'bottom' ] : [ 'left', 'right' ];\n var j;\n if ( isNaN( xpx ) || isNaN( ypx ) ) {\n return;\n }\n for ( var i = 0, l = error.length; i < l; i++ ) {\n if ( error[ i ] instanceof Array ) { // TOP\n j = bars[ 0 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal + error[ i ][ 0 ] ), originPx, j );\n j = bars[ 1 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal - error[ i ][ 1 ] ), originPx, j );\n } else {\n j = bars[ 0 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal + error[ i ] ), originPx, j );\n j = bars[ 1 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal - error[ i ] ), originPx, j );\n }\n }\n },\n */\n\n /*\n makeError: function( orientation, type, coord, origin, quadOrientation ) {\n var method;\n switch ( this.errorstyles[ level ].type ) {\n case 'bar':\n method = \"makeBar\";\n break;\n case 'box':\n method = \"makeBox\";\n break;\n }\n return this[ method + orientation.toUpperCase() ]( coord, origin, this.errorstyles[ level ][ quadOrientation ] );\n },*/\n\n makeBarY: function (coordY, origin, style) {\n if (!coordY || style === undefined) {\n return;\n }\n var width = !isNumeric$1(style.width) ? 10 : style.width;\n return ' V ' + coordY + ' m -' + width / 2 + ' 0 h ' + width + ' m -' + width / 2 + ' 0 V ' + origin + ' ';\n },\n\n makeBoxY: function (coordY, origin, style) {\n if (!coordY || style === undefined) {\n return;\n }\n return ' m 5 0 V ' + coordY + ' h -10 V ' + origin + ' m 5 0 ';\n },\n\n makeBarX: function (coordX, origin, style) {\n if (!coordX || style === undefined) {\n return;\n }\n var height = !isNumeric$1(style.width) ? 10 : style.width;\n return ' H ' + coordX + ' m 0 -' + height / 2 + ' v ' + height + ' m 0 -' + height / 2 + ' H ' + origin + ' ';\n },\n\n makeBoxX: function (coordX, origin, style) {\n if (!coordX || style === undefined) {\n return;\n }\n return ' v 5 H ' + coordX + ' v -10 H ' + origin + ' v 5 ';\n },\n /*\n check: function( index, valY, valX ) {\n var dx, dy;\n if ( ( this.getType() == Graph.SERIE_LINE || this.getType() == Graph.SERIE_SCATTER ) ) {\n if ( !( dx = this.data[ index * 2 ] ) || !( dy = this.data[ index * 2 + 1 ] ) ) { //\n return;\n }\n }\n if ( dx === undefined ) {\n return;\n }\n for ( var i = 0, l = valY.length; i < l; i++ ) {\n if ( Array.isArray( valY[ i ] ) ) {\n if ( !isNaN( valY[ i ][ 0 ] ) ) {\n this._checkY( dy + valY[ i ][ 0 ] );\n }\n if ( !isNaN( valY[ i ][ 1 ] ) ) {\n this._checkY( dy - valY[ i ][ 1 ] );\n }\n } else {\n if ( !isNaN( valY[ i ] ) ) {\n this._checkY( dy + valY[ i ] );\n this._checkY( dy - valY[ i ] );\n }\n }\n }\n for ( var i = 0, l = valX.length; i < l; i++ ) {\n if ( Array.isArray( valX[ i ] ) ) {\n if ( !isNaN( valX[ i ][ 0 ] ) ) {\n this._checkX( dx - valX[ i ][ 0 ] );\n }\n if ( !isNaN( valX[ i ][ 1 ] ) ) {\n this._checkX( dx + valX[ i ][ 1 ] );\n }\n } else {\n if ( !isNaN( valY[ i ] ) ) {\n this._checkX( dx - valX[ i ] );\n this._checkX( dx + valX[ i ] );\n }\n }\n }\n },\n */\n\n /**\n *\n * @example serie.setErrorStyle( [ { type: 'bar', x: {} }, { type: 'box', top: { strokeColor: 'green', fillColor: 'olive' }, bottom: { strokeColor: 'red', fillColor: \"#800000\" } } ] );\n */\n setErrorBarStyle: function (errorstyle) {\n\n this.errorbarStyle = this._setErrorStyle(errorstyle);\n return this;\n },\n\n setErrorBoxStyle: function (errorstyle) {\n\n this.errorboxStyle = this._setErrorStyle(errorstyle);\n return this;\n },\n\n _setErrorStyle(errorstyles = {}) {\n\n var styles = [];\n var pairs = [['y', 'top', 'bottom'], ['x', 'left', 'right']];\n\n var makePath = style => {\n\n style.dom = document.createElementNS(this.graph.ns, 'path');\n style.dom.setAttribute('fill', style.fillColor || 'none');\n style.dom.setAttribute('stroke', style.strokeColor || 'black');\n style.dom.setAttribute('stroke-opacity', style.strokeOpacity || 1);\n style.dom.setAttribute('fill-opacity', style.fillOpacity || 1);\n style.dom.setAttribute('stroke-width', style.strokeWidth || 1);\n\n this.groupMain.appendChild(style.dom);\n };\n // i is bar or box\n\n var styles = {};\n\n if (typeof errorstyles == 'string') {\n errorstyles = {};\n }\n\n for (var j = 0, l = pairs.length; j < l; j++) {\n\n if (errorstyles.all) {\n\n errorstyles[pairs[j][1]] = extend(true, {}, errorstyles.all);\n errorstyles[pairs[j][2]] = extend(true, {}, errorstyles.all);\n }\n\n if (errorstyles[pairs[j][0]]) {\n //.x, .y\n\n errorstyles[pairs[j][1]] = extend(true, {}, errorstyles[pairs[j][0]]);\n errorstyles[pairs[j][2]] = extend(true, {}, errorstyles[pairs[j][0]]);\n }\n\n for (var k = 1; k <= 2; k++) {\n\n if (errorstyles[pairs[j][k]]) {\n\n styles[pairs[j][k]] = errorstyles[pairs[j][k]];\n makePath(styles[pairs[j][k]]);\n }\n }\n }\n\n return styles;\n },\n\n errorDrawInit: function () {\n if (this.errorboxStyle) {\n\n this.errorboxStyle.paths = {\n top: '',\n bottom: '',\n left: '',\n right: ''\n };\n }\n\n if (this.errorbarStyle) {\n\n this.errorbarStyle.paths = {\n top: '',\n bottom: '',\n left: '',\n right: ''\n };\n }\n },\n\n errorAddPoint: function (index, dataX, dataY, xpx, ypx) {\n\n /* eslint-disable no-cond-assign */\n let error;\n if (error = this.waveform.getErrorBarXBelow(index)) {\n this.errorbarStyle.paths.left += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.left += this.makeBarX(this.getX(dataX - error), xpx, this.errorbarStyle.left);\n }\n\n if (error = this.waveform.getErrorBarXAbove(index)) {\n this.errorbarStyle.paths.right += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.right += this.makeBarX(this.getX(dataX + error), xpx, this.errorbarStyle.right);\n }\n\n if (error = this.waveform.getErrorBarYBelow(index)) {\n this.errorbarStyle.paths.bottom += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.bottom += this.makeBarY(this.getY(dataY - error), ypx, this.errorbarStyle.bottom);\n }\n\n if (error = this.waveform.getErrorBarYAbove(index)) {\n this.errorbarStyle.paths.top += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.top += this.makeBarY(this.getY(dataY + error), ypx, this.errorbarStyle.top);\n }\n\n if (error = this.waveform.getErrorBoxXBelow(index)) {\n this.errorboxStyle.paths.left += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.left += this.makeBoxX(this.getX(dataX - error), xpx, this.errorboxStyle.left);\n }\n\n if (error = this.waveform.getErrorBoxXAbove(index)) {\n this.errorboxStyle.paths.right += ' M ' + xpx + ' ' + ypx;\n\n this.errorboxStyle.paths.right += this.makeBoxX(this.getX(dataX + error), xpx, this.errorboxStyle.right);\n }\n\n if (error = this.waveform.getErrorBoxYBelow(index)) {\n this.errorboxStyle.paths.bottom += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.bottom += this.makeBoxY(this.getY(dataY - error), ypx, this.errorboxStyle.bottom);\n }\n\n if (error = this.waveform.getErrorBoxYAbove(index)) {\n this.errorboxStyle.paths.top += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.top += this.makeBoxY(this.getY(dataY + error), ypx, this.errorboxStyle.top);\n }\n /* eslint-enable */\n },\n\n errorAddPointBarChart: function (j, posY, xpx, ypx) {\n var error;\n if (this.error && (error = this.error[j])) {\n this.doErrorDraw('y', error, posY, ypx, xpx, ypx);\n }\n },\n\n errorDraw: function () {\n\n if (this.errorbarStyle) {\n\n for (var j in this.errorbarStyle.paths) {\n\n if (this.errorbarStyle[j] && this.errorbarStyle[j].dom) {\n this.errorbarStyle[j].dom.setAttribute('d', this.errorbarStyle.paths[j]);\n }\n }\n }\n\n if (this.errorboxStyle) {\n\n for (var j in this.errorboxStyle.paths) {\n\n if (this.errorboxStyle[j] && this.errorboxStyle[j].dom) {\n this.errorboxStyle[j].dom.setAttribute('d', this.errorboxStyle.paths[j]);\n }\n }\n }\n }\n};\n\n/**\n * Serie line\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends Serie\n */\nclass SerieLine extends Serie {\n\n static default() {\n /**\n * @name SerieLineDefaultOptions\n * @object\n * @static\n * @memberof SerieLine\n */\n return {\n\n lineColor: 'black',\n lineStyle: 1,\n flip: false,\n label: '',\n lineWidth: 1,\n markers: false,\n trackMouse: false,\n trackMouseLabel: false,\n trackMouseLabelRouding: 1,\n lineToZero: false,\n selectableOnClick: false,\n markersIndependant: false,\n overflowX: false,\n overflowY: false\n };\n }\n\n constructor(graph, name, options) {\n\n super(...arguments);\n\n this.selectionType = 'unselected';\n this.markerFamilies = {};\n\n mapEventEmission(this.options, this); // Register events\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n lineWidth: this.options.lineWidth,\n markers: this.options.markers\n };\n\n this.styles.selected = {\n lineWidth: 3\n };\n\n this.extendStyles();\n this.markersDom = new Map();\n\n this.shown = true;\n\n this.data = [];\n this._isMinOrMax = {\n x: {\n min: false,\n max: false\n },\n y: {\n min: false,\n max: false\n }\n };\n\n // Optimize is no markerPoints => save loops\n // this.markerPoints = {};\n\n this.groupLines = document.createElementNS(this.graph.ns, 'g');\n this.domMarker = document.createElementNS(this.graph.ns, 'path');\n this.domMarker.style.cursor = 'pointer';\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n this.additionalData = {};\n\n this.marker = document.createElementNS(this.graph.ns, 'circle');\n this.marker.setAttribute('fill', 'black');\n this.marker.setAttribute('r', 3);\n this.marker.setAttribute('display', 'none');\n\n this.markerLabel = document.createElementNS(this.graph.ns, 'text');\n this.markerLabelSquare = document.createElementNS(this.graph.ns, 'rect');\n this.markerLabelSquare.setAttribute('fill', 'white');\n this.domMarkerHover = {};\n this.domMarkerSelect = {};\n this.markerHovered = 0;\n this.groupMarkerSelected = document.createElementNS(this.graph.ns, 'g');\n\n this.markerPoints = {};\n\n //this.scale = 1;\n //this.shift = 0;\n this.lines = [];\n\n this.groupMain.appendChild(this.groupLines);\n\n this.groupMain.appendChild(this.marker);\n\n this.groupMain.appendChild(this.groupMarkerSelected);\n this.groupMain.appendChild(this.markerLabelSquare);\n this.groupMain.appendChild(this.markerLabel);\n\n this.groupMarkers = document.createElementNS(this.graph.ns, 'g');\n this.groupMain.appendChild(this.groupMarkers);\n\n this.independantMarkers = [];\n\n if (this.initExtended1) {\n this.initExtended1();\n }\n\n this.groupLines.addEventListener('click', e => {\n\n if (this.options.selectableOnClick) {\n\n if (this.isSelected()) {\n\n this.graph.unselectSerie(this);\n } else {\n this.graph.selectSerie(this);\n }\n }\n });\n\n if (this.options.markers) {\n this.setMarkers(this.options.markers, 'unselected');\n }\n }\n\n setWaveform(waveform) {\n\n if (!(waveform instanceof Waveform)) {\n throw 'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance';\n }\n\n this.waveform = waveform;\n\n this.minX = this.waveform.getXMin();\n this.maxX = this.waveform.getXMax();\n this.minY = this.waveform.getMin();\n this.maxY = this.waveform.getMax();\n\n this.graph.updateDataMinMaxAxes();\n this.dataHasChanged();\n\n return this;\n }\n\n /**\n * Sets the options of the serie\n * @see SerieLineDefaultOptions\n * @param {Object} options - A object containing the options to set\n * @return {SerieLine} The current serie\n * @memberof SerieLine\n */\n setOptions(options) {\n this.options = extend(true, {}, SerieLine.prototype.defaults, options || {});\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n markers: this.options.markers\n };\n\n this.applyLineStyles();\n return this;\n }\n\n onMouseOverMarker(e, index) {\n\n var toggledOn = this.toggleMarker(index, true, true);\n\n if (this.options.onMouseOverMarker) {\n\n this.options.onMouseOverMarker(index, this.infos ? this.infos[index] || false : false, [this.waveform.getX(index), this.waveform.getY(index)]);\n }\n }\n\n onMouseOutMarker(e, index) {\n this.markersOffHover();\n\n if (this.options.onMouseOutMarker) {\n this.options.onMouseOutMarker(index, this.infos ? this.infos[index] || false : false, [this.waveform.getX(index), this.waveform.getY(index)]);\n }\n }\n\n /**\n * Selects one of the markers of the serie\n * @param {Number} index - The point index to select (starting at 0)\n * @param {Boolean} [force = undefined] - Forces state of the marker. true forces selection, false forces deselection. undefined toggles the state of the marker\n * @param {Boolean} [hover = false] - true to set the selection in mode \"hover\" (will disappear on mouse out of the marker). false to set the selection in mode \"select\" (will disappear when another marker is selected)\n * @returns {Boolean} The new state of the marker\n * @memberof SerieLine\n */\n toggleMarker(index, force, hover) {\n\n let i = index;\n\n var _on;\n if (typeof force === 'undefined') {\n _on = !hover ? !this.domMarkerSelect[index] : !this.domMarkerHover[index];\n }\n var el = this['domMarker' + (hover ? 'Hover' : 'Select')];\n\n if (_on || force === true) {\n\n if (!el[index]) {\n\n var dom = document.createElementNS(this.graph.ns, 'path');\n\n this.setMarkerStyleTo(dom, this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(i)]);\n this['domMarker' + (hover ? 'Hover' : 'Select')][index] = dom;\n this.groupMarkerSelected.appendChild(dom);\n } else {\n dom = el[index];\n }\n\n let x = this.getX(this.waveform.getX(i)),\n y = this.getY(this.waveform.getY(i));\n\n dom.setAttribute('d', 'M ' + x + ' ' + y + ' ' + this.getMarkerPath(this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(i)], 1));\n\n if (hover) {\n this.markerHovered++;\n }\n } else if (!_on || force === false) {\n\n if (hover && this.domMarkerHover[index] && !this.domMarkerSelect[index] || this.domMarkerSelect[index]) {\n\n if (!el[index]) {\n return;\n }\n\n this.groupMarkerSelected.removeChild(el[index]);\n\n delete el[index];\n\n if (hover) this.markerHovered--;\n }\n }\n\n return _on;\n }\n\n /**\n * Toggles off markers that have the hover mode \"on\"\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n markersOffHover() {\n\n for (var i in this.domMarkerHover) {\n this.toggleMarker(i.split(','), false, true);\n }\n return this;\n }\n\n /**\n * Toggles off markers that have the select mode \"on\"\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n markersOffSelect() {\n\n for (var i in this.domMarkerSelect) {\n this.toggleMarker(i.split(','), false, false);\n }\n return this;\n }\n\n onClickOnMarker(e, index) {\n\n var toggledOn = this.toggleMarker(index);\n\n if (toggledOn && this.options.onSelectMarker) {\n this.options.onSelectMarker(index, this.infos ? this.infos[index[0]] || false : false);\n }\n\n if (!toggledOn && this.options.onUnselectMarker) {\n this.options.onUnselectMarker(index, this.infos ? this.infos[index[0]] || false : false);\n }\n\n if (this.options.onToggleMarker) {\n this.options.onToggleMarker(index, this.infos ? this.infos[index[0]] || false : false, toggledOn);\n }\n }\n\n _getMarkerIndexFromEvent(e) {\n var px = this.graph._getXY(e);\n\n // return this.searchIndexByPxXY( ( px.x ), ( px.y ) );\n return this.searchIndexByPxXY(px.x - this.graph.getPaddingLeft(), px.y - this.graph.getPaddingTop());\n }\n\n onMouseWheel() {}\n\n /**\n * Cleans the DOM from the serie internal object (serie and markers). Mostly used internally when a new {@link Serie#setData} is called\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n empty() {\n\n for (var i = 0, l = this.lines.length; i < l; i++) {\n this.groupLines.removeChild(this.lines[i]);\n }\n this.lines = [];\n\n return this;\n }\n\n /**\n * Applies a selection to the serie\n * @param {String} [ selectionType = \"selected\" ] - The selection name\n * @returns {SerieLine} The current serie\n * @see SerieLine#unselect\n * @memberof SerieLine\n */\n select(selectionType) {\n\n selectionType = selectionType || 'selected';\n\n this.selected = selectionType !== 'unselected';\n\n if (this.areMarkersShown() || this.areMarkersShown(selectionType)) {\n this.selectionType = selectionType;\n\n this.draw(true); // Drawing is absolutely required here\n this.applyLineStyles();\n } else {\n this.selectionType = selectionType;\n this.applyLineStyles();\n }\n\n this.applyLineStyle(this.getSymbolForLegend());\n return this;\n }\n\n /**\n * Removes the selection to the serie. Effectively, calls {@link SerieLine#select}(\"unselected\").\n * @returns {SerieLine} The current serie\n * @see SerieLine#select\n * @memberof SerieLine\n */\n unselect() {\n\n this.selected = false;\n\n return this.select('unselected');\n }\n\n /**\n * Degrades the data of the serie. This option is used for big data sets that have monotoneously increasing (or decreasing) x values.\n * For example, a serie containing 1'000'000 points, displayed over 1'000px, will have 1'000 points per pixel. Often it does not make sense to display more than 2-3 points per pixel.\n * degrade( pxPerPoint ) allows a degradation of the serie, based on a a number of pixel per point. It computes the average of the data that would be displayed over each pixel range\n * Starting from jsGraph 2.0, it does not calculate the minimum and maximum and creates the zone serie anymore\n * @return {SerieLine} The current serie instance\n * @example serie.degrade( 0.5 ); // Will display 2 points per pixels\n * @memberof SerieLine\n */\n degrade(pxPerP) {\n\n this.degradationPx = pxPerP;\n return this;\n }\n\n drawInit(force) {\n\n try {\n this.axisCheck();\n } catch (e) {\n console.warn(e);\n return false;\n }\n\n this.currentLineId = 0;\n this.counter = 0;\n this._drawn = true;\n this.currentLine = '';\n\n // Degradation\n\n if (this.waveform) {\n\n if (this.degradationPx) {\n\n this.waveform.resampleForDisplay({\n\n resampleToPx: this.degradationPx,\n xPosition: this.getXAxis().getPx.bind(this.getXAxis()),\n minX: this.getXAxis().getCurrentMin(),\n maxX: this.getXAxis().getCurrentMax()\n\n });\n\n this._dataToUse = [this.waveform.getDataToUseFlat()];\n } else if (this.waveform.hasAggregation()) {\n\n let xaxis = this.getXAxis(),\n numberOfPointsInTotal = this.graph.getDrawingWidth() * (xaxis.getDataMax() - xaxis.getDataMin()) / (xaxis.getCurrentMax() - xaxis.getCurrentMin()),\n promise = this.waveform.selectAggregatedData(numberOfPointsInTotal);\n\n if (promise instanceof Promise) {\n\n promise.then(() => {\n\n this.draw(force);\n });\n\n return false;\n } else if (promise === false) {\n\n return false;\n } else {\n\n this._dataToUse = this.waveform.getDataToUseFlat();\n }\n }\n\n // this._dataToUse = this.waveform.getDataToUseFlat();\n } else {\n\n this._dataToUse = this.data;\n this._xDataToUse = this.xData;\n }\n\n return true;\n }\n\n removeLinesGroup() {\n this._afterLinesGroup = this.groupLines.nextSibling;\n this.groupMain.removeChild(this.groupLines);\n }\n\n insertLinesGroup() {\n\n if (!this._afterLinesGroup) {\n throw 'Could not find group after lines to insertion.';\n }\n\n this.groupMain.insertBefore(this.groupLines, this._afterLinesGroup);\n this._afterLinesGroup = false;\n }\n\n removeExtraLines() {\n\n var i = this.currentLineId,\n l = this.lines.length;\n\n for (; i < l; i++) {\n this.groupLines.removeChild(this.lines[i]);\n }\n\n this.lines.splice(this.currentLineId, l - this.currentLineId);\n this.currentLineId = 0;\n }\n\n /**\n * Draws the serie\n * @memberof SerieLine\n */\n draw(force) {\n // Serie redrawing\n\n super.draw(...arguments);\n\n if (!this.getXAxis() || !this.getYAxis()) {\n throw 'No axes were defined for this serie';\n }\n\n if (force || this.hasDataChanged()) {\n if (!this.drawInit(force)) {\n return;\n }\n\n var data = this._dataToUse,\n xData = this._xDataToUse,\n slotToUse = this._slotToUse;\n\n this.removeLinesGroup();\n this.eraseMarkers();\n\n this.lookForMaxima = true;\n this.lookForMinima = false;\n\n this.markerFamily = this.markerFamilies[this.selectionType || 'unselected'];\n\n this.pos0 = this.getYAxis().getPos(0);\n\n if (this.hasErrors()) {\n this.errorDrawInit();\n }\n\n this._draw();\n\n if (this.hasErrors()) {\n this.errorDraw();\n }\n\n this.removeExtraLines();\n this.insertMarkers();\n this.insertLinesGroup();\n }\n\n // Unhovers everything\n for (var i in this.domMarkerHover) {\n this.toggleMarker(i.split(','), false, true);\n }\n\n // Deselects everything\n for (var i in this.domMarkerSelect) {\n this.toggleMarker(i.split(','), false, false);\n }\n\n this.applyLineStyle(this.getSymbolForLegend());\n\n if (this.hasStyleChanged(this.selectionType)) {\n this.updateStyle();\n }\n\n this.dataHasChanged(false);\n super.afterDraw();\n }\n\n _draw() {\n\n let self = this,\n waveform = this.waveform,\n data,\n x,\n y,\n lastX = false,\n lastY = false,\n xpx,\n ypx,\n xpx2,\n ypx2,\n xAxis = this.getXAxis(),\n yAxis = this.getYAxis(),\n xMin = xAxis.getCurrentMin(),\n yMin = yAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n yMax = yAxis.getCurrentMax();\n\n if (!waveform) {\n return;\n }\n\n data = waveform.getData(true);\n\n // Y crossing\n let yLeftCrossingRatio,\n yLeftCrossing,\n yRightCrossingRatio,\n yRightCrossing,\n xTopCrossingRatio,\n xTopCrossing,\n xBottomCrossingRatio,\n xBottomCrossing,\n\n\n /*xshift = waveform.getXShift(),\n xscale = wave.getXScale(),*/\n yshift = waveform.getShift(),\n yscale = waveform.getScale();\n\n let pointOutside = false;\n let lastPointOutside = false;\n let pointOnAxis;\n\n let _monotoneous = this.isMonotoneous(),\n _markersShown = this.markersShown();\n\n let i = 0,\n l = waveform.getLength();\n\n this.currentLine = '';\n\n if (waveform.isXMonotoneous()) {\n\n if (waveform.isXMonotoneousAscending()) {\n\n i = waveform.getIndexFromX(xMin, true) || 0;\n l = waveform.getIndexFromX(xMax, true);\n\n if (l === false) {\n l = waveform.getLength();\n }\n } else {\n\n i = waveform.getIndexFromX(xMax, true) || 0;\n l = waveform.getIndexFromX(xMin, true);\n\n if (l === false) {\n l = waveform.getLength();\n }\n }\n\n l += 2;\n if (l > data.length) {\n l = data.length;\n }\n }\n\n for (; i < l; i += 1) {\n\n x = waveform.getX(i, true);\n y = data[i] * yscale + yshift;\n\n if (x != x || y != y) {\n // NaN checks\n this._createLine();\n continue;\n }\n\n if (!this.options.overflowX && x < xMin && lastX < xMin || !this.options.overflowX && x > xMax && lastX > xMax || (!this.options.overflowY && y < yMin && lastY < yMin || !this.options.overflowY && y > yMax && lastY > yMax) && !this.options.lineToZero) {\n lastX = x;\n lastY = y;\n lastPointOutside = true;\n continue;\n }\n\n this.counter2 = i;\n\n if (_markersShown) {\n this.getMarkerCurrentFamily(this.counter2);\n }\n\n xpx2 = this.getX(x);\n ypx2 = this.getY(y);\n //xpx2 = 0;\n //ypx2 = 0;\n\n if (xpx2 == xpx && ypx2 == ypx) {\n continue;\n }\n\n if (xpx2 != xpx2 || ypx2 != ypx2) {\n // NaN checks\n if (this.counter > 0) {\n\n this._createLine();\n }\n continue;\n }\n\n if (!_monotoneous) {\n\n pointOutside = !this.options.overflowX && (x < xMin || x > xMax) || !this.options.overflowY && (y < yMin || y > yMax);\n } else {\n pointOutside = !this.options.overflowY && (y < yMin || y > yMax);\n }\n\n if (this.options.lineToZero) {\n pointOutside = x < xMin || x > xMax;\n\n if (pointOutside) {\n continue;\n }\n } else {\n\n if (pointOutside || lastPointOutside) {\n\n if ((lastX === false || lastY === false) && !lastPointOutside) {\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n } else {\n\n pointOnAxis = [];\n // Y crossing\n yLeftCrossingRatio = (x - xMin) / (x - lastX);\n yLeftCrossing = y - yLeftCrossingRatio * (y - lastY);\n yRightCrossingRatio = (x - xMax) / (x - lastX);\n yRightCrossing = y - yRightCrossingRatio * (y - lastY);\n\n // X crossing\n xTopCrossingRatio = (y - yMin) / (y - lastY);\n xTopCrossing = x - xTopCrossingRatio * (x - lastX);\n xBottomCrossingRatio = (y - yMax) / (y - lastY);\n xBottomCrossing = x - xBottomCrossingRatio * (x - lastX);\n\n if (yLeftCrossingRatio < 1 && yLeftCrossingRatio > 0 && yLeftCrossing !== false && yLeftCrossing < yMax && yLeftCrossing > yMin) {\n pointOnAxis.push([xMin, yLeftCrossing]);\n }\n\n if (yRightCrossingRatio < 1 && yRightCrossingRatio > 0 && yRightCrossing !== false && yRightCrossing < yMax && yRightCrossing > yMin) {\n pointOnAxis.push([xMax, yRightCrossing]);\n }\n\n if (xTopCrossingRatio < 1 && xTopCrossingRatio > 0 && xTopCrossing !== false && xTopCrossing < xMax && xTopCrossing > xMin) {\n pointOnAxis.push([xTopCrossing, yMin]);\n }\n\n if (xBottomCrossingRatio < 1 && xBottomCrossingRatio > 0 && xBottomCrossing !== false && xBottomCrossing < xMax && xBottomCrossing > xMin) {\n pointOnAxis.push([xBottomCrossing, yMax]);\n }\n\n if (pointOnAxis.length > 0) {\n\n if (!pointOutside) {\n // We were outside and now go inside\n\n if (pointOnAxis.length > 1) {\n console.error('Programmation error. Please e-mail me.');\n console.log(pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY);\n }\n\n this._createLine();\n this._addPoint(this.getX(pointOnAxis[0][0]), this.getY(pointOnAxis[0][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n this._addPoint(xpx2, ypx2, lastX, lastY, false, false, true);\n } else if (!lastPointOutside) {\n // We were inside and now go outside\n\n if (pointOnAxis.length > 1) {\n console.error('Programmation error. Please e-mail me.');\n console.log(pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY);\n }\n\n this._addPoint(this.getX(pointOnAxis[0][0]), this.getY(pointOnAxis[0][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n } else {\n\n // No crossing: do nothing\n if (pointOnAxis.length == 2) {\n this._createLine();\n\n this._addPoint(this.getX(pointOnAxis[0][0]), this.getY(pointOnAxis[0][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n this._addPoint(this.getX(pointOnAxis[1][0]), this.getY(pointOnAxis[1][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n }\n }\n } else if (!pointOutside) {\n\n this._addPoint(xpx2, ypx2, lastX, lastY, i, false, false);\n } // else {\n // Norman:\n // This else case is not the sign of a bug. If yLeftCrossing == 0 or 1 for instance, pointOutside or lastPointOutside will be true\n // However, there's no need to draw anything because the point is on the axis and will already be covered.\n // 28 Aug 2015\n\n /*\n if ( lastPointOutside !== pointOutside ) {\n console.error( \"Programmation error. A crossing should have been found\" );\n console.log( yLeftCrossing, yLeftCrossingRatio, yMax, yMin );\n console.log( yRightCrossing, yRightCrossingRatio, yMax, yMin );\n console.log( xTopCrossing, xTopCrossingRatio, xMax, xMin );\n console.log( xBottomCrossing, xBottomCrossingRatio, xMax, xMin );\n console.log( pointOutside, lastPointOutside )\n }\n */\n // }\n }\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n\n lastPointOutside = pointOutside;\n\n continue;\n }\n }\n\n this._addPoint(xpx2, ypx2, x, y, i, false, true);\n\n //this.detectPeaks( x, y );\n\n xpx = xpx2;\n ypx = ypx2;\n\n lastX = x;\n lastY = y;\n }\n\n this._createLine();\n\n if (this._tracker) {\n\n if (this._trackerDom) {\n this._trackerDom.remove();\n }\n\n var cloned = this.groupLines.cloneNode(true);\n this.groupMain.appendChild(cloned);\n\n for (i = 0, l = cloned.children.length; i < l; i++) {\n\n cloned.children[i].setAttribute('stroke', 'transparent');\n cloned.children[i].setAttribute('stroke-width', '25px');\n cloned.children[i].setAttribute('pointer-events', 'stroke');\n }\n\n this._trackerDom = cloned;\n\n this.groupMain.addEventListener('mousemove', e => {\n var coords = this.graph._getXY(e),\n ret = this.handleMouseMove(false, false);\n\n this._trackingCallback(this, ret, coords.x, coords.y);\n });\n\n this.groupMain.addEventListener('mouseleave', e => {\n this._trackingOutCallback(this);\n });\n }\n\n return this;\n }\n\n kill() {\n super.kill();\n }\n\n /**\n * @param {Number} k - Index of the point for which we should get the family\n * @memberof SerieLine\n */\n getMarkerCurrentFamily(k) {\n\n if (!this.markerPoints || !this.markerPoints[this.selectionType]) {\n return;\n }\n\n var family;\n\n for (var z = 0; z < this.markerPoints[this.selectionType].length; z++) {\n if (this.markerPoints[this.selectionType][z][0] <= k) {\n // This one is a possibility !\n if (this.markerPoints[this.selectionType][z][1] >= k) {\n // Verify that it's in the boundary\n this.markerCurrentFamily = this.markerPoints[this.selectionType][z][2];\n family = this.markerFamilies[this.selectionType][this.markerCurrentFamily];\n }\n } else {\n break;\n }\n }\n\n if (!family) {\n return false;\n }\n this.getMarkerDom(family);\n return this.markerCurrentFamily;\n }\n\n setMarkerStyleTo(dom, family) {\n\n if (!dom || !family) {\n console.trace();\n throw 'Cannot set marker style. DOM does not exist.';\n }\n\n dom.setAttribute('fill', family.fillColor || 'transparent');\n dom.setAttribute('stroke', family.strokeColor || this.getLineColor());\n dom.setAttribute('stroke-width', family.strokeWidth || 1);\n }\n\n /**\n * Hides the tracking marker (see the trackMouse option)\n * @memberof SerieLine\n */\n hideTrackingMarker() {\n this.marker.setAttribute('display', 'none');\n this.markerLabel.setAttribute('display', 'none');\n this.markerLabelSquare.setAttribute('display', 'none');\n }\n\n _addPoint(xpx, ypx, x, y, j, move, allowMarker) {\n\n /*if( ! this.currentLineId ) {\n throw \"No current line\"\n }* @memberof SerieLine\n */\n\n if (xpx !== xpx || ypx !== ypx) {\n return;\n }\n\n if (this.counter == 0) {\n this.currentLine = 'M ';\n } else {\n\n if (this.options.lineToZero || move) {\n this.currentLine += 'M ';\n } else {\n this.currentLine += 'L ';\n }\n }\n\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += ypx;\n this.currentLine += ' ';\n\n if (this.options.lineToZero && this.pos0 !== undefined) {\n\n this.currentLine += 'L ';\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += this.pos0;\n this.currentLine += ' ';\n }\n\n if (this.hasErrors()) {\n this.errorAddPoint(j, x, y, xpx, ypx);\n }\n\n if (!this.markerPoints) {\n this.counter++;\n\n return;\n }\n\n if (this.markersShown() && allowMarker !== false && this.markerFamily) {\n drawMarkerXY(this, this.markerFamily[this.markerCurrentFamily], xpx, ypx, this.markersDom.get(this.markerFamily[this.markerCurrentFamily]));\n }\n\n this.counter++;\n }\n\n // Returns the DOM\n _createLine() {\n\n var i = this.currentLineId++,\n line;\n\n // Creates a line if needed\n if (this.lines[i]) {\n line = this.lines[i];\n } else {\n\n line = document.createElementNS(this.graph.ns, 'path');\n this.applyLineStyle(line);\n this.groupLines.appendChild(line);\n this.lines[i] = line;\n }\n\n if (this.counter == 0) {\n line.setAttribute('d', '');\n } else {\n line.setAttribute('d', this.currentLine);\n }\n\n this.currentLine = 'M ';\n this.counter = 0;\n\n return line;\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyles() {\n\n for (var i = 0; i < this.lines.length; i++) {\n this.applyLineStyle(this.lines[i]);\n }\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n } else {\n line.removeAttribute('stroke-dasharray');\n }\n line.setAttribute('fill', 'none');\n //\tline.setAttribute('shape-rendering', 'optimizeSpeed');\n }\n\n /**\n * Updates the current style (lines + legend) of the serie. Use this method if you have explicitely changed the options of the serie\n * @example var opts = { lineColor: 'red' };\n * var s = graph.newSerie( \"name\", opts ).setData( someData );\n * opts.lineColor = 'green';\n * s.updateStyle(); // Sets the lineColor to green\n * s.draw(); // Would also do the same thing, but recalculates the whole serie display (including (x,y) point pairs)\n * @memberof SerieLine\n */\n updateStyle() {\n this.applyLineStyles();\n this.setLegendSymbolStyle();\n\n this.styleHasChanged(false);\n }\n\n // Revised August 2014. Ok\n getMarkerPath(family, add) {\n\n var z = family.zoom || 1,\n add = add || 0,\n el = [];\n\n switch (family.type) {\n\n case 2:\n el = ['m', -2, -2, 'l', 4, 4, 'm', -4, 0, 'l', 4, -4];\n break;\n\n case 3:\n el = ['m', -2, 0, 'l', 4, 0, 'm', -2, -2, 'l', 0, 4];\n break;\n\n case 4:\n el = ['m', -1, -1, 'l', 2, 0, 'l', -1, 2, 'z'];\n break;\n\n default:\n case 1:\n el = ['m', -2, -2, 'l', 4, 0, 'l', 0, 4, 'l', -4, 0, 'z'];\n break;\n\n }\n\n if ((z == 1 || !z) && !add) {\n return el.join(' ');\n }\n\n var num = 'number';\n\n if (!el) {\n return;\n }\n\n for (var i = 0, l = el.length; i < l; i++) {\n\n if (typeof el[i] == num) {\n\n el[i] *= z + add;\n }\n }\n\n return el.join(' ');\n }\n\n // Revised August 2014. Ok\n getMarkerDom(family) {\n\n var self = this;\n\n if (!this.markersDom.has(family)) {\n\n var dom = document.createElementNS(this.graph.ns, 'path');\n this.setMarkerStyleTo(dom, family);\n this.markersDom.set(family, {\n dom: dom,\n path: ''\n });\n\n dom.addEventListener('mouseover', function (e) {\n var closest = self._getMarkerIndexFromEvent(e);\n self.onMouseOverMarker(e, closest);\n });\n\n dom.addEventListener('mouseout', function (e) {\n var closest = self._getMarkerIndexFromEvent(e);\n self.onMouseOutMarker(e, closest);\n });\n\n dom.addEventListener('click', function (e) {\n var closest = self._getMarkerIndexFromEvent(e);\n self.onClickOnMarker(e, closest);\n });\n }\n\n return family.dom;\n }\n\n // In case markers are not grouped in families but independant\n getMarkerDomIndependent(index, family) {\n\n if (!this.independantMarkers[index]) {\n\n var dom = document.createElementNS(this.graph.ns, 'path');\n this.setMarkerStyleTo(dom, family);\n\n dom.addEventListener('mouseover', e => {\n\n this.onMouseOverMarker(e, index);\n });\n\n dom.addEventListener('mouseout', e => {\n\n this.onMouseOutMarker(e, index);\n });\n\n dom.addEventListener('click', e => {\n\n this.onClickOnMarker(e, index);\n });\n\n this.independantMarkers[index] = dom;\n }\n\n this.groupMarkers.appendChild(this.independantMarkers[index]);\n\n return this.independantMarkers[index];\n }\n\n /**\n * Searches the closest point pair (x,y) to the a pair of pixel position\n * @param {Number} x - The x position in pixels (from the left)\n * @param {Number} y - The y position in pixels (from the left)\n * @returns {Number} Index in the data array of the closest (x,y) pair to the pixel position passed in parameters\n * @memberof SerieLine\n */\n searchIndexByPxXY(x, y) {\n\n var oldDist = false,\n xyindex = false,\n dist;\n\n var xData = this._xDataToUse,\n p_x,\n p_y;\n\n for (var k = 0, m = this.waveform.getLength(); k < m; k += 1) {\n\n p_x = this.waveform.getX(k);\n p_y = this.waveform.getY(k);\n\n dist = Math.pow(this.getX(p_x) - x, 2) + Math.pow(this.getY(p_y) - y, 2);\n //console.log(x, y, dist, this.data[i][k], this.data[i][k + 1]);\n\n if (!oldDist || dist < oldDist) {\n oldDist = dist;\n xyindex = k;\n }\n }\n\n return xyindex;\n }\n\n /**\n * Performs a binary search to find the closest point index to an x value. For the binary search to work, it is important that the x values are monotoneous.\n * @param {Number} valX - The x value to search for\n * @returns {Object} Index in the data array of the closest (x,y) pair to the pixel position passed in parameters\n * @memberof SerieLine\n */\n searchClosestValue(valX, valY) {\n\n if (this.waveform) {\n\n const indexX = this.waveform.getIndexFromXY(valX, valY, undefined, undefined, this.getXAxis().getRelPx(1), this.getYAxis().getRelPx(1));\n\n let returnObj = {};\n\n let direction;\n\n if (valX > this.waveform.getX(indexX)) {\n direction = 0;\n } else {\n direction = 1;\n }\n\n Object.assign(returnObj, {\n indexMin: indexX + direction,\n indexMax: indexX + direction + 1,\n indexClosest: indexX,\n xMin: this.waveform.getX(indexX + direction),\n xMax: this.waveform.getX(indexX + direction + 1),\n yMin: this.waveform.getY(indexX + direction),\n yMax: this.waveform.getY(indexX + direction + 1),\n xClosest: this.waveform.getX(indexX),\n yClosest: this.waveform.getY(indexX),\n xExact: valX\n });\n return returnObj;\n }\n }\n\n handleMouseMove(xValue, doMarker, yValue) {\n\n var valX = xValue || this.getXAxis().getMouseVal(),\n valY = yValue || this.getYAxis().getMouseVal();\n\n var value = this.searchClosestValue(valX, valY);\n\n if (!value) {\n return;\n }\n\n var ratio, intY;\n\n if (value.xMax == value.xMin) {\n intY = value.yMin;\n } else {\n\n //ratio = ( valX - value.xMin ) / ( value.xMax - value.xMin );\n //intY = ( ( 1 - ratio ) * value.yMin + ratio * value.yMax );\n }\n\n if (doMarker && this.options.trackMouse) {\n\n if (value.xMin == undefined) {\n\n return false;\n } else {\n\n if (!this.marker) {\n return;\n }\n\n var x = this.getX(this.getFlip() ? value.yClosest : value.xClosest);\n var y = this.getY(this.getFlip() ? value.xClosest : value.yClosest);\n\n if (isNaN(x) || isNaN(y)) {\n return;\n }\n\n this.marker.setAttribute('display', 'block');\n this.marker.setAttribute('cx', x);\n this.marker.setAttribute('cy', y);\n\n this.markerLabel.setAttribute('display', 'block');\n this.markerLabelSquare.setAttribute('display', 'block');\n\n switch (this.options.trackMouseLabel) {\n\n case false:\n\n break;\n\n default:\n this.markerLabel.textContent = this.options.trackMouseLabel.replace('', valX.toFixed(this.options.trackMouseLabelRouding)).replace('', intY.toFixed(this.options.trackMouseLabelRouding));\n break;\n }\n\n this.markerLabel.setAttribute('x', x + 5);\n this.markerLabel.setAttribute('y', y - 5);\n\n this.markerLabelSquare.setAttribute('x', x + 5);\n this.markerLabelSquare.setAttribute('y', y - 5 - this.graph.options.fontSize);\n this.markerLabelSquare.setAttribute('width', this.markerLabel.getComputedTextLength() + 2);\n this.markerLabelSquare.setAttribute('height', this.graph.options.fontSize + 2);\n }\n }\n\n return {\n xBefore: value.xMin,\n xAfter: value.xMax,\n yBefore: value.yMin,\n yAfter: value.yMax,\n trueX: value.xExact,\n indexClosest: value.indexClosest,\n interpolatedY: intY,\n\n xClosest: value.xClosest,\n yClosest: value.yClosest\n };\n }\n /**\n * Gets the maximum value of the y values between two x values. The x values must be monotoneously increasing\n * @param {Number} startX - The start of the x values\n * @param {Number} endX - The end of the x values\n * @returns {Number} Maximal y value in between startX and endX\n * @memberof SerieLine\n */\n getMax(start, end) {\n\n var start2 = Math.min(start, end),\n end2 = Math.max(start, end),\n v1 = this.searchClosestValue(start2),\n v2 = this.searchClosestValue(end2),\n i,\n j,\n max = -Infinity,\n initJ,\n maxJ;\n\n // console.log( start2, end2, v1, v2 );\n\n if (!v1) {\n start2 = this.minX;\n v1 = this.searchClosestValue(start2);\n }\n\n if (!v2) {\n end2 = this.maxX;\n v2 = this.searchClosestValue(end2);\n }\n\n if (!v1 || !v2) {\n return -Infinity;\n }\n\n for (i = v1.dataIndex; i <= v2.dataIndex; i++) {\n initJ = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n maxJ = i == v2.dataIndex ? v2.xBeforeIndexArr : this.data[i].length;\n\n for (j = initJ; j <= maxJ; j += 2) {\n max = Math.max(max, this.data[i][j + 1]);\n }\n }\n\n return max;\n }\n\n /**\n * Gets the minimum value of the y values between two x values. The x values must be monotoneously increasing\n * @param {Number} startX - The start of the x values\n * @param {Number} endX - The end of the x values\n * @returns {Number} Maximal y value in between startX and endX\n * @memberof SerieLine\n */\n getMin(start, end) {\n\n var start2 = Math.min(start, end),\n end2 = Math.max(start, end),\n v1 = this.searchClosestValue(start2),\n v2 = this.searchClosestValue(end2),\n i,\n j,\n min = Infinity,\n initJ,\n maxJ;\n\n if (!v1) {\n start2 = this.minX;\n v1 = this.searchClosestValue(start2);\n }\n\n if (!v2) {\n end2 = this.maxX;\n v2 = this.searchClosestValue(end2);\n }\n\n if (!v1 || !v2) {\n return Infinity;\n }\n\n for (i = v1.dataIndex; i <= v2.dataIndex; i++) {\n initJ = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n maxJ = i == v2.dataIndex ? v2.xBeforeIndexArr : this.data[i].length;\n\n for (j = initJ; j <= maxJ; j += 2) {\n min = Math.min(min, this.data[i][j + 1]);\n }\n }\n\n return min;\n }\n\n /* LINE STYLE * @memberof SerieLine\n */\n\n setStyle(style, selectionType = 'unselected') {\n\n this.styles[selectionType] = style;\n this.styleHasChanged(selectionType);\n }\n\n setLineStyle(number, selectionType = 'unselected', applyToSelected) {\n\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].lineStyle = number;\n\n if (applyToSelected) {\n this.setLineStyle(number, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getLineStyle(selectionType) {\n return this.getStyle(selectionType).lineStyle;\n }\n\n getLineDashArray(selectionType = this.selectionType || 'unselected') {\n\n switch (this.getStyle(selectionType).lineStyle) {\n\n case 2:\n return '1, 1';\n break;\n case 3:\n return '2, 2';\n break;\n case 4:\n return '3, 3';\n break;\n case 5:\n return '4, 4';\n break;\n case 6:\n return '5, 5';\n break;\n\n case 7:\n return '5 2';\n break;\n case 8:\n return '2 5';\n break;\n\n case 9:\n return '4 2 4 4';\n break;\n case 10:\n return '1,3,1';\n break;\n case 11:\n return '9 2';\n break;\n case 12:\n return '2 9';\n break;\n\n case 1:\n case false:\n return false;\n break;\n\n default:\n return this.styles[selectionType].lineStyle;\n break;\n }\n\n this.styleHasChanged(selectionType);\n }\n\n getStyle(selectionType = this.selectionType || 'unselected') {\n return this.styles[selectionType];\n }\n\n extendStyles() {\n for (var i in this.styles) {\n\n var s = this.styles[i];\n if (s) {\n this.styles[i] = extend(true, {}, this.styles.unselected, s);\n }\n }\n }\n\n extendStyle(styleTarget, styleOrigin) {\n var s = this.styles[styleTarget];\n\n this.styles[styleTarget] = extend(true, {}, this.styles[styleOrigin || 'unselected'], s || {});\n\n this.styles[styleTarget].markers.map(function (marker) {\n if (marker.dom) {\n marker.dom = '';\n }\n });\n\n this._recalculateMarkerPoints(styleTarget, this.styles[styleTarget].markers);\n this.styleHasChanged(styleTarget);\n }\n\n /* * @memberof SerieLine\n */\n\n setLineWidth(width, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].lineWidth = width;\n\n if (applyToSelected) {\n this.setLineWidth(width, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getLineWidth(selectionType) {\n\n return this.getStyle(selectionType).lineWidth || 1;\n }\n\n /* LINE COLOR * @memberof SerieLine\n */\n setLineColor(color, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].lineColor = color;\n\n if (applyToSelected) {\n this.setLineColor(color, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getLineColor(selectionType) {\n\n return this.getStyle(selectionType).lineColor || 'black';\n }\n\n /* * @memberof SerieLine\n */\n\n /* MARKERS * @memberof SerieLine\n */\n showMarkers(selectionType, redraw) {\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].showMarkers = true;\n\n if (redraw && this._drawn) {\n this.draw(true);\n } else {\n this.styleHasChanged(selectionType);\n }\n\n return this;\n }\n\n hideMarkers(selectionType, redraw) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType].showMarkers = false;\n\n if (redraw && this._drawn) {\n this.draw(true);\n } else {\n this.styleHasChanged(selectionType);\n }\n return this;\n }\n\n markersShown(selectionType) {\n return this.getStyle(selectionType).showMarkers !== false;\n }\n\n areMarkersShown() {\n return this.markersShown.apply(this, arguments);\n }\n\n isMarkersShown() {\n return this.markersShown.apply(this, arguments);\n }\n\n // Multiple markers\n setMarkers(families, selectionType, applyToSelected) {\n // Family has to be an object\n // Family looks like\n /*\n {\n \ttype: 1,\n \tzoom: 1,\n \tstrokeWidth: 1,\n \tstrokeColor: '',\n \tfillColor: '',\n points: []\n }\n * @memberof SerieLine\n */\n\n this.styles[selectionType || 'unselected'] = this.styles[selectionType || 'unselected'] || {};\n\n this.showMarkers(selectionType, false);\n\n if (!Array.isArray(families) && typeof families == 'object') {\n families = [families];\n } else if (!families) {\n\n families = [{\n type: 1,\n zoom: 1,\n points: 'all'\n }];\n }\n\n this.styles[selectionType || 'unselected'].markers = families;\n\n if (applyToSelected) {\n this.styles.selected.markers = extend(true, {}, families);\n }\n\n this._recalculateMarkerPoints(selectionType, families);\n this.styleHasChanged(selectionType);\n this.dataHasChanged(true); // Data has not really changed, but marker placing is performed during the draw method\n return this;\n }\n\n setMarkersPoints(points, family, selectionType) {\n this._extendMarkers('points', points, family, selectionType, true);\n }\n\n setMarkersColor(color, family, selectionType) {\n this._extendMarkers('color', color, family, selectionType);\n }\n\n setMarkersType(type, family, selectionType) {\n this._extendMarkers('type', type, family, selectionType);\n }\n\n setMarkersZoom(zoom, family, selectionType) {\n this._extendMarkers('zoom', zoom, family, selectionType);\n }\n\n setMarkersStrokeColor(strokeColor, family, selectionType) {\n this._extendMarkers('strokeColor', strokeColor, family, selectionType);\n }\n\n setMarkersStrokeWidth(strokeWidth, family, selectionType) {\n this._extendMarkers('strokeWidth', strokeWidth, family, selectionType);\n }\n\n setMarkersFillColor(fillColor, family, selectionType) {\n this._extendMarkers('fillColor', fillColor, family, selectionType);\n }\n\n _extendMarkers(type, value, family, selectionType, recalculatePoints) {\n\n family = family || 0;\n selectionType = selectionType || 'unselected';\n\n if (!this.styles[selectionType] || !this.styles[selectionType].markers) {\n return;\n }\n\n this.styles[selectionType].markers[family][type] = value;\n\n if (recalculatePoints) {\n this._recalculateMarkerPoints(selectionType, this.styles[selectionType].markers);\n }\n\n if (!this.markersDom[this.styles[selectionType].markers[family]]) {\n // DOM doesn't exist yet.\n return;\n }\n\n this.setMarkerStyleTo(this.markersDom[this.styles[selectionType].markers[family]].dom, this.styles[selectionType].markers[family]);\n }\n\n _recalculateMarkerPoints(selectionType, families) {\n\n var markerPoints = [];\n // Overwriting any other undefined families\n markerPoints.push([0, Infinity, null]);\n\n for (var i = 0, k = families.length; i < k; i++) {\n\n families[i].markerPath = this.getMarkerPath(families[i]);\n\n if (!families[i].points) {\n families[i].points = 'all';\n }\n\n if (!Array.isArray(families[i].points)) {\n families[i].points = [families[i].points];\n }\n\n for (var j = 0, l = families[i].points.length; j < l; j++) {\n\n if (families[i].points[j] == 'all') {\n\n markerPoints.push([0, Infinity, i]);\n } else if (!Array.isArray(families[i].points[j])) {\n\n markerPoints.push([families[i].points[j], families[i].points[j], i]);\n //markerPoints.push( [ family[ i ].points[ j ] + 1, null ] );\n } else {\n\n markerPoints.push([families[i].points[j][0], families[i].points[j][1], i]);\n }\n }\n }\n\n this.markerFamilies[selectionType || 'unselected'] = families;\n\n // Let's sort if by the first index.\n markerPoints.sort(function (a, b) {\n return a[0] - b[0] || (a[2] == null ? -1 : 1);\n });\n\n this.markerPoints[selectionType || 'unselected'] = markerPoints;\n }\n\n insertMarkers(selectionType) {\n\n if (!this.markerFamilies || !this.markerFamilies[selectionType || this.selectionType] || this.options.markersIndependant) {\n return;\n }\n\n for (var i = 0, l = this.markerFamilies[selectionType || this.selectionType].length; i < l; i++) {\n\n if (!this.markersDom.has(this.markerFamilies[selectionType || this.selectionType][i])) {\n continue;\n }\n\n let dom = this.markersDom.get(this.markerFamilies[selectionType || this.selectionType][i]);\n\n dom.dom.setAttribute('d', dom.path);\n\n this.groupMarkers.appendChild(dom.dom);\n this.currentMarkersSelectionType = this.selectionType;\n }\n }\n\n getMarkerForLegend() {\n\n if (!this.markerPoints || !this.markerPoints[this.selectionType]) {\n return;\n }\n\n if (!this.markerForLegend) {\n\n var marker = document.createElementNS(this.graph.ns, 'path');\n this.setMarkerStyleTo(marker, this.markerFamilies[this.selectionType][0]);\n\n marker.setAttribute('d', 'M 14 0 ' + this.getMarkerPath(this.markerFamilies[this.selectionType][0]));\n\n this.markerForLegend = marker;\n }\n\n return this.markerForLegend;\n }\n\n eraseMarkers() {\n\n var self = this;\n\n if (this.options.markersIndependant) {\n\n for (var i in this.independantMarkers) {\n self.groupMarkers.removeChild(this.independantMarkers[i]);\n }\n\n this.independantMarkers = {};\n } else if (this.currentMarkersSelectionType) {\n\n this.markersDom.forEach(function (el) {\n\n if (!el.dom) {\n return;\n }\n\n if (el.dom.parentNode !== self.groupMarkers) {\n return;\n }\n\n self.groupMarkers.removeChild(el.dom);\n el.path = '';\n });\n\n this.currentMarkersSelectionType = false;\n }\n }\n\n isMonotoneous() {\n if (this.waveform) {\n return this.waveform.isMonotoneous();\n }\n\n return !!this.xmonotoneous;\n }\n\n findLocalMinMax(xRef, xWithin, type) {\n\n if (!this.waveform) {\n return false;\n }\n\n return this.waveform.findLocalMinMax(xRef, xWithin, type);\n }\n\n}\n\nfunction drawMarkerXY(graph, family, x, y, markerDom) {\n\n if (!family) {\n return;\n }\n\n if (graph.options.markersIndependant) {\n var dom = graph.getMarkerDomIndependent(graph.counter2, family);\n var p = 'M ' + x + ' ' + y + ' ';\n p += family.markerPath + ' ';\n\n dom.setAttribute('d', p);\n }\n\n markerDom.path = markerDom.path || '';\n markerDom.path += 'M ' + x + ' ' + y + ' ';\n markerDom.path += family.markerPath + ' ';\n}\n\nmix(SerieLine, ErrorBarMixin);\n\nvar Serie3DMixin = {\n\n /**\n * Returns the x position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The x position in px corresponding to the x value\n */\n getX: function (val) {\n return (val = this.getXAxis().getPx(val)) - val % 0.2 + this.getXAxis().getZProj(this.options.zpos);\n },\n\n /**\n * Returns the y position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie3DMixin\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The y position in px corresponding to the y value\n */\n getY: function (val) {\n return (val = this.getYAxis().getPx(val)) - val % 0.2 + this.getYAxis().getZProj(this.options.zpos);\n },\n\n getZPos: function () {\n return this.options.zpos;\n },\n\n /**\n * @returns {Number} Lowest x value of the serie's data\n * @memberof Serie\n */\n getMinX: function (useZValues) {\n if (!useZValues) {\n return this.minX;\n }\n\n return getZCorrectedValue(this, true, true);\n },\n\n /**\n * @returns {Number} Highest x value of the serie's data\n * @memberof Serie\n */\n getMaxX: function (useZValues) {\n\n if (!useZValues) {\n return this.maxX;\n }\n return getZCorrectedValue(this, true, false);\n },\n\n /**\n * @returns {Number} Lowest y value of the serie's data\n * @memberof Serie\n */\n getMinY: function (useZValues) {\n\n if (!useZValues) {\n return this.minY;\n }\n return getZCorrectedValue(this, false, true);\n },\n\n /**\n * @returns {Number} Highest y value of the serie's data\n * @memberof Serie\n */\n getMaxY: function (useZValues) {\n\n if (!useZValues) {\n return this.maxY;\n }\n return getZCorrectedValue(this, false, false);\n }\n\n};\n\nfunction getZCorrectedValue(serie, x, min) {\n\n let i, l, data, val, valFinal;\n let wf = serie.getWaveforms();\n\n for (let wave of wf) {\n\n i = 0;\n l = wave.getLength();\n data = wave.getData();\n\n for (; i < l; i += 1) {\n\n if (x) {\n val = serie.getXAxis().getVal(serie.getX(wave.getX(i, true)));\n } else {\n val = serie.getYAxis().getVal(serie.getY(data[i]));\n }\n\n if (i == 0) {\n valFinal = val;\n } else {\n\n if (min) {\n valFinal = Math.min(valFinal, val);\n } else {\n valFinal = Math.max(valFinal, val);\n }\n }\n }\n }\n return valFinal;\n}\n\n/**\n * Serie line with 3D projection\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends SerieLine\n */\nclass SerieLine3D extends SerieLine {\n\n static defaults() {\n return {\n zpos: 0\n };\n }\n constructor(graph, name, options) {\n super(...arguments);\n }\n\n /**\n * Sets the z-position\n * @memberof SerieLine3D\n * @param {Number} zPos - The position in the z axis\n */\n setZPos(zPos) {\n this.options.zpos = zPos;\n return this;\n }\n\n setz() {\n return this.setZPos(...arguments);\n }\n}\n\nmix(SerieLine3D, Serie3DMixin);\n\n/**\n * Represents a bar serie.\n Needs to be used exclusively with a bar axis ({@link AxisXBar}).\n Supports error bars, line color, line width, fill color, fill opacity.\n * @example graph.newSerie(\"serieName\", { fillColor: 'red', fillOpacity: 0.2 }, \"bar\" );\n * @extends Serie\n */\nclass SerieBar extends SerieLine {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.pathDom = document.createElementNS(this.graph.ns, 'path');\n this.groupMain.appendChild(this.pathDom);\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n lineWidth: this.options.lineWidth,\n fillColor: this.options.fillColor,\n fillOpacity: this.options.fillOpacity,\n markers: this.options.markers\n };\n }\n\n /**\n * Sets the data of the bar serie\n * @param {Object} data\n * @example serie.setData( { \"cat1\": val1, \"cat2\": val2, \"cat4\": val4 } );\n * @return {SerieBar} The current serie instance\n */\n setData(data) {\n\n this.data = data;\n this.minY = Number.MAX_SAFE_INTEGER;\n this.maxY = Number.MIN_SAFE_INTEGER;\n\n for (var i in this.data) {\n this._checkY(this.data[i]);\n }\n\n return this;\n }\n\n /**\n * Sets the fill color\n */\n setFillColor(fillColor, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].fillColor = fillColor;\n\n if (applyToSelected) {\n this.setFillColor(fillColor, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n /**\n * Returns the fill color\n */\n getFillColor(selectionType) {\n return this.getStyle(selectionType).fillColor;\n }\n\n /*\n * @memberof SerieBar\n */\n setFillOpacity(opacity, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].fillOpacity = opacity;\n\n if (applyToSelected) {\n this.setLineWidth(opacity, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getFillOpacity(selectionType) {\n\n return this.getStyle(selectionType).fillOpacity || 1;\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n */\n applyLineStyles() {\n this.applyLineStyle(this.pathDom);\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieBar\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n } else {\n line.removeAttribute('stroke-dasharray');\n }\n line.setAttribute('fill', this.getFillColor());\n line.setAttribute('fill-opacity', this.getFillOpacity() || 1);\n }\n\n draw() {\n\n var path = '';\n if (this.error) {\n this.errorDrawInit();\n }\n\n for (var i in this.data) {\n\n if (!this.categoryIndices[i]) {\n continue;\n }\n\n path += 'M ' + this.getXAxis().getPos(this.categoryIndices[i]) + ' ' + this.getYAxis().getPos(0) + ' V ' + this.getYAxis().getPos(this.data[i]) + ' h ' + this.getXAxis().getDeltaPx(1 / this.nbCategories) + ' V ' + this.getYAxis().getPos(0);\n\n if (this.error) {\n this.errorAddPointBarChart(i, this.data[i], this.getXAxis().getPos(this.categoryIndices[i] + 0.5 / this.nbCategories), this.getYAxis().getPos(this.data[i]));\n }\n }\n\n if (this.error) {\n this.errorDraw();\n }\n\n this.pathDom.setAttribute('d', path);\n this.applyLineStyles();\n }\n\n // Markers now allowed\n setMarkers() {}\n\n getUsedCategories() {\n return Object.keys(this.data);\n }\n\n}\n\n/**\n * @static\n * @extends Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\nclass SerieBox extends Serie {\n\n static default() {\n return {\n orientation: 'y',\n maxBoxWidth: 20,\n\n defaultStyle: {\n\n meanLineColor: 'rgb( 100, 0, 0 )',\n meanLineWidth: 2,\n\n boxAboveLineWidth: 1,\n boxAboveLineColor: 'rgb( 0, 0, 0 )',\n boxAboveFillColor: 'transparent',\n boxAboveFillOpacity: 1,\n boxBelowLineWidth: 1,\n boxBelowLineColor: 'rgb( 0, 0, 0 )',\n boxBelowFillColor: 'transparent',\n boxBelowFillOpacity: 1,\n\n barAboveLineColor: 'rgba( 0, 0, 0, 1 )',\n barAboveLineWidth: 1,\n barBelowLineColor: 'rgba( 0, 0, 0, 1 )',\n barBelowLineWidth: 1,\n\n outlierLineWidth: 1,\n outlierLineColor: 'rgb( 255, 255, 255 )',\n outlierFillColor: 'rgb( 0, 0, 0 )',\n outlierFillOpacity: 1\n }\n };\n }\n\n constructor(graph, name, options) {\n\n super(...arguments);\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.pathDom = document.createElementNS(this.graph.ns, 'path');\n this.groupMain.appendChild(this.pathDom);\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = this.options.defaultStyle;\n }\n\n /**\n * Sets the data of the bar serie\n * @param {Object} data\n * @example serie.setData( [ { x: 'cat', Q2: valMean, Q1: valBoxMin, Q3: valBoxMax, whiskers: [ val1, val2 ], outliers: [ ...yList ] } ] );\n * @return {SerieBar} The current serie instance\n */\n setData(data, noRescale) {\n\n this.data = data;\n\n if (!Array.isArray(data)) {\n return;\n }\n\n let axisref, axisval, methodref, methodval, blnX;\n\n if (this.options.orientation == 'y') {\n axisref = this.getXAxis();\n axisval = this.getYAxis();\n methodref = this._checkX.bind(this);\n methodval = this._checkY.bind(this);\n blnX = true;\n\n this.minY = data[0].Q2;\n this.maxY = data[0].Q2;\n this.maxX = data[0].x;\n this.minX = data[0].x;\n } else {\n axisref = this.getYAxis();\n axisval = this.getXAxis();\n methodref = this._checkY.bind(this);\n methodval = this._checkX.bind(this);\n blnX = false;\n\n this.minX = data[0].Q2;\n this.maxX = data[0].Q2;\n this.maxY = data[0].y;\n this.minY = data[0].y;\n }\n\n if (noRescale) {\n methodref = function () {};\n methodval = function () {};\n }\n\n if (!axisref || !axisval) {\n throwError('Error in setting data of the box serie. The X and Y axes must be set beforehand');\n }\n\n for (var i in this.data) {\n\n if (blnX) {\n methodref(this.data[i].x);\n this.data[i].pos = this.data[i].x;\n } else {\n methodref(this.data[i].y);\n this.data[i].pos = this.data[i].y;\n }\n\n if (this.data[i].Q3) {\n\n methodval(this.data[i].Q3);\n }\n\n if (this.data[i].Q1) {\n methodval(this.data[i].Q1);\n }\n\n if (this.data[i].whiskers) {\n\n if (Array.isArray(this.data[i].whiskers)) {\n\n if (this.data[i].whiskers.length > 0) {\n methodval(this.data[i].whiskers[0]);\n }\n\n if (this.data[i].whiskers.length > 1) {\n methodval(this.data[i].whiskers[1]);\n }\n } else {\n methodval(this.data[i].whiskers);\n this.data[i].whiskers = [this.data[i].whiskers];\n }\n } else {\n this.data[i].whiskers = [];\n }\n\n if (Array.isArray(this.data[i].outliers)) {\n this.data[i].outliers.map(val => methodval(val));\n } else {\n this.data[i].outliers = [];\n }\n }\n\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n _style(type, styleValue, selectionType = 'unselected', applyToSelected = false) {\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType][type] = styleValue;\n\n if (applyToSelected) {\n this._set(type, styleValue, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n return this;\n }\n\n _gstyle(type, selectionType) {\n return this.getStyle(selectionType)[type];\n }\n\n /**\n * Retrives a selection object\n * @param {String} [ selectionType = \"unselected\" ] - The selection type\n * @returns {Object} The selection object\n */\n getStyle(selectionType = 'unselected') {\n\n return this.styles[selectionType] || {};\n }\n\n /**\n * Sets the mean line color\n * @param {String} color - The mean line color\n * @returns {SerieBox} The current serie instance\n */\n setMeanLineColor() {\n return this._style('meanLineColor', ...arguments);\n }\n\n /**\n * Returns the mean line color\n * @return {String} The mean line color\n */\n getMeanLineColor() {\n return this._gstyle('meanLineColor', ...arguments);\n }\n\n setStyle(style, selectionType = 'unselected') {\n //console.log( style, selectionType );\n this.styles[selectionType] = extend({}, this.default().defaultStyle, this.styles.unselected, style);\n this.styleHasChanged(selectionType);\n }\n\n /**\n * Sets the mean line width\n * @param {Number} width - The line width\n * @returns {SerieBox} The current serie instance\n */\n setMeanLineWidth() {\n return this._style('meanLineWidth', ...arguments);\n }\n\n /**\n * Returns the mean line width\n * @return {Number} The mean line width\n */\n getMeanLineWidth() {\n return this._gstyle('meanLineWidth', ...arguments);\n }\n\n /**\n * Sets the box line color\n * @param {Number} color - The color of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveLineColor() {\n return this._style('boxAboveLineColor', ...arguments);\n }\n\n /**\n * Returns the box line color\n * @return {String} The line color of the box above the median\n */\n getBoxAboveLineColor() {\n return this._gstyle('boxAboveLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} color - The color of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowLineColor() {\n return this._style('boxBelowLineColor', ...arguments);\n }\n\n /**\n * Returns the fill color\n * @return {String} The line color of the box below the median\n */\n getBoxBelowLineColor() {\n return this._gstyle('boxBelowLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The contour width of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveLineWidth() {\n return this._style('boxAboveLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the box above the median\n * @return {Number} The line width of the box above the median\n */\n getBoxAboveLineWidth() {\n return this._gstyle('boxAboveLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The contour width of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowLineWidth() {\n return this._style('boxBelowLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the box below the median\n * @return {Number} The line width of the box below the median\n */\n getBoxBelowLineWidth() {\n return this._gstyle('boxBelowLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The fill color of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveFillColor() {\n return this._style('boxAboveFillColor', ...arguments);\n }\n\n /**\n * Returns the fill color of the box above the median\n * @return {String} The fill color of the box above the median\n */\n getBoxAboveFillColor() {\n return this._gstyle('boxAboveFillColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The fill color of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowFillColor() {\n return this._style('boxBelowFillColor', ...arguments);\n }\n\n /**\n * Returns the fill color of the box below the median\n * @return {String} The fill color of the box below the median\n */\n getBoxBelowFillColor() {\n return this._gstyle('boxBelowFillColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} opacity - The fill opacity of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveFillOpacity() {\n return this._style('boxAboveFillOpacity', ...arguments);\n }\n\n /**\n * Returns the fill opacity of the box above the median\n * @return {Number} The fill opacity of the box above the median\n */\n getBoxAboveFillOpacity() {\n return this._gstyle('boxAboveFillOpacity', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} opacity - The fill opacity of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowFillOpacity() {\n return this._style('boxBelowFillOpacity', ...arguments);\n }\n\n /**\n * Returns the fill opacity of the box below the median\n * @return {Number} The fill opacity of the box below the median\n */\n getBoxBelowFillOpacity() {\n return this._gstyle('boxBelowFillOpacity', ...arguments);\n }\n\n /**\n * Sets the whisker color\n * @param {String} color - The line color of the whisker above the median\n * @returns {SerieBox} The current serie instance\n */\n setBarAboveLineColor() {\n return this._style('barAboveLineColor', ...arguments);\n }\n\n /**\n * Returns the line color of the whisker above the median\n * @return {String} The line color of the whisker above the median\n */\n getBarAboveLineColor() {\n return this._gstyle('barAboveLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The line color of the whisker below the median\n * @returns {SerieBox} The current serie instance\n */\n setBarBelowLineColor() {\n return this._style('barBelowLineColor', ...arguments);\n }\n\n /**\n * Returns the line color of the whisker below the median\n * @return {String} The line color of the whisker below the median\n */\n getBarBelowLineColor() {\n return this._gstyle('barBelowLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The line width of the whisker above the median\n * @returns {SerieBox} The current serie instance\n */\n setBarAboveLineWidth() {\n return this._style('barAboveLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the whisker above the median\n * @return {Number} The line width of the whisker above the median\n */\n getBarAboveLineWidth() {\n return this._gstyle('barAboveLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The line width of the whisker below the median\n * @returns {SerieBox} The current serie instance\n */\n setBarBelowLineWidth() {\n return this._style('barBelowLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the whisker below the median\n * @return {Number} The line width of the whisker below the median\n */\n getBarBelowLineWidth() {\n return this._gstyle('barBelowLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The outlier stroke color\n * @returns {SerieBox} The current serie instance\n */\n setOutlierLineColor() {\n return this._style('outlierLineColor', ...arguments);\n }\n\n /**\n * Returns the line color of the outliers\n * @return {String} The line color of the outliers\n */\n getOutlierLineColor() {\n return this._gstyle('outlierLineColor', ...arguments);\n }\n\n /**\n * Sets the stroke width\n * @param {Number} width - The outlier stroke width\n * @returns {SerieBox} The current serie instance\n */\n setOutlierLineWidth() {\n return this._style('outlierLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the outliers\n * @return {Number} The line width of the outliers\n */\n getOutlierLineWidth() {\n return this._gstyle('outlierLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The outlier fill color\n * @returns {SerieBox} The current serie instance\n */\n setOutlierFillColor() {\n return this._style('outlierFillColor', ...arguments);\n }\n\n /**\n * Returns the fill color of the outliers\n * @return {String} The fill color of the outliers\n */\n getOutlierFillColor() {\n return this._gstyle('outlierFillColor', ...arguments);\n }\n\n /**\n * Sets the outlier fill opacity\n * @param {Number} opacity - The outlier fill opacity\n * @returns {SerieBox} The current serie instance\n */\n setOutlierFillOpacity() {\n return this._style('outlierFillOpacity', ...arguments);\n }\n\n /**\n * Returns the fill opacity of the outliers\n * @return {Number} The fill opacity of the outliers\n */\n getOutlierFillOpacity() {\n return this._gstyle('outlierFillOpacity', ...arguments);\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n * @returns {SerieBox} The current serie instance\n */\n applyLineStyles() {\n this.applyLineStyle(this.pathDom);\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieBar\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n line.removeAttribute('stroke-dasharray');\n line.setAttribute('fill', this.getFillColor());\n line.setAttribute('fill-opacity', this.getFillOpacity() || 1);\n }\n\n draw() {\n\n if (!this.data) {\n return;\n }\n\n let position;\n let axis = this.options.orientation == 'y' ? this.getYAxis() : this.getXAxis();\n let axis2 = this.options.orientation == 'y' ? this.getXAxis() : this.getYAxis();\n let boxOtherDimension; // width or height of the box\n let mean, boxAbove, boxBelow, barAbove, barBelow, outliers;\n emptyDom(this.groupMain);\n\n if (axis2.getType() == 'category') {\n\n boxOtherDimension = axis2.getRelPx(0.8 / this.nbCategories);\n \n } else {\n // Get all the spacing and determine the smallest one\n boxOtherDimension = this.options.maxBoxWidth;\n // console.log( boxOtherDimension );\n for (var i = 0, l = this.data.length; i < l - 1; i++) {\n\n // console.log( Math.abs( axis.getPx( this.data[ i + 1 ].pos ) - axis.getPx( this.data[ i ].pos ) ), axis.getPx( this.data[ i + 1 ].pos ), axis.getPx( this.data[ i ].pos ) );\n boxOtherDimension = Math.min(boxOtherDimension, Math.abs(axis2.getPx(this.data[i + 1].pos) - axis2.getPx(this.data[i].pos)));\n }\n // console.log( boxOtherDimension );\n }\n\n for (var i = 0, l = this.data.length; i < l; i++) {\n\n if (axis2.getType() == 'category') {\n\n let cat = this.options.orientation == 'y' ? this.data[i].x : this.data[i].y;\n\n if (!this.categoryIndices.hasOwnProperty(cat)) {\n\n if (Array.isArray(this._linkedToScatterSeries)) {\n for (let scatter_serie of this._linkedToScatterSeries) {\n\n if (scatter_serie.categoryIndices.hasOwnProperty(cat)) {\n\n position = [axis2.getPos(scatter_serie.categoryIndices[cat]) + 1.2 * boxOtherDimension / 2];\n\n if (this.options.orientation == 'y') {\n axis = scatter_serie.getYAxis();\n } else {\n axis = scatter_serie.getXAxis();\n }\n\n break;\n }\n }\n }\n } else {\n\n position = [axis2.getPos(this.categoryIndices[cat]) + 1.2 * boxOtherDimension / 2];\n }\n } else {\n\n position = [axis2.getPos(this.options.orientation == 'y' ? this.data[i].x : this.data[i].y), boxOtherDimension];\n }\n\n mean = axis.getPos(this.data[i].Q2);\n boxAbove = axis.getPos(this.data[i].Q3);\n boxBelow = axis.getPos(this.data[i].Q1);\n\n this.data[i].whiskers.map(val => {\n\n if (val < this.data[i].Q1) {\n barBelow = axis.getPos(val);\n } else {\n barAbove = axis.getPos(val);\n }\n });\n\n outliers = this.data[i].outliers.map(val => axis.getPos(val));\n\n var lineMean = document.createElementNS(this.graph.ns, 'line');\n\n this.applyMeanStyle(lineMean);\n\n var rectAbove = document.createElementNS(this.graph.ns, 'rect');\n var rectBelow = document.createElementNS(this.graph.ns, 'rect');\n\n if (this.options.orientation == 'y') {\n\n rectAbove.setAttribute('width', boxOtherDimension);\n rectAbove.setAttribute('x', position[0] - boxOtherDimension / 2);\n\n rectBelow.setAttribute('width', boxOtherDimension);\n rectBelow.setAttribute('x', position[0] - boxOtherDimension / 2);\n\n lineMean.setAttribute('x1', position[0] - boxOtherDimension / 2);\n lineMean.setAttribute('x2', position[0] + boxOtherDimension / 2);\n lineMean.setAttribute('y1', mean);\n lineMean.setAttribute('y2', mean);\n } else {\n\n rectAbove.setAttribute('height', boxOtherDimension);\n rectAbove.setAttribute('y', position[0] - boxOtherDimension / 2);\n\n rectBelow.setAttribute('height', boxOtherDimension);\n rectBelow.setAttribute('y', position[0] - boxOtherDimension / 2);\n\n lineMean.setAttribute('y1', position[0] - boxOtherDimension / 2);\n lineMean.setAttribute('y2', position[0] + boxOtherDimension / 2);\n lineMean.setAttribute('x1', mean);\n lineMean.setAttribute('x2', mean);\n }\n\n this.boxPos(rectAbove, mean, boxAbove, this.options.orientation == 'x');\n this.boxPos(rectBelow, mean, boxBelow, this.options.orientation == 'x');\n\n this.applyBoxStyle(rectAbove, rectBelow);\n\n var whiskerAbove = document.createElementNS(this.graph.ns, 'line');\n var whiskerBelow = document.createElementNS(this.graph.ns, 'line');\n\n if (this.options.orientation == 'y') {\n\n if (barAbove !== undefined) {\n whiskerAbove.setAttribute('y1', boxAbove);\n whiskerAbove.setAttribute('y2', barAbove);\n whiskerAbove.setAttribute('x1', position[0]);\n whiskerAbove.setAttribute('x2', position[0]);\n }\n\n if (barBelow !== undefined) {\n whiskerBelow.setAttribute('y1', boxBelow);\n whiskerBelow.setAttribute('y2', barBelow);\n whiskerBelow.setAttribute('x1', position[0]);\n whiskerBelow.setAttribute('x2', position[0]);\n }\n } else {\n\n if (barAbove !== undefined) {\n whiskerAbove.setAttribute('x1', boxAbove);\n whiskerAbove.setAttribute('x2', barAbove);\n whiskerAbove.setAttribute('y1', position[0]);\n whiskerAbove.setAttribute('y2', position[0]);\n }\n\n if (barBelow !== undefined) {\n whiskerBelow.setAttribute('x1', boxBelow);\n whiskerBelow.setAttribute('x2', barBelow);\n whiskerBelow.setAttribute('y1', position[0]);\n whiskerBelow.setAttribute('y2', position[0]);\n }\n }\n\n outliers.map(outliervalue => {\n\n let outlier = document.createElementNS(this.graph.ns, 'circle');\n\n outlier.setAttribute('r', 2);\n\n if (this.options.orientation == 'y') {\n\n outlier.setAttribute('cx', position[0]);\n outlier.setAttribute('cy', outliervalue);\n } else {\n\n outlier.setAttribute('cy', position[0]);\n outlier.setAttribute('cx', outliervalue);\n }\n\n this.setOutlierStyle(outlier);\n\n this.groupMain.appendChild(outlier);\n });\n\n if (barAbove !== undefined) {\n this.groupMain.appendChild(whiskerAbove);\n }\n\n if (barBelow !== undefined) {\n this.groupMain.appendChild(whiskerBelow);\n }\n\n if (boxAbove !== undefined) {\n this.groupMain.appendChild(rectAbove);\n }\n\n if (boxBelow !== undefined) {\n this.groupMain.appendChild(rectBelow);\n }\n\n this.groupMain.appendChild(lineMean);\n\n this.applyWhiskerStyle(whiskerAbove, whiskerBelow);\n }\n }\n\n applyBoxStyle(above, below) {\n\n above.setAttribute('stroke', this.getBoxAboveLineColor());\n above.setAttribute('stroke-width', this.getBoxAboveLineWidth());\n\n if (this.getBoxAboveFillColor() !== undefined) {\n above.setAttribute('fill', this.getBoxAboveFillColor());\n }\n if (this.getBoxAboveFillOpacity() !== undefined) {\n above.setAttribute('fill-opacity', this.getBoxAboveFillOpacity());\n }\n\n below.setAttribute('stroke', this.getBoxBelowLineColor());\n below.setAttribute('stroke-width', this.getBoxBelowLineWidth());\n\n if (this.getBoxBelowFillColor() !== undefined) {\n below.setAttribute('fill', this.getBoxBelowFillColor());\n }\n if (this.getBoxAboveFillOpacity() !== undefined) {\n below.setAttribute('fill-opacity', this.getBoxBelowFillOpacity());\n }\n }\n\n applyWhiskerStyle(above, below) {\n\n above.setAttribute('stroke', this.getBarAboveLineColor());\n above.setAttribute('stroke-width', this.getBarAboveLineWidth());\n\n below.setAttribute('stroke', this.getBarBelowLineColor());\n below.setAttribute('stroke-width', this.getBarBelowLineWidth());\n }\n\n applyMeanStyle(line) {\n\n line.setAttribute('stroke', this.getMeanLineColor());\n line.setAttribute('stroke-width', this.getMeanLineWidth());\n }\n\n setOutlierStyle(outlier) {\n\n outlier.setAttribute('stroke', this.getOutlierLineColor());\n outlier.setAttribute('stroke-width', this.getOutlierLineWidth());\n\n if (this.getBoxBelowFillColor() !== undefined) {\n outlier.setAttribute('fill', this.getOutlierFillColor());\n }\n if (this.getBoxAboveFillOpacity() !== undefined) {\n outlier.setAttribute('fill-opacity', this.getOutlierFillOpacity());\n }\n }\n /**\n * Returns the index of a category based on its name\n * @param {String} name - The name of the category\n */\n getCategoryIndex(name) {\n\n if (!this.categories) {\n throw new Error('No categories were defined. Probably axis.setSeries was not called');\n }\n\n for (var i = 0; i < this.categories.length; i++) {\n\n if (this.categories[i].name == name) {\n return i;\n }\n }\n\n return false;\n }\n\n // Markers now allowed\n setMarkers() {}\n\n boxPos(box, mean, extremity, blnX) {\n\n if (mean > extremity) {\n\n box.setAttribute(blnX ? 'x' : 'y', extremity);\n box.setAttribute(blnX ? 'width' : 'height', mean - extremity);\n } else {\n\n box.setAttribute(blnX ? 'x' : 'y', mean);\n box.setAttribute(blnX ? 'width' : 'height', extremity - mean);\n }\n }\n\n getUsedCategories() {\n let xymode = this.options.orientation == 'y' ? 'x' : 'y';\n\n let categories = this.data.map(d => d[xymode]);\n\n if (Array.isArray(this._linkedToScatterSeries)) {\n this._linkedToScatterSeries.map(scatter_serie => {\n\n scatter_serie.getUsedCategories().map(scatter_serie_cat => {\n let index;\n if ((index = categories.indexOf(scatter_serie_cat)) > -1) {\n categories.splice(index, 1);\n }\n });\n });\n }\n\n return categories;\n }\n\n linkToScatterSerie(...series) {\n this._linkedToScatterSeries = series;\n }\n}\n\n/**\n * Colored serie line\n * @example graph.newSerie( name, options, \"color\" );\n * @see Graph#newSerie\n * @augments SerieLine\n */\nclass SerieLineColor extends SerieLine {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n this.lines = this.lines || {};\n }\n\n setColors(colors) {\n this.colors = colors;\n }\n\n _draw() {\n\n var self = this,\n data = this._dataToUse,\n toBreak,\n i = 0,\n j,\n k,\n m,\n x,\n y,\n k,\n o,\n lastX = false,\n lastY = false,\n xpx,\n ypx,\n xpx2,\n ypx2,\n xAxis = this.getXAxis(),\n yAxis = this.getYAxis(),\n xMin = xAxis.getCurrentMin(),\n yMin = yAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n yMax = yAxis.getCurrentMax();\n\n // Y crossing\n this.eraseLines();\n\n if (this.isFlipped()) {\n \n }\n\n this.currentLine = '';\n m = this.waveform.getLength();\n\n for (j = 0; j < m; j += 2) {\n\n x = this.waveform.getX(j);\n y = this.waveform.getY(j);\n\n if (x < xMin && lastX < xMin || x > xMax && lastX > xMax || (y < yMin && lastY < yMin || y > yMax && lastY > yMax) && !this.options.lineToZero) {\n lastX = x;\n lastY = y;\n continue;\n }\n\n this.counter2 = j;\n\n if (this.markersShown()) {\n this.getMarkerCurrentFamily(this.counter2);\n }\n\n xpx2 = this.getX(x);\n ypx2 = this.getY(y);\n\n if (xpx2 == xpx && ypx2 == ypx) {\n continue;\n }\n\n if (isNaN(xpx2) || isNaN(ypx2)) {\n if (this.counter > 0) {\n\n // this._createLine();\n }\n continue;\n }\n\n var color = this.colors[j];\n\n this._addPoint(xpx2, ypx2, x, y, xpx, ypx, lastX, lastY, j, color, false, true);\n\n xpx = xpx2;\n ypx = ypx2;\n\n lastX = x;\n lastY = y;\n }\n\n this.latchLines();\n\n if (this._tracker) {\n\n if (this._trackerDom) {\n this._trackerDom.remove();\n }\n\n var cloned = this.groupLines.cloneNode(true);\n this.groupMain.appendChild(cloned);\n\n for (var i = 0, l = cloned.children.length; i < l; i++) {\n\n cloned.children[i].setAttribute('stroke', 'transparent');\n cloned.children[i].setAttribute('stroke-width', '25px');\n cloned.children[i].setAttribute('pointer-events', 'stroke');\n }\n\n self._trackerDom = cloned;\n\n self.groupMain.addEventListener('mousemove', function (e) {\n var coords = self.graph._getXY(e),\n ret = self.handleMouseMove(false, false);\n self._trackingCallback(self, ret, coords.x, coords.y);\n });\n\n self.groupMain.addEventListener('mouseleave', function (e) {\n self._trackingOutCallback(self);\n });\n }\n return this;\n }\n\n _addPoint(xpx, ypx, x, y, xpxbefore, ypxbefore, xbefore, ybefore, j, color, move, allowMarker) {\n\n if (xpxbefore === undefined || ypxbefore === undefined) {\n return;\n }\n\n if (isNaN(xpx) || isNaN(ypx)) {\n return;\n }\n\n if (color._rgb) {\n color = 'rgba(' + color._rgb[0] + ',' + color._rgb[1] + ',' + color._rgb[2] + ',' + (color._rgb[3] || 1) + ')';\n }\n\n var line = this.lines[color];\n if (!line) {\n line = this.lines[color] = {\n object: document.createElementNS(this.graph.ns, 'path'),\n path: '',\n color: color\n };\n line.object.setAttribute('stroke', color);\n line.color = color;\n // this.applyLineStyle( line );\n this.groupLines.appendChild(line.object);\n }\n\n line.path += 'M ' + xpxbefore + ' ' + ypxbefore + ' L ' + xpx + ' ' + ypx;\n\n if (this.hasErrors()) {\n this.errorAddPoint(j, x, y, xpx, ypx);\n }\n\n /*if ( this.markersShown() && allowMarker !== false ) {\n drawMarkerXY( this, this.markerFamilies[ this.selectionType ][ this.markerCurrentFamily ], xpx, ypx );\n }*/\n }\n\n removeExtraLines() {}\n\n // Returns the DOM\n latchLines() {\n\n for (var i in this.lines) {\n this.lines[i].object.setAttribute('d', this.lines[i].path);\n }\n }\n\n // Returns the DOM\n eraseLines() {\n\n for (var i in this.lines) {\n this.lines[i].path = '';\n this.lines[i].object.setAttribute('d', '');\n }\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyle(line) {\n\n //line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute('stroke-width', this.getLineWidth());\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n } else {\n line.removeAttribute('stroke-dasharray');\n }\n line.setAttribute('fill', 'none');\n //\tline.setAttribute('shape-rendering', 'optimizeSpeed');\n }\n}\n\nvar type = 'scatter';\n\n/**\n * @static\n * @augments Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\nclass SerieScatter extends Serie {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n this.id = Math.random() + Date.now();\n this.shapes = []; // Stores all shapes\n this.shown = true;\n this.data = [];\n\n this.shapesDetails = [];\n this.shapes = [];\n\n this._type = type;\n\n mapEventEmission(this.options, this);\n\n this._isMinOrMax = {\n x: {\n min: false,\n max: false\n },\n y: {\n min: false,\n max: false\n }\n };\n\n this.groupPoints = document.createElementNS(this.graph.ns, 'g');\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.additionalData = {};\n\n this.selectedStyleGeneral = {};\n this.selectedStyleModifiers = {};\n\n this.groupPoints.addEventListener('mouseover', e => {\n var id = parseInt(e.target.parentElement.getAttribute('data-shapeid'));\n this.emit('mouseover', id, this.waveform.getX(id), this.waveform.getY(id));\n });\n\n this.groupPoints.addEventListener('mouseout', e => {\n var id = parseInt(e.target.parentElement.getAttribute('data-shapeid'));\n this.emit('mouseout', id, this.waveform.getX(id), this.waveform.getY(id));\n });\n\n this.minX = Number.MAX_VALUE;\n this.minY = Number.MAX_VALUE;\n this.maxX = Number.MIN_VALUE;\n this.maxY = Number.MIN_VALUE;\n\n this.groupMain.appendChild(this.groupPoints);\n this.currentAction = false;\n\n if (this.initExtended1) {\n this.initExtended1();\n }\n\n this.styles = {};\n this.styles.unselected = {};\n this.styles.selected = {};\n\n this.styles.unselected.default = {\n shape: 'circle',\n cx: 0,\n cy: 0,\n r: 3,\n stroke: 'transparent',\n fill: 'black'\n };\n\n this.styles.selected.default = {\n shape: 'circle',\n cx: 0,\n cy: 0,\n r: 4,\n stroke: 'transparent',\n fill: 'black'\n };\n }\n\n /**\n * Applies for x as the category axis\n * @example serie.setDataCategory( { x: \"someName\", y: Waveform } );\n */\n setDataCategory(data) {\n\n for (let dataCategory of data) {\n\n this._checkY(dataCategory.y.getMaxY());\n this._checkY(dataCategory.y.getMinY());\n }\n\n this.data = data;\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n return this;\n }\n\n /**\n * Removes all DOM points\n * @private\n */\n empty() {\n\n while (this.groupPoints.firstChild) {\n this.groupPoints.removeChild(this.groupPoints.firstChild);\n }\n }\n\n getSymbolForLegend() {\n\n if (this.symbol) {\n return this.symbol;\n }\n\n var g = document.createElementNS(this.graph.ns, 'g');\n g.setAttribute('data-shapeid', -1);\n var shape = this.doShape(g, this.styles.unselected.default);\n\n var style = this.getStyle('unselected', -1, true);\n\n for (var i in style[-1]) {\n if (i == 'shape') {\n continue;\n }\n shape.setAttribute(i, style[-1][i]);\n }\n\n return g;\n }\n\n /**\n * Sets style to the scatter points\n * First argument is the style applied by default to all points\n * Second argument is an array of modifiers that allows customization of any point of the scatter plot. Data for each elements of the array will augment allStyles, so be sure to reset the style if needed.\n * All parameters - except shape - will be set as parameters to the DOM element of the shape\n *\n * @example\n * var modifiers = [];\n * modifiers[ 20 ] = { shape: 'circle', r: 12, fill: 'rgba(0, 100, 255, 0.3)', stroke: 'rgb(0, 150, 255)' };\n * serie.setStyle( { shape: 'circle', r: 2, fill: 'rgba(255, 0, 0, 0.3)', stroke: 'rgb(255, 100, 0)' }, modifiers ); // Will modify scatter point n°20\n *\n * @param {Object} allStyles - The general style for all markers\n * @param {Object} [ modifiers ] - The general style for all markers\n * @param {String} [ selectionMode=\"unselected\" ] - The selection mode to which this style corresponds. Default is unselected\n *\n */\n setStyle(all, modifiers, mode = 'unselected') {\n\n if (typeof modifiers == 'string') {\n mode = modifiers;\n modifiers = false;\n }\n\n /*\n if( ! this.styles[ mode ] ) {\n }\n if ( mode !== \"selected\" && mode !== \"unselected\" ) {\n throw \"Style mode is not correct. Should be selected or unselected\";\n }\n */\n\n this.styles[mode] = this.styles[mode] || {};\n this.styles[mode].all = all;\n this.styles[mode].modifiers = modifiers;\n\n this.styleHasChanged(mode);\n\n return this;\n }\n\n /**\n * Redraws the serie\n * @private\n * @param {force} Boolean - Forces redraw even if the data hasn't changed\n */\n draw(force) {\n // Serie redrawing\n\n if (!force && !this.hasDataChanged() && !this.hasStyleChanged('unselected')) {\n return;\n }\n\n var x,\n y,\n xpx,\n ypx,\n j = 0;\n\n var isCategory = this.getXAxis().getType() == 'category';\n\n this._drawn = true;\n\n this.dataHasChanged(false);\n this.styleHasChanged(false);\n this.groupMain.removeChild(this.groupPoints);\n\n var keys = [];\n\n j = 0;\n if (this.hasErrors()) {\n this.errorDrawInit();\n }\n\n if (isCategory) {\n\n let k = 0;\n\n for (; j < this.data.length; j++) {\n\n if (!this.categoryIndices.hasOwnProperty(this.data[j].x)) {\n continue;\n }\n\n if (this.error) {\n // this.errorAddPoint( j, position[ 0 ] + position[ 1 ] / 2, 0, this.getX( position[ 0 ] + position[ 1 ] / 2 ), ypx );\n }\n\n for (var n = 0, l = this.data[j].y.getLength(); n < l; n++) {\n\n //let xpos = i / ( l - 1 ) * ( position[ 1 ] ) + position[ 0 ];\n\n ypx = this.getY(this.data[j].y.getY(n));\n xpx = this.getX(n / (l - 1) * (0.8 / this.nbCategories) + this.categoryIndices[this.data[j].x] + 0.1 / this.nbCategories);\n n++;\n\n this.shapesDetails[k] = this.shapesDetails[k] || [];\n this.shapesDetails[k][0] = xpx;\n this.shapesDetails[k][1] = ypx;\n keys.push(k);\n k++;\n }\n }\n } else {\n\n for (; j < this.waveform.getLength(); j++) {\n\n if (this.waveform.getX(j) < this.getXAxis().getCurrentMin() || this.waveform.getX(j) > this.getXAxis().getCurrentMax() || this.waveform.getY(j) < this.getYAxis().getCurrentMin() || this.waveform.getY(j) > this.getYAxis().getCurrentMax()) {\n\n if (this.shapes[j]) {\n this.shapes[j].setAttribute('display', 'none');\n }\n continue;\n }\n\n if (this.shapes[j]) {\n this.shapes[j].setAttribute('display', 'initial');\n }\n\n xpx = this.getX(this.waveform.getX(j));\n ypx = this.getY(this.waveform.getY(j));\n\n if (this.hasErrors()) {\n this.errorAddPoint(j, this.waveform.getX(j), this.waveform.getY(j), xpx, ypx);\n }\n\n this.shapesDetails[j] = this.shapesDetails[j] || [];\n this.shapesDetails[j][0] = xpx;\n this.shapesDetails[j][1] = ypx;\n keys.push(j);\n\n //this.shapes[ j / 2 ] = this.shapes[ j / 2 ] || undefined;\n }\n }\n\n if (this.hasErrors()) {\n this.errorDraw();\n }\n\n // This will automatically create the shapes\n this.applyStyle('unselected', keys);\n\n this.groupMain.appendChild(this.groupPoints);\n }\n\n _addPoint(xpx, ypx, k) {\n\n let shape;\n let g = document.createElementNS(this.graph.ns, 'g');\n g.setAttribute('transform', 'translate(' + xpx + ', ' + ypx + ')');\n g.setAttribute('data-shapeid', k);\n\n if (this.extraStyle && this.extraStyle[k]) {\n\n shape = this.doShape(g, this.extraStyle[k]);\n } else if (this.stdStylePerso) {\n\n shape = this.doShape(g, this.stdStylePerso);\n } else {\n\n shape = this.doShape(g, this.stdStyle);\n }\n\n this.shapes[k] = shape;\n this.groupPoints.appendChild(g);\n }\n\n doShape(group, shape) {\n var el = document.createElementNS(this.graph.ns, shape.shape);\n group.appendChild(el);\n return el;\n }\n\n getStyle(selection, index, noSetPosition) {\n\n var selection = selection || 'unselected';\n var indices;\n\n var styles = {};\n\n if (typeof index == 'number') {\n indices = [index];\n } else if (Array.isArray(index)) {\n indices = index;\n }\n\n var shape, index, modifier, style; // loop variables\n var styleAll;\n\n if (this.styles[selection].all !== undefined) {\n\n styleAll = this.styles[selection].all;\n\n if (typeof styleAll == 'function') {\n\n styleAll = styleAll();\n } else if (styleAll === false) {\n\n styleAll = {};\n }\n }\n\n var i = 0,\n l = indices.length;\n\n for (; i < l; i++) {\n\n index = indices[i];\n shape = this.shapes[index];\n\n if ((modifier = this.styles[selection].modifiers) && (typeof modifier == 'function' || modifier[index])) {\n\n if (typeof modifier == 'function') {\n\n style = modifier(index, shape);\n } else if (modifier[index]) {\n\n style = modifier[index];\n }\n\n styles[index] = Object.assign({}, styleAll, style);\n } else if (styleAll !== undefined) {\n\n styles[index] = styleAll;\n } else {\n\n styles[index] = this.styles[selection].default;\n }\n\n if (!styles[index]) {\n styles[index] = styleAll;\n }\n\n if (!shape) {\n // Shape doesn't exist, let's create it\n\n if (!styles[index].shape) {\n console.error(style);\n throw 'No shape was defined with this style.';\n }\n\n var g = document.createElementNS(this.graph.ns, 'g');\n g.setAttribute('data-shapeid', index);\n this.shapes[index] = this.doShape(g, styles[index]);\n this.groupPoints.appendChild(g);\n shape = this.shapes[index];\n }\n\n if (!noSetPosition) {\n shape.parentNode.setAttribute('transform', 'translate(' + this.shapesDetails[index][0] + ', ' + this.shapesDetails[index][1] + ')');\n }\n }\n\n return styles;\n }\n\n applyStyle(selection, index, noSetPosition) {\n\n var i, j;\n var styles = this.getStyle(selection, index, noSetPosition);\n\n for (i in styles) {\n\n for (j in styles[i]) {\n\n if (j !== 'shape') {\n\n if (styles[i][j]) {\n\n this.shapes[i].setAttribute(j, styles[i][j]);\n } else {\n\n this.shapes[i].removeAttribute(j);\n }\n }\n }\n }\n }\n\n unselectPoint(index) {\n this.selectPoint(index, false);\n }\n\n selectPoint(index, setOn, selectionType) {\n\n if (this.shapesDetails[index][2] && this.shapesDetails[index][2] == selectionType) {\n return;\n }\n\n if (typeof setOn == 'string') {\n selectionType = setOn;\n setOn = undefined;\n }\n\n if (Array.isArray(index)) {\n return this.selectPoints(index);\n }\n\n if (this.shapes[index] && this.shapesDetails[index]) {\n\n if ((this.shapesDetails[index][2] || setOn === false) && setOn !== true) {\n\n var selectionStyle = this.shapesDetails[index][2];\n this.shapesDetails[index][2] = false;\n\n var allStyles = this.getStyle(selectionStyle, index, true);\n for (var i in allStyles[index]) {\n this.shapes[index].removeAttribute(i);\n }\n\n this.applyStyle('unselected', index, true);\n } else {\n\n selectionType = selectionType || 'selected';\n this.shapesDetails[index][2] = selectionType;\n\n this.applyStyle(selectionType, index, true);\n }\n }\n }\n\n getUsedCategories() {\n\n if (typeof this.data[0] == 'object') {\n return this.data.map(d => d.x);\n }\n\n return [];\n }\n\n}\n\nmix(SerieScatter, ErrorBarMixin);\n\n/**\n * @static\n * @extends Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\nclass SerieZone extends Serie {\n\n static default() {\n return {\n fillColor: 'rgba( 0, 0, 0, 0.1 )',\n lineColor: 'rgba( 0, 0, 0, 1 )',\n lineWidth: '1px'\n };\n }\n constructor(graph, name, options) {\n super(...arguments);\n\n this.selectionType = 'unselected';\n this.id = guid();\n\n this.groupZones = document.createElementNS(this.graph.ns, 'g');\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n this.lineZone = document.createElementNS(this.graph.ns, 'path');\n this.lineZone.setAttribute('stroke', 'black');\n this.lineZone.setAttribute('stroke-width', '1px');\n\n this.groupMain.appendChild(this.groupZones);\n this.groupZones.appendChild(this.lineZone);\n\n this.applyLineStyle(this.lineZone);\n this.styleHasChanged();\n\n this.clip = document.createElementNS(this.graph.ns, 'clipPath');\n this.clipId = guid();\n this.clip.setAttribute('id', this.clipId);\n\n this.graph.defs.appendChild(this.clip);\n }\n\n /**\n * Assigns a collection of waveforms that make up the zone\n * The waveforms will appended one after the other, without break\n * @param {...Waveform} waveforms - The collection of waveforms\n * @return {SerieZone} - The current serie zone instance\n * @memberof SerieZone\n */\n setWaveform(...waveforms) {\n this.waveforms = waveforms;\n\n this.waveforms = this.waveforms.map(wave => {\n\n if (!(wave instanceof Waveform)) {\n return new Waveform(wave);\n } else {\n return wave;\n }\n });\n\n this.minX = this.waveforms[0].getXMin();\n this.maxX = this.waveforms[0].getXMax();\n this.minY = this.waveforms[0].getMin();\n this.maxY = this.waveforms[0].getMax();\n\n this.waveforms.map(wave => {\n\n this.minX = Math.min(wave.getXMin(), this.minX);\n this.maxX = Math.max(wave.getXMin(), this.maxX);\n this.minY = Math.min(wave.getMin(), this.minY);\n this.maxY = Math.max(wave.getMax(), this.maxY);\n });\n\n this.graph.updateDataMinMaxAxes();\n this.dataHasChanged();\n return this;\n }\n\n setWaveforms() {\n return this.setWaveform(...arguments);\n }\n\n getWaveforms() {\n return this.waveforms;\n }\n\n setMinMaxWaveforms(min, max) {\n this.waveforms = [min, max.reverse()];\n return this;\n }\n\n /**\n * Removes all the dom concerning this serie from the drawing zone\n */\n empty() {\n\n while (this.group.firstChild) {\n this.group.removeChild(this.group.firstChild);\n }\n }\n\n /**\n * Redraws the serie\n * @private\n *\n * @param {force} Boolean - Forces redraw even if the data hasn't changed\n */\n draw(force) {\n // Serie redrawing\n\n if (force || this.hasDataChanged()) {\n\n if (!this.waveforms) {\n return;\n }\n\n let dataX = 0,\n dataY = 0,\n xpx = 0,\n ypx = 0,\n j = 0,\n line = '',\n buffer,\n move = false;\n\n const xminpx = this.getXAxis().getMinPx(),\n xmaxpx = this.getXAxis().getMaxPx(),\n yminpx = this.getYAxis().getMinPx(),\n ymaxpx = this.getYAxis().getMaxPx();\n\n const xmin = this.getXAxis().getCurrentMin(),\n xmax = this.getXAxis().getCurrentMax(),\n ymin = this.getYAxis().getCurrentMin(),\n ymax = this.getYAxis().getCurrentMax();\n\n //this.clipRect.setAttribute( \"x\", Math.min( xmin, xmax ) );\n //this.clipRect.setAttribute( \"y\", Math.min( ymin, ymax ) );\n //this.clipRect.setAttribute( \"width\", Math.abs( xmax - xmin ) );\n //this.clipRect.setAttribute( \"height\", Math.abs( ymax - ymin ) );\n\n this.groupMain.removeChild(this.groupZones);\n\n for (let waveform of this.waveforms) {\n\n for (j = 0; j < waveform.getLength(); j += 1) {\n dataX = waveform.getX(j, true);\n dataY = waveform.getY(j, true);\n\n // The y axis in screen coordinate is inverted vs cartesians\n if (dataY[j] < ymin) {\n ypx = this.getY(ymin);\n } else if (dataY[j] > ymax) {\n ypx = this.getY(ymax);\n }\n\n if (dataX !== dataX) {\n continue;\n }\n\n if (dataY !== dataY) {\n // Let's make a new line\n\n if (line.length == 0) {\n continue;\n }\n\n line += 'L ' + xpx + ', ' + this.getY(waveform.getMinY());\n move = true;\n continue;\n }\n\n ypx = this.getY(dataY);\n xpx = this.getX(dataX);\n\n if (dataX < xmin || dataX > xmax) {\n buffer = [dataX, dataY[j], xpx, ypx];\n continue;\n }\n\n if (move) {\n line += ' M ' + xpx + ', ' + this.getY(waveform.getMinY()) + ' ';\n move = false;\n }\n\n if (line.length > 0) {\n line += ' L ';\n }\n\n if (buffer) {\n line += buffer[2] + ',' + buffer[3] + ' ';\n buffer = false;\n } else {\n line += xpx + ',' + ypx + ' ';\n }\n }\n }\n\n if (line !== '') {\n this.lineZone.setAttribute('d', 'M ' + line + ' z');\n } else {\n this.lineZone.setAttribute('d', '');\n }\n this.groupMain.appendChild(this.groupZones);\n }\n\n if (this.hasStyleChanged(this.selectionType)) {\n this.applyLineStyle(this.lineZone);\n this.styleHasChanged(false);\n }\n }\n\n /**\n * Applies the computed style to the DOM element fed as a parameter\n * @private\n *\n * @param {SVGLineElement} line - The line to which the style has to be applied to\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n line.setAttribute('fill', this.getFillColor());\n line.setAttribute('fill-opacity', this.getFillOpacity());\n line.setAttribute('stroke-opacity', this.getLineOpacity());\n }\n\n /**\n * Sets the line width\n *\n * @param {Number} width - The line width\n * @returns {SerieZone} - The current serie\n */\n setLineWidth(width) {\n this.options.lineWidth = width;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line width\n *\n * @returns {Number} - The line width\n */\n getLineWidth() {\n return this.options.lineWidth;\n }\n\n /**\n * Sets the line opacity\n *\n * @param {Number} opacity - The line opacity\n * @returns {SerieZone} - The current serie\n */\n setLineOpacity(opacity) {\n this.options.lineOpacity = opacity;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line opacity\n *\n * @returns {Number} - The line opacity\n */\n getLineOpacity() {\n return this.options.lineOpacity;\n }\n\n /**\n * Sets the line color\n *\n * @param {String} color - The line color\n * @returns {SerieZone} - The current serie\n */\n setLineColor(color) {\n this.options.lineColor = color;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line width\n *\n * @returns {Number} - The line width\n */\n getLineColor() {\n return this.options.lineColor;\n }\n\n /**\n * Sets the fill opacity\n *\n * @param {Number} opacity - The fill opacity\n * @returns {SerieZone} - The current serie\n */\n setFillOpacity(opacity) {\n this.options.fillOpacity = opacity;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the fill opacity\n *\n * @returns {Number} - The fill opacity\n */\n getFillOpacity() {\n return this.options.fillOpacity;\n }\n\n /**\n * Sets the fill color\n *\n * @param {Number} width - The line width\n * @returns {Number} - The line width\n */\n setFillColor(color) {\n this.options.fillColor = color;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the fill color\n *\n * @returns {Number} - The fill color\n */\n getFillColor() {\n return this.options.fillColor;\n }\n\n}\n\n/**\n * Serie line with 3D projection\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends SerieLine\n */\nclass SerieZone3D extends SerieZone {\n\n static default() {\n return {\n zpos: 0\n };\n }\n constructor(graph, name, options) {\n super(...arguments);\n }\n\n /**\n * Sets the z-position\n * @memberof SerieZone3D\n * @param {Number} zPos - The position in the z axis\n */\n setZPos(zPos) {\n this.options.zpos = zPos;\n return this;\n }\n\n setz() {\n return this.setZPos(...arguments);\n }\n}\n\nmix(SerieZone3D, Serie3DMixin);\n\n/**\n * Density map serie\n * @example graph.newSerie( name, options, \"densitymap\" );\n * @see Graph#newSerie\n * @augments Serie\n */\nclass SerieDensityMap extends Serie {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n mapEventEmission(this.options, this); // Register events\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.rects = [];\n this.paths = [];\n\n this.recalculateBinsOnDraw = false;\n }\n /**\n * Sets the data of the serie. Careful, only one format allowed for now.\n * @memberof SerieDensityMap\n * @param {Array} data - A vector containing 2-elements arrays\n * @return {SerieDensityMap} The current instance\n * @example serie.setData( [ [ x1, y1 ], [ x2, y2 ], ..., [ xn, yn ] ] );\n */\n setData(data) {\n\n this.minX = this.maxX = this.minY = this.maxY = 0;\n var i = 0,\n l = data.length;\n this.data = data;\n\n this.minX = Number.POSITIVE_INFINITY;\n this.minY = Number.POSITIVE_INFINITY;\n this.maxX = Number.NEGATIVE_INFINITY;\n this.maxY = Number.NEGATIVE_INFINITY;\n\n for (i = 0; i < l; i++) {\n this._checkX(data[i][0]);\n this._checkY(data[i][1]);\n }\n\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Calculates the bins from the (x,y) dataset\n * @memberof SerieDensityMap\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} numX - The number of x bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @param {Number} numY - The number of y bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n calculateDensity(fromX, deltaX, numX, fromY, deltaY, numY) {\n\n var densitymap = [],\n i,\n l = this.data.length,\n indexX,\n indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n for (i = 0; i < l; i++) {\n indexX = ~~((this.data[i][0] - fromX) / deltaX);\n indexY = ~~((this.data[i][1] - fromY) / deltaY);\n\n if (indexX > numX || indexY > numY || indexX < 0 || indexY < 0) {\n continue;\n }\n\n densitymap[indexX] = densitymap[indexX] || [];\n densitymap[indexX][indexY] = densitymap[indexX][indexY] + 1 || 1;\n\n binMin = densitymap[indexX][indexY] < binMin ? densitymap[indexX][indexY] : binMin;\n binMax = densitymap[indexX][indexY] > binMax ? densitymap[indexX][indexY] : binMax;\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = numX;\n this.maxIndexY = numY;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = numX;\n this.numY = numY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Sets the density map from a precalculated data set\n * @memberof SerieDensityMap\n * @param {Array} densitymap - A 2D-array containing the map\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n setDensityMap(densitymap, fromX, deltaX, numX, fromY, deltaY, numY) {\n\n var i,\n j,\n l = this.data.length;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n for (i = 0; i < densitymap.length; i++) {\n\n for (j = 0; j < densitymap[i].length; j++) {\n binMin = densitymap[i][j] < binMin ? densitymap[i][j] : binMin;\n binMax = densitymap[i][j] > binMax ? densitymap[i][j] : binMax;\n }\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = densitymap.length;\n this.maxIndexY = densitymap[0].length;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = this.maxIndexX;\n this.numY = this.maxIndexY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Calculates the bins from the (x,y) dataset using bin weighing\n * Will assign a set of (x,y) to the 4 neighbouring bins according to its exact position\n * @memberof SerieDensityMap\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} numX - The number of x bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @param {Number} numY - The number of y bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n calculateDensityWeighted(fromX, deltaX, numX, fromY, deltaY, numY) {\n\n var densitymap = [],\n i,\n l = this.data.length,\n indexX,\n indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n var compX, compY;\n var exactX, exactY;\n var indexXLow, indexXHigh, indexYLow, indexYHigh;\n\n for (i = 0; i < l; i++) {\n exactX = (this.data[i][0] - fromX) / deltaX - 0.5;\n exactY = (this.data[i][1] - fromY) / deltaY - 0.5;\n\n indexX = Math.floor(exactX);\n indexY = Math.floor(exactY);\n\n indexXLow = indexX; //Math.floor( exactX );\n indexYLow = indexY; //Math.floor( exactY );\n\n indexXHigh = indexX + 1; //Math.ceil( exactX );\n indexYHigh = indexY + 1; //Math.ceil( exactY );\n\n compX = 1 - (exactX - indexX);\n compY = 1 - (exactY - indexY);\n\n //console.log( exactY, indexY );\n //console.log( compY, indexYLow, indexYHigh );\n if (indexX > numX || indexY > numY || indexX < 0 || indexY < 0) {\n continue;\n }\n\n densitymap[indexXLow] = densitymap[indexXLow] || [];\n densitymap[indexXHigh] = densitymap[indexXHigh] || [];\n\n densitymap[indexXLow][indexYLow] = densitymap[indexXLow][indexYLow] || 0;\n densitymap[indexXHigh][indexYLow] = densitymap[indexXHigh][indexYLow] || 0;\n densitymap[indexXLow][indexYHigh] = densitymap[indexXLow][indexYHigh] || 0;\n densitymap[indexXHigh][indexYHigh] = densitymap[indexXHigh][indexYHigh] || 0;\n\n densitymap[indexXLow][indexYLow] += compX * compY;\n densitymap[indexXHigh][indexYLow] += (1 - compX) * compY;\n densitymap[indexXLow][indexYHigh] += compX * (1 - compY);\n densitymap[indexXHigh][indexYHigh] += (1 - compX) * (1 - compY);\n\n // A loop would be nicer, but would it be faster ?\n binMin = densitymap[indexXLow][indexYLow] < binMin ? densitymap[indexXLow][indexYLow] : binMin;\n binMax = densitymap[indexXLow][indexYLow] > binMax ? densitymap[indexXLow][indexYLow] : binMax;\n binMin = densitymap[indexXHigh][indexYLow] < binMin ? densitymap[indexXHigh][indexYLow] : binMin;\n binMax = densitymap[indexXHigh][indexYLow] > binMax ? densitymap[indexXHigh][indexYLow] : binMax;\n binMin = densitymap[indexXLow][indexYHigh] < binMin ? densitymap[indexXLow][indexYHigh] : binMin;\n binMax = densitymap[indexXLow][indexYHigh] > binMax ? densitymap[indexXLow][indexYHigh] : binMax;\n binMin = densitymap[indexXHigh][indexYHigh] < binMin ? densitymap[indexXHigh][indexYHigh] : binMin;\n binMax = densitymap[indexXHigh][indexYHigh] > binMax ? densitymap[indexXHigh][indexYHigh] : binMax;\n\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = numX;\n this.maxIndexY = numY;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = numX;\n this.numY = numY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Calculates the density map based on the minimum and maximum values found in the data array\n * @memberof SerieDensityMap\n * @param {Number} [ numX = 400 ] - The number of x bins\n * @param {Number} [ numY = numX ] - The number of y bins\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n autoBins(numX, numY) {\n\n this.numX = numX || 400;\n this.numY = numY || this.numX;\n\n this.calculateDensity(this.minX, (this.maxX - this.minX) / numX, numX, this.minY, (this.maxY - this.minY) / numY, numY);\n\n this.recalculateBinsOnDraw = false;\n\n return this;\n }\n\n /**\n * Only calculates the density map upon redraw based on the current state of the graph. In this mode, a fixed number of pixels per bin is used to calculate the number of bins and fed into\n * the calculation of the density map. In this method, the color map spans on the full scale of the density map values (i.e. a subrange cannot be defined, like you would do using {@link SerieDensityMap#setColorMapBinBoundaries}).\n * @memberof SerieDensityMap\n * @param {Number} pxPerBinX - The number of x bins per pixels. Should be an integer, but technically it doesn't have to\n * @param {Number} pxPerBinY - The number of y bins per pixels. Should be an integer, but technically it doesn't have to\n * @param {Boolean} weightedDensityMap - Whether jsGraph should use weighted density mapping or not\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n setPxPerBin(pxPerBinX, pxPerBinY, weightedDensityMap) {\n\n if (pxPerBinX) {\n this.calculationDensityMap({\n from: 'min',\n to: 'max',\n pxPerBin: pxPerBinX,\n weighted: weightedDensityMap\n });\n }\n\n if (pxPerBinY) {\n this.calculationDensityMap(false, {\n from: 'min',\n to: 'max',\n pxPerBin: pxPerBinY,\n weighted: weightedDensityMap\n });\n }\n\n return this;\n }\n\n /**\n * Sets bins in the ```x``` or ```y``` direction based on a from value, a to value and a number of bins.\n * @memberof SerieDensityMap\n * @param {String} mode - ```x``` or ```y```\n * @param {Number} from - The from value of the bin for the calculation with ```calculateDensityMap```\n * @param {Number} to - The to value\n * @param {Number} num - The number of bins\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n setBinsFromTo(mode, from, to, num) {\n\n this.densityMapCalculation = this.densityMapCalculation || {};\n\n this.densityMapCalculation[mode] = {\n from: from,\n to: to,\n numBins: num\n };\n this.calculationDensityMap();\n return this;\n }\n\n calculationDensityMap(x, y) {\n\n this.method = this.calculateDensityAdvanced;\n this.densityMapCalculation = this.densityMapCalculation || {};\n\n if (x) {\n this.densityMapCalculation.x = x;\n }\n\n if (y) {\n this.densityMapCalculation.y = y;\n }\n }\n\n calculateDensityAdvanced() {\n\n var results = {\n x: {\n from: 0,\n num: 0,\n delta: 0,\n weighing: false\n },\n\n y: {\n from: 0,\n num: 0,\n delta: 0,\n weighing: false\n }\n };\n\n var widthValues = {\n x: this.graph.drawingSpaceWidth,\n y: this.graph.drawingSpaceHeight\n };\n var axisGetter = {\n x: this.getXAxis,\n y: this.getYAxis\n };\n\n var weighing = false;\n\n for (var i in this.densityMapCalculation) {\n\n if (this.densityMapCalculation[i].weighted) {\n weighing = true;\n results[i].weighing = true;\n }\n\n if (this.densityMapCalculation[i].pxPerBin) {\n\n // In value\n\n var from = this.densityMapCalculation[i].from == 'min' ? axisGetter[i].call(this).getCurrentMin() : this.densityMapCalculation[i].from;\n var to = this.densityMapCalculation[i].to == 'max' ? axisGetter[i].call(this).getCurrentMax() : this.densityMapCalculation[i].to;\n\n // In px\n var dimension = Math.abs(axisGetter[i].call(this).getRelPx(to - from));\n results[i].num = Math.ceil(widthValues[i] / this.densityMapCalculation[i].pxPerBin);\n\n //console.log( from, from - axisGetter[ i ].call( this ).getRelVal( ( results[i ].num * this.densityMapCalculation[ i ].pxPerBin - dimension ) / 2 ), ( results[i ].num * this.densityMapCalculation[ i ].pxPerBin - dimension ) / 2 );\n results[i].from = from - Math.abs(axisGetter[i].call(this).getRelVal((results[i].num * this.densityMapCalculation[i].pxPerBin - dimension) / 2));\n results[i].delta = Math.abs(axisGetter[i].call(this).getRelVal(this.densityMapCalculation[i].pxPerBin));\n } else {\n\n results[i].num = this.densityMapCalculation[i].numBins || 400;\n results[i].from = this.densityMapCalculation[i].from == 'min' ? axisGetter[i].call(this).getCurrentMin() : this.densityMapCalculation[i].from;\n results[i].delta = this.densityMapCalculation[i].to ? ((this.densityMapCalculation[i].to == 'max' ? axisGetter[i].call(this).getCurrentMax() : this.densityMapCalculation[i].to) - results[i].from) / results[i].num : this.densityMapCalculate[i].delta;\n }\n\n // console.log( axisGetter[ i ].call( this ).getCurrentMin(), axisGetter[ i ].call( this ).getCurrentMax(), )\n }\n //console.log( this.getYAxis().getCurrentMin(), this.getYAxis().getCurrentMax(), this.graph.drawingSpaceHeight );\n\n //console.log( this.densityMapCalculation );\n\n (weighing ? this.calculateDensityWeighted : this.calculateDensity).call(this, results.x.from, results.x.delta, results.x.num, results.y.from, results.y.delta, results.y.num);\n }\n\n /**\n * Selects a subrange of bins for the color mapping. There is no need to recalculate the color map after calling this method\n * @memberof SerieDensityMap\n * @param {Number} binMin - The minimum bin value\n * @param {Number} binMax - The maximum bin value\n * @return {SerieDensityMap} The current instance\n * @example // In this case, all bins with values below binMin * 2 (the middle scale) will be rendered with the first color of the color map\n * serie.setColorMapBinBoundaries( serie.binMin * 2, serie.binMax );\n */\n setColorMapBinBoundaries(min, max) {\n this.colorMapMin = min;\n this.colorMapMax = max;\n return this;\n }\n\n /**\n * Calls {@link SerieDensityMap#setColorMapBinBoundaries} using the minimum and maximum bin values calculated by {@link SerieDensityMap#calculateDensity}. This function must be called, since colorMinMap and colorMaxMap are not set automatically when the density map is calculated.\n * @memberof SerieDensityMap\n * @param {Number} binMin - The minimum bin value\n * @param {Number} binMax - The maximum bin value\n * @return {SerieDensityMap} The current instance\n */\n autoColorMapBinBoundaries() {\n this.colorMapMin = this.binMin;\n this.colorMapMax = this.binMax;\n return this;\n }\n\n /**\n * Allows the use of a callback to determine the color map min and max value just before the density map is redrawn. This is very useful when the density map is recalculate before redraw, such as in the case where bins per pixels are used\n * @memberof SerieDensityMap\n * @param {(String|Function)} callback - The callback function to call. Should return an array with two elements ```[ colorMapMin, colorMapMax ]```. This parameter can also take the value ```auto```, in which case ```autoColorMapBinBoundaries``` will be called before redraw\n * @return {SerieDensityMap} The current instance\n */\n onRedrawColorMapBinBoundaries(callback) {\n this.callbackColorMapMinMax = callback;\n return this;\n }\n\n /**\n * Generates a color map based on a serie of HSL(A) values.\n * @summary Colors can scale linearly, logarithmically (enhances short range differences) or exponentially (enhances long range differences).\n * One word of advice though. SVG being not canvas, jsGraph has to create a path for each color value of the color map. In other words, if you're asking for 16-bit coloring (65536 values), 65536 SVG paths will be created and your browser will start to suffer from it.\n * As of now, all the colors in colorStops will be places at equal distances from each other between colorMapMin and colorMapMax set by {@link autoColorMapBinBoundaries} or {@link setColorMapBinBoundaries}\n * @memberof SerieDensityMap\n * @param {Array} colorStops - An array of objects, each having the following format: { h: [ 0-360], s: 0-1, l: 0-1, a: 0-1}\n * @param {Number} numColors - The number of colors to compute.\n * @param {String} [ method = \"linear\" ] - The method to use to calculate the density map: linear, exp, or log\n * @return {SerieDensityMap} The current instance\n */\n colorMapHSL(colorStops, numColors, method) {\n\n method = method || 'linear';\n\n var methods = {\n 'exp': function (value) {\n return (Math.exp(value / numColors * 1) - Math.exp(0)) / (Math.exp(1) - Math.exp(0));\n },\n 'log': function (value) {\n return (Math.log(value + 1) - Math.log(1)) / (Math.log(numColors + 1) - Math.log(1));\n },\n 'linear': function (value) {\n return (value - 0) / (numColors - 0);\n }\n };\n\n var k = 0,\n colorMap = [],\n opacities = [];\n\n var color = {\n h: null,\n s: null,\n l: null,\n a: null\n };\n\n var ratio, first;\n\n var slices = colorStops.length - 1;\n\n for (var i = 0; i <= numColors; i++) {\n\n ratio = methods[method](i);\n\n first = Math.floor(ratio * slices);\n\n if (first == colorStops.length - 1) {\n // Handle 1\n first = slices - 1;\n }\n\n ratio = (ratio - first / slices) / (1 / slices);\n\n for (var j in color) {\n color[j] = (colorStops[first + 1][j] - colorStops[first][j]) * ratio + colorStops[first][j];\n }\n\n colorMap[k] = 'hsl(' + color.h + ', ' + Math.round(color.s * 100) + '%, ' + Math.round(color.l * 100) + '%)'; //this.HSVtoRGB( color.h, color.s, color.v );\n opacities[k] = color.a;\n k++;\n }\n\n this.opacities = opacities;\n this.colorMap = colorMap;\n this.colorMapNum = numColors;\n return this;\n }\n\n /**\n * Calls {@link SerieDensityMap#colorMapHSV} using 100 colors.\n * @memberof SerieDensityMap\n * @param {Array} colorStops - An array of objects, each having the following format: { h: [ 0-360], s: 0-1, l: 0-1, a: 0-1}\n * @param {String} [ method = \"linear\" ] - The method to use to calculate the density map: linear, exp or log\n * @return {SerieDensityMap} The current instance\n */\n autoColorMapHSL(colorStops, method = 'linear') {\n this.colorMapHSV(colorStops, 100, method);\n return this;\n }\n\n /* byteToHex( b ) {\n return hexChar[ ( b >> 4 ) & 0x0f ] + hexChar[ b & 0x0f ];\n }\n */\n /*\n HSVtoRGB( h, s, v ) {\n var r, g, b, i, f, p, q, t;\n if ( arguments.length === 1 ) {\n s = h.s, v = h.v, h = h.h;\n }\n i = Math.floor( h * 6 );\n f = h * 6 - i;\n p = v * ( 1 - s );\n q = v * ( 1 - f * s );\n t = v * ( 1 - ( 1 - f ) * s );\n switch ( i % 6 ) {\n case 0:\n r = v, g = t, b = p;\n break;\n case 1:\n r = q, g = v, b = p;\n break;\n case 2:\n r = p, g = v, b = t;\n break;\n case 3:\n r = p, g = q, b = v;\n break;\n case 4:\n r = t, g = p, b = v;\n break;\n case 5:\n r = v, g = p, b = q;\n break;\n }\n return \"#\" + this.byteToHex( Math.floor( r * 255 ) ) + this.byteToHex( Math.floor( g * 255 ) ) + this.byteToHex( Math.floor( b * 255 ) );\n }\n */\n\n /**\n * Returns the color index (```[ 0 - 1 ]```) for a certain value, based on colorMapMin and colorMapMax.\n * @memberof SerieDensityMap\n * @param {Number} binValue - The value of the bin\n * @return {Number} The color index\n */\n getColorIndex(binValue) {\n\n return Math.max(0, Math.min(this.colorMapNum, Math.floor((binValue - this.colorMapMin) / (this.colorMapMax - this.colorMapMin) * this.colorMapNum)));\n }\n\n /**\n * Draws the serie\n * @memberof SerieDensityMap\n * @private\n */\n draw() {\n\n var colorIndex;\n\n if (this.method) {\n this.method();\n }\n\n if (!this.callbackColorMapMinMax || this.colorMapMin == undefined || this.colorMapMax == undefined || this.callbackColorMapMinMax == 'auto') {\n\n this.autoColorMapBinBoundaries();\n } else {\n var val = this.callbackColorMapMinMax(this.binMin, this.binMax);\n\n this.setColorMapBinBoundaries(val[0], val[1]);\n }\n\n var deltaXPx = this.getXAxis().getRelPx(this.deltaX),\n deltaYPx = this.getYAxis().getRelPx(this.deltaY);\n\n for (var i = 0; i < this.paths.length; i++) {\n this.paths[i] = '';\n }\n\n for (var i = 0; i < this.maxIndexX; i++) {\n\n for (var j = 0; j < this.maxIndexY; j++) {\n\n if (this.densitymap[i] == undefined || this.densitymap[i][j] == undefined) {\n continue;\n }\n\n colorIndex = this.getColorIndex(this.densitymap[i][j]);\n if (!this.paths[colorIndex]) {\n this.paths[colorIndex] = '';\n }\n\n this.paths[colorIndex] += ' M ' + this.getXAxis().getPx(i * this.deltaX + this.fromX) + ' ' + this.getYAxis().getPx(j * this.deltaY + this.fromY) + ' h ' + deltaXPx + ' v ' + deltaYPx + ' h -' + deltaXPx + ' z';\n }\n }\n /*\n this.maxIndexX = indexX;\n this.maxIndexY = indexY;*/\n\n this.drawRects();\n }\n\n /**\n * Draws the rectangles\n * @memberof SerieDensityMap\n * @private\n */\n drawRects() {\n\n for (var i = 0; i < this.paths.length; i++) {\n\n if (!this.rects[i]) {\n this.rects[i] = document.createElementNS(this.graph.ns, 'path');\n this.rects[i].setAttribute('shape-rendering', 'crispEdges');\n }\n\n if (this.paths[i] !== undefined) {\n this.rects[i].setAttribute('d', this.paths[i]);\n this.rects[i].setAttribute('fill', this.colorMap[i]);\n this.rects[i].setAttribute('fill-opacity', this.opacities[i]);\n }\n this.groupMain.appendChild(this.rects[i]);\n }\n }\n\n /**\n * Sets the options of the serie\n * @see SerieDensityMapDefaultOptions\n * @param {Object} options - A object containing the options to set\n * @return {SerieDensityMap} The current serie\n * @memberof SerieDensityMap\n */\n setOptions(options) {\n this.options = extend(true, {}, this.defaults(), options || {});\n // Unselected style\n\n return this;\n }\n}\n\n/**\n * Constructor for the contour serie. Do not use this constructor directly, but use the {@link Graph#newSerie} method\n * @private\n * @extends Serie\n * @example graph.newSerie( name, options, \"contour\" );\n * @see Graph#newSerie\n */\nclass SerieContour extends SerieLine {\n\n constructor(graph, name, options) {\n super(...arguments);\n\n this.negativeDelta = 0;\n this.positiveDelta = 0;\n\n this.negativeThreshold = 0;\n this.positiveThreshold = 0;\n\n this.groupMain.setAttribute('clip-path', 'url(#_clipplot' + graph._creation + ')');\n }\n\n /**\n * Sets the contour lines\n * @memberof SerieContour.prototype\n * @param {Object} data - The object data\n * @param {Number} data.minX - The minimum x value\n * @param {Number} data.maxX - The maximum x value\n * @param {Number} data.minY - The minimum y value\n * @param {Number} data.maxY - The maximum y value\n * @param {Object[]} data.segments - The segments making up the contour lines\n * @param {Number[]} data.segments.lines - An array of alternating (x1,y1,x2,y2) quadruplet\n * @param {Number} data.segments.zValue - The corresponding z-value of this array\n * @return {Serie} The current serie\n */\n setData(data, arg, type) {\n\n var x,\n dx,\n arg = arg || '2D',\n type = type || 'float',\n i,\n l = data.length,\n j,\n k,\n arr,\n datas = [];\n\n if (!(data instanceof Array)) {\n\n if (typeof data == 'object') {\n // Def v2\n this.minX = data.minX;\n this.minY = data.minY;\n this.maxX = data.maxX;\n this.maxY = data.maxY;\n\n data = data.segments;\n l = data.length;\n }\n }\n\n for (i = 0; i < l; i++) {\n k = data[i].lines.length;\n arr = this._addData(type, k);\n\n for (j = 0; j < k; j += 2) {\n\n arr[j] = data[i].lines[j];\n this._checkX(arr[j]);\n arr[j + 1] = data[i].lines[j + 1];\n this._checkY(arr[j + 1]);\n }\n\n datas.push({\n lines: arr,\n zValue: data[i].zValue\n });\n }\n this.data = datas;\n this.graph.updateDataMinMaxAxes();\n\n this.dataHasChanged(true);\n\n return this;\n }\n\n /**\n * Draws the serie if the data has changed\n * @memberof SerieContour.prototype\n * @param {Boolean} force - Forces redraw even if the data hasn't changed\n * @return {Serie} The current serie\n */\n draw(force) {\n\n if (force || this.hasDataChanged()) {\n\n this.currentLine = 0;\n var x,\n y,\n xpx,\n ypx,\n xpx2,\n ypx2,\n i = 0,\n l = this.data.length,\n j = 0,\n k,\n m,\n currentLine,\n domLine,\n arr;\n this.minZ = Infinity;\n this.maxZ = -Infinity;\n\n var next = this.groupLines.nextSibling;\n this.groupMain.removeChild(this.groupLines);\n this.zValues = {};\n\n var incrXFlip = 0;\n var incrYFlip = 1;\n if (this.getFlip()) {\n incrXFlip = 0;\n incrYFlip = 1;\n }\n\n var minY = this.getYAxis().getCurrentMin();\n var minX = this.getXAxis().getCurrentMin();\n\n var maxX = this.getXAxis().getCurrentMax();\n var maxY = this.getYAxis().getCurrentMax();\n\n this.counter = 0;\n this.currentLineId = 0;\n\n for (; i < l; i++) {\n this.currentLine = '';\n j = 0;\n for (arr = this.data[i].lines, m = arr.length; j < m; j += 4) {\n\n if (arr[j + incrXFlip] < minX && arr[j + 2 + incrXFlip] < minX || arr[j + incrYFlip] < minY && arr[j + 2 + incrYFlip] < minY || arr[j + incrYFlip] > maxY && arr[j + 2 + incrYFlip] > maxY || arr[j + incrXFlip] > maxX && arr[j + 2 + incrXFlip] > maxX) {\n continue;\n }\n\n xpx2 = this.getX(arr[j + incrXFlip]);\n ypx2 = this.getY(arr[j + incrYFlip]);\n\n xpx = this.getX(arr[j + 2 + incrXFlip]);\n ypx = this.getY(arr[j + 2 + incrYFlip]);\n\n if (xpx == xpx2 && ypx == ypx2) {\n continue;\n }\n\n /*\tif( j > 0 && ( lastxpx !== undefined && lastypx !== undefined && Math.abs( xpx2 - lastxpx ) <= 30 && Math.abs( ypx2 - lastypx ) <= 30 ) ) {\n currentLine += \"L\";\n } else {\n currentLine += \"M\";\n }\n */\n\n this.currentLine += 'M ';\n this.currentLine += xpx2;\n this.currentLine += ' ';\n this.currentLine += ypx2;\n\n this.currentLine += 'L ';\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += ypx;\n\n this.counter++;\n\n \n }\n\n this.currentLine += ' z';\n\n domLine = this._createLine();\n domLine.setAttribute('data-zvalue', this.data[i].zValue);\n\n this.zValues[this.data[i].zValue] = {\n dom: domLine\n };\n\n this.minZ = Math.min(this.minZ, this.data[i].zValue);\n this.maxZ = Math.max(this.maxZ, this.data[i].zValue);\n }\n\n i++;\n\n for (i = this.currentLine + 1; i < this.lines.length; i++) {\n this.groupLines.removeChild(this.lines[i]);\n this.lines.splice(i, 1);\n }\n\n i = 0;\n\n for (; i < l; i++) {\n this.setColorTo(this.lines[i], this.data[i].zValue, this.minZ, this.maxZ);\n }\n\n this.onMouseWheel(0, {\n shiftKey: false\n });\n this.groupMain.insertBefore(this.groupLines, next);\n } else if (this.hasStyleChanged(this.selectionType)) {\n\n for (; i < l; i++) {\n this.setColorTo(this.lines[i], this.data[i].zValue, this.minZ, this.maxZ);\n }\n }\n }\n\n onMouseWheel(delta, e, fixed, positive) {\n\n delta /= 250;\n\n if (fixed !== undefined) {\n\n if (!positive) {\n this.negativeThreshold = -fixed * this.minZ;\n this.negativeDelta = -Math.pow(Math.abs(this.negativeThreshold / -this.minZ), 1 / 3);\n }\n\n if (positive) {\n this.positiveThreshold = fixed * this.maxZ;\n this.positiveDelta = Math.pow(this.positiveThreshold / this.maxZ, 1 / 3);\n }\n } else {\n\n if (!e.shiftKey || !this.options.hasNegative) {\n\n this.positiveDelta = Math.min(1, Math.max(0, this.positiveDelta + Math.min(0.1, Math.max(-0.1, delta))));\n this.positiveThreshold = this.maxZ * Math.pow(this.positiveDelta, 3);\n } else {\n\n this.negativeDelta = Math.min(0, Math.max(-1, this.negativeDelta + Math.min(0.1, Math.max(-0.1, delta))));\n this.negativeThreshold = -this.minZ * Math.pow(this.negativeDelta, 3);\n }\n }\n\n if (isNaN(this.positiveDelta)) {\n this.positiveDelta = 0;\n }\n\n if (isNaN(this.negativeDelta)) {\n this.negativeDelta = 0;\n }\n\n for (var i in this.zValues) {\n\n this.zValues[i].dom.setAttribute('display', i >= 0 && i >= this.positiveThreshold || i <= 0 && i <= this.negativeThreshold ? 'block' : 'none');\n }\n\n if (this._shapeZoom) {\n\n if (!this.options.hasNegative) {\n this._shapeZoom.hideHandleNeg();\n } else {\n\n this._shapeZoom.setHandleNeg(-Math.pow(this.negativeDelta, 3), this.minZ);\n this._shapeZoom.showHandleNeg();\n }\n\n this._shapeZoom.setHandlePos(Math.pow(this.positiveDelta, 3), this.maxZ);\n }\n }\n\n /**\n * Sets rainbow colors based on hsl format\n * @memberof SerieContour.prototype\n * @param {Object} colors\n * @param {Object} colors.fromPositive\n * @param {Number} colors.fromPositive.h\n * @param {Number} colors.fromPositive.s\n * @param {Number} colors.fromPositive.l\n * @param {Object} colors.toPositive\n * @param {Number} colors.toPositive.h\n * @param {Number} colors.toPositive.s\n * @param {Number} colors.toPositive.l\n * @param {Object} colors.fromNegative\n * @param {Number} colors.fromNegative.h\n * @param {Number} colors.fromNegative.s\n * @param {Number} colors.fromNegative.l\n * @param {Object} colors.toNegative\n * @param {Number} colors.toNegative.h\n * @param {Number} colors.toNegative.s\n * @param {Number} colors.toNegative.l\n * @return {Serie} The current serie\n */\n setDynamicColor(colors) {\n this.lineColors = colors;\n\n this.styleHasChanged();\n }\n\n setNegative(bln) {\n this.options.hasNegative = bln;\n\n if (bln) {\n this.negativeThreshold = 0;\n }\n }\n\n setColorTo(line, zValue, min, max) {\n\n if (!this.lineColors) {\n return;\n }\n\n var hsl = {\n h: 0,\n s: 0,\n l: 0\n };\n\n for (var i in hsl) {\n\n if (zValue > 0) {\n hsl[i] = this.lineColors.fromPositive[i] + (this.lineColors.toPositive[i] - this.lineColors.fromPositive[i]) * (zValue / max);\n } else {\n hsl[i] = this.lineColors.fromNegative[i] + (this.lineColors.toNegative[i] - this.lineColors.fromNegative[i]) * (zValue / min);\n }\n }\n\n hsl.h /= 360;\n\n var rgb = hslToRgb(hsl.h, hsl.s, hsl.l);\n\n line.setAttribute('stroke', 'rgb(' + rgb.join() + ')');\n }\n\n getSymbolForLegend() {\n\n if (!this.lineForLegend) {\n\n var line = document.createElementNS(this.graph.ns, 'ellipse');\n\n line.setAttribute('cx', 7);\n line.setAttribute('cy', 0);\n line.setAttribute('rx', 8);\n line.setAttribute('ry', 3);\n\n line.setAttribute('cursor', 'pointer');\n this.lineForLegend = line;\n }\n\n this.applyLineStyle(this.lineForLegend, this.maxZ);\n\n return this.lineForLegend;\n }\n\n applyLineStyle(line, overwriteValue) {\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth() + (this.isSelected() ? 2 : 0));\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n }\n line.setAttribute('fill', 'none');\n\n this.setColorTo(line, overwriteValue !== undefined ? overwriteValue : line.getAttribute('data-zvalue'), this.minZ, this.maxZ);\n // line.setAttribute('shape-rendering', 'optimizeSpeed');\n\n this.hasStyleChanged(false);\n }\n\n setShapeZoom(shape) {\n this._shapeZoom = shape;\n }\n\n}\n\n/**\n * Shape class that should be extended\n * @class Shape\n * @static\n */\nclass Shape extends EventEmitter {\n\n constructor() {\n super();\n }\n\n /**\n * Initializes the shape\n * @param {Graph} graph - The graph containing the shape\n * @param {Object} properties - The properties object (not copied)\n * @return {Shape} The current shape\n */\n init(graph, properties) {\n\n var self = this;\n\n this.graph = graph;\n this.properties = properties || {};\n this.handles = [];\n this.options = this.options || {};\n\n this.group = document.createElementNS(this.graph.ns, 'g');\n\n this.group.setAttribute('clip-path', 'url(#_clipplot' + graph._creation + ')');\n\n this._selected = false;\n this.createDom();\n\n if (this._dom) {\n this._dom.jsGraphIsShape = this;\n }\n\n this.group.jsGraphIsShape = this;\n\n this.classes = [];\n this.transforms = [];\n\n if (this._data.masker) {\n\n var maskPath = document.createElementNS(this.graph.ns, 'mask');\n this.maskingId = Math.random();\n maskPath.setAttribute('id', this.maskingId);\n\n this.maskDomWrapper = document.createElementNS(this.graph.ns, 'rect');\n this.maskDomWrapper.setAttribute('fill', 'white');\n maskPath.appendChild(this.maskDomWrapper);\n\n var maskDom = this._dom.cloneNode();\n maskPath.appendChild(maskDom);\n\n this.maskDom = maskDom;\n\n this.graph.defs.appendChild(maskPath);\n }\n\n if (this.group) {\n\n if (this._dom && !this.isHTML()) {\n this.group.appendChild(this._dom);\n }\n\n this.group.addEventListener('mouseover', function (e) {\n\n self.handleMouseOver(e);\n });\n\n this.group.addEventListener('mouseout', function (e) {\n\n self.handleMouseOut(e);\n });\n\n this.group.addEventListener('mousedown', function (e) {\n\n self.graph.focus();\n\n self.handleMouseDown(e);\n });\n\n this.group.addEventListener('click', this.handleClick.bind(this));\n\n this.group.addEventListener('dblclick', function (e) {\n\n //e.preventDefault();\n // e.stopPropagation();\n\n self.handleDblClick(e);\n });\n }\n\n //\t\t\tthis.group.appendChild(this.rectEvent);\n\n this.initImpl();\n\n this.graph.emit('shapeNew', this);\n\n return this;\n }\n\n /**\n * Implentation of the init method. To be extended if necessary on extended Shape classes\n */\n initImpl() {}\n\n /**\n * @return {Object} The shape's underlying data object\n */\n getData() {\n return this._data;\n }\n\n /**\n * @returns {String} The type of the shape\n */\n getType() {\n return this.type;\n }\n\n /**\n * Removes the shape from the DOM and unlinks it from the graph\n */\n kill(keepDom) {\n\n if (this._inDom && !keepDom) {\n this.graph.removeShapeFromDom(this);\n }\n\n if (!keepDom) {\n this.graph._removeShape(this);\n }\n\n this.graph.stopElementMoving(this);\n this.graph.emit('shapeRemoved', this);\n this.emit('removed', this);\n\n this._inDom = false;\n }\n\n /**\n * Hides the shape\n * @return {Shape} The current shape\n */\n hide() {\n\n if (this.hidden) {\n return this;\n }\n\n this.hidden = true;\n if (!this.isHTML()) {\n this.group.style.display = 'none';\n } else {\n this._dom.style.display = 'none';\n }\n return this;\n }\n\n /**\n * Returns whether the shape is hidden or not\n * @return {Boolean} true if the shape is hidden, false otherwise\n */\n isHidden() {\n return this.hidden;\n }\n\n /**\n * Returns whether the shape is visible or not\n * @return {Boolean} true if the shape is visible, false if it is hidden\n */\n isVisible() {\n return !this.hidden;\n }\n\n /**\n * Shows the shape\n * @return {Shape} The current shape\n */\n show() {\n\n if (!this.hidden) {\n return this;\n }\n\n this.hidden = false;\n if (!this.isHTML()) {\n this.group.style.display = 'initial';\n } else {\n this._dom.style.display = 'initial';\n }\n\n this.redraw();\n return this;\n }\n\n /**\n * Adds a class to the shape DOM\n * @param {String} className - The class to add\n * @return {Shape} The current shape\n */\n addClass(className) {\n this.classes = this.classes || [];\n if (this.classes.indexOf(className) == -1) {\n this.classes.push(className);\n }\n this.makeClasses();\n return this;\n }\n\n /**\n * Removes a class from the shape DOM\n * @param {String} className - The class to remove\n * @return {Shape} The current shape\n */\n removeClass(className) {\n this.classes.splice(this.classes.indexOf(className), 1);\n this.makeClasses();\n return this;\n }\n\n /**\n * Builds the classes\n * @private\n * @return {Shape} The current shape\n */\n makeClasses() {\n\n if (this._dom) {\n this._dom.setAttribute('class', this.classes.join(' '));\n }\n\n return this;\n }\n\n /**\n * Triggers a ```shapeChanged``` event on the graph and a ```changed``` event on the shape\n * @return {Shape} The current shape\n */\n changed(event, parameters) {\n\n if (event) {\n this.graph.emit(event, this, parameters);\n this.emit(event, this, parameters);\n }\n\n this.emit('changed', this, parameters);\n this.graph.emit('shapeChanged', this, parameters);\n return this;\n }\n\n /**\n * Creates an event receptacle with the coordinates of the shape bounding box\n * @return {Shape} The current shape\n */\n setEventReceptacle() {\n\n if (!this.rectEvent) {\n this.rectEvent = document.createElementNS(this.graph.ns, 'rect');\n this.rectEvent.setAttribute('pointer-events', 'fill');\n this.rectEvent.setAttribute('fill', 'transparent');\n this.group.appendChild(this.rectEvent);\n this.rectEvent.jsGraphIsShape = this;\n }\n\n var box = this.group.getBBox();\n this.rectEvent.setAttribute('x', box.x);\n this.rectEvent.setAttribute('y', box.y - 10);\n this.rectEvent.setAttribute('width', box.width);\n this.rectEvent.setAttribute('height', box.height + 20);\n }\n\n /**\n * Assigns a serie to the shape\n * @param {Serie} The serie that owns the shape\n * @return {Shape} The current shape\n */\n setSerie(serie) {\n\n if (!serie) {\n return;\n }\n\n this.serie = serie;\n\n if (!serie.getXAxis || !serie.getYAxis) {\n console.error(serie);\n throw 'Serie does not implement the getXAxis or getYAxis method';\n }\n this.xAxis = serie.getXAxis();\n this.yAxis = serie.getYAxis();\n return this;\n }\n\n /**\n * @return {Serie} The serie associated to the shape\n */\n getSerie() {\n return this.serie;\n }\n\n /**\n * Assigns the shape to the default x and y axes of the graph, only if they don't exist yet\n * @return {Shape} The current shape\n * @see Graph#getXAxis\n * @see Graph#getYAxis\n */\n autoAxes() {\n\n if (!this.xAxis) {\n this.xAxis = this.graph.getXAxis();\n }\n\n if (!this.yAxis) {\n this.yAxis = this.graph.getYAxis();\n }\n\n return this;\n }\n\n /**\n * Assigns the shape to an x axis\n * @param {XAxis} The X axis related to the shape\n * @return {Shape} The current shape\n */\n setXAxis(axis) {\n this.xAxis = axis;\n return this;\n }\n\n /**\n * Assigns the shape to an y axis\n * @param {YAxis} The Y axis related to the shape\n * @return {Shape} The current shape\n */\n setYAxis(axis) {\n this.yAxis = axis;\n }\n\n /**\n * Returns the x axis associated to the shape. If non-existent, assigns it automatically\n * @return {XAxis} The x axis associated to the shape.\n */\n getXAxis() {\n\n if (!this.xAxis) {\n this.autoAxes();\n }\n\n return this.xAxis;\n }\n\n /**\n * Returns the y axis associated to the shape. If non-existent, assigns it automatically\n * @return {YAxis} The y axis associated to the shape.\n */\n getYAxis() {\n\n if (!this.yAxis) {\n this.autoAxes();\n }\n\n return this.yAxis;\n }\n\n /**\n * Sets the layer of the shape\n * @param {Number} layer - The layer number (1 being the lowest)\n * @return {Shape} The current shape\n * @see Shape#getLayer\n */\n setLayer(layer) {\n this.setProp('layer', layer);\n return this;\n }\n\n /**\n * Returns the layer on which the shape is placed\n * @return {Number} The layer number (1 being the lowest layer)\n */\n getLayer() {\n var layer = this.getProp('layer');\n\n if (layer !== undefined) {\n return layer;\n }\n\n return 1;\n }\n\n /**\n * Initial drawing of the shape. Adds it to the DOM and creates the labels. If the shape was already in the DOM, the method simply recreates the labels and reapplies the shape style, unless ```force``` is set to ```true```\n * @param {Boolean} force - Forces adding the shape to the DOM (useful if the shape has changed layer)\n * @param {Boolean} preventRedraw - Prevents the redraw method\n * @return {Shape} The current shape\n */\n draw(force, preventRedraw) {\n\n if (!this._inDom || force) {\n\n this.appendToDom();\n this._inDom = true;\n }\n\n this.makeLabels();\n\n if (!preventRedraw) {\n this.redraw();\n }\n\n this.applyStyle();\n\n return this;\n }\n\n /**\n * Redraws the shape. Repositions it, applies the style and updates the labels\n * @return {Shape} The current shape\n */\n redraw() {\n\n if (this.hidden) {\n return this;\n }\n\n this.position = this.applyPosition();\n\n this.redrawImpl();\n if (!this.position) {\n this.updateLabels();\n return this;\n }\n\n this.updateLabels();\n this._applyTransforms();\n return this;\n }\n\n /**\n * Implementation of the redraw method. Extended Shape classes should override this method\n */\n redrawImpl() {}\n\n /**\n * Sets all dumpable properties of the shape\n * @param {Object} properties - The properties object\n * @return {Shape} The current shape\n */\n setProperties(properties) {\n this.properties = properties;\n\n if (!Array.isArray(this.properties.position)) {\n this.properties.position = [this.properties.position];\n }\n var self = this;\n for (var i = 0, l = this.properties.position.length; i < l; i++) {\n\n var pos = Position.check(this.properties.position[i], function (relativeTo) {\n return self.getRelativePosition(relativeTo);\n });\n\n this.properties.position[i] = pos;\n }\n\n this.emit('propertiesChanged');\n return this;\n }\n\n getRelativePosition(relativePosition) {\n\n var result;\n if ((result = /position([0-9]*)/.exec(relativePosition)) !== null) {\n return this.getPosition(result[1]);\n } else if ((result = /labelPosition([0-9]*)/.exec(relativePosition)) !== null) {\n return this.getLabelPosition(result[1]);\n }\n }\n\n /**\n * Gets all dumpable properties of the shape\n * @return {Object} properties - The properties object\n */\n getProperties(properties) {\n return this.properties;\n }\n\n /**\n * Sets a property to the shape that is remembered and can be later reexported (or maybe reimported)\n * @param {String} prop - The property to save\n * @param val - The value to save\n * @param [ index = 0 ] - The index of the property array to save the property\n * @return {Shape} The current shape\n */\n setProp(prop, val, index) {\n this.properties = this.properties || {};\n this.properties[prop] = this.properties[prop] || [];\n this.properties[prop][index || 0] = val;\n this.emit('propertyChanged', prop);\n return this;\n }\n\n /**\n * Returns a property of the shape\n * @param {String} prop - The property to retrieve\n * @param [ index = 0 ] - The index of the property array\n */\n getProp(prop, index) {\n return (this.properties[prop] || [])[index || 0];\n }\n\n /**\n * Returns all the properties of the shape\n * @param {String} prop - The property to retrieve\n */\n getProps(prop, index) {\n return this.properties[prop] || [];\n }\n\n /**\n * Adds a property to the property array\n * @param {String} prop - The property to add\n * @param val - The value to save\n */\n addProp(prop, value) {\n this.properties[prop] = this.properties[prop] || [];\n this.properties[prop].push(value);\n }\n\n /**\n * Resets the property array\n * @param {String} prop - The property to reset\n */\n resetProp(prop) {\n this.properties[prop] = [];\n }\n\n /**\n * Sets a DOM property to the shape\n */\n setDom(prop, val, noForce) {\n if (this._dom) {\n\n if (!noForce || !hasSavedAttribute(this._dom, prop)) {\n this._dom.setAttribute(prop, val);\n }\n }\n }\n\n /**\n * Sets a DOM property to the shape group\n */\n setDomGroup(prop, val) {\n if (this.group) {\n this.group.setAttribute(prop, val);\n }\n }\n\n /**\n * Saves the stroke color\n * @return {Shape} The current shape\n */\n setStrokeColor(color) {\n this.setProp('strokeColor', color);\n this.overwriteSavedProp('stroke', color);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the stroke color\n * @return {String} The stroke color of the shape\n */\n getStrokeColor() {\n return this.getProp('strokeColor');\n }\n\n /**\n * Saves the fill color\n * @param {String} color - The filling color\n * @return {Shape} The current shape\n */\n setFillColor(color) {\n\n this.setProp('fillColor', color);\n this.overwriteSavedProp('fill', color);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the fill color\n * @return {String} The fill color of the shape\n */\n getFillColor() {\n return this.getProp('fillColor');\n }\n\n /**\n * Saves the opacity of the filling color of the shape\n * @param {Number} opacity - The filling opacity (0 to 1)\n * @return {Shape} The current shape\n */\n setFillOpacity(opacity) {\n this.setProp('fillOpacity', opacity);\n this.overwriteSavedProp('fill-opacity', opacity);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Saves the stroke width\n * @param {String} width - The stroke width\n * @return {Shape} The current shape\n */\n setStrokeWidth(width) {\n this.setProp('strokeWidth', width);\n this.overwriteSavedProp('stroke-width', width);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the stroke width\n * @return {String} The stroke width of the shape\n */\n getStrokeWidth() {\n return this.getProp('strokeWidth');\n }\n\n /**\n * Saves the stroke dash array\n * @param {String} dasharray - The dasharray string\n * @example shape.setStrokeDasharray(\"5,5,1,4\");\n * shape.applyStyle();\n * @return {Shape} The current shape\n */\n setStrokeDasharray(dasharray) {\n this.setProp('strokeDasharray', dasharray);\n this.overwriteSavedProp('stroke-dasharray', dasharray);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Sets any extra attributes to the DOM element of the shape\n * @param {Object} attributes - An extra attribute array to apply to the shape DOM\n * @example shape.setAttributes( { \"data-bindable\" : true } );\n * shape.applyStyle();\n * @return {Shape} The current shape\n */\n setAttributes(attributes) {\n this.setProp('attributes', attributes);\n return this;\n }\n\n overwriteSavedProp(prop, newValue) {\n overwriteDomAttribute(this._dom, prop, newValue);\n }\n\n /**\n * Adds an extra attribute to the shape\n * @param {String} attributeName - The name of the attribute\n * @param {String} attributeValue - The value of the attribute\n * @return {Shape} The current shape\n */\n addAttribute(attributeName, attributeValue) {\n var added = {};\n added[attributeName] = attributeValue;\n this.addProp('attributes', added);\n return this;\n }\n\n /**\n * Adds a transform property to the shape.\n * @param {String} type - The transform type (\"rotate\", \"transform\" or \"scale\")\n * @param {String} args - The arguments following the transform\n * @return {Shape} The current shape\n */\n addTransform(type, args) {\n this.addProp('transforms', {\n type: type,\n arguments: Array.isArray(args) ? args : [args]\n });\n return this;\n }\n\n /**\n * Resets the transforms\n * @see Shape#addTransform\n * @return {Shape} The current shape\n */\n resetTransforms() {\n this.resetProp('transforms');\n return this;\n }\n\n /**\n * Sets the text of the label\n * @param {String} text - The text of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelText(text, index = 0) {\n this.setProp('labelText', text, index);\n return this;\n }\n\n /**\n * Sets the text of the label\n * @param {String} data - Some additional HTML tags that will be set to the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelData(data, text, index = 0) {\n this.setProp('labelData', text, index);\n return this;\n }\n\n /**\n * Returns the text of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {String} The text of the label\n */\n getLabelText(text, index = 0) {\n return this.getProp('labelText', index);\n }\n\n /**\n * Displays a hidden label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n displayLabel(index = 0) {\n this.setProp('labelVisible', true, index);\n return this;\n }\n\n /**\n * Hides a displayed label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n hideLabel(index = 0) {\n this.setProp('labelVisible', false, index);\n return this;\n }\n\n /**\n * Sets the color of the label\n * @param {String} color - The color of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelColor(color, index = 0) {\n this.setProp('labelColor', color, index);\n return this;\n }\n\n /**\n * Sets the font size of the label\n * @param {String} size - The font size (in px) of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelFontSize(size, index = 0) {\n this.setProp('labelFontSize', size, index);\n return this;\n }\n\n /**\n * Returns the position of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Position} The current position of the label\n */\n getLabelPosition(index = 0) {\n return this.getProp('labelPosition', index);\n }\n\n /**\n * Sets the position of the label\n * @param {Position} position - The position of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelPosition(position, index) {\n\n var self;\n var pos = Position.check(position, function (relativeTo) {\n return self.getRelativePosition(relativeTo);\n });\n\n this.setProp('labelPosition', pos, index || 0);\n return this;\n }\n\n /**\n * Sets the angle of the label\n * @param {Number} angle - The angle of the label in degrees (0 to 360°)\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelAngle(angle, index) {\n this.setProp('labelAngle', angle, index || 0);\n return this;\n }\n\n /**\n * Sets the baseline of the label, which affects its y position with respect to the text direction. For text along the x direction, different baselines will reference differently the text to the ```y``` coordinate.\n * @param {String} baseline - The baseline of the label. Most common baselines are ```no-change```, ```central```, ```middle``` and ```hanging```. You will find an explanation of those significations on the [corresponding MDN article]{@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/dominant-baseline}\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBaseline(baseline, index) {\n this.setProp('labelBaseline', baseline, index || 0);\n return this;\n }\n\n /**\n * Sets the anchoring of the label.\n * @param {String} anchor - The anchor of the label. Values can be ```start```, ```middle```, ```end``` or ```inherit```.\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelAnchor(anchor, index) {\n this.setProp('labelAnchor', anchor, index || 0);\n return this;\n }\n\n /**\n * Sets the anchoring of the label.\n * @param {String} size - The font size in px\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelSize(size, index) {\n this.setProp('labelSize', size, index || 0);\n return this;\n }\n\n /**\n * Sets the color of the stroke of the label.\n * @param {String} color - The color of the stroke\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelStrokeColor(color, index) {\n this.setProp('labelStrokeColor', color, index || 0);\n return this;\n }\n\n /**\n * Sets the width of the stroke of the label.\n * @param {Number} width - The width of the stroke\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelStrokeWidth(width, index) {\n this.setProp('labelStrokeWidth', width, index || 0);\n return this;\n }\n\n /**\n * Sets the color of the background of the label.\n * @param {String} color - The color of the background\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBackgroundColor(color, index) {\n this.setProp('labelBackgroundColor', color, index || 0);\n return this;\n }\n\n /**\n * Sets the opacity of the background of the label.\n * @param {Number} opacity - The opacity of the background, between 0 and 1\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBackgroundOpacity(opacity, index) {\n this.setProp('labelBackgroundOpacity', opacity, index || 0);\n return this;\n }\n\n /**\n * Applies the generic style to the shape. This is a method that applies to most shapes, hence should not be overridden. However if you create a bundle of shapes that extend another one, you may use it to set common style properties to all your shapes.\n * @return {Shape} The current shape\n */\n applyGenericStyle() {\n\n this.setDom('fill', this.getProp('fillColor'), true);\n this.setDom('fill-opacity', this.getProp('fillOpacity'), true);\n this.setDom('stroke', this.getProp('strokeColor'), true);\n this.setDom('stroke-width', this.getProp('strokeWidth'), true);\n this.setDom('stroke-dasharray', this.getProp('strokeDasharray'), true);\n\n var attributes = this.getProps('attributes');\n for (var j = 0, l = attributes.length; j < l; j++) {\n\n for (var i in attributes[j]) {\n this.setDom(i, typeof attributes[j][i] == 'function' ? attributes[j][i].call(this, i) : attributes[j][i], true);\n }\n }\n\n this._applyTransforms();\n\n return this;\n }\n\n /**\n * Applies the style to the shape. This method can be extended to apply specific style to the shapes\n * @return {Shape} The current shape\n */\n applyStyle() {\n\n return this.applyGenericStyle();\n }\n\n /**\n * Returns a computed position object\n * @param {(Number|Position)} [ index = 0 ] - The index of the position to compute\n * @param {Position} relToPosition - A base position from which to compute the position (useful for dx values)\n * @return {Object} The computed position object in the format { x: x_in_px, y: y_in_px }\n */\n calculatePosition(index) {\n\n var position;\n\n position = index instanceof Position ? index : this.getPosition(index);\n\n if (!position) {\n return;\n }\n\n if (position && position.compute) {\n return position.compute(this.graph, this.getXAxis(), this.getYAxis(), this.getSerie());\n }\n\n this.graph.throw();\n }\n\n /**\n * Returns a stored position object\n * @param {Number} [ index = 0 ] - The index of the position to compute\n * @return {Position} The position at the proper index, or undefined\n */\n getPosition(index) {\n\n var pos = this.getProp('position', index || 0);\n this.setProp('position', pos = Position.check(pos), index);\n return pos;\n }\n\n /**\n * Sets a position object\n * @param {Position} position - The position object to store\n * @param {Number} [ index = 0 ] - The index of the position to store\n * @return {Shape} The current shape\n */\n setPosition(position, index) {\n\n var self = this;\n var pos = Position.check(position, function (relativeTo) {\n return self.getRelativePosition(relativeTo);\n });\n\n return this.setProp('position', pos, index || 0);\n }\n\n /**\n * Sorts the positions\n * @param {Function} sortFunction - Function passed into the ```Array.sort``` method\n * @return {Position} The current shape\n */\n sortPositions(sortFunction) {\n this.getProps('position').sort(sortFunction);\n return this;\n }\n\n /**\n * Applies the style to the shape. This method can be extended to apply specific style to the shapes\n * @private\n * @return {Shape} The current shape\n */\n _applyTransforms() {\n\n var transforms = this.getProp('transforms'),\n transformString = '';\n\n if (!transforms) {\n return;\n }\n transforms = Array.isArray(transforms) ? transforms : [transforms];\n\n if (transforms.length == 0) {\n return;\n }\n\n for (var i = 0; i < transforms.length; i++) {\n\n transformString += transforms[i].type + '(';\n\n switch (transforms[i].type) {\n\n case 'translate':\n\n let transform = transforms[i].arguments[0].compute(this.graph, this.getXAxis(), this.getYAxis(), this.getSerie());\n\n transformString += transform.x;\n transformString += ', ';\n transformString += transform.y;\n break;\n\n case 'rotate':\n\n transformString += transforms[i].arguments[0];\n transformString += ', ';\n\n if (transforms[i].arguments.length == 1) {\n var p = this.computePosition(0);\n transformString += p.x + ', ' + p.y;\n } else {\n\n transformString += Position.getDeltaPx(transforms[i].arguments[1], this.getXAxis()).replace('px', '');\n transformString += ', ';\n transformString += Position.getDeltaPx(transforms[i].arguments[2], this.getYAxis()).replace('px', '');\n }\n\n break;\n }\n\n transformString += ') ';\n }\n\n this.setDomGroup('transform', transformString);\n return this;\n }\n\n /**\n * Creates all the labels\n * @private\n * @returns {Shape} The current shape\n */\n makeLabels() {\n\n this._labels = this._labels || [];\n this._labelsBackground = this._labelsBackground || [];\n\n this._labels.map(label => {\n this.group.removeChild(label);\n });\n\n this._labelsBackground.map(bg => {\n this.group.removeChild(bg);\n });\n\n this._labels = [];\n this._labelsBackground[i] = [];\n\n var i = 0;\n\n while (this.getProp('labelText', i) !== undefined) {\n\n if (!this._labels[i]) {\n\n this._labels[i] = document.createElementNS(this.graph.ns, 'text');\n this._labels[i].setAttribute('data-label-i', i);\n this._labels[i].jsGraphIsShape = this;\n\n this._labelsBackground[i] = document.createElementNS(this.graph.ns, 'rect');\n this._labelsBackground[i].setAttribute('data-label-i', i);\n this._labelsBackground[i].jsGraphIsShape = this;\n\n this.group.appendChild(this._labelsBackground[i]);\n this.group.appendChild(this._labels[i]);\n\n this._labels[i].addEventListener('dblclick', e => {\n e.stopPropagation();\n\n this.labelDblClickListener(e);\n });\n\n this._labelsBackground[i].addEventListener('dblclick', e => {\n e.stopPropagation();\n\n this.labelDblClickListener(e);\n });\n }\n\n i++;\n }\n\n this.updateLabels();\n\n return this;\n }\n\n /**\n * Determines if the label is editable\n * @param {Number} labelIndex - The index of the label\n * @return {Boolean} ```true``` if the label is editable, ```false``` otherwise\n */\n isLabelEditable(labelIndex) {\n return this.getProp('labelEditable', labelIndex || 0);\n }\n\n /**\n * Applies the label data to the dom object\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {Shape} The current shape\n */\n updateLabels() {\n\n this._labels = this._labels || [];\n\n for (var i = 0, l = this._labels.length; i < l; i++) {\n this._applyLabelData(i);\n }\n }\n\n /**\n * Applies the label data to the dom object\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {Shape} The current shape\n */\n _applyLabelData(labelIndex) {\n\n labelIndex = labelIndex || 0;\n\n /** Sets the position */\n\n var visible = this.getProp('labelVisible', labelIndex);\n\n if (visible === false) {\n this._labels[labelIndex].setAttribute('display', 'none');\n this._labelsBackground[labelIndex].setAttribute('display', 'none');\n return;\n } else {\n this._labels[labelIndex].setAttribute('display', 'initial');\n this._labelsBackground[labelIndex].setAttribute('display', 'initial');\n }\n\n var position = this.calculatePosition(Position.check(this.getProp('labelPosition', labelIndex)));\n\n if (isNaN(position.x) || isNaN(position.y) || position.y === false || position.x === false) {\n /*console.warn( \"Cannot compute positioning for labelIndex \" + labelIndex + \" with text \" + this.getProp( \"labelText\", labelIndex ) );\n console.log( this, this._labels );\n console.trace();*/\n return;\n }\n\n if (position.x != 'NaNpx' && !isNaN(position.x) && position.x !== 'NaN' && position.x !== false) {\n\n this._labels[labelIndex].setAttribute('x', position.x);\n this._labels[labelIndex].setAttribute('y', position.y);\n }\n\n /** Sets the angle */\n var currAngle = this.getProp('labelAngle', labelIndex) || 0;\n if (currAngle != 0) {\n\n var x = this._labels[labelIndex].getAttribute('x'),\n y = this._labels[labelIndex].getAttribute('y');\n\n this._labels[labelIndex].setAttribute('transform', 'rotate(' + currAngle + ' ' + x + ' ' + y + ')');\n // this._labelsBackground[ labelIndex ].setAttribute( 'transform', 'rotate(' + currAngle + ' ' + x + ' ' + y + ')' );\n }\n\n let labelData = this.getProp('labelHTMLData', labelIndex) || {};\n\n for (var i in labelData) {\n\n this._labels[labelIndex].setAttribute(i, labelData[i]);\n this._labelsBackground[labelIndex].setAttribute(i, labelData[i]);\n }\n\n /** Sets the baseline */\n this._labels[labelIndex].setAttribute('dominant-baseline', this.getProp('labelBaseline', labelIndex) || 'no-change');\n\n /** Sets the text */\n this._labels[labelIndex].textContent = this.getProp('labelText', labelIndex);\n\n /** Sets the color */\n this._labels[labelIndex].setAttribute('fill', this.getProp('labelColor', labelIndex) || 'black');\n\n /** Sets the size */\n this._labels[labelIndex].setAttribute('font-size', this.getProp('labelSize', labelIndex) + 'px' || '12px');\n\n /** Sets the anchor */\n this._labels[labelIndex].setAttribute('text-anchor', this._getLabelAnchor(labelIndex));\n\n /** Sets the stroke */\n this._labels[labelIndex].setAttribute('stroke', this.getProp('labelStrokeColor', labelIndex) || 'black');\n\n /** Sets the stroke */\n this._labels[labelIndex].setAttribute('stroke-width', this.getProp('labelStrokeWidth', labelIndex) || 0 + 'px');\n\n this._labels[labelIndex].setAttribute('stroke-location', 'outside');\n\n let rect = this._labels[labelIndex].getBBox();\n\n this._labelsBackground[labelIndex].setAttribute('x', rect.x);\n this._labelsBackground[labelIndex].setAttribute('y', rect.y);\n this._labelsBackground[labelIndex].setAttribute('width', rect.width);\n this._labelsBackground[labelIndex].setAttribute('height', rect.height);\n\n this._labelsBackground[labelIndex].setAttribute('fill', this.getProp('labelBackgroundColor') || 'transparent');\n this._labelsBackground[labelIndex].setAttribute('fill-opacity', this.getProp('labelBackgroundOpacity') || 1);\n\n return this;\n }\n\n /**\n * Temporarily empties the labels, until the next rendering.\n * This is used when the shape should not be displayed\n * @returns {Shape} The current shape instance\n */\n emptyLabels() {\n\n for (var i = 0, l = this._labels.length; i < l; i++) {\n /** Sets the baseline */\n this._labels[i].textContent = '';\n }\n\n return this;\n }\n\n /**\n * Returns the anchor of the label\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {String} The anchor in SVG string\n */\n _getLabelAnchor(labelIndex) {\n var anchor = this.getProp('labelAnchor', labelIndex);\n switch (anchor) {\n case 'middle':\n case 'start':\n case 'end':\n return anchor;\n break;\n\n case 'right':\n return 'end';\n break;\n\n case 'left':\n return 'start';\n break;\n\n default:\n return 'start';\n break;\n }\n }\n\n /**\n * Returns the shape selection status\n * @returns {Boolean} true is the shape is selected, false otherwise\n */\n isSelected() {\n return this._selectStatus || false;\n }\n\n /**\n * Sets or queries whether the shape can have handles. Even if the property is set to false, the getter can return true if the property ```statichandles``` is true (used when handles never disappear)\n * @param {Boolean} setter - If used, defined if the shape has handles or not\n * @returns {Boolean} true is the shape has handles, false otherwise\n * @example Shape.hasHandles( true ); // Sets that the shape has handles\n * @example Shape.hasHandles( false ); // Sets that the shape has no handles\n * @example Shape.hasHandles( ); // Queries the shape to determine if it has handles or not. Also returns true if handles are static\n */\n hasHandles(setter) {\n\n if (setter !== undefined) {\n this.setProp('handles', setter);\n }\n\n return !!this.getProp('handles') || !!this.getProp('staticHandles');\n }\n\n /**\n * Adds shape handles\n * @private\n * @return {Shape} The current shape\n */\n addHandles() {\n\n if (this.isLocked()) {\n return;\n }\n\n if (!this.handlesInDom) {\n\n this.handlesInDom = true;\n\n for (var i = 1; i < this.handles.length; i++) {\n\n if (this.handles[i]) {\n this.group.appendChild(this.handles[i]);\n }\n }\n }\n\n return this;\n }\n\n /**\n * Remove shape handles\n * @private\n * @return {Shape} The current shape\n */\n removeHandles() {\n\n this.hideHandles();\n this.handles = [];\n }\n\n /**\n * Hide shape handles\n * @private\n * @return {Shape} The current shape\n */\n hideHandles() {\n\n if (!this.handlesInDom) {\n return this;\n }\n\n for (var i = 1; i < this.handles.length; i++) {\n this.group.removeChild(this.handles[i]);\n }\n\n this.handlesInDom = false;\n return this;\n }\n\n /**\n * @protected\n * @return {Boolean} ```true``` if the handles are in the DOM\n */\n areHandlesInDom() {\n\n return this.handlesInDom;\n }\n\n /**\n * Selects the shape. Should only be called from jsGraph main instance\n * @private\n * @param {Boolean} [ mute = false ] - Mutes the method (no event emission)\n * @returns {Shape} the current shape\n */\n _select(mute) {\n\n if (!this.isSelectable()) {\n return false;\n }\n\n // Put on the stack\n this.appendToDom();\n //this.graph.appendShapeToDom( this ); // Put the shape on top of the stack !\n\n this._selectStatus = true;\n\n this.applySelectedStyle();\n\n if (this.hasHandles() && !this.hasStaticHandles()) {\n\n this.addHandles();\n this.setHandles();\n }\n\n if (!mute) {\n this.graph.emit('shapeSelected', this);\n }\n }\n\n applySelectedStyle() {\n\n if (!this._selectStatus) {\n return;\n }\n\n var style = this.getSelectStyle();\n var style2 = {};\n for (var i in style) {\n if (typeof style[i] == 'function') {\n style2[i] = style[i].call(this);\n } else {\n style2[i] = style[i];\n }\n }\n\n saveDomAttributes(this._dom, style2, 'select');\n }\n\n /**\n * Unselects the shape. Should only be called from jsGraph main instance\n * @private\n * @param {Boolean} [ mute = false ] - Mutes the method (no event emission)\n * @returns {Shape} the current shape\n */\n _unselect(mute) {\n\n this._selectStatus = false;\n\n restoreDomAttributes(this._dom, 'select');\n\n if (this.hasHandles() && !this.hasStaticHandles()) {\n this.hideHandles();\n }\n\n if (!mute) {\n this.graph.emit('shapeUnselected', this);\n }\n }\n\n /**\n * Returns the special style of the shape when it is selected.\n * @see Shape#setSelectStyle\n * @param {Object} The SVG attributes to apply to the shape\n */\n getSelectStyle() {\n return this.selectStyle;\n }\n\n /**\n * Defines the style that is applied to the shape when it is selected. The style extends the default style of the shape\n * @param {Object} [ attr = {} ] - The SVG attributes to apply to the shape\n * @example rectangle.setSelectStyle( { fill: 'red' } );\n * @returns {Shape} the current shape\n */\n setSelectStyle(attr) {\n this.selectStyle = attr;\n this.applySelectedStyle(); // Maybe the shape is already selected\n return this;\n }\n\n /**\n * Assigns static handles to the shape. In this mode, handles will not disappear\n * @param {Boolean} staticHandles - true to enable static handles, false to disable them.\n * @returns {Shape} the current shape\n */\n setStaticHandles(staticHandles) {\n this.setProp('staticHandles', staticHandles);\n }\n\n /**\n * @returns {Boolean} ```true``` if the shape has static handles, ```false``` otherwise\n */\n hasStaticHandles(staticHandles) {\n return !!this.getProp('staticHandles');\n }\n\n /**\n * Creates the handles for the shape\n * @param {Number} nb - The number of handles\n * @param {String} type - The type of SVG shape to use\n * @param {Object} [ attr = {} ] - The SVG attributes to apply to the handles\n * @param {Function} [ callbackEach ] - An additional callback the user can provide to further personalize the handles\n * @returns {Shape} the current shape\n * @private\n */\n _createHandles(nb, type, attr, callbackEach) {\n\n if (this.handles && this.handles.length > 0) {\n return;\n }\n\n for (var i = 1, l = nb; i <= l; i++) {\n\n (j => {\n\n var self = this;\n\n var handle = document.createElementNS(self.graph.ns, type);\n handle.jsGraphIsShape = true;\n\n if (attr) {\n for (var k in attr) {\n handle.setAttribute(k, attr[k]);\n }\n }\n\n handle.addEventListener('mousedown', e => {\n\n if (self.isResizable()) {\n\n e.preventDefault();\n e.stopPropagation();\n\n self.graph.emit('beforeShapeResize', self);\n this.emit('beforeShapeResize');\n\n if (!self.graph.prevent(false)) {\n\n self.resizing = true;\n self.handleSelected = j;\n self.handleMouseDown(e);\n }\n }\n });\n\n if (callbackEach) {\n callbackEach(self.handles[j]);\n }\n\n self.handles[j] = handle;\n }).call(this, i);\n }\n\n return this.handles;\n }\n\n /**\n * Creates the handles for the shape. Should be implemented by the children shapes classes.\n */\n createHandles() {\n\n if (this.hasStaticHandles()) {\n this.addHandles();\n this.setHandles();\n }\n }\n\n /**\n * Handles mouse down event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseDownImpl() {}\n\n /**\n * Handles the mouse move event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseMoveImpl() {}\n\n /**\n * Handles mouse up event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseUpImpl() {}\n\n /**\n * Called when the shape is created\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleCreateImpl() {}\n\n /**\n * Handles mouse down events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDownImpl} method.prototype\n */\n handleMouseDown(e) {\n\n //this.handleSelected = false;\n\n if (this.isLocked()) {\n return;\n }\n\n if (this.isMovable() || this.isResizable()) {\n\n this.graph.elementMoving(this);\n }\n\n if (this.getProp('selectOnMouseDown')) {\n this.graph.selectShape(this);\n }\n\n if (this.isMovable()) {\n if (!this.resizing) {\n\n this.graph.emit('beforeShapeMove', self);\n\n if (!this.graph.prevent(false)) {\n\n this.moving = true;\n this.moved = false;\n }\n }\n }\n\n this._mouseCoords = this.graph._getXY(e);\n return this.handleMouseDownImpl(e, this._mouseCoords);\n }\n\n /**\n * Handles mouse click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDownClick} method\n * @private\n */\n handleClick(e) {\n\n this.graph.emit('shapeClicked', this);\n this.emit('shapeClicked');\n\n if (!this.isSelectable()) {\n return false;\n }\n\n if (!e.shiftKey) {\n this.graph.unselectShapes();\n }\n\n if (this.getProp('selectOnClick')) {\n\n this.graph.selectShape(this);\n }\n }\n\n /**\n * Handles mouse click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseUpImpl} method\n * @private\n */\n handleMouseMove(e) {\n //console.log( this.resizinh, this.moving, this.isSelected(), this._mouseCoords );\n if ((this.resizing || this.moving) && !this.isSelected()) {\n this.graph.selectShape(this);\n }\n\n this.graph.emit('beforeShapeMouseMove', this);\n this.emit('beforeShapeMouseMove');\n\n if (this.graph.prevent(false) || !this._mouseCoords) {\n return false;\n }\n\n this.moved = true;\n var coords = this.graph._getXY(e);\n var deltaX = this.getXAxis().getRelVal(coords.x - this._mouseCoords.x),\n deltaY = this.getYAxis().getRelVal(coords.y - this._mouseCoords.y);\n\n if (deltaX != 0 || deltaY !== 0) {\n this.preventUnselect = true;\n }\n\n this._mouseCoords = coords;\n\n var ret = this.handleMouseMoveImpl(e, deltaX, deltaY, coords.x - this._mouseCoords.x, coords.y - this._mouseCoords.y);\n\n return ret;\n }\n\n /**\n * Handles mouse up events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseUpImpl} method\n * @private\n */\n handleMouseUp(e) {\n\n if (this.moving && this.moved) {\n\n this.graph.emit('shapeMoved', this);\n this.emit('shapeMoved');\n }\n\n if (this.handleSelected || this.resize) {\n\n this.graph.emit('shapeResized', this);\n this.emit('shapeResized');\n }\n\n this.moving = false;\n this.resizing = false;\n this.handleSelected = false;\n this.graph.elementMoving(false);\n\n return this.handleMouseUpImpl(e);\n }\n\n /**\n * Handles double click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDblClickImpl} method\n * @private\n */\n handleDblClick(e) {}\n\n /**\n * Handles mouse over events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseOverImpl} method\n * @private\n */\n handleMouseOver() {\n\n if (this.getProp('highlightOnMouseOver')) {\n\n if (!this.moving && !this.resizing) {\n this.highlight();\n }\n }\n\n this.graph.emit('shapeMouseOver', this);\n }\n\n /**\n * Handles mouse out events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseOutImpl} method\n * @private\n */\n handleMouseOut() {\n\n if (this.getProp('highlightOnMouseOver')) {\n this.unHighlight();\n }\n\n this.graph.emit('shapeMouseOut', this);\n }\n\n /*\n * Updated July 1st, 2015\n */\n\n /**\n * Locks the shape (prevents selection, resizing and moving)\n * @return {Shape} The current shape\n */\n lock() {\n this.setProp('locked', true);\n return this;\n }\n\n /**\n * Unlocks the shape (prevents selection, resizing and moving)\n * @return {Shape} The current shape\n */\n unlock() {\n this.setProp('locked', false);\n return this;\n }\n\n /**\n * @return {Boolean} True if the shape is locked, false otherwise\n */\n isLocked() {\n return this.getProp('locked') || this.graph.shapesLocked;\n }\n\n /**\n * Makes the shape moveable\n * @return {Shape} The current shape\n */\n movable(bln) {\n this.setProp('movable', true);\n }\n\n /**\n * Makes the shape non-moveable\n * @return {Shape} The current shape\n */\n unmovable() {\n this.setProp('movable', false);\n return false;\n }\n\n /**\n * @return {Boolean} True if the shape is movable, false otherwise\n */\n isMovable() {\n return this.getProp('movable');\n }\n\n /**\n * Makes the shape resizable\n * @return {Shape} The current shape\n */\n resizable() {\n this.setProp('resizable', true);\n }\n\n /**\n * Makes the shape non-resizable\n * @return {Shape} The current shape\n */\n unresizable() {\n this.setProp('resizable', false);\n }\n\n /**\n * @return {Boolean} True if the shape is resizable, false otherwise\n */\n isResizable() {\n return this.getProp('resizable');\n }\n\n /**\n * Makes the shape selectable\n * @return {Shape} The current shape\n */\n selectable() {\n this.setProp('selectable', true);\n }\n\n /**\n * Makes the shape non-selectable\n * @return {Shape} The current shape\n */\n unselectable() {\n this.graph.unselectShape(this);\n this.setProp('selectable', false);\n }\n\n /**\n * @return {Boolean} True if the shape is selectable, false otherwise\n */\n isSelectable() {\n return this.getProp('selectable');\n }\n\n /**\n * Highlights the shape with attributes\n * @returns {Shape} The current shape\n * @param {Object} [ attributes ] - A hashmap of attributes to apply. If omitted, {@link Shape#getHighlightAttributes} will be called\n * @param {String} [ saveDomName=highlight ] - The name to which the current shape attributes will be saved to be recovered later with the {@link Shape#unHighlight} method\n * @example shape.highlight( { fill: 'red', 'fill-opacity': 0.5 } );\n * @see Shape#unHighlight\n */\n highlight(attributes, saveDomName) {\n\n if (!attributes) {\n attributes = this.getHighlightAttributes();\n }\n\n if (!saveDomName) {\n saveDomName = 'highlight';\n }\n\n saveDomAttributes(this._dom, attributes, saveDomName);\n this.highlightImpl();\n return this;\n }\n\n /**\n * Removes the highlight properties from the same\n * @returns {Shape} The current shape\n * @param {String} [ saveDomName=highlight ] - The name to which the current shape attributes will be saved to be recovered later with the {@link Shape#unHighlight} method\n * @see Shape#highlight\n */\n unHighlight(saveDomName) {\n\n if (!saveDomName) {\n saveDomName = 'highlight';\n }\n\n restoreDomAttributes(this._dom, saveDomName);\n this.unHighlightImpl();\n return this;\n }\n\n highlightImpl() {}\n unHighlightImpl() {}\n\n /**\n * @returns {Object} The attributes taken by the shape when highlighted\n * @see Shape#highlight\n */\n getHighlightAttributes() {\n return this._highlightAttributes;\n }\n\n /**\n * Sets the attributes the shape will take when highlighted\n * @param {Object} [ attributes ] - A hashmap of attributes to apply when the shape is highlighted\n * @returns {Shape} The current shape\n * @see Shape#highlight\n */\n setHighlightAttributes(attributes) {\n this._highlightAttributes = attributes;\n return this;\n }\n\n /**\n * Returns the masking id of the shape. Returns null if the shape does not behave as a mask\n * @returns {String} The ```id``` attribute of the shape\n */\n getMaskingID() {\n return this.maskingId;\n }\n\n /**\n * Masks the current shape with another shape passed as the first parameter of the method\n * @param {Shape} maskingShape - The shape used to mask the current shape\n * @return {Shape} The current shape\n */\n maskWith(maskingShape) {\n\n const maskingId = maskingShape.getMaskingID();\n\n if (maskingId) {\n\n this._dom.setAttribute('mask', 'url(#' + maskingId + ')');\n } else {\n\n this._dom.removeAttribute('mask');\n }\n }\n\n /**\n * Manually updates the mask of the shape. This is needed because the shape needs to be surrounded by a white rectangle (because transparent is treated as black and will not render the shape)\n * This method will work well for rectangles but should be overridden for other shapes\n * @return {Shape} The current shape\n * @todo Explore a way to make it compatible for all kinds of shapes. Maybe the masker position should span the whole graph...\n */\n updateMask() {\n return;\n if (!this.maskDom) {\n return; // eslint-disable-line no-useless-return\n }\n\n var position = {\n x: 'min',\n y: 'min'\n };\n var position2 = {\n x: 'max',\n y: 'max'\n };\n\n position = this._getPosition(position);\n position2 = this._getPosition(position2);\n\n this.maskDomWrapper.setAttribute('x', Math.min(position.x, position2.x));\n this.maskDomWrapper.setAttribute('y', Math.min(position.y, position2.y));\n\n this.maskDomWrapper.setAttribute('width', Math.abs(position2.x - position.x));\n this.maskDomWrapper.setAttribute('height', Math.abs(position2.y - position.y));\n\n for (var i = 0; i < this._dom.attributes.length; i++) {\n this.maskDom.setAttribute(this._dom.attributes[i].name, this._dom.attributes[i].value);\n }\n\n this.maskDom.setAttribute('fill', 'black');\n\n return this;\n }\n\n labelDblClickListener(e) {\n\n var i = parseInt(e.target.getAttribute('data-label-i'));\n\n var self = this;\n\n if (isNaN(i)) {\n return;\n }\n\n if (!this.isLabelEditable(i)) {\n return;\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n var shapeLabel = document.createElement('input');\n shapeLabel.setAttribute('type', 'text');\n shapeLabel.setAttribute('value', self.getProp('labelText', i));\n\n self.graph.wrapper.prepend(shapeLabel);\n shapeLabel.select();\n\n setCSS(shapeLabel, {\n position: 'absolute',\n marginTop: parseInt(e.target.getAttribute('y').replace('px', '')) + this.graph.getPaddingTop() - 10 + 'px',\n marginLeft: parseInt(e.target.getAttribute('x').replace('px', '')) + this.graph.getPaddingLeft() - 50 + 'px',\n textAlign: 'center',\n width: '100px'\n });\n\n const previousValue = self.getLabelText(i);\n\n const blurEvent = function () {\n\n self.setLabelText(shapeLabel.value, i);\n self._labels[i].textContent = shapeLabel.value;\n\n const nextValue = shapeLabel.value;\n\n shapeLabel.remove();\n shapeLabel.removeEventListener('blur', blurEvent);\n shapeLabel = false;\n\n self.changed('shapeLabelChanged', {\n previousValue: previousValue,\n nextValue: nextValue\n });\n };\n\n shapeLabel.addEventListener('blur', blurEvent);\n\n shapeLabel.addEventListener('keyup', function (e) {\n\n if (e.keyCode === 13) {\n blurEvent();\n }\n });\n shapeLabel.addEventListener('keypress', function (e) {\n e.stopPropagation();\n });\n shapeLabel.addEventListener('keydown', function (e) {\n e.stopPropagation();\n });\n shapeLabel.focus();\n }\n\n /**\n * Appends the shape DOM to its parent\n * @private\n * @return {Shape} The current shape\n */\n appendToDom() {\n\n if (this._forcedParentDom) {\n\n this._forcedParentDom.appendChild(this.group);\n } else {\n this.graph.appendShapeToDom(this);\n }\n return this;\n }\n\n /**\n * Forces the DOM parent (instead of the normal layer)\n * @return {Shape} The current shape\n */\n forceParentDom(dom) {\n\n this._forcedParentDom = dom;\n\n return this;\n }\n\n isHTML() {\n return false;\n }\n}\n\n/**\n * @alias Shape#calculatePosition\n */\nShape.prototype.computePosition = Shape.prototype.calculatePosition;\n\n/**\n * @alias Shape#displayLabel\n */\nShape.prototype.showLabel = Shape.prototype.displayLabel;\n\n/**\n * @alias Shape#kill\n */\nShape.prototype.remove = Shape.prototype.kill;\n\n/**\n * Displays a surface under a line serie\n * @extends GraphShape\n */\nclass ShapeSurfaceUnderCurve extends Shape {\n\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'path');\n }\n\n createHandles() {\n\n this._createHandles(2, 'line', {\n 'stroke-width': '3',\n 'stroke': 'transparent',\n 'pointer-events': 'stroke',\n 'cursor': 'ew-resize'\n });\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY) {\n\n if (this.isLocked()) {\n return;\n }\n\n if (this.moving) {\n\n this.getPosition(0).deltaPosition('x', deltaX, this.getXAxis());\n this.getPosition(1).deltaPosition('x', deltaX, this.getXAxis());\n } else if (this.serie && this.handleSelected) {\n\n this.resizingPosition = this.handleSelected == 1 ? this.getPosition(0) : this.getPosition(1);\n\n var value = this.serie.searchClosestValue(this.getXAxis().getVal(this.graph._getXY(e).x - this.graph.getPaddingLeft()));\n\n if (!value) {\n return;\n }\n\n if (this.resizingPosition.x != value.xMin) {\n this.preventUnselect = true;\n }\n\n this.resizingPosition.x = value.xMin;\n } else if (this.handleSelected) {\n\n this.resizingPosition = this.handleSelected == 1 ? this.getPosition(0) : this.getPosition(1);\n this.resizingPosition.deltaPosition('x', deltaX, this.getXAxis());\n }\n\n this.applyPosition();\n }\n /*\n redrawImpl: function() {\n //var doDraw = this.setPosition();\n //\tthis.setDom('fill', 'url(#' + 'patternFill' + this.graph._creation + ')')\n if ( this.position != this.doDraw ) {\n this.group.setAttribute( \"visibility\", this.position ? \"visible\" : 'hidden' );\n this.doDraw = this.position;\n }\n },\n */\n applyPosition() {\n\n if (!this.serie) {\n return;\n }\n\n var posXY = this.computePosition(0),\n posXY2 = this.computePosition(1),\n w = Math.abs(posXY.x - posXY2.x),\n x = Math.min(posXY.x, posXY2.x);\n\n // this.reversed = x == posXY2.x;\n\n if (w < 2 || x + w < 0 || x > this.graph.getDrawingWidth()) {\n this.setDom('d', '');\n return false;\n }\n\n var v1 = this.serie.searchClosestValue(this.getPosition(0).x),\n v2 = this.serie.searchClosestValue(this.getPosition(1).x),\n v3,\n i,\n j,\n init,\n max,\n k,\n x,\n y,\n firstX,\n firstY,\n currentLine,\n maxY = 0,\n minY = Number.MAX_VALUE;\n\n if (!v1 || !v2) {\n return false;\n }\n\n if (v1.xBeforeIndex > v2.xBeforeIndex) {\n v3 = v1;\n v1 = v2;\n v2 = v3;\n\n //this.handleSelected = ( this.handleSelected == 1 ) ? 2 : 1;\n }\n\n this.counter = 0;\n\n for (i = v1.dataIndex; i <= v2.dataIndex; i++) {\n this.currentLine = '';\n init = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n max = i == v2.dataIndex ? v2.xBeforeIndexArr : this.serie.data[i].length;\n k = 0;\n\n if (init == max) {\n max++;\n }\n\n for (j = init; j <= max; j += 2) {\n\n x = this.serie.getX(this.serie.data[i][j + 0]);\n y = this.serie.getY(this.serie.data[i][j + 1]);\n\n maxY = Math.max(this.serie.data[i][j + 1], maxY);\n minY = Math.min(this.serie.data[i][j + 1], minY);\n\n if (j == init) {\n this.firstX = x;\n this.firstY = y;\n }\n\n if (k > 0) {\n this.currentLine += ' L ' + x + ' ' + y + ' ';\n } else {\n this.currentLine += ' M ' + x + ' ' + y + ' ';\n }\n\n //this.serie._addPoint( x, y, false, this.currentLine );\n k++;\n }\n\n this.lastX = x;\n this.lastY = y;\n\n if (!this.firstX || !this.firstY || !this.lastX || !this.lastY) {\n return;\n }\n\n this.currentLine += ' V ' + this.getYAxis().getPx(0) + ' H ' + this.firstX + ' z';\n this.setDom('d', this.currentLine);\n }\n\n this.maxY = this.serie.getY(maxY);\n this.setHandles();\n\n this.changed();\n\n return true;\n }\n\n setHandles() {\n\n if (!this.firstX) {\n return;\n }\n\n var posXY = this.computePosition(0),\n posXY2 = this.computePosition(1);\n\n if (posXY.x < posXY2.x) {\n\n this.handles[1].setAttribute('x1', this.firstX);\n this.handles[1].setAttribute('x2', this.firstX);\n\n this.handles[2].setAttribute('x1', this.lastX);\n this.handles[2].setAttribute('x2', this.lastX);\n } else {\n\n this.handles[1].setAttribute('x1', this.lastX);\n this.handles[1].setAttribute('x2', this.lastX);\n\n this.handles[2].setAttribute('x1', this.firstX);\n this.handles[2].setAttribute('x2', this.firstX);\n }\n this.handles[1].setAttribute('y1', this.getYAxis().getMaxPx());\n this.handles[1].setAttribute('y2', this.serie.getY(0));\n\n this.handles[2].setAttribute('y1', this.getYAxis().getMaxPx());\n this.handles[2].setAttribute('y2', this.serie.getY(0));\n }\n}\n\n/**\n * Represents a line\n * @extends Shape\n * @see Graph#newShape\n */\nclass ShapeLine extends Shape {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'line');\n\n if (!this.getStrokeColor()) {\n this.setStrokeColor('black');\n }\n\n if (!this.getStrokeWidth()) {\n this.setStrokeWidth(1);\n }\n }\n\n /**\n * Creates the handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {\n\n this._createHandles(2, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n var position = this.calculatePosition(0);\n var position2 = this.calculatePosition(1);\n\n if (!position || !position.x || !position.y) {\n return;\n }\n\n this.setDom('x2', position.x);\n this.setDom('y2', position.y);\n\n this.setDom('y1', position2.y);\n this.setDom('x1', position2.x);\n\n this.currentPos2x = position2.x;\n this.currentPos2y = position2.y;\n\n this.currentPos1x = position.x;\n this.currentPos1y = position.y;\n\n return true;\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n if (this.isLocked()) {\n return;\n }\n\n var pos = this.getPosition(0);\n var pos2 = this.getPosition(1);\n\n var posToChange;\n if (this.handleSelected == 1) {\n\n posToChange = pos;\n } else if (this.handleSelected == 2) {\n\n posToChange = pos2;\n }\n\n if (posToChange) {\n\n if (!this._data.vertical) {\n posToChange.deltaPosition('x', deltaX, this.getXAxis());\n }\n\n if (!this._data.horizontal) {\n posToChange.deltaPosition('y', deltaY, this.getYAxis());\n }\n }\n\n if (this.moving) {\n\n // If the pos2 is defined by a delta, no need to move them\n if (pos.x) {\n pos.deltaPosition('x', deltaX, this.getXAxis());\n }\n if (pos.y) {\n pos.deltaPosition('y', deltaY, this.getYAxis());\n }\n\n // If the pos2 is defined by a delta, no need to move them\n if (pos2.x) {\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n }\n if (pos2.y) {\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n }\n }\n\n if (this._data.forcedCoords) {\n\n var forced = this._data.forcedCoords;\n\n if (forced.y !== undefined) {\n\n if (typeof forced.y == 'function') {\n pos2.y = pos.y = forced.y(this);\n } else {\n pos2.y = forced.y;\n pos.y = forced.y;\n }\n }\n\n if (forced.x !== undefined) {\n\n if (typeof forced.x == 'function') {\n pos2.x = pos.x = forced.x(this);\n } else {\n pos2.x = forced.x;\n pos.x = forced.x;\n }\n }\n }\n\n if (this.rectEvent) {\n this.setEventReceptacle();\n }\n\n this.redraw();\n this.changed();\n this.setHandles();\n\n return true;\n }\n\n /**\n * Sets the handle position\n * @private\n */\n setHandles() {\n\n if (!this.areHandlesInDom()) {\n return;\n }\n\n if (isNaN(this.currentPos1x)) {\n return;\n }\n\n this.handles[1].setAttribute('x', this.currentPos1x);\n this.handles[1].setAttribute('y', this.currentPos1y);\n\n this.handles[2].setAttribute('x', this.currentPos2x);\n this.handles[2].setAttribute('y', this.currentPos2y);\n }\n\n /**\n * Creates an line receptacle with the coordinates of the line, but continuous and thicker\n * @return {Shape} The current shape\n */\n setEventReceptacle() {\n\n if (!this.currentPos1x) {\n return;\n }\n\n if (!this.rectEvent) {\n this.rectEvent = document.createElementNS(this.graph.ns, 'line');\n this.rectEvent.setAttribute('pointer-events', 'stroke');\n this.rectEvent.setAttribute('stroke', 'transparent');\n this.rectEvent.jsGraphIsShape = this;\n this.group.appendChild(this.rectEvent);\n }\n\n this.rectEvent.setAttribute('x1', this.currentPos1x);\n this.rectEvent.setAttribute('y1', this.currentPos1y);\n this.rectEvent.setAttribute('x2', this.currentPos2x);\n this.rectEvent.setAttribute('y2', this.currentPos2y);\n this.rectEvent.setAttribute('stroke-width', this.getProp('strokeWidth') + 2);\n }\n}\n\n/**\n * Displays an arrow\n * @extends GraphShapeLine\n */\nclass ShapeArrow extends ShapeLine {\n\n constructor(graph) {\n\n super(graph);\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'line');\n this._dom.setAttribute('marker-end', 'url(#arrow' + this.graph._creation + ')');\n\n this.createHandles(this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n\n this.setStrokeColor('black');\n this.setStrokeWidth(1);\n }\n}\n\n/**\n * Displays an ellipse\n * @extends Shape\n */\nclass ShapeEllipse extends Shape {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'ellipse');\n }\n\n applyPosition() {\n\n var pos = this.computePosition(0);\n\n this.setDom('cx', pos.x || 0);\n this.setDom('cy', pos.y || 0);\n\n let posR = this.graph.newPosition({\n\n dx: this.getProp('rx'),\n dy: this.getProp('ry') || this.getProp('rx')\n\n });\n\n let posComputed = this.calculatePosition(posR);\n\n this.setDom('rx', Math.abs(posComputed.x) || 0);\n this.setDom('ry', Math.abs(posComputed.y) || 0);\n return true;\n }\n\n setR(rx, ry) {\n this.setProp('rx', rx);\n this.setProp('ry', ry);\n return this;\n }\n\n handleMouseUpImpl() {\n this.triggerChange();\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {}\n}\n\n/**\n * Blank shape used to display label\n * Use myShapelabel.setLabelText(); and associated methods\n * @extend GraphShape\n */\nclass ShapeLabel extends Shape {\n\n constructor(graph, options) {\n\n super(graph, options);\n }\n\n createDom() {\n return false;\n }\n\n applyPosition() {\n return true;\n }\n}\n\n/**\n * Represents a line that extends the Shape class. Used by the plugin {@link PluginSerieLineDifference}\n * @extends Shape\n * @see Graph#newShape\n */\nclass ShapePolyline extends Shape {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'path');\n\n if (!this.getStrokeColor()) {\n this.setStrokeColor('black');\n }\n\n if (this.getStrokeWidth() == undefined) {\n this.setStrokeWidth(1);\n }\n }\n\n /**\n * No handles for the polyline\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {}\n\n /**\n * Force the points of the polyline already computed in pixels\n * @param {String} a SVG string to be used in the ```d``` attribute of the path.\n * @return {ShapePolyline} The current polyline instance\n */\n setPointsPx(points) {\n this.setProp('pxPoints', points);\n return this;\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n let pxPoints;\n let pos = this.computePosition(0);\n\n if (pxPoints = this.getProp('pxPoints')) {\n\n pxPoints = ' M ' + pos.x + ' ' + pos.y + ' ' + pxPoints;\n this.setDom('d', pxPoints);\n } else if (this.points) {\n\n var xAxis, yAxis;\n\n if (this.serie) {\n\n xAxis = this.serie.getXAxis();\n yAxis = this.serie.getYAxis();\n } else if (this.xAxis && this.yAxis) {\n\n xAxis = this.xAxis;\n yAxis = this.yAxis;\n }\n\n this.setDom('d', 'M ' + this.points.map(function (p) {\n return xAxis.getPx(p[0]) + ', ' + yAxis.getPx(p[1]);\n }).join(' L '));\n }\n\n this.changed();\n return true;\n }\n}\n\n/**\n * Displays an integral with NMR style\n * @extends ShapeSurfaceUnderCurve\n */\nclass ShapeNMRIntegral extends Shape {\n\n constructor(graph, options) {\n\n super(graph, options);\n\n this.nbHandles = 2;\n }\n\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'path');\n this._domShadow = document.createElementNS(this.graph.ns, 'path');\n this._domShadow.jsGraphIsShape = this;\n this._dom.setAttribute('pointer-events', 'stroke');\n this._domShadow.setAttribute('pointer-events', 'stroke');\n this._domShadow.setAttribute('stroke-width', '12');\n this._domShadow.setAttribute('fill', 'transparent');\n this._domShadow.setAttribute('stroke', 'transparent');\n this.group.appendChild(this._domShadow);\n }\n\n initImpl() {\n this.setFillColor('transparent');\n this.setStrokeColor('black');\n }\n\n createHandles() {\n\n this._createHandles(2, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white'\n });\n\n this.handles[1].setAttribute('fill', 'red');\n }\n\n xor(a, b) {\n return a && !b || !a && b;\n }\n\n applyPosition() {\n\n let x,\n y,\n xVal,\n yVal,\n axis = this.getAxis(),\n points = [];\n\n let currentLine = '',\n baseLine = this.getProp('baseLine', 0) || 300,\n ratio;\n\n if (!this.serie) {\n throw 'No serie exists for this shape';\n }\n /*\n this.sortPositions( ( a, b ) => {\n return a.x - b.x;\n } );\n */\n let pos1 = this.getPosition(0);\n let pos2 = this.getPosition(1);\n\n if (pos1.x < this.serie.getXAxis().getCurrentMin() && pos2.x < this.serie.getXAxis().getCurrentMin() || pos1.x > this.serie.getXAxis().getCurrentMax() && pos2.x > this.serie.getXAxis().getCurrentMax()) {\n this.setDom('d', '');\n this._domShadow.setAttribute('d', '');\n\n this.hideLabel(0);\n return false;\n }\n\n this.showLabel(0);\n\n let sum = 0;\n\n let j;\n let waveform = this.serie.getWaveform();\n\n if (!waveform) {\n return;\n }\n\n let index1 = waveform.getIndexFromX(pos1[axis], true, Math.floor),\n index2 = waveform.getIndexFromX(pos2[axis], true, Math.ceil),\n index3,\n flipped = false;\n\n if (index1 == index2) {\n // At least one px please !\n if (waveform.getReductionType() == 'aggregate') {\n index2 += 4; // Aggregated state\n } else {\n index2++; // Non aggregated state\n }\n }\n\n if (index2 < index1) {\n index3 = index1;\n index1 = index2;\n index2 = index3;\n flipped = true;\n }\n\n let firstX, firstY, firstXVal, firstYVal, lastX, lastXVal, lastY, lastYVal;\n let data = waveform.getDataInUse();\n\n let condition, incrementation;\n\n if (waveform.getReductionType() == 'aggregate') {\n \n }\n\n if (waveform.getXMonotoneousAscending() && // Ascending\n 1 == 1 || !waveform.getXMonotoneousAscending() && // Ascending\n 1 == 2) {\n\n j = index2;\n condition = true;\n incrementation = -1;\n } else {\n\n j = index1;\n condition = false;\n incrementation = 1;\n }\n\n for (; condition ? j >= index1 : j <= index2; j += incrementation) {\n\n xVal = waveform.getX(j, true);\n yVal = waveform.getY(j, true);\n\n x = this.serie.getX(xVal);\n y = this.serie.getY(yVal);\n\n /*\n if ( ! normalSums && j % 4 == 0 && j >= index1 && data.sums ) { // Sums are located every 4 element\n sum += data.sums[ j ];// * ( waveform.getX( j, true ) - waveform.getX( j - 3, true ) ); // y * (out-in)\n } else if( normalSums ) {\n */\n sum += waveform.getY(j, true); // * ( waveform.getX( j, true ) - waveform.getX( j - 1, true ) ); // y * (out-in)\n //}\n\n if (!firstX) {\n\n firstX = x;\n firstY = y;\n firstXVal = waveform.getX(j);\n firstYVal = waveform.getY(j);\n }\n\n if (lastX == undefined) {\n\n lastX = x;\n lastXVal = waveform.getX(j);\n lastYVal = waveform.getY(j);\n continue;\n }\n\n lastX = x;\n points.push([x, y, sum]);\n lastXVal = xVal;\n }\n\n lastXVal = false;\n lastYVal = false;\n lastX = false;\n if (sum == 0) {\n sum = 1;\n }\n\n this._sumVal = waveform.integrate(pos1.x, pos2.x);\n\n if (!this.ratio) {\n // 150px / unit\n ratio = 200 / sum;\n } else {\n // Already existing\n ratio = this.ratio * (this.sumVal / sum);\n }\n let py;\n\n if (points.length == 0) {\n return;\n }\n\n for (var i = 0, l = points.length; i < l; i++) {\n\n py = baseLine - points[i][2] * ratio;\n\n if (i > 0 && (points[i - 1][2] > sum / 2 && points[i][2] <= sum / 2 || points[i - 1][2] < sum / 2 && points[i][2] >= sum / 2)) {\n\n let pos = baseLine - (points[i - 1][2] + points[i][2]) / 2 * ratio;\n\n this.setPosition({\n x: points[i][0] + 'px',\n y: pos + 'px'\n\n }, 3);\n\n this.setLabelPosition(this.getPosition(3), 0);\n }\n\n currentLine += ' L ' + points[i][0] + ', ' + py + ' ';\n\n this.lastPointX = points[i][0];\n this.lastPointY = py;\n }\n\n this.points = points;\n this._sum = sum;\n\n if (this.serie.isFlipped()) {\n currentLine = ' M ' + baseLine + ', ' + firstX + ' ' + currentLine;\n } else {\n currentLine = ' M ' + firstX + ', ' + baseLine + ' ' + currentLine;\n }\n\n this.firstPointX = firstX;\n this.firstPointY = baseLine;\n\n this.setDom('d', currentLine);\n this._domShadow.setAttribute('d', currentLine);\n\n this.firstX = firstX;\n this.firstY = firstY;\n /*\n if ( this._selected ) {\n this.select();\n }\n this.setHandles();*/\n\n this.ratioLabel && this.updateIntegralValue(this.ratioLabel) || this.updateLabels();\n\n this.changed();\n this.handleCondition = !this.xor(incrementation == -1, flipped);\n this.setHandles();\n\n this.updateIntegralValue();\n\n return true;\n }\n\n updateIntegralValue(ratioLabel = this.ratioLabel, forceValue) {\n\n if (ratioLabel) {\n this.ratioLabel = ratioLabel;\n }\n\n if (forceValue !== undefined) {\n this.ratioLabel = forceValue / this.sumVal;\n }\n\n this.setLabelText(ratioLabel ? (Math.round(100 * this.sumVal * ratioLabel) / 100).toPrecision(3) : 'N/A', 0);\n this.updateLabels();\n return this.ratioLabel;\n }\n\n getAxis() {\n return this._data.axis || 'x';\n }\n\n /**\n * User to screen coordinate transform. In (unit)/(px), (unit) being the unit of the integral (x * y)\n * @type {Number}\n */\n set ratio(r) {\n this._ratio = r;\n }\n\n get ratio() {\n return this._ratio;\n }\n\n get sum() {\n return this._sum;\n }\n\n get sumVal() {\n return this._sumVal;\n }\n\n selectStyle() {\n this.setDom('stroke-width', '2px');\n }\n\n selectHandles() {} // Cancel areaundercurve\n\n setHandles() {\n\n if (this.points == undefined) {\n return;\n }\n\n if (!this.isSelected()) {\n return;\n }\n\n this.addHandles();\n\n if (this.handleCondition) {\n\n this.handles[1].setAttribute('x', this.firstPointX);\n this.handles[1].setAttribute('y', this.firstPointY);\n this.handles[2].setAttribute('x', this.lastPointX);\n this.handles[2].setAttribute('y', this.lastPointY);\n } else {\n\n this.handles[2].setAttribute('x', this.firstPointX);\n this.handles[2].setAttribute('y', this.firstPointY);\n this.handles[1].setAttribute('x', this.lastPointX);\n this.handles[1].setAttribute('y', this.lastPointY);\n }\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n if (this.isLocked()) {\n return;\n }\n\n var pos = this.getPosition(0);\n var pos2 = this.getPosition(1);\n\n var posToChange;\n\n if (this.handleSelected == 1) {\n\n posToChange = pos;\n } else if (this.handleSelected == 2) {\n\n posToChange = pos2;\n }\n\n if (posToChange) {\n\n if (!this._data.vertical) {\n posToChange.deltaPosition('x', deltaX, this.getXAxis());\n }\n }\n\n if (this.moving) {\n\n // If the pos2 is defined by a delta, no need to move them\n if (pos.x) {\n pos.deltaPosition('x', deltaX, this.getXAxis());\n }\n\n // If the pos2 is defined by a delta, no need to move them\n if (pos2.x) {\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n }\n }\n\n if (this.rectEvent) {\n this.setEventReceptacle();\n }\n\n this.redraw();\n this.changed();\n\n return true;\n }\n}\n\n/**\n * Represents a rectangle that extends the Shape class\n * @class ShapeRectangle\n * @augments Shape\n * @see Graph#newShape\n */\nclass ShapeRectangle extends Shape {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'rect');\n\n if (!this.getStrokeColor()) {\n this.setStrokeColor('black');\n }\n\n if (!this.getStrokeWidth()) {\n this.setStrokeWidth(1);\n }\n\n if (!this.getFillColor()) {\n this.setFillColor('transparent');\n }\n\n return this;\n }\n\n /**\n * Creates the Handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {\n if (!this.hasHandles()) {\n return;\n }\n\n /*\n this._data.handles = this._data.handles || {\n type: 'corners'\n };\n */\n\n var handles = this.getProp('handles');\n\n if (typeof handles != 'object') {\n handles = {};\n }\n\n if (!handles.type) {\n handles.type = 'corners';\n }\n\n switch (handles.type) {\n\n case 'sides':\n\n extend(handles, {\n sides: {\n top: true,\n bottom: true,\n left: true,\n right: true\n }\n });\n\n var j = 0;\n for (var i in handles.sides) {\n if (handles.sides[i]) {\n j++;\n }\n }\n\n this._createHandles(j, 'g').map(function (g) {\n\n var r = document.createElementNS(self.graph.ns, 'rect');\n r.setAttribute('x', '-3');\n r.setAttribute('width', '6');\n r.setAttribute('y', '-6');\n r.setAttribute('height', '12');\n r.setAttribute('stroke', 'black');\n r.setAttribute('fill', 'white');\n r.setAttribute('cursor', 'pointer');\n\n g.appendChild(r);\n });\n\n var j = 1;\n\n for (var i in handles.sides) {\n if (handles.sides[i]) {\n this.handles[i] = this['handle' + j];\n this.sides[j] = i;\n j++;\n }\n }\n\n break;\n\n case 'corners':\n this._createHandles(4, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white'\n });\n\n if (this.handles) {\n this.handles[2].setAttribute('cursor', 'nesw-resize');\n this.handles[4].setAttribute('cursor', 'nesw-resize');\n\n this.handles[1].setAttribute('cursor', 'nwse-resize');\n this.handles[3].setAttribute('cursor', 'nwse-resize');\n }\n\n break;\n\n case 'seamlessX':\n\n this._createHandles(2, 'rect', {\n transform: 'translate(-3 -3)',\n stroke: 'transparent',\n fill: 'transparent',\n width: '20px',\n cursor: 'ew-resize'\n });\n\n break;\n }\n\n super.createHandles();\n\n return this;\n }\n\n /**\n * Updates the position\n * @memberof ShapeRectangle\n * @private\n * @return {Shape} The current shape\n */\n applyPosition() {\n\n var pos = this.computePosition(0),\n pos2 = this.computePosition(1),\n x,\n y,\n width,\n height;\n\n if (pos.x < pos2.x) {\n x = pos.x;\n width = pos2.x - pos.x;\n } else {\n x = pos2.x;\n width = pos.x - pos2.x;\n }\n\n if (pos.y < pos2.y) {\n y = pos.y;\n height = pos2.y - pos.y;\n } else {\n y = pos2.y;\n height = pos.y - pos2.y;\n }\n\n this.currentX = x;\n this.currentY = y;\n this.currentW = width;\n this.currentH = height;\n\n if (!isNaN(x) && !isNaN(y) && x !== false && y !== false) {\n\n this.setDom('width', width);\n this.setDom('height', height);\n this.setDom('x', x);\n this.setDom('y', y);\n\n this.setHandles();\n this.updateMask();\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Implements mouse move event\n * @private\n * @return {Shape} The current shape\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n var handles = this.getProp('handles');\n\n if (!this.moving && !this.handleSelected) {\n return;\n }\n\n var pos = this.getPosition(0);\n var pos2 = this.getPosition(1);\n\n var invX = this.getXAxis().isFlipped(),\n invY = this.getYAxis().isFlipped(),\n posX = pos.x,\n posY = pos.y,\n pos2X = pos2.x,\n pos2Y = pos2.y;\n\n if (this.moving) {\n\n pos.deltaPosition('x', deltaX, this.getXAxis());\n pos.deltaPosition('y', deltaY, this.getYAxis());\n\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n } else {\n\n switch (handles.type) {\n\n case 'seamlessX':\n // Do nothing for now\n\n switch (this.handleSelected) {\n\n case 1:\n pos.deltaPosition('x', deltaX, this.getXAxis());\n break;\n\n case 2:\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n break;\n }\n\n break;\n\n case 'sides':\n // Do nothing for now\n\n switch (this.sides[this.handleSelected]) {\n\n case 'left':\n pos.deltaPosition('x', deltaX, this.getXAxis());\n break;\n\n case 'right':\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n break;\n\n case 'top':\n pos.deltaPosition('y', deltaY, this.getYAxis());\n break;\n\n case 'bottom':\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n break;\n\n }\n\n break;\n\n case 'corners':\n default:\n\n if (this.handleSelected == 1) {\n\n pos.deltaPosition('x', deltaX, this.getXAxis());\n pos.deltaPosition('y', deltaY, this.getYAxis());\n } else if (this.handleSelected == 2) {\n\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n pos.deltaPosition('y', deltaY, this.getYAxis());\n } else if (this.handleSelected == 3) {\n\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n } else if (this.handleSelected == 4) {\n\n pos.deltaPosition('x', deltaX, this.getXAxis());\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n }\n\n break;\n\n }\n }\n\n this.redraw();\n this.changed();\n this.setHandles();\n\n return true;\n }\n\n /**\n * Places handles properly\n * @private\n * @return {Shape} The current shape\n */\n setHandles() {\n\n if (this.isLocked() || !this.isSelectable() && !this._staticHandles) {\n return;\n }\n\n if (!this.handlesInDom) {\n return;\n }\n\n var pos = this.computePosition(0);\n var pos2 = this.computePosition(1);\n\n var handles = this.getProp('handles');\n\n switch (handles.type) {\n\n case 'seamlessX':\n\n if (this.handles[1]) {\n this.handles[1].setAttribute('transform', 'translate(-10) translate(' + pos.x + ')');\n this.handles[1].setAttribute('height', Math.abs(pos2.y - pos.y));\n this.handles[1].setAttribute('y', Math.min(pos2.y, pos.y));\n }\n\n if (this.handles[2]) {\n this.handles[2].setAttribute('transform', 'translate(-10) translate(' + pos2.x + ')');\n this.handles[2].setAttribute('height', Math.abs(pos2.y - pos.y));\n this.handles[2].setAttribute('y', Math.min(pos2.y, pos.y));\n }\n\n break;\n\n case 'sides':\n\n if (this.handles.left) {\n this.handles.left.setAttribute('transform', 'translate(' + this.currentX + ' ' + (this.currentY + this.currentH / 2) + ')');\n }\n\n if (this.handles.right) {\n this.handles.right.setAttribute('transform', 'translate( ' + (this.currentX + this.currentW) + ' ' + (this.currentY + this.currentH / 2) + ')');\n }\n\n if (this.handles.top) {\n this.handles.top.setAttribute('transform', 'translate( ' + (this.currentX + this.currentW / 2) + ' ' + this.currentY + ')');\n }\n\n if (this.handles.bottom) {\n this.handles.bottom.setAttribute('transform', 'translate( ' + (this.currentX + this.currentW / 2) + ' ' + (this.currentY + this.currentH) + ')');\n }\n\n break;\n\n case 'corners':\n default:\n\n this.handles[1].setAttribute('x', pos.x);\n this.handles[1].setAttribute('y', pos.y);\n\n this.handles[2].setAttribute('x', pos2.x);\n this.handles[2].setAttribute('y', pos.y);\n\n this.handles[3].setAttribute('x', pos2.x);\n this.handles[3].setAttribute('y', pos2.y);\n\n this.handles[4].setAttribute('x', pos.x);\n this.handles[4].setAttribute('y', pos2.y);\n\n break;\n\n }\n }\n\n}\n\nclass ShapePeakIntegration2D extends ShapeRectangle {\n\n constructor(graph, options) {\n\n super(graph, options);\n this.nbHandles = 4;\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'rect');\n this._dom.element = this;\n\n this.createHandles(this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n\n redrawImpl() {\n\n this.setPosition();\n this.setHandles();\n this.setBindableToDom(this._dom);\n }\n\n}\n\n/**\n * Displays a cross\n * @extends Shape\n */\nclass ShapeCross extends Shape {\n\n constructor(graph, options) {\n super(graph, options);\n this.nbHandles = 1;\n }\n\n /**\n * Width of the cross, also available from the constructor\n * @type {Number} width\n */\n get width() {\n return this.options.width || 10;\n }\n\n set width(l) {\n this.options.width = l;\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'path');\n this._dom.setAttribute('d', 'M -' + this.width / 2 + ' 0 h ' + this.width + ' m -' + this.width / 2 + ' -' + this.width / 2 + ' v ' + this.width + '');\n }\n\n createHandles() {\n\n this._createHandles(this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n applyPosition() {\n\n var position = this.calculatePosition(0);\n if (!position || !position.x || !position.y) {\n return;\n }\n\n this.setDom('transform', 'translate( ' + position.x + ', ' + position.y + ')');\n\n this.currentPos1x = position.x;\n this.currentPos1y = position.y;\n\n return true;\n }\n\n redrawImpl() {\n\n this.setHandles();\n }\n\n handleCreateImpl() {}\n\n handleMouseDownImpl(e) {\n\n this.moving = true;\n\n return true;\n }\n\n handleMouseUpImpl() {\n\n this.triggerChange();\n return true;\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n if (this.isLocked()) {\n return;\n }\n\n var pos = this.getFromData('pos');\n\n if (this.moving) {\n\n pos.x = this.graph.deltaPosition(pos.x, deltaX, this.getXAxis());\n pos.y = this.graph.deltaPosition(pos.y, deltaY, this.getYAxis());\n }\n\n this.redrawImpl();\n\n return true;\n }\n\n setHandles() {\n\n if (!this.areHandlesInDom()) {\n return;\n }\n\n if (isNaN(this.currentPos1x)) {\n return;\n }\n\n this.handles[1].setAttribute('x', this.currentPos1x);\n this.handles[1].setAttribute('y', this.currentPos1y);\n }\n\n selectStyle() {\n this.setDom('stroke', 'red');\n this.setDom('stroke-width', '2');\n }\n}\n\n/**\n * Shows a horizontal line with three little vertical bars. Very useful to demonstrate a peak start, end and middle value\n * @extends ShapeLine\n */\nclass ShapePeakBoundaries extends ShapeLine {\n\n constructor(graph) {\n super(graph);\n this.lineHeight = 6;\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'line');\n this.line1 = document.createElementNS(this.graph.ns, 'line');\n this.line2 = document.createElementNS(this.graph.ns, 'line');\n this.line3 = document.createElementNS(this.graph.ns, 'line');\n\n this.rectBoundary = document.createElementNS(this.graph.ns, 'path');\n\n this.rectBoundary.setAttribute('fill', 'transparent');\n this.rectBoundary.setAttribute('stroke', 'none');\n this.rectBoundary.setAttribute('pointer-events', 'fill');\n\n this.rectBoundary.jsGraphIsShape = true;\n\n this.group.appendChild(this.rectBoundary);\n this.group.appendChild(this.line1);\n this.group.appendChild(this.line2);\n this.group.appendChild(this.line3);\n this._dom.element = this;\n }\n\n createHandles() {\n this._createHandles(3, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n\n redrawImpl() {\n\n this.line1.setAttribute('stroke', this.getStrokeColor());\n this.line2.setAttribute('stroke', this.getStrokeColor());\n this.line3.setAttribute('stroke', this.getStrokeColor());\n\n this.line1.setAttribute('stroke-width', this.getStrokeWidth());\n this.line2.setAttribute('stroke-width', this.getStrokeWidth());\n this.line3.setAttribute('stroke-width', this.getStrokeWidth());\n\n this.setHandles();\n this.redrawLines();\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Redraws the vertical lines according to the positions.\n * Position 0 is the left line, position 1 is the right line and position 2 is the center line\n * @returns {ShapePeakBoundaries} The shape instance\n */\n redrawLines() {\n\n var posLeft = this.computePosition(0);\n var posRight = this.computePosition(1);\n var posCenter = this.computePosition(2);\n\n if (posLeft.x && posRight.x && posCenter.x && this.posYPx) {\n\n var height = this.lineHeight;\n this.rectBoundary.setAttribute('d', 'M ' + posLeft.x + ' ' + (this.posYPx - height) + ' v ' + 2 * height + ' H ' + posRight.x + ' v ' + -2 * height + 'z');\n this.line1.setAttribute('x1', posLeft.x);\n this.line1.setAttribute('x2', posLeft.x);\n\n this.line2.setAttribute('x1', posRight.x);\n this.line2.setAttribute('x2', posRight.x);\n\n this.line3.setAttribute('x1', posCenter.x);\n this.line3.setAttribute('x2', posCenter.x);\n\n this._dom.setAttribute('x1', posLeft.x);\n this._dom.setAttribute('x2', posRight.x);\n\n this.redrawY(height);\n }\n\n return this;\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Redraws the vertical positions of the shape\n * @returns {ShapePeakBoundaries} The shape instance\n */\n redrawY() {\n\n if (!this.posYPx) {\n return this;\n }\n\n var height = this.lineHeight;\n\n this.line1.setAttribute('y1', this.posYPx - height);\n this.line1.setAttribute('y2', this.posYPx + height);\n\n this.line2.setAttribute('y1', this.posYPx - height);\n this.line2.setAttribute('y2', this.posYPx + height);\n\n this.line3.setAttribute('y1', this.posYPx - height);\n this.line3.setAttribute('y2', this.posYPx + height);\n\n this._dom.setAttribute('y1', this.posYPx);\n this._dom.setAttribute('y2', this.posYPx);\n\n return this;\n }\n\n setHandles() {\n\n if (!this.posYPx) {\n return;\n }\n\n var posLeft = this.computePosition(0);\n var posRight = this.computePosition(1);\n var posCenter = this.computePosition(2);\n\n if (posLeft.x && posRight.x && posCenter.x) {\n\n this.handles[1].setAttribute('x', posLeft.x);\n this.handles[1].setAttribute('y', this.posYPx);\n\n this.handles[2].setAttribute('x', posRight.x);\n this.handles[2].setAttribute('y', this.posYPx);\n\n this.handles[3].setAttribute('x', posCenter.x);\n this.handles[3].setAttribute('y', this.posYPx);\n }\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Sets the y position of the shape\n * @param {Number} y - The y position in px\n * @returns {ShapePeakBoundaries} The shape instance\n */\n setY(y) {\n this.posYPx = y;\n return this;\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Sets the height of the peak lines\n * @param {Number} height - The height of the lines in px\n * @returns {ShapePeakBoundaries} The shape instance\n */\n setLineHeight(height) {\n this.lineHeihgt = height;\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY) {\n\n if (this.isLocked()) {\n return;\n }\n\n var posLeft = this.getPosition(0);\n var posRight = this.getPosition(1);\n var posCenter = this.getPosition(2);\n\n switch (this.handleSelected) {\n\n case 1:\n // left\n posLeft.deltaPosition('x', deltaX, this.getXAxis());\n\n if (Math.abs(posCenter.x - posRight.x) > Math.abs(posRight.x - posLeft.x) || Math.abs(posCenter.x - posLeft.x) > Math.abs(posRight.x - posLeft.x)) {\n posCenter.x = posLeft.x + (posRight.x - posLeft.x) * 0.1;\n }\n break;\n\n case 2:\n // left\n\n posRight.deltaPosition('x', deltaX, this.getXAxis());\n\n if (Math.abs(posCenter.x - posRight.x) > Math.abs(posRight.x - posLeft.x) || Math.abs(posCenter.x - posLeft.x) > Math.abs(posRight.x - posLeft.x)) {\n posCenter.x = posRight.x + (posLeft.x - posRight.x) * 0.1;\n }\n\n break;\n\n case 3:\n // left\n\n posCenter.deltaPosition('x', deltaX, this.getXAxis());\n\n if (Math.abs(posCenter.x - posRight.x) > Math.abs(posRight.x - posLeft.x) || Math.abs(posCenter.x - posLeft.x) > Math.abs(posRight.x - posLeft.x)) {\n return;\n }\n\n break;\n\n }\n\n this.setLabelPosition({\n y: this.getLabelPosition(0).y,\n x: posCenter.x\n });\n\n this.updateLabels();\n this.redrawLines();\n this.setHandles();\n }\n\n applyPosition() {\n\n this.redrawLines();\n return true;\n }\n\n}\n\n/**\n * Represents a line\n * @extends Shape\n * @see Graph#newShape\n */\nclass ShapeHTML extends Shape {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElement('div');\n // this._dom.setAttribute( \"requiredExtensions\", \"http://www.w3.org/1999/xhtml\" );\n\n this._dom.setAttribute('style', 'position: absolute');\n let div = document.createElement('div');\n this._dom.appendChild(div);\n this.div = div;\n }\n\n /**\n * Creates the handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {}\n\n setHeight(height) {\n this.setProp('height', height);\n }\n\n setWidth(width) {\n this.setProp('width', width);\n }\n\n setContent(content) {\n this.setProp('content', content);\n }\n\n setRenderer(method) {\n this._renderer = method;\n }\n\n redraw() {\n\n if (this._renderer) {\n this._renderer(this.div);\n } else {\n this.div.innerHTML = this.getProp('content');\n }\n\n super.redraw(...arguments);\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n var position = this.calculatePosition(0);\n\n if (!position || !isNumeric$1(position.x) || !isNumeric$1(position.y)) {\n return;\n }\n this._dom.style.left = position.x + 'px';\n this._dom.style.top = position.y + 'px';\n\n this.currentPosX = position.x;\n this.currentPosY = position.y;\n\n return true;\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n return true;\n }\n\n /**\n * Sets the handle position\n * @private\n */\n setHandles() {}\n\n isHTML() {\n return true;\n }\n}\n\n/**\n * Represents a plugin\n * @interface\n */\nclass Plugin extends EventEmitter {\n\n static default() {\n return {};\n }\n\n constructor(options) {\n super(...arguments);\n\n this.options = Object.assign({}, Plugin.default(), this.constructor.default(), options);\n }\n\n /**\n * Init function called by jsGraph on load\n */\n init(graph) {\n this.graph = graph;\n }\n\n /**\n * Handles the mousedown event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseDown() {}\n\n /**\n * Handles the mouseup event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseUp() {}\n\n /**\n * Handles the mousemove event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseMove() {}\n}\n\n/**\n * Constructor for the drag plugin. Do not use this constructor directly.\n * @class PluginDrag\n * @implements Plugin\n */\nclass PluginDrag extends Plugin {\n\n static default() {\n return {\n\n dragX: true,\n dragY: true,\n persistanceX: false,\n persistanceY: false\n\n };\n }\n\n /**\n * @private\n */\n init(graph) {\n\n this.graph = graph;\n this.time = null;\n this.totaltime = 2000;\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, target) {\n this._draggingX = x;\n this._draggingY = y;\n\n this._lastDraggingX = this._draggingX;\n this._lastDraggingY = this._draggingY;\n\n this.stopAnimation = true;\n\n this.moved = false;\n\n return true;\n }\n\n /**\n * @memberof PluginDrag\n * @private\n */\n onMouseMove(graph, x, y, e, target) {\n\n var deltaX = x - this._draggingX;\n var deltaY = y - this._draggingY;\n\n if (this.options.dragX) {\n graph._applyToAxes(function (axis) {\n axis.setCurrentMin(axis.getVal(axis.getMinPx() - deltaX));\n axis.setCurrentMax(axis.getVal(axis.getMaxPx() - deltaX));\n }, false, true, false);\n }\n\n if (this.options.dragY) {\n\n graph._applyToAxes(function (axis) {\n axis.setCurrentMin(axis.getVal(axis.getMinPx() - deltaY));\n axis.setCurrentMax(axis.getVal(axis.getMaxPx() - deltaY));\n }, false, false, true);\n }\n\n this._lastDraggingX = this._draggingX;\n this._lastDraggingY = this._draggingY;\n\n this._draggingX = x;\n this._draggingY = y;\n\n this.moved = true;\n\n this.time = Date.now();\n\n this.emit('dragging');\n\n graph.draw(true);\n }\n\n onMouseUp(graph, x, y, e, target) {\n\n var dt = Date.now() - this.time;\n\n if (x == this._lastDraggingX || y == this._lastDraggingY) {\n\n if (this.moved) {\n this.emit('dragged');\n }\n\n return;\n }\n\n this.speedX = (x - this._lastDraggingX) / dt;\n this.speedY = (y - this._lastDraggingY) / dt;\n\n if (isNaN(this.speedX) || isNaN(this.speedY)) {\n this.emit('dragged');\n return;\n }\n\n graph._applyToAxes(function (axis) {\n axis._pluginDragMin = axis.getCurrentMin();\n axis._pluginDragMax = axis.getCurrentMax();\n }, false, true, true);\n\n this.stopAnimation = false;\n this.accelerationX = -this.speedX / this.totaltime;\n this.accelerationY = -this.speedY / this.totaltime;\n\n if (this.options.persistanceX || this.options.persistanceY) {\n\n this._persistanceMove(graph);\n } else {\n\n this.emit('dragged');\n }\n }\n\n _persistanceMove(graph) {\n\n var self = this;\n\n if (self.stopAnimation) {\n self.emit('dragged');\n return;\n }\n\n window.requestAnimationFrame(function () {\n\n var dt = Date.now() - self.time;\n var dx = (0.5 * self.accelerationX * dt + self.speedX) * dt;\n var dy = (0.5 * self.accelerationY * dt + self.speedY) * dt;\n\n if (self.options.persistanceX) {\n\n graph._applyToAxes(function (axis) {\n\n axis.setCurrentMin(-axis.getRelVal(dx) + axis._pluginDragMin);\n axis.setCurrentMax(-axis.getRelVal(dx) + axis._pluginDragMax);\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n }, false, true, false);\n }\n\n if (self.options.persistanceY) {\n\n graph._applyToAxes(function (axis) {\n\n axis.setCurrentMin(-axis.getRelVal(dy) + axis._pluginDragMin);\n axis.setCurrentMax(-axis.getRelVal(dy) + axis._pluginDragMax);\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n }, false, false, true);\n }\n\n graph.draw();\n\n if (dt < self.totaltime) {\n self.emit('dragging');\n self._persistanceMove(graph);\n } else {\n self.emit('dragged');\n }\n });\n }\n}\n\n/**\n * @class PluginShape\n * @implements Plugin\n */\nclass PluginShape extends Plugin {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n return {};\n }\n\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n\n super.init(graph, options);\n this.shapeType = options.type;\n }\n\n /**\n * Sets the shape that is created by the plugin\n * @param {String} shapeType - The type of the shape\n */\n setShape(shapeType) {\n this.shapeInfo.shapeType = shapeType;\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, target) {\n\n if (!this.shapeType && !this.options.url) {\n return;\n }\n\n var self = this;\n\n var xVal, yVal;\n\n this.count = this.count || 0;\n\n x -= graph.getPaddingLeft();\n y -= graph.getPaddingTop();\n\n xVal = graph.getXAxis().getVal(x);\n yVal = graph.getYAxis().getVal(y);\n\n var shapeInfo = {\n\n position: [{\n x: xVal,\n y: yVal\n }, {\n x: xVal,\n y: yVal\n }],\n\n onChange: function (newData) {\n graph.triggerEvent('onAnnotationChange', newData);\n },\n\n locked: false,\n selectable: true,\n resizable: true,\n movable: true\n };\n\n let shapeProperties = this.options.properties;\n\n extend(true, shapeInfo, this.options);\n\n this.emit('beforeNewShape', e, shapeInfo);\n\n if (this.graph.prevent(false)) {\n return;\n }\n\n var shape = graph.newShape(shapeInfo.type, shapeInfo, false, shapeProperties);\n\n this.emit('createdShape', e, shape);\n\n if (shape) {\n self.currentShape = shape;\n self.currentShapeEvent = e;\n }\n\n graph.once('mouseUp', () => {\n console.log(this.currentShape);\n if (!this.currentShape) {\n // The mouse has moved\n self.emit('newShape', e, shape);\n }\n });\n }\n\n /**\n * @private\n */\n onMouseMove(graph, x, y, e) {\n\n if (this.currentShape) {\n console.log('mv');\n this.count++;\n\n var shape = this.currentShape;\n\n this.currentShape = false;\n\n if (graph.selectedSerie && !shape.serie) {\n shape.setSerie(graph.selectedSerie);\n }\n\n shape.resizing = true;\n\n if (shape.options && shape.options.onCreate) {\n shape.options.onCreate.call(shape);\n }\n\n shape.draw();\n graph.selectShape(shape);\n shape.handleMouseDown(this.currentShapeEvent, true);\n shape.handleSelected = this.options.handleSelected || 1;\n shape.handleMouseMove(e, true);\n }\n }\n\n /**\n * @private\n */\n onMouseUp() {\n\n if (this.currentShape) {\n // No need to kill it as it hasn't been actually put in the dom right now\n\n // Norman 30 July 2017: Yes but it's added in the jsGraph stack. We need to remove it. See #176\n // From now on killing the shape will result in removing it from the stack as well.\n this.currentShape.kill();\n this.currentShape = false;\n }\n }\n\n}\n\n/**\n * @extends Plugin\n */\nclass PluginSelectScatter extends Plugin {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n return {};\n }\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n\n this._path = document.createElementNS(graph.ns, 'path');\n\n setAttributeTo(this._path, {\n 'display': 'none',\n 'fill': 'rgba(0,0,0,0.1)',\n 'stroke': 'rgba(0,0,0,1)',\n 'shape-rendering': 'crispEdges',\n 'x': 0,\n 'y': 0,\n 'height': 0,\n 'width': 0,\n 'd': ''\n });\n\n this.graph = graph;\n\n graph.dom.appendChild(this._path);\n }\n\n /**\n * Assigns the scatter serie that should be selected to the plugin\n * @param {ScatterSerie} serie - The serie\n * @return {PluginSelectScatter} The current plugin instance\n */\n setSerie(serie) {\n this.serie = serie;\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, mute) {\n\n if (!this.serie) {\n return;\n }\n\n this.path = 'M ' + x + ' ' + y + ' ';\n this.currentX = x;\n this.currentY = y;\n\n this.xs = [this.serie.getXAxis().getVal(x - graph.getPaddingLeft())];\n this.ys = [this.serie.getYAxis().getVal(y - graph.getPaddingTop())];\n this._path.setAttribute('d', '');\n this._path.setAttribute('display', 'block');\n }\n\n /**\n * @private\n */\n onMouseMove(graph, x, y, e, mute) {\n\n if (Math.pow(x - this.currentX, 2) + Math.pow(y - this.currentY, 2) > 25) {\n\n this.path += ' L ' + x + ' ' + y + ' ';\n this.currentX = x;\n this.currentY = y;\n\n this.xs.push(this.serie.getXAxis().getVal(x - graph.getPaddingLeft()));\n this.ys.push(this.serie.getYAxis().getVal(y - graph.getPaddingTop()));\n\n this._path.setAttribute('d', this.path + ' z');\n\n this.findPoints();\n }\n }\n\n /**\n * @private\n */\n findPoints() {\n\n var data = this.serie.waveform;\n var selected = [];\n var counter = 0,\n j2;\n for (var i = 0, l = data.getLength(); i < l; i += 1) {\n\n counter = 0;\n for (var j = 0, k = this.xs.length; j < k; j += 1) {\n\n if (j == k - 1) {\n j2 = 0;\n } else {\n j2 = j + 1;\n }\n\n if (this.ys[j] < data.getY(i) && this.ys[j2] > data.getY(i) || this.ys[j] > data.getY(i) && this.ys[j2] < data.getY(i)) {\n\n if (data.getX(i) > (data.getY(i) - this.ys[j]) / (this.ys[j2] - this.ys[j]) * (this.xs[j2] - this.xs[j]) + this.xs[j]) {\n counter++;\n }\n }\n }\n\n if (counter % 2 == 1) {\n selected.push(i);\n this.serie.selectPoint(i, true, 'selected');\n } else {\n this.serie.unselectPoint(i);\n }\n }\n\n this.selected = selected;\n this.emit('selectionProcess', selected);\n }\n\n /**\n * @private\n */\n onMouseUp(graph, x, y, e) {\n this._path.setAttribute('display', 'none');\n this.emit('selectionEnd', this.selected);\n }\n\n}\n\n/**\n * @class PluginZoom\n * @implements Plugin\n */\nclass PluginZoom extends Plugin {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n\n return {\n 'axes': 'all'\n };\n }\n\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n\n this._zoomingGroup = document.createElementNS(graph.ns, 'g');\n this._zoomingSquare = document.createElementNS(graph.ns, 'rect');\n this._zoomingSquare.setAttribute('display', 'none');\n\n setAttributeTo(this._zoomingSquare, {\n 'display': 'none',\n 'fill': 'rgba(171,12,12,0.2)',\n 'stroke': 'rgba(171,12,12,1)',\n 'shape-rendering': 'crispEdges',\n 'x': 0,\n 'y': 0,\n 'height': 0,\n 'width': 0,\n 'pointer-events': 'none'\n });\n\n this.graph = graph;\n graph.groupEvent.appendChild(this._zoomingGroup);\n this._zoomingGroup.appendChild(this._zoomingSquare);\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, mute) {\n\n var zoomMode = this.options.zoomMode;\n\n if (!zoomMode) {\n return;\n }\n\n this._zoomingMode = zoomMode;\n\n if (x === undefined) {\n this._backedUpZoomMode = this._zoomingMode;\n this._zoomingMode = 'y';\n x = 0;\n }\n\n if (y === undefined) {\n this._backedUpZoomMode = this._zoomingMode;\n this._zoomingMode = 'x';\n y = 0;\n }\n\n this._zoomingXStart = x;\n this._zoomingYStart = y;\n this.x1 = x - graph.getPaddingLeft();\n this.y1 = y - graph.getPaddingTop();\n\n this._zoomingSquare.setAttribute('width', 0);\n this._zoomingSquare.setAttribute('height', 0);\n this._zoomingSquare.setAttribute('display', 'block');\n\n switch (this._zoomingMode) {\n\n case 'x':\n this._zoomingSquare.setAttribute('y', graph.options.paddingTop);\n this._zoomingSquare.setAttribute('height', graph.getDrawingHeight() - graph.shift.bottom);\n break;\n\n case 'y':\n this._zoomingSquare.setAttribute('x', graph.options.paddingLeft /* + this.shift[1]*/);\n this._zoomingSquare.setAttribute('width', graph.getDrawingWidth() /* - this.shift[1] - this.shift[2]*/);\n break;\n\n case 'forceY2':\n\n this.y2 = graph.getYAxis().getPx(this.options.forcedY) + graph.options.paddingTop;\n\n break;\n\n }\n\n if (this.options.onZoomStart && !mute) {\n this.options.onZoomStart(graph, x, y, e, mute);\n }\n }\n\n /**\n * @private\n */\n onMouseMove(graph, x, y, e, mute) {\n\n //\tthis._zoomingSquare.setAttribute('display', 'none');\n\n //\tthis._zoomingSquare.setAttribute('transform', 'translate(' + Math.random() + ', ' + Math.random() + ') scale(10, 10)');\n switch (this._zoomingMode) {\n\n case 'xy':\n this._zoomingSquare.setAttribute('x', Math.min(this._zoomingXStart, x));\n this._zoomingSquare.setAttribute('y', Math.min(this._zoomingYStart, y));\n this._zoomingSquare.setAttribute('width', Math.abs(this._zoomingXStart - x));\n this._zoomingSquare.setAttribute('height', Math.abs(this._zoomingYStart - y));\n\n break;\n\n case 'forceY2':\n this._zoomingSquare.setAttribute('y', Math.min(this._zoomingYStart, this.y2));\n this._zoomingSquare.setAttribute('height', Math.abs(this._zoomingYStart - this.y2));\n this._zoomingSquare.setAttribute('x', Math.min(this._zoomingXStart, x));\n this._zoomingSquare.setAttribute('width', Math.abs(this._zoomingXStart - x));\n\n break;\n\n case 'x':\n this._zoomingSquare.setAttribute('x', Math.min(this._zoomingXStart, x));\n this._zoomingSquare.setAttribute('width', Math.abs(this._zoomingXStart - x));\n\n break;\n\n case 'y':\n this._zoomingSquare.setAttribute('y', Math.min(this._zoomingYStart, y));\n this._zoomingSquare.setAttribute('height', Math.abs(this._zoomingYStart - y));\n break;\n\n }\n\n if (this.options.onZoomMove && !mute) {\n\n this.options.onZoomMove(graph, x, y, e, mute);\n }\n //\t\tthis._zoomingSquare.setAttribute('display', 'block');\n }\n\n /**\n * @private\n */\n onMouseUp(graph, x, y, e, mute) {\n var self = this;\n this.removeZone();\n\n var _x = x - graph.options.paddingLeft;\n var _y = y - graph.options.paddingTop;\n\n this.emit('beforeZoom', {\n graph: graph,\n x: x,\n y: y,\n e: e,\n mute: mute\n });\n\n if (graph.prevent(false)) {\n\n // This doesn't work !\n //graph.prevent( true ); // Cancel future click event\n return;\n }\n\n if (x - this._zoomingXStart == 0 && this._zoomingMode != 'y' || y - this._zoomingYStart == 0 && this._zoomingMode != 'x') {\n return;\n }\n\n if (this.options.transition || this.options.smooth) {\n\n let modeX = false,\n modeY = false;\n\n if (this._zoomingMode == 'x' || this._zoomingMode == 'xy' || this._zoomingMode == 'forceY2') {\n\n this.fullX = false;\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min(axis.getVal(_x), axis.getVal(self.x1));\n axis._pluginZoomMaxFinal = Math.max(axis.getVal(_x), axis.getVal(self.x1));\n }, false, true, false);\n\n modeX = true;\n }\n\n if (this._zoomingMode == 'y' || this._zoomingMode == 'xy') {\n\n this.fullY = false;\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min(axis.getVal(_y), axis.getVal(self.y1));\n axis._pluginZoomMaxFinal = Math.max(axis.getVal(_y), axis.getVal(self.y1));\n }, false, false, true);\n\n modeY = true;\n }\n\n if (this._zoomingMode == 'forceY2') {\n\n this.fullY = false;\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min(axis.getVal(self.y2), axis.getVal(self.y1));\n axis._pluginZoomMaxFinal = Math.max(axis.getVal(self.y2), axis.getVal(self.y1));\n }, false, false, true);\n\n modeY = true;\n }\n\n this.transition(modeX, modeY, 'zoomEnd');\n } else {\n\n switch (this._zoomingMode) {\n case 'x':\n this.fullX = false;\n this.toAxes('_doZoom', [_x, this.x1], true, false);\n break;\n case 'y':\n this.fullY = false;\n this.toAxes('_doZoom', [_y, this.y1], false, true);\n break;\n case 'xy':\n this.fullX = false;\n this.fullY = false;\n this.toAxes('_doZoom', [_x, this.x1], true, false);\n this.toAxes('_doZoom', [_y, this.y1], false, true);\n break;\n\n case 'forceY2':\n\n this.fullX = false;\n this.fullY = false;\n\n this.toAxes('_doZoom', [_x, this.x1], true, false);\n this.toAxes('_doZoom', [this.y1, this.y2], false, true);\n\n break;\n }\n\n // graph.prevent( true ); // WHat are you doing ??\n graph.draw();\n\n if (this._backedUpZoomMode) {\n this._zoomingMode = this._backedUpZoomMode;\n }\n\n this.emit('zoomed');\n\n graph.pluginYieldActiveState();\n }\n }\n\n /**\n * @private\n */\n removeZone() {\n\n this._zoomingSquare.setAttribute('display', 'none');\n }\n\n /**\n * @private\n */\n onMouseWheel(delta, e, coordX, coordY, options) {\n\n if (!options) {\n options = {};\n }\n\n if (!options.baseline) {\n options.baseline = 0;\n }\n\n let baseline = options.baseline;\n\n if (options.baseline == 'mousePosition') {\n baseline = this.graph.getYAxis().getVal(coordY);\n console.log(baseline);\n }\n\n /*var serie;\n if ( ( serie = this.graph.getSelectedSerie() ) ) {\n if ( serie.getYAxis().handleMouseWheel( delta, e ) ) {\n return;\n }\n }*/\n\n var doX = options.direction == 'x';\n var doY = !(options.direction !== 'y');\n\n this.toAxes('handleMouseWheel', [delta, e, baseline], doX, doY);\n\n this.graph.drawSeries();\n }\n\n /**\n * @private\n */\n onDblClick(x, y, e, pref, mute) {\n\n var graph = this.graph;\n this.emit('beforeDblClick', {\n graph: graph,\n x: x,\n y: y,\n pref: pref,\n e: e,\n mute: mute\n });\n\n if (graph.prevent(false)) {\n return;\n }\n\n if (this.options.transition || this.options.smooth) {\n\n var modeX = false,\n modeY = false;\n\n if (pref.mode == 'xtotal' || pref.mode == 'total') {\n\n this.toAxes(function (axis) {\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getMinValue() - axis.options.axisDataSpacing.min * axis.getInterval();\n axis._pluginZoomMaxFinal = axis.getMaxValue() + axis.options.axisDataSpacing.max * axis.getInterval();\n }, false, true, false);\n\n modeX = true;\n }\n\n if (pref.mode == 'ytotal' || pref.mode == 'total') {\n\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getMinValue() - axis.options.axisDataSpacing.min * axis.getInterval();\n axis._pluginZoomMaxFinal = axis.getMaxValue() + axis.options.axisDataSpacing.max * axis.getInterval();\n }, false, false, true);\n\n modeY = true;\n }\n\n let x, y;\n\n if (pref.mode == 'gradualX' || pref.mode == 'gradualY' || pref.mode == 'gradual' || pref.mode == 'gradualXY') {\n\n x = false, y = false;\n\n if (pref.mode == 'gradualX' || pref.mode == 'gradual' || pref.mode == 'gradualXY') {\n x = true;\n modeX = true;\n }\n\n if (pref.mode == 'gradualY' || pref.mode == 'gradual' || pref.mode == 'gradualXY') {\n y = true;\n modeY = true;\n }\n\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getCurrentMin() - (axis.getCurrentMax() - axis.getCurrentMin());\n axis._pluginZoomMaxFinal = axis.getCurrentMax() + (axis.getCurrentMax() - axis.getCurrentMin());\n }, false, x, y);\n }\n\n this.transition(modeX, modeY, 'dblClick');\n return;\n }\n\n var xAxis = this.graph.getXAxis(),\n yAxis = this.graph.getYAxis();\n\n if (pref.mode == 'xtotal') {\n\n this.toAxes('setMinMaxToFitSeries', null, true, false);\n this.fullX = true;\n this.fullY = false;\n } else if (pref.mode == 'ytotal') {\n\n this.toAxes('setMinMaxToFitSeries', null, false, true);\n this.fullX = false;\n this.fullY = true;\n } else if (pref.mode == 'total') {\n\n this.toAxes('setMinMaxToFitSeries', null, true, true);\n\n this.fullX = true;\n this.fullY = true;\n // Nothing to do here\n /* this.graph._applyToAxes( function( axis ) {\n axis.emit( 'zoom', axis.currentAxisMin, axis.currentAxisMax, axis );\n }, null, true, true );\n */\n } else {\n\n x -= this.graph.options.paddingLeft;\n y -= this.graph.options.paddingTop;\n\n var xMin = xAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n xActual = xAxis.getVal(x),\n diffX = xMax - xMin,\n yMin = yAxis.getCurrentMin(),\n yMax = yAxis.getCurrentMax(),\n yActual = yAxis.getVal(y),\n diffY = yMax - yMin;\n\n if (pref.mode == 'gradualXY' || pref.mode == 'gradualX') {\n\n var ratio = (xActual - xMin) / (xMax - xMin);\n xMin = Math.max(xAxis.getMinValue() - xAxis.getInterval() * xAxis.options.axisDataSpacing.min, xMin - diffX * ratio);\n xMax = Math.min(xAxis.getMaxValue() + xAxis.getInterval() * xAxis.options.axisDataSpacing.max, xMax + diffX * (1 - ratio));\n xAxis.setCurrentMin(xMin);\n xAxis.setCurrentMax(xMax);\n\n if (xAxis.options.onZoom) {\n xAxis.options.onZoom(xMin, xMax);\n }\n\n xAxis.cacheCurrentMin();\n xAxis.cacheCurrentMax();\n xAxis.cacheInterval();\n }\n\n if (pref.mode == 'gradualXY' || pref.mode == 'gradualY') {\n\n var ratio = (yActual - yMin) / (yMax - yMin);\n yMin = Math.max(yAxis.getMinValue() - yAxis.getInterval() * yAxis.options.axisDataSpacing.min, yMin - diffY * ratio);\n yMax = Math.min(yAxis.getMaxValue() + yAxis.getInterval() * yAxis.options.axisDataSpacing.max, yMax + diffY * (1 - ratio));\n yAxis.setCurrentMin(yMin);\n yAxis.setCurrentMax(yMax);\n\n if (yAxis.options.onZoom) {\n yAxis.options.onZoom(yMin, yMax);\n }\n\n yAxis.cacheCurrentMin();\n yAxis.cacheCurrentMax();\n yAxis.cacheInterval();\n }\n }\n\n graph.pluginYieldActiveState();\n\n this.graph.draw();\n /*\n this.emit( \"dblClick\", {\n graph: graph,\n x: x,\n y: y,\n pref: pref,\n e: e,\n mute: mute\n } );\n if ( this.options.onDblClick && !mute ) {\n this.options.onDblClick( graph, x, y, e, mute );\n }*/\n }\n\n transition(modeX, modeY, eventName) {\n\n var self = this,\n maxTime = 500;\n\n if (!self.gradualUnzoomStart) {\n self.gradualUnzoomStart = Date.now();\n }\n\n window.requestAnimationFrame(function () {\n\n var dt = Date.now() - self.gradualUnzoomStart;\n\n if (dt > maxTime) {\n dt = maxTime;\n }\n var progress = Math.sin(dt / maxTime * Math.PI / 2);\n\n self.toAxes(function (axis) {\n\n axis.setCurrentMin(axis._pluginZoomMin + (axis._pluginZoomMinFinal - axis._pluginZoomMin) * progress);\n axis.setCurrentMax(axis._pluginZoomMax + (axis._pluginZoomMaxFinal - axis._pluginZoomMax) * progress);\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n }, false, modeX, modeY);\n\n self.graph.draw();\n\n if (dt < maxTime) {\n\n self.transition(modeX, modeY, eventName);\n self.emit('zooming');\n } else {\n\n self.emit('zoomed');\n self.graph.pluginYieldActiveState();\n\n if (eventName) {\n self.emit(eventName);\n }\n self.gradualUnzoomStart = 0;\n }\n });\n }\n\n isFullX() {\n return this.fullX;\n }\n\n isFullY() {\n return this.fullY;\n }\n\n toAxes(func, params, tb, lr) {\n\n var axes = this.options.axes;\n\n if (!axes || axes == 'serieSelected' && !this.graph.getSelectedSerie()) {\n axes = 'all';\n }\n\n switch (axes) {\n\n case 'all':\n this.graph._applyToAxes.apply(this.graph, arguments);\n break;\n\n case 'serieSelected':\n\n var serie = this.graph.getSelectedSerie();\n if (serie) {\n\n if (tb) {\n\n if (typeof func == 'string') {\n serie.getXAxis()[func].apply(serie.getXAxis(), params);\n } else {\n func.apply(serie.getXAxis(), params);\n }\n }\n\n if (lr) {\n\n if (typeof func == 'string') {\n serie.getYAxis()[func].apply(serie.getYAxis(), params);\n } else {\n func.apply(serie.getYAxis(), params);\n }\n }\n }\n\n break;\n\n default:\n\n if (!Array.isArray(axes)) {\n axes = [axes];\n }\n\n for (let axis of axes) {\n\n if (axis.isX() && tb) {\n // Not the best check\n\n if (typeof func == 'string') {\n axis[func].apply(axis, params);\n } else {\n func.apply(axis, params);\n }\n } else if (axis.isY() && lr) {\n // Not the best check\n\n if (typeof func == 'string') {\n axis[func].apply(axis, params);\n } else {\n func.apply(axis, params);\n }\n }\n }\n break;\n }\n }\n\n}\n\nvar memory = {};\nvar memoryHead = {};\n\nfunction getFromMemory(store, index) {\n var obj, head;\n\n if (memory[store] && memory[store][index]) {\n\n head = memoryHead[store];\n\n obj = memory[store][index];\n obj.prev = head;\n obj.next = head.next;\n head.next.prev = obj;\n head.next = obj;\n\n memoryHead[store] = obj;\n return obj.data;\n }\n}\n\n\n\nfunction get(store, index) {\n var result;\n if ((result = getFromMemory(store, index)) != undefined) {\n return result;\n }\n}\n\n/**\n * @class PluginTimeSerieManager\n * @implements Plugin\n */\nclass PluginTimeSerieManager extends Plugin {\n\n constructor() {\n\n super(...arguments);\n\n this.series = [];\n this.plugins = [];\n this.currentSlots = {};\n\n this.requestLevels = new Map();\n this.update = (noRecalculate, force) => {\n\n this.series.forEach(function (serie) {\n\n this.updateSerie(serie, noRecalculate);\n });\n\n if (!noRecalculate) {\n this.recalculateSeries(force);\n }\n };\n }\n\n static default() {\n\n return {\n\n LRUName: 'PluginTimeSerieManager',\n intervals: [1000, 15000, 60000, 900000, 3600000, 8640000],\n maxParallelRequests: 3,\n optimalPxPerPoint: 2,\n nbPoints: 1000,\n url: ''\n };\n }\n\n /**\n * Init method\n * @private\n * @memberof PluginTimeSerieManager\n */\n init(graph, options) {\n this.graph = graph;\n get.create(this.options.LRUName, 200);\n this.requestsRunning = 0;\n }\n\n setURL(url) {\n this.options.url = url;\n return this;\n }\n\n setAvailableIntervals() {\n this.options.intervals = arguments;\n }\n\n newSerie(serieName, serieOptions, serieType, dbElements, noZoneSerie) {\n var s = this.graph.newSerie(serieName, serieOptions, serieType);\n\n this.currentSlots[serieName] = {\n min: 0,\n max: 0,\n interval: 0\n };\n\n s.on('hide', function () {\n\n if (s._zoneSerie) {\n\n s._zoneSerie.hide();\n }\n });\n\n s.on('show', function () {\n\n if (s._zoneSerie) {\n s._zoneSerie.show();\n }\n });\n\n s.setInfo('timeSerieManagerDBElements', dbElements);\n\n if (!noZoneSerie) {\n s._zoneSerie = this.graph.newSerie(serieName + '_zone', {}, Graph$1.SERIE_ZONE);\n }\n\n this.series.push(s);\n return s;\n }\n\n registerPlugin(plugin, event) {\n\n var index;\n if ((index = this.plugins.indexOf(plugin)) > -1) {\n\n for (var i = 1; i < arguments.length; i++) {\n plugin.removeListener(arguments[i], this.update);\n }\n }\n\n for (var i = 1; i < arguments.length; i++) {\n plugin.on(arguments[i], this.update);\n }\n }\n\n updateSerie(serie, noRecalculate) {\n\n var self = this;\n var from = serie.getXAxis().getCurrentMin();\n var to = serie.getXAxis().getCurrentMax();\n var optimalInterval = this.getOptimalInterval(to - from);\n var optimalIntervalIndex = this.options.intervals.indexOf(optimalInterval);\n var interval;\n\n this.cleanRegister(optimalIntervalIndex);\n\n for (var i = optimalIntervalIndex; i <= optimalIntervalIndex + 1; i++) {\n\n interval = this.options.intervals[i];\n var startSlotId = self.computeSlotID(from, interval);\n var endSlotId = self.computeSlotID(to, interval);\n\n var intervalMultipliers = [[2, 5, 6], [1, 2, 4], [0, 1, 3]];\n\n intervalMultipliers.forEach(function (multiplier) {\n\n var firstSlotId = startSlotId - multiplier[0] * (endSlotId - startSlotId);\n var lastSlotId = endSlotId + multiplier[0] * (endSlotId - startSlotId);\n\n var slotId = firstSlotId;\n\n while (slotId <= lastSlotId) {\n\n if (self.computeTimeMin(slotId, interval) > Date.now()) {\n break;\n }\n\n self.register(serie, slotId, interval, interval == optimalInterval ? multiplier[1] : multiplier[2], true, noRecalculate);\n slotId++;\n }\n });\n }\n\n this.processRequests();\n }\n\n cleanRegister(interval) {\n\n if (!this.requestLevels) {\n return;\n }\n\n this.requestLevels.forEach(levelArray => {\n\n levelArray.forEach((levelElement, levelIndex) => {\n\n if (levelElement[4] < interval) {\n levelArray.splice(levelIndex, 1);\n }\n });\n });\n }\n\n register(serie, slotId, interval, priority, noProcess, noRecalculate) {\n\n var id = this.computeUniqueID(serie, slotId, interval);\n\n var data = get.get(this.options.LRUName, id);\n\n if (!data || this.computeTimeMax(slotId, interval) > Date.now() && data.timeout < Date.now() - (noRecalculate ? 5000 : 100000) && priority == 1) {\n\n this.request(serie, slotId, interval, priority, id, noProcess);\n }\n }\n\n request(serie, slotId, interval, priority, slotName, noProcess) {\n\n for (var i in this.requestLevels) {\n\n if (i == priority) {\n continue;\n }\n\n if (this.requestLevels[i][slotName]) {\n\n if (this.requestLevels[i][slotName][0] !== 1) {\n // If the request is not pending\n\n delete this.requestLevels[i][slotName];\n } else {\n this.requestLevels[i][slotName][5] = priority;\n }\n }\n }\n\n if (this.requestLevels[priority] && this.requestLevels[priority][slotName]) {\n return;\n }\n\n this.requestLevels[priority] = this.requestLevels[priority] || {};\n this.requestLevels[priority][slotName] = [0, slotName, serie.getName(), slotId, interval, priority, serie.getInfo('timeSerieManagerDBElements')];\n\n if (!noProcess) {\n this.processRequests();\n }\n }\n\n processRequests() {\n\n if (this.requestsRunning >= this.options.maxParallelRequests) {\n return;\n }\n\n var self = this,\n currentLevelChecking = 1,\n requestToMake;\n\n while (true) {\n\n for (var i in this.requestLevels[currentLevelChecking]) {\n\n if (this.requestLevels[currentLevelChecking][i][0] == 1) {\n // Running request\n continue;\n }\n\n requestToMake = this.requestLevels[currentLevelChecking][i];\n break;\n }\n\n if (requestToMake) {\n break;\n }\n\n currentLevelChecking++;\n\n if (currentLevelChecking > 10) {\n return;\n }\n }\n\n this.requestsRunning++;\n\n if (!requestToMake) {\n return;\n }\n\n requestToMake[0] = 1;\n\n ajaxGet({\n\n url: this.getURL(requestToMake),\n method: 'GET',\n json: true\n\n }).done(function (data) {\n\n if (data.status == 1) {\n // Success\n\n self.requestsRunning--;\n\n delete self.requestLevels[currentLevelChecking][i];\n\n get.store(self.options.LRUName, requestToMake[1], data.data); // Element 1 is the unique ID\n self.processRequests();\n\n if (requestToMake[5] == 1 && Object.keys(self.requestLevels[1]).length == 0) {\n\n self.recalculateSeries(true);\n }\n }\n });\n }\n\n computeTimeMax(slotId, interval) {\n return (slotId + 1) * (interval * this.options.nbPoints);\n }\n\n computeTimeMin(slotId, interval) {\n return slotId * (interval * this.options.nbPoints);\n }\n\n getURL(requestElements) {\n\n var url = this.options.url.replace('', requestElements[2]).replace('', this.computeTimeMin(requestElements[3], requestElements[4])).replace('', this.computeTimeMax(requestElements[3], requestElements[4])).replace('', requestElements[4]);\n\n var dbElements = requestElements[6] || {};\n\n for (var i in dbElements) {\n url = url.replace('<' + i + '>', dbElements[i]);\n }\n\n return url;\n }\n\n getOptimalInterval(totalspan) {\n\n var optimalInterval = (this.options.optimalPxPerPoint || 1) * totalspan / this.graph.getDrawingWidth(),\n diff = Infinity,\n optimalIntervalAmongAvailable;\n\n this.options.intervals.forEach(function (interval) {\n\n var newDiff = Math.min(diff, Math.abs(interval - optimalInterval));\n if (diff !== newDiff) {\n\n optimalIntervalAmongAvailable = interval;\n diff = newDiff;\n }\n });\n\n return optimalIntervalAmongAvailable || 1000;\n }\n\n computeUniqueID(serie, slotId, interval) {\n var extra = '';\n var info = serie.getInfo('timeSerieManagerDBElements');\n for (var i in info) {\n extra += ';' + i + ':' + info[i];\n }\n\n return serie.getName() + ';' + slotId + ';' + interval + extra;\n }\n\n computeSlotID(time, interval) {\n return Math.floor(time / (interval * this.options.nbPoints));\n }\n\n computeSlotTime(slotId, interval) {\n return slotId * (interval * this.options.nbPoints);\n }\n\n getZoneSerie(serie) {\n return serie._zoneSerie;\n }\n\n updateZoneSerie(serieName) {\n\n var serie = this.graph.getSerie(serieName);\n\n if (!serie) {\n return;\n }\n\n if (!serie._zoneSerie) {\n return;\n }\n\n serie._zoneSerie.setXAxis(serie.getXAxis());\n serie._zoneSerie.setYAxis(serie.getYAxis());\n serie._zoneSerie.setFillColor(serie.getLineColor());\n serie._zoneSerie.setLineColor(serie.getLineColor());\n serie._zoneSerie.setFillOpacity(0.2);\n serie._zoneSerie.setLineOpacity(0.3);\n }\n\n recalculateSeries(force) {\n\n var self = this;\n\n if (this.locked) {\n return;\n }\n\n this.changed = false;\n\n this.series.map(function (serie) {\n self.recalculateSerie(serie, force);\n });\n\n /*if ( this.changed ) {\n self.graph._applyToAxes( \"scaleToFitAxis\", [ this.graph.getXAxis(), false, undefined, undefined, false, true ], false, true );\n }\n */\n this.changed = false;\n //self.graph.autoscaleAxes();\n\n self.graph.draw();\n }\n\n recalculateSerie(serie, force) {\n\n var from = serie.getXAxis().getCurrentMin(),\n to = serie.getXAxis().getCurrentMax(),\n interval = this.getOptimalInterval(to - from);\n\n var startSlotId = this.computeSlotID(from, interval);\n var endSlotId = this.computeSlotID(to, interval);\n\n var data = [];\n var dataMinMax = [];\n\n if (!force && interval == this.currentSlots[serie.getName()].interval && this.currentSlots[serie.getName()].min <= startSlotId && this.currentSlots[serie.getName()].max >= endSlotId) {\n return;\n }\n\n startSlotId -= 2;\n endSlotId += 2;\n\n this.currentSlots[serie.getName()].min = startSlotId;\n this.currentSlots[serie.getName()].max = endSlotId;\n this.currentSlots[serie.getName()].interval = interval;\n\n var slotId = startSlotId;\n\n while (slotId <= endSlotId) {\n\n const lruData = get.get(this.options.LRUName, this.computeUniqueID(serie, slotId, interval));\n if (lruData) {\n\n data = data.concat(lruData.data.mean);\n dataMinMax = dataMinMax.concat(lruData.data.minmax);\n } else {\n\n this.recalculateSerieUpwards(serie, slotId, interval, data, dataMinMax);\n }\n\n slotId++;\n }\n\n this.changed = true;\n\n serie.setData(data);\n\n if (serie._zoneSerie) {\n serie._zoneSerie.setData(dataMinMax);\n }\n }\n\n setIntervalCheck(interval) {\n\n if (this.interval) {\n clearInterval(this.interval);\n }\n\n this.update(true, true);\n this.interval = setInterval(() => {\n this.update(true, false);\n }, interval);\n }\n\n recalculateSerieUpwards(serie, downSlotId, downInterval, data, dataMinMax) {\n\n var intervals = this.options.intervals.slice(0);\n intervals.sort();\n\n var nextInterval = intervals[intervals.indexOf(downInterval) + 1] || -1;\n if (nextInterval < 0) {\n return [];\n }\n\n var newSlotTime = this.computeSlotTime(downSlotId, downInterval);\n var newSlotTimeEnd = this.computeSlotTime(downSlotId + 1, downInterval);\n var newSlotId = this.computeSlotID(newSlotTime, nextInterval),\n start = false;\n\n const lruData = get.get(this.options.LRUName, this.computeUniqueID(serie, newSlotId, nextInterval));\n if (lruData) {\n\n for (var i = 0, l = lruData.data.mean.length; i < l; i += 2) {\n\n if (lruData.data.mean[i] < newSlotTime) {\n continue;\n } else if (start === false) {\n start = i;\n }\n\n if (lruData.data.mean[i] >= newSlotTimeEnd) {\n\n data = data.concat(lruData.data.mean.slice(start, i));\n dataMinMax = data.concat(lruData.data.minmax.slice(start, i));\n\n return;\n }\n }\n }\n\n return this.recalculateSerieUpwards(serie, newSlotId, nextInterval, data, dataMinMax);\n }\n\n lockRedraw() {\n this.locked = true;\n }\n\n unlockRedraw() {\n this.locked = false;\n }\n\n isRedrawLocked() {\n return !!this.locked;\n }\n}\n\n/**\n * @class PluginSerieLineDifference\n * @implements Plugin\n */\nclass PluginSerieLineDifference extends Plugin {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n return {\n\n positiveStyle: {\n\n fillColor: 'green',\n fillOpacity: 0.2,\n strokeWidth: 0\n },\n\n negativeStyle: {\n fillColor: 'red',\n fillOpacity: 0.2,\n strokeWidth: 0\n },\n\n from: 0,\n to: 0\n };\n }\n\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n this.graph = graph;\n\n this.pathsPositive = [];\n this.pathsNegative = [];\n\n this.positivePolyline = this.graph.newShape('polyline').draw();\n\n this.positivePolyline.setFillColor(this.options.positiveStyle.fillColor).setFillOpacity(this.options.positiveStyle.fillOpacity).setStrokeWidth(this.options.positiveStyle.strokeWidth).applyStyle();\n\n this.negativePolyline = this.graph.newShape('polyline').draw();\n\n this.negativePolyline.setFillColor(this.options.negativeStyle.fillColor).setFillOpacity(this.options.negativeStyle.fillOpacity).setStrokeWidth(this.options.negativeStyle.strokeWidth).applyStyle();\n }\n\n /**\n * Assigns the two series for the shape. Postive values are defined when ```serieTop``` is higher than ```serieBottom```.\n * @param {SerieLine} serieTop - The top serie\n * @param {SerieLine} serieBottom - The bottom serie\n */\n setSeries(serieTop, serieBottom) {\n this.serie1 = serieTop;\n this.serie2 = serieBottom;\n }\n\n /**\n * Assigns the boundaries\n */\n setBoundaries(from, to) {\n this.options.from = from;\n this.options.to = to;\n }\n\n /**\n * @returns the starting value used to draw the zone\n */\n getFrom() {\n return this.options.from;\n }\n\n /**\n * @returns the ending value used to draw the zone\n */\n getTo() {\n return this.options.to;\n }\n\n /**\n * Calculates and draws the zone series\n * @returns {Plugin} The current plugin instance\n */\n draw() {\n\n var self = this;\n var s1 = this.serie1.searchClosestValue(this.getFrom());\n var i1, j1, i2, j2, y, y2, crossing;\n\n var top = [];\n var bottom = [];\n\n var bottomBroken;\n\n if (!s1) {\n i1 = 0;\n j1 = 0;\n } else {\n\n i1 = s1.dataIndex;\n j1 = s1.xAfterIndex * 2;\n }\n\n y = this.interpolate(this.serie1, this.getFrom());\n top.push(this.getFrom()); // x\n top.push(y); // y\n\n y = this.interpolate(this.serie2, this.getFrom());\n bottom.push(this.getFrom()); // x\n bottom.push(y); // y\n\n var s2;\n\n var order;\n\n function nextSet() {\n\n if (order === true) {\n self.pathsPositive.push([top, bottom]);\n } else if (order === false) {\n self.pathsNegative.push([top, bottom]);\n }\n\n top = [];\n bottom = [];\n order = undefined;\n }\n var ended;\n for (; i1 < this.serie1.data.length; i1++) {\n\n for (; j1 < this.serie1.data[i1].length; j1 += 2) {\n\n if (this.serie1.data[i1][j1] > this.getTo()) {\n // FINISHED !\n\n y = this.interpolate(this.serie1, this.getTo());\n y2 = this.interpolate(this.serie2, this.getTo());\n\n crossing = this.computeCrossing(top[top.length - 2], top[top.length - 1], this.getTo(), y, bottom[bottom.length - 2], bottom[bottom.length - 1], this.getTo(), y2);\n\n if (crossing) {\n\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n nextSet();\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n\n order = this.serie1.data[i1][j1 + 1] > this.serie2.data[i2][j2 + 1];\n }\n\n top.push(this.getTo()); // x\n top.push(y); // y\n\n bottom.push(this.getTo()); // x\n bottom.push(y2); // y\n\n ended = true;\n break;\n }\n\n if (!s2) {\n s2 = this.serie2.searchClosestValue(this.serie1.data[i1][j1]); // Finds the first point\n\n if (s2) {\n i2 = s2.dataIndex;\n j2 = s2.xBeforeIndex * 2;\n\n // TODO: Add here first points\n\n y = this.interpolate(this.serie2, this.serie1.data[i1][j1]);\n\n top.push(this.serie1.data[i1][j1]); // x\n top.push(this.serie1.data[i1][j1 + 1]); // y\n\n bottom.push(this.serie1.data[i1][j1]); // x\n bottom.push(y); // y\n\n order = this.serie1.data[i1][j1 + 1] > y;\n } else {\n continue;\n }\n }\n\n bottomBroken = false;\n\n crossing = this.computeCrossing(top[top.length - 2], top[top.length - 1], this.serie1.data[i1][j1], this.serie1.data[i1][j1 + 1], bottom[bottom.length - 2], bottom[bottom.length - 1], this.serie2.data[i2][j2], this.serie2.data[i2][j2 + 1]);\n\n if (crossing) {\n\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n nextSet();\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n\n order = this.serie1.data[i1][j1 + 1] > this.serie2.data[i2][j2 + 1];\n }\n\n while (this.serie2.data[i2][j2] < this.serie1.data[i1][j1]) {\n\n bottom.push(this.serie2.data[i2][j2]);\n bottom.push(this.serie2.data[i2][j2 + 1]);\n\n j2 += 2;\n if (j2 == this.serie2.data[i2].length) {\n bottomBroken = this.serie2.data[i2][j2 - 2];\n i2++;\n j2 = 0;\n break;\n }\n\n crossing = this.computeCrossing(top[top.length - 2], top[top.length - 1], this.serie1.data[i1][j1], this.serie1.data[i1][j1 + 1], bottom[bottom.length - 2], bottom[bottom.length - 1], this.serie2.data[i2][j2], this.serie2.data[i2][j2 + 1]);\n\n if (crossing) {\n\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n nextSet();\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n\n order = this.serie1.data[i1][j1 + 1] > this.serie2.data[i2][j2 + 1];\n }\n }\n\n if (bottomBroken === false) {\n top.push(this.serie1.data[i1][j1]);\n top.push(this.serie1.data[i1][j1 + 1]);\n } else {\n\n top.push(bottomBroken);\n top.push(this.interpolate(this.serie1, bottomBroken));\n\n s2 = false;\n j1 -= 2;\n nextSet();\n }\n }\n\n if (ended) {\n nextSet();\n break;\n }\n // End of X\n\n y = this.interpolate(this.serie2, top[top.length - 2]);\n if (y) {\n bottom.push(top[top.length - 2]);\n bottom.push(y);\n }\n\n nextSet();\n\n j1 = 0;\n s2 = false;\n }\n\n var d = this.pathsPositive.reduce(makePaths, '');\n this.positivePolyline.setPointsPx(d).redraw();\n\n var d = this.pathsNegative.reduce(makePaths, '');\n this.negativePolyline.setPointsPx(d).redraw();\n\n //pathsBottom.map( function( map ) { makePaths( map, self.options.negativeStyle ); } );\n\n function makePaths(d, path) {\n\n for (var i = 0; i < path[0].length; i += 2) {\n if (i == 0) {\n d += 'M ';\n }\n d += ' ' + Math.round(self.serie1.getXAxis().getPx(path[0][i])) + ', ' + Math.round(self.serie1.getYAxis().getPx(path[0][i + 1]));\n if (i < path[0].length - 2) {\n d += ' L ';\n }\n }\n\n for (var i = path[1].length - 2; i >= 0; i -= 2) {\n d += ' L ' + Math.round(self.serie2.getXAxis().getPx(path[1][i])) + ', ' + Math.round(self.serie2.getYAxis().getPx(path[1][i + 1]));\n if (i == 0) {\n d += ' z ';\n }\n }\n return d;\n }\n }\n\n /**\n * Finds the interpolated y value at point ```valX``` of the serie ```serie```\n * @returns {(Number|Boolean)} The interpolated y value is possible, ```false``` otherwise\n * @param {Serie} serie - The serie for which the y value should be computed\n * @param {Number} valX - The x value\n */\n interpolate(serie, valX) {\n\n var value = serie.searchClosestValue(valX);\n\n if (!value) {\n return false;\n }\n\n if (value.xMax == undefined) {\n return value.yMin;\n }\n\n if (value.xMin == undefined) {\n return value.yMax;\n }\n\n var ratio = (valX - value.xMin) / (value.xMax - value.xMin);\n return (1 - ratio) * value.yMin + ratio * value.yMax;\n }\n\n /**\n * Finds the crossing point between two vector and returns it, or ```false``` if it is not within the x boundaries\n * @returns {(Object|Boolean)} An object containing the crossing point in the following format: ```{ x: xCrossing, y: yCrossing }``` or ```false``` if no crossing point can be found\n * @param {Number} x11 - First x point of the first vector\n * @param {Number} y11 - First y point of the first vector\n * @param {Number} x12 - Second x point of the first vector\n * @param {Number} y12 - Second y point of the first vector\n * @param {Number} x21 - First x point of the second vector\n * @param {Number} y21 - First y point of the second vector\n * @param {Number} y22 - Second x point of the second vector\n * @param {Number} y22 - Second y point of the second vector\n */\n computeCrossing(x11, y11, x12, y12, x21, y21, x22, y22) {\n var a1 = (y12 - y11) / (x12 - x11);\n var a2 = (y22 - y21) / (x22 - x21);\n\n var b1 = y12 - a1 * x12;\n var b2 = y22 - a2 * x22;\n\n if (x11 == x12 || x21 == x22) {\n\n return false;\n }\n\n if (a1 == a2) {\n return {\n x: x11,\n y1: y11,\n y2: y11\n };\n }\n\n var x = (b1 - b2) / (a2 - a1);\n\n if (x > x12 || x < x11 || x < x21 || x > x22) {\n return false;\n }\n\n return {\n x: x,\n y: a1 * x + b1\n };\n }\n\n /**\n * @returns The positive polyline\n */\n getPositivePolyline() {\n return this.positivePolyline;\n }\n\n /**\n * @returns The negative polyline\n */\n getNegativePolyline() {\n return this.negativePolyline;\n }\n\n}\n\nclass SerieLineExtended extends SerieLine {\n\n constructor() {\n super(...arguments);\n this.subSeries = [];\n }\n\n setData() {\n super.setData(...arguments);\n this.subSeries.map(sub => {\n sub.data = this.data;\n });\n return this;\n }\n\n draw() {\n this.eraseMarkers();\n return this;\n }\n\n getSymbolForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getSymbolForLegend();\n }\n\n getMarkerForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getMarkerForLegend();\n }\n}\n\nclass SerieScatterExtended extends SerieScatter {\n\n constructor() {\n super(...arguments);\n this.subSeries = [];\n }\n\n setData() {\n super.setData(...arguments);\n this.subSeries.map(sub => {\n sub.data = this.data;\n });\n return this;\n }\n\n draw() {\n return this;\n }\n\n getSymbolForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getSymbolForLegend();\n }\n\n getMarkerForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getMarkerForLegend();\n }\n}\n\nvar excludingMethods = ['constructor', 'init', 'draw', 'setLineColor', 'setLineWidth', 'setLineStyle', 'getLineColor', 'getLineWidth', 'getLineStyle', 'setMarkers', 'showMarkers', 'hideMarkers', 'getMarkerDom', 'getMarkerDomIndependant', 'getMarkerPath', 'eraseMarkers', '_recalculateMarkerPoints'];\nvar addMethods = [];\n\nObject.getOwnPropertyNames(SerieLine.prototype).concat(addMethods).map(function (i) {\n\n if (excludingMethods.indexOf(i) > -1) {\n return;\n }\n\n SerieLineExtended.prototype[i] = function (j) {\n\n return function () {\n\n var args = arguments;\n this.subSeries.map(subSerie => {\n subSerie[j](...args);\n });\n };\n }(i);\n});\n\n/**\n * Axis splitting plugin\n * @augments Plugin\n */\nclass PluginAxisSplitting extends Plugin {\n\n constructor(options) {\n super(...arguments);\n this.series = new Map();\n }\n\n static defaults() {\n\n return {\n axes: {\n margins: {\n high: 5,\n low: 5\n }\n }\n };\n }\n\n init(graph) {\n this.graph = graph;\n }\n\n /**\n * Creates a new bottom split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newXAxis(options) {\n return this.newBottomAxis(options);\n }\n\n /**\n * Creates a new left split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newYAxis(options) {\n return this.newLeftAxis(options);\n }\n\n /**\n * Creates a new top split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newTopAxis(options) {\n options = this.getOptions(options);\n return new SplitXAxis(this.graph, 'top', options);\n }\n\n /**\n * Creates a new bottom split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newBottomAxis(options) {\n options = this.getOptions(options);\n return new SplitXAxis(this.graph, 'bottom', options);\n }\n\n /**\n * Creates a new left split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newLeftAxis(options) {\n options = this.getOptions(options);\n return new SplitYAxis(this.graph, 'left', options);\n }\n\n /**\n * Creates a new right split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newRightAxis(options) {\n options = this.getOptions(options);\n return new SplitYAxis(this.graph, 'right', options);\n }\n\n getOptions(options) {\n var defaults = {\n marginMin: this.options.axes.margins.low,\n marginMax: this.options.axes.margins.high\n };\n return extend(true, defaults, options);\n }\n\n preDraw() {\n\n var xAxis, yAxis;\n\n // for ( let { serie } of this.series.values() ) {\n this.series.forEach(({\n serie\n }) => {\n\n xAxis = serie.getXAxis();\n yAxis = serie.getYAxis();\n\n let splits = 1;\n\n if (xAxis.splitNumber) {\n splits *= xAxis.splitNumber;\n }\n\n if (yAxis.splitNumber) {\n splits *= yAxis.splitNumber;\n }\n\n while (serie.subSeries.length < splits) {\n\n const name = serie.getName() + '_' + serie.subSeries.length;\n\n const s = this.graph.newSerie(name, {}, serie.getType() || Graph$1.SERIE_LINE);\n\n s.excludedFromLegend = true;\n s.styles = serie.styles;\n s.data = serie.data; // Copy data\n\n if (serie.getType() == Graph$1.SERIE_LINE) {\n s.markerPoints = serie.markerPoints;\n s.markerFamilies = serie.markerFamilies;\n }\n\n serie.subSeries.push(s);\n }\n\n while (serie.subSeries.length > splits) {\n\n let subserie = this.graph.getSerie(serie.getName() + '_' + (serie.subSeries.length - 1));\n\n if (subserie && subserie.kill) {\n subserie.kill();\n }\n serie.subSeries.pop();\n }\n\n if (!serie.getXAxis().splitNumber && serie.getXAxis().splitAxis) {\n serie.getXAxis().splitAxis();\n }\n\n if (!serie.getYAxis().splitNumber && serie.getYAxis().splitAxis) {\n serie.getYAxis().splitAxis();\n }\n\n // Re-assign axes to the sub series\n serie.subSeries.map((sserie, index) => {\n\n var xSubAxis, ySubAxis;\n\n //sserie.groupMarkers = firstSubSerie.groupMarkers;\n\n if (serie.getXAxis().getSubAxis) {\n let subAxisIndex = index % (xAxis.splitNumber || 1);\n xSubAxis = serie.getXAxis().getSubAxis(subAxisIndex);\n } else {\n xSubAxis = serie.getXAxis();\n }\n\n sserie.setXAxis(xSubAxis);\n\n if (serie.getYAxis().getSubAxis) {\n\n let subAxisIndex = Math.floor(index / (xAxis.splitNumber || 1));\n ySubAxis = serie.getYAxis().getSubAxis(subAxisIndex);\n } else {\n ySubAxis = serie.getYAxis();\n }\n\n sserie.setYAxis(ySubAxis);\n\n sserie.draw(true);\n });\n //}\n });\n }\n\n /**\n * Creates a new serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @param {String} type - The type of the serie\n * @return {Serie} The created serie\n */\n newSerie(name, options = {}, type) {\n\n switch (type) {\n\n case 'line':\n return this.newLineSerie(name, options);\n break;\n\n case 'scatter':\n return this.newScatterSerie(name, options);\n break;\n }\n\n throw 'Cannot create a split serie of type ' + type;\n }\n\n /**\n * Creates a new line serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @return {Serie} The created serie\n */\n newLineSerie(name, options) {\n var serieObj = {\n type: 'lineSerie',\n serie: new SerieLineExtended(name, options, 'line')\n };\n this.series.set(name, serieObj);\n serieObj.serie.init(this.graph, name, options);\n this.graph.series.push(serieObj.serie);\n return serieObj.serie;\n }\n\n /**\n * Creates a new scatter serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @return {Serie} The created serie\n */\n newScatterSerie(name, options) {\n var serieObj = {\n type: 'scatterSerie',\n serie: new SerieScatterExtended(name, options, 'scatter')\n };\n this.series.set(name, serieObj);\n serieObj.serie.init(this.graph, options);\n this.graph.series.push(serieObj.serie);\n return serieObj.serie;\n }\n\n}\n\nvar defaultAxisConstructorOptions = {\n splitMarks: true\n};\n\nvar SplitAxis = function (mixin) {\n\n var delegateMethods = ['turnGridsOff', 'turnGridsOn', 'gridsOff', 'gridsOn', 'setEngineering', 'setScientificScaleExponent', 'setScientific', 'setLabelColor', 'setSecondaryGridDasharray', 'setPrimaryGridDasharray', 'setSecondaryGridsOpacity', 'setPrimaryGridOpacity', 'setSecondaryGridWidth', 'setPrimaryGridWidth', 'setSecondaryGridColor', 'setPrimaryGridColor', 'setTicksLabelColor', 'setSecondaryTicksColor', 'setPrimaryTicksColor', 'setAxisColor', 'secondaryGridOn', 'secondaryGridOff', 'primaryGridOff', 'primaryGridOn', 'setSecondaryGrid', 'setPrimaryGrid', 'setGrids', 'setTickPosition', 'setExponentialFactor', 'setExponentialLabelFactor', 'setGridLinesStyle', 'forcePrimaryTickUnitMin', 'forcePrimaryTickUnitMax', 'forcePrimaryTickUnit', 'flip', 'show', 'hide', 'setDisplay'];\n\n /**\n * Split axis\n * @mixes AxisX\n * @mixes AxisY\n * @name SplitAxis\n * @static\n */\n var cl = class SplitAxis extends mixin {\n\n constructor(graph, position, options = {}) {\n\n super(graph, position, options);\n this.axes = [];\n this.position = position;\n this.constructorOptions = extend(true, {}, defaultAxisConstructorOptions, options);\n\n this._splitVal = [];\n }\n\n /**\n * Calls a callback onto each chunk axes. The callback receives two parameters: 1) the ```axis``` itself and 2) the ```index``` of the axis in the stack\n * @param {Function} callback - The callback to be applied to each axes\n * @return {SplitAxis} The current axis instance\n */\n all(callback) {\n\n if (!(typeof callback == 'function')) {\n return;\n }\n\n this.axes.map(callback);\n return this;\n }\n\n /**\n * Splits the axis into chunks at the positions defined as a list of parameters.\n * @param {Function} ...splits - The positions of axis splitting\n * @return {SplitAxis} The current axis instance\n * @example axis.splitAxis( 0.2, 0.5, 0.8 ); // Creates 4 chunks (0-20%, 20%-50%, 50%-80%, 80%-100%)\n */\n splitAxis(...splits) {\n\n splits.push(1);\n let splitNumber = splits.length;\n\n while (this.axes.length > splitNumber) {\n this.axes.pop().kill(true, true);\n }\n\n while (this.axes.length < splitNumber) {\n let axis = new (this.getConstructor())(this.graph, this.position, this.constructorOptions);\n this.axes.push(axis);\n axis.zoomLock = true;\n axis.init(this.graph, this.constructorOptions);\n }\n\n let from = 0;\n let i = 0;\n for (let axis of this.axes) {\n\n axis.options.marginMin = 10;\n axis.options.marginMax = 10;\n\n if (i == 0) {\n axis.options.marginMin = 0;\n }\n\n if (i == this.axes.length - 1) {\n axis.options.marginMax = 0;\n }\n\n axis.setSpan(from, from = splits[i]);\n axis.setMinMaxFlipped();\n i++;\n }\n\n this._splits = splits;\n return this;\n }\n\n /**\n * Fixes the major tick interval of all axes based on the one provided as a parameter\n * @param {Number} axisIndex - The index of the reference axis (starting at 0)\n * @return {SplitAxis} The current axis instance\n */\n fixGridIntervalBasedOnAxis(axisIndex) {\n\n this.fixGridFor = axisIndex;\n this.graph._axisHasChanged();\n return this;\n }\n\n /**\n * Spreads the chunks of the axis based on the relative interval of each one of them, so that the unit / px is constant for each chunk\n * @param {Boolean} bln - ```true``` to enable the spread, ```false``` otherwise\n * @return {SplitAxis} The current axis instance\n */\n splitSpread(bln) {\n this.autoSpread = !!bln;\n return this;\n }\n\n hasAxis(axis) {\n return this.axes.indexOf(axis) > -1;\n }\n\n _splitSpread() {\n\n let splits = [],\n total = 0,\n currentSplit = 0;\n //console.log( this._splitVal );\n for (let split of this._splitVal) {\n total += split[1] - split[0];\n }\n\n for (let split of this._splitVal) {\n\n splits.push(currentSplit += (split[1] - split[0]) / total);\n }\n\n splits.pop();\n this.splitAxis(...splits);\n }\n\n /**\n * Defines the boundaries of each chunk in axis unit.\n * @param {Array<(Array|Number)>} values - An array of either 2-component arrays (from-to) or number (mean)\n * @example axis.setChunkBoundaries( [ [ 12, 20 ], [ 100, 200 ] ] ); // First chunk from 12 to 20, second one from 100 to 200\n * @example axis.setChunkBoundaries( [ 12, [ 100, 200 ] ] ); // Second chunk from 100 to 200, first chunk with a mean at 12 and min / max determined by the relative widths of the chunks\n * @return {SplitAxis} The current axis instance\n */\n setChunkBoundaries(values) {\n\n let index = 0,\n baseWidth,\n baseWidthIndex;\n\n for (let axis of this.axes) {\n // List all axes\n\n // Two elements in the array => becomes the new reference\n if (Array.isArray(values[index]) && values[index].length > 1 && !baseWidth) {\n baseWidth = values[index][1] - values[index][0];\n baseWidthIndex = index;\n }\n\n if (values[index].length == 1 || !Array.isArray(values[index])) {\n axis._mean = values[index];\n\n if (Array.isArray(axis._mean)) {\n axis._mean = axis._mean[0];\n }\n } else {\n\n axis.forceMin(values[index][0]).forceMax(values[index][1]);\n }\n\n index++;\n }\n\n this._baseWidthVal = baseWidth;\n this._baseWidthIndex = baseWidthIndex;\n\n this._splitVal = values;\n\n this.graph._axisHasChanged();\n\n return this;\n }\n\n setMinMaxToFitSeries() {\n\n if (!this._splitVal || this._splitVal.length < 1) {\n super.setMinMaxToFitSeries(...arguments);\n this._splitVal[0] = this._splitVal[0] || [];\n this._splitVal[this._splitVal.length - 1] = this._splitVal[this._splitVal.length - 1] || [];\n\n this._splitVal[0][0] = this.getCurrentMin();\n this._splitVal[this._splitVal.length - 1][1] = this.getCurrentMax();\n this.setChunkBoundaries(this._splitVal);\n }\n }\n\n draw() {\n\n if (this.autoSpread) {\n this._splitSpread();\n }\n\n let max = 0;\n let unit;\n let subAxis;\n let spanReference;\n\n if (this._baseWidthIndex >= 0 && (subAxis = this.getSubAxis(this._baseWidthIndex))) {\n spanReference = subAxis.getSpan();\n }\n\n subAxis = undefined;\n\n if (this.fixGridFor >= 0 && (subAxis = this.getSubAxis(this.fixGridFor))) {\n\n if (subAxis._mean !== undefined) {\n let width = (subAxis.getSpan()[1] - subAxis.getSpan()[0]) / (spanReference[1] - spanReference[0]) * this._baseWidthVal;\n subAxis.forceMin(subAxis._mean - width / 2);\n subAxis.forceMax(subAxis._mean + width / 2);\n }\n\n max = subAxis.draw();\n unit = subAxis.getPrimaryTickUnit();\n }\n\n this.axes.map(axis => {\n\n if (subAxis === axis) {\n return;\n }\n\n if (axis._mean !== undefined) {\n let width = (axis.getSpan()[1] - axis.getSpan()[0]) / (spanReference[1] - spanReference[0]) * this._baseWidthVal;\n axis.forceMin(axis._mean - width / 2);\n axis.forceMax(axis._mean + width / 2);\n }\n\n if (unit) {\n axis.forcePrimaryTickUnit(unit);\n }\n\n max = Math.max(max, axis.draw());\n });\n\n // this.drawLabel();\n this.writeUnit();\n\n return max;\n }\n\n setMinPx(min) {\n\n super.setMinPx(min);\n for (let axis of this.axes) {\n axis.setMinPx(min);\n }\n }\n\n setMaxPx(max) {\n\n super.setMaxPx(max);\n\n for (let axis of this.axes) {\n axis.setMaxPx(max);\n }\n }\n\n setShift() {\n\n super.setShift(...arguments);\n\n for (let axis of this.axes) {\n axis.setShift(...arguments);\n }\n }\n\n init() {\n super.init(...arguments);\n this.splitAxis();\n }\n\n getAxisPosition() {\n var max = 0;\n\n this.axes.map(axis => {\n max = Math.max(max, axis.getAxisPosition());\n });\n\n return max;\n }\n\n getSubAxis(index) {\n\n if (this.axes.length <= index) {\n throw 'Impossible to reach axis. Index ' + index + ' is out of range';\n }\n\n return this.axes[index];\n }\n\n get splitNumber() {\n return this._splits.length;\n }\n };\n\n delegateMethods.map(methodName => {\n\n cl.prototype[methodName] = function (method) {\n\n return function () {\n //super[ method ]( ...arguments )\n\n this.axes.map(axis => {\n axis[method](...arguments);\n });\n return this;\n };\n }(methodName);\n });\n\n return cl;\n};\n\nclass SplitXAxis extends SplitAxis(AxisX) {\n\n constructor(graph, topbottom, options) {\n super(...arguments);\n this.topbottom = topbottom;\n }\n\n getConstructor() {\n return AxisX;\n }\n\n getAxisPosition() {\n var max = super.getAxisPosition(...arguments);\n\n this.labelPosY = max;\n\n if (this.getLabel()) {\n max += this.graph.options.fontSize;\n }\n\n return max;\n }\n\n drawLabel() {\n super.drawLabel();\n this.label.setAttribute('y', (this.top ? -1 : 1) * (this.graph.options.fontSize + this.labelPosY));\n }\n\n draw() {\n var height = super.draw(...arguments);\n this.drawLabel();\n return height;\n }\n\n}\n\nclass SplitYAxis extends SplitAxis(AxisY) {\n\n constructor(graph, leftright, options) {\n super(...arguments);\n ///this.leftright = leftright;\n }\n\n getConstructor() {\n return AxisY;\n }\n /*\n draw() {\n if ( this.getLabel() ) {\n this.axes.map( ( axis ) => {\n axis.setAxisPosition( this.graph.options.fontSize );\n } ); // Extra shift allowed for the label\n //this.setShift( this.graph.options.fontSize );\n }\n return super.draw( ...arguments );\n }\n */\n drawLabel() {\n super.drawLabel();\n }\n\n equalizePosition(width) {\n\n var widthAfter = width;\n\n if (this.getLabel()) {\n this.axes.map(axis => {\n widthAfter = Math.max(axis.equalizePosition(width), widthAfter);\n }); // Extra shift allowed for the label\n //this.setShift( this.graph.options.fontSize );\n }\n\n if (this.getLabel()) {\n this.placeLabel(this.left ? -widthAfter : widthAfter);\n return widthAfter + this.graph.options.fontSize;\n }\n }\n\n}\n\nmix(SplitXAxis, new AxisX());\nmix(SplitYAxis, new AxisY());\n\n/**\n * The intent of this plugin is to provide methods for the user to make the traces on the graph automatically different\n * Options to provide colorization, markers and line styles should be provided\n * @extends Plugin\n */\nclass PluginMakeTracesDifferent extends Plugin {\n\n constructor() {\n super(...arguments);\n }\n\n init(graph, options) {\n super.init(graph, options);\n }\n // Load this with defaults\n static default() {\n\n return {};\n }\n\n checkHSL(color) {\n\n let result = {},\n hue,\n saturation,\n lightness;\n\n if (hue = color.h || color.hue) {\n\n if (hue < 1) {\n hue = Math.round(hue * 360);\n }\n\n result.hue = hue;\n } else {\n result.h = 0;\n }\n\n if (saturation = color.s || color.saturation) {\n\n if (saturation > 1) {\n saturation /= 100;\n }\n\n result.saturation = saturation;\n } else {\n result.saturation = 0.75;\n }\n\n if (lightness = color.lightness || color.l) {\n\n if (lightness > 1) {\n lightness /= 100;\n }\n\n result.lightness = lightness;\n } else {\n result.lightness = 0.5;\n }\n\n return result;\n }\n\n buildHSLString(hsl) {\n return 'hsl( ' + Math.round(hsl.h) + ', ' + Math.round(hsl.s * 100) + '%, ' + Math.round(hsl.l * 100) + '%)';\n }\n\n colorizeAll(options) {\n\n let series, seriesLength;\n\n if (options.serieTypes) {\n\n if (!Array.isArray(options.serieTypes)) {\n options.serieTypes = [options.serieTypes];\n }\n\n series = this.graph.allSeries(...options.serieTypes);\n } else {\n series = this.graph.getSeries();\n }\n\n seriesLength = series.length;\n\n if (!options.startingColorHSL) {\n\n if (options.colorHSL) {\n options.startingColorHSL = this.checkHSL(options.colorHSL);\n } else {\n throw 'No starting color was provided. There must exist either options.colorHSL or options.startingColorHSL';\n }\n }\n\n if (!options.endingColorHSL) {\n\n if (!options.affect || !['h', 's', 'l', 'hue', 'saturation', 'lightness'].include(options.affect)) {\n options.affect = 'h';\n }\n\n switch (options.affect) {\n\n case 'h':\n case 'hue':\n options.endingColorHSL = {\n h: options.startingColorHSL.h + 300,\n s: options.startingColorHSL.s,\n l: options.startingColorHSL.l\n };\n break;\n\n case 'saturation':\n case 's':\n let endS;\n\n if (options.startingColorHSL.s > 0.5) {\n endS = 0;\n } else {\n endS = 1;\n }\n\n options.endingColorHSL = {\n h: options.startingColorHSL.h,\n s: endS,\n l: options.startingColorHSL.l\n };\n break;\n\n case 'lightness':\n case 'l':\n let endL;\n\n if (options.startingColorHSL.l > 0.5) {\n endL = 0;\n } else {\n endL = 0.75;\n }\n\n options.endingColorHSL = {\n h: options.startingColorHSL.h,\n s: options.startingColorHSL.s,\n l: endL\n };\n break;\n }\n } else {\n options.endingColorHSL = Object.assign({}, options.startingColorHSL, options.endingColorHSL);\n }\n\n return series.map((serie, index) => {\n\n if (!serie.setLineColor) {\n throw 'The serie ' + serie.getName() + ' does not implement the method `startingColor`';\n }\n\n const colorString = this.buildHSLString({\n h: options.startingColorHSL.h + index / (seriesLength - 1) * (options.endingColorHSL.h - options.startingColorHSL.h),\n s: options.startingColorHSL.s + index / (seriesLength - 1) * (options.endingColorHSL.s - options.startingColorHSL.s),\n l: options.startingColorHSL.l + index / (seriesLength - 1) * (options.endingColorHSL.l - options.startingColorHSL.l)\n });\n\n serie.setLineColor(colorString);\n return colorString;\n });\n }\n}\n\n/*\n What is it ?\n It is a plugin for automatic peak detection on a line serie\n\n How to use ?\n Basic usage:\n\n let graph = new Graph(\"dom\", {\n plugins: {\n 'peakPicking': {}\n }\n }\n );\n\n let wv = Graph.newWaveform();\n wv.setData( [ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 ] );\n let s = graph.newSerie(\"serie\").setWaveform( wv ).autoAxis();\n\n graph.getPlugin('peakPicking').setSerie( s );\n graph.draw();\n*/\n\n/**\n * @extends Plugin\n */\nclass PluginPeakPicking extends Plugin {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n\n return {\n autoPeakPicking: false,\n autoPeakPickingNb: 4,\n autoPeakPickingMinDistance: 10,\n autoPeakPickingFormat: false,\n autoPeakPickingAllowAllY: false\n };\n }\n\n init(graph, options) {\n\n super.init(graph, options);\n this.picks = [];\n\n for (var n = 0, m = this.options.autoPeakPickingNb; n < m; n++) {\n\n var shape = this.graph.newShape({\n type: 'label',\n label: {\n text: '',\n position: {\n x: 0\n },\n anchor: 'middle'\n\n },\n\n selectable: true,\n\n shapeOptions: {\n minPosY: 15\n }\n\n });\n\n shape.draw();\n\n this.picks.push(shape);\n }\n }\n\n setSerie(serie) {\n this.serie = serie;\n }\n\n serieRemoved(serie) {\n\n if (this.serie == serie) {\n this.picks.map(pick => {\n pick.kill();\n });\n }\n }\n\n preDraw() {\n\n if (!this.serie) {\n return;\n }\n\n this.detectedPeaks = [];\n this.lastYPeakPicking = false;\n }\n\n postDraw() {\n\n if (!this.serie) {\n return;\n }\n let lookForMaxima = true;\n let lookForMinima = false;\n let lastYPeakPicking;\n let peaks = [];\n\n let waveform = this.serie.getWaveform();\n\n if (!waveform) {\n throw 'The serie must have a waveform for the peak picking to work';\n }\n\n let length = waveform.getLength(),\n i = 0,\n y;\n\n for (; i < length; i++) {\n\n y = waveform.getY(i);\n\n if (this.serie.options.lineToZero) {\n peaks.push([waveform.getX(i), y]);\n continue;\n }\n\n if (!lastYPeakPicking) {\n lastYPeakPicking = [waveform.getX(i), y];\n continue;\n }\n\n if (y >= lastYPeakPicking[1] && lookForMaxima || y <= lastYPeakPicking[1] && lookForMinima) {\n\n lastYPeakPicking = [waveform.getX(i), y];\n } else if (y < lastYPeakPicking[1] && lookForMaxima || y > lastYPeakPicking[1] && lookForMinima) {\n\n if (lookForMinima) {\n lookForMinima = false;\n lookForMaxima = true;\n } else {\n\n lookForMinima = true;\n lookForMaxima = false;\n\n peaks.push(lastYPeakPicking);\n lastYPeakPicking = false;\n }\n\n lastYPeakPicking = [waveform.getX(i), y];\n }\n }\n\n var ys = peaks;\n var x,\n px,\n passed = [],\n px,\n l = ys.length,\n k,\n m,\n index;\n\n i = 0;\n\n var selected = this.graph.selectedShapes.map(function (shape) {\n return shape.getProp('xval');\n });\n\n ys.sort(function (a, b) {\n return b[1] - a[1];\n });\n\n m = 0;\n\n for (; i < l; i++) {\n\n x = ys[i][0];\n px = this.serie.getX(x);\n k = 0;\n y = this.serie.getY(ys[i][1]);\n\n if (px < this.serie.getXAxis().getMinPx() || px > this.serie.getXAxis().getMaxPx()) {\n continue;\n }\n\n if (!this.options.autoPeakPickingAllowAllY && (y > this.serie.getYAxis().getMinPx() || y < this.serie.getYAxis().getMaxPx())) {\n\n continue;\n }\n\n // Distance check\n for (; k < passed.length; k++) {\n if (Math.abs(passed[k] - px) < this.options.autoPeakPickingMinDistance) {\n break;\n }\n }\n if (k < passed.length) {\n continue;\n }\n\n // Distance check end\n\n // If the retained one has already been selected somewhere, continue;\n if ((index = selected.indexOf(x)) > -1) {\n passed.push(px);\n continue;\n }\n\n if (!this.picks[m]) {\n return;\n }\n\n //console.log( this.getYAxis().getDataMax(), this.getYAxis().getCurrentMin(), y );\n // this.picks[ m ].show();\n\n if (this.serie.getYAxis().getPx(ys[i][1]) - 20 < 0) {\n\n this.picks[m].setLabelPosition({\n x: x,\n y: '5px'\n });\n\n this.picks[m].setLabelBaseline('hanging');\n } else {\n\n this.picks[m].setLabelBaseline('no-change');\n\n this.picks[m].setLabelPosition({\n x: x,\n y: ys[i][1],\n dy: '-15px'\n });\n }\n\n this.picks[m].setProp('xval', x);\n\n if (this.options.autoPeakPickingFormat) {\n\n this.picks[m].setLabelText(this.options.autoPeakPickingFormat.call(this.picks[m], x, m));\n } else {\n this.picks[m].setLabelText(String(Math.round(x * 1000) / 1000));\n }\n\n this.picks[m].makeLabels();\n\n m++;\n while (this.picks[m] && this.picks[m].isSelected()) {\n m++;\n }\n\n if (passed.length == this.options.autoPeakPickingNb) {\n break;\n }\n }\n }\n\n /**\n * Hides the automatic peak picking (see the autoPeakPicking option)\n * @memberof SerieLine\n */\n hidePeakPicking(lock) {\n\n if (!this._hidePeakPickingLocked) {\n this._hidePeakPickingLocked = lock;\n }\n\n if (!this.graph.picks) {\n return;\n }\n for (var i = 0; i < this.graph.picks.length; i++) {\n this.graph.picks[i].hide();\n }\n }\n\n /**\n * Shows the automatic peak picking (see the autoPeakPicking option)\n * @memberof SerieLine\n */\n showPeakPicking(unlock) {\n\n if (this._hidePeakPickingLocked && !unlock) {\n return;\n }\n\n if (!this.graph.picks) {\n return;\n }\n\n for (var i = 0; i < this.graph.picks.length; i++) {\n this.graph.picks[i].show();\n }\n }\n\n killPeakPicking() {\n\n if (this.picks) {\n for (var i = 0, l = this.picks.length; i < l; i++) {\n this.picks[i].kill();\n }\n }\n }\n}\n\n// Corrent naming is important here !\n\nGraph$1.registerConstructor('graph.position', Position);\n\nGraph$1.registerConstructor('graph.axis.x', AxisX);\nGraph$1.registerConstructor('graph.axis.y', AxisY);\nGraph$1.registerConstructor('graph.axis.x.bar', AxisXBar);\nGraph$1.registerConstructor('graph.axis.x.time', GraphTimeAxis);\n\nGraph$1.registerConstructor('graph.serie.line', SerieLine);\nGraph$1.registerConstructor('graph.serie.line.3d', SerieLine3D);\nGraph$1.registerConstructor('graph.serie.line.color', SerieLineColor);\nGraph$1.registerConstructor('graph.serie.contour', SerieContour);\nGraph$1.registerConstructor('graph.serie.bar', SerieBar);\nGraph$1.registerConstructor('graph.serie.box', SerieBox);\nGraph$1.registerConstructor('graph.serie.scatter', SerieScatter);\nGraph$1.registerConstructor('graph.serie.zone', SerieZone);\nGraph$1.registerConstructor('graph.serie.zone.3d', SerieZone3D);\nGraph$1.registerConstructor('graph.serie.densitymap', SerieDensityMap);\n\nGraph$1.registerConstructor(Graph$1.SERIE_LINE, SerieLine);\nGraph$1.registerConstructor(Graph$1.SERIE_LINE_3D, SerieLine3D);\nGraph$1.registerConstructor(Graph$1.SERIE_LINE_COLORED, SerieLineColor);\nGraph$1.registerConstructor(Graph$1.SERIE_CONTOUR, SerieContour);\nGraph$1.registerConstructor(Graph$1.SERIE_BAR, SerieBar);\nGraph$1.registerConstructor(Graph$1.SERIE_BOX, SerieBox);\nGraph$1.registerConstructor(Graph$1.SERIE_SCATTER, SerieScatter);\nGraph$1.registerConstructor(Graph$1.SERIE_ZONE, SerieZone);\nGraph$1.registerConstructor(Graph$1.SERIE_ZONE_3D, SerieZone3D);\nGraph$1.registerConstructor(Graph$1.SERIE_DENSITYMAP, SerieDensityMap);\n\n//Graph.registerConstructor( \"graph.serie.line.broken\", GraphSerieLineBroken );\n\nGraph$1.registerConstructor('graph.plugin.shape', PluginShape);\nGraph$1.registerConstructor('graph.plugin.drag', PluginDrag);\nGraph$1.registerConstructor('graph.plugin.zoom', PluginZoom);\nGraph$1.registerConstructor('graph.plugin.selectScatter', PluginSelectScatter);\nGraph$1.registerConstructor('graph.plugin.timeSerieManager', PluginTimeSerieManager);\nGraph$1.registerConstructor('graph.plugin.serielinedifference', PluginSerieLineDifference);\nGraph$1.registerConstructor('graph.plugin.serieLineDifference', PluginSerieLineDifference);\nGraph$1.registerConstructor('graph.plugin.axissplitting', PluginAxisSplitting);\nGraph$1.registerConstructor('graph.plugin.makeTracesDifferent', PluginMakeTracesDifferent);\nGraph$1.registerConstructor('graph.plugin.peakPicking', PluginPeakPicking);\n\nGraph$1.registerConstructor('graph.shape', Shape);\nGraph$1.registerConstructor('graph.shape.areaundercurve', ShapeSurfaceUnderCurve);\nGraph$1.registerConstructor('graph.shape.arrow', ShapeArrow);\nGraph$1.registerConstructor('graph.shape.ellipse', ShapeEllipse);\nGraph$1.registerConstructor('graph.shape.label', ShapeLabel);\nGraph$1.registerConstructor('graph.shape.polyline', ShapePolyline);\nGraph$1.registerConstructor('graph.shape.line', ShapeLine);\nGraph$1.registerConstructor('graph.shape.nmrintegral', ShapeNMRIntegral);\nGraph$1.registerConstructor('graph.shape.html', ShapeHTML);\nGraph$1.registerConstructor('graph.shape.peakintegration2d', ShapePeakIntegration2D);\n// Graph.registerConstructor( \"graph.shape.peakinterval\", GraphShapePeakInterval );\n// Graph.registerConstructor( \"graph.shape.peakinterval2\", GraphShapePeakInterval2 );\n// Graph.registerConstructor( \"graph.shape.rangex\", GraphShapeRangeX );\nGraph$1.registerConstructor('graph.shape.rect', ShapeRectangle);\nGraph$1.registerConstructor('graph.shape.rectangle', ShapeRectangle);\nGraph$1.registerConstructor('graph.shape.cross', ShapeCross);\n//Graph.registerConstructor( \"graph.shape.zoom2d\", GraphShapeZoom2D );\nGraph$1.registerConstructor('graph.shape.peakboundariescenter', ShapePeakBoundaries);\n\n// Graph.registerConstructor( \"graph.toolbar\", GraphToolbar );\nGraph$1.registerConstructor('graph.legend', Legend);\nGraph$1.registerConstructor('graph.waveform', Waveform);\n\nexport default Graph$1;\n\n//# sourceMappingURL=jsgraph-module.js.map"]} \ No newline at end of file +{"version":3,"sources":["jsgraph-module.js"],"names":["extend","_parsePx","indexOf","parseInt","replace","isNumeric","isNaN","parseFloat","isFinite","Position","constructor","x","y","dx","dy","duplicate","compute","hasXAxis","hasYAxis","throw","_compute","_relativeTo","getXAxis","getYAxis","getPx","console","warn","searchClosestValue","getY","yMin","getName","_parsePercent","getRelPx","_getPositionPx","getPos","getDrawingWidth","getDrawingHeight","getDeltaPx","deltaPosition","getValPosition","getRelVal","getMaxValue","getMinValue","getMinPx","getMaxPx","getPxRel","relativeTo","check","setAttributeTo","setAttributeNS","setAttribute","mapEventEmission","substring","toLowerCase","on","apply","arguments","guid","random","toString","throwError","error","isNumeric$1","Array","isArray","hue2rgb","hslToRgb","Math","round","saveDomAttributes","_savedAttributesIds","restoreDomAttributes","_savedAttributes","_attributes","push","getAttribute","hasSavedAttribute","overwriteDomAttribute","splice","length","debounce","clearTimeout","setTimeout","SVGParser","DOMParser","parseFromString","getOffset","getBoundingClientRect","top","left","setCSS","style","ajaxGet","Promise","XMLHttpRequest","open","type","url","json","setRequestHeader","onload","status","responseText","JSON","parse","Error","onerror","send","hasOwn","Object","prototype","hasOwnProperty","toStr","call","isPlainObject","extend$1","mix","emptyDom","firstChild","removeChild","EventEmitter","proto","indexOfListener","listener","alias","getListeners","_getEvents","RegExp","test","flattenListeners","getListenersAsObject","addListener","once","addOnceListener","defineEvent","defineEvents","removeListener","off","addListeners","manipulateListeners","removeListeners","removeEvent","_events","removeAllListeners","emitEvent","_getOnceReturnValue","trigger","emit","slice","setOnceReturnValue","_onceReturnValue","FitHost","DELTAP","BIGVAL","WEIGHT","setYData","dataY","setXData","dataX","setWeight","weight","setInitialParams","params","subsetIndex","setSubset","setFunction","function","progress","hookIteration","options","data","parms","map","NPARMS","_from","_to","_hookIteration","buildFit","_func","init","NPTS","getLength","arrY","getDataY","arrX","getDataX","resid","fill","jac","fit","log","join","LM","_result","done","func","computeResiduals","nudge","buildJacobian","getResidualElement","getJacobianElement","getMin","getMax","waveform","setData","LMITER","LMBOOST","LMSHRINK","LAMBDAZERO","LAMBDAMAX","LMTOL","sos","sosprev","lambda","myH","nadj","npts","delta","beta","alpha","amatrix","bLMiter","gaussj","abs","Waveform","xOffset","xScale","forEach","setXWaveform","_makeArray","isNaNAllowed","_setData","dataInUse","getScale","getShift","xdata","computeXMinMax","hasXWaveform","getXWaveform","append","getX","rescaleX","getTypedArrayClass","_typedArrayClass","setTypedArrayClass","name","isUnsigned","from","Float32Array","Float64Array","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","recalculateMinMaxNewPoint","minX","maxX","minY","maxY","prepend","unshift","monotoneous","getMonotoneousAscending","_monotoneousAscending","_monotoneous","min","max","getDataInUse","getIndexFromVal","getIndexFromData","dataInUseType","getIndexFromX","getData","isMonotoneous","trace","binarySearch","getReductionType","getXMin","getXScale","getXShift","getXMax","getYMin","getYMax","getMinX","getMaxX","getMinY","getMaxY","setShift","shift","scale","setScale","setXShift","setXScale","getDataToUseFlat","getXRaw","_integrateP","integrateP","integrate","average","getAverageP","mean","getAverageX","_integrateX","checkMonotonicity","requireXMonotonicity","requireMonotonicity","isXMonotoneous","invert","reverse","resampleForDisplay","xPosition","resampleToPx","interpolate","floor","interpolateIndex_X","getXMonotoneousAscending","isXMonotoneousAscending","divide","_arithmetic","DIVIDE","divideBy","multiply","MULTIPLY","multiplyBy","logBase","ln","E","add","ADD","addBy","subtract","SUBTRACT","subtractBy","math","_waveArithmetic","_numberArithmetic","aggregate","_dataAggregating","_dataAggregated","_dataAggregationDirection","toUpperCase","pow2floor","aggregator","numPoints","direction","then","aggregates","hasAggregation","selectAggregatedData","pow2ceil","xShift","subrangeX","findLocalMinMax","findLocalMinMaxIndex","Number","NEGATIVE_INFINITY","POSITIVE_INFINITY","setUnit","unit","setXUnit","xunit","getUnit","getXUnit","hasXUnit","hasUnit","findLevels","box","edge","rounding","rangeP","findLevel","ceil","rangeX","getIndexInterpolate","normalize","Symbol","GraphOptionsDefault","title","paddingTop","paddingBottom","paddingLeft","paddingRight","close","right","bottom","closeColor","fontSize","fontFamily","plugins","pluginAction","mouseActions","keyActions","wheel","dblclick","shapesUnselectOnClick","shapesUniqueSelection","defaultScatterStyle","shape","r","_constructors","Map","Graph$1","_creation","_drawn","HTMLElement","document","getElementById","doDom","bind","setWrapper","prevented","axis","shapes","shapesLocked","plugin","selectedShapes","series","_axesHaveChanged","padding","currentAction","ns","nsxlink","getTopAxis","getLeftAxis","getRightAxis","getBottomAxis","_pluginsInit","appendChild","position","outline","wrapper","height","width","getComputedStyle","setSize","_resize","dom","_registerEvents","getDom","getId","getWrapper","setOption","setTitle","domTitle","textContent","displayTitle","hideTitle","hide","display","show","redraw","sizeSet","haveAxesChanged","hasSizeChanged","executeRedrawSlaves","refreshDrawingZone","_pluginsExecute","draw","drawn","updateLegend","drawSeries","delayUpdate","_lockUpdate","doUpdate","legend","update","resumeUpdate","isDelayedUpdate","setWidth","setHeight","resize","getWidth","getHeight","getPaddingTop","getPaddingLeft","getPaddingBottom","getPaddingRight","innerHeight","innerWidth","cacheOffset","offsetCached","uncacheOffset","_getAxis","setXAxis","setBottomAxis","setYAxis","setLeftAxis","kill","setRightAxis","setTopAxis","killAxis","isX","isY","axisGroup","group","groupPrimaryGrids","gridPrimary","groupSecondaryGrids","gridSecondary","hasTopAxis","hasBottomAxis","hasLeftAxis","hasRightAxis","hasAxis","autoscaleAxes","_applyToAxes","autoscale","autoScale","autoScaleAxes","autoScaleAxis","setMinMaxToFitSeries","setBackgroundColor","rectEvent","getAxisState","getCurrentMin","getCurrentMax","setAxisState","setCurrentMin","setCurrentMax","saveAxisState","savedAxisState","recallAxisState","_applyToAxis","getBoundaryAxis","getBoundaryAxisFromSeries","Infinity","getSeriesFromAxis","isShown","updateDataMinMaxAxes","setMaxValueData","setMinValueData","findAxesLinkedTo","linkedToAxis","getConstructor","_axisHasChanged","newSerie","SERIE_LINE","getSerie","makeSerie","getSeries","allSeries","filter","include","getType","drawSerie","resetSeries","removeSeries","killSeries","selectSerie","selectedSerie","selectionType","unselectSerie","triggerEvent","select","getSelectedSerie","unselect","getShapesOfSerie","makeToolbar","toolbar","getShapes","newShape","prevent","_id","graph","_data","properties","setProperties","props","setProp","setPosition","fillColor","setFillColor","fillOpacity","setFillOpacity","strokeColor","setStrokeColor","strokeWidth","setStrokeWidth","layer","setLayer","locked","lock","movable","selectable","resizable","attributes","handles","selectOnMouseDown","selectOnClick","transforms","value","addTransform","highlightOnMouseOver","labelEditable","labels","label","showLabel","setLabelText","text","setLabelPosition","setLabelColor","color","setLabelSize","size","setLabelAngle","angle","setLabelBaseline","baseline","setLabelAnchor","anchor","setLabelBackgroundColor","backgroundColor","setLabelBackgroundOpacity","backgroundOpacity","serie","setSerie","createHandles","applyStyle","newPosition","redrawShapes","removeShapes","selectShape","isSelectable","unselectShapes","_select","getSelectedShapes","unselectShape","cancelUnselectShape","_unselect","_removeShape","appendShapeToDom","isHTML","insertBefore","_dom","getLayer","removeShapeFromDom","appendSerieToDom","groupMain","removeSerieFromDom","layers","createElementNS","nextSibling","plotGroup","focus","elementMoving","bypassHandleMouse","stopElementMoving","_makeClosingLines","closingLines","graphingZone","isActionAllowed","enabled","key","keyCode","ctrl","meta","alt","shiftKey","ctrlKey","metaKey","altKey","forcePlugin","forcedPlugin","unforcePlugin","_pluginExecute","pluginYieldActiveState","activePlugin","_serieExecute","getPlugin","makeLegend","getLegend","requireLegendUpdate","requireDelayedUpdate","orthogonalProjectionSetup","zAxis","maxZ","minZ","shiftX","shiftY","xAxis","yAxis","orthogonalProjectionUpdate","g","l","groupGrids","getZProj","getZPos","sort","_removeSerie","contextListen","onContextMenuListen","lockShapes","moving","resizing","unlockShapes","_getXY","clientX","clientY","_sizeChanged","updateGraphingZone","getDrawingSpaceWidth","drawingSpaceWidth","getDrawingSpaceHeight","drawingSpaceHeight","getDrawingSpaceMinX","drawingSpaceMinX","getDrawingSpaceMinY","drawingSpaceMinY","getDrawingSpaceMaxX","drawingSpaceMaxX","getDrawingSpaceMaxY","drawingSpaceMaxY","trackingLine","enable","mode","addSerieToTrackingLine","disableTracking","noLine","trackingObject","stroke","trackingLineShapeOptions","assign","enableTracking","getPosition","trueX","_trackingLegend","_trackingLegendSerie","textMethod","valueToHtml","yValue","trackingShape","setKatexRenderer","_katexRenderer","hasKatexRenderer","renderWithKatex","createElement","fromJSON","labelValue","unitWrapperAfter","unitWrapperBefore","forcedMin","forcedMax","flip","flipped","_jsGraphIndex","SERIE_LINE_COLORED","SERIE_SCATTER","SERIE_BOX","orientation","newWaveform","id","lineStyle","unselected","entries","lineWidth","lineColor","setStyle","defaultStyle","defaultStyles","styles","Set","keys","concat","zoom","points","setMarkers","setColors","errorX","errorBarX","errorBoxX","errorY","errorBarY","errorBoxY","setErrorBarXAbove","setErrorBarStyle","setErrorBoxXAbove","setErrorBoxXBelow","setErrorBoxAbove","setErrorBoxBelow","setErrorBoxStyle","autoAxis","boxes","setWaveform","exportToSchema","SERIE_BAR","isFlipped","styleName","markers","getLabel","registerConstructor","has","set","get","getAxisLevelFromSpan","_painted","hideGroup","showGroup","floating","getSpan","setLevel","getAxisPosition","reduce","getLevel","setMinPx","setMaxPx","equalizePosition","getFloatingAxis","getFloatingValue","_closeLine","clipRect","drawLines","_handleKey","checkKeyActions","preventDefault","stopPropagation","callback","removeSelectedShape","keepInDom","defs","groupEvent","clip","markerArrow","markerHorizontalSplit","markerVerticalSplit","vertLineArrow","addEventListener","_handleMouseMove","_handleMouseLeave","which","_handleMouseDown","_handleMouseUp","_handleDblClick","_handleClick","wheelDeltaY","wheelDelta","deltaY","_handleMouseWheel","checkMouseActions","handleMouseMove","snapToSerie","xClosest","withinPx","withinVal","onMouseMoveData","_makeTrackingLegend","getVal","xValue","yClosest","index","serieShape","rx","getLineWidth","ry","getLineColor","forceParentDom","onCreated","onChanged","magnet","within","forceTrackingLegendMode","_trackingLegendMove","innerHTML","Date","now","marginLeft","marginTop","window","requestAnimationFrame","offsetHeight","offsetWidth","borderRadius","boxShadow","border","pointerEvents","handleMouseUp","target","jsGraphIsShape","def","time","bar","broken","isDisplayed","handleMouseLeave","SERIE_CONTOUR","SERIE_ZONE","SERIE_DENSITYMAP","SERIE_LINE_3D","SERIE_ZONE_3D","TICKS_OUTSIDE","TICKS_INSIDE","TICKS_CENTERED","legendDefaults","frame","frameWidth","frameColor","frameRounding","shapesToggleable","isSerieHideable","isSerieSelectable","Legend","svg","subG","groups","rect","rectBottom","pos","transformX","transformY","setEvents","eyeId","eyeCrossedId","adoptNode","documentElement","alignToX","alignToY","setDraggable","setAutoPosition","autoPosition","buildLegendBox","excludedFromLegend","getBBox","cursor","bbox","calculatePosition","_setPosition","_requiredUpdate","hasChildNodes","lastChild","getSymbolForLegend","getMarkerForLegend","getTextForLegend","isHideable","hideShapesOnHideSerie","isSelected","notHideable","hideable","seriesHideable","isToggleShapes","mousedown","fixSeries","fixSeriesAdd","defaults","lineAt","axisDataSpacing","unitModification","primaryGrid","secondaryGrid","primaryGridColor","secondaryGridColor","primaryGridWidth","secondaryGridWidth","hideWhenNoSeriesShown","shiftToZero","tickPosition","nbTicksPrimary","nbTicksSecondary","ticklabelratio","exponentialFactor","exponentialLabelFactor","logScale","span","marginMin","marginMax","scientificScale","scientificScaleExponent","engineeringScale","unitInTicks","splitMarks","tickLabelOffset","useKatexForLabel","Axis","unitModificationTimeTicks","hasChanged","_lines","line","groupTicks","groupTickLabels","labelTspan","preunit","unitTspan","expTspan","expTspanExp","setTickPosition","gridLinePath","primary","secondary","setGridLinesStyle","groupSeries","widthHeightTick","ticks","ticksLabels","tickScaling","currentTick","lastCurrentTick","totalDelta","handleMouseMoveLocal","addLabel","setDisplay","_hidden","setLineAt","adaptTo","thisValue","foreignValue","preference","adapt","currentAxisMin","currentAxisMax","_zoomed","getInterval","setFloating","floatingAxis","floatingValue","setAxisDataSpacing","dataSpacing","setAxisDataSpacingMin","setAxisDataSpacingMax","minPx","setMinMaxFlipped","maxPx","minPxFlipped","maxPxFlipped","getMathMaxPx","getMathMinPx","dataMin","dataMax","getDataMax","getDataMin","forceMin","forceMax","getForcedMin","getForcedMax","forceToAxis","getNbTicksPrimary","setNbTicksPrimary","getNbTicksSecondary","setNbTicksSecondary","mouseVal","handleMouseWheel","_doZoomVal","zoomLock","_zoomLocked","_doZoom","cacheCurrentMin","cacheCurrentMax","cacheInterval","_hasChanged","getSerieShift","_serieShift","getSerieScale","_serieScale","getMouseVal","getUnitPerTick","pow","decimals","cache","getCurrentInterval","cachedInterval","cachedCurrentMin","cachedCurrentMax","_draw","scientificExponent","unitDecade","getEngineeringExponent","getExponentGreekLetter","writeUnit","preunitTspan","katexElement","hideTicks","resetTicksLength","deltaPx","drawLinkedToAxisTicksWrapper","drawLinearTicksWrapper","drawLogTicks","removeUselessTicks","removeUselessTickLabels","_drawLine","_hideLine","primaryTickUnit","maxPrimaryTickUnit","minPrimaryTickUnit","drawTicks","secondaryTicks","forcePrimaryTickUnit","forcePrimaryTickUnitMax","forcePrimaryTickUnitMin","getPrimaryTickUnit","incrTick","setTickLabelRatio","doesHideWhenNoSeriesShown","_widthLabels","subIncrTick","drawTickWrapper","getMaxSizeTick","nextTick","nextTickLabel","lastCurrentTickLabel","currentTickLabel","nextGridLine","setGridLineStyle","getPrimaryGridColor","getSecondaryGridColor","getPrimaryGridWidth","getSecondaryGridWidth","getPrimaryGridOpacity","getSecondaryGridOpacity","getPrimaryGridDasharray","getSecondaryGridDasharray","exponential","overwrite","drawTick","linkToAxis","scalingFunction","getRoundedPx","exp","valueToText","toFixed","getExponentialFactor","getExponentialLabelFactor","modifyUnit","getModifiedValue","setExponentialFactor","setExponentialLabelFactor","setLabel","setLabelFont","labelFont","setSpan","_level","tickPx1","tickPx2","setGrids","setPrimaryGrid","setSecondaryGrid","primaryGridOn","primaryGridOff","secondaryGridOn","secondaryGridOff","gridsOn","gridsOff","turnGridsOff","turnGridsOn","setAxisColor","axisColor","getAxisColor","setTickLabelOffset","setPrimaryTicksColor","primaryTicksColor","getPrimaryTicksColor","setSecondaryTicksColor","secondaryTicksColor","getSecondaryTicksColor","setTicksLabelColor","ticksLabelColor","getTicksLabelColor","setPrimaryGridColor","setSecondaryGridColor","setPrimaryGridWidth","setSecondaryGridWidth","setPrimaryGridOpacity","primaryGridOpacity","setSecondaryGridOpacity","secondaryGridOpacity","setPrimaryGridDasharray","primaryGridDasharray","setSecondaryGridDasharray","secondaryGridDasharray","labelColor","getLabelColor","setTickContent","setUnitInTicks","setUnitWrapper","setUnitDecade","setScientific","setScientificScaleExponent","setEngineering","setLogScale","isZoomed","getValue","AxisX","dominantBaseline","drawLabel","drawSpecifics","AxisY","leftright","setAxisPosition","shiftPosition","getAdditionalWidth","tickMargin","longestTick","getComputedTextLength","fullwidthlabel","placeLabel","isLeft","isRight","scaleToFitAxis","AxisXBar","categories","_barCategories","autoSeries","setSeries","setCategoryConfig","_getUsedCategories","getUsedCategories","setDataIndices","axisFormat","threshold","increments","increment","format","dateFormat","SyntaxError","masks","default","getTimezoneOffset","d","dd","ddd","i18n","dayNames","dddd","m","mm","mmm","monthNames","mmmm","yy","yyyy","h","hh","H","HH","M","MM","s","ss","L","t","tt","T","TT","Z","match","pop","o","S","W","shortDate","mediumDate","longDate","fullDate","shortTime","mediumTime","longTime","isoDate","isoTime","isoDateTime","isoUtcDateTime","getClosestIncrement","roundDate","setSeconds","getSeconds","setMilliseconds","setMinutes","getMinutes","setHours","getHours","setDate","getDate","setMonth","getMonth","incrementDate","setFullYear","getFullYear","getGroup","line1","line2","cloneNode","hideGroups","getDateText","renderGroup","substr","GraphTimeAxis","getTime","Serie","redrawShapesAfterDraw","beforeDraw","afterDraw","_addData","clearData","setOptions","hidden","hideImpl","showImpl","toggleDisplay","axisCheck","selected","_checkX","_checkY","autoAxes","xaxis","yaxis","setAxes","getWaveform","getWaveforms","dataHasChanged","lineForLegend","applyLineStyle","setLegendSymbolStyle","updateStyle","textForLegend","getIndex","setFlip","getFlip","styleHasChanged","_changedStyles","hasStyleChanged","_dataHasChanged","hasDataChanged","setInfo","infos","getInfo","setAdditionalData","additionalData","getAdditionalData","_tracker","_trackingCallback","_trackingOutCallback","_trackerDom","remove","allowTrackingLine","_type","_excludedFromLegend","categoryIndices","nbCategories","hasErrors","hasErrorBars","ErrorBarMixin","makeBarY","makeBoxY","makeBarX","makeBoxX","errorbarStyle","_setErrorStyle","errorboxStyle","strokeOpacity","all","errorDrawInit","paths","errorAddPoint","getErrorBarXBelow","getErrorBarXAbove","getErrorBarYBelow","getErrorBarYAbove","getErrorBoxXBelow","getErrorBoxXAbove","getErrorBoxYBelow","getErrorBoxYAbove","errorAddPointBarChart","doErrorDraw","errorDraw","SerieLine","trackMouse","trackMouseLabel","trackMouseLabelRouding","lineToZero","selectableOnClick","markersIndependant","overflowX","overflowY","markerFamilies","extendStyles","markersDom","shown","_isMinOrMax","groupLines","domMarker","marker","markerLabel","markerLabelSquare","domMarkerHover","domMarkerSelect","markerHovered","groupMarkerSelected","markerPoints","lines","groupMarkers","independantMarkers","initExtended1","applyLineStyles","onMouseOverMarker","toggleMarker","onMouseOutMarker","markersOffHover","setMarkerStyleTo","getMarkerCurrentFamily","getMarkerPath","split","markersOffSelect","onClickOnMarker","onSelectMarker","onUnselectMarker","onToggleMarker","_getMarkerIndexFromEvent","searchIndexByPxXY","onMouseWheel","empty","areMarkersShown","degrade","degradationPx","drawInit","currentLineId","counter","currentLine","_dataToUse","_xDataToUse","xData","removeLinesGroup","_afterLinesGroup","insertLinesGroup","removeExtraLines","_slotToUse","eraseMarkers","lookForMaxima","lookForMinima","markerFamily","pos0","insertMarkers","markersShown","_createLine","counter2","_addPoint","children","markerCurrentFamily","getMarkerDom","hideTrackingMarker","drawMarkerXY","getLineDashArray","removeAttribute","path","getMarkerDomIndependent","getIndexFromXY","indexMin","indexMax","indexClosest","xMin","xMax","yMax","xExact","xBefore","xAfter","yBefore","yAfter","interpolatedY","dataIndex","xBeforeIndexArr","setLineStyle","getLineStyle","getStyle","extendStyle","_recalculateMarkerPoints","setLineWidth","setLineColor","showMarkers","hideMarkers","isMarkersShown","setMarkersPoints","_extendMarkers","setMarkersColor","setMarkersType","setMarkersZoom","setMarkersStrokeColor","setMarkersStrokeWidth","setMarkersFillColor","markerPath","currentMarkersSelectionType","markerForLegend","parentNode","xmonotoneous","Serie3DMixin","zpos","getZCorrectedValue","SerieLine3D","setZPos","setz","SerieBar","pathDom","MAX_SAFE_INTEGER","MIN_SAFE_INTEGER","getFillColor","getFillOpacity","SerieBox","maxBoxWidth","meanLineColor","meanLineWidth","boxAboveLineWidth","boxAboveLineColor","boxAboveFillColor","boxAboveFillOpacity","boxBelowLineWidth","boxBelowLineColor","boxBelowFillColor","boxBelowFillOpacity","barAboveLineColor","barAboveLineWidth","barBelowLineColor","barBelowLineWidth","outlierLineWidth","outlierLineColor","outlierFillColor","outlierFillOpacity","Q2","Q3","Q1","whiskers","outliers","_style","_set","_gstyle","setMeanLineColor","getMeanLineColor","setMeanLineWidth","getMeanLineWidth","setBoxAboveLineColor","getBoxAboveLineColor","setBoxBelowLineColor","getBoxBelowLineColor","setBoxAboveLineWidth","getBoxAboveLineWidth","setBoxBelowLineWidth","getBoxBelowLineWidth","setBoxAboveFillColor","getBoxAboveFillColor","setBoxBelowFillColor","getBoxBelowFillColor","setBoxAboveFillOpacity","getBoxAboveFillOpacity","setBoxBelowFillOpacity","getBoxBelowFillOpacity","setBarAboveLineColor","getBarAboveLineColor","setBarBelowLineColor","getBarBelowLineColor","setBarAboveLineWidth","getBarAboveLineWidth","setBarBelowLineWidth","getBarBelowLineWidth","setOutlierLineColor","getOutlierLineColor","setOutlierLineWidth","getOutlierLineWidth","setOutlierFillColor","getOutlierFillColor","setOutlierFillOpacity","getOutlierFillOpacity","_linkedToScatterSeries","applyMeanStyle","boxPos","applyBoxStyle","setOutlierStyle","applyWhiskerStyle","getCategoryIndex","linkToScatterSerie","SerieLineColor","colors","eraseLines","latchLines","_rgb","object","SerieScatter","MIN_VALUE","MAX_VALUE","shapesDetails","groupPoints","selectedStyleGeneral","selectedStyleModifiers","parentElement","cx","cy","setDataCategory","symbol","doShape","modifiers","extraStyle","stdStylePerso","stdStyle","unselectPoint","selectPoint","selectPoints","SerieZone","groupZones","lineZone","clipId","waveforms","setWaveforms","setMinMaxWaveforms","getLineOpacity","setLineOpacity","lineOpacity","SerieZone3D","SerieDensityMap","rects","recalculateBinsOnDraw","calculateDensity","maxIndexX","maxIndexY","binMin","binMax","deltaX","fromX","fromY","numX","numY","densitymap","setDensityMap","calculateDensityWeighted","autoBins","setPxPerBin","calculationDensityMap","to","pxPerBin","weighted","setBinsFromTo","densityMapCalculation","numBins","method","calculateDensityAdvanced","num","weighing","densityMapCalculate","setColorMapBinBoundaries","colorMapMin","colorMapMax","autoColorMapBinBoundaries","onRedrawColorMapBinBoundaries","callbackColorMapMinMax","colorMapHSL","a","opacities","colorMap","colorMapNum","autoColorMapHSL","colorMapHSV","getColorIndex","drawRects","SerieContour","negativeDelta","positiveDelta","negativeThreshold","positiveThreshold","segments","zValue","zValues","setColorTo","hasNegative","_shapeZoom","setHandleNeg","showHandleNeg","hideHandleNeg","setHandlePos","setDynamicColor","lineColors","setNegative","fromPositive","toPositive","fromNegative","toNegative","setShapeZoom","Shape","_selected","createDom","classes","masker","maskingId","maskDomWrapper","maskDom","handleMouseOver","handleMouseOut","handleMouseDown","handleClick","handleDblClick","initImpl","_inDom","isHidden","isVisible","addClass","makeClasses","removeClass","changed","setEventReceptacle","getProp","appendToDom","makeLabels","applyPosition","redrawImpl","updateLabels","_applyTransforms","getRelativePosition","exec","getLabelPosition","getProperties","getProps","addProp","resetProp","setDom","setDomGroup","overwriteSavedProp","applySelectedStyle","getStrokeColor","getStrokeWidth","setStrokeDasharray","setAttributes","addAttribute","resetTransforms","setLabelData","getLabelText","displayLabel","hideLabel","setLabelFontSize","setLabelStrokeColor","setLabelStrokeWidth","applyGenericStyle","sortPositions","computePosition","_labels","_labelsBackground","labelDblClickListener","isLabelEditable","_applyLabelData","_getLabelAnchor","emptyLabels","_selectStatus","hasHandles","addHandles","isLocked","handlesInDom","removeHandles","hideHandles","areHandlesInDom","hasStaticHandles","setHandles","getSelectStyle","selectStyle","setSelectStyle","setStaticHandles","_createHandles","isResizable","handleSelected","handleMouseDownImpl","handleMouseMoveImpl","handleMouseUpImpl","handleCreateImpl","isMovable","self","moved","_mouseCoords","preventUnselect","highlight","unHighlight","unlock","unmovable","unresizable","unselectable","getHighlightAttributes","highlightImpl","unHighlightImpl","_highlightAttributes","setHighlightAttributes","getMaskingID","maskWith","updateMask","textAlign","removeEventListener","previousValue","nextValue","_forcedParentDom","ShapeSurfaceUnderCurve","resizingPosition","xBeforeIndex","firstX","firstY","lastX","lastY","ShapeLine","transform","currentPos2x","currentPos2y","currentPos1x","currentPos1y","vertical","horizontal","noX","noY","forcedCoords","ShapeArrow","nbHandles","ShapeEllipse","setR","triggerChange","ShapeLabel","ShapePolyline","setPointsPx","ShapeNMRIntegral","_domShadow","xor","getAxis","_sumVal","ratio","sumVal","lastPointX","lastPointY","_sum","firstPointX","firstPointY","ratioLabel","updateIntegralValue","handleCondition","toPrecision","_ratio","sum","selectHandles","ShapeRectangle","sides","currentX","currentY","currentW","currentH","_staticHandles","ShapePeakIntegration2D","element","setBindableToDom","ShapeCross","getFromData","ShapePeakBoundaries","lineHeight","line3","rectBoundary","redrawLines","posYPx","redrawY","setY","setLineHeight","lineHeihgt","ShapeHTML","div","setContent","setRenderer","_renderer","currentPosX","currentPosY","Plugin","onMouseDown","onMouseUp","onMouseMove","PluginDrag","dragX","dragY","persistanceX","persistanceY","totaltime","_draggingX","_draggingY","_lastDraggingX","_lastDraggingY","stopAnimation","speedX","speedY","_pluginDragMin","_pluginDragMax","accelerationX","accelerationY","_persistanceMove","PluginShape","shapeType","setShape","shapeInfo","count","onChange","currentShape","currentShapeEvent","onCreate","PluginSelectScatter","_path","xs","ys","findPoints","PluginZoom","_zoomingGroup","_zoomingSquare","zoomMode","_zoomingMode","_backedUpZoomMode","_zoomingXStart","_zoomingYStart","x1","y1","y2","forcedY","onZoomStart","onZoomMove","removeZone","e","mute","transition","smooth","fullX","toAxes","_pluginZoomMin","_pluginZoomMax","_pluginZoomMinFinal","_pluginZoomMaxFinal","fullY","onDblClick","pref","onZoom","gradualUnzoomStart","sin","PI","isFullX","isFullY","axes","memory","memoryHead","getFromMemory","prev","next","PluginTimeSerieManager","currentSlots","requestLevels","updateSerie","recalculateSeries","LRUName","intervals","maxParallelRequests","optimalPxPerPoint","nbPoints","create","requestsRunning","setURL","setAvailableIntervals","interval","_zoneSerie","registerPlugin","getOptimalInterval","cleanRegister","computeSlotID","computeTimeMin","register","processRequests","computeUniqueID","computeTimeMax","timeout","request","getURL","store","computeSlotTime","getZoneSerie","updateZoneSerie","recalculateSerie","minmax","recalculateSerieUpwards","setIntervalCheck","clearInterval","setInterval","lockRedraw","unlockRedraw","isRedrawLocked","PluginSerieLineDifference","positiveStyle","negativeStyle","pathsPositive","pathsNegative","positivePolyline","negativePolyline","serie1","serie2","setBoundaries","getFrom","getTo","xAfterIndex","computeCrossing","getPositivePolyline","getNegativePolyline","SerieLineExtended","subSeries","SerieScatterExtended","excludingMethods","addMethods","getOwnPropertyNames","PluginAxisSplitting","margins","high","low","newXAxis","newBottomAxis","newYAxis","newLeftAxis","newTopAxis","getOptions","SplitXAxis","SplitYAxis","newRightAxis","preDraw","splitNumber","splitAxis","getSubAxis","newLineSerie","newScatterSerie","defaultAxisConstructorOptions","SplitAxis","constructorOptions","_splitVal","_splits","fixGridIntervalBasedOnAxis","fixGridFor","splitSpread","autoSpread","_splitSpread","setChunkBoundaries","_mean","_baseWidthVal","_baseWidthIndex","topbottom","labelPosY","PluginMakeTracesDifferent","checkHSL","hue","saturation","lightness","buildHSLString","colorizeAll","serieTypes","startingColorHSL","colorHSL","endingColorHSL","affect","PluginPeakPicking","autoPeakPicking","autoPeakPickingNb","autoPeakPickingMinDistance","autoPeakPickingFormat","autoPeakPickingAllowAllY","picks","shapeOptions","minPosY","serieRemoved","detectedPeaks","lastYPeakPicking","postDraw","hidePeakPicking","_hidePeakPickingLocked","showPeakPicking","killPeakPicking"],"mappings":"AAAA,MAAOA,OAAP,KAAmB,QAAnB,CAEA,QAASC,SAAT,GAAsB,OAChB,IAAM,EAAGC,OAAT,EAAuC,CAAC,CAApB,GAAGA,OAAH,CAAW,IAAX,CADJ,EAEXC,SAAS,EAAGC,OAAH,CAAW,IAAX,CAAiB,EAAjB,CAAT,CAGV,CAED,QAASC,UAAT,GAAsB,CACpB,MAAO,CAACC,MAAMC,aAAN,CAAD,EAAyBC,WACjC,CAMD,KAAMC,SAAS,CAEbC,oBAA0B,CAER,QAAZ,UAFoB,EAGtB,KAAKC,CAAL,CAAS,EAAEA,CAHW,CAItB,KAAKC,CAAL,CAAS,EAAEA,CAJW,CAKtB,KAAKC,EAAL,CAAU,EAAEA,EALU,CAMtB,KAAKC,EAAL,CAAU,EAAEA,EANU,GAQtB,KAAKH,CAAL,EARsB,CAStB,KAAKC,CAAL,EATsB,CAUtB,KAAKC,EAAL,EAVsB,CAWtB,KAAKC,EAAL,EAXsB,CAazB,CAEDC,WAAY,CACV,MAAO,IAAIN,SAAJ,CAAa,KAAKE,CAAlB,CAAqB,KAAKC,CAA1B,CAA6B,KAAKC,EAAlC,CAAsC,KAAKC,EAA3C,CACR,CAUDE,gBAAoC,CAMlC,GAJ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CAA4B,4BAA5B,CAA0Dy9B,sBAA1D,C,CACA71C,QAAQoY,mBAAR,CAA4B,mBAA5B,CAAiD2+B,UAAjD,C,CACA/2C,QAAQoY,mBAAR,CAA4B,qBAA5B,CAAmD6+B,YAAnD,C,CACAj3C,QAAQoY,mBAAR,CAA4B,mBAA5B,CAAiDg/B,UAAjD,C,CACAp3C,QAAQoY,mBAAR,CAA4B,sBAA5B,CAAoDi/B,aAApD,C,CACAr3C,QAAQoY,mBAAR,CAA4B,kBAA5B,CAAgDg+B,SAAhD,C,CACAp2C,QAAQoY,mBAAR,CAA4B,yBAA5B,CAAuDm/B,gBAAvD,C,CACAv3C,QAAQoY,mBAAR,CAA4B,kBAA5B,CAAgD4hC,SAAhD,C,CACAh6C,QAAQoY,mBAAR,CAA4B,+BAA5B,CAA6D6gC,sBAA7D,C,CAIAj5C,QAAQoY,mBAAR,CAA4B,kBAA5B,CAAgDsgC,cAAhD,C,CACA14C,QAAQoY,mBAAR,CAA4B,uBAA5B,CAAqDsgC,cAArD,C,CACA14C,QAAQoY,mBAAR,CAA4B,mBAA5B,CAAiDghC,UAAjD,C,CAEAp5C,QAAQoY,mBAAR,CAA4B,kCAA5B,CAAgEkhC,mBAAhE,C,CAGAt5C,QAAQoY,mBAAR,CAA4B,cAA5B,CAA4C8G,MAA5C,C,CACAlf,QAAQoY,mBAAR,CAA4B,gBAA5B,CAA8CrjB,QAA9C,C,CAEA,cAAeiL,QAAf","file":"jsgraph-module.min.js","sourcesContent":["import extend from 'extend';\n\nfunction _parsePx(px) {\n if (px && px.indexOf && px.indexOf('px') > -1) {\n return parseInt(px.replace('px', ''));\n }\n return false;\n}\n\nfunction isNumeric(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n}\n\n/**\n * Utility class to compute positioning\n * @class\n */\nclass Position {\n\n constructor(x, y, dx, dy) {\n\n if (typeof x == 'object') {\n this.x = x.x;\n this.y = x.y;\n this.dx = x.dx;\n this.dy = x.dy;\n } else {\n this.x = x;\n this.y = y;\n this.dx = dx;\n this.dy = dy;\n }\n }\n\n duplicate() {\n return new Position(this.x, this.y, this.dx, this.dy);\n }\n\n /**\n * Computes the position of the position\n * @param {Graph} graph - The graph for which the position has to be computed\n * @param {AxisX} xAxis - The x axis to consider (has to belong to the graph)\n * @param {AxisY} yAxis - The y axis to consider (has to belong to the graph)\n * @param {Serie} [serie] - For non-existing y value, use a serie to compute it automatically from the serie data\n * @return {Object} An object in the format ```{x: xPx, y: yPx}``` containing the position in pixels of the position\n */\n compute(graph, xAxis, yAxis, serie) {\n\n if (!graph || !xAxis || !yAxis || !graph.hasXAxis || !graph.hasYAxis) {\n graph.throw();\n }\n\n if (!graph.hasXAxis(xAxis)) {\n throw 'Graph does not contain the x axis that was used as a parameter';\n }\n\n if (!graph.hasYAxis(yAxis)) {\n throw 'Graph does not contain the x axis that was used as a parameter';\n }\n\n return this._compute(graph, xAxis, yAxis, serie);\n }\n\n _compute(graph, xAxis, yAxis, serie) {\n\n var relativeTo = this._relativeTo;\n if (relativeTo) {\n var relativeToComputed = relativeTo._compute(graph, xAxis, yAxis, serie);\n }\n\n var parsed,\n pos = {\n x: false,\n y: false\n };\n\n if (!xAxis) {\n xAxis = graph.getXAxis();\n }\n\n if (!yAxis) {\n yAxis = graph.getYAxis();\n }\n\n for (var i in pos) {\n\n var axis = i == 'x' ? xAxis : yAxis;\n var val = this[i];\n var dval = this['d' + i];\n\n if (val === undefined && (dval !== undefined && relativeTo === undefined || relativeTo === undefined)) {\n\n if (i == 'x') {\n\n if (dval === undefined) {\n continue;\n }\n\n pos[i] = relativeTo ? relativeTo[i] : 0;\n } else if (this.x !== undefined && serie) {\n\n if (_parsePx(this.x) !== false) {\n console.warn('You have defined x in px and not y. Makes no sense. Returning 0 for y');\n pos[i] = 0;\n } else {\n\n var closest = serie.searchClosestValue(this.x);\n\n if (!closest) {\n console.warn('Could not find y position for x = ' + this.x + ' on serie \"' + serie.getName() + '\". Returning 0 for y.');\n pos[i] = 0;\n } else {\n pos[i] = serie.getY(closest.yMin);\n }\n }\n }\n } else if (val !== undefined) {\n\n pos[i] = this.getPx(val, axis);\n }\n\n if (dval !== undefined) {\n\n var def = val !== undefined || relativeToComputed == undefined || relativeToComputed[i] == undefined ? pos[i] : relativeToComputed[i];\n\n if (i == 'y' && relativeToComputed && relativeToComputed.x !== undefined && relativeToComputed.y == undefined) {\n\n if (!serie) {\n throw 'Error. No serie exists. Cannot find y value';\n return;\n }\n\n var closest = serie.searchClosestValue(relativeTo.x);\n if (closest) {\n def = serie.getY(closest.yMin);\n }\n\n //console.log( relativeTo.x, closest, serie.getY( closest.yMin ), def );\n }\n\n if (!def) {\n def = 0;\n }\n\n if ((parsed = _parsePx(dval)) !== false) {\n // dx in px => val + 10px\n\n pos[i] = def + parsed; // return integer (will be interpreted as px)\n } else if ((parsed = this._parsePercent(dval)) !== false) {\n\n pos[i] = def + this._getPositionPx(parsed, true, axis, graph); // returns xx%\n } else if (axis) {\n\n pos[i] = def + axis.getRelPx(dval); // px + unittopx\n }\n }\n }\n\n return pos;\n }\n\n _getPositionPx(value, x, axis, graph) {\n\n var parsed;\n\n if ((parsed = _parsePx(value)) !== false) {\n return parsed; // return integer (will be interpreted as px)\n }\n\n if ((parsed = this._parsePercent(value)) !== false) {\n return parsed / 100 * (x ? graph.getDrawingWidth() : graph.getDrawingHeight());\n } else if (axis) {\n return axis.getPos(value);\n }\n }\n\n _parsePercent(percent) {\n if (percent && percent.indexOf && percent.indexOf('%') > -1) {\n return percent;\n }\n return false;\n }\n\n /**\n * Computes the value in pixels of an amplitude (or a distance) for a certain axis\n * @param {Number} value - The value in axis unit\n * @param {Axis} Axis - The x axis to consider (has to belong to the graph)\n * @return {String} The value in pixels, e.g. \"20px\"\n */\n getDeltaPx(value, axis) {\n var v;\n if ((v = _parsePx(value)) !== false) {\n return v + 'px';\n } else {\n\n return axis.getRelPx(value) + 'px';\n }\n }\n\n deltaPosition(mode, delta, axis) {\n\n mode = mode == 'y' ? 'y' : 'x';\n var ref = this[mode],\n refd = this['d' + mode],\n refPx,\n deltaPx;\n\n if (ref !== undefined) {\n if ((refPx = _parsePx(ref)) !== false) {\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this[mode] = refPx + deltaPx + 'px';\n } else {\n this[mode] = refPx + axis.getRelPx(delta) + 'px';\n }\n } else {\n\n ref = this.getValPosition(ref, axis);\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this[mode] = ref + axis.getRelVal(deltaPx);\n } else {\n this[mode] = ref + delta;\n }\n }\n } else if (refd !== undefined) {\n\n if (mode == 'y' && ref === undefined && !this._relativeTo) {\n // This means that the shape is placed by the x value. Therefore, the dy is only a stand-off.\n // Therefore, we do nothing\n return;\n }\n\n if ((refPx = _parsePx(refd)) !== false) {\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this['d' + mode] = refPx + deltaPx + 'px';\n } else {\n this['d' + mode] = refPx + axis.getRelPx(delta) + 'px';\n }\n } else {\n\n refd = this.getValPosition(refd, axis);\n\n if ((deltaPx = _parsePx(delta)) !== false) {\n this['d' + mode] = refd + axis.getRelVal(deltaPx);\n } else {\n this['d' + mode] = refd + delta;\n }\n }\n }\n }\n\n getValPosition(rel, axis) {\n\n if (rel == 'max') {\n return axis.getMaxValue();\n }\n\n if (rel == 'min') {\n return axis.getMinValue();\n }\n\n return rel;\n }\n\n /**\n * Computes a value in pixels\n * @param {Number} value - The value in axis unit\n * @param {Axis} axis - The x or y axis to consider (has to belong to the graph)\n * @param {Boolean} rel - Whether or not the value is a distance\n * @return {(Number|String)} The computed value\n */\n getPx(value, axis, rel) {\n\n var parsed;\n\n if (typeof value == 'function') {\n\n return value(axis, rel);\n } else if ((parsed = _parsePx(value)) !== false) {\n\n return parsed; // return integer (will be interpreted as px)\n } else if ((parsed = this._parsePercent(value)) !== false) {\n\n return parsed; // returns xx%\n } else if (axis) {\n\n if (value == 'min') {\n\n return axis.getMinPx();\n } else if (value == 'max') {\n\n return axis.getMaxPx();\n } else if (rel) {\n\n return axis.getRelPx(value);\n } else if (isNumeric(value)) {\n\n return axis.getPos(value);\n }\n }\n }\n\n getPxRel(value, axis) {\n return this.getPx(value, axis, true);\n }\n\n /**\n * Assigns the current position as relative to another. This is used when a position is used with \"dx\" or \"dy\" and not \"x\" or \"y\"\n * @param {Position} pos - The reference position\n * @return {Position} The current position\n */\n relativeTo(pos) {\n this._relativeTo = Position.check(pos);\n return this;\n }\n\n /**\n * Checks if an object is a position. If not, creates a new Position instance with the ```pos``` object. If a new position is created, ```callback``` is fired with the position as a unique parameter. The return of the function, if not false, should be a ```Position``` instance which serves as the reference position.\n * @example Position.check( { x: 1, y: 2 }, function() { return someOtherPosition; } );\n * @param {(Object|Position)} pos - The position object or the object fed into the constructor\n * @param {Function} callback - The callback fired if a new position is created\n * @return {Position} The resulting position object\n */\n static check(pos, callback) {\n if (pos instanceof Position) {\n return pos;\n }\n\n var posObject = new Position(pos);\n\n if (pos && pos.relativeTo) {\n const position = callback(pos.relativeTo);\n if (position) {\n posObject.relativeTo(position);\n }\n }\n\n return posObject;\n }\n}\n\n/**\n * Easy set attribute method to apply to a SVG Element the attributes listed. Optional namespacing\n * @param {SVGElement} to - The SVG element to apply the attributes to\n * @param {Object} attr - A key/value hashmap of attributes\n * @param {String} [ ns = undefined ] - The namespace to use (with setAttributeNS). Default if without namespacing\n */\nfunction setAttributeTo(to, params, ns) {\n var i;\n\n if (ns) {\n for (i in params) {\n to.setAttributeNS(ns, i, params[i]);\n }\n } else {\n for (i in params) {\n to.setAttribute(i, params[i]);\n }\n }\n}\n\n/**\n * Maps old-style events defined within the creation (i.e. { onMouseOver: function() }) to modern event listening .on(\"mouseover\")\n * The function will read any object and select the ones starting with \"on\"\n * @params {Object} options - An option object to read the events from\n * @param {Object} source - The source object to which the options belong\n * @example util.mapEventEmission( this.options, this );\n */\nfunction mapEventEmission(options, source) {\n\n if (!source) {\n source = this;\n }\n\n var eventName;\n\n for (var i in options) {\n\n // Starts with onXXX\n if (i.indexOf('on') == 0 && typeof options[i] == 'function') {\n eventName = i.substring(2);\n eventName = eventName.substring(0, 1).toLowerCase() + eventName.substring(1);\n\n if (source.on) {\n\n (function (j) {\n\n source.on(eventName, function () {\n options[j].apply(source, arguments);\n });\n })(i);\n }\n }\n }\n}\n\n/**\n * @link http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript\n * @return {String} a random id\n */\nfunction guid() {\n //\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0,\n v = c == 'x' ? r : r & 0x3 | 0x8;\n return v.toString(16);\n });\n}\n\nfunction throwError(message) {\n console.error(message);\n}\n\nfunction warn(message) {\n console.warn(message);\n}\n\n/**\n * Checks if a variable is a numeric or not\n * @return {Boolean} true for a numeric value, false otherwise\n */\nfunction isNumeric$1(obj) {\n return !Array.isArray(obj) && obj - parseFloat(obj) + 1 >= 0;\n}\n\n/**\n * @see http://stackoverflow.com/questions/2353211/hsl-to-rgb-color-conversion\n * Converts an HSL color value to RGB. Conversion formula\n * adapted from http://en.wikipedia.org/wiki/HSL_color_space.\n * Assumes h, s, and l are contained in the set [0, 1] and\n * returns r, g, and b in the set [0, 255].\n *\n * @param Number h The hue\n * @param Number s The saturation\n * @param Number l The lightness\n * @return Array The RGB representation\n */\nfunction hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n}\n\nfunction hslToRgb(h, s, l) {\n var r, g, b;\n\n if (s == 0) {\n r = g = b = l; // achromatic\n } else {\n\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n\n return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)];\n}\n\nfunction saveDomAttributes(to, attributes, identification) {\n\n if (!to) return;\n\n to._savedAttributesIds = to._savedAttributesIds || [];\n\n if (to._savedAttributesIds.indexOf(identification) > -1) {\n restoreDomAttributes(to, identification);\n }\n\n to._savedAttributes = to._savedAttributes || {};\n to._attributes = to._attributes || {};\n to._attributes[identification] = attributes;\n\n to._savedAttributesIds.push(identification);\n\n for (var i in attributes) {\n\n if (!to._savedAttributes[i]) {\n to._savedAttributes[i] = to.getAttribute(i);\n }\n\n to.setAttribute(i, attributes[i]);\n }\n}\n\nfunction hasSavedAttribute(dom, attr) {\n return dom._savedAttributes && dom._savedAttributes[attr] !== undefined;\n}\n\nfunction overwriteDomAttribute(dom, attribute, newValue) {\n if (hasSavedAttribute(dom, attribute)) {\n dom._savedAttributes[attribute] = newValue;\n }\n}\n\nfunction restoreDomAttributes(to, identification) {\n\n if (!to || !to._savedAttributesIds) {\n return;\n }\n\n to._savedAttributesIds.splice(to._savedAttributesIds.indexOf(identification), 1);\n delete to._attributes[identification];\n\n var attrs = {};\n\n for (var i in to._savedAttributes) {\n attrs[i] = to._savedAttributes[i];\n }\n\n for (var i = 0, l = to._savedAttributesIds.length; i < l; i++) {\n\n for (var j in to._attributes[to._savedAttributesIds[i]]) {\n attrs[j] = to._attributes[to._savedAttributesIds[i]][j];\n }\n }\n\n for (var j in attrs) {\n to.setAttribute(j, attrs[j]);\n }\n}\n\n// https://davidwalsh.name/function-debounce\nfunction debounce(func, wait, immediate) {\n var timeout;\n return function () {\n var context = this,\n args = arguments;\n var later = function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n}\n\nfunction SVGParser(svgString) {\n\n var parser = new DOMParser();\n var doc = parser.parseFromString(svgString, 'image/svg+xml');\n // returns a SVGDocument, which also is a Document.\n\n return doc;\n}\n\n// http://stackoverflow.com/questions/5276953/what-is-the-most-efficient-way-to-reverse-an-array-in-javascript\n\n\n// jQuery.fn.offset\nfunction getOffset(el) {\n var rect = el.getBoundingClientRect();\n return {\n top: rect.top,\n left: rect.left\n };\n}\n\n// jQuery.fn.css\nfunction setCSS(element, values) {\n var style = element.style;\n for (var i in values) {\n style[i] = values[i];\n }\n}\n\nfunction ajaxGet(options) {\n return new Promise(function (resolve, reject) {\n var request = new XMLHttpRequest();\n request.open(options.type || 'GET', options.url, true);\n if (options.json) request.setRequestHeader('Accept', 'application/json');\n request.onload = function () {\n if (request.status === 200) {\n var response = request.responseText;\n if (options.json) response = JSON.parse(response);\n resolve(response);\n } else {\n reject(new Error('Request error: ' + request.status));\n }\n };\n request.onerror = function () {\n reject(new Error('Network error: ' + request.status));\n };\n request.send();\n });\n}\n\n// https://raw.githubusercontent.com/justmoon/node-extend/888f153645115d1c6aa9a7e346e8e9cd9a83de9b/index.js\n// Copyright (c) 2014 Stefan Thomas\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\n\nvar isArray = function isArray(arr) {\n if (typeof Array.isArray === 'function') {\n return Array.isArray(arr);\n }\n\n return toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n if (!obj || toStr.call(obj) !== '[object Object]') {\n return false;\n }\n\n var hasOwnConstructor = hasOwn.call(obj, 'constructor');\n var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n // Not own constructor property must be Object\n if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n return false;\n }\n\n // Own properties are enumerated firstly, so to speed up,\n // if last one is own, then all properties are own.\n var key;\n for (key in obj) {/**/}\n\n return typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\nfunction extend$1() {\n var options, name, src, copy, copyIsArray, clone;\n var target = arguments[0];\n var i = 1;\n var length = arguments.length;\n var deep = false;\n\n // Handle a deep copy situation\n if (typeof target === 'boolean') {\n deep = target;\n target = arguments[1] || {};\n // skip the boolean and the target\n i = 2;\n } else if (typeof target !== 'object' && typeof target !== 'function' || target == null) {\n target = {};\n }\n\n for (; i < length; ++i) {\n options = arguments[i];\n // Only deal with non-null/undefined values\n if (options != null) {\n // Extend the base object\n for (name in options) {\n src = target[name];\n copy = options[name];\n\n // Prevent never-ending loop\n if (target !== copy) {\n // Recurse if we're merging plain objects or arrays\n if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n if (copyIsArray) {\n copyIsArray = false;\n clone = src && isArray(src) ? src : [];\n } else {\n clone = src && isPlainObject(src) ? src : {};\n }\n\n // Never move original objects, clone them\n target[name] = extend$1(deep, clone, copy);\n\n // Don't bring in undefined values\n } else if (typeof copy !== 'undefined') {\n target[name] = copy;\n }\n }\n }\n }\n }\n\n // Return the modified object\n return target;\n}\n\nfunction mix(baseClass, mixin) {\n\n for (let prop in mixin) {\n\n if (mixin.hasOwnProperty(prop)) {\n baseClass.prototype[prop] = mixin[prop];\n }\n }\n}\n\nfunction emptyDom(dom) {\n while (dom.firstChild) {\n dom.removeChild(dom.firstChild);\n }\n}\n\n/*!\n * EventEmitter v4.2.9 - git.io/ee\n * Oliver Caldwell\n * MIT license\n * @preserve\n */\n\n/**\n * Class for managing events.\n * Can be extended to provide event functionality in other classes.\n *\n * @class EventEmitter Manages event registering and emitting.\n */\n\nfunction EventEmitter() {}\n\n// Shortcuts to improve speed and size\nvar proto = EventEmitter.prototype;\n\n/**\n * Finds the index of the listener for the event in its storage array.\n *\n * @param {Function[]} listeners Array of listeners to search through.\n * @param {Function} listener Method to look for.\n * @return {Number} Index of the specified listener, -1 if not found\n * @api private\n */\nfunction indexOfListener(listeners, listener) {\n var i = listeners.length;\n while (i--) {\n if (listeners[i].listener === listener) {\n return i;\n }\n }\n\n return -1;\n}\n\n/**\n * Alias a method while keeping the context correct, to allow for overwriting of target method.\n *\n * @param {String} name The name of the target method.\n * @return {Function} The aliased method\n * @api private\n */\nfunction alias(name) {\n return function aliasClosure() {\n return this[name].apply(this, arguments);\n };\n}\n\n/**\n * Returns the listener array for the specified event.\n * Will initialise the event object and listener arrays if required.\n * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them.\n * Each property in the object response is an array of listener functions.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Function[]|Object} All listener functions for the event.\n */\nproto.getListeners = function getListeners(evt) {\n var events = this._getEvents();\n var response;\n var key;\n\n // Return a concatenated array of all matching events if\n // the selector is a regular expression.\n if (evt instanceof RegExp) {\n response = {};\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n response[key] = events[key];\n }\n }\n } else {\n response = events[evt] || (events[evt] = []);\n }\n\n return response;\n};\n\n/**\n * Takes a list of listener objects and flattens it into a list of listener functions.\n *\n * @param {Object[]} listeners Raw listener objects.\n * @return {Function[]} Just the listener functions.\n */\nproto.flattenListeners = function flattenListeners(listeners) {\n var flatListeners = [];\n var i;\n\n for (i = 0; i < listeners.length; i += 1) {\n flatListeners.push(listeners[i].listener);\n }\n\n return flatListeners;\n};\n\n/**\n * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful.\n *\n * @param {String|RegExp} evt Name of the event to return the listeners from.\n * @return {Object} All listener functions for an event in an object.\n */\nproto.getListenersAsObject = function getListenersAsObject(evt) {\n var listeners = this.getListeners(evt);\n var response;\n\n if (listeners instanceof Array) {\n response = {};\n response[evt] = listeners;\n }\n\n return response || listeners;\n};\n\n/**\n * Adds a listener function to the specified event.\n * The listener will not be added if it is a duplicate.\n * If the listener returns true then it will be removed after it is called.\n * If you pass a regular expression as the event name then the listener will be added to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.addListener = function addListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var listenerIsWrapped = typeof listener === 'object';\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) {\n listeners[key].push(listenerIsWrapped ? listener : {\n listener: listener,\n once: false\n });\n }\n }\n\n return this;\n};\n\n/**\n * Alias of addListener\n */\nproto.on = alias('addListener');\n\n/**\n * Semi-alias of addListener. It will add a listener that will be\n * automatically removed after its first execution.\n *\n * @param {String|RegExp} evt Name of the event to attach the listener to.\n * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.addOnceListener = function addOnceListener(evt, listener) {\n return this.addListener(evt, {\n listener: listener,\n once: true\n });\n};\n\n/**\n * Alias of addOnceListener.\n */\nproto.once = alias('addOnceListener');\n\n/**\n * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad.\n * You need to tell it what event names should be matched by a regex.\n *\n * @param {String} evt Name of the event to create.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.defineEvent = function defineEvent(evt) {\n this.getListeners(evt);\n return this;\n};\n\n/**\n * Uses defineEvent to define multiple events.\n *\n * @param {String[]} evts An array of event names to define.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.defineEvents = function defineEvents(evts) {\n for (var i = 0; i < evts.length; i += 1) {\n this.defineEvent(evts[i]);\n }\n return this;\n};\n\n/**\n * Removes a listener function from the specified event.\n * When passed a regular expression as the event name, it will remove the listener from all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to remove the listener from.\n * @param {Function} listener Method to remove from the event.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.removeListener = function removeListener(evt, listener) {\n var listeners = this.getListenersAsObject(evt);\n var index;\n var key;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n index = indexOfListener(listeners[key], listener);\n\n if (index !== -1) {\n listeners[key].splice(index, 1);\n }\n }\n }\n\n return this;\n};\n\n/**\n * Alias of removeListener\n */\nproto.off = alias('removeListener');\n\n/**\n * Adds listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added.\n * You can also pass it a regular expression to add the array of listeners to all events that match it.\n * Yeah, this function does quite a bit. That's probably a bad thing.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.addListeners = function addListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(false, evt, listeners);\n};\n\n/**\n * Removes listeners in bulk using the manipulateListeners method.\n * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be removed.\n * You can also pass it a regular expression to remove the listeners from all events that match it.\n *\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.removeListeners = function removeListeners(evt, listeners) {\n // Pass through to manipulateListeners\n return this.manipulateListeners(true, evt, listeners);\n};\n\n/**\n * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level.\n * The first argument will determine if the listeners are removed (true) or added (false).\n * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays.\n * You can also pass it an event name and an array of listeners to be added/removed.\n * You can also pass it a regular expression to manipulate the listeners of all events that match it.\n *\n * @param {Boolean} remove True if you want to remove listeners, false if you want to add.\n * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once.\n * @param {Function[]} [listeners] An optional array of listener functions to add/remove.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.manipulateListeners = function manipulateListeners(remove, evt, listeners) {\n var i;\n var value;\n var single = remove ? this.removeListener : this.addListener;\n var multiple = remove ? this.removeListeners : this.addListeners;\n\n // If evt is an object then pass each of its properties to this method\n if (typeof evt === 'object' && !(evt instanceof RegExp)) {\n for (i in evt) {\n if (evt.hasOwnProperty(i) && (value = evt[i])) {\n // Pass the single listener straight through to the singular method\n if (typeof value === 'function') {\n single.call(this, i, value);\n } else {\n // Otherwise pass back to the multiple function\n multiple.call(this, i, value);\n }\n }\n }\n } else {\n // So evt must be a string\n // And listeners must be an array of listeners\n // Loop over it and pass each one to the multiple method\n i = listeners.length;\n while (i--) {\n single.call(this, evt, listeners[i]);\n }\n }\n\n return this;\n};\n\n/**\n * Removes all listeners from a specified event.\n * If you do not specify an event then all listeners will be removed.\n * That means every event will be emptied.\n * You can also pass a regex to remove all events that match it.\n *\n * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.removeEvent = function removeEvent(evt) {\n var type = typeof evt;\n var events = this._getEvents();\n var key;\n\n // Remove different things depending on the state of evt\n if (type === 'string') {\n // Remove all listeners for the specified event\n delete events[evt];\n } else if (evt instanceof RegExp) {\n // Remove all events matching the regex.\n for (key in events) {\n if (events.hasOwnProperty(key) && evt.test(key)) {\n delete events[key];\n }\n }\n } else {\n // Remove all listeners in all events\n delete this._events;\n }\n\n return this;\n};\n\n/**\n * Alias of removeEvent.\n *\n * Added to mirror the node API.\n */\nproto.removeAllListeners = alias('removeEvent');\n\n/**\n * Emits an event of your choice.\n * When emitted, every listener attached to that event will be executed.\n * If you pass the optional argument array then those arguments will be passed to every listener upon execution.\n * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.\n * So they will not arrive within the array on the other side, they will be separate.\n * You can also pass a regular expression to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {Array} [args] Optional array of arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.emitEvent = function emitEvent(evt, args) {\n var listeners = this.getListenersAsObject(evt);\n var listener;\n var i;\n var key;\n var response;\n\n for (key in listeners) {\n if (listeners.hasOwnProperty(key)) {\n i = listeners[key].length;\n\n while (i--) {\n // If the listener returns true then it shall be removed from the event\n // The function is executed either with a basic call or an apply if there is an args array\n listener = listeners[key][i];\n\n if (listener.once === true) {\n this.removeListener(evt, listener.listener);\n }\n\n response = listener.listener.apply(this, args || []);\n\n if (response === this._getOnceReturnValue()) {\n this.removeListener(evt, listener.listener);\n }\n }\n }\n }\n\n return this;\n};\n\n/**\n * Alias of emitEvent\n */\nproto.trigger = alias('emitEvent');\n\n/**\n * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on.\n * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it.\n *\n * @param {String|RegExp} evt Name of the event to emit and execute listeners for.\n * @param {...*} Optional additional arguments to be passed to each listener.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.emit = function emit(evt) {\n var args = Array.prototype.slice.call(arguments, 1);\n return this.emitEvent(evt, args);\n};\n\n/**\n * Sets the current value to check against when executing listeners. If a\n * listeners return value matches the one set here then it will be removed\n * after execution. This value defaults to true.\n *\n * @param {*} value The new value to check for when executing listeners.\n * @return {Object} Current instance of EventEmitter for chaining.\n */\nproto.setOnceReturnValue = function setOnceReturnValue(value) {\n this._onceReturnValue = value;\n return this;\n};\n\n/**\n * Fetches the current value to check against when executing listeners. If\n * the listeners return value matches this one then it should be removed\n * automatically. It will return true by default.\n *\n * @return {*|Boolean} The current value to check for or the default, true.\n * @api private\n */\nproto._getOnceReturnValue = function _getOnceReturnValue() {\n if (this.hasOwnProperty('_onceReturnValue')) {\n return this._onceReturnValue;\n } else {\n return true;\n }\n};\n\n/**\n * Fetches the events object and creates one if required.\n *\n * @return {Object} The events storage object.\n * @api private\n */\nproto._getEvents = function _getEvents() {\n return this._events || (this._events = {});\n};\n\nclass FitHost {\n\n constructor(options) {\n\n this.DELTAP = 1e-6;\n this.BIGVAL = 9e99;\n this.WEIGHT = 1.0;\n\n this.setYData(options.dataY);\n this.setXData(options.dataX);\n this.setWeight(options.weight);\n this.setInitialParams(options.params);\n\n if (options.subsetIndex) {\n this.setSubset(...options.subsetIndex);\n }\n\n this.setFunction(options.function);\n\n if (options.progress) {\n this.hookIteration(options.progress);\n }\n\n this.options = options;\n }\n\n //[ [ x1, y1 ], [ x2, y2 ] ]\n setYData(data) {\n // Waveform instance\n this.data = data;\n }\n\n setXData(data) {\n // Waveform instance\n this.dataX = data;\n }\n\n setWeight(weight) {\n // Waveform instance\n this.weight = weight;\n }\n\n setInitialParams(params) {\n this.parms = params;\n\n this.parms = this.parms.map(el => {\n if (typeof el == 'function') {\n return el(this.data, this.dataX);\n } else {\n return el;\n }\n });\n this.NPARMS = params.length;\n }\n\n setSubset(fromIndex, toIndex) {\n if (fromIndex !== undefined && toIndex !== undefined) {\n this._from = fromIndex;\n this._to = toIndex;\n }\n }\n\n hookIteration(f) {\n this._hookIteration = params => {\n let data = this.buildFit(params, 200);\n f(data);\n };\n }\n\n setFunction(func) {\n this._func = func;\n }\n\n init() {\n\n // Get data length\n if (this._from !== undefined && this._to !== undefined) {\n\n if (this._from >= this._to) {\n throw 'Impossible to fit negative subranges. The starting index must be lower than the ending index';\n }\n\n this.NPTS = this._to - this._from + 1;\n\n if (this.data && this.data.getLength() <= this._to) {\n throw 'Wave Y has not enough point to be fitted to subrange [' + this._from + ', ' + this._to + ']';\n }\n\n if (this._from < 0) {\n throw 'Impossible to fit a subrange with negative indices';\n }\n } else {\n\n this.NPTS = this.data.getLength();\n this._from = 0;\n this._to = this.data.getLength() - 1;\n }\n\n if (this.dataX && this.dataX.getLength() <= this._to) {\n throw 'Wave X has not enough point to be fitted to subrange [' + this._from + ', ' + this._to + ']';\n }\n\n this.arrY = this.data.getDataY();\n\n if (this.dataX) {\n this.arrX = this.dataX.getDataY();\n } else {\n this.arrX = this.data.getDataX();\n }\n\n this.resid = new Array(this.NPTS).fill(0);\n this.jac = new Array(this.NPTS).fill(0);\n this.jac = this.jac.map(el => new Array(this.NPARMS));\n }\n\n fit() {\n\n this.log('Starting the fit with initial parameter list {' + this.parms.join() + '};');\n new LM(this, this.NPARMS, this.NPTS, this._hookIteration);\n this.log('Fit successful. Output parameters {' + this.parms.join() + '};');\n\n this._result = this.buildFit(this.parms, 200);\n\n if (this.options.done) {\n this.options.done(this.parms, this._result);\n }\n\n return this._result;\n }\n\n func(x, param) {\n return this._func(x, param);\n }\n\n computeResiduals() {\n var sumsq = 0;\n for (var i = 0; i < this.NPTS; i++) {\n this.resid[i] = (this.func(this.arrX[i + this._from], this.parms) - this.arrY[i + this._from]) * this.WEIGHT;\n sumsq += this.resid[i] * this.resid[i];\n }\n\n return sumsq;\n }\n\n log(message) {\n if (this.options.log) {\n console.log(message);\n }\n }\n\n //------the four mandated interface methods------------\n nudge(dp) {\n\n for (var j = 0; j < this.NPARMS; j++) {\n this.parms[j] += dp[j];\n }\n return this.computeResiduals();\n }\n\n buildJacobian() {\n // Allows LM to compute a new Jacobian.\n // Uses current parms[] and two-sided finite difference.\n // If current parms[] is bad, returns false.\n var delta = new Array(this.NPARMS);\n var FACTOR = 0.5 / this.DELTAP;\n var d = 0;\n\n for (var j = 0; j < this.NPARMS; j++) {\n for (var k = 0; k < this.NPARMS; k++) delta[k] = k == j ? this.DELTAP : 0.0;\n\n d = this.nudge(delta); // resid at pplus\n if (d == this.BIGVAL) {\n throw 'Bad dBuildJacobian() exit 2';\n }\n\n for (var i = 0; i < this.NPTS; i++) {\n this.jac[i][j] = this.getResidualElement(i);\n }\n\n for (var k = 0; k < this.NPARMS; k++) {\n delta[k] = k == j ? -2 * this.DELTAP : 0.0;\n }\n\n d = this.nudge(delta); // resid at pminus\n if (d == this.BIGVAL) {\n throw 'Bad dBuildJacobian(). exit 3';\n }\n\n for (var i = 0; i < this.NPTS; i++) this.jac[i][j] -= this.getResidualElement(i); // fetches resid[]\n\n for (var i = 0; i < this.NPTS; i++) this.jac[i][j] *= FACTOR;\n\n for (var k = 0; k < this.NPARMS; k++) delta[k] = k == j ? this.DELTAP : 0.0;\n\n d = this.nudge(delta);\n if (d == this.BIGVAL) {\n throw 'Bad dBuildJacobian(). exit 4';\n }\n }\n return true;\n }\n\n getResidualElement(i) {\n // Allows LM to see one element of the resid[] vector.\n return this.resid[i];\n }\n\n getJacobianElement(i, j) {\n // Allows LM to see one element of the Jacobian matrix.\n return this.jac[i][j];\n }\n\n buildFit(parms, length) {\n let x;\n\n if (!length) {\n x = this.arrX;\n } else {\n\n const xmin = this.dataX.getMin(this._from, this._to);\n const xmax = this.dataX.getMax(this._from, this._to);\n\n x = new Array(length).fill(0).map((el, index) => index * (xmax - xmin) / (length - 1) + xmin);\n }\n\n var fit = new Array(x.length);\n for (var i = 0, l = x.length; i < l; i++) {\n fit[i] = this.func(x[i], this.parms);\n }\n\n let waveformResult = this.options.waveform;\n waveformResult.setData(fit, x);\n //waveformResult.setXWaveform( x );\n\n return waveformResult;\n }\n}\n\nclass LM {\n\n constructor(gH, gnadj, gnpnts, hook) {\n\n this.LMITER = 100; // max number of L-M iterations\n this.LMBOOST = 2.0; // damping increase per failed step\n this.LMSHRINK = 0.10; // damping decrease per successful step\n this.LAMBDAZERO = 0.001; // initial damping\n this.LAMBDAMAX = 1E9; // max damping\n this.LMTOL = 1E-12; // exit tolerance\n this.BIGVAL = 9e99; // trouble flag\n\n this.sos;\n this.sosprev;\n this.lambda;\n\n this.myH = null; // overwritten by constructor\n this.nadj = 0; // overwritten by constructor\n this.npts = 0; // overwritten by constructor\n\n this.delta; // local parm change\n this.beta;\n this.alpha;\n this.amatrix;\n\n // Constructor sets up fields and drives iterations.\n this.myH = gH;\n this.nadj = gnadj;\n this.npts = gnpnts;\n\n this.delta = new Array(this.nadj).fill(0);\n this.beta = new Array(this.nadj).fill(0);\n\n this.alpha = new Array(this.nadj).fill(0);\n this.amatrix = new Array(this.nadj).fill(0);\n\n this.alpha = this.alpha.map(() => new Array(this.nadj));\n this.amatrix = this.amatrix.map(() => new Array(this.nadj));\n\n this.lambda = this.LAMBDAZERO;\n\n var niter = 0;\n var done = false;\n do {\n done = this.bLMiter();\n\n if (hook) {\n hook(this.myH.params);\n }\n\n niter++;\n } while (!done && niter < this.LMITER);\n }\n\n bLMiter() {\n // Each call performs one LM iteration.\n // Returns true if done with iterations; false=wants more.\n // Global nadj, npts; needs nadj, myH to be preset.\n // Ref: M.Lampton, Computers in Physics v.11 pp.110-115 1997.\n for (var k = 0; k < this.nadj; k++) this.delta[k] = 0.0;\n this.sos = this.myH.nudge(this.delta);\n if (this.sos == this.BIGVAL) {\n console.error(' bLMiter finds faulty initial nudge()');\n return false;\n }\n this.sosprev = this.sos;\n\n this.myH.log(' bLMiter..SumOfSquares= ' + this.sos);\n if (!this.myH.buildJacobian()) {\n console.error(' bLMiter finds buildJacobian()=false');\n return false;\n }\n\n for (var k = 0; k < this.nadj; k++) // get downhill gradient beta\n {\n this.beta[k] = 0.0;\n for (var i = 0; i < this.npts; i++) {\n this.beta[k] -= this.myH.getResidualElement(i) * this.myH.getJacobianElement(i, k);\n }\n }\n\n for (var k = 0; k < this.nadj; k++) // get curvature matrix alpha\n for (var j = 0; j < this.nadj; j++) {\n this.alpha[j][k] = 0.0;\n for (var i = 0; i < this.npts; i++) {\n this.alpha[j][k] += this.myH.getJacobianElement(i, j) * this.myH.getJacobianElement(i, k);\n }\n }\n var rrise = 0;\n do // inner damping loop searches for one downhill step\n {\n for (var k = 0; k < this.nadj; k++) {\n // copy and damp it\n for (var j = 0; j < this.nadj; j++) {\n this.amatrix[j][k] = this.alpha[j][k] + (j == k ? this.lambda : 0.0);\n }\n }\n\n this.gaussj(this.amatrix, this.nadj); // invert\n\n for (var k = 0; k < this.nadj; k++) // compute delta[]\n {\n this.delta[k] = 0.0;\n for (var j = 0; j < this.nadj; j++) this.delta[k] += this.amatrix[j][k] * this.beta[j];\n }\n this.sos = this.myH.nudge(this.delta); // try it out.\n if (this.sos == this.BIGVAL) {\n console.error(' LMinner failed SOS step');\n return false;\n }\n rrise = (this.sos - this.sosprev) / (1 + this.sos);\n if (rrise <= 0.0) // good step!\n {\n this.lambda *= this.LMSHRINK; // shrink lambda\n break; // leave lmInner.\n }\n for (var q = 0; q < this.nadj; q++) {\n // reverse course!\n this.delta[q] *= -1.0;\n }\n this.myH.nudge(this.delta); // sosprev should still be OK\n if (rrise < this.LMTOL) {\n // finished but keep prev parms\n break; // leave inner loop\n }\n this.lambda *= this.LMBOOST; // else try more damping.\n } while (this.lambda < this.LAMBDAMAX);\n return rrise > -this.LMTOL || this.lambda > this.LAMBDAMAX;\n }\n\n gaussj(a, N) {\n // Inverts the double array a[N][N] by Gauss-Jordan method\n // M.Lampton UCB SSL (c)2003, 2005\n\n var det = 1.0,\n big,\n save;\n var i, j, k, L;\n var ik = new Array(100);\n var jk = new Array(100);\n\n for (k = 0; k < N; k++) {\n big = 0.0;\n for (i = k; i < N; i++) for (j = k; j < N; j++) // find biggest element\n if (Math.abs(big) <= Math.abs(a[i][j])) {\n big = a[i][j];\n ik[k] = i;\n jk[k] = j;\n }\n if (big == 0.0) return 0.0;\n i = ik[k];\n if (i > k) for (j = 0; j < N; j++) // exchange rows\n {\n save = a[k][j];\n a[k][j] = a[i][j];\n a[i][j] = -save;\n }\n j = jk[k];\n if (j > k) for (i = 0; i < N; i++) {\n save = a[i][k];\n a[i][k] = a[i][j];\n a[i][j] = -save;\n }\n for (i = 0; i < N; i++) // build the inverse\n if (i != k) a[i][k] = -a[i][k] / big;\n for (i = 0; i < N; i++) for (j = 0; j < N; j++) if (i != k && j != k) a[i][j] += a[i][k] * a[k][j];\n for (j = 0; j < N; j++) if (j != k) a[k][j] /= big;\n a[k][k] = 1.0 / big;\n det *= big; // bomb point\n } // end k loop\n for (L = 0; L < N; L++) {\n k = N - L - 1;\n j = ik[k];\n if (j > k) for (i = 0; i < N; i++) {\n save = a[i][k];\n a[i][k] = -a[i][j];\n a[i][j] = save;\n }\n i = jk[k];\n if (i > k) for (j = 0; j < N; j++) {\n save = a[k][j];\n a[k][j] = -a[i][j];\n a[i][j] = save;\n }\n }\n return det;\n }\n}\n\n\n//module.export = FitHost\n\nclass Waveform {\n\n constructor(data = [], xOffset = 0, xScale = 1) {\n\n this.xOffset = xOffset;\n this.xScale = xScale;\n this.setData(data);\n }\n\n /** [ [ x1, y1 ], [ x2, y2 ] ] */\n\n /*\n setDataXY( data ) {\n let newData = [ this._makeArray( data.length ), this._makeArray( data.length ) ],\n warnNaN = false;\n const nanable = this.isNaNAllowed();\n data.map( ( el, index ) => {\n if ( !nanable && ( el[ 0 ] !== el[ 0 ] || el[ 1 ] !== el[ 1 ] ) ) {\n warnNaN = true;\n }\n newData[ 0 ][ index ] = el[ 0 ];\n newData[ 1 ][ index ] = el[ 1 ];\n } );\n if ( warnNaN ) {\n this.warn( \"Trying to assign NaN values to a typed array that does not support NaNs. 0's will be used instead\" );\n }\n this._setData( ...newData );\n return this;\n }\n */\n setData(data, dataX = null) {\n\n /* First, we must treat the case of the array of array for backward compatibility */\n if (Array.isArray(data[0])) {\n let x = [];\n let y = [];\n data.forEach(el => {\n x.push(el[0]);\n y.push(el[1]);\n });\n\n this.setXWaveform(x);\n data = y;\n }\n\n let newData = this._makeArray(data.length),\n warnNaN = false;\n\n const nanable = this.isNaNAllowed();\n\n data.map((el, index) => {\n\n if (!nanable && (el[0] !== el[0] || el[1] !== el[1])) {\n warnNaN = true;\n }\n\n newData[index] = el;\n });\n\n if (warnNaN) {\n this.warn(\"Trying to assign NaN values to a typed array that does not support NaNs. 0's will be used instead\");\n }\n\n this._setData(newData);\n\n if (dataX) {\n this.setXWaveform(dataX);\n }\n return this;\n }\n\n getY(index, optimized) {\n\n if (optimized && this.dataInUse) {\n return this.dataInUse.y[index] * this.getScale() + this.getShift();\n }\n\n return this.data[index] * this.getScale() + this.getShift();\n }\n\n /*\n flipXY() {\n let temp;\n temp = this.data.x;\n this.data.x = this.data.y;\n this.data.y = temp;\n this._setData( this.data.x, this.data.y );\n }*/\n\n setXWaveform(waveform) {\n\n if (!(waveform instanceof Waveform)) {\n\n if (Array.isArray(waveform)) {\n waveform = new Waveform(waveform);\n } else {\n throw \"Cannot set X waveform. Data is not a valid array.\";\n }\n }\n\n this.xdata = waveform;\n this.computeXMinMax();\n return this;\n }\n\n hasXWaveform() {\n return !!this.xdata;\n }\n\n getXWaveform() {\n if (this.xdata) {\n return this.xdata;\n }\n\n var wave = new Waveform();\n for (var i = 0; i < this.getLength(); i += 1) {\n wave.append(this.getX(i));\n }\n return wave;\n }\n\n rescaleX(offset, scale) {\n this.xScale = scale;\n this.xOffset = offset;\n this.computeXMinMax();\n return this;\n }\n\n getTypedArrayClass() {\n return this._typedArrayClass || false;\n }\n\n setTypedArrayClass(constructor) {\n\n if (this.getTypedArrayClass() && this.isNaNAllowed() && !this.isNaNAllowed(constructor)) {\n this.warn(\"NaN values are not allowed by the new constructor (\" + constructor.name + \") while it was allowed by the previous one (\" + this._typedArrayClass.name + \")\");\n }\n\n if (this.getTypedArrayClass() && this.isUnsigned() && !this.isUnsigned(constructor)) {\n this.warn(\"You are switching from signed values to unsigned values. You may experience data corruption if there were some negative values.\");\n }\n\n this._typedArrayClass = constructor;\n\n if (this.data) {\n this._setData(constructor.from(this.data));\n }\n\n if (this.hasXWaveform()) {\n this.getXWaveform().setTypedArrayClass(constructor);\n }\n }\n\n isNaNAllowed(constructor = this._typedArrayClass) {\n\n // The following types accept NaNs\n return constructor == Array || constructor == Float32Array || constructor == Float64Array;\n }\n\n isUnsigned(constructor = this._typedArrayClass) {\n\n // The following types accept NaNs\n return constructor == Uint8Array || constructor == Uint8ClampedArray || constructor == Uint16Array || constructor == Uint32Array;\n }\n\n recalculateMinMaxNewPoint(x, y) {\n if (x < this.minX || this.minX === undefined) {\n this.minX = x;\n }\n\n if (x > this.maxX || this.maxX === undefined) {\n this.maxX = x;\n }\n\n if (y < this.minY || this.minY === undefined) {\n this.minY = y;\n }\n\n if (y > this.maxY || this.maxY === undefined) {\n this.maxY = y;\n }\n }\n\n prepend(x, y) {\n\n if (typeof x == \"function\") {\n x = x(this);\n }\n\n if (typeof y == \"function\") {\n y = y(this);\n }\n\n if (this.xdata) {\n this.xdata.prepend(null, x);\n } else if (x !== null) {\n this.xdata = this.getXWaveform();\n this.xdata.prepend(null, x);\n } else {\n this.xOffset -= this.xScale;\n }\n\n this.data.unshift(y);\n this.recalculateMinMaxNewPoint(x, y);\n return this;\n }\n\n append(x, y) {\n\n if (typeof x == \"function\") {\n x = x(this);\n }\n\n if (typeof y == \"function\") {\n y = y(this);\n }\n\n if (this.xdata) {\n this.xdata.append(null, x);\n } else if (x !== null) {\n this.xdata = this.getXWaveform();\n this.xdata.append(null, x);\n }\n\n if (this.monotoneous) {\n if (y > this.data[this.data.y] && this.getMonotoneousAscending() === false) {\n this.monotoneous = false;\n } else if (y < this.data[this.data.y] && this.getMonotoneousAscending() === true) {\n this.monotoneous = false;\n }\n }\n\n if (this.data.length == 1 || this._monotoneousAscending === undefined) {\n\n this.monotoneous = true;\n\n if (y == this.data[0]) {\n this._monotoneousAscending = undefined;\n } else {\n this._monotoneousAscending = y > this.data[0];\n }\n }\n\n this.data.push(y);\n this.recalculateMinMaxNewPoint(x, y);\n\n return this;\n }\n\n _makeArray(length) {\n\n const constructor = this.getTypedArrayClass();\n if (constructor) {\n return new constructor(length);\n }\n return new Array(length);\n }\n\n _setData(dataY) {\n const l = dataY.length;\n let i = 1,\n monoDir = dataY[1] > dataY[0],\n minY = dataY[0],\n maxY = dataY[0];\n\n this._monotoneous = true;\n\n for (; i < l; i++) {\n if (dataY[i] !== dataY[i - 1] && monoDir !== dataY[i] > dataY[i - 1]) {\n this._monotoneous = false;\n }\n\n if (dataY[i] === dataY[i]) {\n // NaN support\n minY = Math.min(dataY[i], minY);\n maxY = Math.max(dataY[i], maxY);\n }\n }\n\n if (this._monotoneous) {\n this._monotoneousAscending = dataY[1] > dataY[0];\n }\n\n this.minY = minY;\n this.maxY = maxY;\n\n this.data = dataY;\n\n this.computeXMinMax();\n }\n\n computeXMinMax() {\n\n if (!this.data) {\n\n return;\n }\n\n if (this.xdata) {\n\n this.minX = this.xdata.getMin();\n this.maxX = this.xdata.getMax();\n } else {\n\n const b1 = this.xOffset + this.xScale * this.getLength(),\n b2 = this.xOffset;\n\n this.minX = Math.min(b1, b2);\n this.maxX = Math.max(b1, b2);\n }\n }\n\n getDataInUse() {\n return this.dataInUse || this.data;\n }\n\n getIndexFromVal(val, useDataToUse = false, roundingMethod = Math.round) {\n\n let data;\n\n if (useDataToUse && this.dataInUse) {\n data = this.dataInUse.y;\n } else {\n data = this.data;\n }\n\n let position;\n\n position = this.getIndexFromData(val, data, this.data.getMonotoneousAscending(), roundingMethod);\n\n if (useDataToUse && this.dataInUse && this.dataInUseType == \"aggregateY\") {\n // In case of aggregation, round to the closest element of 4.\n return position - position % 4;\n }\n\n return position;\n }\n\n getIndexFromX(xval, useDataToUse = false, roundingMethod = Math.round) {\n\n let xdata;\n\n if (useDataToUse && this.dataInUse) {\n xdata = this.dataInUse.x;\n } else if (this.xdata) {\n xdata = this.xdata.getData();\n }\n\n let position;\n\n if (this.hasXWaveform()) {\n position = this.xdata.getIndexFromData(xval, xdata, this.xdata.getMonotoneousAscending(), roundingMethod);\n } else {\n position = Math.max(0, Math.min(this.getLength() - 1, roundingMethod((xval - this.xOffset) / this.xScale)));\n }\n\n if (useDataToUse && this.dataInUse && this.dataInUseType == \"aggregateX\") {\n // In case of aggregation, round to the closest element of 4.\n return position - position % 4;\n }\n\n return position;\n }\n\n getIndexFromData(val, valCollection, isAscending, roundingMethod) {\n\n if (!this.isMonotoneous()) {\n console.trace();\n throw \"Impossible to get the index from a non-monotoneous wave !\";\n }\n\n val -= this.getShift();\n val /= this.getScale();\n\n return binarySearch(val, valCollection, !isAscending);\n }\n\n getReductionType() {\n return this.dataInUseType;\n }\n\n getXMin() {\n return this.minX * this.getXScale() + this.getXShift();\n }\n\n getXMax() {\n return this.maxX * this.getXScale() + this.getXShift();\n }\n\n getYMin() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getYMax() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getMin() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getMax() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getMinX() {\n\n return this.minX * this.getXScale() + this.getXShift();\n }\n\n getMaxX() {\n return this.maxX * this.getXScale() + this.getXShift();\n }\n\n getMinY() {\n return this.minY * this.getScale() + this.getShift();\n }\n\n getMaxY() {\n return this.maxY * this.getScale() + this.getShift();\n }\n\n getDataY() {\n return this.data;\n }\n\n getData(optimized) {\n if (!optimized || !this.dataInUse) {\n return this.data;\n }\n return this.dataInUse.y;\n }\n\n setShift(shift = 0) {\n\n // We must update the min and the max of the y data\n //this.minY += ( shift - this.getShift() );\n //this.maxY += ( shift - this.getShift() );\n this.shift = shift;\n return this;\n }\n\n getShift() {\n return this.shift || 0;\n }\n\n getScale() {\n return this.scale || 1;\n }\n\n setScale(scale = 1) {\n\n // this.minY = ( this.minY - this.getShift() ) * scale;\n // this.maxY = ( this.maxY - this.getShift() ) * scale;\n this.scale = scale;\n return this;\n }\n\n setXShift(shift = 0) {\n\n if (!this.hasXWaveform) {\n return this;\n }\n\n // We must update the min and the max of the x data\n // That's important for when the data has already been set\n // this.minX += ( shift - this.getXShift() );\n // this.maxX += ( shift - this.getXShift() );\n this.getXWaveform().setShift(shift);\n return this;\n }\n\n getXShift(shift = 0) {\n\n if (!this.hasXWaveform) {\n return 0;\n }\n\n return this.getXWaveform().getShift();\n }\n\n setXScale(scale = 1) {\n\n if (!this.hasXWaveform) {\n return this;\n }\n\n this.getXWaveform().setScale(scale);\n return this;\n }\n\n getXScale() {\n\n if (!this.hasXWaveform) {\n return 1;\n }\n\n return this.getXWaveform().getScale();\n }\n\n getLength() {\n return this.data.length;\n }\n\n getDataToUseFlat() {\n\n let l;\n let j = 0;\n let arr;\n\n if (this.dataInUse) {\n\n l = this.dataInUse.x.length;\n arr = new Array(l * 2).fill(0);\n\n for (var i = 0; i < l; i += 1) {\n arr[j] = this.dataInUse.x[i];\n arr[j + 1] = this.dataInUse.y[i];\n j += 2;\n }\n } else {\n\n l = this.getLength();\n arr = new Array(l * 2).fill(0);\n for (var i = 0; i < l; i += 1) {\n arr[j + 1] = this.data[i];\n arr[j] = this.getX(i);\n j += 2;\n }\n }\n\n return arr;\n }\n\n fit(options) {\n\n var self = this;\n\n return new Promise(function (resolver, rejector) {\n\n var fit = new FitHost(extend({}, {\n\n dataY: self,\n dataX: self.getXWaveform(),\n done: function (results) {\n resolver(results);\n },\n waveform: new Waveform()\n\n }, options));\n\n fit.init();\n fit.fit();\n });\n }\n\n getX(index, optimized) {\n\n if (optimized && this.dataInUse) {\n return this.dataInUse.x[index] * this.getXScale() + this.getXShift();\n }\n\n if (this.xdata) {\n return this.xdata.data[index] * this.getXScale() + this.getXShift();\n } else {\n return this.xOffset + index * this.xScale;\n }\n }\n\n getXRaw(index, optimized) {\n\n if (optimized && this.dataInUse) {\n return this.dataInUse.x[index];\n }\n\n if (this.xdata) {\n return this.xdata.data[index];\n } else {\n return index;\n }\n }\n\n _integrateP(from = 0, to = this.getLength() - 1) {\n\n from = Math.round(from);\n to = Math.round(to);\n\n if (from > to) {\n let temp = from;\n from = to;\n to = temp;\n }\n\n var l = to - from + 1;\n var sum = 0;\n\n let deltaTot = 0;\n let diff;\n var arrY = this.getData();\n\n for (; from <= to; from++) {\n\n if (arrY.length - 1 > from) {\n diff = this.getX(from + 1) - this.getX(from);\n deltaTot += diff;\n sum += arrY[from] * diff;\n }\n }\n\n return [sum, l, deltaTot];\n }\n\n integrateP(from, to) {\n var val = this._integrateP(from, to);\n return val[0];\n }\n\n integrate(fromX, toX) {\n return this.integrateP(this.getIndexFromX(fromX), this.getIndexFromX(toX));\n }\n\n average(p0 = 0, p1 = this.getLength() - 1) {\n return this.getAverageP(p0, p1);\n }\n\n mean() {\n return this.average();\n }\n\n getAverageP(from, to) {\n var sum = this._integrateP(from, to);\n return sum[0] / sum[2];\n }\n\n getAverageX(from, to) {\n var sum = this._integrateX(from, to);\n return sum[0] / sum[2];\n }\n\n checkMonotonicity() {\n\n let i = 1,\n data = this.getData();\n const l = this.data.length;\n let dir = data[1] > data[0];\n\n for (; i < l; i++) {\n if (data[i] !== data[i - 1] && dir !== data[i] > data[i - 1]) {\n return this._monotoneous = false;\n }\n }\n\n this._monotoneousAscending = data[1] > data[0];\n return this._monotoneous = true;\n }\n\n requireXMonotonicity() {\n if (this.xdata) {\n this.xdata.requireMonotonicity();\n }\n }\n\n requireMonotonicity() {\n if (!this.isMonotoneous()) {\n throw \"The wave must be monotonic\";\n }\n }\n\n isMonotoneous() {\n return !!this._monotoneous;\n }\n\n isXMonotoneous() {\n if (this.xdata) {\n return this.xdata.isMonotoneous();\n }\n // Offset and scale is always monotoneous\n return true;\n }\n\n invert(data) {\n\n let d = dataY || this.data;\n d.reverse();\n\n if (this.isMonotoneous()) {\n this._monotoneousAscending = !this._monotoneousAscending;\n }\n\n return d;\n }\n\n resampleForDisplay(options) {\n // Serie redrawing\n\n let i = 0;\n\n this.requireXMonotonicity();\n\n let inverting = false,\n dataY = this.getDataY(),\n data = {\n x: [],\n y: []\n },\n dataMinMax = [],\n resampleSum,\n resampleMin,\n resampleMax,\n resampleNum,\n resample_x_start,\n resample_x_px_start,\n x_px,\n doing_mean = false,\n firstPointIndex = 0,\n xval;\n\n const l = this.getLength();\n\n if (!options.xPosition) {\n throw \"No position calculation method provided\";\n }\n\n if (!options.resampleToPx) {\n throw \"No \\\"resampleToPx\\\" method was provided. Unit: px per point\";\n }\n\n if (options.minX > options.maxX) {\n let temp = options.minX;\n options.minX = options.maxX;\n options.maxX = temp;\n }\n\n if (this.xdata && !this.xdata.getMonotoneousAscending() || !this.xdata && this.xScale < -0) {\n inverting = true;\n i = l;\n }\n\n for (; inverting ? i > 0 : i < l; inverting ? i-- : i++) {\n\n xval = this.getX(i);\n\n if (options.minX > xval) {\n\n firstPointIndex = i;\n continue;\n }\n\n x_px = options.xPosition(xval);\n\n if (!doing_mean) {\n\n if (!firstPointIndex) {\n\n firstPointIndex = i;\n } else {\n\n data.x.push(xval);\n data.y.push(dataY[firstPointIndex]);\n }\n\n while (isNaN(dataY[i])) {\n\n if (inverting) {\n i--;\n } else {\n i++;\n }\n }\n\n resampleSum = resampleMin = resampleMax = dataY[firstPointIndex];\n resampleNum = 1;\n resample_x_px_start = x_px;\n resample_x_start = xval;\n firstPointIndex = 0;\n\n doing_mean = true;\n\n continue;\n }\n\n if (Math.abs(x_px - resample_x_px_start) > options.resampleToPx || i == l || i == 0 || isNaN(dataY[i])) {\n\n let xpos = (resample_x_start + xval) / 2;\n\n data.x.push(xpos);\n data.y.push(resampleSum / resampleNum);\n\n dataMinMax.push(xpos, resampleMin, resampleMax);\n\n if (options.maxX !== undefined && xval > options.maxX) {\n\n break;\n }\n\n doing_mean = false;\n\n continue;\n }\n\n resampleSum += dataY[i];\n resampleNum++;\n\n resampleMin = Math.min(resampleMin, dataY[i]);\n resampleMax = Math.max(resampleMax, dataY[i]);\n }\n\n this.dataInUseType = \"resampled\";\n this.dataInUse = data;\n return dataMinMax;\n }\n\n interpolate(x) {\n\n let yData = this.getDataY();\n let xIndex;\n\n if (this.xdata) {\n let xData = this.xdata.getData();\n xIndex = binarySearch(x, xData, !this.xdata.getMonotoneousAscending());\n if (xData[xIndex] == x) {\n return yData[xIndex];\n }\n return (x - xData[xIndex]) / (xData[xIndex + 1] - xData[xIndex]) * (yData[xIndex + 1] - yData[xIndex]) + yData[xIndex];\n } else {\n xIndex = (x - this.xOffset) / this.xScale;\n let xIndexF = Math.floor(xIndex);\n return (xIndex - xIndexF) * (yData[xIndexF + 1] - yData[xIndexF]) + yData[xIndexF];\n }\n }\n\n interpolateIndex_X(index) {\n\n let yData = this.getDataY();\n if (this.xdata) {\n let xData = this.xdata.getData();\n let indexStart = Math.floor(index);\n\n return (index - indexStart) * (xData[indexStart + 1] - xData[indexStart]) + xData[indexStart];\n }\n }\n\n getMonotoneousAscending() {\n\n if (!this.isMonotoneous()) {\n return \"The waveform is not monotoneous\";\n }\n\n return this._monotoneousAscending;\n }\n\n getXMonotoneousAscending() {\n if (this.xdata) {\n return this.xdata.getMonotoneousAscending();\n }\n\n return this.xScale > 0;\n }\n\n isXMonotoneousAscending() {\n return this.getXMonotoneousAscending(...arguments);\n }\n\n divide(numberOrWave) {\n return this._arithmetic(numberOrWave, DIVIDE);\n }\n\n divideBy() {\n return this.divide(...arguments);\n }\n\n multiply(numberOrWave) {\n return this._arithmetic(numberOrWave, MULTIPLY);\n }\n\n multiplyBy() {\n return this.multiply(...arguments);\n }\n\n log() {\n return this.logBase(10);\n }\n\n ln() {\n return this.logBase(Math.E);\n }\n\n logBase(base) {\n\n let logBase = Math.log(base);\n this.data.map(valY => {\n\n return Math.log(valY) / logBase;\n });\n }\n\n add(numberOrWave) {\n return this._arithmetic(numberOrWave, ADD);\n }\n\n addBy() {\n return this.add(...arguments);\n }\n\n subtract(numberOrWave) {\n return this._arithmetic(numberOrWave, SUBTRACT);\n }\n\n subtractBy() {\n return this.subtract(...arguments);\n }\n\n math(method) {\n\n for (var i = 0; i < this.getLength(); i++) {\n this.data[i] = method(this.getY(i), this.getX(i));\n }\n\n this._setData(this.data);\n return this;\n }\n\n _arithmetic(numberOrWave, operator) {\n\n if (numberOrWave instanceof Waveform) {\n return this._waveArithmetic(numberOrWave, operator);\n } else if (typeof numberOrWave == 'number') {\n\n return this._numberArithmetic(numberOrWave, operator);\n }\n }\n\n _numberArithmetic(num, operation) {\n\n let i = 0,\n l = this.getLength();\n\n if (operation == MULTIPLY) {\n\n for (; i < l; i++) {\n this.data[i] *= num;\n }\n\n this.minY *= num;\n this.maxY *= num;\n } else if (operation == DIVIDE) {\n\n for (; i < l; i++) {\n this.data[i] /= num;\n }\n\n this.minY /= num;\n this.maxY /= num;\n } else if (operation == ADD) {\n\n for (; i < l; i++) {\n this.data[i] += num;\n }\n\n this.minY += num;\n this.maxY += num;\n } else if (operation == SUBTRACT) {\n\n for (; i < l; i++) {\n this.data[i] -= num;\n }\n\n this.minY -= num;\n this.maxY -= num;\n }\n\n return this;\n }\n\n _waveArithmetic(wave, operation) {\n\n let yDataThis = this.getDataY(),\n i = 0;\n const l = this.getLength();\n this.requireXMonotonicity();\n wave.requireXMonotonicity();\n\n if (operation == MULTIPLY) {\n\n for (; i < l; i++) {\n yDataThis[i] *= wave.interpolate(this.getX(i));\n }\n } else if (operation == DIVIDE) {\n\n for (; i < l; i++) {\n yDataThis[i] /= wave.interpolate(this.getX(i));\n }\n } else if (operation == ADD) {\n\n for (; i < l; i++) {\n yDataThis[i] += wave.interpolate(this.getX(i));\n }\n } else if (operation == SUBTRACT) {\n\n for (; i < l; i++) {\n yDataThis[i] -= wave.interpolate(this.getX(i));\n }\n }\n\n this._setData(yDataThis);\n return this;\n }\n\n aggregate(direction = 'x') {\n\n this._dataAggregating = {};\n this._dataAggregated = {};\n this._dataAggregationDirection = direction.toUpperCase();\n\n var pow2 = pow2floor(this.getLength());\n\n this._dataAggregating = aggregator({\n\n minX: this.minX,\n maxX: this.maxX,\n minY: this.minY,\n maxY: this.maxY,\n data: this.data,\n xdata: this.xdata ? this.xdata.getData() : undefined,\n xScale: this.xScale,\n xOffset: this.xOffset,\n numPoints: pow2,\n direction: direction\n\n }).then(event => {\n\n this._dataAggregated = event.aggregates;\n this._dataAggregating = false;\n });\n }\n\n hasAggregation() {\n return !!this._dataAggregated;\n }\n\n selectAggregatedData(pxWidth) {\n\n if (pxWidth < 2) {\n return false;\n }\n /*\n console.log( direction, this._dataAggregationDirection );\n if( direction !== this._dataAggregationDirection ) {\n throw \"The data is not aggregated in that direction\";\n }\n */\n\n var level = pow2ceil(pxWidth);\n\n if (this._dataAggregated[level]) {\n\n this.dataInUseType = \"aggregate\" + this._dataAggregationDirection;\n this.dataInUse = this._dataAggregated[level];\n return;\n } else if (this._dataAggregating) {\n\n return this._dataAggregating;\n }\n\n this.dataInUseType = \"none\";\n this.dataInUse = {\n y: this.data,\n x: this.getXWaveform().data\n };\n }\n\n duplicate(alsoDuplicateXWave) {\n var newWaveform = new Waveform();\n newWaveform._setData(this.getDataY().slice());\n newWaveform.rescaleX(this.xOffset, this.xShift);\n newWaveform.setShift(this.getShift());\n newWaveform.setScale(this.getScale());\n\n if (this.xdata) {\n if (alsoDuplicateXWave) {\n newWaveform.setXWaveform(this.xdata.duplicate());\n } else {\n newWaveform.setXWaveform(this.xdata);\n }\n\n newWaveform.setXShift(this.getXShift());\n newWaveform.setXScale(this.getXScale());\n } else {\n newWaveform.xOffset = this.xOffset;\n newWaveform.xScale = this.xScale;\n }\n\n return newWaveform;\n }\n\n subrangeX(fromX, toX) {\n\n if (!this.xdata) {\n // We can select the new range from there\n\n let fromP = this.getIndexFromX(fromX),\n toP = this.getIndexFromX(toP);\n\n return new Waveform().setData(this.data.slice(fromP, toP)).rescaleX(this.xOffset, this.xScale);\n } else {\n\n var waveform = new Waveform();\n\n for (var i = 0, l = this.data.length; i < l; i++) {\n\n if (this.data[i] >= fromX && this.data[i] < toX) {\n\n waveform.append(this.dataX[i], this.data[i]);\n }\n }\n\n return waveform;\n }\n }\n\n findLocalMinMax(xRef, xWithin, type) {\n\n let index = this.getIndexFromX(xRef),\n indexPlus = this.getIndexFromX(xRef + xWithin),\n indexMinus = this.getIndexFromX(xRef - xWithin);\n\n return this.findLocalMinMaxIndex(indexMinus, indexPlus, type);\n }\n\n findLocalMinMaxIndex(indexMinus, indexPlus, type) {\n\n let tmp;\n\n if (indexPlus < indexMinus) {\n tmp = indexPlus;\n indexPlus = indexMinus;\n indexMinus = tmp;\n }\n\n let curr, currI;\n\n if (type == 'max') {\n\n curr = Number.NEGATIVE_INFINITY;\n\n for (var i = indexMinus; i <= indexPlus; i++) {\n\n if (this.getY(i) > curr) {\n curr = this.getY(i);\n currI = i;\n }\n }\n } else {\n\n curr = Number.POSITIVE_INFINITY;\n\n for (var i = indexMinus; i <= indexPlus; i++) {\n\n if (this.getY(i) < curr) {\n curr = this.getY(i);\n currI = i;\n }\n }\n }\n\n if (currI == indexMinus || currI == indexPlus) {\n return false;\n }\n\n return this.getX(currI);\n }\n\n warn(text) {\n if (console) {\n console.warn(text);\n }\n }\n\n setUnit(unit) {\n this.unit = unit;\n return this;\n }\n\n setXUnit(unit) {\n if (this.hasXWaveform()) {\n this.xdata.setUnit(unit);\n }\n\n this.xunit = unit;\n return this;\n }\n\n getUnit() {\n return this.unit || \"\";\n }\n\n getXUnit() {\n if (this.hasXWaveform()) {\n return this.xdata.getUnit();\n }\n\n return this.xunit | \"\";\n }\n\n hasXUnit() {\n return this.getXUnit().length > 0;\n }\n\n hasUnit() {\n return this.getUnit().length > 0;\n }\n\n findLevels(level, options) {\n\n options = extend({\n\n box: 1,\n edge: 'both',\n rounding: 'before',\n rangeP: [0, this.getLength()]\n\n }, options);\n\n var lastLvlIndex = options.rangeP[0];\n var lvlIndex;\n var indices = [];\n var i = 0;\n\n while (lvlIndex = this.findLevel(level, extend(true, {}, options, {\n rangeP: [lastLvlIndex, options.rangeP[1]]\n }))) {\n indices.push(lvlIndex);\n lastLvlIndex = Math.ceil(lvlIndex);\n\n i++;\n if (i > 1000) {\n return;\n }\n }\n\n return indices;\n }\n\n // Find the first level in the specified range\n findLevel(level, options) {\n\n options = extend({\n\n box: 1,\n edge: 'both',\n direction: 'ascending',\n rounding: 'before',\n rangeP: [0, this.getLength()]\n\n }, options);\n\n if (options.rangeX) {\n options.rangeP = options.rangeX.map(this.getIndexFromX);\n }\n\n var value, below, i, j, l, increment;\n\n var box = options.box;\n\n if (box % 2 == 0) {\n box++;\n }\n\n if (options.direction == \"descending\") {\n i = options.rangeP[1], l = options.rangeP[0], increment = -1;\n } else {\n i = options.rangeP[0], l = options.rangeP[1], increment = +1;\n }\n\n for (;; i += increment) {\n\n if (options.direction == \"descending\") {\n if (i < l) {\n break;\n }\n } else {\n if (i > l) {\n break;\n }\n }\n\n if (i < options.rangeP[0] + (box - 1) / 2) {\n continue;\n }\n\n if (i > options.rangeP[1] - (box - 1) / 2) {\n break;\n }\n\n value = this.getAverageP(i - (box - 1) / 2, i + (box - 1) / 2);\n\n if (below === undefined) {\n below = value < level;\n continue;\n }\n // Crossing up\n if (value >= level && below) {\n\n below = false;\n\n if (options.edge == 'ascending' || options.edge == 'both') {\n // Found something\n\n for (j = i + (box - 1) / 2; j >= i - (box - 1) / 2; j--) {\n\n if (this.data[j] >= level && this.data[j - 1] <= level) {\n // Find a crossing\n\n switch (options.rounding) {\n case 'before':\n return j - 1;\n break;\n\n case 'after':\n return j;\n break;\n\n case 'interpolate':\n return getIndexInterpolate(level, this.data[j], this.data[j - 1], j, j - 1);\n break;\n }\n }\n }\n }\n } else if (value <= level && !below) {\n\n below = true;\n\n if (options.edge == 'descending' || options.edge == 'both') {\n\n for (j = i + (box - 1) / 2; j >= i - (box - 1) / 2; j--) {\n\n if (this.data[j] <= level && this.data[j - 1] >= level) {\n // Find a crossing\n\n switch (options.rounding) {\n case 'before':\n return j - 1;\n break;\n\n case 'after':\n return j;\n break;\n\n case 'interpolate':\n return getIndexInterpolate(level, this.data[j], this.data[j - 1], j, j - 1);\n break;\n }\n }\n }\n }\n }\n }\n }\n\n normalize(mode) {\n\n let factor, total, minValue, maxValue, ratio, i;\n\n if (mode == 'max1' || mode == 'max100') {\n\n factor = 1;\n\n if (mode == 'max100') {\n factor = 100;\n }\n\n maxValue = this.data[0];\n\n for (i = 1; i < this.getLength(); i++) {\n\n if (this.data[i] > maxValue) {\n\n maxValue = this.data[i];\n }\n }\n\n for (i = 0; i < this.getLength(); i++) {\n\n this.data[i] /= maxValue / factor;\n }\n } else if (mode == 'sum1') {\n\n total = 0;\n\n for (i = 0; i < this.getLength(); i++) {\n total += this.data[i];\n }\n\n for (i = 0; i < this.getLength(); i++) {\n\n this.data[i] /= total;\n }\n } else if (mode == 'max1min0') {\n\n maxValue = this.data[0], minValue = this.data[0];\n\n for (i = 1; i < this.getLength(); i++) {\n if (this.data[i] > maxValue) {\n\n maxValue = this.data[i];\n } else if (this.data[i] < minValue) {\n\n minValue = this.data[i];\n }\n }\n\n ratio = 1 / (maxValue - minValue);\n\n for (i = 0; i < this.getLength(); i++) {\n\n this.data[i] = (this.data[i] - minValue) * ratio;\n }\n }\n\n this.setData(this.data);\n }\n\n}\n\nconst MULTIPLY = Symbol();\nconst ADD = Symbol();\nconst SUBTRACT = Symbol();\nconst DIVIDE = Symbol();\n\n// http://stackoverflow.com/questions/26965171/fast-nearest-power-of-2-in-javascript\nfunction pow2ceil(v) {\n v--;\n var p = 2;\n while (v >>= 1) {\n p <<= 1;\n }\n return p;\n}\n\nfunction pow2floor(v) {\n\n var p = 1;\n\n while (v >>= 1) {\n p <<= 1;\n }\n return p;\n}\n\nfunction getIndexInterpolate(value, valueBefore, valueAfter, indexBefore, indexAfter) {\n return (value - valueBefore) / (valueAfter - valueBefore) * (indexAfter - indexBefore) + indexBefore;\n}\n\nfunction binarySearch(target, haystack, reverse) {\n\n let seedA = 0,\n length = haystack.length,\n seedB = length - 1,\n seedInt,\n i = 0,\n nanDirection = 1;\n\n if (haystack[seedA] == target) {\n return seedA;\n }\n\n if (haystack[seedB] == target) {\n return seedB;\n }\n\n while (true) {\n i++;\n if (i > 100) {\n throw \"Error loop\";\n }\n\n seedInt = Math.floor((seedA + seedB) / 2);\n\n // seedInt -= seedInt % 2; // Always looks for an x.\n\n while (isNaN(haystack[seedInt])) {\n\n if (seedInt >= haystack.length - 1) {\n\n return haystack.length - 1;\n } else if (seedInt <= 0) {\n\n return 0;\n }\n\n seedInt += nanDirection;\n }\n\n if (seedInt == seedA || haystack[seedInt] == target || seedInt == seedB) {\n return seedInt;\n }\n\n // console.log(seedA, seedB, seedInt, haystack[seedInt]);\n if (haystack[seedInt] <= target) {\n if (reverse) {\n seedB = seedInt;\n } else {\n seedA = seedInt;\n }\n } else if (haystack[seedInt] > target) {\n if (reverse) {\n seedA = seedInt;\n } else {\n seedB = seedInt;\n }\n } else {\n return false;\n }\n\n nanDirection *= -1;\n }\n}\n\n/**\n * Default graph parameters\n * @name Graph~GraphOptionsDefault\n * @name GraphOptions\n * @object\n * @static\n * @memberof Graph\n * @prop {String} title - Title of the graph\n * @prop {Number} paddingTop - The top padding\n * @prop {Number} paddingLeft - The left padding\n * @prop {Number} paddingRight - The right padding\n * @prop {Number} paddingBottom - The bottom padding\n * @prop {(Number|Boolean)} padding - A common padding value for top, bottom, left and right\n * @prop {Number} fontSize - The basic text size of the graphs\n * @prop {Number} fontFamily - The basic font family. Should be installed on the computer of the user\n * @prop {Object.} plugins - A list of plugins to import with their options\n * @prop {Object.} pluginAction - The default key combination to access those actions\n * @prop {Object.} mouseActions - Alias of pluginActions\n * @prop {Object.} keyActions - Defines what happens when keys are pressed\n * @prop {Object} wheel - Define the mouse wheel action\n * @prop {Object} dblclick - Define the double click action\n * @prop {Boolean} shapesUniqueSelection - true to allow only one shape to be selected at the time\n * @prop {Boolean} shapesUnselectOnClick - true to unselect all shapes on click\n */\nconst GraphOptionsDefault = {\n\n title: '',\n\n paddingTop: 30,\n paddingBottom: 5,\n paddingLeft: 20,\n paddingRight: 20,\n\n close: {\n left: true,\n right: true,\n top: true,\n bottom: true\n },\n\n closeColor: 'black',\n\n fontSize: 12,\n fontFamily: 'Myriad Pro, Helvetica, Arial',\n\n plugins: {},\n pluginAction: {},\n mouseActions: [],\n keyActions: [],\n wheel: {},\n dblclick: {},\n\n shapesUnselectOnClick: true,\n shapesUniqueSelection: true\n};\n\nconst defaultScatterStyle = {\n shape: 'circle',\n r: 4\n};\n\nvar _constructors = new Map();\n\n/**\n * Entry class of jsGraph that creates a new graph.\n * @extends EventEmitter\n * @tutorial basic\n */\nclass Graph$1 extends EventEmitter {\n\n /**\n * Graph constructor\n * @param {(HTMLElement|String)} [wrapper ] - The DOM Wrapper element its ```id``` property. If you do not use the wrapper during the graph creation, use it with the @link{Graph.setWrapper} method\n * @param {GraphOptions} [ options ] - The options of the graph\n * @param {Object} [ axis ] - The list of axes\n * @param {Array} axis.left - The list of left axes\n * @param {Array} axis.bottom - The list of bottom axes\n * @param {Array} axis.top - The list of top axes\n * @param {Array} axis.right - The list of right axes\n * @example var graph = new Graph(\"someDomID\");\n * @example var graph = new Graph(\"someOtherDomID\", { title: 'Graph title', paddingRight: 100 } );\n */\n constructor(wrapper, options, axis) {\n\n super();\n\n /*\n The unique ID of the graph\n @name Graph#uniqueid\n @type String\n */\n this._creation = guid();\n this._drawn = false;\n\n if (wrapper === Object(wrapper) && !(wrapper instanceof HTMLElement)) {\n // Wrapper is options\n axis = options;\n options = wrapper;\n wrapper = null;\n } else if (typeof wrapper == 'string') {\n wrapper = document.getElementById(wrapper);\n } else if (typeof wrapper.length == 'number') {\n wrapper = wrapper[0];\n }\n\n /**\n * @object\n * @memberof Graph\n * @name Graph#options\n * @type GraphOptions\n * @default {@link GraphOptionsDefault}\n * Access directly the options of the graph using this public object.\n * @example graph.options.mouseActions.push( { } );\n */\n this.options = extend$1({}, GraphOptionsDefault, options);\n // Options declaration must be placed before the doDom operation\n\n // doDom is a private method. We bind it to this thanks to ES6 features\n doDom.bind(this)();\n\n if (wrapper) {\n this.setWrapper(wrapper);\n }\n\n this.prevented = false;\n\n this.axis = {\n left: [],\n top: [],\n bottom: [],\n right: []\n };\n\n this.shapes = [];\n this.shapesLocked = false;\n this.plugins = {};\n\n for (var i in this.options.pluginAction) {\n this.options.pluginAction.plugin = i;\n this.options.mouseActions.push(this.options.pluginAction);\n }\n\n this.selectedShapes = [];\n\n this.series = [];\n //this._dom = wrapper;\n this._axesHaveChanged = true;\n\n if (this.options.hasOwnProperty('padding') && isNumeric$1(this.options.padding)) {\n this.options.paddingTop = this.options.paddingBottom = this.options.paddingLeft = this.options.paddingRight = this.options.padding;\n }\n\n this.currentAction = false;\n\n this.ns = Graph$1.ns;\n this.nsxlink = Graph$1.nsxlink;\n\n // Load all axes\n if (axis) {\n for (var i in axis) {\n for (var j = 0, l = axis[i].length; j < l; j++) {\n\n switch (i) {\n\n case 'top':\n this.getTopAxis(j, axis[i][j]);\n break;\n case 'left':\n this.getLeftAxis(j, axis[i][j]);\n break;\n case 'right':\n this.getRightAxis(j, axis[i][j]);\n break;\n case 'bottom':\n this.getBottomAxis(j, axis[i][j]);\n break;\n\n default:\n // Do not do anything\n break;\n }\n }\n }\n }\n\n this._pluginsInit();\n }\n\n setWrapper(wrapper) {\n\n if (!wrapper) {\n throw new Error('The wrapper DOM element was not found.');\n }\n\n if (!wrapper.appendChild) {\n throw new Error('The wrapper appears to be an invalid HTMLElement');\n }\n\n wrapper.style['-webkit-user-select'] = 'none';\n wrapper.style['-moz-user-select'] = 'none';\n wrapper.style['-o-user-select'] = 'none';\n wrapper.style['-ms-user-select'] = 'none';\n wrapper.style['user-select'] = 'none';\n\n wrapper.style.position = 'relative';\n wrapper.style.outline = 'none';\n\n // Why would that be necessary ?\n // wrapper.setAttribute( 'tabindex', 1 );\n\n this.wrapper = wrapper;\n\n // DOM\n\n if (!this.height || !this.width) {\n var wrapperStyle = getComputedStyle(wrapper);\n var w = parseInt(wrapperStyle.width, 10);\n var h = parseInt(wrapperStyle.height, 10);\n this.setSize(w, h);\n this._resize();\n }\n\n wrapper.appendChild(this.dom);\n\n _registerEvents(this);\n }\n /**\n * Returns the graph SVG wrapper element\n * @public\n * @return {SVGElement} The DOM element wrapping the graph\n */\n getDom() {\n return this.dom;\n }\n\n /**\n * Returns the unique id representing the graph\n * @public\n * @return {String} The unique ID of the graph\n */\n getId() {\n return this._creation;\n }\n\n /**\n * Returns the graph wrapper element passed during the graph creation\n * @public\n * @return {HTMLElement} The DOM element wrapping the graph\n */\n getWrapper() {\n return this.wrapper;\n }\n\n /**\n * Sets an option of the graph\n * @param {String} name - Option name\n * @param value - New option value\n * @returns {Graph} - Graph instance\n */\n setOption(name, val) {\n this.options[name] = val;\n return this;\n }\n\n /**\n * Sets the title of the graph\n */\n setTitle(title) {\n this.options.title = title;\n this.domTitle.textContent = title;\n }\n\n /**\n * Shows the title of the graph\n */\n displayTitle() {\n this.domTitle.setAttribute('display', 'inline');\n }\n\n /**\n * Hides the title of the graph\n */\n hideTitle() {\n this.domTitle.setAttribute('display', 'none');\n }\n\n hide() {\n if (this.dom.style.display !== 'none') {\n this.dom.style.display = 'none';\n }\n }\n\n show() {\n if (this.dom.style.display == 'none') {\n this.dom.style.display = 'initial';\n }\n }\n\n /**\n * Calls a repaint of the container. Used internally when zooming on the graph, or when .autoscaleAxes() is called (see {@link Graph#autoscaleAxes}).
\n * To be called after axes min/max are expected to have changed (e.g. after an axis.zoom( from, to )) has been called\n * @param {Boolean} onlyIfAxesHaveChanged - Triggers a redraw only if min/max values of the axes have changed.\n * @return {Boolean} if the redraw has been successful\n */\n redraw(onlyIfAxesHaveChanged, force) {\n\n if (!this.width || !this.height) {\n return;\n }\n\n if (!this.sizeSet) {\n this._resize();\n this.executeRedrawSlaves();\n return true;\n } else {\n\n if (!onlyIfAxesHaveChanged || force || haveAxesChanged(this) || hasSizeChanged(this)) {\n this.executeRedrawSlaves();\n refreshDrawingZone(this);\n return true;\n }\n }\n\n this.executeRedrawSlaves(true);\n return false;\n }\n\n executeRedrawSlaves() {\n this._pluginsExecute('preDraw');\n }\n\n /**\n * Draw the graph and the series. This method will only redraw what is necessary. You may trust its use when you have set new data to series, changed serie styles or called for a zoom on an axis.\n */\n draw(force) {\n\n this.drawn = true;\n this.updateLegend(true);\n this.drawSeries(this.redraw(true, force));\n\n this._pluginsExecute('postDraw');\n }\n\n /**\n * Prevents the graph, the series and the legend from redrawing automatically. Valid until {@link Graph#resumeUpdate} is called\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#resumeUpdate}\n * @see {@link Graph#doUpdate}\n * @since 1.16.19\n */\n delayUpdate() {\n this._lockUpdate = true;\n return this;\n }\n\n /**\n * Forces legend and graph update, even is {@link Graph#delayUpdate} has been called before.\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#delayUpdate}\n * @see {@link Graph#resumeUpdate}\n * @since 1.16.19\n */\n doUpdate() {\n if (this.legend) {\n this.legend.update();\n }\n this.draw();\n if (this.legend) {\n this.legend.update();\n }\n return this;\n }\n\n /**\n * Cancels the effect of {@link Graph#delayUpdate}, but does not redraw the graph automatically\n * @memberof Graph\n * @return {Graph} The current graph instance\n * @see {@link Graph#delayUpdate}\n * @see {@link Graph#doUpdate}\n * @since 1.16.19\n */\n resumeUpdate() {\n this._lockUpdate = false;\n return this;\n }\n\n isDelayedUpdate() {\n return this._lockUpdate;\n }\n\n /**\n * Sets the total width of the graph\n * @param {Number} width - The new width of the graph\n * @param {Boolean} skipResize - true to defer graph repaint. Use {@link Graph#resize} to force repain later on. (Useful if many graph sizing operations are done successively)\n * @see Graph#setHeight\n * @see Graph#resize\n */\n setWidth(width, skipResize) {\n this.width = width;\n if (!skipResize) {\n this._resize();\n }\n }\n\n /**\n * Sets the total height of the graph\n * @param {Number} height - The new height of the graph\n * @param {Boolean} skipResize - true to defer graph repaint. Use {@link Graph#resize} to force repain later on. (Useful if many graph sizing operations are done successively)\n * @see Graph#setWidth\n * @see Graph#resize\n */\n setHeight(height, skipResize) {\n this.height = height;\n if (!skipResize) {\n this._resize();\n }\n }\n\n /**\n * Sets the new dimension of the graph and repaints it. If width and height are omitted, a simple refresh is done.\n * @param {Number} [ width ] - The new width of the graph\n * @param {Number} [ height ] - The new height of the graph\n * @see Graph#setWidth\n * @see Graph#setHeight\n * @return {Graph} The current graph\n */\n resize(w, h) {\n if (w && h) {\n this.setSize(w, h);\n }\n\n this._resize();\n return this;\n }\n\n /**\n * Sets the new dimension of the graph without repainting it. Use {@link Graph#resize} to perform the actual resizing of the graph.\n * @param {Number} [ width ] - The new width of the graph\n * @param {Number} [ height ] - The new height of the graph\n * @see Graph#setWidth\n * @see Graph#setHeight\n * @see Graph#resize\n */\n setSize(w, h) {\n this.setWidth(w, true);\n this.setHeight(h, true);\n this.getDrawingHeight();\n this.getDrawingWidth();\n }\n\n /**\n * Returns the width of the graph (set by setSize, setWidth or resize methods)\n * @return {Number} Width of the graph\n */\n getWidth() {\n return this.width;\n }\n\n /**\n * Returns the height of the graph (set by setSize, setHeight or resize methods)\n * @return {Number} Height of the graph\n */\n getHeight() {\n return this.height;\n }\n\n /**\n * Returns the top padding of the graph (space between the top of the svg container and the topmost axis)\n * @return {Number} paddingTop\n */\n getPaddingTop() {\n return this.options.paddingTop;\n }\n\n /**\n * Returns the left padding of the graph (space between the left of the svg container and the leftmost axis)\n * @return {Number} paddingTop\n */\n getPaddingLeft() {\n return this.options.paddingLeft;\n }\n\n /**\n * Returns the bottom padding of the graph (space between the bottom of the svg container and the bottommost axis)\n * @return {Number} paddingTop\n */\n getPaddingBottom() {\n return this.options.paddingBottom;\n }\n\n /**\n * Returns the right padding of the graph (space between the right of the svg container and the rightmost axis)\n * @return {Number} paddingRight\n */\n getPaddingRight() {\n return this.options.paddingRight;\n }\n\n /**\n * Returns the height of the drawable zone, including the space used by the axes\n * @param {Boolean} useCache - Use cached value. Useful if one is sure the graph hasn't changed dimension. Automatically called after a Graph.resize();\n * @returns {Number} Height of the graph\n */\n getDrawingHeight(useCache) {\n if (useCache && this.innerHeight) {\n return this.innerHeight;\n }\n return this.innerHeight = this.height - this.options.paddingTop - this.options.paddingBottom;\n }\n\n /**\n * Returns the width of the drawable zone, including the space used by the axes\n * @param {Boolean} useCache - Use cached value. Useful if one is sure the graph hasn't changed dimension. Automatically called after a Graph.resize();\n * @returns {Number} Width of the graph\n */\n getDrawingWidth(useCache) {\n if (useCache && this.innerWidth) {\n return this.innerWidth;\n }\n return this.innerWidth = this.width - this.options.paddingLeft - this.options.paddingRight;\n }\n\n /**\n * Caches the wrapper offset in the page.
\n * The position of the wrapper is used when processing most of mouse events and it is fetched via the jQuery function .offset().\n * If performance becomes a critical issue in your application, cacheOffset() should be used to store the offset position. It should be ensured that the graph doesn't move in the page. If one can know when the graph has moved, cacheOffset() should be called again to update the offset position.\n * @see Graph#uncacheOffset\n */\n cacheOffset() {\n this.offsetCached = getOffset(this.wrapper);\n }\n\n /**\n * Un-caches the wrapper offset value\n * @see Graph#cacheOffset\n */\n uncacheOffset() {\n this.offsetCached = false;\n }\n\n /**\n * Returns the x axis at a certain index. If any top axis exists and no bottom axis exists, returns or creates a top axis. Otherwise, creates or returns a bottom axis\n * Caution ! The options parameter will only be effective if an axis is created\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getXAxis(index, options) {\n if (this.axis.top.length > 0 && this.axis.bottom.length == 0) {\n return this.getTopAxis(index, options);\n }\n\n return this.getBottomAxis(index, options);\n }\n\n /**\n * Returns the y axis at a certain index. If any right axis exists and no left axis exists, returns or creates a right axis. Otherwise, creates or returns a left axis\n * Caution ! The options parameter will only be effective if an axis is created\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getYAxis(index, options) {\n\n if (this.axis.right.length > 0 && this.axis.left.length == 0) {\n return this.getRightAxis(index, options);\n }\n\n return this.getLeftAxis(index, options);\n }\n\n /**\n * Returns the top axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getTopAxis(index, options) {\n return _getAxis(this, index, options, 'top');\n }\n\n /**\n * Returns the bottom axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getBottomAxis(index, options) {\n return _getAxis(this, index, options, 'bottom');\n }\n\n /**\n * Returns the left axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getLeftAxis(index, options) {\n return _getAxis(this, index, options, 'left');\n }\n\n /**\n * Returns the right axis at a certain index. Creates it if non-existant\n * @param {Number} [ index=0 ] - The index of the axis\n * @param {Object} [ options={} ] - The options to pass to the axis constructor\n */\n getRightAxis(index, options) {\n return _getAxis(this, index, options, 'right');\n }\n\n /**\n * Sets a bottom axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n */\n setXAxis(axis, index) {\n this.setBottomAxis(axis, index);\n }\n\n /**\n * Sets a left axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n */\n setYAxis(axis, index) {\n this.setLeftAxis(axis, index);\n }\n\n /**\n * Sets a left axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setTopAxis\n * @see Graph#setRightAxis\n * @see Graph#getLeftAxis\n * @see Graph#getYAxis\n */\n setLeftAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.left[index]) {\n this.axis.left[index].kill();\n }\n this.axis.left[index] = axis;\n }\n\n /**\n * Sets a right axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setLeftAxis\n * @see Graph#setTopAxis\n * @see Graph#getRightAxis\n * @see Graph#getYAxis\n */\n setRightAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.right[index]) {\n this.axis.right[index].kill();\n }\n this.axis.right[index] = axis;\n }\n\n /**\n * Sets a top axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setBottomAxis\n * @see Graph#setLeftAxis\n * @see Graph#setRightAxis\n * @see Graph#getBottomAxis\n * @see Graph#getXAxis\n */\n setTopAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.top[index]) {\n this.axis.top[index].kill();\n }\n this.axis.top[index] = axis;\n }\n\n /**\n * Sets a bottom axis\n * @param {Axis} axis - The axis instance to set\n * @param {Number} [ index=0 ] - The index of the axis\n * @see Graph#setTopAxis\n * @see Graph#setLeftAxis\n * @see Graph#setRightAxis\n * @see Graph#getTopAxis\n * @see Graph#getXAxis\n */\n setBottomAxis(axis, index) {\n index = index || 0;\n\n if (this.axis.bottom[index]) {\n this.axis.bottom[index].kill();\n }\n this.axis.bottom[index] = axis;\n }\n\n killAxis(axis, noRedraw = false, noSerieKill = false) {\n\n var index;\n\n if (axis.isX()) {\n\n if ((index = this.axis.bottom.indexOf(axis)) > -1) {\n this.axis.bottom.splice(index, 1);\n }\n\n if ((index = this.axis.top.indexOf(axis)) > -1) {\n this.axis.top.splice(index, 1);\n }\n\n if (!noSerieKill) {\n this.series.forEach(serie => {\n\n if (serie.getXAxis() == axis) {\n serie.kill();\n }\n });\n }\n }\n\n if (axis.isY()) {\n\n if ((index = this.axis.left.indexOf(axis)) > -1) {\n this.axis.left.splice(index, 1);\n }\n\n if ((index = this.axis.right.indexOf(axis)) > -1) {\n this.axis.right.splice(index, 1);\n }\n\n if (!noSerieKill) {\n this.series.forEach(serie => {\n\n if (serie.getYAxis() == axis) {\n serie.kill();\n }\n });\n }\n }\n\n this.axisGroup.removeChild(axis.group); // Removes all DOM\n this.groupPrimaryGrids.removeChild(axis.gridPrimary);\n this.groupSecondaryGrids.removeChild(axis.gridSecondary);\n\n if (!noRedraw) {\n this.draw(true);\n }\n }\n\n /**\n * Determines if an x axis belongs to the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasXAxis(axis) {\n return this.hasTopAxis(axis) || this.hasBottomAxis(axis);\n }\n\n /**\n * Determines if an x axis belongs to the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasYAxis(axis) {\n return this.hasLeftAxis(axis) || this.hasRightAxis(axis);\n }\n\n /**\n * Determines if an x axis belongs to top axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasTopAxis(axis) {\n return this.hasAxis(axis, this.axis.top);\n }\n\n /**\n * Determines if an x axis belongs to bottom axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasBottomAxis(axis) {\n return this.hasAxis(axis, this.axis.bottom);\n }\n\n /**\n * Determines if a y axis belongs to left axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasLeftAxis(axis) {\n return this.hasAxis(axis, this.axis.left);\n }\n\n /**\n * Determines if a y axis belongs to right axes list of the graph\n * @param {Axis} axis - The axis instance to check\n */\n hasRightAxis(axis) {\n return this.hasAxis(axis, this.axis.right);\n }\n\n /**\n * Determines if an axis belongs to a list of axes\n * @param {Axis} axis - The axis instance to check\n * @param {Array} axisList - The list of axes to check\n * @private\n */\n hasAxis(axis, axisList) {\n for (var i = 0, l = axisList.length; i < l; i++) {\n if (axisList[i] == axis) {\n return true;\n }\n\n if (axisList[i].hasAxis(axis)) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Autoscales the x and y axes of the graph.\n * Does not repaint the canvas\n * @return {Graph} The current graph instance\n */\n autoscaleAxes() {\n\n this._applyToAxes('setMinMaxToFitSeries', null, true, true);\n\n //this._applyToAxes( \"scaleToFitAxis\", [ this.getYAxis() ], false, true )\n // X is not always ascending...\n return this;\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoscale() {\n return this.autoscaleAxes(...arguments);\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoScale() {\n return this.autoscaleAxes(...arguments);\n }\n\n // See #138\n /**\n * @alias Graph#autoscaleAxes\n */\n autoScaleAxes() {\n return this.autoscaleAxes(...arguments);\n }\n\n // See #138\n /**\n * Autoscales a particular axis\n * @param {Axis} The axis to rescale\n * @return {Graph} The current graph instance\n */\n autoScaleAxis(axis) {\n if (!axis) {\n return this;\n }\n\n axis.setMinMaxToFitSeries();\n return this;\n }\n\n /**\n * Sets the background color\n * @param {String} color - An SVG accepted color for the background\n * @return {Graph} The current graph instance\n */\n setBackgroundColor(color) {\n\n this.rectEvent.setAttribute('fill', color);\n return this;\n }\n\n getAxisState() {\n\n var state = {};\n for (var i in this.axis) {\n state[i] = this.axis[i].map(function (axis) {\n return [axis.getCurrentMin(), axis.getCurrentMax()];\n });\n }\n return state;\n }\n\n setAxisState(state) {\n\n var j, l;\n for (var i in state) {\n\n if (!this.axis[i]) {\n continue;\n }\n\n for (j = 0, l = state[i].length; j < l; j++) {\n\n if (!this.axis[i][j]) {\n continue;\n }\n\n this.axis[i][j].setCurrentMin(state[i][j][0]);\n this.axis[i][j].setCurrentMax(state[i][j][1]);\n }\n }\n\n this.draw();\n }\n\n saveAxisState(savedName) {\n this.savedAxisState = this.savedAxisState || {};\n this.savedAxisState[savedName] = this.getAxisState();\n return this;\n }\n\n recallAxisState(savedName) {\n if (this.savedAxisState[savedName]) {\n this.recallAxisState(this.savedAxisState[savedName]);\n }\n return this;\n }\n\n _applyToAxis(type) {\n\n switch (type) {\n\n case 'string':\n return function (type, func, params) {\n // params.splice(1, 0, type);\n\n for (var i = 0; i < this.axis[type].length; i++) {\n this.axis[type][i][func].apply(this.axis[type][i], params);\n }\n };\n\n case 'function':\n return function (type, func, params) {\n for (var i = 0; i < this.axis[type].length; i++) {\n func.call(this, this.axis[type][i], type, params);\n }\n };\n\n default:\n throw new Error('You must either execute a function or provide a string that registers a function');\n }\n }\n\n /**\n * Calculates the minimal or maximal value of the axis. Currently, alias of getBoudaryAxisFromSeries\n */\n getBoundaryAxis(axis, minmax, usingZValues) {\n\n var valSeries = this.getBoundaryAxisFromSeries(axis, minmax, usingZValues);\n // var valShapes = this.getBoundaryAxisFromShapes( axis, xy, minmax );\n return valSeries;\n //return Math[ minmax ]( valSeries, valShapes );\n }\n\n /**\n * Calculates the minimal or maximal value of the axis, based on the series that belong to it. The value is computed so that all series just fit in the value.\n * @memberof Graph.prototype\n * @param {Axis} axis - The axis for which the value should be computed\n * @param {minmax} minmax - The minimum or maximum to look for. \"min\" for the minimum, anything else for the maximum\n * @returns {Number} The minimimum or maximum of the axis based on its series\n */\n getBoundaryAxisFromSeries(axis, minmax, usingZValues) {\n\n var min = minmax == 'min',\n val,\n func = axis.isX() ? ['getMinX', 'getMaxX'] : ['getMinY', 'getMaxY'],\n func2use = func[min ? 0 : 1],\n infinity2use = min ? +Infinity : -Infinity,\n serie,\n series,\n serieValue,\n i,\n l;\n\n val = infinity2use;\n series = this.getSeriesFromAxis(axis);\n\n for (i = 0, l = series.length; i < l; i++) {\n\n serie = series[i];\n\n if (!serie.isShown()) {\n continue;\n }\n\n serieValue = serie[func2use](usingZValues);\n val = Math[minmax](isNaN(val) ? infinity2use : val, isNaN(serieValue) ? infinity2use : serieValue);\n }\n\n return val;\n }\n\n /**\n * Returns all the series associated to an axis\n * @param {Axis} axis - The axis to which the series belong\n * @returns {Serie[]} An array containing the list of series that belong to the axis\n */\n getSeriesFromAxis(axis) {\n var series = [],\n i = this.series.length - 1;\n\n for (; i >= 0; i--) {\n if (this.series[i].getXAxis() == axis || this.series[i].getYAxis() == axis) {\n series.push(this.series[i]);\n }\n }\n\n return series;\n }\n\n /**\n * Determines the maximum and minimum of each axes, based on {@link Graph#getBoundaryAxis}. It is usually called internally, but if the data of series has changed, called this function to make sure that minimum / maximum of the axes are properly updated.\n * @see Graph#getBoundaryAxis\n */\n updateDataMinMaxAxes(usingZValues) {\n\n var axisvars = ['bottom', 'top', 'left', 'right'],\n axis,\n j,\n l,\n i;\n\n for (j = 0, l = axisvars.length; j < l; j++) {\n\n for (i = this.axis[axisvars[j]].length - 1; i >= 0; i--) {\n\n axis = this.axis[axisvars[j]][i];\n\n // 25.10.2017. Wait a second, this cannot be real. Even hidden axes must have min max values.\n // The data can be displayed while the axis is hidden\n // I assume this was added to cover another bug, but another approach must be chosen\n if (!axis.isShown()) {}\n // continue;\n\n\n //console.log( axisvars[ j ], this.getBoundaryAxisFromSeries( this.axis[ axisvars[ j ] ][ i ], xy, 'min'), this.getBoundaryAxisFromSeries( this.axis[ axisvars[ j ] ][ i ], xy, 'max') );\n\n let min = this.getBoundaryAxis(this.axis[axisvars[j]][i], 'min', usingZValues);\n let max = this.getBoundaryAxis(this.axis[axisvars[j]][i], 'max', usingZValues);\n\n if (isFinite(max)) {\n axis.setMaxValueData(max);\n }\n if (isFinite(min)) {\n axis.setMinValueData(min);\n }\n }\n }\n }\n\n /**\n * Function that is called from {@link Graph#_applyToAxes}\n * @function\n * @name AxisCallbackFunction\n * @param {Axis} axis - The axis of the function\n * @param {String} type - The type of the axis (left,right,top,bottom)\n * @param params - The params passed in the _applyToAxis function.\n * @see Graph#_applyToAxes\n */\n\n /**\n * Applies a function to axes. The function will be executed once for every axis.\n * If func is a string, the internal function belonging to the axis will be called, with the params array flattened out (in this case, params must be an array).\n * If func is a function, the function will be called with the axis, its type and params as parameters. See {@link AxisCallbackFunction} for more details.\n * @param {(AxisCallbackFunction|String)} func - The function or function name to execute\n * @param params - Extra parameters to pass to the function\n * @param {Boolean} topbottom=false - True to apply to function to top and bottom axes\n * @param {Boolean} leftright=false - True to apply to function to left and right axes\n */\n _applyToAxes(func, params, tb, lr) {\n\n var ax = [],\n i = 0,\n l;\n\n if (tb || tb == undefined) {\n ax.push('top');\n ax.push('bottom');\n }\n if (lr || lr == undefined) {\n ax.push('left');\n ax.push('right');\n }\n\n for (l = ax.length; i < l; i++) {\n this._applyToAxis(typeof func).call(this, ax[i], func, params);\n }\n }\n\n /**\n * Axes can be dependant of one another (for instance for unit conversions)\n * Finds and returns all the axes that are linked to a specific axis. Mostly used internally.\n * @param {Axis} axis - The axis that links one or multiple other dependant axes\n * @returns {Axis[]} The list of axes linked to the axis passed as parameter\n */\n findAxesLinkedTo(axis) {\n\n var axes = [];\n this._applyToAxes(function (a) {\n\n if (a.linkedToAxis && a.linkedToAxis.axis == axis) {\n axes.push(a);\n }\n }, {}, axis instanceof this.getConstructor('graph.axis.x'), axis instanceof this.getConstructor('graph.axis.y'));\n\n return axes;\n }\n\n _axisHasChanged() {\n this._axesHaveChanged = true;\n }\n\n /**\n * Creates a new serie.\n * If the a serie with the same name exists, returns this serie with update options.\n * The type of the serie is used to fetch the corresponding registered constructor registered with the name \"graph.serie.\", e.g \"line\" will fetch the \"graph.serie.line\" prototype (built-in)
\n * Built-in series types are \"line\", \"contour\", \"zone\" and \"scatter\".\n * @param {String} name - The name of the serie (unique)\n * @param {Object} options - The serie options\n * @param {Type} type - The type of the serie.\n * @returns {Serie} The newly created serie\n */\n newSerie(name, options, type) {\n\n let serie;\n\n if (typeof options !== 'object' && !type) {\n type = options;\n options = {};\n }\n\n if (!type) {\n type = Graph$1.SERIE_LINE;\n }\n\n if (serie = this.getSerie(name)) {\n return serie;\n }\n\n if (!(serie = makeSerie(this, name, options, type))) {\n return;\n }\n\n this.series.push(serie);\n this.emit('newSerie', serie);\n return serie;\n }\n\n /**\n * Looks for an existing serie by name or by index and returns it.\n * The index of the serie follows the creation sequence (0 for the first one, 1 for the second one, ...)\n * @param {(String|Number)} name - The name or the index of the serie\n * @returns {Serie}\n */\n getSerie(name) {\n\n if (typeof name == 'number') {\n return this.series[name] || false;\n }\n\n if (typeof name == 'function') {\n name = name();\n }\n\n var i = 0,\n l = this.series.length;\n\n for (; i < l; i++) {\n\n if (this.series[i].getName() == name || this.series[i] == name) {\n\n return this.series[i];\n }\n }\n\n return false;\n }\n\n /**\n * Returns all the series\n * @returns {Serie[]} An array of all the series\n */\n getSeries() {\n return this.series;\n }\n\n /**\n * Returns all the series that correspond to one or multiple types\n * @param {...Symbol} type - The serie types to select\n * @returns {Serie[]} An array of all the series\n * @example graph.allSeries( Graph.SERIE_LINE, Graph.SERIE_ZONE );\n */\n allSeries(...types) {\n\n return this.series.filter(serie => {\n return types.include(serie.getType());\n });\n }\n\n /**\n * Draws a specific serie\n * @param {Serie} serie - The serie to redraw\n * @param {Boolean} force - Forces redraw even if no data has changed\n */\n drawSerie(serie, force) {\n\n if (!serie.draw) {\n throw new Error('Serie has no method draw');\n }\n\n serie.draw(force);\n }\n\n /**\n * Redraws all visible series\n * @param {Boolean} force - Forces redraw even if no data has changed\n */\n drawSeries(force) {\n\n if (!this.width || !this.height) {\n return;\n }\n\n var i = this.series.length - 1;\n for (; i >= 0; i--) {\n if (this.series[i].isShown()) {\n this.drawSerie(this.series[i], force);\n }\n }\n }\n\n /**\n * @alias Graph#removeSeries\n */\n resetSeries() {\n this.removeSeries();\n }\n\n /**\n * @alias Graph#removeSeries\n */\n\n killSeries() {\n this.resetSeries();\n }\n\n /**\n * Removes all series from the graph\n */\n removeSeries() {\n while (this.series[0]) {\n this.series[0].kill(true);\n }\n this.series = [];\n\n if (this.legend) {\n this.legend.update();\n }\n }\n\n /**\n * Selects a serie. Only one serie per graph can be selected.\n * @param {Serie} serie - The serie to select\n * @param {String} selectName=\"selected\" - The name of the selection\n */\n selectSerie(serie, selectName) {\n\n if (!(typeof serie == 'object')) {\n serie = this.getSerie(serie);\n }\n\n if (this.selectedSerie == serie && this.selectedSerie.selectionType == selectName) {\n return;\n }\n\n if (this.selectedSerie !== serie && this.selectedSerie) {\n this.unselectSerie(this.selectedSerie);\n }\n\n this.selectedSerie = serie;\n this.triggerEvent('onSelectSerie', serie);\n\n serie.select(selectName || 'selected');\n }\n\n /**\n * Returns the selected serie\n * @returns {(Serie|undefined)} The selected serie\n */\n getSelectedSerie() {\n return this.selectedSerie;\n }\n\n /**\n * Unselects a serie\n * @param {Serie} serie - The serie to unselect\n */\n unselectSerie(serie) {\n\n if (!serie.unselect) {\n return;\n }\n\n serie.unselect();\n this.selectedSerie = false;\n this.triggerEvent('onUnselectSerie', serie);\n }\n\n /**\n * Returns all the shapes associated to a serie. Shapes can (but don't have to) be associated to a serie. The position of the shape can then be relative to the same axes as the serie.\n * @param {Serie} serie - The serie containing the shapes\n * @returns {Shape[]} An array containing a list of shapes associated to the serie\n */\n getShapesOfSerie(serie) {\n\n var shapes = [];\n var i = this.shapes.length - 1;\n\n for (; i >= 0; i--) {\n\n if (this.shapes[i].getSerie() == serie) {\n shapes.push(this.shapes[i]);\n }\n }\n\n return shapes;\n }\n makeToolbar(toolbarData) {\n\n var constructor = this.getConstructor('graph.toolbar');\n if (constructor) {\n return this.toolbar = new constructor(this, toolbarData);\n } else {\n return throwError('No constructor exists for toolbar');\n }\n }\n\n /**\n * Returns all shapes from the graph\n */\n getShapes() {\n return this.shapes || [];\n }\n\n /**\n * Creates a new shape. jsGraph will look for the registered constructor \"graph.shape.\".\n * @param {String} shapeType - The type of the shape\n * @param {Object} [shapeData] - The options passed to the shape creator\n * @param {Boolean} [mute=false] - true to create the shape quietly\n * @param {Object} [shapeProperties] - The native object containing the shape properties in the jsGraph format (caution when using it)\n * @returns {Shape} The created shape\n * @see Graph#getConstructor\n */\n newShape(shapeType, shapeData, mute = false, shapeProperties) {\n\n this.prevent(false);\n\n if (!mute) {\n\n this.emit('beforeNewShape', shapeData);\n\n if (this.prevent(false)) {\n return false;\n }\n }\n\n // Backward compatibility\n if (typeof shapeType == 'object') {\n mute = shapeData;\n shapeData = shapeType;\n shapeType = shapeData.type;\n }\n\n shapeData = shapeData || {};\n shapeData._id = guid();\n\n var constructor;\n if (typeof shapeType == 'function') {\n constructor = shapeType;\n } else {\n constructor = this.getConstructor('graph.shape.' + shapeType);\n }\n\n if (!constructor) {\n return throwError('No constructor for this shape');\n }\n\n var shape = new constructor(this, shapeData);\n\n if (!shape) {\n return throwError('Failed to construct shape.');\n }\n\n shape.type = shapeType;\n shape.graph = this;\n shape._data = shapeData;\n\n if (shapeData.properties !== undefined) {\n shape.setProperties(shapeData.properties);\n }\n\n shape.init(this, shapeProperties);\n\n if (shapeData.props !== undefined) {\n for (var i in shapeData.props) {\n shape.setProp(i, shapeData.props[i]);\n }\n }\n\n if (shapeData.position) {\n\n for (var i = 0, l = shapeData.position.length; i < l; i++) {\n shape.setPosition(new Position(shapeData.position[i]), i);\n }\n }\n\n /* Setting shape properties */\n if (shapeData.fillColor !== undefined) {\n shape.setFillColor(shapeData.fillColor);\n }\n\n if (shapeData.fillOpacity !== undefined) {\n shape.setFillOpacity(shapeData.fillOpacity);\n }\n\n if (shapeData.strokeColor !== undefined) {\n shape.setStrokeColor(shapeData.strokeColor);\n }\n\n if (shapeData.strokeWidth !== undefined) {\n shape.setStrokeWidth(shapeData.strokeWidth);\n }\n\n if (shapeData.layer !== undefined) {\n shape.setLayer(shapeData.layer);\n }\n\n if (shapeData.locked == true) {\n shape.lock();\n }\n\n if (shapeData.movable == true) {\n shape.movable();\n }\n\n if (shapeData.selectable == true) {\n shape.selectable();\n }\n\n if (shapeData.resizable == true) {\n shape.resizable();\n }\n\n if (shapeData.attributes !== undefined) {\n shape.setProp('attributes', shapeData.attributes);\n }\n\n if (shapeData.handles !== undefined) {\n shape.setProp('handles', shapeData.handles);\n }\n\n if (shapeData.selectOnMouseDown !== undefined) {\n shape.setProp('selectOnMouseDown', true);\n }\n\n if (shapeData.selectOnClick !== undefined) {\n shape.setProp('selectOnClick', true);\n }\n\n if (shapeData.transforms !== undefined && Array.isArray(shapeData.transforms)) {\n\n shapeData.transforms.forEach(({\n\n type,\n value\n\n }) => {\n\n shape.addTransform(type, value);\n });\n }\n\n if (shapeData.highlightOnMouseOver !== undefined) {\n shape.setProp('highlightOnMouseOver', true);\n }\n\n if (shapeData.labelEditable) {\n shape.setProp('labelEditable', shapeData.labelEditable);\n }\n\n if (shapeData.labels && !shapeData.label) {\n shapeData.label = shapeData.labels;\n }\n\n if (shapeData.label !== undefined) {\n\n if (!Array.isArray(shapeData.label)) {\n shapeData.label = [shapeData.label];\n }\n\n for (var i = 0, l = shapeData.label.length; i < l; i++) {\n\n shape.showLabel(i);\n shape.setLabelText(shapeData.label[i].text, i);\n shape.setLabelPosition(shapeData.label[i].position, i);\n shape.setLabelColor(shapeData.label[i].color || 'black', i);\n shape.setLabelSize(shapeData.label[i].size, i);\n shape.setLabelAngle(shapeData.label[i].angle || 0, i);\n shape.setLabelBaseline(shapeData.label[i].baseline || 'no-change', i);\n shape.setLabelAnchor(shapeData.label[i].anchor || 'start', i);\n shape.setLabelBackgroundColor(shapeData.label[i].backgroundColor || 'transparent', i);\n shape.setLabelBackgroundOpacity(shapeData.label[i].backgroundOpacity || 1, i);\n }\n }\n\n if (shapeData.serie) {\n shape.setSerie(this.getSerie(shapeData.serie));\n }\n shape.createHandles();\n shape.applyStyle();\n\n this.shapes.push(shape);\n\n if (!mute) {\n this.emit('newShape', shape, shapeData);\n }\n\n return shape;\n }\n\n /**\n * Creates a new position. Arguments are passed to the position constructor\n * @param {...*} varArgs\n * @see Position\n */\n newPosition(varArgs) {\n\n return new Position(...arguments);\n\n // 18 September 2016 Norman: What is that ?\n //Array.prototype.unshift.call( arguments, null );\n //return new( Function.prototype.bind.apply( GraphPosition, arguments ) )();\n }\n\n /**\n * Redraws all shapes. To be called if their definitions have changed\n */\n redrawShapes() {\n\n //this.graphingZone.removeChild(this.shapeZone);\n for (var i = 0, l = this.shapes.length; i < l; i++) {\n this.shapes[i].redraw();\n }\n //this.graphingZone.insertBefore(this.shapeZone, this.axisGroup);\n }\n\n /**\n * Removes all shapes from the graph\n */\n removeShapes() {\n for (var i = 0, l = this.shapes.length; i < l; i++) {\n if (this.shapes[i] && this.shapes[i].kill) {\n this.shapes[i].kill(true);\n }\n }\n this.shapes = [];\n }\n\n /**\n * Selects a shape\n * @param {Shape} shape - The shape to select\n * @param {Boolean} mute - Select the shape quietly\n */\n selectShape(shape, mute) {\n\n // Already selected. Returns false\n\n if (!shape) {\n return;\n }\n\n if (this.selectedShapes.indexOf(shape) > -1) {\n return false;\n }\n\n if (!shape.isSelectable()) {\n return false;\n }\n\n if (!mute) {\n this.emit('beforeShapeSelect', shape);\n }\n\n if (this.prevent(false)) {\n return;\n }\n\n if (this.selectedShapes.length > 0 && this.options.shapesUniqueSelection) {\n // Only one selected shape at the time\n\n this.unselectShapes(mute);\n }\n\n shape._select(mute);\n this.selectedShapes.push(shape);\n\n if (!mute) {\n this.emit('shapeSelect', shape);\n }\n }\n\n getSelectedShapes() {\n return this.selectedShapes;\n }\n\n /**\n * Unselects a shape\n * @param {Shape} shape - The shape to unselect\n * @param {Boolean} mute - Unselect the shape quietly\n */\n unselectShape(shape, mute) {\n\n if (this.selectedShapes.indexOf(shape) == -1) {\n return;\n }\n\n if (!mute) {\n this.emit('beforeShapeUnselect', shape);\n }\n\n if (this.cancelUnselectShape) {\n this.cancelUnselectShape = false;\n return;\n }\n\n shape._unselect();\n\n this.selectedShapes.splice(this.selectedShapes.indexOf(shape), 1);\n\n if (!mute) {\n this.emit('shapeUnselect', shape);\n }\n }\n\n /**\n * Unselects all shapes\n * @param {Boolean} [ mute = false ] - Mutes all unselection events\n * @return {Graph} The current graph instance\n */\n unselectShapes(mute) {\n\n while (this.selectedShapes[0]) {\n this.unselectShape(this.selectedShapes[0], mute);\n }\n\n return this;\n }\n\n _removeShape(shape) {\n this.shapes.splice(this.shapes.indexOf(shape), 1);\n }\n\n appendShapeToDom(shape) {\n\n if (shape.isHTML()) {\n this.wrapper.insertBefore(shape._dom, this.dom);\n }\n\n this.getLayer(shape.getLayer(), 'shape').appendChild(shape.group);\n }\n\n removeShapeFromDom(shape) {\n\n if (shape.isHTML()) {\n this.wrapper.removeChild(shape._dom);\n }\n\n this.getLayer(shape.getLayer(), 'shape').removeChild(shape.group);\n }\n\n appendSerieToDom(serie) {\n this.getLayer(serie.getLayer(), 'serie').appendChild(serie.groupMain);\n }\n\n removeSerieFromDom(serie) {\n this.getLayer(serie.getLayer(), 'serie').removeChild(serie.groupMain);\n }\n\n getLayer(layer, mode) {\n\n if (!this.layers[layer]) {\n\n this.layers[layer] = [];\n\n this.layers[layer][0] = document.createElementNS(Graph$1.ns, 'g');\n this.layers[layer][0].setAttribute('data-layer', layer);\n this.layers[layer][1] = document.createElementNS(Graph$1.ns, 'g');\n this.layers[layer][2] = document.createElementNS(Graph$1.ns, 'g');\n\n this.layers[layer][0].appendChild(this.layers[layer][1]);\n this.layers[layer][0].appendChild(this.layers[layer][2]);\n\n var i = 1,\n prevLayer;\n\n while (!(prevLayer = this.layers[layer - i]) && layer - i >= 0) {\n i++;\n }\n\n if (!prevLayer) {\n\n this.plotGroup.insertBefore(this.layers[layer][0], this.plotGroup.firstChild);\n } else if (prevLayer.nextSibling) {\n\n this.plotGroup.insertBefore(this.layers[layer][0], prevLayer.nextSibling);\n } else {\n\n this.plotGroup.appendChild(this.layers[layer][0]);\n }\n }\n\n return this.layers[layer][mode == 'shape' ? 2 : 1];\n }\n\n focus() {\n this.wrapper.focus();\n }\n\n elementMoving(movingElement) {\n this.bypassHandleMouse = movingElement;\n }\n\n stopElementMoving(element) {\n\n if (element && element == this.bypassHandleMouse) {\n this.bypassHandleMouse = false;\n } else if (!element) {\n this.bypassHandleMouse = false;\n }\n }\n\n _makeClosingLines() {\n\n this.closingLines = {};\n var els = ['top', 'bottom', 'left', 'right'],\n i = 0,\n l = 4;\n for (; i < l; i++) {\n var line = document.createElementNS(Graph$1.ns, 'line');\n line.setAttribute('stroke', this.options.closeColor);\n line.setAttribute('shape-rendering', 'crispEdges');\n line.setAttribute('stroke-linecap', 'square');\n line.setAttribute('display', 'none');\n this.closingLines[els[i]] = line;\n this.graphingZone.appendChild(line);\n }\n }\n\n isActionAllowed(e, action) {\n\n if (action.type !== e.type && (action.type !== undefined || e.type !== 'mousedown') && !((e.type === 'wheel' || e.type === 'mousewheel') && action.type == 'mousewheel')) {\n return;\n }\n\n if (action.enabled && (typeof action.enabled == 'function' ? !action.enabled(this) : !action.enabled)) {\n return;\n }\n\n if (action.key) {\n\n if (action.key !== e.keyCode) {\n\n let keyCheck = {\n 'backspace': 8,\n 'enter': 13,\n 'tab': 9,\n 'shift': 16,\n 'ctrl': 17,\n 'alt': 18,\n 'pause': 19,\n 'escape': 27,\n 'up': 33,\n 'down': 34,\n 'left': 37,\n 'right': 39\n };\n\n if (keyCheck[action.key] !== e.keyCode) {\n return;\n }\n }\n }\n\n if (action.shift === undefined) {\n action.shift = false;\n }\n\n if (action.ctrl === undefined) {\n action.ctrl = false;\n }\n\n if (action.meta === undefined) {\n action.meta = false;\n }\n\n if (action.alt === undefined) {\n action.alt = false;\n }\n\n return e.shiftKey == action.shift && e.ctrlKey == action.ctrl && e.metaKey == action.meta && e.altKey == action.alt;\n }\n\n forcePlugin(plugin) {\n this.forcedPlugin = plugin;\n }\n\n unforcePlugin() {\n this.forcedPlugin = false;\n }\n\n _pluginsExecute(funcName, ...args) {\n\n //\t\t\tArray.prototype.splice.apply(args, [0, 0, this]);\n\n for (var i in this.plugins) {\n\n if (this.plugins[i] && this.plugins[i][funcName]) {\n\n this.plugins[i][funcName].apply(this.plugins[i], args);\n }\n }\n }\n\n _pluginExecute(which, func, args) {\n\n //Array.prototype.splice.apply( args, [ 0, 0, this ] );\n if (!which) {\n return;\n }\n\n if (this.plugins[which] && this.plugins[which][func]) {\n\n this.plugins[which][func].apply(this.plugins[which], args);\n return true;\n }\n }\n\n pluginYieldActiveState() {\n this.activePlugin = false;\n }\n\n _serieExecute(serie, func, args) {\n\n if (typeof serie !== 'object') {\n serie = this.getSerie(serie);\n }\n\n if (typeof serie[func] == 'function') {\n serie.apply(serie, args);\n }\n }\n _pluginsInit() {\n\n var constructor, pluginName, pluginOptions;\n\n for (var i in this.options.plugins) {\n\n pluginName = i;\n pluginOptions = this.options.plugins[i];\n\n constructor = this.getConstructor('graph.plugin.' + pluginName);\n\n if (constructor) {\n\n //var options = util.extend( true, {}, constructor.defaults(), pluginOptions );\n this.plugins[pluginName] = new constructor(pluginOptions);\n\n mapEventEmission(this.plugins[pluginName].options, this.plugins[pluginName]);\n this.plugins[pluginName].init(this, pluginOptions);\n } else {\n throwError('Plugin \"' + pluginName + '\" has not been registered');\n }\n }\n }\n\n /**\n * Returns an initialized plugin\n * @param {String} pluginName\n * @returns {Plugin} The plugin which name is \n */\n getPlugin(pluginName) {\n var plugin = this.plugins[pluginName];\n\n if (!plugin) {\n return throwError('Plugin \"' + pluginName + '\" has not been loaded or properly registered');\n }\n\n return plugin;\n }\n triggerEvent() {\n var func = arguments[0];\n /*,\n args = Array.prototype.splice.apply( arguments, [ 0, 1 ] );\n */\n if (typeof this.options[func] == 'function') {\n return this.options[func].apply(this, arguments);\n }\n }\n\n /**\n * Creates a legend. Only one legend is allowed per graph\n * @param {Object} options - The legend options\n */\n makeLegend(options) {\n\n if (this.legend) {\n return this.legend;\n }\n\n var constructor = this.getConstructor('graph.legend');\n if (constructor) {\n this.legend = new constructor(this, options);\n } else {\n return throwError('Graph legend is not available as it has not been registered');\n }\n\n return this.legend;\n }\n\n /**\n * Redraws the legend if it exists\n * @param {Boolean} [ onlyIfRequired = false ] ```true``` to redraw the legend only when it actually needs to be updated\n * @return {Graph} The graph instance\n */\n updateLegend(onlyIfRequired = false) {\n\n if (!this.legend) {\n return;\n }\n\n this.legend.update(onlyIfRequired);\n return this;\n }\n\n /**\n * @returns {Legend} The legend item\n */\n getLegend() {\n if (!this.legend) {\n return;\n }\n\n return this.legend;\n }\n\n requireLegendUpdate() {\n\n if (!this.legend) {\n return;\n }\n\n this.legend.requireDelayedUpdate();\n }\n\n orthogonalProjectionSetup() {\n\n this.options.zAxis = extend$1(true, {\n maxZ: 10,\n minZ: 0,\n shiftX: -25,\n shiftY: -15,\n xAxis: this.getXAxis(),\n yAxis: this.getYAxis()\n });\n }\n\n orthogonalProjectionUpdate() {\n\n if (!this.zAxis) {\n this.zAxis = {\n g: document.createElementNS(Graph$1.ns, 'g'),\n l: document.createElementNS(Graph$1.ns, 'line')\n };\n\n this.zAxis.g.appendChild(this.zAxis.l);\n this.groupGrids.appendChild(this.zAxis.g);\n }\n\n let refAxisX = this.options.zAxis.xAxis;\n let refAxisY = this.options.zAxis.yAxis;\n\n var x0 = refAxisX.getMinPx();\n var y0 = refAxisY.getMinPx();\n\n var dx = refAxisX.getZProj(this.options.zAxis.maxZ);\n var dy = refAxisY.getZProj(this.options.zAxis.maxZ);\n\n this.zAxis.l.setAttribute('stroke', 'black');\n this.zAxis.l.setAttribute('x1', x0);\n this.zAxis.l.setAttribute('x2', x0 + dx);\n this.zAxis.l.setAttribute('y1', y0);\n this.zAxis.l.setAttribute('y2', y0 + dy);\n\n this.updateDataMinMaxAxes(true);\n\n var sort = this.series.map(serie => {\n return [serie.getZPos(), serie];\n });\n\n sort.sort((sa, sb) => {\n return sb[0] - sa[0];\n });\n\n let i = 0;\n sort.forEach(s => {\n s[1].setLayer(i);\n this.appendSerieToDom(s[1]);\n i++;\n });\n\n this.drawSeries(true);\n }\n\n /**\n * Kills the graph\n **/\n kill() {\n this.wrapper.removeChild(this.dom);\n }\n _removeSerie(serie) {\n this.series.splice(this.series.indexOf(serie), 1);\n this._pluginsExecute('serieRemoved', serie);\n }\n contextListen(target, menuElements, callback) {\n\n if (this.options.onContextMenuListen) {\n return this.options.onContextMenuListen(target, menuElements, callback);\n }\n }\n lockShapes() {\n this.shapesLocked = true;\n\n // Removes the current actions of the shapes\n for (var i = 0, l = this.shapes.length; i < l; i++) {\n this.shapes[i].moving = false;\n this.shapes[i].resizing = false;\n }\n }\n unlockShapes() {\n //\t\tconsole.log('unlock');\n this.shapesLocked = false;\n }\n prevent(arg) {\n var curr = this.prevented;\n if (arg != -1) {\n this.prevented = arg == undefined || arg;\n }\n return curr;\n }\n _getXY(e) {\n\n var x = e.clientX,\n y = e.clientY;\n\n var pos = this.offsetCached || getOffset(this.wrapper);\n\n x -= pos.left;\n y -= pos.top;\n\n return {\n x: x,\n y: y\n };\n }\n _resize() {\n\n if (!this.width || !this.height) {\n return;\n }\n\n this.getDrawingWidth();\n this.getDrawingHeight();\n\n this.sizeSet = true;\n this.dom.setAttribute('width', this.width);\n this.dom.setAttribute('height', this.height);\n this.domTitle.setAttribute('x', this.width / 2);\n\n this._sizeChanged = true;\n\n if (this.drawn) {\n this.requireLegendUpdate();\n this.draw(true);\n }\n }\n\n updateGraphingZone() {\n setAttributeTo(this.graphingZone, {\n 'transform': 'translate(' + this.options.paddingLeft + ', ' + this.options.paddingTop + ')'\n });\n\n this._sizeChanged = true;\n }\n\n // We have to proxy the methods in case they are called anonymously\n getDrawingSpaceWidth() {\n return () => this.drawingSpaceWidth;\n }\n\n getDrawingSpaceHeight() {\n return () => this.drawingSpaceHeight;\n }\n\n getDrawingSpaceMinX() {\n return () => this.drawingSpaceMinX;\n }\n\n getDrawingSpaceMinY() {\n return () => this.drawingSpaceMinY;\n }\n\n getDrawingSpaceMaxX() {\n return () => this.drawingSpaceMaxX;\n }\n\n getDrawingSpaceMaxY() {\n return () => this.drawingSpaceMaxY;\n }\n\n /**\n * Enables the line tracking\n * @param {Object|Boolean} options - Defines the tracking behavior. If a boolean, simply enables or disables the existing tracking.\n */\n trackingLine(options) {\n\n var self = this;\n\n if (typeof options === 'boolean') {\n\n if (this.options.trackingLine) {\n this.options.trackingLine.enable = options;\n }\n return;\n }\n\n if (options) {\n this.options.trackingLine = options;\n }\n\n options.series = options.series || [];\n options.enable = options.enable === undefined ? true : !!options.enable;\n\n // Individual tracking\n if (options.mode == 'individual') {\n\n if (options.series) {\n\n if (!Array.isArray(options.series)) {\n\n if (options.series == 'all') {\n\n options.series = this.series.map(serie => ({\n serie: serie\n }));\n } else {\n\n options.series = [options.series];\n }\n }\n\n options.series.forEach(sOptions => {\n\n if (typeof sOptions.serie !== 'object') {\n\n if (typeof sOptions !== 'object') {\n throw new Error('Misuse of the trackingLine() method. Each serie must be an object with the serie property: { series: [ { serie: jsGraphSerie, options: { ... someOptions } } ] }');\n }\n\n sOptions.serie = this.getSerie(sOptions.serie);\n }\n\n if (!sOptions.serie) {\n return;\n }\n\n self.addSerieToTrackingLine(sOptions.serie, sOptions);\n });\n }\n } else {\n\n options.series.forEach(serie => {\n serie.serie.disableTracking();\n });\n }\n\n if (options.noLine) {\n return;\n }\n\n if (!this.trackingObject) {\n // Avoid multiple creation of tracking lines\n\n // Creates a new shape called trackingLine, in the first layer (below everything)\n this.trackingObject = this.newShape('line', extend$1(true, {\n position: [{\n y: 'min'\n }, {\n y: 'max'\n }],\n stroke: 'black',\n layer: -1\n }, options.trackingLineShapeOptions));\n }\n\n this.trackingObject.draw();\n\n return this.trackingObject;\n }\n\n addSerieToTrackingLine(serie, options) {\n\n if (!this.options.trackingLine) {\n\n this.trackingLine({\n mode: 'individual'\n });\n }\n\n this.options.trackingLine.series.forEach((serieO, index) => {\n if (serieO.serie == serie) {\n this.options.trackingLine.series.splice(index, 1);\n }\n });\n\n this.options.trackingLine.series.push(Object.assign({\n serie: serie\n }, options));\n\n serie.enableTracking((serie, index, x, y) => {\n\n if (this.options.trackingLine.enable) {\n\n if (index) {\n\n if (this.trackingObject) {\n\n this.trackingObject.show();\n this.trackingObject.getPosition(0).x = index.trueX; //serie.getData()[ 0 ][ index.closestIndex * 2 ];\n this.trackingObject.getPosition(1).x = index.trueX; //serie.getData()[ 0 ][ index.closestIndex * 2 ];\n this.trackingObject.redraw();\n }\n\n serie._trackingLegend = _trackingLegendSerie(this, {\n serie: serie\n }, x, y, serie._trackingLegend, options.textMethod ? options.textMethod : output => {\n\n for (var i in output) {\n return output[i].serie.serie.getName() + ': ' + output[i].serie.serie.getYAxis().valueToHtml(output[i].yValue);\n }\n }, index.trueX);\n\n if (serie._trackingLegend) {\n serie._trackingLegend.style.display = 'block';\n }\n }\n }\n }, serie => {\n\n if (this.trackingObject) {\n this.trackingObject.hide();\n }\n\n if (serie.trackingShape) {\n serie.trackingShape.hide();\n }\n\n if (serie._trackingLegend) {\n serie._trackingLegend.style.display = 'none';\n }\n\n serie._trackingLegend = _trackingLegendSerie(this, {\n\n serie: serie\n\n }, false, false, serie._trackingLegend, false, false);\n });\n }\n\n /**\n * Pass here the katex.render method to be used later\n * @param {Function} renderer - katexRendered - renderer\n * @return {Graph} The current graph instance\n */\n setKatexRenderer(renderer) {\n this._katexRenderer = renderer;\n }\n\n hasKatexRenderer() {\n return !!this._katexRenderer;\n }\n\n renderWithKatex(katexValue, katexElement) {\n\n if (this._katexRenderer) {\n\n if (katexElement) {\n katexElement.removeChild(katexElement.firstChild);\n } else {\n katexElement = document.createElementNS(Graph$1.ns, 'foreignObject');\n }\n\n let div = document.createElement('div');\n\n katexElement.appendChild(div);\n this._katexRenderer(katexValue, div);\n\n return katexElement;\n }\n\n return false;\n }\n\n /**\n * Returns a graph created from a schema\n * @param {Object} schema - The schema (see https://github.com/cheminfo/json-chart/blob/master/chart-schema.json)\n * @param {HTMLElement} wrapper - The wrapping element\n * @returns {Graph} Newly created graph\n */\n static fromJSON(schema, wrapper) {\n\n let graph,\n options = {},\n axes = {\n left: [],\n top: [],\n right: [],\n bottom: []\n },\n style;\n\n if (schema.title) {\n options.title = schema.title;\n }\n\n if (schema.axis) {\n\n schema.axis.forEach(function (schemaAxis) {\n\n if (!schemaAxis.type) {\n throwError('Axis type is required (top, bottom, left or right)');\n }\n\n var axisOptions = {};\n if (schemaAxis.label) {\n axisOptions.labelValue = schemaAxis.label;\n }\n\n if (schemaAxis.unit !== undefined) {\n axisOptions.unit = schemaAxis.unit;\n }\n\n if (schemaAxis.unitWrapperAfter !== undefined) {\n axisOptions.unitWrapperAfter = schemaAxis.unitWrapperAfter;\n }\n\n if (schemaAxis.unitWrapperBefore !== undefined) {\n axisOptions.unitWrapperBefore = schemaAxis.unitWrapperBefore;\n }\n\n if (schemaAxis.min !== undefined) {\n axisOptions.forcedMin = schemaAxis.min;\n }\n\n if (schemaAxis.max !== undefined) {\n axisOptions.forcedMax = schemaAxis.max;\n }\n\n if (schemaAxis.flip !== undefined) {\n axisOptions.flipped = schemaAxis.flip;\n }\n\n axes[schemaAxis.type].push(axisOptions);\n schemaAxis._jsGraphIndex = axes[schemaAxis.type].length - 1;\n });\n }\n\n graph = new Graph$1(wrapper, options, axes);\n\n if (schema.width) {\n graph.setWidth(schema.width);\n }\n\n if (schema.height) {\n graph.setHeight(schema.width);\n }\n\n graph._resize();\n\n if (schema.data) {\n\n schema.data.forEach(function (schemaSerie) {\n\n var serieType = schemaSerie.type,\n serie,\n serieOptions = {},\n serieAxis;\n\n let waveform;\n\n switch (schemaSerie.type) {\n\n case 'bar':\n throwError('Bar charts not supported');\n serieType = false;\n break;\n\n case 'color':\n serieType = Graph$1.SERIE_LINE_COLORED;\n break;\n\n case 'scatter':\n serieType = Graph$1.SERIE_SCATTER;\n break;\n\n case 'box':\n serieType = Graph$1.SERIE_BOX;\n\n if (schemaSerie.orientation == 'x' || schemaSerie.orientation == 'y') {\n serieOptions.orientation = schemaSerie.orientation;\n }\n break;\n\n default:\n serieType = Graph$1.SERIE_LINE;\n break;\n }\n\n if (serieType !== Graph$1.SERIE_BOX) {\n waveform = Graph$1.newWaveform();\n }\n\n if (!serieType) {\n throwError('No valid serie type was found');\n return;\n }\n\n serie = graph.newSerie(schemaSerie.id || schemaSerie.label || guid(), serieOptions, serieType);\n\n if (schemaSerie.lineStyle) {\n\n let lineStyle;\n\n if (Array.isArray(lineStyle)) {\n lineStyle = {\n unselected: lineStyle\n };\n }\n\n Object.entries(lineStyle).forEach(([styleName, style]) => {\n\n var styleSerie = {};\n\n switch (serieType) {\n\n case Graph$1.SERIE_LINE:\n if (style.lineWidth !== undefined) {\n styleSerie.lineWidth = style.lineWidth;\n }\n\n if (style.color !== undefined) {\n styleSerie.lineColor = style.color;\n }\n\n if (style.lineStyle) {\n styleSerie.lineStyle = style.lineStyle;\n }\n\n serie.setStyle(styleSerie, styleName);\n break;\n }\n });\n }\n\n let defaultStyle = {};\n let defaultStyles = {};\n\n if (schemaSerie.defaultStyle) {\n defaultStyle = schemaSerie.defaultStyle;\n }\n\n if (schemaSerie.defaultStyles) {\n defaultStyles = schemaSerie.defaultStyles;\n }\n\n if (schemaSerie.styles) {\n\n let individualStyles;\n\n if (Array.isArray(schemaSerie.styles)) {\n individualStyles = {\n unselected: schemaSerie.styles\n };\n } else {\n individualStyles = schemaSerie.styles;\n }\n\n let styleNames = new Set(Object.keys(defaultStyles).concat(Object.keys(individualStyles)));\n\n styleNames.forEach(styleName => {\n\n let style = [],\n styles;\n\n if (individualStyles && individualStyles[styleName]) {\n\n style = individualStyles[styleName];\n\n if (!Array.isArray(style)) {\n style = [style];\n }\n\n styles = style.map(function (eachStyleElement) {\n\n switch (serieType) {\n\n case Graph$1.SERIE_LINE:\n\n return {\n type: eachStyleElement.shape,\n zoom: eachStyleElement.zoom,\n strokeWidth: eachStyleElement.lineWidth,\n strokeColor: eachStyleElement.lineColor,\n fillColor: eachStyleElement.color,\n points: eachStyleElement.points\n };\n\n break;\n\n case Graph$1.SERIE_BOX:\n\n return eachStyleElement;\n\n break;\n\n case Graph$1.SERIE_SCATTER:\n return eachStyleElement;\n\n break;\n }\n });\n }\n\n switch (serieType) {\n\n case Graph$1.SERIE_LINE:\n\n serie.setMarkers(styles, styleName);\n break;\n\n case Graph$1.SERIE_SCATTER:\n serie.setStyle(Object.assign({}, defaultScatterStyle, defaultStyle, defaultStyles[styleName] || {}), styles, styleName);\n break;\n\n case Graph$1.SERIE_BOX:\n\n serie.setStyle(styles[0], styleName || 'unselected');\n break;\n }\n });\n }\n\n if (schemaSerie.color && serieType == Graph$1.SERIE_LINE_COLORED) {\n serie.setColors(schemaSerie.color);\n }\n\n if (serieType !== Graph$1.SERIE_BOX) {\n waveform.setData(schemaSerie.y, schemaSerie.x);\n }\n\n if (!serie) {\n return;\n }\n\n let errorBarsXAbove = [],\n errorBarsXBelow = [],\n errorBarsYAbove = [],\n errorBarsYBelow = [],\n errorBoxesXAbove = [],\n errorBoxesXBelow = [],\n errorBoxesYAbove = [],\n errorBoxesYBelow = [];\n\n if (waveform !== undefined) {\n if (schemaSerie.errorX) {\n\n for (var i = 0, l = schemaSerie.errorX.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorX[i])) {\n\n errorBarsXAbove.push(schemaSerie.errorX[i][0]);\n errorBarsXBelow.push(schemaSerie.errorX[i][1]);\n } else {\n errorBarsXAbove.push(schemaSerie.errorX[i]);\n errorBarsXBelow.push(schemaSerie.errorX[i]);\n }\n }\n } else if (schemaSerie.errorBarX || schemaSerie.errorBoxX) {\n\n if (schemaSerie.errorBarX) {\n\n for (var i = 0, l = schemaSerie.errorBarX.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBarX[i])) {\n\n errorBarsXAbove.push(schemaSerie.errorBarX[i][0]);\n errorBarsXBelow.push(schemaSerie.errorBarX[i][1]);\n } else {\n errorBarsXAbove.push(schemaSerie.errorBarX[i]);\n errorBarsXBelow.push(schemaSerie.errorBarX[i]);\n }\n }\n }\n\n if (schemaSerie.errorBoxX) {\n\n for (var i = 0, l = schemaSerie.errorBoxX.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBoxX[i])) {\n\n errorBoxesXAbove.push(schemaSerie.errorBoxX[i][0]);\n errorBoxesXBelow.push(schemaSerie.errorBoxX[i][1]);\n } else {\n errorBoxesXAbove.push(schemaSerie.errorBoxX[i]);\n errorBoxesXBelow.push(schemaSerie.errorBoxX[i]);\n }\n }\n }\n }\n\n if (schemaSerie.errorY) {\n\n for (var i = 0, l = schemaSerie.errorY.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorY[i])) {\n\n errorBarsYAbove.push(schemaSerie.errorY[i][0]);\n errorBarsYBelow.push(schemaSerie.errorY[i][1]);\n } else {\n errorBarsYAbove.push(schemaSerie.errorY[i]);\n errorBarsYBelow.push(schemaSerie.errorY[i]);\n }\n }\n } else if (schemaSerie.errorBarY || schemaSerie.errorBoxY) {\n\n if (schemaSerie.errorBarY) {\n\n for (var i = 0, l = schemaSerie.errorBarY.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBarY[i])) {\n\n errorBarsYAbove.push(schemaSerie.errorBarY[i][0]);\n errorBarsYBelow.push(schemaSerie.errorBarY[i][1]);\n } else {\n errorBarsYAbove.push(schemaSerie.errorBarY[i]);\n errorBarsYBelow.push(schemaSerie.errorBarY[i]);\n }\n }\n }\n\n if (schemaSerie.errorBoxY) {\n\n for (var i = 0, l = schemaSerie.errorBoxY.length; i < l; i++) {\n\n if (Array.isArray(schemaSerie.errorBoxY[i])) {\n\n errorBoxesYAbove.push(schemaSerie.errorBoxY[i][0]);\n errorBoxesYBelow.push(schemaSerie.errorBoxY[i][1]);\n } else {\n errorBoxesYAbove.push(schemaSerie.errorBoxY[i]);\n errorBoxesYBelow.push(schemaSerie.errorBoxY[i]);\n }\n }\n }\n }\n\n style = {};\n if (errorBarsXAbove.length > 0) {\n waveform.setErrorBarXAbove(Graph$1.newWaveform(errorBarsXAbove));\n style.right = {};\n }\n if (errorBarsXBelow.length > 0) {\n waveform.setErrorBarXAbove(Graph$1.newWaveform(errorBarsXAbove));\n style.left = {};\n }\n if (errorBarsYAbove.length > 0) {\n waveform.setErrorBarXAbove(Graph$1.newWaveform(errorBarsYAbove));\n style.top = {};\n }\n if (errorBarsYBelow.length > 0) {\n waveform.setErrorBarXAbove(Graph$1.newWaveform(errorBarsYAbove));\n style.bottom = {};\n }\n\n serie.setErrorBarStyle(style);\n\n style = {};\n if (errorBoxesXAbove.length > 0) {\n waveform.setErrorBoxXAbove(Graph$1.newWaveform(errorBoxesXAbove));\n style.right = {};\n }\n if (errorBoxesXBelow.length > 0) {\n waveform.setErrorBoxXBelow(Graph$1.newWaveform(errorBoxesXBelow));\n style.left = {};\n }\n if (errorBoxesYAbove.length > 0) {\n waveform.setErrorBoxAbove(Graph$1.newWaveform(errorBoxesYAbove));\n style.top = {};\n }\n if (errorBoxesYBelow.length > 0) {\n waveform.setErrorBoxBelow(Graph$1.newWaveform(errorBoxesYBelow));\n style.bottom = {};\n }\n serie.setErrorBoxStyle(style);\n }\n\n if (schema.axis) {\n serieAxis = schema.axis[schemaSerie.xAxis];\n\n if (!serieAxis || serieAxis.type !== 'top' && serieAxis.type !== 'bottom') {\n warn('No x axis found. Setting automatically');\n serie.setXAxis(graph.getXAxis(0));\n } else {\n if (serieAxis.type == 'top') {\n serie.setXAxis(graph.getTopAxis(serieAxis._jsGraphIndex));\n } else if (serieAxis.type == 'bottom') {\n serie.setXAxis(graph.getBottomAxis(serieAxis._jsGraphIndex));\n }\n }\n\n serieAxis = schema.axis[schemaSerie.yAxis];\n\n if (!serieAxis || serieAxis.type !== 'left' && serieAxis.type !== 'right') {\n warn('No y axis found. Setting automatically');\n serie.setYAxis(graph.getYAxis(0));\n } else {\n if (serieAxis.type == 'left') {\n serie.setYAxis(graph.getLeftAxis(serieAxis._jsGraphIndex));\n } else if (serieAxis.type == 'right') {\n serie.setYAxis(graph.getRightAxis(serieAxis._jsGraphIndex));\n }\n }\n } else {\n warn('No axes found. Setting automatically');\n serie.autoAxis();\n }\n\n switch (serieType) {\n\n case Graph$1.SERIE_BOX:\n\n serie.setData(schemaSerie.boxes);\n\n break;\n\n default:\n case Graph$1.SERIE_SCATTER:\n case Graph$1.SERIE_LINE_COLORED:\n case Graph$1.SERIE_LINE:\n\n serie.setWaveform(waveform);\n\n break;\n }\n });\n }\n\n graph.autoscaleAxes();\n graph.draw();\n\n return graph;\n }\n\n exportToSchema() {\n\n let schema = {};\n\n schema.title = this.options.title;\n\n schema.width = this.getWidth();\n schema.height = this.getHeight();\n\n let axesPositions = ['top', 'bottom', 'left', 'right'];\n let axesExport = [];\n let allaxes = {\n x: [],\n y: []\n };\n\n axesPositions.map(axisPosition => {\n\n if (!this.axis[axisPosition]) {\n return;\n }\n\n axesExport = axesExport.concat(this.axis[axisPosition].map(axis => {\n return {\n\n type: axisPosition,\n label: axis.options.label,\n unit: axis.options.unit,\n min: axis.options.forcedMin,\n max: axis.options.forcedMax,\n flip: axis.options.flipped\n\n };\n }));\n\n if (axisPosition == 'top' || axisPosition == 'bottom') {\n allaxes.x = allaxes.x.concat(this.axis[axisPosition]);\n } else {\n allaxes.y = allaxes.y.concat(this.axis[axisPosition]);\n }\n });\n\n schema.axis = axesExport;\n\n let seriesExport = [];\n\n let toType = type => {\n switch (type) {\n\n case Graph$1.SERIE_LINE:\n return 'line';\n break;\n\n case Graph$1.SERIE_BAR:\n return 'bar';\n break;\n\n case Graph$1.SERIE_LINE_COLORED:\n return 'color';\n break;\n\n case Graph$1.SERIE_SCATTER:\n return 'scatter';\n break;\n }\n };\n\n let exportData = (serie, x) => {\n\n let data = [];\n\n switch (serie.getType()) {\n\n case Graph$1.SERIE_LINE:\n\n for (var i = 0; i < serie.data.length; i++) {\n\n for (var j = 0; j < serie.data[i].length - 1; j += 2) {\n\n data.push(serie.data[i][j + (x && serie.isFlipped() || !x && !serie.isFlipped() ? 1 : 0)]);\n }\n }\n break;\n\n case Graph$1.SERIE_SCATTER:\n\n for (var j = 0; j < serie.data.length - 1; j += 2) {\n\n data.push(serie.data[i + (x && serie.isFlipped() || !x && !serie.isFlipped() ? 1 : 0)]);\n }\n\n break;\n }\n\n return data;\n };\n\n schema.data = seriesExport.concat(this.series.map(serie => {\n\n let style = [];\n let linestyle = [];\n\n if (serie.getType() == Graph$1.SERIE_LINE) {\n\n for (var stylename in serie.styles) {\n linestyle.push({\n styleName: stylename,\n color: serie.styles[stylename].lineColor,\n lineWidth: serie.styles[stylename].lineWidth,\n lineStyle: serie.styles[stylename].lineStyle\n });\n\n let styleObj = {\n styleName: stylename,\n styles: []\n };\n style.push(styleObj);\n\n styleObj.styles = styleObj.styles.concat((serie.styles[stylename].markers || []).map(markers => {\n return {\n shape: markers.type,\n zoom: markers.zoom,\n lineWidth: markers.strokeWidth,\n lineColor: markers.strokeColor,\n color: markers.fillColor,\n points: markers.points\n };\n }));\n }\n }\n\n return {\n label: serie.getLabel(),\n id: serie.getName(),\n type: toType(serie.getType()),\n x: exportData(serie, true),\n y: exportData(serie, false),\n xAxis: allaxes.x.indexOf(serie.getXAxis()),\n yAxis: allaxes.y.indexOf(serie.getYAxis()),\n style: style,\n lineStyle: linestyle\n };\n }));\n\n return schema;\n }\n\n /**\n * Registers a constructor to jsGraph. Constructors are used on a later basis by jsGraph to create series, shapes or plugins\n * @param {String} constructorName - The name of the constructor\n * @param {Function} constructor - The constructor method\n * @see Graph.getConstructor\n * @static\n */\n static registerConstructor(constructorName, constructor) {\n\n if (_constructors.has(constructorName)) {\n return throwError('Constructor ' + constructor + ' already exists.');\n }\n\n _constructors.set(constructorName, constructor);\n }\n\n /**\n * Returns a registered constructor\n * @param {String} constructorName - The constructor name to look for\n * @param {Boolean} [softFail = false ] - Fails silently if the constructor doesn't exist, and returns false\n * @returns {Function} The registered constructor\n * @throws Error\n * @see Graph.registerConstructor\n * @static\n */\n static getConstructor(constructorName, softFail = false) {\n\n if (!_constructors.has(constructorName)) {\n\n if (softFail) {\n return false;\n }\n\n return throwError('Constructor \"' + constructorName + \"\\\" doesn't exist\");\n }\n\n return _constructors.get(constructorName);\n }\n\n static newWaveform() {\n return new Waveform(...arguments);\n }\n\n static waveform() {\n return new Waveform(...arguments);\n }\n}\n\n// Adds getConstructor to the prototype. Cannot do that in ES6 classes\nGraph$1.prototype.getConstructor = Graph$1.getConstructor;\n\nfunction makeSerie(graph, name, options, type) {\n\n var constructor = graph.getConstructor(type, true);\n if (!constructor && typeof type == 'string') {\n constructor = graph.getConstructor('graph.serie.' + type, true);\n }\n\n if (constructor) {\n\n var serie = new constructor(graph, name, options);\n //serie.init( graph, name, options );\n graph.appendSerieToDom(serie);\n } else {\n\n return throwError('No constructor exists for the serie type provided. Use Graph.registerConstructor( name, constructor ) first is you use your own series');\n }\n\n return serie;\n}\n\nfunction getAxisLevelFromSpan(span, level) {\n\n for (var i = 0, l = level.length; i < l; i++) {\n\n var possible = true;\n for (var k = 0, m = level[i].length; k < m; k++) {\n\n if (!(span[0] < level[i][k][0] && span[1] < level[i][k][0] || span[0] > level[i][k][1] && span[1] > level[i][k][1])) {\n possible = false;\n }\n }\n\n if (possible) {\n\n level[i].push(span);\n return i;\n }\n }\n\n level.push([span]);\n return level.length - 1;\n}\n\nfunction refreshDrawingZone(graph) {\n\n var shift = {\n top: [],\n bottom: [],\n left: [],\n right: []\n };\n\n var levels = {\n top: [],\n bottom: [],\n left: [],\n right: []\n };\n\n graph._painted = true;\n // Apply to top and bottom\n\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n axis.hideGroup();\n return;\n } else {\n axis.showGroup();\n }\n\n if (axis.floating) {\n return;\n }\n\n var level = getAxisLevelFromSpan(axis.getSpan(), levels[position]);\n axis.setLevel(level);\n\n shift[position][level] = Math.max(axis.getAxisPosition(), shift[position][level] || 0);\n }, false, true, false);\n\n var shiftTop = shift.top.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n var shiftBottom = shift.bottom.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n graph.drawingSpaceHeight = graph.getDrawingHeight() - shiftTop - shiftBottom;\n\n [shift.top, shift.bottom].map(function (arr) {\n arr.reduce(function (prev, current, index) {\n arr[index] = prev + current;\n return prev + current;\n }, 0);\n });\n\n // Apply to top and bottom\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown() || axis.floating) {\n return;\n }\n\n axis.setShift(shift[position][axis.getLevel()]);\n }, false, true, false);\n\n // Applied to left and right\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n axis.hideGroup();\n // Don't return here. We need to go through the draw method as the axis must be assigned minPx and maxPx values.\n // This is because some series can still be visible although the axis isn't.\n } else {\n axis.showGroup();\n }\n\n axis.setMinPx(shiftTop);\n axis.setMaxPx(graph.getDrawingHeight(true) - shiftBottom);\n\n if (axis.floating) {\n return;\n }\n\n // First we need to draw it in order to determine the width to allocate\n // graph is done to accomodate 0 and 100000 without overlapping any element in the DOM (label, ...)\n\n // Let's not draw dependant axes yet\n let drawn = !axis.linkedToAxis ? axis.draw() : 0;\n\n if (!axis.isShown()) {\n return;\n }\n // Get axis position gives the extra shift that is common\n var level = getAxisLevelFromSpan(axis.getSpan(), levels[position]);\n axis.setLevel(level);\n shift[position][level] = Math.max(drawn, shift[position][level] || 0);\n }, false, false, true);\n\n var shift2 = extend$1(true, {}, shift);\n\n // Applied to left and right\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown() || axis.floating) {\n return;\n }\n\n shift2[position][axis.getLevel()] = Math.max(shift[position][axis.getLevel()], axis.equalizePosition(shift[position][axis.getLevel()]));\n }, false, false, true);\n\n shift = shift2;\n\n var shiftLeft = shift.left.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n var shiftRight = shift.right.reduce(function (prev, curr) {\n return prev + curr;\n }, 0);\n\n graph.drawingSpaceWidth = graph.getDrawingWidth() - shiftLeft - shiftRight;\n\n [shift.left, shift.right].map(function (arr) {\n arr.reduce(function (prev, current, index) {\n arr[index] = prev + current;\n return prev + current;\n }, 0);\n });\n\n // Apply to left and right\n graph._applyToAxes((axis, position) => {\n\n if (!axis.isShown() || axis.floating) {\n return;\n }\n axis.setShift(shift[position][axis.getLevel()]);\n }, false, false, true);\n\n // Apply to top and bottom\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n // return;\n }\n\n axis.setMinPx(shiftLeft);\n axis.setMaxPx(graph.getDrawingWidth(true) - shiftRight);\n\n if (axis.floating) {\n return;\n }\n\n if (!axis.linkedToAxis) {\n axis.draw();\n }\n }, false, true, false);\n\n // Floating axes\n graph._applyToAxes(function (axis) {\n\n if (!axis.floating) {\n return;\n }\n\n var floatingAxis = axis.getFloatingAxis();\n var floatingValue = axis.getFloatingValue();\n var floatingPx = floatingAxis.getPx(floatingValue);\n\n axis.setShift(floatingPx);\n\n if (!axis.linkedToAxis) {\n axis.draw();\n }\n }, false, true, true);\n\n _closeLine(graph, 'right', graph.getDrawingWidth(true), graph.getDrawingWidth(true), shiftTop, graph.getDrawingHeight(true) - shiftBottom);\n _closeLine(graph, 'left', 0, 0, shiftTop, graph.getDrawingHeight(true) - shiftBottom);\n _closeLine(graph, 'top', shiftLeft, graph.getDrawingWidth(true) - shiftRight, 0, 0);\n _closeLine(graph, 'bottom', shiftLeft, graph.getDrawingWidth(true) - shiftRight, graph.getDrawingHeight(true) - shiftBottom, graph.getDrawingHeight(true) - shiftBottom);\n\n graph.clipRect.setAttribute('y', shiftTop);\n graph.clipRect.setAttribute('x', shiftLeft);\n graph.clipRect.setAttribute('width', graph.getDrawingWidth() - shiftLeft - shiftRight);\n graph.clipRect.setAttribute('height', graph.getDrawingHeight() - shiftTop - shiftBottom);\n\n graph.rectEvent.setAttribute('y', shiftTop + graph.getPaddingTop());\n graph.rectEvent.setAttribute('x', shiftLeft + graph.getPaddingLeft());\n\n graph.rectEvent.setAttribute('width', graph.drawingSpaceWidth);\n graph.rectEvent.setAttribute('height', graph.drawingSpaceHeight);\n\n graph.drawingSpaceMinX = shiftLeft + graph.getPaddingLeft(); // + \"px\";\n graph.drawingSpaceMinY = shiftTop + graph.getPaddingTop(); // + \"px\";\n graph.drawingSpaceMaxX = graph.getDrawingWidth() - shiftRight + graph.getPaddingLeft(); // + \"px\";\n graph.drawingSpaceMaxY = graph.getDrawingHeight() - shiftBottom + graph.getPaddingTop(); // + \"px\";\n\n // Apply to top and bottom\n graph._applyToAxes(function (axis, position) {\n\n if (!axis.isShown()) {\n return;\n }\n\n axis.drawLines();\n }, false, true, true);\n\n /*\n graph.shapeZoneRect.setAttribute('x', shift[1]);\n graph.shapeZoneRect.setAttribute('y', shift[2]);\n graph.shapeZoneRect.setAttribute('width', graph.getDrawingWidth() - shift[2] - shift[3]);\n graph.shapeZoneRect.setAttribute('height', graph.getDrawingHeight() - shift[1] - shift[0]);\n */\n graph.shift = shift;\n graph.redrawShapes(); // Not sure this should be automatic here. The user should be clever.\n}\n\nfunction _handleKey(graph, event, type) {\n\n console.log(event, type);\n if (graph.forcedPlugin) {\n\n graph.activePlugin = graph.forcedPlugin;\n graph._pluginExecute(graph.activePlugin, type, [graph, event]);\n return;\n }\n\n checkKeyActions(graph, event, [graph, event], type);\n}\n\n// Similar to checkMouseActions\nfunction checkKeyActions(graph, e, parameters, methodName) {\n\n var keyComb = graph.options.keyActions,\n i,\n l;\n\n for (i = 0, l = keyComb.length; i < l; i++) {\n\n if (keyComb[i].plugin) {\n // Is it a plugin ?\n\n if (graph.forcedPlugin == keyComb[i].plugin || graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n graph.activePlugin = keyComb[i].plugin; // Lease the mouse action to the current action\n graph._pluginExecute(keyComb[i].plugin, methodName, parameters);\n\n e.preventDefault();\n e.stopPropagation();\n\n return true;\n }\n } else if (keyComb[i].callback && graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n keyComb[i].callback.apply(graph, parameters);\n return true;\n }\n\n if (keyComb[i].removeSelectedShape && graph.isActionAllowed(e, keyComb[i])) {\n\n e.preventDefault();\n e.stopPropagation();\n\n graph.selectedShapes.map(shape => {\n\n shape.kill(keyComb[i].keepInDom);\n });\n }\n\n /* else if ( keyComb[ i ].series ) {\n var series;\n if ( keyComb[ i ].series === 'all' ) {\n series = graph.series;\n }\n if ( !Array.isArray( keyComb[ i ].series ) ) {\n series = [ series ];\n }\n if ( keyComb[ i ].options ) {\n parameters.push( keyComb[ i ].options );\n }\n for ( var j = 0; j < series.length; i++ ) {\n graph._serieExecute( series[ i ], methodName, parameters );\n }\n return true;\n }*/\n }\n\n return false;\n}\n\nfunction doDom() {\n\n // Create SVG element, set the NS\n this.dom = document.createElementNS(Graph$1.ns, 'svg');\n this.dom.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xlink', 'http://www.w3.org/1999/xlink');\n //this.dom.setAttributeNS(this.ns, 'xmlns:xlink', this.nsxml);\n setAttributeTo(this.dom, {\n 'xmlns': Graph$1.ns,\n 'font-family': this.options.fontFamily,\n 'font-size': this.options.fontSize\n });\n\n try {\n setAttributeTo(this.dom, {\n 'data-jsgraph-version': 'v<%= pkg.version %>'\n });\n } catch (e) {\n // ignore\n }\n\n this.defs = document.createElementNS(Graph$1.ns, 'defs');\n this.dom.appendChild(this.defs);\n\n this.groupEvent = document.createElementNS(Graph$1.ns, 'g');\n\n this.rectEvent = document.createElementNS(Graph$1.ns, 'rect');\n setAttributeTo(this.rectEvent, {\n 'pointer-events': 'fill',\n 'fill': 'transparent'\n });\n this.groupEvent.appendChild(this.rectEvent);\n\n this.dom.appendChild(this.groupEvent);\n\n // Handling graph title\n this.domTitle = document.createElementNS(Graph$1.ns, 'text');\n this.setTitle(this.options.title);\n setAttributeTo(this.domTitle, {\n 'text-anchor': 'middle',\n 'y': 20\n });\n this.groupEvent.appendChild(this.domTitle);\n //\n\n this.graphingZone = document.createElementNS(Graph$1.ns, 'g');\n this.updateGraphingZone();\n\n this.groupEvent.appendChild(this.graphingZone);\n\n /* this.shapeZoneRect = document.createElementNS(this.ns, 'rect');\n //this.shapeZoneRect.setAttribute('pointer-events', 'fill');\n this.shapeZoneRect.setAttribute('fill', 'transparent');\n this.shapeZone.appendChild(this.shapeZoneRect);\n */\n this.axisGroup = document.createElementNS(Graph$1.ns, 'g');\n this.graphingZone.appendChild(this.axisGroup);\n\n this.groupGrids = document.createElementNS(Graph$1.ns, 'g');\n\n // With the z stacking, this should probably be removed\n //this.groupGrids.setAttribute( 'clip-path', 'url(#_clipplot' + this._creation + ')' );\n\n this.groupPrimaryGrids = document.createElementNS(Graph$1.ns, 'g');\n this.groupSecondaryGrids = document.createElementNS(Graph$1.ns, 'g');\n\n this.axisGroup.appendChild(this.groupGrids);\n\n this.groupGrids.appendChild(this.groupSecondaryGrids);\n this.groupGrids.appendChild(this.groupPrimaryGrids);\n\n this.plotGroup = document.createElementNS(Graph$1.ns, 'g');\n this.graphingZone.appendChild(this.plotGroup);\n\n // 5 September 2014. I encountered a case here shapeZone must be above plotGroup\n /*this.shapeZone = document.createElementNS( this.ns, 'g' );\n this.graphingZone.appendChild( this.shapeZone );\n */\n\n this.layers = [];\n\n this._makeClosingLines();\n\n this.clip = document.createElementNS(Graph$1.ns, 'clipPath');\n this.clip.setAttribute('id', '_clipplot' + this._creation);\n this.defs.appendChild(this.clip);\n\n this.clipRect = document.createElementNS(Graph$1.ns, 'rect');\n this.clip.appendChild(this.clipRect);\n this.clip.setAttribute('clipPathUnits', 'userSpaceOnUse');\n\n this.markerArrow = document.createElementNS(this.ns, 'marker');\n this.markerArrow.setAttribute('viewBox', '0 0 10 10');\n this.markerArrow.setAttribute('id', 'arrow' + this._creation);\n this.markerArrow.setAttribute('refX', '6');\n this.markerArrow.setAttribute('refY', '5');\n this.markerArrow.setAttribute('markerUnits', 'strokeWidth');\n this.markerArrow.setAttribute('markerWidth', '8');\n this.markerArrow.setAttribute('markerHeight', '6');\n this.markerArrow.setAttribute('orient', 'auto');\n //this.markerArrow.setAttribute('fill', 'context-stroke');\n //this.markerArrow.setAttribute('stroke', 'context-stroke');\n\n var pathArrow = document.createElementNS(Graph$1.ns, 'path');\n pathArrow.setAttribute('d', 'M 0 0 L 10 5 L 0 10 z');\n //pathArrow.setAttribute( 'fill', 'context-stroke' );\n this.markerArrow.appendChild(pathArrow);\n\n this.defs.appendChild(this.markerArrow);\n\n // Horionzal split marker for axis\n this.markerHorizontalSplit = document.createElementNS(Graph$1.ns, 'marker');\n this.markerHorizontalSplit.setAttribute('viewBox', '0 0 6 8');\n this.markerHorizontalSplit.setAttribute('id', 'horionzalsplit_' + this.getId());\n this.markerHorizontalSplit.setAttribute('refX', '3');\n this.markerHorizontalSplit.setAttribute('refY', '4');\n this.markerHorizontalSplit.setAttribute('markerUnits', 'strokeWidth');\n this.markerHorizontalSplit.setAttribute('markerWidth', '6');\n this.markerHorizontalSplit.setAttribute('markerHeight', '8');\n\n var path = document.createElementNS(Graph$1.ns, 'line');\n path.setAttribute('x1', '0');\n path.setAttribute('y1', '8');\n\n path.setAttribute('x2', '6');\n path.setAttribute('y2', '0');\n\n path.setAttribute('stroke', 'black');\n this.markerHorizontalSplit.appendChild(path);\n\n this.defs.appendChild(this.markerHorizontalSplit);\n\n // Vertical split marker for axis\n this.markerVerticalSplit = document.createElementNS(Graph$1.ns, 'marker');\n this.markerVerticalSplit.setAttribute('viewBox', '0 0 8 6');\n this.markerVerticalSplit.setAttribute('id', 'verticalsplit_' + this.getId());\n this.markerVerticalSplit.setAttribute('refX', '4');\n this.markerVerticalSplit.setAttribute('refY', '3');\n this.markerVerticalSplit.setAttribute('markerUnits', 'strokeWidth');\n this.markerVerticalSplit.setAttribute('markerWidth', '8');\n this.markerVerticalSplit.setAttribute('markerHeight', '6');\n\n var path = document.createElementNS(Graph$1.ns, 'line');\n\n path.setAttribute('x1', '0');\n path.setAttribute('y1', '0');\n\n path.setAttribute('x2', '8');\n path.setAttribute('y2', '6');\n\n path.setAttribute('stroke', 'black');\n this.markerVerticalSplit.appendChild(path);\n this.defs.appendChild(this.markerVerticalSplit);\n\n this.vertLineArrow = document.createElementNS(Graph$1.ns, 'marker');\n this.vertLineArrow.setAttribute('viewBox', '0 0 10 10');\n this.vertLineArrow.setAttribute('id', 'verticalline' + this._creation);\n this.vertLineArrow.setAttribute('refX', '0');\n this.vertLineArrow.setAttribute('refY', '5');\n this.vertLineArrow.setAttribute('markerUnits', 'strokeWidth');\n this.vertLineArrow.setAttribute('markerWidth', '20');\n this.vertLineArrow.setAttribute('markerHeight', '10');\n this.vertLineArrow.setAttribute('orient', 'auto');\n //this.vertLineArrow.setAttribute('fill', 'context-stroke');\n //this.vertLineArrow.setAttribute('stroke', 'context-stroke');\n this.vertLineArrow.setAttribute('stroke-width', '1px');\n\n var pathVertLine = document.createElementNS(Graph$1.ns, 'path');\n pathVertLine.setAttribute('d', 'M 0 -10 L 0 10');\n pathVertLine.setAttribute('stroke', 'black');\n\n this.vertLineArrow.appendChild(pathVertLine);\n\n this.defs.appendChild(this.vertLineArrow);\n\n // Removed with z stacking ?\n // this.plotGroup.setAttribute( 'clip-path', 'url(#_clipplot' + this._creation + ')' );\n\n this.bypassHandleMouse = false;\n}\n\nfunction _registerEvents(graph) {\n if (!graph.wrapper) {\n throw 'No wrapper exists. Cannot register the events.';\n }\n\n graph.dom.setAttribute('tabindex', 0);\n\n graph.dom.addEventListener('keydown', e => {\n _handleKey(graph, e, 'keydown');\n });\n\n graph.dom.addEventListener('keypress', e => {\n _handleKey(graph, e, 'keypress');\n });\n\n graph.dom.addEventListener('keyup', e => {\n _handleKey(graph, e, 'keyup');\n });\n // Not sure this has to be prevented\n\n // August 17th, 2017: I extended the graph.groupEvent to the more general graph.dom to make the zoom plugin more\n // intuitive. Let us see if it breaks another example...\n graph.dom.addEventListener('mousemove', e => {\n //e.preventDefault();\n var coords = graph._getXY(e);\n _handleMouseMove(graph, coords.x, coords.y, e);\n });\n\n graph.dom.addEventListener('mouseleave', e => {\n\n _handleMouseLeave(graph);\n });\n\n graph.groupEvent.addEventListener('mousedown', e => {\n\n graph.focus();\n\n // e.preventDefault();\n if (e.which == 3 || e.ctrlKey) {\n return;\n }\n\n var coords = graph._getXY(e);\n _handleMouseDown(graph, coords.x, coords.y, e);\n });\n\n graph.dom.addEventListener('mouseup', e => {\n\n graph.emit('mouseUp', e);\n var coords = graph._getXY(e);\n\n _handleMouseUp(graph, coords.x, coords.y, e);\n });\n\n graph.wrapper.addEventListener('mouseup', e => {\n e.stopPropagation();\n });\n\n graph.dom.addEventListener('dblclick', e => {\n\n graph.emit('dblClick', e);\n var coords = graph._getXY(e);\n\n _handleDblClick(graph, coords.x, coords.y, e);\n });\n\n graph.groupEvent.addEventListener('click', e => {\n\n // Cancel right click or Command+Click\n if (e.which == 3 || e.ctrlKey) {\n return;\n }\n\n // e.preventDefault();\n var coords = graph._getXY(e);\n\n if (!graph.prevent(false)) {\n _handleClick(graph, coords.x, coords.y, e);\n }\n\n //}, 200 );\n });\n\n graph.groupEvent.addEventListener('mousewheel', e => {\n\n var deltaY = e.wheelDeltaY || e.wheelDelta || -e.deltaY;\n var coords = graph._getXY(e);\n _handleMouseWheel(graph, deltaY, coords.x, coords.y, e);\n\n return false;\n });\n\n graph.groupEvent.addEventListener('wheel', e => {\n\n var coords = graph._getXY(e);\n var deltaY = e.wheelDeltaY || e.wheelDelta || -e.deltaY;\n _handleMouseWheel(graph, deltaY, coords.x, coords.y, e);\n\n return false;\n });\n}\n\nfunction _handleMouseDown(graph, x, y, e) {\n\n if (graph.forcedPlugin) {\n\n graph.activePlugin = graph.forcedPlugin;\n graph._pluginExecute(graph.activePlugin, 'onMouseDown', [graph, x, y, e]);\n return;\n }\n\n if (graph.activePlugin) {\n graph.activePlugin = false;\n }\n\n checkMouseActions(graph, e, [graph, x, y, e], 'onMouseDown');\n}\n\nfunction _handleMouseMove(graph, x, y, e) {\n\n if (graph.bypassHandleMouse) {\n graph.bypassHandleMouse.handleMouseMove(e);\n return;\n }\n\n if (graph.activePlugin && graph._pluginExecute(graph.activePlugin, 'onMouseMove', [graph, x, y, e])) {\n return;\n }\n\n //\t\t\treturn;\n\n graph._applyToAxes('handleMouseMove', [x - graph.options.paddingLeft, e], true, false);\n graph._applyToAxes('handleMouseMove', [y - graph.options.paddingTop, e], false, true);\n\n if (!graph.activePlugin) {\n var index;\n\n // Takes care of the tracking line\n if (graph.options.trackingLine && graph.options.trackingLine.enable && graph.options.trackingLine.snapToSerie) {\n\n if (graph.options.trackingLine.mode == 'common') {\n\n var snapToSerie = graph.options.trackingLine.snapToSerie;\n index = snapToSerie.handleMouseMove(false, true);\n\n if (this.trackingObject) {\n\n if (!index) {\n\n graph.trackingObject.hide();\n } else {\n\n graph.trackingObject.show();\n\n graph.trackingObject.getPosition(0).x = index.xClosest;\n graph.trackingObject.getPosition(1).x = index.xClosest;\n graph.trackingObject.redraw();\n\n var x = snapToSerie.getXAxis().getPx(index.xClosest) + graph.options.paddingLeft;\n }\n }\n\n var series = graph.options.trackingLine.series;\n\n // Gets a default value\n if (!series) {\n\n series = graph.getSeries().map(function (serie) {\n return {\n serie: serie,\n withinPx: 20,\n withinVal: -1\n };\n });\n }\n\n graph._trackingLegend = _trackingLegendSerie(graph, series, x, y, graph._trackingLegend, graph.options.trackingLine.textMethod, index.xClosest);\n }\n }\n }\n // End takes care of the tracking line\n\n if (graph.options.onMouseMoveData) {\n var results = {};\n\n for (var i = 0; i < graph.series.length; i++) {\n\n results[graph.series[i].getName()] = graph.series[i].handleMouseMove(false, true);\n }\n\n graph.options.onMouseMoveData.call(graph, e, results);\n }\n\n checkMouseActions(graph, e, [graph, x, y, e], 'onMouseMove');\n}\n\nfunction checkMouseActions(graph, e, parameters, methodName) {\n\n var keyComb = graph.options.mouseActions,\n i,\n l,\n executed = false;\n\n for (i = 0, l = keyComb.length; i < l; i++) {\n\n if (keyComb[i].plugin) {\n // Is it a plugin ?\n\n if (graph.forcedPlugin == keyComb[i].plugin || graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n // Lease the mouse action to the current action\n // 25.10.2017: Except for mousewheel. See #111\n if (e.type !== 'wheel' && e.type !== 'mousewheel') {\n graph.activePlugin = keyComb[i].plugin;\n }\n\n graph._pluginExecute(keyComb[i].plugin, methodName, parameters);\n executed = true;\n continue;\n }\n } else if (keyComb[i].callback && graph.isActionAllowed(e, keyComb[i])) {\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n keyComb[i].callback.apply(graph, parameters);\n executed = true;\n continue;\n } else if (keyComb[i].series) {\n\n var series;\n if (keyComb[i].series === 'all') {\n series = graph.series;\n }\n\n if (!Array.isArray(keyComb[i].series)) {\n series = [series];\n }\n\n if (keyComb[i].options) {\n parameters.push(keyComb[i].options);\n }\n\n for (var j = 0; j < series.length; i++) {\n graph._serieExecute(series[i], methodName, parameters);\n }\n executed = true;\n continue;\n }\n }\n\n return executed;\n}\n\nvar _trackingLegendSerie = function (graph, serie, x, y, legend, textMethod, xValue) {\n\n var justCreated = false;\n\n if (!Array.isArray(serie)) {\n serie = [serie];\n }\n\n var output = [];\n\n if (!legend && graph.options.trackingLine.legend) {\n justCreated = true;\n legend = _makeTrackingLegend(graph);\n }\n\n serie.map(serie => {\n\n var index = serie.serie.handleMouseMove(xValue, false);\n\n if (!index || !textMethod) {\n\n if (serie.serie.trackingShape) {\n serie.serie.trackingShape.hide();\n }\n\n return legend;\n }\n\n // Should we display the dot ?\n if (serie.withinPx > 0 && Math.abs(x - graph.options.paddingLeft - serie.serie.getXAxis().getPx(index.xClosest)) - serie.withinPx > 1e-14 || serie.withinVal > 0 && Math.abs(serie.serie.getXAxis().getVal(x - graph.options.paddingLeft) - index.xClosest) - serie.withinVal > serie.serie.getXAxis().getVal(x - graph.options.paddingLeft) / 100000) {\n\n if (serie.serie.trackingShape) {\n serie.serie.trackingShape.hide();\n }\n } else {\n\n output[serie.serie.getName()] = {\n\n yValue: index.xClosest,\n xValue: index.yClosest,\n serie: serie,\n index: index\n\n };\n\n let serieShape;\n if (graph.options.trackingLine && graph.options.trackingLine.serieShape) {\n serieShape = graph.options.trackingLine.serieShape;\n } else {\n serieShape = {\n shape: 'ellipse',\n properties: {\n rx: [serie.serie.getLineWidth() * 3 + 'px'],\n ry: [serie.serie.getLineWidth() * 3 + 'px']\n }\n };\n }\n\n if (!serie.serie.trackingShape) {\n\n serie.serie.trackingShape = graph.newShape(serieShape.shape, {\n fillColor: serie.serie.getLineColor(),\n strokeColor: 'White',\n strokeWidth: serie.serie.getLineWidth()\n }, true, serieShape.properties).setSerie(serie.serie).forceParentDom(serie.serie.groupMain).draw();\n\n serieShape.onCreated && serieShape.onCreated(serie.serie.trackingShape);\n\n serie.serie.trackingShape.on('changed', () => {\n\n serieShape.onChanged && serieShape.onChanged(serie.serie.trackingShape);\n });\n }\n\n serie.serie.trackingShape.show();\n serie.serie.trackingShape.getPosition(0).x = index.xClosest;\n\n if (serieShape.magnet) {\n\n let magnetOptions = serieShape.magnet,\n val = magnetOptions.within,\n minmaxpos;\n\n if (magnetOptions.withinPx) {\n val = serie.serie.getXAxis().getRelVal(magnetOptions.withinPx);\n }\n\n if (minmaxpos = serie.serie.findLocalMinMax(index.xClosest, val, magnetOptions.mode)) {\n\n serie.serie.trackingShape.getPosition(0).x = minmaxpos;\n }\n }\n\n serie.serie.trackingShape.redraw();\n }\n }); // End map\n\n if (!graph.options.trackingLine.legend) {\n return;\n }\n\n if (Object.keys(output).length == 0 || !textMethod) {\n legend.style.display = 'none';\n } else {\n\n if (legend.style.display == 'none' || justCreated) {\n\n forceTrackingLegendMode(graph, legend, x, y, true);\n } else {\n _trackingLegendMove(graph, legend, x, y);\n }\n\n legend.style.display = 'block';\n var txt = textMethod(output, xValue, x, y);\n\n legend.innerHTML = txt;\n\n //legend.innerHTML = textMethod( output, xValue, x, y );\n }\n\n return legend;\n};\n\nvar forceTrackingLegendMode = function (graph, legend, toX, toY, skip) {\n\n var ratio = 0,\n start = Date.now(),\n h = legend.offsetHeight,\n startX = parseInt(legend.style.marginLeft.replace('px', '') || 0),\n startY = parseInt(legend.style.marginTop.replace('px', '') || 0);\n\n toX = toX > graph.getWidth() / 2 ? toX - toX % 10 - 20 - legend.offsetWidth : toX - toX % 10 + 30;\n toY = toY - toY % 10 + h / 2;\n\n if (skip) {\n legend.style.marginLeft = toX + 'px';\n legend.style.marginTop = toY + 'px';\n return;\n }\n\n function next() {\n\n var progress = (Date.now() - start) / 200;\n if (progress > 1) {\n progress = 1;\n }\n\n legend.style.marginLeft = (toX - startX) * progress + startX + 'px';\n legend.style.marginTop = (toY - startY) * progress + startY + 'px';\n\n if (progress < 1) {\n window.requestAnimationFrame(next);\n }\n }\n\n window.requestAnimationFrame(next);\n};\n\nvar _trackingLegendMove = debounce(forceTrackingLegendMode, 50);\n\nfunction _makeTrackingLegend(graph) {\n\n var group = document.createElement('div');\n group.setAttribute('class', 'trackingLegend');\n group.style.position = 'absolute';\n group.style.borderRadius = '4px';\n group.style.boxShadow = '1px 1px 3px 0px rgba(100,100,100,0.6)';\n group.style.border = '2px solid #333333';\n group.style.backgroundColor = 'rgba(255, 255, 255, 0.5 )';\n group.style.pointerEvents = 'none';\n group.style.paddingTop = '5px';\n group.style.paddingBottom = '5px';\n group.style.paddingLeft = '10px';\n group.style.paddingRight = '10px';\n\n graph.getWrapper().insertBefore(group, graph.getDom());\n\n return group;\n}\n\nfunction _handleDblClick(graph, x, y, e) {\n //\tvar _x = x - graph.options.paddingLeft;\n //\tvar _y = y - graph.options.paddingTop;\n var pref = graph.options.dblclick;\n checkMouseActions(graph, e, [x, y, e], 'onDblClick');\n /*\n if ( !pref || !pref.type ) {\n return;\n }\n switch ( pref.type ) {\n case 'plugin':\n var plugin;\n if ( ( plugin = graph.plugins[ pref.plugin ] ) ) {\n plugin.onDblClick( graph, x, y, pref.options, e );\n }\n break;\n }*/\n}\n\nfunction _handleMouseUp(graph, x, y, e) {\n\n if (graph.bypassHandleMouse) {\n graph.bypassHandleMouse.handleMouseUp(e);\n graph.activePlugin = false;\n return;\n }\n\n graph._pluginExecute(graph.activePlugin, 'onMouseUp', [graph, x, y, e]);\n graph.activePlugin = false;\n}\n\nfunction _handleClick(graph, x, y, e) {\n\n graph.emit('click', [graph, x, y, e]);\n // Not on a shape\n checkMouseActions(graph, e, [x, y, e], 'onClick');\n\n if (!e.target.jsGraphIsShape && !graph.prevent(false) && graph.options.shapesUnselectOnClick) {\n\n graph.unselectShapes();\n }\n}\n\nfunction _getAxis(graph, num, options, pos) {\n\n var options = options || {};\n var inst;\n\n var _availableAxes = {\n\n def: {\n x: graph.getConstructor('graph.axis.x'),\n y: graph.getConstructor('graph.axis.y')\n },\n\n time: {\n x: graph.getConstructor('graph.axis.x.time')\n },\n\n bar: {\n x: graph.getConstructor('graph.axis.x.bar')\n }\n };\n\n switch (options.type) {\n\n case 'time':\n var axisInstance = _availableAxes.time;\n break;\n\n case 'bar':\n var axisInstance = _availableAxes.bar;\n break;\n\n case 'broken':\n var axisInstance = _availableAxes.broken;\n break;\n\n default:\n var axisInstance = _availableAxes.def;\n break;\n }\n\n switch (pos) {\n\n case 'top':\n case 'bottom':\n inst = axisInstance.x;\n break;\n\n case 'left':\n case 'right':\n inst = axisInstance.y;\n break;\n }\n\n num = num || 0;\n\n if (typeof num == 'object') {\n options = num;\n num = 0;\n }\n\n if (!graph.axis[pos][num]) {\n\n graph.axis[pos][num] = new inst(graph, pos, options);\n graph.axis[pos][num].init(graph, options);\n }\n\n return graph.axis[pos][num];\n}\n\nfunction _closeLine(graph, mode, x1, x2, y1, y2) {\n\n if (graph.options.close === false) {\n return;\n }\n\n var l = 0;\n\n graph.axis[mode].map(function (g) {\n\n if (g.isDisplayed() && !g.floating) {\n l++;\n }\n });\n\n if ((graph.options.close === true || graph.options.close[mode]) && l == 0) {\n\n graph.closingLines[mode].setAttribute('display', 'block');\n graph.closingLines[mode].setAttribute('x1', x1);\n graph.closingLines[mode].setAttribute('x2', x2);\n graph.closingLines[mode].setAttribute('y1', y1);\n graph.closingLines[mode].setAttribute('y2', y2);\n } else {\n\n graph.closingLines[mode].setAttribute('display', 'none');\n }\n}\n\nfunction _handleMouseWheel(graph, delta, coordX, coordY, e) {\n if (checkMouseActions(graph, e, [delta, e, coordX, coordY], 'onMouseWheel')) {\n e.preventDefault();\n e.stopPropagation();\n }\n}\n\nfunction _handleMouseLeave(graph) {\n if (graph.options.handleMouseLeave) {\n graph.options.handleMouseLeave.call(graph);\n }\n}\n\nfunction haveAxesChanged(graph) {\n var temp = graph._axesHaveChanged;\n graph._axesHaveChanged = false;\n return temp;\n}\n\nfunction hasSizeChanged(graph) {\n var temp = graph._sizeChanged;\n graph._sizeChanged = false;\n return temp;\n}\n\n// Constants\nGraph$1.SERIE_LINE = Symbol();\nGraph$1.SERIE_SCATTER = Symbol();\nGraph$1.SERIE_CONTOUR = Symbol();\nGraph$1.SERIE_BAR = Symbol();\nGraph$1.SERIE_BOX = Symbol();\nGraph$1.SERIE_ZONE = Symbol();\nGraph$1.SERIE_LINE_COLORED = Symbol();\nGraph$1.SERIE_ZONE = Symbol();\nGraph$1.SERIE_DENSITYMAP = Symbol();\nGraph$1.SERIE_LINE_3D = Symbol();\nGraph$1.SERIE_ZONE_3D = Symbol();\n\nGraph$1.TICKS_OUTSIDE = Symbol();\nGraph$1.TICKS_INSIDE = Symbol();\nGraph$1.TICKS_CENTERED = Symbol();\n\nGraph$1.ns = 'http://www.w3.org/2000/svg';\nGraph$1.nsxlink = 'http://www.w3.org/1999/xlink';\n\n/**\n * Default legend configuration\n * @name LegendOptionsDefault\n * @object\n * @static\n * @prop {Boolean} frame - true to display a frame around the legend\n * @prop {Number} frameWidth - The width of the frame stroke\n * @prop {String} frameColor - The stroke color of the frame\n * @prop {String} backgroundColor - The background color of the frame\n * @prop {Number} paddingLeft - The left padding\n * @prop {Number} paddingRight - The right padding\n * @prop {Number} paddingTop - The top padding\n * @prop {Number} paddingBottom - The bottom padding\n * @prop {Boolean} shapesToggleable - true to toggle the shapes linked to serie with its status (shown or hidden)\n * @prop {Boolean} isSerieHideable - true to allow series to be hidden through the legend\n * @prop {Boolean} isSerieSelectable - true to allow series to be selected through the legend\n */\nvar legendDefaults = {\n\n backgroundColor: 'rgba(255, 255, 255, 0.8)',\n frame: true,\n frameWidth: 1,\n frameColor: 'black',\n paddingTop: 10,\n paddingLeft: 10,\n paddingBottom: 10,\n paddingRight: 10,\n color: 'black',\n frameRounding: 0,\n\n movable: false,\n\n shapesToggleable: true,\n isSerieHideable: true,\n isSerieSelectable: true\n\n};\n\n/**\n * Legend constructor. You should not call this method directly, but rather use {@link graph.makeLegend}\n * @example var legend = graph.makeLegend( { backgroundColor: 'rgba(255, 255, 255, 0.8)',\n * frame: true,\n * frameWidth: 1,\n * frameColor: 'black',\n * paddingTop: 10,\n * paddingLeft: 10,\n * paddingBottom: 10,\n * paddingRight: 10,\n * frameRounding: 3,\n *\n * movable: false,\n *\n * shapesToggleable: true,\n * isSerieHideable: true,\n * isSerieSelectable: true\n * } );\n */\nclass Legend {\n\n constructor(graph, options) {\n\n this.options = extend$1({}, legendDefaults, options);\n\n this.graph = graph;\n this.svg = document.createElementNS(this.graph.ns, 'g');\n this.subG = document.createElementNS(this.graph.ns, 'g');\n\n this.groups = [];\n this.rect = document.createElementNS(this.graph.ns, 'rect');\n this.rectBottom = document.createElementNS(this.graph.ns, 'rect');\n\n this.rect.setAttribute('x', 0);\n this.rect.setAttribute('y', 0);\n\n this.rectBottom.setAttribute('x', 0);\n this.rectBottom.setAttribute('y', 0);\n\n this.series = false;\n\n this.svg.setAttribute('display', 'none');\n this.pos = {\n x: undefined,\n y: undefined,\n transformX: 0,\n transformY: 0\n };\n\n this.setEvents();\n\n this.eyeId = guid();\n this.eyeCrossedId = guid();\n\n var eyeClosed = SVGParser('');\n // var eyeClosed = util.SVGParser('');\n\n /* var eyeClosed = document.createElementNS( this.graph.ns, \"symbol\");\n eyeClosed.setAttribute('id', this.eyeId );\n eyeClosed.setAttribute(\"viewBox\", '0 0 100 100');\n var rect = document.createElementNS( this.graph.ns, \"rect\" );\n rect.setAttribute('width', 100 );\n rect.setAttribute('height', 100 );\n rect.setAttribute('x', 0 );\n rect.setAttribute('y', 0 );\n rect.setAttribute('fill', 'black');\n eyeClosed.appendChild( rect );\n */\n var eye = SVGParser('');\n\n this.svg.appendChild(document.adoptNode(eye.documentElement.firstChild));\n this.svg.appendChild(document.adoptNode(eyeClosed.documentElement.firstChild));\n\n this.svg.appendChild(this.subG);\n\n this.applyStyle();\n }\n\n /**\n * Sets the position of the legend\n * @param {Position} position - the position to set the legend to versus the graph main axes ({@link Graph#getXAxis} and {@link Graph#getYAxis})\n * @param {String} alignToX - \"right\" or \"left\". References the legend right or left boundary using the position parameter\n * @param {String} alignToY - \"top\" or \"bottom\". References the legend top or bottom boundary using the position parameter\n * @example legend.setPosition( { x: 'max', y: '0px' }, 'right', 'top' ); // The rightmost side of the legend will at the maximum value of the axis, and will be positioned at the top\n */\n setPosition(position, alignToX, alignToY) {\n\n if (!position) {\n return;\n }\n\n this.position = position;\n this.alignToX = alignToX || 'left';\n this.alignToY = alignToY || 'top';\n }\n\n setDraggable(bln) {\n this.options.movable = bln;\n }\n\n setAutoPosition(position) {\n\n if (['bottom', 'left', 'top', 'right'].indexOf(position = position.toLowerCase()) > -1) {\n this.autoPosition = position;\n return this;\n }\n\n this.requireDelayedUpdate();\n this.autoPosition = false;\n }\n\n autoPosition() {\n return this.setAutoPosition(...arguments);\n }\n\n buildLegendBox() {\n\n var series = this.series || this.graph.getSeries(),\n posX = 0,\n posY = this.options.paddingTop;\n\n if (!this.autoPosition) {\n this.graph.graphingZone.appendChild(this.getDom());\n } else {\n this.graph.getDom().appendChild(this.getDom());\n }\n\n for (var i = 0, l = series.length; i < l; i++) {\n\n if (series[i].excludedFromLegend && !this.series) {\n continue;\n }\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n\n var bbox = getBBox(this.groups[i]);\n\n if (posX + bbox.width > this.graph.getDrawingWidth() - this.options.paddingRight) {\n posY += 16;\n posX = 0;\n }\n }\n\n this.groups[i].setAttribute('transform', 'translate( ' + posX + ', ' + posY + ')');\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n\n posX += bbox.width + 10;\n posY += 0;\n } else {\n\n posX = 0;\n posY += 16;\n }\n }\n\n var bbox = getBBox(this.subG);\n\n /* Independant on box position */\n this.width = bbox.width + this.options.paddingRight + this.options.paddingLeft;\n this.height = bbox.height + this.options.paddingBottom + this.options.paddingTop;\n\n this.rect.setAttribute('width', this.width);\n this.rect.setAttribute('height', this.height);\n this.rect.setAttribute('fill', 'none');\n this.rect.setAttribute('pointer-events', 'fill');\n\n this.rect.setAttribute('display', 'none');\n\n if (this.options.movable) {\n this.rectBottom.style.cursor = 'move';\n }\n\n this.rectBottom.setAttribute('width', this.width);\n this.rectBottom.setAttribute('height', this.height);\n\n this.rectBottom.setAttribute('x', bbox.x - this.options.paddingLeft);\n this.rectBottom.setAttribute('y', bbox.y - this.options.paddingTop);\n /* End independant on box position */\n\n this.position = this.position || {};\n\n switch (this.autoPosition) {\n\n case 'bottom':\n this.position.y = this.graph.getHeight() + 'px';\n // Try to center with respect to the drawing space, not the full graph. It's useful when the graph is fairly asymmetric (i.e. multiple axes on 1 side)\n this.position.x = (this.graph.drawingSpaceWidth - this.width) / 2 + this.graph.drawingSpaceMinX + 'px';\n this.alignToY = 'bottom';\n this.alignToX = false;\n break;\n\n case 'left':\n this.position.x = '6px';\n this.position.y = (this.graph.getHeight() - this.height) / 2 + 'px';\n this.alignToX = 'left';\n this.alignToY = false;\n break;\n\n case 'right':\n this.position.x = this.graph.getWidth() + 'px';\n this.position.y = (this.graph.getHeight() - this.height) / 2 + 'px';\n this.alignToX = 'right';\n this.alignToY = false;\n break;\n\n case 'top':\n this.position.x = (this.graph.drawingSpaceWidth - this.width) / 2 + this.graph.drawingSpaceMinX + 'px';\n this.position.y = '10px';\n this.alignToY = 'top';\n this.alignToX = false;\n break;\n }\n\n if (this.autoPosition) {\n switch (this.autoPosition) {\n\n case 'bottom':\n this.graph.options.paddingBottom = this.height + 10;\n break;\n\n case 'left':\n this.graph.options.paddingLeft = this.width + 5;\n break;\n\n case 'right':\n this.graph.options.paddingRight = this.width + 10;\n break;\n\n case 'top':\n this.graph.options.paddingTop = this.height + 14;\n break;\n }\n\n this.graph.updateGraphingZone();\n this.graph.getDrawingHeight();\n this.graph.getDrawingWidth();\n // this.graph.redraw( false );\n }\n\n this.bbox = bbox;\n }\n\n calculatePosition() {\n\n var pos = Position.check(this.position);\n let poscoords = pos.compute(this.graph, this.graph.getXAxis(), this.graph.getYAxis());\n\n if (!poscoords) {\n return;\n }\n\n if (pos.y == 'max') {\n poscoords.y += this.graph.getPaddingTop();\n }\n\n if (pos.x == 'max') {\n poscoords.x -= this.graph.getPaddingRight();\n }\n\n if (this.alignToX == 'right') {\n poscoords.x -= this.width;\n poscoords.x -= this.bbox.x;\n } else {\n //poscoords.x -= this.bbox.x;\n }\n\n if (this.alignToY == 'bottom') {\n poscoords.y -= this.height;\n poscoords.y -= this.bbox.y;\n } else {\n\n poscoords.y -= this.bbox.y;\n }\n\n this.pos.transformX = poscoords.x;\n this.pos.transformY = poscoords.y;\n\n this._setPosition();\n }\n\n /**\n * Updates the legend position and content\n */\n update(onlyIfRequired) {\n\n if (this.graph.isDelayedUpdate() || !this._requiredUpdate && onlyIfRequired) {\n return;\n }\n\n this._requiredUpdate = false;\n\n var self = this;\n\n this.applyStyle();\n\n while (this.subG.hasChildNodes()) {\n this.subG.removeChild(this.subG.lastChild);\n }\n\n this.svg.insertBefore(this.rectBottom, this.svg.firstChild);\n\n var series = this.series || this.graph.getSeries();\n\n if (series.length > 0) {\n this.svg.setAttribute('display', 'block');\n } else {\n return;\n }\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n var fullWidth = this.graph.getDrawingWidth();\n }\n\n for (var i = 0, l = series.length; i < l; i++) {\n\n if (series[i].excludedFromLegend && !this.series) {\n continue;\n }\n\n (function (j) {\n\n var g,\n line,\n text;\n\n if (this.autoPosition == 'bottom' || this.autoPosition == 'top') {\n var fullWidth = this.graph.getDrawingWidth();\n }\n\n g = document.createElementNS(self.graph.ns, 'g');\n var rect = document.createElementNS(self.graph.ns, 'rect');\n\n self.subG.appendChild(g);\n\n g.appendChild(rect);\n\n var line = series[j].getSymbolForLegend();\n var marker = series[j].getMarkerForLegend();\n var text = series[j].getTextForLegend();\n\n var dx = 35;\n\n if (this.isHideable()) {\n dx += 20;\n\n var eyeUse = document.createElementNS(self.graph.ns, 'use');\n eyeUse.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', '#' + (series[i].isShown() ? this.eyeId : this.eyeCrossedId));\n eyeUse.setAttribute('width', 15);\n eyeUse.setAttribute('height', 15);\n eyeUse.setAttribute('x', 35);\n eyeUse.setAttribute('y', -8);\n\n eyeUse.addEventListener('click', function (e) {\n e.stopPropagation();\n\n var id;\n if (series[j].isShown()) {\n series[j].hide(self.options.hideShapesOnHideSerie);\n id = self.eyeCrossedId;\n } else {\n series[j].show(self.options.hideShapesOnHideSerie);\n id = self.eyeId;\n }\n\n eyeUse.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', '#' + id);\n });\n }\n\n text.setAttribute('transform', 'translate(' + dx + ', 3)');\n\n text.setAttribute('color', this.options.color);\n\n if (line) {\n g.appendChild(line);\n }\n\n if (series[j].getType() == 'scatter') {\n line.setAttribute('transform', 'translate( 20, 0 )');\n }\n\n if (marker) {\n g.appendChild(marker);\n }\n\n if (eyeUse) {\n g.appendChild(eyeUse);\n }\n\n g.appendChild(text);\n\n var bbox = getBBox(g);\n\n rect.setAttribute('x', bbox.x);\n rect.setAttribute('y', bbox.y);\n rect.setAttribute('width', bbox.width);\n rect.setAttribute('height', bbox.height);\n rect.setAttribute('fill', 'none');\n rect.setAttribute('pointer-events', 'fill');\n\n self.groups[j] = g;\n\n g.addEventListener('click', function (e) {\n\n var serie = series[j];\n\n if (!serie.isShown()) {\n return;\n }\n\n if (self.isSelectable() && !serie.isSelected()) {\n\n self.graph.selectSerie(serie);\n } else {\n\n self.graph.unselectSerie(serie);\n }\n\n e.preventDefault();\n e.stopPropagation();\n });\n }).call(this, i);\n }\n\n this.svg.appendChild(this.rect);\n this.buildLegendBox();\n this.calculatePosition();\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be hidden or not\n */\n isHideable() {\n return this.options.isSerieHideable;\n }\n\n notHideable() {\n this.options.isSerieHideable = false;\n return this;\n }\n\n hideable() {\n this.options.isSerieHideable = true;\n return this;\n }\n\n set seriesHideable(hideable) {\n this.options.isSerieHideable = !!hideable;\n }\n\n /**\n * @type {Boolean}\n */\n get seriesHideable() {\n return this.options.isSerieHideable;\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be selected or not\n */\n isSelectable() {\n return this.options.isSerieSelectable;\n }\n\n /**\n * @return {Boolean} true or false depending if the series can be t or not\n */\n isToggleShapes() {\n return this.options.shapesToggleable;\n }\n\n /**\n * @return {SVGGroupElement} The SVG group element wrapping the legend\n */\n getDom() {\n return this.svg;\n }\n\n setEvents() {\n\n var self = this;\n var pos = this.pos;\n\n var mousedown = function (e) {\n\n e.stopPropagation();\n console.log('down');\n if (self.options.movable) {\n pos.x = e.clientX;\n pos.y = e.clientY;\n\n e.preventDefault();\n self.mousedown = true;\n self.graph.elementMoving(self);\n\n self.rect.setAttribute('display', 'block');\n }\n };\n\n var mousemove = function (e) {\n self.handleMouseMove(e);\n };\n\n this.svg.addEventListener('mousedown', mousedown);\n this.svg.addEventListener('click', function (e) {\n e.stopPropagation();\n });\n this.svg.addEventListener('dblclick', function (e) {\n e.stopPropagation();\n });\n this.svg.addEventListener('mousemove', mousemove);\n //this.rect.addEventListener( 'mousemove', mousemove );\n }\n\n handleMouseUp(e) {\n\n e.stopPropagation();\n e.preventDefault();\n this.mousedown = false;\n this.rect.setAttribute('display', 'none');\n this.graph.elementMoving(false);\n }\n\n handleMouseMove(e) {\n\n if (!this.mousedown) {\n return;\n }\n\n var pos = this.pos;\n\n var deltaX = e.clientX - pos.x;\n var deltaY = e.clientY - pos.y;\n\n pos.transformX += deltaX;\n pos.transformY += deltaY;\n\n pos.x = e.clientX;\n pos.y = e.clientY;\n\n e.stopPropagation();\n e.preventDefault();\n\n this._setPosition();\n }\n\n _setPosition() {\n\n var pos = this.pos;\n if (!isNaN(pos.transformX) && !isNaN(pos.transformY) && pos.transformX !== false && pos.transformY !== false) {\n this.svg.setAttribute('transform', 'translate(' + pos.transformX + ', ' + pos.transformY + ')');\n }\n }\n\n /**\n * Re-applies the legend style\n */\n applyStyle() {\n\n if (this.options.frame) {\n this.rectBottom.setAttribute('stroke', this.options.frameColor);\n this.rectBottom.setAttribute('stroke-width', this.options.frameWidth + 'px');\n this.rectBottom.setAttribute('rx', this.options.frameRounding);\n this.rectBottom.setAttribute('ry', this.options.frameRounding);\n }\n\n this.rectBottom.setAttribute('fill', this.options.backgroundColor);\n }\n\n /**\n * Re-applies the legend style\n * @param {...(GraphSerie|GraphSerie[])} a serie or an array of series\n */\n fixSeries() {\n var series = [];\n\n if (arguments[0] === false) {\n this.series = false;\n this.update();\n return;\n }\n\n for (var i = 0, l = arguments.length; i < l; i++) {\n if (Array.isArray(arguments[i])) {\n series = series.concat(arguments[i]);\n } else {\n series.push(arguments[i]);\n }\n }\n\n this.update();\n this.series = series;\n }\n\n fixSeriesAdd(serie) {\n this.series = this.series || [];\n this.series.push(serie);\n }\n\n requireDelayedUpdate() {\n this._requiredUpdate = true;\n }\n\n}\n\nfunction getBBox(svgElement) {\n // Firefox throws when trying to call getBBox() on elements\n // that are not yet rendered.\n try {\n return svgElement.getBBox();\n } catch (e) {\n return {\n height: 0,\n width: 0,\n x: 0,\n y: 0\n };\n }\n}\n\n/**\n * Default graph parameters\n * @name AxisOptionsDefault\n * @object\n * @static\n * @memberof Axis\n * @prop {Boolean} display - Whether to display or not the axis\n * @prop {Boolean} flipped - Flips the axis (maximum and minimum will be inverted)\n * @prop {Numner} axisDataSpacing.min - The spacing of the at the bottom of the axis. The value is multiplied by the (max - min) values given by the series (0.1 means 10% of the serie width / height).\n * @prop {Number} axisDataSpacing.max - The spacing of the at the top of the axis. The value is multiplied by the (max - min) values given by the series (0.1 means 10% of the serie width / height).\n * @prop {String} unitModification - Used to change the units of the axis in a defined way. Currently, \"time\" and \"time:min.sec\" are supported. They will display the value in days, hours, minutes and seconds and the data should be expressed in seconds.\n * @prop {Boolean} primaryGrid - Whether or not to display the primary grid (on the main ticks)\n * @prop {Boolean} secondaryGrid - Whether or not to display the secondary grid (on the secondary ticks)\n * @prop {Number} tickPosition - Sets the position of the ticks with regards to the axis ( 1 = inside, 2 = centered, 3 = outside ).\n * @prop {Number} nbTicksPrimary - The number of primary ticks to use (approximately)\n * @prop {Number} nbTicksSecondary - The number of secondary ticks to use (approximately)\n * @prop {Number} ticklabelratio - Scaling factor on the labels under each primary ticks\n * @prop {Number} exponentialFactor - Scales the labels under each primary ticks by 10^(exponentialFactor)\n * @prop {Number} exponentialLabelFactor - Scales the axis label by 10^(exponentialFactor)\n * @prop {Boolean} logScale - Display the axis in log scale (base 10)\n * @prop {(Number|Boolean)} forcedMin - Use a number to force the minimum value of the axis (becomes independant of its series)\n * @prop {(Number|Boolean)} forcedMax - Use a number to force the maximum value of the axis (becomes independant of its series)\n */\nconst defaults = {\n lineAt: false,\n display: true,\n flipped: false,\n axisDataSpacing: {\n min: 0.1,\n max: 0.1\n },\n unitModification: false,\n primaryGrid: true,\n secondaryGrid: true,\n\n primaryGridColor: '#f0f0f0',\n secondaryGridColor: '#f0f0f0',\n\n primaryGridWidth: 1,\n secondaryGridWidth: 1,\n\n hideWhenNoSeriesShown: false,\n shiftToZero: false,\n tickPosition: 1,\n nbTicksPrimary: 3,\n nbTicksSecondary: 10,\n ticklabelratio: 1,\n exponentialFactor: 0,\n exponentialLabelFactor: 0,\n logScale: false,\n forcedMin: false,\n forcedMax: false,\n\n span: [0, 1],\n marginMin: 0,\n marginMax: 0,\n\n scientificScale: false,\n scientificScaleExponent: false,\n engineeringScale: false,\n\n unitInTicks: false,\n unit: false,\n unitWrapperBefore: '',\n unitWrapperAfter: '',\n\n splitMarks: false,\n\n tickLabelOffset: 0,\n\n useKatexForLabel: false\n};\n\n/**\n * Axis constructor. Usually not instanced directly, but for custom made axes, that's possible\n * @class Axis\n * @static\n * @augments EventEmitter\n * @example function myAxis() {};\n * myAxis.prototype = new Graph.getConstructor(\"axis\");\n * graph.setBottomAxis( new myAxis( { } ) );\n */\nclass Axis extends EventEmitter {\n\n constructor() {\n\n super();\n }\n\n init(graph, options, overwriteoptions) {\n\n this.unitModificationTimeTicks = [[1, [1, 2, 5, 10, 20, 30]], [60, [1, 2, 5, 10, 20, 30]], [3600, [1, 2, 6, 12]], [3600 * 24, [1, 2, 3, 4, 5, 10, 20, 40]]];\n\n this.graph = graph;\n this.options = extend$1(true, {}, defaults, overwriteoptions, options);\n\n this.group = document.createElementNS(this.graph.ns, 'g');\n this.hasChanged = true;\n\n this.rectEvent = document.createElementNS(this.graph.ns, 'rect');\n this.rectEvent.setAttribute('pointer-events', 'fill');\n this.rectEvent.setAttribute('fill', 'transparent');\n this.group.appendChild(this.rectEvent);\n\n this.graph.axisGroup.appendChild(this.group); // Adds to the main axiszone\n\n // Lines at a certain value\n this._lines = [];\n\n this.line = document.createElementNS(this.graph.ns, 'line');\n this.line.setAttribute('stroke', 'black');\n this.line.setAttribute('shape-rendering', 'crispEdges');\n this.line.setAttribute('stroke-linecap', 'square');\n this.groupTicks = document.createElementNS(this.graph.ns, 'g');\n this.groupTickLabels = document.createElementNS(this.graph.ns, 'g');\n\n this.group.appendChild(this.groupTicks);\n this.group.appendChild(this.groupTickLabels);\n this.group.appendChild(this.line);\n\n this.label = document.createElementNS(this.graph.ns, 'text');\n\n this.labelTspan = document.createElementNS(this.graph.ns, 'tspan'); // Contains the main label\n this.preunit = ''; //document.createElementNS( this.graph.ns, 'tspan' ); // Contains the scaling unit\n this.unitTspan = document.createElementNS(this.graph.ns, 'tspan'); // Contains the unit\n this.expTspan = document.createElementNS(this.graph.ns, 'tspan'); // Contains the exponent (x10)\n this.expTspanExp = document.createElementNS(this.graph.ns, 'tspan'); // Contains the exponent value\n\n this.label.appendChild(this.labelTspan);\n //this.label.appendChild( this.preunitTspan );\n this.label.appendChild(this.unitTspan);\n this.label.appendChild(this.expTspan);\n this.label.appendChild(this.expTspanExp);\n\n this.expTspan.setAttribute('dx', 6);\n this.expTspanExp.setAttribute('dy', -5);\n this.expTspanExp.setAttribute('font-size', '0.8em');\n\n this.label.setAttribute('text-anchor', 'middle');\n\n this.setTickPosition(this.options.tickPosition);\n\n this.gridLinePath = {\n primary: '',\n secondary: ''\n };\n\n this.gridPrimary = document.createElementNS(this.graph.ns, 'path');\n this.gridSecondary = document.createElementNS(this.graph.ns, 'path');\n\n this.graph.groupPrimaryGrids.appendChild(this.gridPrimary);\n this.graph.groupSecondaryGrids.appendChild(this.gridSecondary);\n\n this.setGridLinesStyle();\n\n this.group.appendChild(this.label);\n\n this.groupSeries = document.createElementNS(this.graph.ns, 'g');\n this.group.appendChild(this.groupSeries);\n\n this.widthHeightTick = 0;\n\n this.ticks = {};\n this.ticksLabels = [];\n this.tickScaling = {\n 1: 3,\n 2: 2,\n 3: 1,\n 4: 0.5\n };\n\n this.currentTick = {};\n this.lastCurrentTick = {};\n\n this.series = [];\n this.totalDelta = 0;\n this.currentAction = false;\n\n this.group.addEventListener('mousemove', e => {\n e.preventDefault();\n var coords = this.graph._getXY(e);\n this.handleMouseMoveLocal(coords.x, coords.y, e);\n\n for (var i = 0, l = this.series.length; i < l; i++) {\n this.series[i].handleMouseMove(false, true);\n }\n });\n\n this.labels = [];\n this.group.addEventListener('click', e => {\n e.preventDefault();\n var coords = this.graph._getXY(e);\n this.addLabel(this.getVal(coords.x - this.graph.getPaddingLeft()));\n });\n\n //this.clip = document.createElementNS( this.graph.ns, 'clipPath' );\n //this.clip.setAttribute( 'id', '_clip' + this.axisRand );\n //this.graph.defs.appendChild( this.clip );\n /*\n this.clipRect = document.createElementNS( this.graph.ns, 'rect' );\n this.clip.appendChild( this.clipRect );\n this.clip.setAttribute( 'clipPathUnits', 'userSpaceOnUse' );\n */\n this.gridPrimary.setAttribute('clip-path', 'url(#_clipplot' + this.graph._creation + ')');\n this.gridSecondary.setAttribute('clip-path', 'url(#_clipplot' + this.graph._creation + ')');\n this.graph._axisHasChanged(this);\n }\n\n handleMouseMoveLocal() {}\n\n /**\n * Hides the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n hide() {\n this.options.display = false;\n return this;\n }\n\n /**\n * Shows the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n show() {\n this.options.display = true;\n return this;\n }\n\n /**\n * Shows or hides the axis\n * @memberof Axis\n * @param {Boolean} display - true to display the axis, false to hide it\n * @return {Axis} The current axis\n */\n setDisplay(bool) {\n this.options.display = !!bool;\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Boolean} A boolean indicating the displayed state of the axis\n */\n isDisplayed() {\n\n if (!this.options.hideWhenNoSeriesShown) {\n return this.options.display;\n }\n\n return this.graph.getSeriesFromAxis(this).reduce((accumulator, serie) => {\n return accumulator || serie.isShown();\n }, false);\n }\n\n isShown() {\n\n return this.isDisplayed(...arguments);\n }\n\n hideGroup() {\n if (this._hidden) {\n return;\n }\n this._hidden = true;\n this.group.setAttribute('display', 'none');\n }\n\n showGroup() {\n if (!this._hidden) {\n return;\n }\n this._hidden = false;\n this.group.setAttribute('display', 'initial');\n }\n\n kill(noRedraw, noSerieKill) {\n this.graph.killAxis(this, noRedraw, noSerieKill);\n }\n /**\n * Forces the appearence of a straight perpendicular line at value 0\n * @param {Array} atValues - An array of x or y values where the lines are displayed\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setLineAt(atValues) {\n this.options.lineAt = atValues;\n return this;\n }\n\n // Used to adapt the 0 of the axis to the zero of another axis that has the same direction\n\n /**\n * Aligns ```thisValue``` of the axis to ```foreignValue``` of another axis\n * @param {(Axis|Boolean)} axis - The axis with which the 0 should be aligned. Use \"false\" to deactivate the adapt to 0 mode.\n * @param {Number} thisValue - The value of the current axis that should be aligned\n * @param {Number} foreignValue - The value of the reference axis that should be aligned\n * @param {String} preference - \"min\" or \"max\". Defined the boundary that should behave the more normally\n * @memberof Axis\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n adaptTo(axis, thisValue, foreignValue, preference) {\n\n if (!axis) {\n this.options.adaptTo = false;\n return this;\n }\n\n this.options.adaptTo = {\n axis: axis,\n thisValue: thisValue,\n foreignValue: foreignValue,\n preference: preference\n };\n\n this.adapt();\n\n return this;\n }\n\n /**\n * Adapts maximum and minimum of the axis if options.adaptTo is defined\n * @memberof Axis\n * @returns {Axis} The current axis\n * @since 1.13.2\n */\n adapt() {\n\n if (!this.options.adaptTo) {\n return;\n }\n\n var axis = this.options.adaptTo.axis,\n current = this.options.adaptTo.thisValue,\n foreign = this.options.adaptTo.foreignValue;\n\n if (axis.currentAxisMin === undefined || axis.currentAxisMax === undefined) {\n axis.setMinMaxToFitSeries();\n }\n\n if (this.options.forcedMin !== false && this.options.forcedMax == false || this.options.adaptTo.preference !== 'max') {\n\n if (this.options.forcedMin !== false) {\n this.currentAxisMin = this.options.forcedMin;\n } else {\n this.currentAxisMin = this._zoomed ? this.getCurrentMin() : this.getMinValue() - (current - this.getMinValue()) * (this.options.axisDataSpacing.min * (axis.getCurrentMax() - axis.getCurrentMin()) / (foreign - axis.getCurrentMin()));\n }\n\n if (this.currentAxisMin == current) {\n this.currentAxisMin -= this.options.axisDataSpacing.min * this.getInterval();\n }\n\n var use = this.options.forcedMin !== false ? this.options.forcedMin : this.currentAxisMin;\n this.currentAxisMax = (current - use) * (axis.getCurrentMax() - axis.getCurrentMin()) / (foreign - axis.getCurrentMin()) + use;\n } else {\n\n if (this.options.forcedMax !== false) {\n this.currentAxisMax = this.options.forcedMax;\n } else {\n this.currentAxisMax = this._zoomed ? this.getCurrentMax() : this.getMaxValue() + (this.getMaxValue() - current) * (this.options.axisDataSpacing.max * (axis.getCurrentMax() - axis.getCurrentMin()) / (axis.getCurrentMax() - foreign));\n }\n\n if (this.currentAxisMax == current) {\n this.currentAxisMax += this.options.axisDataSpacing.max * this.getInterval();\n }\n\n var use = this.options.forcedMax !== false ? this.options.forcedMax : this.currentAxisMax;\n\n this.currentAxisMin = (current - use) * (axis.getCurrentMin() - axis.getCurrentMax()) / (foreign - axis.getCurrentMax()) + use;\n }\n\n this.graph._axisHasChanged(this);\n }\n\n // Floating axis. Adapts axis position orthogonally to another axis at a defined value. Not taken into account for margins\n\n /**\n * Makes the axis floating (not aligned to the right or the left anymore). You need to specify another axis (perpendicular) and a value at which this axis should be located\n * @param {Axis} axis - The axis on which the current axis should be aligned to\n * @param {Number} value - The value on which the current axis should be aligned\n * @memberof Axis\n * @return {Axis} The current axis\n * @example graph.getYAxis().setFloat( graph.getBottomAxis(), 0 ); // Alignes the y axis with the origin of the bottom axis\n */\n setFloating(axis, value) {\n\n this.floating = true;\n this.floatingAxis = axis;\n this.floatingValue = value;\n\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Axis} The axis referencing the floating value of the current axis\n */\n getFloatingAxis() {\n return this.floatingAxis;\n }\n\n /**\n * @memberof Axis\n * @return {Axis} The value to which the current axis is aligned to\n */\n getFloatingValue() {\n return this.floatingValue;\n }\n\n /**\n * Sets the axis data spacing\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} min - The spacing at the axis min value\n * @param {Number} [ max = min ] - The spacing at the axis max value. If omitted, will be equal to the \"min\" parameter\n * @return {Axis} The current axis\n */\n setAxisDataSpacing(val1, val2) {\n this.options.axisDataSpacing.min = val1;\n this.options.axisDataSpacing.max = val2 || val1;\n return this;\n }\n\n dataSpacing() {\n return this.setAxisDataSpacing(...arguments);\n }\n\n /**\n * Sets the axis data spacing at the minimum of the axis\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} min - The spacing at the axis min value\n * @return {Axis} The current axis\n */\n setAxisDataSpacingMin(val) {\n this.options.axisDataSpacing.min = val;\n }\n\n /**\n * Sets the axis data spacing at the maximum of the axis\n * @memberof Axis\n * @see AxisOptionsDefault\n * @param {Number} max - The spacing at the axis max value\n * @return {Axis} The current axis\n */\n setAxisDataSpacingMax(val) {\n this.options.axisDataSpacing.max = val;\n }\n\n setMinPx(px) {\n\n this.minPx = px;\n this.setMinMaxFlipped();\n }\n\n setMaxPx(px) {\n\n this.maxPx = px;\n this.setMinMaxFlipped();\n }\n\n /**\n * @memberof Axis\n * @return {Number} The position in px of the bottom of the axis\n */\n getMinPx() {\n return this.minPxFlipped;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The position in px of the top of the axis\n */\n getMaxPx() {\n return this.maxPxFlipped;\n }\n\n getMathMaxPx() {\n return this.maxPx;\n }\n\n getMathMinPx() {\n return this.minPx;\n }\n\n // Returns the true minimum of the axis. Either forced in options or the one from the data\n\n /**\n * Retrieves the minimum possible value of the axis. Can be set by \"forcedMin\", \"adapt0ToAxis\" or by the values of the series the axis contains. Does not take into account any zooming.\n * @memberof Axis\n * @return {Number} The minimum possible value of the axis\n */\n getMinValue() {\n return this.options.forcedMin !== false ? this.options.forcedMin : this.dataMin;\n }\n\n /**\n * Retrieves the maximum possible value of the axis. Can be set by \"forcedMax\", \"adapt0ToAxis\" or by the values of the series the axis contains. Does not take into account any zooming.\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getMaxValue() {\n return this.options.forcedMax !== false ? this.options.forcedMax : this.dataMax;\n }\n\n setMinValueData(min) {\n this.dataMin = min;\n\n // 25.10.2017. This is to help in the case there's no autoscaling\n if (isNaN(this.getCurrentMin())) {\n //this.setCurrentMin( this.getMinValue() );\n //this.cache();\n\n }\n }\n\n setMaxValueData(max) {\n this.dataMax = max;\n\n // 25.10.2017. This is to help in the case there's no autoscaling\n // 02.02.2018. Don't agree with this. Next time, put a link to show the use of this piece of code\n if (isNaN(this.getCurrentMax())) {\n // this.setCurrentMax( this.getMaxValue() );\n //this.cache();\n\n }\n }\n\n /**\n * Retrieves the maximum possible value of the axis based only on the data. Does not take into account the possible axis forcing\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getDataMax() {\n return this.dataMax;\n }\n\n /**\n * Retrieves the minimum possible value of the axis based only on the data. Does not take into account the possible axis forcing\n * @memberof Axis\n * @return {Number} The minimum possible value of the axis\n */\n getDataMin() {\n return this.dataMin;\n }\n\n /**\n * Forces the minimum value of the axis (no more dependant on the serie values)\n * @memberof Axis\n * @param {Number} min - The minimum value of the axis\n * @param {Boolean} noRescale - ```true``` to prevent the axis to rescale to set this minimum. Rescales anyway if current min is lower than the value. Defaults to ```false```\n * @return {Axis} The current axis\n */\n forceMin(min, noRescale = false) {\n this.options.forcedMin = min;\n this.setCurrentMin(noRescale ? this.getCurrentMin() : undefined);\n this.graph._axisHasChanged(this);\n return this;\n }\n\n /**\n * Forces the maximum value of the axis (no more dependant on the serie values).\n * @memberof Axis\n * @param {Number} max - The maximum value of the axis\n * @param {Boolean} noRescale - ```true``` to prevent the axis to rescale to set this maximum. Rescales anyway if current max is higher than the value\n * @return {Axis} The current axis\n */\n forceMax(max, noRescale = false) {\n this.options.forcedMax = max;\n this.setCurrentMax(noRescale ? this.getCurrentMax() : undefined);\n this.graph._axisHasChanged(this);\n return this;\n }\n\n /**\n * Retrieves the forced minimum of the axis\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getForcedMin() {\n return this.options.forcedMin;\n }\n\n /**\n * Retrieves the forced minimum of the axis\n * @memberof Axis\n * @return {Number} The maximum possible value of the axis\n */\n getForcedMax() {\n return this.options.forcedMax;\n }\n\n /**\n * Forces the min and max values of the axis to the min / max values of another axis\n * @param {Axis} axis - The axis from which the min / max values are retrieved.\n * @memberof Axis\n * @return {Axis} The current axis\n */\n forceToAxis(axis) {\n if (axis.getMaxValue && axis.getMinValue) {\n this.options.forcedMin = axis.getMinValue();\n this.options.forcedMax = axis.getMaxValue();\n }\n\n return this;\n }\n\n getNbTicksPrimary() {\n return this.options.nbTicksPrimary;\n }\n\n setNbTicksPrimary(nb) {\n this.options.nbTicksPrimary = nb;\n }\n\n getNbTicksSecondary() {\n return this.options.nbTicksSecondary;\n }\n\n setNbTicksSecondary(nb) {\n this.options.nbTicksSecondary = nb;\n return this;\n }\n\n handleMouseMove(px) {\n this.mouseVal = this.getVal(px);\n }\n\n handleMouseWheel(delta, e, baseline) {\n\n delta = Math.min(0.2, Math.max(-0.2, delta));\n\n if (baseline == 'min') {\n baseline = this.getMinValue();\n } else if (baseline == 'max') {\n baseline = this.getMaxValue();\n } else if (!baseline) {\n baseline = 0;\n }\n\n this._doZoomVal((this.getCurrentMax() - baseline) * (1 + delta) + baseline, (this.getCurrentMin() - baseline) * (1 + delta) + baseline);\n\n this.graph.draw();\n //\tthis.graph.drawSeries(true);\n }\n\n set zoomLock(bln) {\n this._zoomLocked = bln;\n }\n\n get zoomLock() {\n return this._zoomLocked || false;\n }\n\n /**\n * Performs a zoom on the axis, without redraw afterwards\n * @param {Number} val1 - The new axis minimum\n * @param {Number} val2 - The new axis maximum\n * @memberof Axis\n * @return {Axis} The current axis\n * @example\n * graph.getBottomAxis().zoom( 50, 70 ); // Axis boundaries will be 50 and 70 after next redraw\n * graph.redraw();\n * @example\n * graph.getBottomAxis().forceMin( 0 ).forceMax( 100 ).zoom( 50, 70 ); // Axis boundaries will be 50 and 70 after next redraw\n * graph.draw();\n * graph.autoscaleAxes(); // New bottom axis boundaries will be 0 and 100, not 50 and 70 !\n * graph.draw();\n */\n zoom(val1, val2, forceLock) {\n\n if (!forceLock && this.zoomLock) {\n return;\n }\n\n return this._doZoomVal(val1, val2, true);\n }\n\n _doZoomVal(val1, val2, mute) {\n\n return this._doZoom(this.getPx(val1), this.getPx(val2), val1, val2, mute);\n }\n\n _doZoom(px1, px2, val1, val2, mute) {\n\n //if(this.options.display || 1 == 1) {\n var val1 = val1 !== undefined ? val1 : this.getVal(px1);\n var val2 = val2 !== undefined ? val2 : this.getVal(px2);\n\n this.setCurrentMin(Math.min(val1, val2));\n this.setCurrentMax(Math.max(val1, val2));\n\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n\n this._zoomed = true;\n\n this.adapt();\n\n this._hasChanged = true;\n\n // New method\n if (!mute) {\n this.emit('zoom', [this.currentAxisMin, this.currentAxisMax, this]);\n }\n\n return this;\n }\n\n getSerieShift() {\n return this._serieShift;\n }\n\n getSerieScale() {\n return this._serieScale;\n }\n\n getMouseVal() {\n return this.mouseVal;\n }\n\n getUnitPerTick(px, nbTick, valrange) {\n\n var pxPerTick = px / nbTicks; // 1000 / 100 = 10 px per tick\n if (!nbTick) {\n nbTick = px / 10;\n } else {\n nbTick = Math.min(nbTick, px / 10);\n }\n\n // So now the question is, how many units per ticks ?\n // Say, we have 0.0004 unit per tick\n var unitPerTick = valrange / nbTick;\n\n switch (this.options.unitModification) {\n\n case 'time':\n case 'time:min.sec':\n {\n\n //const max = this.getModifiedValue( this.getMaxValue() );/*,\n /*units = [\n [ 60, 'min' ],\n [ 3600, 'h' ],\n [ 3600 * 24, 'd' ]\n ];*/\n\n let i, l, k, m;\n let breaked = false;\n for (i = 0, l = this.unitModificationTimeTicks.length; i < l; i++) {\n for (k = 0, m = this.unitModificationTimeTicks[i][1].length; k < m; k++) {\n if (unitPerTick < this.unitModificationTimeTicks[i][0] * this.unitModificationTimeTicks[i][1][k]) {\n breaked = true;\n break;\n }\n }\n if (breaked) {\n break;\n }\n }\n\n //i and k contain the good variable;\n if (i !== this.unitModificationTimeTicks.length) {\n unitPerTickCorrect = this.unitModificationTimeTicks[i][0] * this.unitModificationTimeTicks[i][1][k];\n } else {\n unitPerTickCorrect = 1;\n }\n\n break;\n }\n default:\n {\n\n // We take the log\n var decimals = Math.floor(Math.log(unitPerTick) / Math.log(10));\n /*\n Example:\n 13'453 => Math.log10() = 4.12 => 4\n 0.0000341 => Math.log10() = -4.46 => -5\n */\n\n var numberToNatural = unitPerTick * Math.pow(10, -decimals);\n\n /*\n Example:\n 13'453 (4) => 1.345\n 0.0000341 (-5) => 3.41\n */\n\n this.decimals = -decimals;\n\n var possibleTicks = [1, 2, 5, 10];\n var closest = false;\n for (let i = possibleTicks.length - 1; i >= 0; i--) {\n if (!closest || Math.abs(possibleTicks[i] - numberToNatural) < Math.abs(closest - numberToNatural)) {\n closest = possibleTicks[i];\n }\n }\n\n // Ok now closest is the number of unit per tick in the natural number\n /*\n Example:\n 13'453 (4) (1.345) => 1\n 0.0000341 (-5) (3.41) => 5\n */\n\n // Let's scale it back\n var unitPerTickCorrect = closest * Math.pow(10, decimals);\n\n /*\n Example:\n 13'453 (4) (1.345) (1) => 10'000\n 0.0000341 (-5) (3.41) (5) => 0.00005\n */\n break;\n }\n }\n\n var nbTicks = valrange / unitPerTickCorrect;\n\n var pxPerTick = px / nbTick;\n return [unitPerTickCorrect, nbTicks, pxPerTick];\n }\n\n /**\n * Resets the min and max of the serie to fit the series it contains\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setMinMaxToFitSeries(noNotify) {\n\n var interval = this.getInterval();\n\n if (this.options.logScale) {\n\n this.currentAxisMin = Math.max(1e-50, this.getMinValue() * 0.9);\n this.currentAxisMax = Math.max(1e-50, this.getMaxValue() * 1.1);\n } else {\n\n this.currentAxisMin = this.getMinValue();\n this.currentAxisMax = this.getMaxValue();\n\n if (this.getForcedMin() === false) {\n this.currentAxisMin -= this.options.axisDataSpacing.min * interval;\n }\n\n if (this.getForcedMax() === false) {\n this.currentAxisMax += this.options.axisDataSpacing.max * interval;\n }\n }\n\n if (isNaN(this.currentAxisMin) || isNaN(this.currentAxisMax)) {\n this.currentAxisMax = undefined;\n this.currentAxisMin = undefined;\n }\n\n this.cache();\n\n this._zoomed = false;\n\n this.adapt();\n\n if (!noNotify) {\n this.graph._axisHasChanged(this);\n }\n\n this.emit('zoomOutFull', [this.currentAxisMin, this.currentAxisMax, this]);\n\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {Number} the maximum interval ( max - min ) of the axis ( not nessarily the current one )\n */\n getInterval() {\n return this.getMaxValue() - this.getMinValue();\n }\n\n /**\n * @memberof Axis\n * @return {Number} the maximum interval ( max - min ) of the axis ( not nessarily the current one )\n */\n getCurrentInterval() {\n return this.cachedInterval;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The current minimum value of the axis\n */\n getCurrentMin() {\n return this.cachedCurrentMin;\n }\n\n /**\n * @memberof Axis\n * @return {Number} The current maximum value of the axis\n */\n getCurrentMax() {\n return this.cachedCurrentMax;\n }\n\n /**\n * Caches the current axis minimum\n * @memberof Axis\n */\n cacheCurrentMin() {\n this.cachedCurrentMin = this.currentAxisMin == this.currentAxisMax ? this.options.logScale ? this.currentAxisMin / 10 : this.currentAxisMin - 1 : this.currentAxisMin;\n }\n\n /**\n * Caches the current axis maximum\n * @memberof Axis\n */\n cacheCurrentMax() {\n this.cachedCurrentMax = this.currentAxisMax == this.currentAxisMin ? this.options.logScale ? this.currentAxisMax * 10 : this.currentAxisMax + 1 : this.currentAxisMax;\n }\n\n /**\n * Caches the current interval\n * @memberof Axis\n */\n cacheInterval() {\n this.cachedInterval = this.cachedCurrentMax - this.cachedCurrentMin;\n }\n\n cache() {\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n }\n\n /**\n * Sets the current minimum value of the axis. If lower that the forced value, the forced value is used\n * @memberof Axis\n * @param {Number} val - The new minimum value\n * @return {Axis} The current axis\n */\n setCurrentMin(val) {\n\n if (val === undefined || this.getForcedMin() !== false && (val < this.getForcedMin() || val === undefined)) {\n val = this.getMinValue();\n }\n this.currentAxisMin = val;\n if (this.options.logScale) {\n this.currentAxisMin = Math.max(1e-50, val);\n }\n\n this.cacheCurrentMin();\n this.cacheInterval();\n\n this.graph._axisHasChanged(this);\n return this;\n }\n\n /**\n * Sets the current maximum value of the axis. If higher that the forced value, the forced value is used\n * @memberof Axis\n * @param {Number} val - The new maximum value\n * @return {Axis} The current axis\n */\n setCurrentMax(val) {\n\n if (val === undefined || this.getForcedMax() !== false && (val > this.getForcedMax() || val === undefined)) {\n val = this.getMaxValue();\n }\n\n this.currentAxisMax = val;\n\n if (this.options.logScale) {\n this.currentAxisMax = Math.max(1e-50, val);\n }\n\n this.cacheCurrentMax();\n this.cacheInterval();\n\n this.graph._axisHasChanged(this);\n }\n\n /**\n * Sets the flipping state of the axis. If enabled, the axis is descending rather than ascending.\n * @memberof Axis\n * @param {Boolean} flip - The new flipping state of the axis\n * @return {Axis} The current axis\n */\n flip(flip) {\n this.options.flipped = flip;\n this.setMinMaxFlipped();\n return this;\n }\n /*\n setMinMaxFlipped() {\n var interval = this.maxPx - this.minPx;\n var maxPx = this.maxPx - interval * this.options.span[ 0 ];\n var minPx = this.maxPx - interval * this.options.span[ 1 ];\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n // this.minPx = minPx;\n //this.maxPx = maxPx;\n }\n */\n /**\n * @memberof Axis\n * @return {Boolean} The current flipping state of the axis\n */\n isFlipped() {\n return this.options.flipped;\n }\n\n _draw() {\n // Redrawing of the axis\n\n var self = this;\n // var visible;\n\n // this.drawInit();\n\n if (this.currentAxisMin === undefined || this.currentAxisMax === undefined) {\n this.setMinMaxToFitSeries(true); // We reset the min max as a function of the series\n }\n\n // this.cache();\n\n // this.setSlaveAxesBoundaries();\n\n // The data min max is stored in this.dataMin, this.dataMax\n\n //var widthPx = this.maxPx - this.minPx;\n var widthPx = Math.abs(this.getMaxPx() - this.getMinPx());\n var valrange = this.getCurrentInterval();\n\n /* Number of px per unit */\n /* Example: width: 1000px\n /* \t\t\t10 - 100 => 11.11\n /*\t\t\t0 - 2 => 500\n /*\t\t\t0 - 0.00005 => 20'000'000\n */\n\n if (!this.isShown()) {\n this.line.setAttribute('display', 'none');\n return 0;\n }\n\n this.line.setAttribute('display', 'block');\n\n if (this.options.scientificScale == true) {\n\n if (this.options.scientificScaleExponent) {\n\n this.scientificExponent = this.options.scientificScaleExponent;\n } else {\n this.scientificExponent = Math.floor(Math.log(Math.max(Math.abs(this.getCurrentMax()), Math.abs(this.getCurrentMin()))) / Math.log(10));\n }\n } else {\n this.scientificExponent = 0;\n }\n\n /************************************/\n /*** DRAWING LABEL ******************/\n /************************************/\n\n this.gridLinePath.primary = '';\n this.gridLinePath.secondary = '';\n\n /*\n var label;\n if ( label = this.getLabel() ) {\n // Sets the label\n this.labelTspan.textContent = label;\n }\n */\n let letter;\n if (!this.options.useKatexForLabel || !this.graph.hasKatexRenderer()) {\n\n if (this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && (this.scientificExponent = this.getEngineeringExponent(this.scientificExponent)) && (letter = this.getExponentGreekLetter(this.scientificExponent))) {\n\n this.preunit = letter;\n this.unitTspan.setAttribute('dx', 0);\n } else if (this.scientificExponent !== 0 && !isNaN(this.scientificExponent)) {\n\n if (this.options.engineeringScale) {\n this.scientificExponent = this.getEngineeringExponent(this.scientificExponent);\n }\n\n this.preunit = '';\n\n this.expTspan.setAttribute('display', 'visible');\n this.expTspanExp.setAttribute('display', 'visible');\n\n this.expTspan.textContent = 'x10';\n this.expTspanExp.textContent = this.scientificExponent;\n } else {\n\n if (!this.options.unit) {\n this.unitTspan.setAttribute('display', 'none');\n }\n\n this.preunit = '';\n this.expTspan.setAttribute('display', 'none');\n this.expTspanExp.setAttribute('display', 'none');\n }\n\n this.writeUnit();\n } else {\n\n let string = this.getLabel();\n /*,\n domEl;*/\n\n if (this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && (this.scientificExponent = this.getEngineeringExponent(this.scientificExponent)) && (letter = this.getExponentGreekLetter(this.scientificExponent))) {\n\n string += letter;\n this.preunitTspan.innerHTML = letter;\n this.preunitTspan.setAttribute('display', 'visible');\n this.unitTspan.setAttribute('dx', 0);\n\n string += ' ' + letter + ' ' + this.options.unit;\n } else if (this.scientificExponent !== 0 && !isNaN(this.scientificExponent)) {\n\n if (this.options.engineeringScale) {\n this.scientificExponent = this.getEngineeringExponent(this.scientificExponent);\n }\n string += ' \\\\cdot 10^' + this.scientificExponent + ' ' + this.options.unit;\n }\n\n this.katexElement = this.graph.renderWithKatex(string, this.katexElement);\n }\n\n if (!this.options.hideTicks) {\n\n this.resetTicksLength();\n\n if (this.linkedToAxis) {\n // px defined, linked to another axis\n\n this.linkedToAxis.deltaPx = 10;\n var widthHeight = this.drawLinkedToAxisTicksWrapper(widthPx, valrange);\n } else if (!this.options.logScale) {\n // So the setting is: How many ticks in total ? Then we have to separate it\n\n var widthHeight = this.drawLinearTicksWrapper(widthPx, valrange);\n } else {\n\n var widthHeight = this.drawLogTicks();\n }\n } else {\n var widthHeight = 0;\n }\n\n this.removeUselessTicks();\n this.removeUselessTickLabels();\n\n this.gridPrimary.setAttribute('d', this.gridLinePath.primary);\n this.gridSecondary.setAttribute('d', this.gridLinePath.secondary);\n\n // Looks for axes linked to this current axis\n var axes = this.graph.findAxesLinkedTo(this);\n axes.forEach(function (axis) {\n\n if (!axis.linkedToAxis) {\n return;\n }\n axis.setMinPx(self.getMinPx());\n axis.setMaxPx(self.getMaxPx());\n\n axis.draw();\n });\n\n /************************************/\n /*** DRAW CHILDREN IMPL SPECIFIC ****/\n /************************************/\n\n // this.drawSpecifics();\n\n return widthHeight;\n }\n\n drawLines() {\n\n if (this.options.lineAt && Array.isArray(this.options.lineAt)) {\n\n this.options.lineAt.forEach((val, index) => {\n\n if (!isNaN(val) && this.getCurrentMin() <= val && this.getCurrentMax() >= val) {\n\n this._lines[index] = this._drawLine(val, this._lines[index]);\n } else {\n this._hideLine(this._lines[index]);\n }\n });\n }\n }\n\n writeUnit() {\n if (this.options.unit) {\n\n this.unitTspan.setAttribute('display', 'visible');\n this.unitTspan.setAttribute('dx', 5);\n\n this.expTspan.setAttribute('display', 'none');\n this.expTspanExp.setAttribute('display', 'none');\n this.unitTspan.innerHTML = (this.options.unitWrapperBefore + this.preunit + this.options.unit + this.options.unitWrapperAfter).replace(/\\^([-+0-9]*)(.*)/g, \"$1$2\");\n } else {\n this.unitTspan.setAttribute('display', 'none');\n }\n }\n\n getExponentGreekLetter(val) {\n\n switch (val) {\n\n case 3:\n {\n return 'k';\n }\n\n case 6:\n {\n return 'M';\n }\n case 9:\n {\n return 'G';\n }\n case 12:\n {\n return 'T';\n }\n case 15:\n {\n return 'E';\n }\n case -3:\n {\n return 'm';\n }\n case -6:\n {\n return 'μ';\n }\n case -9:\n {\n return 'n';\n }\n case -12:\n {\n return 'p';\n }\n case -15:\n {\n return 'f';\n }\n default:\n {\n return '';\n }\n }\n }\n\n drawLinearTicksWrapper(widthPx, valrange) {\n\n let tickPrimaryUnit;\n\n if (this.options.primaryTickUnit) {\n\n tickPrimaryUnit = this.options.primaryTickUnit;\n } else {\n\n tickPrimaryUnit = this.getUnitPerTick(widthPx, this.getNbTicksPrimary(), valrange)[0];\n\n if (this.options.maxPrimaryTickUnit && this.options.maxPrimaryTickUnit < tickPrimaryUnit) {\n tickPrimaryUnit = this.options.maxPrimaryTickUnit;\n } else if (this.options.minPrimaryTickUnit && this.options.minPrimaryTickUnit > tickPrimaryUnit) {\n tickPrimaryUnit = this.options.minPrimaryTickUnit;\n }\n }\n\n // We need to get here the width of the ticks to display the axis properly, with the correct shift\n return this.drawTicks(tickPrimaryUnit, this.secondaryTicks());\n }\n\n forcePrimaryTickUnit(primaryInterval) {\n this.options.primaryTickUnit = primaryInterval;\n }\n\n forcePrimaryTickUnitMax(value) {\n this.options.maxPrimaryTickUnit = value;\n }\n\n forcePrimaryTickUnitMin(value) {\n this.options.minPrimaryTickUnit = value;\n }\n\n getPrimaryTickUnit() {\n return this.incrTick;\n }\n\n setTickLabelRatio(tickRatio) {\n this.options.ticklabelratio = tickRatio;\n }\n\n doesHideWhenNoSeriesShown() {\n return this.options.hideWhenNoSeriesShown;\n }\n\n draw() {\n\n this._widthLabels = 0;\n var drawn = this._draw();\n this._widthLabels += drawn;\n return drawn;\n }\n\n drawTicks(primary, secondary) {\n\n var unitPerTick = primary,\n min = this.getCurrentMin(),\n max = this.getCurrentMax(),\n secondaryIncr,\n incrTick,\n subIncrTick,\n loop = 0;\n\n if (secondary) {\n secondaryIncr = unitPerTick / secondary;\n }\n\n incrTick = this.options.shiftToZero ? this.dataMin - Math.ceil((this.dataMin - min) / unitPerTick) * unitPerTick : Math.floor(min / unitPerTick) * unitPerTick;\n this.incrTick = primary;\n\n while (incrTick <= max) {\n\n loop++;\n if (loop > 200) {\n break;\n }\n\n if (secondary) {\n\n subIncrTick = incrTick + secondaryIncr;\n this.subIncrTick = subIncrTick;\n //widthHeight = Math.max(widthHeight, this.drawTick(subIncrTick, 1));\n var loop2 = 0;\n\n while (subIncrTick < incrTick + unitPerTick) {\n loop2++;\n if (loop2 > 100) {\n break;\n }\n\n if (subIncrTick < min || subIncrTick > max) {\n subIncrTick += secondaryIncr;\n continue;\n }\n\n this.drawTickWrapper(subIncrTick, false, Math.abs(subIncrTick - incrTick - unitPerTick / 2) < 1e-4 ? 2 : 3);\n\n subIncrTick += secondaryIncr;\n }\n }\n\n if (incrTick < min || incrTick > max) {\n incrTick += primary;\n continue;\n }\n\n this.drawTickWrapper(incrTick, true, 1);\n incrTick += primary;\n }\n\n this.widthHeightTick = this.getMaxSizeTick();\n return this.widthHeightTick;\n }\n\n nextTick(level, callback) {\n\n this.ticks[level] = this.ticks[level] || [];\n this.lastCurrentTick[level] = this.lastCurrentTick[level] || 0;\n this.currentTick[level] = this.currentTick[level] || 0;\n\n if (this.currentTick[level] >= this.ticks[level].length) {\n var tick = document.createElementNS(this.graph.ns, 'line');\n this.groupTicks.appendChild(tick);\n this.ticks[level].push(tick);\n\n callback(tick);\n }\n\n var tick = this.ticks[level][this.currentTick[level]];\n\n if (this.currentTick[level] >= this.lastCurrentTick[level]) {\n tick.setAttribute('display', 'visible');\n }\n\n this.currentTick[level]++;\n\n return tick;\n }\n\n nextTickLabel(callback) {\n\n this.ticksLabels = this.ticksLabels || [];\n this.lastCurrentTickLabel = this.lastCurrentTickLabel || 0;\n this.currentTickLabel = this.currentTickLabel || 0;\n\n if (this.currentTickLabel >= this.ticksLabels.length) {\n\n var tickLabel = document.createElementNS(this.graph.ns, 'text');\n this.groupTickLabels.appendChild(tickLabel);\n this.ticksLabels.push(tickLabel);\n callback(tickLabel);\n }\n\n var tickLabel = this.ticksLabels[this.currentTickLabel];\n\n if (this.currentTickLabel >= this.lastCurrentTickLabel) {\n tickLabel.setAttribute('display', 'visible');\n }\n\n this.currentTickLabel++;\n\n return tickLabel;\n }\n\n removeUselessTicks() {\n\n for (var j in this.currentTick) {\n\n for (var i = this.currentTick[j]; i < this.ticks[j].length; i++) {\n this.ticks[j][i].setAttribute('display', 'none');\n }\n\n this.lastCurrentTick[j] = this.currentTick[j];\n this.currentTick[j] = 0;\n }\n }\n\n removeUselessTickLabels() {\n\n for (var i = this.currentTickLabel; i < this.ticksLabels.length; i++) {\n this.ticksLabels[i].setAttribute('display', 'none');\n }\n\n this.lastCurrentTickLabel = this.currentTickLabel;\n this.currentTickLabel = 0;\n }\n /*\n doGridLine() {\n var gridLine = document.createElementNS( this.graph.ns, 'line' );\n this.groupGrids.appendChild( gridLine );\n return gridLine;\n };*/\n\n nextGridLine(primary, x1, x2, y1, y2) {\n\n if (!(primary && this.options.primaryGrid || !primary && this.options.secondaryGrid)) {\n return;\n }\n\n this.gridLinePath[primary ? 'primary' : 'secondary'] += 'M ' + x1 + ' ' + y1 + ' L ' + x2 + ' ' + y2;\n }\n\n setGridLineStyle(gridLine, primary) {\n\n gridLine.setAttribute('shape-rendering', 'crispEdges');\n gridLine.setAttribute('stroke', primary ? this.getPrimaryGridColor() : this.getSecondaryGridColor());\n gridLine.setAttribute('stroke-width', primary ? this.getPrimaryGridWidth() : this.getSecondaryGridWidth());\n gridLine.setAttribute('stroke-opacity', primary ? this.getPrimaryGridOpacity() : this.getSecondaryGridOpacity());\n\n var dasharray;\n if (dasharray = primary ? this.getPrimaryGridDasharray() : this.getSecondaryGridDasharray()) {\n gridLine.setAttribute('stroke-dasharray', dasharray);\n }\n }\n\n setGridLinesStyle() {\n this.setGridLineStyle(this.gridPrimary, true);\n this.setGridLineStyle(this.gridSecondary, false);\n return this;\n }\n\n resetTicksLength() {}\n\n secondaryTicks() {\n return this.options.nbTicksSecondary;\n }\n\n drawLogTicks() {\n var min = this.getCurrentMin(),\n max = this.getCurrentMax();\n var incr = Math.min(min, max);\n var max = Math.max(min, max);\n\n if (incr < 1e-50) {\n incr = 1e-50;\n }\n\n if (Math.log(incr) - Math.log(max) > 20) {\n max = Math.pow(10, Math.log(incr) * 20);\n }\n\n var optsMain = {\n fontSize: '1.0em',\n exponential: true,\n overwrite: false\n };\n\n if (incr < 0) {\n incr = 0;\n }\n\n var pow = incr == 0 ? 0 : Math.floor(Math.log(incr) / Math.log(10));\n var incr = 1,\n val;\n while ((val = incr * Math.pow(10, pow)) < max) {\n if (incr == 1) {\n // Superior power\n if (val > min) this.drawTickWrapper(val, true, 1, optsMain);\n }\n if (incr == 10) {\n incr = 1;\n pow++;\n } else {\n\n if (incr != 1 && val > min) {\n\n this.drawTickWrapper(val, false, 2, {\n overwrite: '',\n fontSize: '0.6em'\n });\n }\n\n incr++;\n }\n }\n\n this.widthHeightTick = this.getMaxSizeTick();\n return this.widthHeightTick;\n }\n\n drawTickWrapper(value, label, level, options) {\n\n //var pos = this.getPos( value );\n\n this.drawTick(value, level, options);\n }\n\n /**\n * Used to scale the master axis into the slave axis\n * @function SlaveAxisScalingFunction\n * @param {Number} val - The master value to convert into a slave value\n * @returns undefined\n */\n\n /**\n * Makes this axis a slave. This can be used to show the same data with different units, specifically when a conversion function exists from axis -> slaveAxis but not in reverse. This axis should actually have no series.\n * @param {Axis} axis - The master axis\n * @param {SlaveAxisScalingFunction} scalingFunction - The scaling function used to map masterValue -> slaveValue\n * @param {Number} decimals - The number of decimals to round the value to\n * @memberof Axis\n * @return {Number} The width or height used by the axis (used internally)\n */\n linkToAxis(axis, scalingFunction, decimals) {\n\n this.linkedToAxis = {\n axis: axis,\n scalingFunction: scalingFunction,\n decimals: decimals || 1\n };\n }\n\n drawLinkedToAxisTicksWrapper(widthPx, valrange) {\n\n var opts = this.linkedToAxis,\n px = 0,\n val,\n t,\n l,\n delta2;\n\n // Redrawing the main axis ? Why ?\n //opts.axis.draw();\n\n if (!opts.deltaPx) {\n opts.deltaPx = 10;\n }\n\n do {\n\n val = opts.scalingFunction(opts.axis.getVal(px + this.getMinPx()));\n\n if (opts.decimals) {\n this.decimals = opts.decimals;\n }\n\n t = this.drawTick(val, 1, {}, px + this.getMinPx());\n\n if (!t) {\n console.error(val, px, this.getMinPx());\n throw new Error('Unable to draw tick. Please report the test-case');\n }\n\n l = String(t[1].textContent).length * 8;\n delta2 = Math.round(l / 5) * 5;\n\n if (delta2 > opts.deltaPx) {\n opts.deltaPx = delta2;\n // this.drawInit();\n this.drawLinkedToAxisTicksWrapper(widthPx, valrange);\n return;\n }\n\n px += opts.deltaPx;\n } while (px < widthPx);\n }\n\n /**\n * Transform a value into pixels, according to the axis scaling. The value is referenced to the drawing wrapper, not the the axis minimal value\n * @param {Number} value - The value to translate into pixels\n * @memberof Axis\n * @return {Number} The value transformed into pixels\n */\n getPos(value) {\n return this.getPx(value);\n }\n\n /**\n * @alias Axis~getPos\n */\n getPx(value) {\n // if(this.getMaxPx() == undefined)\n // console.log(this);\n //console.log(this.getMaxPx(), this.getMinPx(), this.getCurrentInterval());\n // Ex 50 / (100) * (1000 - 700) + 700\n\n //console.log( value, this.getCurrentMin(), this.getMaxPx(), this.getMinPx(), this.getCurrentInterval() );\n\n if (!this.options.logScale) {\n\n return (value - this.getCurrentMin()) / this.getCurrentInterval() * (this.getMaxPx() - this.getMinPx()) + this.getMinPx();\n } else {\n // 0 if value = min\n // 1 if value = max\n\n if (value < 0) return;\n\n var value = (Math.log(value) - Math.log(this.getCurrentMin())) / (Math.log(this.getCurrentMax()) - Math.log(this.getCurrentMin())) * (this.getMaxPx() - this.getMinPx()) + this.getMinPx();\n\n return value;\n }\n }\n\n /**\n * @alias Axis~getPos\n */\n getRoundedPx(value) {\n // if(this.getMaxPx() == undefined)\n // console.log(this);\n //console.log(this.getMaxPx(), this.getMinPx(), this.getCurrentInterval());\n // Ex 50 / (100) * (1000 - 700) + 700\n\n //console.log( value, this.getCurrentMin(), this.getMaxPx(), this.getMinPx(), this.getCurrentInterval() );\n return Math.round(this.getPx(value) * 10) / 10;\n }\n\n /**\n * Transform a pixel position (referenced to the graph zone, not to the axis minimum) into a value, according to the axis scaling.\n * @param {Number} pixels - The number of pixels to translate into a value\n * @memberof Axis\n * @return {Number} The axis value corresponding to the pixel position\n */\n getVal(px) {\n\n if (!this.options.logScale) {\n\n return (px - this.getMinPx()) / (this.getMaxPx() - this.getMinPx()) * this.getCurrentInterval() + this.getCurrentMin();\n } else {\n\n return Math.exp((px - this.getMinPx()) / (this.getMaxPx() - this.getMinPx()) * (Math.log(this.getCurrentMax()) - Math.log(this.getCurrentMin())) + Math.log(this.getCurrentMin()));\n }\n }\n\n /**\n * Transform a delta value into pixels\n * @param {Number} value - The value to translate into pixels\n * @return {Number} The value transformed into pixels\n * @example graph.getBottomAxis().forceMin( 20 ).forceMax( 50 ).getRelPx( 2 ); // Returns how many pixels will be covered by 2 units. Let's assume 600px of width, it's ( 2 / 30 ) * 600 = 40px\n */\n getRelPx(delta) {\n\n return delta / this.getCurrentInterval() * (this.getMaxPx() - this.getMinPx());\n }\n\n /**\n * Transform a delta pixels value into value\n * @param {Number} pixels - The pixel to convert into a value\n * @return {Number} The delta value corresponding to delta pixels\n * @see Axis~getRelPx\n * @example graph.getBottomAxis().forceMin( 20 ).forceMax( 50 ).getRelVal( 40 ); // Returns 2 (for 600px width)\n */\n getRelVal(px) {\n return px / (this.getMaxPx() - this.getMinPx()) * this.getCurrentInterval();\n }\n\n valueToText(value) {\n\n if (this.scientificExponent) {\n\n value /= Math.pow(10, this.scientificExponent);\n return value.toFixed(1);\n } else {\n\n value = value * Math.pow(10, this.getExponentialFactor()) * Math.pow(10, this.getExponentialLabelFactor());\n if (this.options.shiftToZero) {\n value -= this.dataMin;\n }\n if (this.options.ticklabelratio) {\n value *= this.options.ticklabelratio;\n }\n if (this.options.unitModification) {\n value = this.modifyUnit(value, this.options.unitModification);\n return value;\n }\n\n var dec = this.decimals - this.getExponentialFactor() - this.getExponentialLabelFactor();\n\n if (isNaN(value)) {\n return '';\n }\n\n if (dec > 0) {\n value = value.toFixed(dec);\n } else {\n value = value.toFixed(0);\n }\n\n if (this.options.unitInTicks && this.options.unit) {\n value += ' ' + this.options.unit;\n }\n\n return value;\n }\n }\n\n /**\n * Computes a value and returns it in HTML formatting\n * @memberof Axis\n * @param {Number} value - The value to compute\n * @param {Boolean} noScaling - Does not display scaling\n * @param {Boolean} noUnits - Does not display units\n * @return {String} An HTML string containing the computed value\n * @example graph.getXAxis().setUnit( \"m\" ).setUnitDecade( true ).setScientific( true );\n * graph.getXAxis().valueToHtml( 3500 ); // Returns \"3.5 km\"\n * @see Axis#valueToText\n */\n valueToHtml(value, noScaling, noUnits) {\n\n var text = this.valueToText(value);\n var letter;\n\n if (this.options.unitDecade && this.options.unit && this.scientificExponent !== 0 && (this.scientificExponent = this.getEngineeringExponent(this.scientificExponent)) && (letter = this.getExponentGreekLetter(this.scientificExponent))) {\n\n text += letter;\n } else if (this.scientificExponent !== 0 && !isNaN(this.scientificExponent) && !noScaling) {\n text += 'x10';\n text += '' + this.scientificExponent + '';\n }\n\n if (this.options.unit && !noUnits) {\n\n text += this.options.unit.replace(/\\^([-+0-9]*)/g, '$1');\n }\n\n return text;\n }\n\n getModifiedValue(value) {\n if (this.options.ticklabelratio) {\n value *= this.options.ticklabelratio;\n }\n\n if (this.options.shiftToZero) {\n value -= this.getMinValue() * (this.options.ticklabelratio || 1);\n }\n\n return value;\n }\n\n modifyUnit(value, mode) {\n\n var text = '';\n var incr = this.incrTick;\n var umin;\n\n switch (mode) {\n\n case 'time':\n // val must be in seconds => transform in hours / days / months\n var max = this.getModifiedValue(this.getMaxValue()),\n units = [[60, 'min'], [3600, 'h'], [3600 * 24, 'd']];\n\n if (max < 3600) {\n // to minutes\n umin = 0;\n } else if (max < 3600 * 24) {\n umin = 1;\n } else if (max < 3600 * 24 * 30) {\n umin = 2;\n }\n\n if (!units[umin]) {\n return false;\n }\n\n value = value / units[umin][0];\n var valueRounded = Math.floor(value);\n text = valueRounded + units[umin][1];\n\n // Addind lower unit for precision\n umin--;\n while (incr < 1 * units[umin + 1][0] && umin > -1) {\n\n value = (value - valueRounded) * units[umin + 1][0] / units[umin][0];\n valueRounded = Math.round(value);\n text += ' ' + valueRounded + units[umin][1];\n umin--;\n }\n\n break;\n\n case 'time:min.sec':\n value = value / 60;\n var valueRounded = Math.floor(value);\n var s = Math.round((value - valueRounded) * 60) + '';\n s = s.length == 1 ? '0' + s : s;\n text = valueRounded + '.' + s;\n break;\n\n default:\n break;\n }\n\n return text;\n }\n\n getExponentialFactor() {\n return this.options.exponentialFactor;\n }\n\n setExponentialFactor(value) {\n this.options.exponentialFactor = value;\n }\n\n setExponentialLabelFactor(value) {\n this.options.exponentialLabelFactor = value;\n }\n\n getExponentialLabelFactor() {\n return this.options.exponentialLabelFactor;\n }\n\n /**\n * Sets the label of the axis\n * @param {Number} label - The label to display under the axis\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setLabel(label) {\n this.options.labelValue = label;\n return this;\n }\n\n setLabelFont(font) {\n this.options.labelFont = font;\n return this;\n }\n\n /**\n * @memberof Axis\n * @return {String} The label value\n */\n getLabel() {\n return this.options.labelValue;\n }\n\n setSpan(_from, _to) {\n\n this.options.span = [_from, _to];\n return this;\n }\n\n getSpan() {\n return this.options.span;\n }\n\n setLevel(level) {\n this._level = level;\n return this;\n }\n\n getLevel() {\n return this._level;\n }\n\n setShift(shift) {\n this.shift = shift;\n }\n\n getShift() {\n return this.shift;\n }\n\n /**\n * Changes the tick position\n * @param {Number} pos - The new position ( \"outside\", \"centered\" or \"inside\" )\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setTickPosition(pos) {\n switch (pos) {\n case 3:\n case 'outside':\n case Graph$1.TICKS_OUTSIDE:\n {\n pos = 3;\n break;\n }\n\n case 2:\n case 'centered':\n case Graph$1.TICKS_CENTERED:\n {\n pos = 2;\n break;\n }\n\n case 1:\n case 'inside':\n case Graph$1.TICKS_INSIDE:\n default:\n {\n pos = 1;\n break;\n }\n }\n\n this.options.tickPosition = pos;\n\n switch (this.options.tickPosition) {\n case 3:\n this.tickPx1 = -2;\n this.tickPx2 = 0;\n break;\n\n case 2:\n this.tickPx1 = -1;\n this.tickPx2 = 1;\n break;\n\n default:\n case 1:\n this.tickPx1 = 0;\n this.tickPx2 = 2;\n break;\n }\n\n return this;\n }\n\n /**\n * Displays or hides the axis grids\n * @param {Boolean} on - true to enable the grids, false to disable them\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setGrids(on) {\n this.options.primaryGrid = on;\n this.options.secondaryGrid = on;\n return this;\n }\n\n /**\n * Displays or hides the axis primary grid\n * @param {Boolean} on - true to enable the grids, false to disable it\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setPrimaryGrid(on) {\n this.options.primaryGrid = on;\n return this;\n }\n\n /**\n * Displays or hides the axis secondary grid\n * @param {Boolean} on - true to enable the grids, false to disable it\n * @memberof Axis\n * @return {Axis} The current axis\n */\n setSecondaryGrid(on) {\n this.options.secondaryGrid = on;\n return this;\n }\n\n /**\n * Enables primary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n primaryGridOn() {\n return this.setPrimaryGrid(true);\n }\n\n /**\n * Disables primary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n primaryGridOff() {\n return this.setPrimaryGrid(false);\n }\n\n /**\n * Enables secondary grid\n * @memberof Axis\n * @return {Axis} The current axis\n */\n secondaryGridOn() {\n return this.setSecondaryGrid(true);\n }\n\n /**\n * Disables secondary grid\n * @return {Axis} The current axis\n */\n secondaryGridOff() {\n return this.setSecondaryGrid(false);\n }\n\n /**\n * Enables all the grids\n * @return {Axis} The current axis\n */\n gridsOn() {\n return this.setGrids(true);\n }\n\n /**\n * Disables all the grids\n * @return {Axis} The current axis\n */\n gridsOff() {\n return this.setGrids(false);\n }\n\n /**\n * @alias Axis#gridsOff\n */\n turnGridsOff() {\n return this.gridsOff(...arguments);\n }\n\n /**\n * @alias Axis#gridsOn\n */\n turnGridsOn() {\n return this.gridsOn(...arguments);\n }\n\n /**\n * Sets the axis color\n * @memberof Axis\n * @param {String} color - The color to set the axis\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setAxisColor(color) {\n this.options.axisColor = color;\n return this;\n }\n\n /**\n * Gets the axis color\n * @memberof Axis\n * @return {String} The color of the axis\n * @since 1.13.2\n */\n getAxisColor() {\n return this.options.axisColor || 'black';\n }\n\n setTickLabelOffset(offsetValue) {\n this.options.tickLabelOffset = offsetValue;\n return this;\n }\n\n /**\n * Sets the color of the main ticks\n * @memberof Axis\n * @param {String} color - The new color of the primary ticks\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setPrimaryTicksColor(color) {\n this.options.primaryTicksColor = color;\n return this;\n }\n\n /**\n * Gets the color of the main ticks\n * @memberof Axis\n * @return {String} The color of the primary ticks\n * @since 1.13.2\n */\n getPrimaryTicksColor() {\n return this.options.primaryTicksColor || 'black';\n }\n\n /**\n * Sets the color of the secondary ticks\n * @memberof Axis\n * @param {String} color - The new color of the secondary ticks\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setSecondaryTicksColor(color) {\n this.options.secondaryTicksColor = color;\n return this;\n }\n\n /**\n * Gets the color of the secondary ticks\n * @memberof Axis\n * @return {String} The color of the secondary ticks\n * @since 1.13.2\n */\n getSecondaryTicksColor() {\n return this.options.secondaryTicksColor || 'black';\n }\n\n /**\n * Sets the color of the tick labels\n * @memberof Axis\n * @param {String} color - The new color of the tick labels\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setTicksLabelColor(color) {\n this.options.ticksLabelColor = color;\n if (Array.isArray(this.ticksLabels)) {\n this.ticksLabels.forEach(tick => {\n tick.setAttribute('fill', color);\n });\n }\n return this;\n }\n\n /**\n * Gets the color of the tick labels\n * @memberof Axis\n * @return {String} The color of the tick labels\n * @since 1.13.2\n */\n getTicksLabelColor() {\n return this.options.ticksLabelColor || 'black';\n }\n\n /**\n * Sets the color of the primary grid\n * @memberof Axis\n * @param {String} color - The primary grid color\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridColor(color) {\n this.options.primaryGridColor = color;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the color of the primary grid\n * @memberof Axis\n * @return {String} color - The primary grid color\n * @since 1.13.3\n */\n getPrimaryGridColor() {\n return this.options.primaryGridColor;\n }\n\n /**\n * Sets the color of the primary grid\n * @memberof Axis\n * @param {String} color - The primary grid color\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridColor(color) {\n this.options.secondaryGridColor = color;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the color of the secondary grid\n * @memberof Axis\n * @return {String} color - The secondary grid color\n * @since 1.13.3\n */\n getSecondaryGridColor() {\n return this.options.secondaryGridColor;\n }\n\n /**\n * Sets the width of the primary grid lines\n * @memberof Axis\n * @param {Number} width - The width of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridWidth(width) {\n this.options.primaryGridWidth = width;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the width of the primary grid lines\n * @memberof Axis\n * @return {Number} width - The width of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridWidth() {\n return this.options.primaryGridWidth;\n }\n\n /**\n * Sets the width of the secondary grid lines\n * @memberof Axis\n * @param {Number} width - The width of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridWidth(width) {\n this.options.secondaryGridWidth = width;\n this.setGridLinesStyle();\n return this;\n }\n\n /**\n * Gets the width of the secondary grid lines\n * @memberof Axis\n * @return {Number} width - The width of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridWidth() {\n return this.options.secondaryGridWidth;\n }\n\n /**\n * Sets the opacity of the primary grid lines\n * @memberof Axis\n * @param {Number} opacity - The opacity of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridOpacity(opacity) {\n this.options.primaryGridOpacity = opacity;\n return this;\n }\n\n /**\n * Gets the opacity of the primary grid lines\n * @memberof Axis\n * @return {Number} opacity - The opacity of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridOpacity() {\n return this.options.primaryGridOpacity;\n }\n\n /**\n * Sets the opacity of the secondary grid lines\n * @memberof Axis\n * @param {Number} opacity - The opacity of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridOpacity(opacity) {\n this.options.secondaryGridOpacity = opacity;\n return this;\n }\n\n /**\n * Gets the opacity of the secondary grid lines\n * @memberof Axis\n * @return {Number} opacity - The opacity of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridOpacity() {\n return this.options.secondaryGridOpacity;\n }\n\n /**\n * Sets the dasharray of the primary grid lines\n * @memberof Axis\n * @param {String} dasharray - The dasharray of the primary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setPrimaryGridDasharray(dasharray) {\n this.options.primaryGridDasharray = dasharray;\n return this;\n }\n\n /**\n * Gets the dasharray of the primary grid lines\n * @memberof Axis\n * @return {String} dasharray - The dasharray of the primary grid lines\n * @since 1.13.3\n */\n getPrimaryGridDasharray() {\n return this.options.primaryGridDasharray;\n }\n\n /**\n * Sets the dasharray of the secondary grid lines\n * @memberof Axis\n * @param {String} dasharray - The dasharray of the secondary grid lines\n * @return {Axis} The current axis\n * @since 1.13.3\n */\n setSecondaryGridDasharray(dasharray) {\n this.options.secondaryGridDasharray = dasharray;\n return this;\n }\n\n /**\n * Gets the dasharray of the secondary grid lines\n * @memberof Axis\n * @return {String} dasharray - The dasharray of the secondary grid lines\n * @since 1.13.3\n */\n getSecondaryGridDasharray() {\n return this.options.secondaryGridDasharray;\n }\n\n /**\n * Sets the color of the label\n * @memberof Axis\n * @param {String} color - The new color of the label\n * @return {Axis} The current axis\n * @since 1.13.2\n */\n setLabelColor(color) {\n this.options.labelColor = color;\n return this;\n }\n\n /**\n * Gets the color of the label\n * @memberof Axis\n * @return {String} The color of the label\n * @since 1.13.2\n */\n getLabelColor() {\n return this.options.labelColor;\n }\n\n setTickContent(dom, val, options) {\n if (!options) options = {};\n\n if (options.overwrite || !options.exponential) {\n\n dom.textContent = options.overwrite || this.valueToText(val);\n } else {\n var log = Math.round(Math.log(val) / Math.log(10));\n var unit = Math.floor(val * Math.pow(10, -log));\n\n dom.textContent = unit != 1 ? unit + 'x10' : '10';\n var tspan = document.createElementNS(this.graph.ns, 'tspan');\n tspan.textContent = log;\n tspan.setAttribute('font-size', '0.7em');\n tspan.setAttribute('dy', -5);\n dom.appendChild(tspan);\n }\n\n if (options.fontSize) {\n dom.setAttribute('font-size', options.fontSize);\n }\n }\n\n /**\n * @memberof Axis\n * @returns {Boolean} true if it is an x axis, false otherwise\n */\n isX() {\n return false;\n }\n\n /**\n * @memberof Axis\n * @returns {Boolean} true if it is an y axis, false otherwise\n */\n isY() {\n return false;\n }\n\n /**\n * Sets the unit of the axis\n * @param {String} unit - The unit of the axis\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setUnit(unit) {\n this.options.unit = unit;\n return this;\n }\n\n /**\n * Places the unit in every tick\n * @param {Boolean} bool - ```true``` to place the unit, ```false``` otherwise\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 2.0.44\n */\n setUnitInTicks(bool) {\n this.options.unitInTicks = bool;\n return this;\n }\n\n /**\n * Sets characters wrapping the unit\n * @param {String} before - The string to insert before\n * @param {String} after - The string to insert after\n * @return {Axis} The current axis\n * @memberof Axis\n * @example axis.setUnitWrapper(\"[\", \"]\").setUnit('m'); // Will display [m]\n * @since 1.13.3\n */\n setUnitWrapper(before, after) {\n this.options.unitWrapperBefore = before;\n this.options.unitWrapperAfter = after;\n return this;\n }\n\n /**\n * Allows the unit to scale with thousands\n * @param {Boolean} on - Enables this mode\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setUnitDecade(on) {\n this.options.unitDecade = on;\n return this;\n }\n\n /**\n * Enable the scientific mode for the axis values. This way, big numbers can be avoided, e.g. \"1000000000\" would be displayed 1 with 109 or \"G\" shown on near the axis unit.\n * @param {Boolean} on - Enables the scientific mode\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setScientific(on) {\n this.options.scientificScale = on;\n return this;\n }\n\n /**\n * In the scientific mode, forces the axis to take a specific power of ten. Useful if you want to show kilometers instead of meters for example. In this case you would use \"3\" as a value.\n * @param {Number} scientificScaleExponent - Forces the scientific scale to take a defined power of ten\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n * @see Axis#setScientific\n */\n setScientificScaleExponent(scientificScaleExponent) {\n this.options.scientificScaleExponent = scientificScaleExponent;\n return this;\n }\n\n /**\n * The engineer scaling is similar to the scientific scaling ({@link Axis#setScientificScale}) but allowing only mupltiples of 3 to be used to scale the axis (for instance, go from grams to kilograms while skipping decagrams and hexagrams)\n * @param {Boolean} engineeringScaling - true to turn on the engineering scaling\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n * @see Axis#setScientific\n */\n setEngineering(engineeringScaling) {\n //bool\n this.options.scientificScale = engineeringScaling;\n this.options.engineeringScale = engineeringScaling;\n return this;\n }\n\n /**\n * Calculates the closest engineering exponent from a scientific exponent\n * @param {Number} scientificExponent - The exponent of 10 based on which the axis will be scaled\n * @return {Number} The appropriate engineering exponent\n * @memberof Axis\n * @since 1.13.3\n * @private\n */\n getEngineeringExponent(scientificExponent) {\n\n if (scientificExponent > 0) {\n scientificExponent -= scientificExponent % 3;\n } else {\n scientificExponent -= (3 - -scientificExponent % 3) % 3;\n }\n\n return scientificExponent;\n }\n\n /**\n * Enables log scaling\n * @param {Boolean} logScale - ```true``` to enable the log scaling, ```false``` to disable it\n * @return {Axis} The current axis\n * @memberof Axis\n * @since 1.13.3\n */\n setLogScale(log) {\n this.options.logScale = log;\n return this;\n }\n\n isZoomed() {\n return !(this.currentAxisMin == this.getMinValue() || this.currentAxisMax == this.getMaxValue());\n }\n\n hasAxis() {\n return false;\n }\n\n getType() {\n return null;\n }\n\n useKatexForLabel(use = true) {\n this.options.useKatexForLabel = use;\n return this;\n }\n\n}\n\n/**\n * @alias Axis#getVal\n */\nAxis.prototype.getValue = Axis.prototype.getVal;\n\n/**\n * @alias Axis#getRelPx\n */\nAxis.prototype.getDeltaPx = Axis.prototype.getRelPx;\n\n/**\n * Generic constructor of a y axis\n * @augments Axis\n */\nclass AxisX extends Axis {\n\n constructor(graph, topbottom, options = {}) {\n\n super(graph, topbottom, options);\n this.top = topbottom == 'top';\n }\n\n /**\n * @private\n * Returns the position of the axis, used by refreshDrawingZone in core module\n */\n getAxisPosition() {\n\n if (!this.options.display) {\n return 0;\n }\n\n let size;\n\n if (this.options.tickLabelOffset == 0) {\n // Normal mode, no offset\n size = this.options.tickPosition == 1 ? 8 : 20;\n size += this.graph.options.fontSize * 1;\n } else {\n // With an offset, and ticks inside, axis position is actually 0. Otherwise, it's the heights of the ticks\n size = this.options.tickPosition == 1 ? 0 : 12;\n }\n\n if (this.getLabel()) {\n size += this.graph.options.fontSize;\n }\n\n return size;\n }\n\n /**\n * @returns {Boolean} always ```true```\n */\n isX() {\n return true;\n }\n\n /**\n * @returns {Boolean} always ```false```\n */\n isY() {\n return false;\n }\n\n /**\n * @private\n * Used to set the x position of the axis\n */\n setShift(shift) {\n\n this.shift = shift;\n if (this.getShift() === undefined || !this.graph.getDrawingHeight()) {\n return;\n }\n\n this.group.setAttribute('transform', 'translate(0 ' + (this.floating ? this.getShift() : this.top ? this.shift : this.graph.getDrawingHeight() - this.shift) + ')');\n }\n\n /**\n * Caclulates the maximum tick height\n * @return {Number} The maximum tick height\n */\n getMaxSizeTick() {\n return (this.top ? -1 : 1) * (this.options.tickPosition == 1 ? 10 : 10);\n }\n\n /**\n * Draws a tick. Mostly used internally but it can be useful if you want to make your own axes\n * @param {Number} value - The value in axis unit to place the tick\n * @param {Number} level - The importance of the tick\n * @param {Object} options - Further options to be passed to ```setTickContent```\n * @param {Number} forcedPos - Forces the position of the tick (for axis dependency)\n */\n drawTick(value, level, options, forcedPos) {\n\n var self = this,\n val;\n\n val = forcedPos || this.getPos(value);\n\n if (val == undefined || isNaN(val)) {\n return;\n }\n\n var tick = this.nextTick(level, function (tick) {\n\n tick.setAttribute('y1', (self.top ? 1 : -1) * self.tickPx1 * self.tickScaling[level]);\n tick.setAttribute('y2', (self.top ? 1 : -1) * self.tickPx2 * self.tickScaling[level]);\n\n if (level == 1) {\n tick.setAttribute('stroke', self.getPrimaryTicksColor());\n } else {\n tick.setAttribute('stroke', self.getSecondaryTicksColor());\n }\n });\n\n // tick.setAttribute( 'shape-rendering', 'crispEdges' );\n tick.setAttribute('x1', val);\n tick.setAttribute('x2', val);\n\n this.nextGridLine(level == 1, val, val, 0, this.graph.getDrawingHeight());\n\n // this.groupTicks.appendChild( tick );\n if (level == 1) {\n var tickLabel = this.nextTickLabel(tickLabel => {\n\n tickLabel.setAttribute('y', (self.top ? -1 : 1) * ((self.options.tickPosition == 1 ? 8 : 20) + (self.top ? 10 : 0)) + this.options.tickLabelOffset);\n tickLabel.setAttribute('text-anchor', 'middle');\n if (self.getTicksLabelColor() !== 'black') {\n tickLabel.setAttribute('fill', self.getTicksLabelColor());\n }\n tickLabel.style.dominantBaseline = 'hanging';\n });\n\n tickLabel.setAttribute('x', val);\n this.setTickContent(tickLabel, value, options);\n }\n // this.ticks.push( tick );\n\n return [tick, tickLabel];\n }\n\n drawLabel() {\n // Place label correctly\n\n if (this.getLabelColor() !== 'black') {\n this.label.setAttribute('fill', this.getLabelColor());\n }\n\n if (this.options.labelFont) {\n this.label.setAttribute('font-family', this.options.labelFont);\n }\n\n this.label.setAttribute('text-anchor', 'middle');\n this.label.setAttribute('style', 'display: initial;');\n this.label.setAttribute('x', Math.abs(this.getMaxPx() + this.getMinPx()) / 2);\n this.label.setAttribute('y', (this.top ? -1 : 1) * ((this.options.tickPosition == 1 ? 10 : 25) + this.graph.options.fontSize));\n this.labelTspan.textContent = this.getLabel();\n }\n\n draw() {\n var tickWidth = super.draw(...arguments);\n this.drawSpecifics();\n\n return tickWidth;\n }\n /**\n * Paints the label, the axis line and anything else specific to x axes\n */\n drawSpecifics() {\n\n // Adjusts group shift\n //this.group.setAttribute('transform', 'translate(0 ' + this.getShift() + ')');\n\n this.drawLabel();\n\n this.line.setAttribute('x1', this.getMinPx());\n this.line.setAttribute('x2', this.getMaxPx());\n this.line.setAttribute('y1', 0);\n this.line.setAttribute('y2', 0);\n\n this.line.setAttribute('stroke', this.getAxisColor());\n\n if (!this.top) {\n\n this.labelTspan.style.dominantBaseline = 'hanging';\n this.expTspan.style.dominantBaseline = 'hanging';\n this.expTspanExp.style.dominantBaseline = 'hanging';\n\n this.unitTspan.style.dominantBaseline = 'hanging';\n // this.preunitTspan.style.dominantBaseline = 'hanging';\n }\n\n var span = this.getSpan();\n this.line.setAttribute('marker-start', !this.options.splitMarks || span[0] == 0 ? '' : 'url(#horionzalsplit_' + this.graph.getId() + ')');\n this.line.setAttribute('marker-end', !this.options.splitMarks || span[1] == 1 ? '' : 'url(#horionzalsplit_' + this.graph.getId() + ')');\n }\n\n /**\n * @private\n */\n _drawLine(pos, line) {\n\n let px = this.getPx(pos);\n\n if (!line) {\n line = document.createElementNS(this.graph.ns, 'line');\n } else {\n line.setAttribute('display', 'initial');\n }\n\n line.setAttribute('x1', px);\n line.setAttribute('x2', px);\n\n line.setAttribute('y1', 0);\n line.setAttribute('y2', this.graph.drawingSpaceHeight);\n\n line.setAttribute('stroke', 'black');\n this.group.appendChild(line);\n\n return line;\n }\n\n _hideLine(line) {\n if (!line) {\n return;\n }\n line.setAttribute('display', 'none');\n }\n\n /**\n * @private\n */\n handleMouseMoveLocal(x) {\n // handleMouseMoveLocal( x, y, e )\n x -= this.graph.getPaddingLeft();\n this.mouseVal = this.getVal(x);\n }\n\n /**\n * Caches the minimum px and maximum px position of the axis. Includes axis spans and flipping. Mostly used internally\n */\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n\n if (isNaN(interval)) {\n return;\n }\n\n var maxPx = interval * this.options.span[1] + this.minPx - this.options.marginMax;\n var minPx = interval * this.options.span[0] + this.minPx + this.options.marginMin;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n }\n\n getZProj(zValue) {\n return zValue * this.graph.options.zAxis.shiftX;\n }\n\n}\n\n/**\n * Generic constructor of a y axis\n * @extends Axis\n */\nclass AxisY extends Axis {\n\n constructor(graph, leftright, options) {\n\n super(graph, leftright, options);\n this.leftright = leftright;\n this.left = leftright == 'left';\n }\n\n /**\n * @private\n */\n setAxisPosition(shift) {\n this.shiftPosition = shift;\n }\n\n getAxisPosition() {\n return this.shiftPosition || 0;\n }\n\n getAdditionalWidth() {\n let pos = 0;\n if (this.getLabel()) {\n pos += this.graph.options.fontSize;\n }\n\n if (this.isShown()) {\n pos += Math.abs(this.tickMargin);\n }\n return pos;\n }\n\n /**\n * @returns {Boolean} always ```false```\n */\n isX() {\n return false;\n }\n\n /**\n * @returns {Boolean} always ```true```\n */\n isY() {\n return true;\n }\n\n /**\n * @private\n */\n resetTicksLength() {\n this.longestTick = [false, 0];\n }\n\n /**\n * @private\n */\n getMaxSizeTick() {\n // Gives an extra margin of 5px\n return this.longestTick && this.longestTick[0] ? this.longestTick[0].getComputedTextLength() + 5 : 0; //(this.left ? 10 : 0);\n }\n\n draw() {\n\n this.tickMargin = this.left ? -5 - this.tickPx1 * this.tickScaling[1] : 2 - this.tickPx1 * this.tickScaling[1];\n var tickWidth = super.draw(...arguments);\n tickWidth += this.getAdditionalWidth();\n this.drawSpecifics(tickWidth);\n\n this.fullwidthlabel = tickWidth;\n\n return tickWidth;\n }\n\n equalizePosition(width) {\n\n this.placeLabel(this.left ? -width : width);\n\n if (this.getLabel()) {\n return width + this.graph.options.fontSize;\n }\n\n return 0;\n }\n\n /**\n * @private\n */\n drawTick(value, level, options, forcedPos) {\n let pos, tick, tickLabel;\n\n pos = forcedPos || this.getPos(value);\n\n if (pos == undefined || isNaN(pos)) {\n return;\n }\n\n tick = this.nextTick(level, tick => {\n\n tick.setAttribute('x1', (this.left ? 1 : -1) * this.tickPx1 * this.tickScaling[level]);\n tick.setAttribute('x2', (this.left ? 1 : -1) * this.tickPx2 * this.tickScaling[level]);\n\n if (level == 1) {\n tick.setAttribute('stroke', this.getPrimaryTicksColor());\n } else {\n tick.setAttribute('stroke', this.getSecondaryTicksColor());\n }\n });\n\n tick.setAttribute('y1', pos);\n tick.setAttribute('y2', pos);\n\n this.nextGridLine(level == 1, 0, this.graph.getDrawingWidth(), pos, pos);\n\n // this.groupTicks.appendChild( tick );\n if (level == 1) {\n tickLabel = this.nextTickLabel(tickLabel => {\n\n tickLabel.setAttribute('x', this.tickMargin + this.options.tickLabelOffset);\n if (this.getTicksLabelColor() !== 'black') {\n tickLabel.setAttribute('fill', this.getTicksLabelColor());\n }\n\n if (this.left) {\n tickLabel.setAttribute('text-anchor', 'end');\n } else {\n tickLabel.setAttribute('text-anchor', 'start');\n }\n tickLabel.style.dominantBaseline = 'central';\n });\n\n tickLabel.setAttribute('y', pos);\n this.setTickContent(tickLabel, value, options);\n\n if (String(tickLabel.textContent).length >= this.longestTick[1]) {\n this.longestTick[0] = tickLabel;\n this.longestTick[1] = String(tickLabel.textContent).length;\n }\n }\n }\n\n drawLabel() {\n\n if (this.getLabelColor() !== 'black') {\n this.label.setAttribute('fill', this.getLabelColor());\n }\n\n this.label.setAttribute('dominant-baseline', !this.left ? 'auto' : 'auto');\n this.labelTspan.textContent = this.getLabel();\n }\n\n placeLabel(y) {\n this.label.setAttribute('transform', 'translate(' + y + ', ' + Math.abs(this.getMaxPx() + this.getMinPx()) / 2 + ') rotate(-90)');\n }\n\n /**\n * @private\n */\n drawSpecifics() {\n // Place label correctly\n //this.label.setAttribute('x', (this.getMaxPx() - this.getMinPx()) / 2);\n /*\n if ( !this.left ) {\n this.labelTspan.style.dominantBaseline = 'hanging';\n this.expTspan.style.dominantBaseline = 'hanging';\n this.expTspanExp.style.dominantBaseline = 'hanging';\n this.unitTspan.style.dominantBaseline = 'hanging';\n this.preunitTspan.style.dominantBaseline = 'hanging';\n }\n */\n this.line.setAttribute('y1', this.getMinPx());\n this.line.setAttribute('y2', this.getMaxPx());\n this.line.setAttribute('x1', 0);\n this.line.setAttribute('x2', 0);\n\n this.line.setAttribute('stroke', this.getAxisColor());\n\n var span = this.getSpan();\n this.line.setAttribute('marker-start', !this.options.splitMarks || span[0] == 0 ? '' : 'url(#verticalsplit_' + this.graph.getId() + ')');\n this.line.setAttribute('marker-end', !this.options.splitMarks || span[1] == 1 ? '' : 'url(#verticalsplit_' + this.graph.getId() + ')');\n }\n\n /**\n * @private\n */\n setShift(shift) {\n\n this.shift = shift;\n\n if (!this.shift || !this.graph.getWidth()) {\n return;\n }\n\n let xshift = this.shift;\n xshift = this.floating ? xshift : this.isLeft() ? xshift : this.graph.getWidth() - this.graph.getPaddingRight() - this.graph.getPaddingLeft() - xshift;\n this.group.setAttribute('transform', 'translate( ' + xshift + ' 0 )');\n this.drawLabel();\n }\n\n /**\n * @private\n */\n isLeft() {\n return this.left;\n }\n\n /**\n * @private\n */\n isRight() {\n return !this.left;\n }\n\n /**\n * @private\n */\n isFlipped() {\n return !this.options.flipped;\n }\n\n /**\n * @private\n */\n _drawLine(pos, line) {\n\n let px = this.getPx(pos);\n\n if (!line) {\n line = document.createElementNS(this.graph.ns, 'line');\n } else {\n line.setAttribute('display', 'initial');\n }\n\n line.setAttribute('y1', px);\n line.setAttribute('y2', px);\n\n line.setAttribute('x1', 0);\n line.setAttribute('x2', this.graph.drawingSpaceWidth);\n\n line.setAttribute('stroke', 'black');\n this.group.appendChild(line);\n\n return line;\n }\n\n _hideLine(line) {\n if (!line) {\n return;\n }\n\n line.setAttribute('display', 'none');\n }\n\n /**\n * @private\n */\n handleMouseMoveLocal(x, y) {\n y -= this.graph.getPaddingTop();\n this.mouseVal = this.getVal(y);\n }\n\n /**\n * Scales the axis with respect to the series contained in an x axis\n * @param {Axis} [ axis = graph.getXAxis() ] - The X axis to use as a reference\n * @param {Serie} [ excludeSerie ] - A serie to exclude\n * @param {Number} [ start = xaxis.getCurrentMin() ] - The start of the boundary\n * @param {Number} [ end = xaxis.getCurrentMax() ] - The end of the boundary\n * @param {Boolean} [ min = true ] - Adapt the min\n * @param {Boolean} [ max = true ] - Adapt the max\n * @returns {Axis} The current axis\n */\n scaleToFitAxis(axis, excludeSerie, start, end, min, max) {\n //console.log( axis instanceof GraphAxis );\n if (!axis || !axis.isX()) {\n axis = this.graph.getXAxis();\n }\n\n if (isNaN(start)) {\n start = axis.getCurrentMin();\n }\n\n if (isNaN(end)) {\n end = axis.getCurrentMax();\n }\n\n if (min === undefined) {\n min = true;\n }\n\n if (max === undefined) {\n max = true;\n }\n\n if (typeof excludeSerie == 'number') {\n end = start;\n start = excludeSerie;\n excludeSerie = false;\n }\n\n var maxV = -Infinity,\n minV = Infinity,\n j = 0;\n\n for (var i = 0, l = this.graph.series.length; i < l; i++) {\n\n if (!this.graph.series[i].isShown()) {\n continue;\n }\n\n if (this.graph.series[i] == excludeSerie) {\n continue;\n }\n\n if (!(this.graph.series[i].getXAxis() == axis) || this.graph.series[i].getYAxis() !== this) {\n continue;\n }\n\n j++;\n\n maxV = max ? Math.max(maxV, this.graph.series[i].getMax(start, end)) : 0;\n minV = min ? Math.min(minV, this.graph.series[i].getMin(start, end)) : 0;\n }\n\n if (j == 0) {\n\n this.setMinMaxToFitSeries(); // No point was found\n } else {\n\n // If we wanted originally to resize min and max. Otherwise we use the current value\n minV = min ? minV : this.getCurrentMin();\n maxV = max ? maxV : this.getCurrentMax();\n\n var interval = maxV - minV;\n\n minV -= this.options.axisDataSpacing.min * interval;\n maxV += this.options.axisDataSpacing.max * interval;\n\n this._doZoomVal(minV, maxV);\n }\n\n return this;\n }\n\n /**\n * Caches the minimum px and maximum px position of the axis. Includes axis spans and flipping. Mostly used internally\n * @return {Axis} The current axis instance\n */\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n\n if (isNaN(interval)) {\n return;\n }\n\n var maxPx = this.maxPx - interval * this.options.span[0] - this.options.marginMin;\n var minPx = this.maxPx - interval * this.options.span[1] + this.options.marginMax;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n }\n\n getZProj(zValue) {\n return zValue * this.graph.options.zAxis.shiftY;\n }\n\n}\n\n/**\n * Generic constructor of a y axis\n * @class AxisXBar\n * @augments Axis\n */\nclass AxisXBar extends AxisX {\n\n constructor(graph, topbottom, options = {}) {\n super(graph, topbottom, options);\n }\n\n /**\n * @param {Object[]} categories - Categories array\n * @param {(String|Number)} categories[].title - The title of the category (to be dispalyed)\n * @param {(String|Number)} categories[].name - The name of the category (to indentify series)\n * @returns {AxisBar} The current axis instance\n */\n set categories(categories) {\n this._barCategories = categories;\n return this;\n }\n\n draw() {\n\n var self = this,\n tickLabel,\n elements = this._barCategories;\n\n this.forceMin(0);\n this.forceMax(1);\n\n this.cacheCurrentMin();\n this.cacheCurrentMax();\n this.cacheInterval();\n\n if (!elements) {\n return;\n }\n\n if (!Array.isArray(elements)) {\n elements = [elements];\n }\n\n // this.drawInit();\n\n //var widthPerElement = width / elements.length;\n for (var i = 0; i <= elements.length; i++) {\n this.drawTick(i / elements.length, 2);\n\n if (i < elements.length) {\n tickLabel = this.nextTickLabel(function (tickLabel) {\n\n tickLabel.setAttribute('y', (self.top ? -1 : 1) * ((self.options.tickPosition == 1 ? 8 : 20) + (self.top ? 10 : 0)));\n tickLabel.setAttribute('text-anchor', 'middle');\n if (self.getTicksLabelColor() !== 'black') {\n tickLabel.setAttribute('fill', self.getTicksLabelColor());\n }\n tickLabel.style.dominantBaseline = 'hanging';\n });\n\n tickLabel.setAttribute('x', this.getPos((i + 0.5) / elements.length));\n tickLabel.textContent = elements[i].title;\n }\n }\n\n this.drawSpecifics();\n return this;\n }\n\n /**\n * Sets the series automatically\n * @returns {AxisBar} The current axis instance\n */\n autoSeries() {\n\n let series = [];\n for (let serie of this.graph.series) {\n if (serie.getXAxis() == this) {\n series.push(serie);\n }\n }\n\n this.setSeries(...series);\n return this;\n }\n\n /**\n * Sets the series that should belong to the axis\n * @param {...(Series|Number|String)} series - List of series identified either by their instance, or their index (string or number)\n * @returns {AxisBar} The current axis instance\n */\n setSeries() {\n\n var self = this;\n this.series = arguments;\n\n Array.prototype.map.call(this.series, function (serie, index) {\n\n if (!(typeof serie == 'object')) {\n serie = self.graph.getSerie(serie);\n }\n\n if (serie.setCategoryConfig) {\n serie.setCategoryConfig(index, self._barCategories, self.series.length);\n }\n });\n\n this._getUsedCategories();\n\n return this;\n }\n\n _getUsedCategories() {\n\n let categories = {},\n total = 0;\n\n Array.prototype.map.call(this.series, serie => {\n let usedCategories = serie.getUsedCategories();\n for (let cat of usedCategories) {\n\n if (!categories.hasOwnProperty(cat)) {\n categories[cat] = 1;\n total += 1;\n }\n\n categories[cat]++;\n total++;\n }\n });\n\n let accumulator = 0;\n for (let i in categories) {\n let temp = categories[i];\n categories[i] = accumulator;\n accumulator += temp;\n }\n\n let dispatchedCategories = {};\n\n Array.prototype.map.call(this.series, serie => {\n\n let scategories = serie.getUsedCategories(),\n indices = {};\n\n scategories.forEach(cat => {\n\n dispatchedCategories[cat] = dispatchedCategories[cat] || 0.5;\n indices[cat] = (categories[cat] + dispatchedCategories[cat]) / total;\n dispatchedCategories[cat]++;\n });\n\n serie.setDataIndices(indices, total);\n });\n }\n\n getType() {\n return 'category';\n }\n}\n\nvar axisFormat = [{\n\n threshold: 20,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 seconds\n increment: 1,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n}, {\n\n threshold: 50,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 2 seconds\n increment: 2,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n}, {\n\n threshold: 100,\n increments: {\n\n 1: {\n increment: 1, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 5 seconds\n increment: 5,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n}, {\n\n threshold: 600,\n increments: {\n\n 1: {\n increment: 10, // 1 minute\n unit: 'i',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 seconds\n increment: 30,\n unit: 's',\n format: 'MM:ss\"s\"'\n }\n }\n}, { // One day\n\n threshold: 1000,\n increments: {\n\n 1: { // 1h\n increment: 1,\n unit: 'h',\n format: 'HH\"h\"MM (dd/mm/yy)'\n },\n\n 2: { // 10 minutes\n increment: 10,\n unit: 'i',\n format: 'MM\"min\"'\n }\n }\n}, { // One day\n\n threshold: 1500,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 1,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 3000,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 2,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 8000,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 10,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 26400,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 20,\n unit: 'i',\n format: 'H\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 86400,\n increments: {\n\n 1: {\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n increment: 1,\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 200000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 2, // One day on the first axis\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 6, // One day on the first axis\n unit: 'h',\n format: 'H\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 1400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'd',\n format: 'dd/mm/yyyy'\n },\n\n 2: {\n\n increment: 12, // One day on the first axis\n unit: 'h',\n format: 'HH\"h\"MM'\n }\n }\n}, { // One day\n\n threshold: 6400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 1, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n}, { // One day\n\n threshold: 12400000,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 2, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n}, { // One day\n\n threshold: 86400000 * 0.5,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 7, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n}, { // One day\n\n threshold: 86400000 * 0.8,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'm',\n format: 'mmmm yyyy'\n },\n\n 2: {\n\n increment: 15, // One day on the first axis\n unit: 'd',\n format: 'dd'\n }\n }\n}, { // One month\n\n threshold: 86400000 * 1,\n increments: {\n\n 1: {\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 3, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n}, { // One month\n\n threshold: 86400000 * 2,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 4, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n}, { // One month\n\n threshold: 86400000 * 10,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 6, // One day on the first axis\n unit: 'm',\n format: 'mm/yyyy'\n }\n }\n}, { // One month\n\n threshold: 86400000 * 12,\n increments: {\n\n 1: {\n\n increment: 1,\n unit: 'y',\n format: 'yyyy'\n },\n\n 2: {\n\n increment: 1, // One day on the first axis\n unit: 'y',\n format: 'yyyy'\n }\n }\n}];\n\n/*\n * Date Format 1.2.3\n * (c) 2007-2009 Steven Levithan \n * MIT license\n *\n * Includes enhancements by Scott Trenda \n * and Kris Kowal \n *\n * Accepts a date, a mask, or a date and a mask.\n * Returns a formatted version of the given date.\n * The date defaults to the current date/time.\n * The mask defaults to dateFormat.masks.default.\n */\n\nvar dateFormat = function () {\n var token = /d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\\1?|[WLloSZ]|\"[^\"]*\"|'[^']*'/g,\n timezone = /\\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\\d{4})?)\\b/g,\n timezoneClip = /[^-+\\dA-Z]/g,\n pad = function (val, len) {\n val = String(val);\n len = len || 2;\n while (val.length < len) val = '0' + val;\n return val;\n },\n getWeek = function (d, f) {\n var onejan = new Date(d[f + 'FullYear'](), 0, 1);\n return Math.ceil(((d - onejan) / 86400000 + onejan[f + 'Day']() + 1) / 7);\n };\n\n // Regexes and supporting functions are cached through closure\n return function (date, mask, utc) {\n var dF = dateFormat;\n\n // You can't provide utc if you skip other args (use the \"UTC:\" mask prefix)\n if (arguments.length == 1 && Object.prototype.toString.call(date) == '[object String]' && !/\\d/.test(date)) {\n mask = date;\n date = undefined;\n }\n\n // Passing date through Date applies Date.parse, if necessary\n date = date ? new Date(date) : new Date();\n if (isNaN(date)) throw SyntaxError('invalid date:' + date);\n\n mask = String(dF.masks[mask] || mask || dF.masks.default);\n\n // Allow setting the utc argument via the mask\n if (mask.slice(0, 4) == 'UTC:') {\n mask = mask.slice(4);\n utc = true;\n }\n\n var _ = utc ? 'getUTC' : 'get',\n d = date[_ + 'Date'](),\n D = date[_ + 'Day'](),\n m = date[_ + 'Month'](),\n y = date[_ + 'FullYear'](),\n H = date[_ + 'Hours'](),\n M = date[_ + 'Minutes'](),\n s = date[_ + 'Seconds'](),\n L = date[_ + 'Milliseconds'](),\n o = utc ? 0 : date.getTimezoneOffset(),\n flags = {\n d: d,\n dd: pad(d),\n ddd: dF.i18n.dayNames[D],\n dddd: dF.i18n.dayNames[D + 7],\n m: m + 1,\n mm: pad(m + 1),\n mmm: dF.i18n.monthNames[m],\n mmmm: dF.i18n.monthNames[m + 12],\n yy: String(y).slice(2),\n yyyy: y,\n h: H % 12 || 12,\n hh: pad(H % 12 || 12),\n H: H,\n HH: pad(H),\n M: M,\n MM: pad(M),\n s: s,\n ss: pad(s),\n l: pad(L, 3),\n L: pad(L > 99 ? Math.round(L / 10) : L),\n t: H < 12 ? 'a' : 'p',\n tt: H < 12 ? 'am' : 'pm',\n T: H < 12 ? 'A' : 'P',\n TT: H < 12 ? 'AM' : 'PM',\n Z: utc ? 'UTC' : (String(date).match(timezone) || ['']).pop().replace(timezoneClip, ''),\n o: (o > 0 ? '-' : '+') + pad(Math.floor(Math.abs(o) / 60) * 100 + Math.abs(o) % 60, 4),\n S: ['th', 'st', 'nd', 'rd'][d % 10 > 3 ? 0 : (d % 100 - d % 10 != 10) * d % 10],\n W: getWeek(date, _)\n };\n\n return mask.replace(token, function ($0) {\n return $0 in flags ? flags[$0] : $0.slice(1, $0.length - 1);\n });\n };\n}();\n\n// Some common format strings\ndateFormat.masks = {\n 'default': 'ddd mmm dd yyyy HH:MM:ss',\n shortDate: 'm/d/yy',\n mediumDate: 'mmm d, yyyy',\n longDate: 'mmmm d, yyyy',\n fullDate: 'dddd, mmmm d, yyyy',\n shortTime: 'h:MM TT',\n mediumTime: 'h:MM:ss TT',\n longTime: 'h:MM:ss TT Z',\n isoDate: 'yyyy-mm-dd',\n isoTime: 'HH:MM:ss',\n isoDateTime: \"yyyy-mm-dd'T'HH:MM:ss\",\n isoUtcDateTime: \"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'\"\n};\n\n// Internationalization strings\ndateFormat.i18n = {\n dayNames: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],\n monthNames: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec', 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']\n};\n\n/* END DATE FORMAT */\n\nfunction getClosestIncrement(value, basis) {\n return Math.round(value / basis) * basis;\n}\n\nfunction roundDate(date, format) {\n\n switch (format.unit) {\n\n case 's':\n // Round at n hour\n\n date.setSeconds(getClosestIncrement(date.getSeconds(), format.increment));\n date.setMilliseconds(0);\n\n break;\n\n case 'i':\n // Round at n hour\n\n date.setMinutes(getClosestIncrement(date.getMinutes(), format.increment));\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'h':\n // Round at n hour\n\n date.setHours(getClosestIncrement(date.getHours(), format.increment));\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'd':\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n\n date.setDate(getClosestIncrement(date.getDate(), format.increment));\n\n break;\n\n case 'm':\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n\n date.setMonth(getClosestIncrement(date.getMonth(), format.increment));\n\n break;\n\n case 'y':\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n date.setMonth(0);\n\n //date.setYear( getClosest( date.getDate(), format.increment ) );\n\n break;\n\n default:\n {\n throw new Error('Date format not recognized');\n }\n }\n\n return date;\n}\n\nfunction incrementDate(date, format) {\n\n switch (format.unit) {\n\n case 's':\n\n date.setSeconds(date.getSeconds() + format.increment);\n date.setMilliseconds(0);\n\n break;\n\n case 'i':\n\n date.setMinutes(date.getMinutes() + format.increment);\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'h':\n // Round at n hour\n\n date.setHours(date.getHours() + format.increment);\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n\n break;\n\n case 'd':\n\n date.setDate(date.getDate() + format.increment);\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n\n break;\n\n case 'm':\n\n date.setMonth(date.getMonth() + format.increment);\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n\n break;\n\n case 'y':\n\n date.setFullYear(date.getFullYear() + format.increment);\n\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n date.setHours(0);\n date.setDate(1);\n date.setMonth(0);\n\n break;\n\n default:\n {\n throw new Error('Date format not recognized');\n }\n }\n\n return date;\n}\n\nfunction getGroup(axis, level, number) {\n\n if (axis.groups[level][number]) {\n axis.groups[level][number].group.setAttribute('display', 'block');\n return axis.groups[level][number];\n }\n\n var g = {\n\n group: document.createElementNS(axis.graph.ns, 'g'),\n text: document.createElementNS(axis.graph.ns, 'text')\n };\n\n var line = document.createElementNS(axis.graph.ns, 'line');\n\n line.setAttribute('stroke', 'black');\n line.setAttribute('y1', 0);\n switch (level) {\n\n case 2:\n\n line.setAttribute('y2', 6);\n g.text.setAttribute('y', 15);\n\n g.line = line;\n\n g.group.appendChild(g.line);\n break;\n\n default:\n case 1:\n\n line.setAttribute('y2', 20);\n g.text.setAttribute('y', 10);\n\n g.line1 = line;\n g.line2 = line.cloneNode();\n\n g.group.appendChild(g.line1);\n g.group.appendChild(g.line2);\n\n break;\n }\n\n g.text.setAttribute('text-anchor', 'middle');\n g.text.setAttribute('dominant-baseline', 'middle');\n\n g.group.appendChild(g.text);\n\n axis.getWrapper(level).appendChild(g.group);\n\n return axis.groups[level][number] = g;\n}\n\nfunction hideGroups(axis, level, from) {\n\n for (; from < axis.groups[level].length; from++) {\n\n hideGroup(axis.groups[level][from]);\n }\n}\n\nfunction hideGroup(group) {\n group.group.setAttribute('display', 'none');\n}\n\nfunction getDateText(date, format) {\n\n return dateFormat(date, format);\n}\n\nfunction renderGroup(level, group, text, minPx, maxPx, x1, x2) {\n\n switch (level) {\n\n case 2:\n\n if (x1 < minPx || x1 > maxPx) {\n\n hideGroup(group);\n return;\n }\n\n group.line.setAttribute('x1', x1);\n group.line.setAttribute('x2', x1);\n group.text.setAttribute('x', x1);\n group.text.textContent = text;\n\n break;\n\n default:\n case 1:\n\n var x1B = Math.max(minPx, Math.min(maxPx, x1)),\n x2B = Math.max(minPx, Math.min(maxPx, x2));\n\n if (isNaN(x2B) || isNaN(x1B)) {\n return;\n }\n\n group.line1.setAttribute('x1', x1B);\n group.line2.setAttribute('x1', x2B);\n\n group.line1.setAttribute('x2', x1B);\n group.line2.setAttribute('x2', x2B);\n\n group.text.setAttribute('x', (x1B + x2B) / 2);\n\n while (text.length * 8 > x2B - x1B) {\n\n text = text.substr(0, text.length - 2) + '.';\n\n if (text.length == 1) {\n text = '';\n break;\n }\n }\n\n group.text.textContent = text;\n break;\n }\n}\n\nclass GraphTimeAxis extends Axis {\n\n constructor() {\n\n super(...arguments);\n }\n\n init(graph, options) {\n\n super.init(graph, options);\n\n this.wrapper = {\n 1: document.createElementNS(graph.ns, 'g'),\n 2: document.createElementNS(graph.ns, 'g')\n };\n this.groups = {\n 1: [],\n 2: []\n };\n\n var rect = document.createElementNS(graph.ns, 'rect');\n rect.setAttribute('fill', '#c0c0c0');\n rect.setAttribute('stroke', '#808080');\n rect.setAttribute('height', '20');\n rect.setAttribute('x', '0');\n rect.setAttribute('y', '0');\n\n this.rect = rect;\n\n this.wrapper[1].appendChild(this.rect);\n\n // this.init( graph, options );\n\n this.group.appendChild(this.wrapper[1]);\n this.group.appendChild(this.wrapper[2]);\n\n this.wrapper[1].setAttribute('transform', 'translate( 0, 25 )');\n this.wrapper[2].setAttribute('transform', 'translate( 0, 00 )');\n }\n\n draw() {\n // Redrawing of the axis\n\n //this.drawInit();\n\n this.cacheCurrentMax();\n this.cacheCurrentMin();\n\n if (this.currentAxisMin == undefined || this.currentAxisMax == undefined) {\n this.setMinMaxToFitSeries(true); // We reset the min max as a function of the series\n }\n\n this.line.setAttribute('x1', this.getMinPx());\n this.line.setAttribute('x2', this.getMaxPx());\n this.line.setAttribute('y1', 0);\n this.line.setAttribute('y2', 0);\n\n var widthPx = this.maxPx - this.minPx;\n var widthTime = this.getCurrentInterval();\n\n var timePerPx = widthTime / widthPx;\n\n var maxVal = this.getCurrentMax();\n var minVal = this.getCurrentMin();\n\n this.rect.setAttribute('width', widthPx);\n this.rect.setAttribute('x', this.minPx);\n\n if (!maxVal || !minVal) {\n return 0;\n }\n\n var currentFormat;\n\n for (i = 0; i < axisFormat.length; i++) {\n\n if (axisFormat[i].threshold > timePerPx) {\n currentFormat = axisFormat[i];\n\n break;\n }\n }\n\n if (!currentFormat) {\n currentFormat = axisFormat[axisFormat.length - 1];\n }\n\n var xVal1,\n xVal2,\n level = 0,\n dateFirst,\n currentDate,\n text,\n group,\n i;\n\n for (level = 1; level <= 2; level++) {\n\n if (!isNumeric$1(minVal)) {\n hideGroups(this, level, 0);\n break;\n }\n\n dateFirst = new Date(minVal);\n\n currentDate = roundDate(dateFirst, currentFormat.increments[level]);\n\n i = 0;\n\n do {\n /** @ignore */\n text = getDateText(currentDate, currentFormat.increments[level].format);\n group = getGroup(this, level, i);\n\n xVal1 = this.getPx(currentDate.getTime());\n currentDate = incrementDate(currentDate, currentFormat.increments[level]);\n xVal2 = this.getPx(currentDate.getTime());\n\n renderGroup(level, group, text, this.getMinPx(), this.getMaxPx(), xVal1, xVal2);\n\n i++;\n if (i > 100) {\n break;\n }\n } while (currentDate.getTime() < maxVal);\n\n hideGroups(this, level, i);\n }\n }\n\n isX() {\n return true;\n }\n\n getWrapper(level) {\n return this.wrapper[level];\n }\n\n setShift(shift) {\n this.shift = shift;\n this.group.setAttribute('transform', 'translate(0 ' + (this.top ? this.shift : this.graph.getDrawingHeight() - this.shift) + ')');\n }\n\n getAxisPosition() {\n return 60;\n }\n\n setMinMaxFlipped() {\n\n var interval = this.maxPx - this.minPx;\n var maxPx = interval * this.options.span[1] + this.minPx;\n var minPx = interval * this.options.span[0] + this.minPx;\n\n this.minPxFlipped = this.isFlipped() ? maxPx : minPx;\n this.maxPxFlipped = this.isFlipped() ? minPx : maxPx;\n }\n\n}\n\n/**\n * Serie class to be extended\n * @static\n */\nclass Serie extends EventEmitter {\n\n static default() {\n\n return {\n redrawShapesAfterDraw: false\n };\n }\n\n constructor(graph, name, options) {\n\n super(...arguments);\n this.graph = graph;\n this.name = name;\n this.options = Object.assign({}, Serie.default(), this.constructor.default(), options);\n\n //if( new.target.default ) {\n //console.log( new.target.default() );\n //}\n }\n\n draw() {}\n\n beforeDraw() {}\n\n afterDraw() {\n\n if (this.options.redrawShapesAfterDraw) {\n this.graph.getShapesOfSerie(this).forEach(shape => {\n shape.redraw();\n });\n }\n\n this.emit('draw');\n }\n\n /**\n * Sets data to the serie\n * @memberof Serie\n * @param {(Object|Array|Array[])} data - The data of the serie\n * @param {Boolean} [ oneDimensional=false ] - In some cases you may need to force the 1D type. This is required when one uses an array or array to define the data (see examples)\n * @param{String} [ type=float ] - Specify the type of the data. Use int to save memory (half the amount of bytes allocated to the data).\n * @example serie.setData( [ [ x1, y1 ], [ x2, y2 ], ... ] );\n * @example serie.setData( [ x1, y1, x2, y2, ... ] ); // Faster\n * @example serie.setData( [ [ x1, y1, x2, y2, ..., xn, yn ] , [ xm, ym, x(m + 1), y(m + 1), ...] ], true ) // 1D array with a gap in the middle\n * @example serie.setData( { x: x0, dx: spacing, y: [ y1, y2, y3, y4 ] } ); // Data with equal x separation. Fastest way\n */\n setData(data, oneDimensional, type) {\n\n if (data instanceof Waveform) {\n return this.setWaveform(data);\n }\n\n throw 'Setting data other than waveforms in not supported by default. You must implemented this method in the inherited class.';\n }\n\n _addData(type, howmany) {\n return [];\n }\n\n /**\n * Removes all the data from the serie, without redrawing\n * @returns {Serie} The current serie\n */\n clearData() {\n this.setData(new Waveform());\n return this;\n }\n\n /**\n * Returns the data in its current form\n * @returns {Array.<(Float64Array|Int32Array)>} An array containing the data chunks. Has only one member if the data has no gaps\n * @memberof Serie\n */\n getData() {\n return this.data;\n }\n\n /**\n * Sets the options of the serie (no extension of default options)\n * @param {Object} options - The options of the serie\n * @memberof Serie\n */\n setOptions(options) {\n this.options = options || {};\n }\n\n /**\n * Sets the options of the serie (no extension of default options)\n * @param {String} name - The option name\n * @param value - The option value\n * @memberof Serie\n * @example serie.setOption('selectableOnClick', true );\n */\n setOption(name, value) {\n this.options[name] = value;\n }\n\n /**\n * Removes the serie from the graph. The method doesn't perform any axis autoscaling or repaint of the graph. This should be done manually.\n * @return {Serie} The current serie instance\n * @memberof Serie\n */\n kill(noLegendUpdate) {\n\n this.graph.removeSerieFromDom(this);\n this.graph._removeSerie(this);\n\n if (this.graph.legend && !noLegendUpdate) {\n\n this.graph.legend.update();\n }\n\n this.graph = undefined;\n return this;\n }\n\n /**\n * Hides the serie\n * @memberof Serie\n * @param {Boolean} [ hideShapes = false ] - true to hide the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n hide(hideShapes, mute = false) {\n\n this.hidden = true;\n this.groupMain.setAttribute('display', 'none');\n\n this.getSymbolForLegend().setAttribute('opacity', 0.5);\n this.getTextForLegend().setAttribute('opacity', 0.5);\n\n this.hideImpl();\n\n if (hideShapes) {\n var shapes = this.graph.getShapesOfSerie(this);\n for (var i = 0, l = shapes.length; i < l; i++) {\n shapes[i].hide();\n }\n }\n\n if (!mute) {\n this.emit('hide');\n }\n\n if (this.getXAxis().doesHideWhenNoSeriesShown() || this.getYAxis().doesHideWhenNoSeriesShown()) {\n this.graph.draw(true);\n }\n\n return this;\n }\n\n /**\n * Shows the serie\n * @memberof Serie\n * @param {Boolean} [showShapes=false] - true to show the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n show(showShapes, mute = false) {\n\n this.hidden = false;\n this.groupMain.setAttribute('display', 'block');\n\n this.getSymbolForLegend().setAttribute('opacity', 1);\n this.getTextForLegend().setAttribute('opacity', 1);\n\n this.showImpl();\n\n this.draw(true);\n\n if (showShapes) {\n var shapes = this.graph.getShapesOfSerie(this);\n for (var i = 0, l = shapes.length; i < l; i++) {\n shapes[i].show();\n }\n }\n\n if (!mute) {\n this.emit('show');\n }\n\n if (this.getXAxis().doesHideWhenNoSeriesShown() || this.getYAxis().doesHideWhenNoSeriesShown()) {\n this.graph.draw(true);\n }\n return this;\n }\n\n hideImpl() {}\n showImpl() {}\n\n /**\n * Toggles the display of the serie (effectively, calls .show() and .hide() alternatively on each call)\n * @memberof Serie\n * @param {Boolean} [hideShapes=false] - true to hide the shapes associated to the serie\n * @returns {Serie} The current serie\n */\n toggleDisplay() {\n\n if (!this.isShown()) {\n this.show();\n } else {\n this.hide();\n }\n\n return this;\n }\n\n /**\n * Determines if the serie is currently visible\n * @memberof Serie\n * @returns {Boolean} The current visibility status of the serie\n */\n isShown() {\n return !this.hidden;\n }\n\n /**\n * Checks that axes assigned to the serie have been defined and have proper values\n * @memberof Serie\n */\n axisCheck() {\n\n if (!this.getXAxis() || !this.getYAxis()) {\n throw 'No axis exist for this serie. Check that they were properly assigned';\n }\n\n if (isNaN(this.getXAxis().getCurrentMin()) || isNaN(this.getXAxis().getCurrentMax()) || isNaN(this.getYAxis().getCurrentMin()) || isNaN(this.getYAxis().getCurrentMax())) {\n throw 'Axis min and max values are not defined. Try autoscaling';\n }\n }\n /**\n * Returns the x position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The x position in px corresponding to the x value\n */\n getX(val) {\n return (val = this.getXAxis().getPx(val)) - val % 0.2;\n }\n\n /**\n * Returns the y position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The y position in px corresponding to the y value\n */\n getY(val) {\n return (val = this.getYAxis().getPx(val)) - val % 0.2;\n }\n\n /**\n * Returns the selection state of the serie. Generic for most serie types\n * @memberof Serie\n * @returns {Boolean} true if the serie is selected, false otherwise\n */\n isSelected() {\n return this.selected || this.selectionType !== 'unselected';\n }\n\n _checkX(val) {\n this.minX = Math.min(this.minX, val);\n this.maxX = Math.max(this.maxX, val);\n }\n\n _checkY(val) {\n this.minY = Math.min(this.minY, val);\n this.maxY = Math.max(this.maxY, val);\n }\n\n /**\n * Getter for the serie name\n * @memberof Serie\n * @returns {String} The serie name\n */\n getName() {\n return this.name;\n }\n\n /* AXIS */\n\n /**\n * Assigns axes automatically, based on {@link Graph#getXAxis} and {@link Graph#getYAxis}.\n * @memberof Serie\n * @returns {Serie} The current serie\n */\n autoAxis() {\n\n if (this.isFlipped()) {\n\n this.setXAxis(this.graph.getYAxis());\n this.setYAxis(this.graph.getXAxis());\n } else {\n\n this.setXAxis(this.graph.getXAxis());\n this.setYAxis(this.graph.getYAxis());\n }\n\n // After axes have been assigned, the graph axes should update their min/max\n this.graph.updateDataMinMaxAxes();\n return this;\n }\n\n autoAxes() {\n return this.autoAxis(...arguments);\n }\n\n /**\n * Assigns an x axis to the serie\n * @memberof Serie\n * @param {Axis|Number} axis - The axis to use as an x axis. If an integer, {@link Graph#getXAxis} or {@link Graph#getYAxis} will be used\n * @returns {Serie} The current serie\n * @example serie.setXAxis( graph.getTopAxis( 1 ) ); // Assigns the second top axis to the serie\n */\n setXAxis(axis) {\n\n if (typeof axis == 'number') {\n this.xaxis = this.isFlipped() ? this.graph.getYAxis(axis) : this.graph.getXAxis(axis);\n } else {\n this.xaxis = axis;\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Assigns an y axis to the serie\n * @memberof Serie\n * @param {Axis|Number} axis - The axis to use as an y axis. If an integer, {@link Graph#getXAxis} or {@link Graph#getYAxis} will be used\n * @returns {Serie} The current serie\n * @example serie.setYAxis( graph.getLeftAxis( 4 ) ); // Assigns the 5th left axis to the serie\n */\n setYAxis(axis) {\n if (typeof axis == 'number') {\n this.xaxis = this.isFlipped() ? this.graph.getXAxis(axis) : this.graph.getYAxis(axis);\n } else {\n this.yaxis = axis;\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Assigns two axes to the serie\n * @param {GraphAxis} axis1 - First axis to assign to the serie (x or y)\n * @param {GraphAxis} axis2 - Second axis to assign to the serie (y or x)\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setAxes() {\n\n for (var i = 0; i < 2; i++) {\n\n if (arguments[i]) {\n this[arguments[i].isX() ? 'setXAxis' : 'setYAxis'](arguments[i]);\n }\n }\n\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * @returns {GraphAxis} The x axis assigned to the serie\n * @memberof Serie\n */\n getXAxis() {\n return this.xaxis;\n }\n\n /**\n * @returns {GraphAxis} The y axis assigned to the serie\n * @memberof Serie\n */\n getYAxis() {\n return this.yaxis;\n }\n\n /* */\n\n /* DATA MIN MAX */\n\n /**\n * @returns {Number} Lowest x value of the serie's data\n * @memberof Serie\n */\n getMinX() {\n return this.minX;\n }\n\n /**\n * @returns {Number} Highest x value of the serie's data\n * @memberof Serie\n */\n getMaxX() {\n return this.maxX;\n }\n\n /**\n * @returns {Number} Lowest y value of the serie's data\n * @memberof Serie\n */\n getMinY() {\n return this.minY;\n }\n\n /**\n * @returns {Number} Highest y value of the serie's data\n * @memberof Serie\n */\n getMaxY() {\n return this.maxY;\n }\n\n getWaveform() {\n return this.waveform;\n }\n\n getWaveforms() {\n return [this.waveform];\n }\n\n setWaveform(waveform) {\n\n if (!(waveform instanceof Waveform)) {\n console.trace();\n console.error(waveform);\n throw new Error('Cannot assign waveform to serie. Waveform is not of the proper Waveform instance');\n }\n\n this.waveform = waveform;\n\n this.minX = this.waveform.getXMin();\n this.maxX = this.waveform.getXMax();\n this.minY = this.waveform.getMin();\n this.maxY = this.waveform.getMax();\n\n this.graph.updateDataMinMaxAxes();\n this.dataHasChanged();\n\n return this;\n }\n\n /**\n * Computes and returns a line SVG element with the same line style as the serie, or width 20px\n * @returns {SVGElement}\n * @memberof Serie\n */\n getSymbolForLegend() {\n\n if (!this.lineForLegend) {\n\n var line = document.createElementNS(this.graph.ns, 'line');\n this.applyLineStyle(line);\n\n line.setAttribute('x1', 5);\n line.setAttribute('x2', 25);\n line.setAttribute('y1', 0);\n line.setAttribute('y2', 0);\n\n line.setAttribute('cursor', 'pointer');\n\n this.lineForLegend = line;\n }\n\n return this.lineForLegend;\n }\n\n /**\n * Explicitely applies the line style to the SVG element returned by {@link Serie#getSymbolForLegend}\n * @see Serie#getSymbolForLegend\n * @returns {SVGElement}\n * @memberof Serie\n */\n setLegendSymbolStyle() {\n this.applyLineStyle(this.getSymbolForLegend());\n }\n\n /**\n * @alias Serie#setLegendSymbolStyle\n * @memberof Serie\n */\n updateStyle() {\n this.setLegendSymbolStyle();\n this.graph.updateLegend();\n }\n\n /**\n * Computes and returns a text SVG element with the label of the serie as a text, translated by 35px\n * @returns {SVGElement}\n * @memberof Serie\n * @see Serie#getLabel\n */\n getTextForLegend() {\n\n if (!this.textForLegend) {\n\n var text = document.createElementNS(this.graph.ns, 'text');\n text.setAttribute('cursor', 'pointer');\n text.textContent = this.getLabel();\n\n this.textForLegend = text;\n }\n\n return this.textForLegend;\n }\n\n /**\n * @returns {Number} The current index of the serie\n * @memberof Serie\n */\n getIndex() {\n return this.graph.series.indexOf(this);\n }\n\n /**\n * @returns {String} The label or, alternatively - the name of the serie\n * @memberof Serie\n */\n getLabel() {\n return this.options.label || this.name;\n }\n\n /**\n * Sets the label of the serie. Note that this does not automatically updates the legend\n * @param {String} label - The new label of the serie\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setLabel(label) {\n this.options.label = label;\n\n if (this.textForLegend) {\n this.textForLegend.textContent = label;\n }\n\n this.graph.requireLegendUpdate();\n return this;\n }\n\n /* FLIP */\n\n /**\n * Assigns the flipping value of the serie. A flipped serie will have inverted axes. However this method does not automatically re-assigns the axes of the serie. Call {@link Serie#autoAxis} to re-assign the axes automatically, or any other axis setting method.\n * @param {Boolean} [flipped=false] - true to flip the serie\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n setFlip(flipped) {\n this.options.flip = flipped;\n return this;\n }\n\n /**\n * @returns {Boolean} true if the serie is flipped, false otherwise\n * @memberof Serie\n */\n getFlip() {\n return this.options.flip;\n }\n\n /**\n * @alias Serie#getFlip\n * @memberof Serie\n */\n isFlipped() {\n return this.options.flip;\n }\n\n /**\n * Sets the layer onto which the serie should be displayed. This method does not trigger a graph redraw.\n * @memberof Serie\n * @param {Number} layerIndex=1 - The index of the layer into which the serie will be drawn\n * @returns {Serie} The current serie\n */\n setLayer(layerIndex) {\n let newLayer = parseInt(layerIndex) || 1;\n\n if (newLayer !== this.options.layer) {\n this.options.layer = newLayer;\n this.graph.appendSerieToDom(this);\n }\n\n return this;\n }\n\n /**\n * Sets the layer onto which the serie should be displayed. This method does not trigger a graph redraw.\n * @memberof Serie\n * @returns {Nunber} The index of the layer into which the serie will be drawn\n */\n getLayer() {\n return this.options.layer || 1;\n }\n\n setStyle(style, selectionType = 'unselected') {\n this.styles[selectionType] = style;\n this.styleHasChanged(selectionType);\n }\n\n /**\n * Notifies jsGraph that the style of the serie has changed and needs to be redrawn on the next repaint\n * @param {String} selectionType - The selection for which the style may have changed\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n styleHasChanged(selectionType = 'unselected') {\n this._changedStyles = this._changedStyles || {};\n\n if (selectionType === false) {\n for (var i in this._changedStyles) {\n this._changedStyles[i] = false;\n }\n } else {\n this._changedStyles[selectionType || 'unselected'] = true;\n }\n\n this.graph.requireLegendUpdate();\n return this;\n }\n\n /**\n * Checks if the style has changed for a selection type\n * @param {String} selectionType - The selection for which the style may have changed\n * @returns {Boolean} true if the style has changed\n * @private\n * @memberof Serie\n */\n hasStyleChanged(selectionType) {\n this._changedStyles = this._changedStyles || {};\n return this._changedStyles[selectionType || 'unselected'];\n }\n\n /**\n * Notifies jsGraph that the data of the serie has changed\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n dataHasChanged(arg) {\n this._dataHasChanged = arg === undefined || arg;\n return this;\n }\n\n /**\n * Checks if the data has changed\n * @returns {Boolean} true if the data has changed\n * @private\n * @memberof Serie\n */\n hasDataChanged() {\n return this._dataHasChanged;\n }\n\n /**\n * Set a key/value arbitrary information to the serie. It is particularly useful if you have this serie has a reference through an event for instance, and you want to retrieve data associated to it\n * @param {String} prop - The property\n * @param value - The value\n * @returns {Serie} The current serie\n * @see Serie#getInfo\n * @memberof Serie\n */\n setInfo(prop, value) {\n this.infos = this.infos || {};\n this.infos[prop] = value;\n return this;\n }\n\n /**\n * Retrives an information value from its key\n * @param {String} prop - The property\n * @returns The value associated to the prop parameter\n * @see Serie#setInfo\n * @memberof Serie\n */\n getInfo(prop, value) {\n return (this.infos || {})[prop];\n }\n\n /**\n * @deprecated\n * @memberof Serie\n */\n setAdditionalData(data) {\n this.additionalData = data;\n return this;\n }\n\n /**\n * @deprecated\n * @memberof Serie\n */\n getAdditionalData() {\n return this.additionalData;\n }\n\n /**\n * Flags the serie as selected\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n select() {\n this.selected = true;\n return this;\n }\n\n /**\n * Flags the serie as unselected\n * @returns {Serie} The current serie\n * @memberof Serie\n */\n unselect() {\n this.selected = false;\n return this;\n }\n\n /**\n * Allows mouse tracking of the serie\n * @memberof Serie\n * @returns {Serie} The current serie\n * @param {Function} hoverCallback - Function to be called when the mouse enters the serie area\n * @param {Function} outCallback - Function to be called when the mouse exits the serie area\n * @private\n */\n enableTracking(hoverCallback, outCallback) {\n this._tracker = true;\n this._trackingCallback = hoverCallback;\n this._trackingOutCallback = outCallback;\n\n return this;\n }\n\n /**\n * Disables mouse tracking of the serie\n * @memberof Serie\n * @returns {Serie} The current serie\n * @private\n */\n disableTracking() {\n\n if (this._trackerDom) {\n this._trackerDom.remove();\n this._trackerDom = null;\n }\n\n this._tracker = false;\n this._trackingCallback = null;\n return this;\n }\n\n /**\n * Allows mouse tracking of the serie\n * @memberof Serie\n * @param {Object} options - The tracking line options\n * @returns {Serie} The current serie\n */\n allowTrackingLine(options) {\n\n options = options || {};\n this.graph.addSerieToTrackingLine(this, options);\n }\n\n getMarkerForLegend() {\n return false;\n }\n\n get type() {\n return this._type;\n }\n\n getType() {\n return this._type;\n }\n\n set excludedFromLegend(bln) {\n this._excludedFromLegend = bln;\n }\n\n get excludedFromLegend() {\n return !!this._excludedFromLegend;\n }\n\n setDataIndices(categories, nb) {\n this.categoryIndices = categories;\n this.nbCategories = nb;\n }\n\n hasErrors() {\n if (!this.waveform) {\n return false;\n }\n\n return this.waveform.hasErrorBars();\n }\n}\n\nvar ErrorBarMixin = {\n /*\n doErrorDraw: function( orientation, error, originVal, originPx, xpx, ypx ) {\n if ( !( error instanceof Array ) ) {\n error = [ error ];\n }\n var functionName = orientation == 'y' ? 'getY' : 'getX';\n var bars = orientation == 'y' ? [ 'top', 'bottom' ] : [ 'left', 'right' ];\n var j;\n if ( isNaN( xpx ) || isNaN( ypx ) ) {\n return;\n }\n for ( var i = 0, l = error.length; i < l; i++ ) {\n if ( error[ i ] instanceof Array ) { // TOP\n j = bars[ 0 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal + error[ i ][ 0 ] ), originPx, j );\n j = bars[ 1 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal - error[ i ][ 1 ] ), originPx, j );\n } else {\n j = bars[ 0 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal + error[ i ] ), originPx, j );\n j = bars[ 1 ];\n this.errorstyles[ i ].paths[ j ] += \" M \" + xpx + \" \" + ypx;\n this.errorstyles[ i ].paths[ j ] += this.makeError( orientation, i, this[ functionName ]( originVal - error[ i ] ), originPx, j );\n }\n }\n },\n */\n\n /*\n makeError: function( orientation, type, coord, origin, quadOrientation ) {\n var method;\n switch ( this.errorstyles[ level ].type ) {\n case 'bar':\n method = \"makeBar\";\n break;\n case 'box':\n method = \"makeBox\";\n break;\n }\n return this[ method + orientation.toUpperCase() ]( coord, origin, this.errorstyles[ level ][ quadOrientation ] );\n },*/\n\n makeBarY: function (coordY, origin, style) {\n if (!coordY || style === undefined) {\n return;\n }\n var width = !isNumeric$1(style.width) ? 10 : style.width;\n return ' V ' + coordY + ' m -' + width / 2 + ' 0 h ' + width + ' m -' + width / 2 + ' 0 V ' + origin + ' ';\n },\n\n makeBoxY: function (coordY, origin, style) {\n if (!coordY || style === undefined) {\n return;\n }\n return ' m 5 0 V ' + coordY + ' h -10 V ' + origin + ' m 5 0 ';\n },\n\n makeBarX: function (coordX, origin, style) {\n if (!coordX || style === undefined) {\n return;\n }\n var height = !isNumeric$1(style.width) ? 10 : style.width;\n return ' H ' + coordX + ' m 0 -' + height / 2 + ' v ' + height + ' m 0 -' + height / 2 + ' H ' + origin + ' ';\n },\n\n makeBoxX: function (coordX, origin, style) {\n if (!coordX || style === undefined) {\n return;\n }\n return ' v 5 H ' + coordX + ' v -10 H ' + origin + ' v 5 ';\n },\n /*\n check: function( index, valY, valX ) {\n var dx, dy;\n if ( ( this.getType() == Graph.SERIE_LINE || this.getType() == Graph.SERIE_SCATTER ) ) {\n if ( !( dx = this.data[ index * 2 ] ) || !( dy = this.data[ index * 2 + 1 ] ) ) { //\n return;\n }\n }\n if ( dx === undefined ) {\n return;\n }\n for ( var i = 0, l = valY.length; i < l; i++ ) {\n if ( Array.isArray( valY[ i ] ) ) {\n if ( !isNaN( valY[ i ][ 0 ] ) ) {\n this._checkY( dy + valY[ i ][ 0 ] );\n }\n if ( !isNaN( valY[ i ][ 1 ] ) ) {\n this._checkY( dy - valY[ i ][ 1 ] );\n }\n } else {\n if ( !isNaN( valY[ i ] ) ) {\n this._checkY( dy + valY[ i ] );\n this._checkY( dy - valY[ i ] );\n }\n }\n }\n for ( var i = 0, l = valX.length; i < l; i++ ) {\n if ( Array.isArray( valX[ i ] ) ) {\n if ( !isNaN( valX[ i ][ 0 ] ) ) {\n this._checkX( dx - valX[ i ][ 0 ] );\n }\n if ( !isNaN( valX[ i ][ 1 ] ) ) {\n this._checkX( dx + valX[ i ][ 1 ] );\n }\n } else {\n if ( !isNaN( valY[ i ] ) ) {\n this._checkX( dx - valX[ i ] );\n this._checkX( dx + valX[ i ] );\n }\n }\n }\n },\n */\n\n /**\n *\n * @example serie.setErrorStyle( [ { type: 'bar', x: {} }, { type: 'box', top: { strokeColor: 'green', fillColor: 'olive' }, bottom: { strokeColor: 'red', fillColor: \"#800000\" } } ] );\n */\n setErrorBarStyle: function (errorstyle) {\n\n this.errorbarStyle = this._setErrorStyle(errorstyle);\n return this;\n },\n\n setErrorBoxStyle: function (errorstyle) {\n\n this.errorboxStyle = this._setErrorStyle(errorstyle);\n return this;\n },\n\n _setErrorStyle(errorstyles = {}) {\n\n var styles = [];\n var pairs = [['y', 'top', 'bottom'], ['x', 'left', 'right']];\n\n var makePath = style => {\n\n style.dom = document.createElementNS(this.graph.ns, 'path');\n style.dom.setAttribute('fill', style.fillColor || 'none');\n style.dom.setAttribute('stroke', style.strokeColor || 'black');\n style.dom.setAttribute('stroke-opacity', style.strokeOpacity || 1);\n style.dom.setAttribute('fill-opacity', style.fillOpacity || 1);\n style.dom.setAttribute('stroke-width', style.strokeWidth || 1);\n\n this.groupMain.appendChild(style.dom);\n };\n // i is bar or box\n\n var styles = {};\n\n if (typeof errorstyles == 'string') {\n errorstyles = {};\n }\n\n for (var j = 0, l = pairs.length; j < l; j++) {\n\n if (errorstyles.all) {\n\n errorstyles[pairs[j][1]] = extend$1(true, {}, errorstyles.all);\n errorstyles[pairs[j][2]] = extend$1(true, {}, errorstyles.all);\n }\n\n if (errorstyles[pairs[j][0]]) {\n //.x, .y\n\n errorstyles[pairs[j][1]] = extend$1(true, {}, errorstyles[pairs[j][0]]);\n errorstyles[pairs[j][2]] = extend$1(true, {}, errorstyles[pairs[j][0]]);\n }\n\n for (var k = 1; k <= 2; k++) {\n\n if (errorstyles[pairs[j][k]]) {\n\n styles[pairs[j][k]] = errorstyles[pairs[j][k]];\n makePath(styles[pairs[j][k]]);\n }\n }\n }\n\n return styles;\n },\n\n errorDrawInit: function () {\n if (this.errorboxStyle) {\n\n this.errorboxStyle.paths = {\n top: '',\n bottom: '',\n left: '',\n right: ''\n };\n }\n\n if (this.errorbarStyle) {\n\n this.errorbarStyle.paths = {\n top: '',\n bottom: '',\n left: '',\n right: ''\n };\n }\n },\n\n errorAddPoint: function (index, dataX, dataY, xpx, ypx) {\n\n /* eslint-disable no-cond-assign */\n let error;\n if (error = this.waveform.getErrorBarXBelow(index)) {\n this.errorbarStyle.paths.left += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.left += this.makeBarX(this.getX(dataX - error), xpx, this.errorbarStyle.left);\n }\n\n if (error = this.waveform.getErrorBarXAbove(index)) {\n this.errorbarStyle.paths.right += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.right += this.makeBarX(this.getX(dataX + error), xpx, this.errorbarStyle.right);\n }\n\n if (error = this.waveform.getErrorBarYBelow(index)) {\n this.errorbarStyle.paths.bottom += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.bottom += this.makeBarY(this.getY(dataY - error), ypx, this.errorbarStyle.bottom);\n }\n\n if (error = this.waveform.getErrorBarYAbove(index)) {\n this.errorbarStyle.paths.top += ' M ' + xpx + ' ' + ypx;\n this.errorbarStyle.paths.top += this.makeBarY(this.getY(dataY + error), ypx, this.errorbarStyle.top);\n }\n\n if (error = this.waveform.getErrorBoxXBelow(index)) {\n this.errorboxStyle.paths.left += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.left += this.makeBoxX(this.getX(dataX - error), xpx, this.errorboxStyle.left);\n }\n\n if (error = this.waveform.getErrorBoxXAbove(index)) {\n this.errorboxStyle.paths.right += ' M ' + xpx + ' ' + ypx;\n\n this.errorboxStyle.paths.right += this.makeBoxX(this.getX(dataX + error), xpx, this.errorboxStyle.right);\n }\n\n if (error = this.waveform.getErrorBoxYBelow(index)) {\n this.errorboxStyle.paths.bottom += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.bottom += this.makeBoxY(this.getY(dataY - error), ypx, this.errorboxStyle.bottom);\n }\n\n if (error = this.waveform.getErrorBoxYAbove(index)) {\n this.errorboxStyle.paths.top += ' M ' + xpx + ' ' + ypx;\n this.errorboxStyle.paths.top += this.makeBoxY(this.getY(dataY + error), ypx, this.errorboxStyle.top);\n }\n /* eslint-enable */\n },\n\n errorAddPointBarChart: function (j, posY, xpx, ypx) {\n var error;\n if (this.error && (error = this.error[j])) {\n this.doErrorDraw('y', error, posY, ypx, xpx, ypx);\n }\n },\n\n errorDraw: function () {\n\n if (this.errorbarStyle) {\n\n for (var j in this.errorbarStyle.paths) {\n\n if (this.errorbarStyle[j] && this.errorbarStyle[j].dom) {\n this.errorbarStyle[j].dom.setAttribute('d', this.errorbarStyle.paths[j]);\n }\n }\n }\n\n if (this.errorboxStyle) {\n\n for (var j in this.errorboxStyle.paths) {\n\n if (this.errorboxStyle[j] && this.errorboxStyle[j].dom) {\n this.errorboxStyle[j].dom.setAttribute('d', this.errorboxStyle.paths[j]);\n }\n }\n }\n }\n};\n\n/**\n * Serie line\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends Serie\n */\nclass SerieLine extends Serie {\n\n static default() {\n /**\n * @name SerieLineDefaultOptions\n * @object\n * @static\n * @memberof SerieLine\n */\n return {\n\n lineColor: 'black',\n lineStyle: 1,\n flip: false,\n label: '',\n lineWidth: 1,\n markers: false,\n trackMouse: false,\n trackMouseLabel: false,\n trackMouseLabelRouding: 1,\n lineToZero: false,\n selectableOnClick: false,\n markersIndependant: false,\n overflowX: false,\n overflowY: false\n };\n }\n\n constructor(graph, name, options) {\n\n super(...arguments);\n\n this.selectionType = 'unselected';\n this.markerFamilies = {};\n\n mapEventEmission(this.options, this); // Register events\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n lineWidth: this.options.lineWidth,\n markers: this.options.markers\n };\n\n this.styles.selected = {\n lineWidth: 3\n };\n\n this.extendStyles();\n this.markersDom = new Map();\n\n this.shown = true;\n\n this.data = [];\n this._isMinOrMax = {\n x: {\n min: false,\n max: false\n },\n y: {\n min: false,\n max: false\n }\n };\n\n // Optimize is no markerPoints => save loops\n // this.markerPoints = {};\n\n this.groupLines = document.createElementNS(this.graph.ns, 'g');\n this.domMarker = document.createElementNS(this.graph.ns, 'path');\n this.domMarker.style.cursor = 'pointer';\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n this.additionalData = {};\n\n this.marker = document.createElementNS(this.graph.ns, 'circle');\n this.marker.setAttribute('fill', 'black');\n this.marker.setAttribute('r', 3);\n this.marker.setAttribute('display', 'none');\n\n this.markerLabel = document.createElementNS(this.graph.ns, 'text');\n this.markerLabelSquare = document.createElementNS(this.graph.ns, 'rect');\n this.markerLabelSquare.setAttribute('fill', 'white');\n this.domMarkerHover = {};\n this.domMarkerSelect = {};\n this.markerHovered = 0;\n this.groupMarkerSelected = document.createElementNS(this.graph.ns, 'g');\n\n this.markerPoints = {};\n\n //this.scale = 1;\n //this.shift = 0;\n this.lines = [];\n\n this.groupMain.appendChild(this.groupLines);\n\n this.groupMain.appendChild(this.marker);\n\n this.groupMain.appendChild(this.groupMarkerSelected);\n this.groupMain.appendChild(this.markerLabelSquare);\n this.groupMain.appendChild(this.markerLabel);\n\n this.groupMarkers = document.createElementNS(this.graph.ns, 'g');\n this.groupMain.appendChild(this.groupMarkers);\n\n this.independantMarkers = [];\n\n if (this.initExtended1) {\n this.initExtended1();\n }\n\n this.groupLines.addEventListener('click', e => {\n\n if (this.options.selectableOnClick) {\n\n if (this.isSelected()) {\n\n this.graph.unselectSerie(this);\n } else {\n this.graph.selectSerie(this);\n }\n }\n });\n\n if (this.options.markers) {\n this.setMarkers(this.options.markers, 'unselected');\n }\n }\n\n /**\n * Sets the options of the serie\n * @see SerieLineDefaultOptions\n * @param {Object} options - A object containing the options to set\n * @return {SerieLine} The current serie\n * @memberof SerieLine\n */\n setOptions(options) {\n this.options = extend$1(true, {}, SerieLine.prototype.defaults, options || {});\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n markers: this.options.markers\n };\n\n this.applyLineStyles();\n return this;\n }\n\n onMouseOverMarker(e, index) {\n\n var toggledOn = this.toggleMarker(index, true, true);\n\n if (this.options.onMouseOverMarker) {\n\n this.options.onMouseOverMarker(index, this.infos ? this.infos[index] || false : false, [this.waveform.getX(index), this.waveform.getY(index)]);\n }\n }\n\n onMouseOutMarker(e, index) {\n this.markersOffHover();\n\n if (this.options.onMouseOutMarker) {\n this.options.onMouseOutMarker(index, this.infos ? this.infos[index] || false : false, [this.waveform.getX(index), this.waveform.getY(index)]);\n }\n }\n\n /**\n * Selects one of the markers of the serie\n * @param {Number} index - The point index to select (starting at 0)\n * @param {Boolean} [force = undefined] - Forces state of the marker. true forces selection, false forces deselection. undefined toggles the state of the marker\n * @param {Boolean} [hover = false] - true to set the selection in mode \"hover\" (will disappear on mouse out of the marker). false to set the selection in mode \"select\" (will disappear when another marker is selected)\n * @returns {Boolean} The new state of the marker\n * @memberof SerieLine\n */\n toggleMarker(index, force, hover) {\n\n let i = index;\n\n var _on;\n if (typeof force === 'undefined') {\n _on = !hover ? !this.domMarkerSelect[index] : !this.domMarkerHover[index];\n }\n var el = this['domMarker' + (hover ? 'Hover' : 'Select')];\n\n if (_on || force === true) {\n\n if (!el[index]) {\n\n var dom = document.createElementNS(this.graph.ns, 'path');\n\n this.setMarkerStyleTo(dom, this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(i)]);\n this['domMarker' + (hover ? 'Hover' : 'Select')][index] = dom;\n this.groupMarkerSelected.appendChild(dom);\n } else {\n dom = el[index];\n }\n\n let x = this.getX(this.waveform.getX(i)),\n y = this.getY(this.waveform.getY(i));\n\n dom.setAttribute('d', 'M ' + x + ' ' + y + ' ' + this.getMarkerPath(this.markerFamilies[this.selectionType][this.getMarkerCurrentFamily(i)], 1));\n\n if (hover) {\n this.markerHovered++;\n }\n } else if (!_on || force === false) {\n\n if (hover && this.domMarkerHover[index] && !this.domMarkerSelect[index] || this.domMarkerSelect[index]) {\n\n if (!el[index]) {\n return;\n }\n\n this.groupMarkerSelected.removeChild(el[index]);\n\n delete el[index];\n\n if (hover) this.markerHovered--;\n }\n }\n\n return _on;\n }\n\n /**\n * Toggles off markers that have the hover mode \"on\"\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n markersOffHover() {\n\n for (var i in this.domMarkerHover) {\n this.toggleMarker(i.split(','), false, true);\n }\n return this;\n }\n\n /**\n * Toggles off markers that have the select mode \"on\"\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n markersOffSelect() {\n\n for (var i in this.domMarkerSelect) {\n this.toggleMarker(i.split(','), false, false);\n }\n return this;\n }\n\n onClickOnMarker(e, index) {\n\n var toggledOn = this.toggleMarker(index);\n\n if (toggledOn && this.options.onSelectMarker) {\n this.options.onSelectMarker(index, this.infos ? this.infos[index[0]] || false : false);\n }\n\n if (!toggledOn && this.options.onUnselectMarker) {\n this.options.onUnselectMarker(index, this.infos ? this.infos[index[0]] || false : false);\n }\n\n if (this.options.onToggleMarker) {\n this.options.onToggleMarker(index, this.infos ? this.infos[index[0]] || false : false, toggledOn);\n }\n }\n\n _getMarkerIndexFromEvent(e) {\n var px = this.graph._getXY(e);\n\n // return this.searchIndexByPxXY( ( px.x ), ( px.y ) );\n return this.searchIndexByPxXY(px.x - this.graph.getPaddingLeft(), px.y - this.graph.getPaddingTop());\n }\n\n onMouseWheel() {}\n\n /**\n * Cleans the DOM from the serie internal object (serie and markers). Mostly used internally when a new {@link Serie#setData} is called\n * @returns {SerieLine} The current serie\n * @memberof SerieLine\n */\n empty() {\n\n for (var i = 0, l = this.lines.length; i < l; i++) {\n this.groupLines.removeChild(this.lines[i]);\n }\n this.lines = [];\n\n return this;\n }\n\n /**\n * Applies a selection to the serie\n * @param {String} [ selectionType = \"selected\" ] - The selection name\n * @returns {SerieLine} The current serie\n * @see SerieLine#unselect\n * @memberof SerieLine\n */\n select(selectionType) {\n\n selectionType = selectionType || 'selected';\n\n this.selected = selectionType !== 'unselected';\n\n if (this.areMarkersShown() || this.areMarkersShown(selectionType)) {\n this.selectionType = selectionType;\n\n this.draw(true); // Drawing is absolutely required here\n this.applyLineStyles();\n } else {\n this.selectionType = selectionType;\n this.applyLineStyles();\n }\n\n this.applyLineStyle(this.getSymbolForLegend());\n return this;\n }\n\n /**\n * Removes the selection to the serie. Effectively, calls {@link SerieLine#select}(\"unselected\").\n * @returns {SerieLine} The current serie\n * @see SerieLine#select\n * @memberof SerieLine\n */\n unselect() {\n\n this.selected = false;\n\n return this.select('unselected');\n }\n\n /**\n * Degrades the data of the serie. This option is used for big data sets that have monotoneously increasing (or decreasing) x values.\n * For example, a serie containing 1'000'000 points, displayed over 1'000px, will have 1'000 points per pixel. Often it does not make sense to display more than 2-3 points per pixel.\n * degrade( pxPerPoint ) allows a degradation of the serie, based on a a number of pixel per point. It computes the average of the data that would be displayed over each pixel range\n * Starting from jsGraph 2.0, it does not calculate the minimum and maximum and creates the zone serie anymore\n * @return {SerieLine} The current serie instance\n * @example serie.degrade( 0.5 ); // Will display 2 points per pixels\n * @memberof SerieLine\n */\n degrade(pxPerP) {\n\n this.degradationPx = pxPerP;\n return this;\n }\n\n drawInit(force) {\n\n try {\n this.axisCheck();\n } catch (e) {\n console.warn(e);\n return false;\n }\n\n this.currentLineId = 0;\n this.counter = 0;\n this._drawn = true;\n this.currentLine = '';\n\n // Degradation\n\n if (this.waveform) {\n\n if (this.degradationPx) {\n\n this.waveform.resampleForDisplay({\n\n resampleToPx: this.degradationPx,\n xPosition: this.getXAxis().getPx.bind(this.getXAxis()),\n minX: this.getXAxis().getCurrentMin(),\n maxX: this.getXAxis().getCurrentMax()\n\n });\n\n this._dataToUse = [this.waveform.getDataToUseFlat()];\n } else if (this.waveform.hasAggregation()) {\n\n let xaxis = this.getXAxis(),\n numberOfPointsInTotal = this.graph.getDrawingWidth() * (xaxis.getDataMax() - xaxis.getDataMin()) / (xaxis.getCurrentMax() - xaxis.getCurrentMin()),\n promise = this.waveform.selectAggregatedData(numberOfPointsInTotal);\n\n if (promise instanceof Promise) {\n\n promise.then(() => {\n\n this.draw(force);\n });\n\n return false;\n } else if (promise === false) {\n\n return false;\n } else {\n\n this._dataToUse = this.waveform.getDataToUseFlat();\n }\n }\n\n // this._dataToUse = this.waveform.getDataToUseFlat();\n } else {\n\n this._dataToUse = this.data;\n this._xDataToUse = this.xData;\n }\n\n return true;\n }\n\n removeLinesGroup() {\n this._afterLinesGroup = this.groupLines.nextSibling;\n this.groupMain.removeChild(this.groupLines);\n }\n\n insertLinesGroup() {\n\n if (!this._afterLinesGroup) {\n throw 'Could not find group after lines to insertion.';\n }\n\n this.groupMain.insertBefore(this.groupLines, this._afterLinesGroup);\n this._afterLinesGroup = false;\n }\n\n removeExtraLines() {\n\n var i = this.currentLineId,\n l = this.lines.length;\n\n for (; i < l; i++) {\n this.groupLines.removeChild(this.lines[i]);\n }\n\n this.lines.splice(this.currentLineId, l - this.currentLineId);\n this.currentLineId = 0;\n }\n\n /**\n * Draws the serie\n * @memberof SerieLine\n */\n draw(force) {\n // Serie redrawing\n\n super.draw(...arguments);\n\n if (!this.getXAxis() || !this.getYAxis()) {\n throw 'No axes were defined for this serie';\n }\n\n if (force || this.hasDataChanged()) {\n if (!this.drawInit(force)) {\n return;\n }\n\n var data = this._dataToUse,\n xData = this._xDataToUse,\n slotToUse = this._slotToUse;\n\n this.removeLinesGroup();\n this.eraseMarkers();\n\n this.lookForMaxima = true;\n this.lookForMinima = false;\n\n this.markerFamily = this.markerFamilies[this.selectionType || 'unselected'];\n\n this.pos0 = this.getYAxis().getPos(0);\n\n if (this.hasErrors()) {\n this.errorDrawInit();\n }\n\n this._draw();\n\n if (this.hasErrors()) {\n this.errorDraw();\n }\n\n this.removeExtraLines();\n this.insertMarkers();\n this.insertLinesGroup();\n }\n\n // Unhovers everything\n for (var i in this.domMarkerHover) {\n this.toggleMarker(i.split(','), false, true);\n }\n\n // Deselects everything\n for (var i in this.domMarkerSelect) {\n this.toggleMarker(i.split(','), false, false);\n }\n\n this.applyLineStyle(this.getSymbolForLegend());\n\n if (this.hasStyleChanged(this.selectionType)) {\n this.updateStyle();\n }\n\n this.dataHasChanged(false);\n super.afterDraw();\n }\n\n _draw() {\n\n let self = this,\n waveform = this.waveform,\n data,\n x,\n y,\n lastX = false,\n lastY = false,\n xpx,\n ypx,\n xpx2,\n ypx2,\n xAxis = this.getXAxis(),\n yAxis = this.getYAxis(),\n xMin = xAxis.getCurrentMin(),\n yMin = yAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n yMax = yAxis.getCurrentMax();\n\n if (!waveform) {\n return;\n }\n\n data = waveform.getData(true);\n\n // Y crossing\n let yLeftCrossingRatio,\n yLeftCrossing,\n yRightCrossingRatio,\n yRightCrossing,\n xTopCrossingRatio,\n xTopCrossing,\n xBottomCrossingRatio,\n xBottomCrossing,\n\n\n /*xshift = waveform.getXShift(),\n xscale = wave.getXScale(),*/\n yshift = waveform.getShift(),\n yscale = waveform.getScale();\n\n let pointOutside = false;\n let lastPointOutside = false;\n let pointOnAxis;\n\n let _monotoneous = this.isMonotoneous(),\n _markersShown = this.markersShown();\n\n let i = 0,\n l = waveform.getLength();\n\n this.currentLine = '';\n\n if (waveform.isXMonotoneous()) {\n\n if (waveform.isXMonotoneousAscending()) {\n\n i = waveform.getIndexFromX(xMin, true) || 0;\n l = waveform.getIndexFromX(xMax, true);\n\n if (l === false) {\n l = waveform.getLength();\n }\n } else {\n\n i = waveform.getIndexFromX(xMax, true) || 0;\n l = waveform.getIndexFromX(xMin, true);\n\n if (l === false) {\n l = waveform.getLength();\n }\n }\n\n l += 2;\n if (l > data.length) {\n l = data.length;\n }\n }\n\n for (; i < l; i += 1) {\n\n x = waveform.getX(i, true);\n y = data[i] * yscale + yshift;\n\n if (x != x || y != y) {\n // NaN checks\n this._createLine();\n continue;\n }\n\n if (!this.options.overflowX && x < xMin && lastX < xMin || !this.options.overflowX && x > xMax && lastX > xMax || (!this.options.overflowY && y < yMin && lastY < yMin || !this.options.overflowY && y > yMax && lastY > yMax) && !this.options.lineToZero) {\n lastX = x;\n lastY = y;\n lastPointOutside = true;\n continue;\n }\n\n this.counter2 = i;\n\n if (_markersShown) {\n this.getMarkerCurrentFamily(this.counter2);\n }\n\n xpx2 = this.getX(x);\n ypx2 = this.getY(y);\n //xpx2 = 0;\n //ypx2 = 0;\n\n if (xpx2 == xpx && ypx2 == ypx) {\n continue;\n }\n\n if (xpx2 != xpx2 || ypx2 != ypx2) {\n // NaN checks\n if (this.counter > 0) {\n\n this._createLine();\n }\n continue;\n }\n\n if (!_monotoneous) {\n\n pointOutside = !this.options.overflowX && (x < xMin || x > xMax) || !this.options.overflowY && (y < yMin || y > yMax);\n } else {\n pointOutside = !this.options.overflowY && (y < yMin || y > yMax);\n }\n\n if (this.options.lineToZero) {\n pointOutside = x < xMin || x > xMax;\n\n if (pointOutside) {\n continue;\n }\n } else {\n\n if (pointOutside || lastPointOutside) {\n\n if ((lastX === false || lastY === false) && !lastPointOutside) {\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n } else {\n\n pointOnAxis = [];\n // Y crossing\n yLeftCrossingRatio = (x - xMin) / (x - lastX);\n yLeftCrossing = y - yLeftCrossingRatio * (y - lastY);\n yRightCrossingRatio = (x - xMax) / (x - lastX);\n yRightCrossing = y - yRightCrossingRatio * (y - lastY);\n\n // X crossing\n xTopCrossingRatio = (y - yMin) / (y - lastY);\n xTopCrossing = x - xTopCrossingRatio * (x - lastX);\n xBottomCrossingRatio = (y - yMax) / (y - lastY);\n xBottomCrossing = x - xBottomCrossingRatio * (x - lastX);\n\n if (yLeftCrossingRatio < 1 && yLeftCrossingRatio > 0 && yLeftCrossing !== false && yLeftCrossing < yMax && yLeftCrossing > yMin) {\n pointOnAxis.push([xMin, yLeftCrossing]);\n }\n\n if (yRightCrossingRatio < 1 && yRightCrossingRatio > 0 && yRightCrossing !== false && yRightCrossing < yMax && yRightCrossing > yMin) {\n pointOnAxis.push([xMax, yRightCrossing]);\n }\n\n if (xTopCrossingRatio < 1 && xTopCrossingRatio > 0 && xTopCrossing !== false && xTopCrossing < xMax && xTopCrossing > xMin) {\n pointOnAxis.push([xTopCrossing, yMin]);\n }\n\n if (xBottomCrossingRatio < 1 && xBottomCrossingRatio > 0 && xBottomCrossing !== false && xBottomCrossing < xMax && xBottomCrossing > xMin) {\n pointOnAxis.push([xBottomCrossing, yMax]);\n }\n\n if (pointOnAxis.length > 0) {\n\n if (!pointOutside) {\n // We were outside and now go inside\n\n if (pointOnAxis.length > 1) {\n console.error('Programmation error. Please e-mail me.');\n console.log(pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY);\n }\n\n this._createLine();\n this._addPoint(this.getX(pointOnAxis[0][0]), this.getY(pointOnAxis[0][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n this._addPoint(xpx2, ypx2, lastX, lastY, false, false, true);\n } else if (!lastPointOutside) {\n // We were inside and now go outside\n\n if (pointOnAxis.length > 1) {\n console.error('Programmation error. Please e-mail me.');\n console.log(pointOnAxis, xBottomCrossing, xTopCrossing, yRightCrossing, yLeftCrossing, y, yMin, yMax, lastY);\n }\n\n this._addPoint(this.getX(pointOnAxis[0][0]), this.getY(pointOnAxis[0][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n } else {\n\n // No crossing: do nothing\n if (pointOnAxis.length == 2) {\n this._createLine();\n\n this._addPoint(this.getX(pointOnAxis[0][0]), this.getY(pointOnAxis[0][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n this._addPoint(this.getX(pointOnAxis[1][0]), this.getY(pointOnAxis[1][1]), pointOnAxis[0][0], pointOnAxis[0][1], false, false, false);\n }\n }\n } else if (!pointOutside) {\n\n this._addPoint(xpx2, ypx2, lastX, lastY, i, false, false);\n } // else {\n // Norman:\n // This else case is not the sign of a bug. If yLeftCrossing == 0 or 1 for instance, pointOutside or lastPointOutside will be true\n // However, there's no need to draw anything because the point is on the axis and will already be covered.\n // 28 Aug 2015\n\n /*\n if ( lastPointOutside !== pointOutside ) {\n console.error( \"Programmation error. A crossing should have been found\" );\n console.log( yLeftCrossing, yLeftCrossingRatio, yMax, yMin );\n console.log( yRightCrossing, yRightCrossingRatio, yMax, yMin );\n console.log( xTopCrossing, xTopCrossingRatio, xMax, xMin );\n console.log( xBottomCrossing, xBottomCrossingRatio, xMax, xMin );\n console.log( pointOutside, lastPointOutside )\n }\n */\n // }\n }\n\n xpx = xpx2;\n ypx = ypx2;\n lastX = x;\n lastY = y;\n\n lastPointOutside = pointOutside;\n\n continue;\n }\n }\n\n this._addPoint(xpx2, ypx2, x, y, i, false, true);\n\n //this.detectPeaks( x, y );\n\n xpx = xpx2;\n ypx = ypx2;\n\n lastX = x;\n lastY = y;\n }\n\n this._createLine();\n\n if (this._tracker) {\n\n if (this._trackerDom) {\n this._trackerDom.remove();\n }\n\n var cloned = this.groupLines.cloneNode(true);\n this.groupMain.appendChild(cloned);\n\n for (i = 0, l = cloned.children.length; i < l; i++) {\n\n cloned.children[i].setAttribute('stroke', 'transparent');\n cloned.children[i].setAttribute('stroke-width', '25px');\n cloned.children[i].setAttribute('pointer-events', 'stroke');\n }\n\n this._trackerDom = cloned;\n\n this.groupMain.addEventListener('mousemove', e => {\n var coords = this.graph._getXY(e),\n ret = this.handleMouseMove(false, false);\n\n this._trackingCallback(this, ret, coords.x, coords.y);\n });\n\n this.groupMain.addEventListener('mouseleave', e => {\n this._trackingOutCallback(this);\n });\n }\n\n return this;\n }\n\n kill() {\n super.kill();\n }\n\n /**\n * @param {Number} k - Index of the point for which we should get the family\n * @memberof SerieLine\n */\n getMarkerCurrentFamily(k) {\n\n if (!this.markerPoints || !this.markerPoints[this.selectionType]) {\n return;\n }\n\n var family;\n\n for (var z = 0; z < this.markerPoints[this.selectionType].length; z++) {\n if (this.markerPoints[this.selectionType][z][0] <= k) {\n // This one is a possibility !\n if (this.markerPoints[this.selectionType][z][1] >= k) {\n // Verify that it's in the boundary\n this.markerCurrentFamily = this.markerPoints[this.selectionType][z][2];\n family = this.markerFamilies[this.selectionType][this.markerCurrentFamily];\n }\n } else {\n break;\n }\n }\n\n if (!family) {\n return false;\n }\n this.getMarkerDom(family);\n return this.markerCurrentFamily;\n }\n\n setMarkerStyleTo(dom, family) {\n\n if (!dom || !family) {\n console.trace();\n throw 'Cannot set marker style. DOM does not exist.';\n }\n\n dom.setAttribute('fill', family.fillColor || 'transparent');\n dom.setAttribute('stroke', family.strokeColor || this.getLineColor());\n dom.setAttribute('stroke-width', family.strokeWidth || 1);\n }\n\n /**\n * Hides the tracking marker (see the trackMouse option)\n * @memberof SerieLine\n */\n hideTrackingMarker() {\n this.marker.setAttribute('display', 'none');\n this.markerLabel.setAttribute('display', 'none');\n this.markerLabelSquare.setAttribute('display', 'none');\n }\n\n _addPoint(xpx, ypx, x, y, j, move, allowMarker) {\n\n /*if( ! this.currentLineId ) {\n throw \"No current line\"\n }* @memberof SerieLine\n */\n\n if (xpx !== xpx || ypx !== ypx) {\n return;\n }\n\n if (this.counter == 0) {\n this.currentLine = 'M ';\n } else {\n\n if (this.options.lineToZero || move) {\n this.currentLine += 'M ';\n } else {\n this.currentLine += 'L ';\n }\n }\n\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += ypx;\n this.currentLine += ' ';\n\n if (this.options.lineToZero && this.pos0 !== undefined) {\n\n this.currentLine += 'L ';\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += this.pos0;\n this.currentLine += ' ';\n }\n\n if (this.hasErrors()) {\n this.errorAddPoint(j, x, y, xpx, ypx);\n }\n\n if (!this.markerPoints) {\n this.counter++;\n\n return;\n }\n\n if (this.markersShown() && allowMarker !== false && this.markerFamily) {\n drawMarkerXY(this, this.markerFamily[this.markerCurrentFamily], xpx, ypx, this.markersDom.get(this.markerFamily[this.markerCurrentFamily]));\n }\n\n this.counter++;\n }\n\n // Returns the DOM\n _createLine() {\n\n var i = this.currentLineId++,\n line;\n\n // Creates a line if needed\n if (this.lines[i]) {\n line = this.lines[i];\n } else {\n\n line = document.createElementNS(this.graph.ns, 'path');\n this.applyLineStyle(line);\n this.groupLines.appendChild(line);\n this.lines[i] = line;\n }\n\n if (this.counter == 0) {\n line.setAttribute('d', '');\n } else {\n line.setAttribute('d', this.currentLine);\n }\n\n this.currentLine = 'M ';\n this.counter = 0;\n\n return line;\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyles() {\n\n for (var i = 0; i < this.lines.length; i++) {\n this.applyLineStyle(this.lines[i]);\n }\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n } else {\n line.removeAttribute('stroke-dasharray');\n }\n line.setAttribute('fill', 'none');\n //\tline.setAttribute('shape-rendering', 'optimizeSpeed');\n }\n\n /**\n * Updates the current style (lines + legend) of the serie. Use this method if you have explicitely changed the options of the serie\n * @example var opts = { lineColor: 'red' };\n * var s = graph.newSerie( \"name\", opts ).setData( someData );\n * opts.lineColor = 'green';\n * s.updateStyle(); // Sets the lineColor to green\n * s.draw(); // Would also do the same thing, but recalculates the whole serie display (including (x,y) point pairs)\n * @memberof SerieLine\n */\n updateStyle() {\n this.applyLineStyles();\n this.setLegendSymbolStyle();\n\n this.styleHasChanged(false);\n }\n\n // Revised August 2014. Ok\n getMarkerPath(family, add) {\n\n var z = family.zoom || 1,\n add = add || 0,\n el = [];\n\n switch (family.type) {\n\n case 2:\n el = ['m', -2, -2, 'l', 4, 4, 'm', -4, 0, 'l', 4, -4];\n break;\n\n case 3:\n el = ['m', -2, 0, 'l', 4, 0, 'm', -2, -2, 'l', 0, 4];\n break;\n\n case 4:\n el = ['m', -1, -1, 'l', 2, 0, 'l', -1, 2, 'z'];\n break;\n\n default:\n case 1:\n el = ['m', -2, -2, 'l', 4, 0, 'l', 0, 4, 'l', -4, 0, 'z'];\n break;\n\n }\n\n if ((z == 1 || !z) && !add) {\n return el.join(' ');\n }\n\n var num = 'number';\n\n if (!el) {\n return;\n }\n\n for (var i = 0, l = el.length; i < l; i++) {\n\n if (typeof el[i] == num) {\n\n el[i] *= z + add;\n }\n }\n\n return el.join(' ');\n }\n\n // Revised August 2014. Ok\n getMarkerDom(family) {\n\n var self = this;\n\n if (!this.markersDom.has(family)) {\n\n var dom = document.createElementNS(this.graph.ns, 'path');\n this.setMarkerStyleTo(dom, family);\n this.markersDom.set(family, {\n dom: dom,\n path: ''\n });\n\n dom.addEventListener('mouseover', function (e) {\n var closest = self._getMarkerIndexFromEvent(e);\n self.onMouseOverMarker(e, closest);\n });\n\n dom.addEventListener('mouseout', function (e) {\n var closest = self._getMarkerIndexFromEvent(e);\n self.onMouseOutMarker(e, closest);\n });\n\n dom.addEventListener('click', function (e) {\n var closest = self._getMarkerIndexFromEvent(e);\n self.onClickOnMarker(e, closest);\n });\n }\n\n return family.dom;\n }\n\n // In case markers are not grouped in families but independant\n getMarkerDomIndependent(index, family) {\n\n if (!this.independantMarkers[index]) {\n\n var dom = document.createElementNS(this.graph.ns, 'path');\n this.setMarkerStyleTo(dom, family);\n\n dom.addEventListener('mouseover', e => {\n\n this.onMouseOverMarker(e, index);\n });\n\n dom.addEventListener('mouseout', e => {\n\n this.onMouseOutMarker(e, index);\n });\n\n dom.addEventListener('click', e => {\n\n this.onClickOnMarker(e, index);\n });\n\n this.independantMarkers[index] = dom;\n }\n\n this.groupMarkers.appendChild(this.independantMarkers[index]);\n\n return this.independantMarkers[index];\n }\n\n /**\n * Searches the closest point pair (x,y) to the a pair of pixel position\n * @param {Number} x - The x position in pixels (from the left)\n * @param {Number} y - The y position in pixels (from the left)\n * @returns {Number} Index in the data array of the closest (x,y) pair to the pixel position passed in parameters\n * @memberof SerieLine\n */\n searchIndexByPxXY(x, y) {\n\n var oldDist = false,\n xyindex = false,\n dist;\n\n var xData = this._xDataToUse,\n p_x,\n p_y;\n\n for (var k = 0, m = this.waveform.getLength(); k < m; k += 1) {\n\n p_x = this.waveform.getX(k);\n p_y = this.waveform.getY(k);\n\n dist = Math.pow(this.getX(p_x) - x, 2) + Math.pow(this.getY(p_y) - y, 2);\n //console.log(x, y, dist, this.data[i][k], this.data[i][k + 1]);\n\n if (!oldDist || dist < oldDist) {\n oldDist = dist;\n xyindex = k;\n }\n }\n\n return xyindex;\n }\n\n /**\n * Performs a binary search to find the closest point index to an x value. For the binary search to work, it is important that the x values are monotoneous.\n * @param {Number} valX - The x value to search for\n * @returns {Object} Index in the data array of the closest (x,y) pair to the pixel position passed in parameters\n * @memberof SerieLine\n */\n searchClosestValue(valX, valY) {\n\n if (this.waveform) {\n\n const indexX = this.waveform.getIndexFromXY(valX, valY, undefined, undefined, this.getXAxis().getRelPx(1), this.getYAxis().getRelPx(1));\n\n let returnObj = {};\n\n let direction;\n\n if (valX > this.waveform.getX(indexX)) {\n direction = 0;\n } else {\n direction = 1;\n }\n\n Object.assign(returnObj, {\n indexMin: indexX + direction,\n indexMax: indexX + direction + 1,\n indexClosest: indexX,\n xMin: this.waveform.getX(indexX + direction),\n xMax: this.waveform.getX(indexX + direction + 1),\n yMin: this.waveform.getY(indexX + direction),\n yMax: this.waveform.getY(indexX + direction + 1),\n xClosest: this.waveform.getX(indexX),\n yClosest: this.waveform.getY(indexX),\n xExact: valX\n });\n return returnObj;\n }\n }\n\n handleMouseMove(xValue, doMarker, yValue) {\n\n var valX = xValue || this.getXAxis().getMouseVal(),\n valY = yValue || this.getYAxis().getMouseVal();\n\n var value = this.searchClosestValue(valX, valY);\n\n if (!value) {\n return;\n }\n\n var ratio, intY;\n\n if (value.xMax == value.xMin) {\n intY = value.yMin;\n } else {\n\n //ratio = ( valX - value.xMin ) / ( value.xMax - value.xMin );\n //intY = ( ( 1 - ratio ) * value.yMin + ratio * value.yMax );\n }\n\n if (doMarker && this.options.trackMouse) {\n\n if (value.xMin == undefined) {\n\n return false;\n } else {\n\n if (!this.marker) {\n return;\n }\n\n var x = this.getX(this.getFlip() ? value.yClosest : value.xClosest);\n var y = this.getY(this.getFlip() ? value.xClosest : value.yClosest);\n\n if (isNaN(x) || isNaN(y)) {\n return;\n }\n\n this.marker.setAttribute('display', 'block');\n this.marker.setAttribute('cx', x);\n this.marker.setAttribute('cy', y);\n\n this.markerLabel.setAttribute('display', 'block');\n this.markerLabelSquare.setAttribute('display', 'block');\n\n switch (this.options.trackMouseLabel) {\n\n case false:\n\n break;\n\n default:\n this.markerLabel.textContent = this.options.trackMouseLabel.replace('', valX.toFixed(this.options.trackMouseLabelRouding)).replace('', intY.toFixed(this.options.trackMouseLabelRouding));\n break;\n }\n\n this.markerLabel.setAttribute('x', x + 5);\n this.markerLabel.setAttribute('y', y - 5);\n\n this.markerLabelSquare.setAttribute('x', x + 5);\n this.markerLabelSquare.setAttribute('y', y - 5 - this.graph.options.fontSize);\n this.markerLabelSquare.setAttribute('width', this.markerLabel.getComputedTextLength() + 2);\n this.markerLabelSquare.setAttribute('height', this.graph.options.fontSize + 2);\n }\n }\n\n return {\n xBefore: value.xMin,\n xAfter: value.xMax,\n yBefore: value.yMin,\n yAfter: value.yMax,\n trueX: value.xExact,\n indexClosest: value.indexClosest,\n interpolatedY: intY,\n\n xClosest: value.xClosest,\n yClosest: value.yClosest\n };\n }\n /**\n * Gets the maximum value of the y values between two x values. The x values must be monotoneously increasing\n * @param {Number} startX - The start of the x values\n * @param {Number} endX - The end of the x values\n * @returns {Number} Maximal y value in between startX and endX\n * @memberof SerieLine\n */\n getMax(start, end) {\n\n var start2 = Math.min(start, end),\n end2 = Math.max(start, end),\n v1 = this.searchClosestValue(start2),\n v2 = this.searchClosestValue(end2),\n i,\n j,\n max = -Infinity,\n initJ,\n maxJ;\n\n // console.log( start2, end2, v1, v2 );\n\n if (!v1) {\n start2 = this.minX;\n v1 = this.searchClosestValue(start2);\n }\n\n if (!v2) {\n end2 = this.maxX;\n v2 = this.searchClosestValue(end2);\n }\n\n if (!v1 || !v2) {\n return -Infinity;\n }\n\n for (i = v1.dataIndex; i <= v2.dataIndex; i++) {\n initJ = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n maxJ = i == v2.dataIndex ? v2.xBeforeIndexArr : this.data[i].length;\n\n for (j = initJ; j <= maxJ; j += 2) {\n max = Math.max(max, this.data[i][j + 1]);\n }\n }\n\n return max;\n }\n\n /**\n * Gets the minimum value of the y values between two x values. The x values must be monotoneously increasing\n * @param {Number} startX - The start of the x values\n * @param {Number} endX - The end of the x values\n * @returns {Number} Maximal y value in between startX and endX\n * @memberof SerieLine\n */\n getMin(start, end) {\n\n var start2 = Math.min(start, end),\n end2 = Math.max(start, end),\n v1 = this.searchClosestValue(start2),\n v2 = this.searchClosestValue(end2),\n i,\n j,\n min = Infinity,\n initJ,\n maxJ;\n\n if (!v1) {\n start2 = this.minX;\n v1 = this.searchClosestValue(start2);\n }\n\n if (!v2) {\n end2 = this.maxX;\n v2 = this.searchClosestValue(end2);\n }\n\n if (!v1 || !v2) {\n return Infinity;\n }\n\n for (i = v1.dataIndex; i <= v2.dataIndex; i++) {\n initJ = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n maxJ = i == v2.dataIndex ? v2.xBeforeIndexArr : this.data[i].length;\n\n for (j = initJ; j <= maxJ; j += 2) {\n min = Math.min(min, this.data[i][j + 1]);\n }\n }\n\n return min;\n }\n\n /* LINE STYLE * @memberof SerieLine\n */\n\n setStyle(style, selectionType = 'unselected') {\n\n this.styles[selectionType] = style;\n this.styleHasChanged(selectionType);\n }\n\n setLineStyle(number, selectionType = 'unselected', applyToSelected) {\n\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].lineStyle = number;\n\n if (applyToSelected) {\n this.setLineStyle(number, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getLineStyle(selectionType) {\n return this.getStyle(selectionType).lineStyle;\n }\n\n getLineDashArray(selectionType = this.selectionType || 'unselected') {\n\n switch (this.getStyle(selectionType).lineStyle) {\n\n case 2:\n return '1, 1';\n break;\n case 3:\n return '2, 2';\n break;\n case 4:\n return '3, 3';\n break;\n case 5:\n return '4, 4';\n break;\n case 6:\n return '5, 5';\n break;\n\n case 7:\n return '5 2';\n break;\n case 8:\n return '2 5';\n break;\n\n case 9:\n return '4 2 4 4';\n break;\n case 10:\n return '1,3,1';\n break;\n case 11:\n return '9 2';\n break;\n case 12:\n return '2 9';\n break;\n\n case 1:\n case false:\n return false;\n break;\n\n default:\n return this.styles[selectionType].lineStyle;\n break;\n }\n\n this.styleHasChanged(selectionType);\n }\n\n getStyle(selectionType = this.selectionType || 'unselected') {\n return this.styles[selectionType];\n }\n\n extendStyles() {\n for (var i in this.styles) {\n\n var s = this.styles[i];\n if (s) {\n this.styles[i] = extend$1(true, {}, this.styles.unselected, s);\n }\n }\n }\n\n extendStyle(styleTarget, styleOrigin) {\n var s = this.styles[styleTarget];\n\n this.styles[styleTarget] = extend$1(true, {}, this.styles[styleOrigin || 'unselected'], s || {});\n\n this.styles[styleTarget].markers.map(function (marker) {\n if (marker.dom) {\n marker.dom = '';\n }\n });\n\n this._recalculateMarkerPoints(styleTarget, this.styles[styleTarget].markers);\n this.styleHasChanged(styleTarget);\n }\n\n /* * @memberof SerieLine\n */\n\n setLineWidth(width, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].lineWidth = width;\n\n if (applyToSelected) {\n this.setLineWidth(width, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getLineWidth(selectionType) {\n\n return this.getStyle(selectionType).lineWidth || 1;\n }\n\n /* LINE COLOR * @memberof SerieLine\n */\n setLineColor(color, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].lineColor = color;\n\n if (applyToSelected) {\n this.setLineColor(color, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getLineColor(selectionType) {\n\n return this.getStyle(selectionType).lineColor || 'black';\n }\n\n /* * @memberof SerieLine\n */\n\n /* MARKERS * @memberof SerieLine\n */\n showMarkers(selectionType, redraw) {\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].showMarkers = true;\n\n if (redraw && this._drawn) {\n this.draw(true);\n } else {\n this.styleHasChanged(selectionType);\n }\n\n return this;\n }\n\n hideMarkers(selectionType, redraw) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType].showMarkers = false;\n\n if (redraw && this._drawn) {\n this.draw(true);\n } else {\n this.styleHasChanged(selectionType);\n }\n return this;\n }\n\n markersShown(selectionType) {\n return this.getStyle(selectionType).showMarkers !== false;\n }\n\n areMarkersShown() {\n return this.markersShown.apply(this, arguments);\n }\n\n isMarkersShown() {\n return this.markersShown.apply(this, arguments);\n }\n\n // Multiple markers\n setMarkers(families, selectionType, applyToSelected) {\n // Family has to be an object\n // Family looks like\n /*\n {\n \ttype: 1,\n \tzoom: 1,\n \tstrokeWidth: 1,\n \tstrokeColor: '',\n \tfillColor: '',\n points: []\n }\n * @memberof SerieLine\n */\n\n this.styles[selectionType || 'unselected'] = this.styles[selectionType || 'unselected'] || {};\n\n this.showMarkers(selectionType, false);\n\n if (!Array.isArray(families) && typeof families == 'object') {\n families = [families];\n } else if (!families) {\n\n families = [{\n type: 1,\n zoom: 1,\n points: 'all'\n }];\n }\n\n this.styles[selectionType || 'unselected'].markers = families;\n\n if (applyToSelected) {\n this.styles.selected.markers = extend$1(true, {}, families);\n }\n\n this._recalculateMarkerPoints(selectionType, families);\n this.styleHasChanged(selectionType);\n this.dataHasChanged(true); // Data has not really changed, but marker placing is performed during the draw method\n return this;\n }\n\n setMarkersPoints(points, family, selectionType) {\n this._extendMarkers('points', points, family, selectionType, true);\n }\n\n setMarkersColor(color, family, selectionType) {\n this._extendMarkers('color', color, family, selectionType);\n }\n\n setMarkersType(type, family, selectionType) {\n this._extendMarkers('type', type, family, selectionType);\n }\n\n setMarkersZoom(zoom, family, selectionType) {\n this._extendMarkers('zoom', zoom, family, selectionType);\n }\n\n setMarkersStrokeColor(strokeColor, family, selectionType) {\n this._extendMarkers('strokeColor', strokeColor, family, selectionType);\n }\n\n setMarkersStrokeWidth(strokeWidth, family, selectionType) {\n this._extendMarkers('strokeWidth', strokeWidth, family, selectionType);\n }\n\n setMarkersFillColor(fillColor, family, selectionType) {\n this._extendMarkers('fillColor', fillColor, family, selectionType);\n }\n\n _extendMarkers(type, value, family, selectionType, recalculatePoints) {\n\n family = family || 0;\n selectionType = selectionType || 'unselected';\n\n if (!this.styles[selectionType] || !this.styles[selectionType].markers) {\n return;\n }\n\n this.styles[selectionType].markers[family][type] = value;\n\n if (recalculatePoints) {\n this._recalculateMarkerPoints(selectionType, this.styles[selectionType].markers);\n }\n\n if (!this.markersDom[this.styles[selectionType].markers[family]]) {\n // DOM doesn't exist yet.\n return;\n }\n\n this.setMarkerStyleTo(this.markersDom[this.styles[selectionType].markers[family]].dom, this.styles[selectionType].markers[family]);\n }\n\n _recalculateMarkerPoints(selectionType, families) {\n\n var markerPoints = [];\n // Overwriting any other undefined families\n markerPoints.push([0, Infinity, null]);\n\n for (var i = 0, k = families.length; i < k; i++) {\n\n families[i].markerPath = this.getMarkerPath(families[i]);\n\n if (!families[i].points) {\n families[i].points = 'all';\n }\n\n if (!Array.isArray(families[i].points)) {\n families[i].points = [families[i].points];\n }\n\n for (var j = 0, l = families[i].points.length; j < l; j++) {\n\n if (families[i].points[j] == 'all') {\n\n markerPoints.push([0, Infinity, i]);\n } else if (!Array.isArray(families[i].points[j])) {\n\n markerPoints.push([families[i].points[j], families[i].points[j], i]);\n //markerPoints.push( [ family[ i ].points[ j ] + 1, null ] );\n } else {\n\n markerPoints.push([families[i].points[j][0], families[i].points[j][1], i]);\n }\n }\n }\n\n this.markerFamilies[selectionType || 'unselected'] = families;\n\n // Let's sort if by the first index.\n markerPoints.sort(function (a, b) {\n return a[0] - b[0] || (a[2] == null ? -1 : 1);\n });\n\n this.markerPoints[selectionType || 'unselected'] = markerPoints;\n }\n\n insertMarkers(selectionType) {\n\n if (!this.markerFamilies || !this.markerFamilies[selectionType || this.selectionType] || this.options.markersIndependant) {\n return;\n }\n\n for (var i = 0, l = this.markerFamilies[selectionType || this.selectionType].length; i < l; i++) {\n\n if (!this.markersDom.has(this.markerFamilies[selectionType || this.selectionType][i])) {\n continue;\n }\n\n let dom = this.markersDom.get(this.markerFamilies[selectionType || this.selectionType][i]);\n\n dom.dom.setAttribute('d', dom.path);\n\n this.groupMarkers.appendChild(dom.dom);\n this.currentMarkersSelectionType = this.selectionType;\n }\n }\n\n getMarkerForLegend() {\n\n if (!this.markerPoints || !this.markerPoints[this.selectionType]) {\n return;\n }\n\n if (!this.markerForLegend) {\n\n var marker = document.createElementNS(this.graph.ns, 'path');\n this.setMarkerStyleTo(marker, this.markerFamilies[this.selectionType][0]);\n\n marker.setAttribute('d', 'M 14 0 ' + this.getMarkerPath(this.markerFamilies[this.selectionType][0]));\n\n this.markerForLegend = marker;\n }\n\n return this.markerForLegend;\n }\n\n eraseMarkers() {\n\n var self = this;\n\n if (this.options.markersIndependant) {\n\n for (var i in this.independantMarkers) {\n self.groupMarkers.removeChild(this.independantMarkers[i]);\n }\n\n this.independantMarkers = {};\n } else if (this.currentMarkersSelectionType) {\n\n this.markersDom.forEach(function (el) {\n\n if (!el.dom) {\n return;\n }\n\n if (el.dom.parentNode !== self.groupMarkers) {\n return;\n }\n\n self.groupMarkers.removeChild(el.dom);\n el.path = '';\n });\n\n this.currentMarkersSelectionType = false;\n }\n }\n\n isMonotoneous() {\n if (this.waveform) {\n return this.waveform.isMonotoneous();\n }\n\n return !!this.xmonotoneous;\n }\n\n findLocalMinMax(xRef, xWithin, type) {\n\n if (!this.waveform) {\n return false;\n }\n\n return this.waveform.findLocalMinMax(xRef, xWithin, type);\n }\n\n}\n\nfunction drawMarkerXY(graph, family, x, y, markerDom) {\n\n if (!family) {\n return;\n }\n\n if (graph.options.markersIndependant) {\n var dom = graph.getMarkerDomIndependent(graph.counter2, family);\n var p = 'M ' + x + ' ' + y + ' ';\n p += family.markerPath + ' ';\n\n dom.setAttribute('d', p);\n }\n\n markerDom.path = markerDom.path || '';\n markerDom.path += 'M ' + x + ' ' + y + ' ';\n markerDom.path += family.markerPath + ' ';\n}\n\nmix(SerieLine, ErrorBarMixin);\n\nvar Serie3DMixin = {\n\n /**\n * Returns the x position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The x position in px corresponding to the x value\n */\n getX: function (val) {\n return (val = this.getXAxis().getPx(val)) - val % 0.2 + this.getXAxis().getZProj(this.options.zpos);\n },\n\n /**\n * Returns the y position of a certain value in pixels position, based on the serie's axis\n * @memberof Serie3DMixin\n * @param {Number} val - Value to convert to pixels position\n * @returns {Number} The y position in px corresponding to the y value\n */\n getY: function (val) {\n return (val = this.getYAxis().getPx(val)) - val % 0.2 + this.getYAxis().getZProj(this.options.zpos);\n },\n\n getZPos: function () {\n return this.options.zpos;\n },\n\n /**\n * @returns {Number} Lowest x value of the serie's data\n * @memberof Serie\n */\n getMinX: function (useZValues) {\n if (!useZValues) {\n return this.minX;\n }\n\n return getZCorrectedValue(this, true, true);\n },\n\n /**\n * @returns {Number} Highest x value of the serie's data\n * @memberof Serie\n */\n getMaxX: function (useZValues) {\n\n if (!useZValues) {\n return this.maxX;\n }\n return getZCorrectedValue(this, true, false);\n },\n\n /**\n * @returns {Number} Lowest y value of the serie's data\n * @memberof Serie\n */\n getMinY: function (useZValues) {\n\n if (!useZValues) {\n return this.minY;\n }\n return getZCorrectedValue(this, false, true);\n },\n\n /**\n * @returns {Number} Highest y value of the serie's data\n * @memberof Serie\n */\n getMaxY: function (useZValues) {\n\n if (!useZValues) {\n return this.maxY;\n }\n return getZCorrectedValue(this, false, false);\n }\n\n};\n\nfunction getZCorrectedValue(serie, x, min) {\n\n let i, l, data, val, valFinal;\n let wf = serie.getWaveforms();\n\n for (let wave of wf) {\n\n i = 0;\n l = wave.getLength();\n data = wave.getData();\n\n for (; i < l; i += 1) {\n\n if (x) {\n val = serie.getXAxis().getVal(serie.getX(wave.getX(i, true)));\n } else {\n val = serie.getYAxis().getVal(serie.getY(data[i]));\n }\n\n if (i == 0) {\n valFinal = val;\n } else {\n\n if (min) {\n valFinal = Math.min(valFinal, val);\n } else {\n valFinal = Math.max(valFinal, val);\n }\n }\n }\n }\n return valFinal;\n}\n\n/**\n * Serie line with 3D projection\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends SerieLine\n */\nclass SerieLine3D extends SerieLine {\n\n static defaults() {\n return {\n zpos: 0\n };\n }\n constructor(graph, name, options) {\n super(...arguments);\n }\n\n /**\n * Sets the z-position\n * @memberof SerieLine3D\n * @param {Number} zPos - The position in the z axis\n */\n setZPos(zPos) {\n this.options.zpos = zPos;\n return this;\n }\n\n setz() {\n return this.setZPos(...arguments);\n }\n}\n\nmix(SerieLine3D, Serie3DMixin);\n\n/**\n * Represents a bar serie.\n Needs to be used exclusively with a bar axis ({@link AxisXBar}).\n Supports error bars, line color, line width, fill color, fill opacity.\n * @example graph.newSerie(\"serieName\", { fillColor: 'red', fillOpacity: 0.2 }, \"bar\" );\n * @extends Serie\n */\nclass SerieBar extends SerieLine {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.pathDom = document.createElementNS(this.graph.ns, 'path');\n this.groupMain.appendChild(this.pathDom);\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = {\n lineColor: this.options.lineColor,\n lineStyle: this.options.lineStyle,\n lineWidth: this.options.lineWidth,\n fillColor: this.options.fillColor,\n fillOpacity: this.options.fillOpacity,\n markers: this.options.markers\n };\n }\n\n /**\n * Sets the data of the bar serie\n * @param {Object} data\n * @example serie.setData( { \"cat1\": val1, \"cat2\": val2, \"cat4\": val4 } );\n * @return {SerieBar} The current serie instance\n */\n setData(data) {\n\n this.data = data;\n this.minY = Number.MAX_SAFE_INTEGER;\n this.maxY = Number.MIN_SAFE_INTEGER;\n\n for (var i in this.data) {\n this._checkY(this.data[i]);\n }\n\n return this;\n }\n\n /**\n * Sets the fill color\n */\n setFillColor(fillColor, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].fillColor = fillColor;\n\n if (applyToSelected) {\n this.setFillColor(fillColor, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n /**\n * Returns the fill color\n */\n getFillColor(selectionType) {\n return this.getStyle(selectionType).fillColor;\n }\n\n /*\n * @memberof SerieBar\n */\n setFillOpacity(opacity, selectionType, applyToSelected) {\n\n selectionType = selectionType || 'unselected';\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType].fillOpacity = opacity;\n\n if (applyToSelected) {\n this.setLineWidth(opacity, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n\n return this;\n }\n\n getFillOpacity(selectionType) {\n\n return this.getStyle(selectionType).fillOpacity || 1;\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n */\n applyLineStyles() {\n this.applyLineStyle(this.pathDom);\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieBar\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n } else {\n line.removeAttribute('stroke-dasharray');\n }\n line.setAttribute('fill', this.getFillColor());\n line.setAttribute('fill-opacity', this.getFillOpacity() || 1);\n }\n\n draw() {\n\n var path = '';\n if (this.error) {\n this.errorDrawInit();\n }\n\n for (var i in this.data) {\n\n if (!this.categoryIndices[i]) {\n continue;\n }\n\n path += 'M ' + this.getXAxis().getPos(this.categoryIndices[i]) + ' ' + this.getYAxis().getPos(0) + ' V ' + this.getYAxis().getPos(this.data[i]) + ' h ' + this.getXAxis().getDeltaPx(1 / this.nbCategories) + ' V ' + this.getYAxis().getPos(0);\n\n if (this.error) {\n this.errorAddPointBarChart(i, this.data[i], this.getXAxis().getPos(this.categoryIndices[i] + 0.5 / this.nbCategories), this.getYAxis().getPos(this.data[i]));\n }\n }\n\n if (this.error) {\n this.errorDraw();\n }\n\n this.pathDom.setAttribute('d', path);\n this.applyLineStyles();\n }\n\n // Markers now allowed\n setMarkers() {}\n\n getUsedCategories() {\n return Object.keys(this.data);\n }\n\n}\n\n/**\n * @static\n * @extends Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\nclass SerieBox extends Serie {\n\n static default() {\n return {\n orientation: 'y',\n maxBoxWidth: 20,\n\n defaultStyle: {\n\n meanLineColor: 'rgb( 100, 0, 0 )',\n meanLineWidth: 2,\n\n boxAboveLineWidth: 1,\n boxAboveLineColor: 'rgb( 0, 0, 0 )',\n boxAboveFillColor: 'transparent',\n boxAboveFillOpacity: 1,\n boxBelowLineWidth: 1,\n boxBelowLineColor: 'rgb( 0, 0, 0 )',\n boxBelowFillColor: 'transparent',\n boxBelowFillOpacity: 1,\n\n barAboveLineColor: 'rgba( 0, 0, 0, 1 )',\n barAboveLineWidth: 1,\n barBelowLineColor: 'rgba( 0, 0, 0, 1 )',\n barBelowLineWidth: 1,\n\n outlierLineWidth: 1,\n outlierLineColor: 'rgb( 255, 255, 255 )',\n outlierFillColor: 'rgb( 0, 0, 0 )',\n outlierFillOpacity: 1\n }\n };\n }\n\n constructor(graph, name, options) {\n\n super(...arguments);\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.pathDom = document.createElementNS(this.graph.ns, 'path');\n this.groupMain.appendChild(this.pathDom);\n\n // Creates an empty style variable\n this.styles = {};\n\n // Unselected style\n this.styles.unselected = this.options.defaultStyle;\n }\n\n /**\n * Sets the data of the bar serie\n * @param {Object} data\n * @example serie.setData( [ { x: 'cat', Q2: valMean, Q1: valBoxMin, Q3: valBoxMax, whiskers: [ val1, val2 ], outliers: [ ...yList ] } ] );\n * @return {SerieBar} The current serie instance\n */\n setData(data, noRescale) {\n\n this.data = data;\n\n if (!Array.isArray(data)) {\n return;\n }\n\n let axisref, axisval, methodref, methodval, blnX;\n\n if (this.options.orientation == 'y') {\n axisref = this.getXAxis();\n axisval = this.getYAxis();\n methodref = this._checkX.bind(this);\n methodval = this._checkY.bind(this);\n blnX = true;\n\n this.minY = data[0].Q2;\n this.maxY = data[0].Q2;\n this.maxX = data[0].x;\n this.minX = data[0].x;\n } else {\n axisref = this.getYAxis();\n axisval = this.getXAxis();\n methodref = this._checkY.bind(this);\n methodval = this._checkX.bind(this);\n blnX = false;\n\n this.minX = data[0].Q2;\n this.maxX = data[0].Q2;\n this.maxY = data[0].y;\n this.minY = data[0].y;\n }\n\n if (noRescale) {\n methodref = function () {};\n methodval = function () {};\n }\n\n if (!axisref || !axisval) {\n throwError('Error in setting data of the box serie. The X and Y axes must be set beforehand');\n }\n\n for (var i in this.data) {\n\n if (blnX) {\n methodref(this.data[i].x);\n this.data[i].pos = this.data[i].x;\n } else {\n methodref(this.data[i].y);\n this.data[i].pos = this.data[i].y;\n }\n\n if (this.data[i].Q3) {\n\n methodval(this.data[i].Q3);\n }\n\n if (this.data[i].Q1) {\n methodval(this.data[i].Q1);\n }\n\n if (this.data[i].whiskers) {\n\n if (Array.isArray(this.data[i].whiskers)) {\n\n if (this.data[i].whiskers.length > 0) {\n methodval(this.data[i].whiskers[0]);\n }\n\n if (this.data[i].whiskers.length > 1) {\n methodval(this.data[i].whiskers[1]);\n }\n } else {\n methodval(this.data[i].whiskers);\n this.data[i].whiskers = [this.data[i].whiskers];\n }\n } else {\n this.data[i].whiskers = [];\n }\n\n if (Array.isArray(this.data[i].outliers)) {\n this.data[i].outliers.map(val => methodval(val));\n } else {\n this.data[i].outliers = [];\n }\n }\n\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n _style(type, styleValue, selectionType = 'unselected', applyToSelected = false) {\n this.styles[selectionType] = this.styles[selectionType] || {};\n this.styles[selectionType][type] = styleValue;\n\n if (applyToSelected) {\n this._set(type, styleValue, 'selected');\n }\n\n this.styleHasChanged(selectionType);\n return this;\n }\n\n _gstyle(type, selectionType) {\n return this.getStyle(selectionType)[type];\n }\n\n /**\n * Retrives a selection object\n * @param {String} [ selectionType = \"unselected\" ] - The selection type\n * @returns {Object} The selection object\n */\n getStyle(selectionType = 'unselected') {\n\n return this.styles[selectionType] || {};\n }\n\n /**\n * Sets the mean line color\n * @param {String} color - The mean line color\n * @returns {SerieBox} The current serie instance\n */\n setMeanLineColor() {\n return this._style('meanLineColor', ...arguments);\n }\n\n /**\n * Returns the mean line color\n * @return {String} The mean line color\n */\n getMeanLineColor() {\n return this._gstyle('meanLineColor', ...arguments);\n }\n\n setStyle(style, selectionType = 'unselected') {\n //console.log( style, selectionType );\n this.styles[selectionType] = extend$1({}, this.default().defaultStyle, this.styles.unselected, style);\n this.styleHasChanged(selectionType);\n }\n\n /**\n * Sets the mean line width\n * @param {Number} width - The line width\n * @returns {SerieBox} The current serie instance\n */\n setMeanLineWidth() {\n return this._style('meanLineWidth', ...arguments);\n }\n\n /**\n * Returns the mean line width\n * @return {Number} The mean line width\n */\n getMeanLineWidth() {\n return this._gstyle('meanLineWidth', ...arguments);\n }\n\n /**\n * Sets the box line color\n * @param {Number} color - The color of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveLineColor() {\n return this._style('boxAboveLineColor', ...arguments);\n }\n\n /**\n * Returns the box line color\n * @return {String} The line color of the box above the median\n */\n getBoxAboveLineColor() {\n return this._gstyle('boxAboveLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} color - The color of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowLineColor() {\n return this._style('boxBelowLineColor', ...arguments);\n }\n\n /**\n * Returns the fill color\n * @return {String} The line color of the box below the median\n */\n getBoxBelowLineColor() {\n return this._gstyle('boxBelowLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The contour width of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveLineWidth() {\n return this._style('boxAboveLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the box above the median\n * @return {Number} The line width of the box above the median\n */\n getBoxAboveLineWidth() {\n return this._gstyle('boxAboveLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The contour width of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowLineWidth() {\n return this._style('boxBelowLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the box below the median\n * @return {Number} The line width of the box below the median\n */\n getBoxBelowLineWidth() {\n return this._gstyle('boxBelowLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The fill color of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveFillColor() {\n return this._style('boxAboveFillColor', ...arguments);\n }\n\n /**\n * Returns the fill color of the box above the median\n * @return {String} The fill color of the box above the median\n */\n getBoxAboveFillColor() {\n return this._gstyle('boxAboveFillColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The fill color of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowFillColor() {\n return this._style('boxBelowFillColor', ...arguments);\n }\n\n /**\n * Returns the fill color of the box below the median\n * @return {String} The fill color of the box below the median\n */\n getBoxBelowFillColor() {\n return this._gstyle('boxBelowFillColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} opacity - The fill opacity of the box above the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxAboveFillOpacity() {\n return this._style('boxAboveFillOpacity', ...arguments);\n }\n\n /**\n * Returns the fill opacity of the box above the median\n * @return {Number} The fill opacity of the box above the median\n */\n getBoxAboveFillOpacity() {\n return this._gstyle('boxAboveFillOpacity', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} opacity - The fill opacity of the box below the median\n * @returns {SerieBox} The current serie instance\n */\n setBoxBelowFillOpacity() {\n return this._style('boxBelowFillOpacity', ...arguments);\n }\n\n /**\n * Returns the fill opacity of the box below the median\n * @return {Number} The fill opacity of the box below the median\n */\n getBoxBelowFillOpacity() {\n return this._gstyle('boxBelowFillOpacity', ...arguments);\n }\n\n /**\n * Sets the whisker color\n * @param {String} color - The line color of the whisker above the median\n * @returns {SerieBox} The current serie instance\n */\n setBarAboveLineColor() {\n return this._style('barAboveLineColor', ...arguments);\n }\n\n /**\n * Returns the line color of the whisker above the median\n * @return {String} The line color of the whisker above the median\n */\n getBarAboveLineColor() {\n return this._gstyle('barAboveLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The line color of the whisker below the median\n * @returns {SerieBox} The current serie instance\n */\n setBarBelowLineColor() {\n return this._style('barBelowLineColor', ...arguments);\n }\n\n /**\n * Returns the line color of the whisker below the median\n * @return {String} The line color of the whisker below the median\n */\n getBarBelowLineColor() {\n return this._gstyle('barBelowLineColor', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The line width of the whisker above the median\n * @returns {SerieBox} The current serie instance\n */\n setBarAboveLineWidth() {\n return this._style('barAboveLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the whisker above the median\n * @return {Number} The line width of the whisker above the median\n */\n getBarAboveLineWidth() {\n return this._gstyle('barAboveLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {Number} width - The line width of the whisker below the median\n * @returns {SerieBox} The current serie instance\n */\n setBarBelowLineWidth() {\n return this._style('barBelowLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the whisker below the median\n * @return {Number} The line width of the whisker below the median\n */\n getBarBelowLineWidth() {\n return this._gstyle('barBelowLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The outlier stroke color\n * @returns {SerieBox} The current serie instance\n */\n setOutlierLineColor() {\n return this._style('outlierLineColor', ...arguments);\n }\n\n /**\n * Returns the line color of the outliers\n * @return {String} The line color of the outliers\n */\n getOutlierLineColor() {\n return this._gstyle('outlierLineColor', ...arguments);\n }\n\n /**\n * Sets the stroke width\n * @param {Number} width - The outlier stroke width\n * @returns {SerieBox} The current serie instance\n */\n setOutlierLineWidth() {\n return this._style('outlierLineWidth', ...arguments);\n }\n\n /**\n * Returns the line width of the outliers\n * @return {Number} The line width of the outliers\n */\n getOutlierLineWidth() {\n return this._gstyle('outlierLineWidth', ...arguments);\n }\n\n /**\n * Sets the fill color\n * @param {String} color - The outlier fill color\n * @returns {SerieBox} The current serie instance\n */\n setOutlierFillColor() {\n return this._style('outlierFillColor', ...arguments);\n }\n\n /**\n * Returns the fill color of the outliers\n * @return {String} The fill color of the outliers\n */\n getOutlierFillColor() {\n return this._gstyle('outlierFillColor', ...arguments);\n }\n\n /**\n * Sets the outlier fill opacity\n * @param {Number} opacity - The outlier fill opacity\n * @returns {SerieBox} The current serie instance\n */\n setOutlierFillOpacity() {\n return this._style('outlierFillOpacity', ...arguments);\n }\n\n /**\n * Returns the fill opacity of the outliers\n * @return {Number} The fill opacity of the outliers\n */\n getOutlierFillOpacity() {\n return this._gstyle('outlierFillOpacity', ...arguments);\n }\n\n /**\n * Reapply the current style to the serie lines elements. Mostly used internally\n * @returns {SerieBox} The current serie instance\n */\n applyLineStyles() {\n this.applyLineStyle(this.pathDom);\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieBar\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n line.removeAttribute('stroke-dasharray');\n line.setAttribute('fill', this.getFillColor());\n line.setAttribute('fill-opacity', this.getFillOpacity() || 1);\n }\n\n draw() {\n\n if (!this.data) {\n return;\n }\n\n let position;\n let axis = this.options.orientation == 'y' ? this.getYAxis() : this.getXAxis();\n let axis2 = this.options.orientation == 'y' ? this.getXAxis() : this.getYAxis();\n let boxOtherDimension; // width or height of the box\n let mean, boxAbove, boxBelow, barAbove, barBelow, outliers;\n emptyDom(this.groupMain);\n\n if (axis2.getType() == 'category') {\n\n boxOtherDimension = axis2.getRelPx(0.8 / this.nbCategories);\n \n } else {\n // Get all the spacing and determine the smallest one\n boxOtherDimension = this.options.maxBoxWidth;\n // console.log( boxOtherDimension );\n for (var i = 0, l = this.data.length; i < l - 1; i++) {\n\n // console.log( Math.abs( axis.getPx( this.data[ i + 1 ].pos ) - axis.getPx( this.data[ i ].pos ) ), axis.getPx( this.data[ i + 1 ].pos ), axis.getPx( this.data[ i ].pos ) );\n boxOtherDimension = Math.min(boxOtherDimension, Math.abs(axis2.getPx(this.data[i + 1].pos) - axis2.getPx(this.data[i].pos)));\n }\n // console.log( boxOtherDimension );\n }\n\n for (var i = 0, l = this.data.length; i < l; i++) {\n\n if (axis2.getType() == 'category') {\n\n let cat = this.options.orientation == 'y' ? this.data[i].x : this.data[i].y;\n\n if (!this.categoryIndices.hasOwnProperty(cat)) {\n\n if (Array.isArray(this._linkedToScatterSeries)) {\n for (let scatter_serie of this._linkedToScatterSeries) {\n\n if (scatter_serie.categoryIndices.hasOwnProperty(cat)) {\n\n position = [axis2.getPos(scatter_serie.categoryIndices[cat]) + 1.2 * boxOtherDimension / 2];\n\n if (this.options.orientation == 'y') {\n axis = scatter_serie.getYAxis();\n } else {\n axis = scatter_serie.getXAxis();\n }\n\n break;\n }\n }\n }\n } else {\n\n position = [axis2.getPos(this.categoryIndices[cat]) + 1.2 * boxOtherDimension / 2];\n }\n } else {\n\n position = [axis2.getPos(this.options.orientation == 'y' ? this.data[i].x : this.data[i].y), boxOtherDimension];\n }\n\n mean = axis.getPos(this.data[i].Q2);\n boxAbove = axis.getPos(this.data[i].Q3);\n boxBelow = axis.getPos(this.data[i].Q1);\n\n this.data[i].whiskers.map(val => {\n\n if (val < this.data[i].Q1) {\n barBelow = axis.getPos(val);\n } else {\n barAbove = axis.getPos(val);\n }\n });\n\n outliers = this.data[i].outliers.map(val => axis.getPos(val));\n\n var lineMean = document.createElementNS(this.graph.ns, 'line');\n\n this.applyMeanStyle(lineMean);\n\n var rectAbove = document.createElementNS(this.graph.ns, 'rect');\n var rectBelow = document.createElementNS(this.graph.ns, 'rect');\n\n if (this.options.orientation == 'y') {\n\n rectAbove.setAttribute('width', boxOtherDimension);\n rectAbove.setAttribute('x', position[0] - boxOtherDimension / 2);\n\n rectBelow.setAttribute('width', boxOtherDimension);\n rectBelow.setAttribute('x', position[0] - boxOtherDimension / 2);\n\n lineMean.setAttribute('x1', position[0] - boxOtherDimension / 2);\n lineMean.setAttribute('x2', position[0] + boxOtherDimension / 2);\n lineMean.setAttribute('y1', mean);\n lineMean.setAttribute('y2', mean);\n } else {\n\n rectAbove.setAttribute('height', boxOtherDimension);\n rectAbove.setAttribute('y', position[0] - boxOtherDimension / 2);\n\n rectBelow.setAttribute('height', boxOtherDimension);\n rectBelow.setAttribute('y', position[0] - boxOtherDimension / 2);\n\n lineMean.setAttribute('y1', position[0] - boxOtherDimension / 2);\n lineMean.setAttribute('y2', position[0] + boxOtherDimension / 2);\n lineMean.setAttribute('x1', mean);\n lineMean.setAttribute('x2', mean);\n }\n\n this.boxPos(rectAbove, mean, boxAbove, this.options.orientation == 'x');\n this.boxPos(rectBelow, mean, boxBelow, this.options.orientation == 'x');\n\n this.applyBoxStyle(rectAbove, rectBelow);\n\n var whiskerAbove = document.createElementNS(this.graph.ns, 'line');\n var whiskerBelow = document.createElementNS(this.graph.ns, 'line');\n\n if (this.options.orientation == 'y') {\n\n if (barAbove !== undefined) {\n whiskerAbove.setAttribute('y1', boxAbove);\n whiskerAbove.setAttribute('y2', barAbove);\n whiskerAbove.setAttribute('x1', position[0]);\n whiskerAbove.setAttribute('x2', position[0]);\n }\n\n if (barBelow !== undefined) {\n whiskerBelow.setAttribute('y1', boxBelow);\n whiskerBelow.setAttribute('y2', barBelow);\n whiskerBelow.setAttribute('x1', position[0]);\n whiskerBelow.setAttribute('x2', position[0]);\n }\n } else {\n\n if (barAbove !== undefined) {\n whiskerAbove.setAttribute('x1', boxAbove);\n whiskerAbove.setAttribute('x2', barAbove);\n whiskerAbove.setAttribute('y1', position[0]);\n whiskerAbove.setAttribute('y2', position[0]);\n }\n\n if (barBelow !== undefined) {\n whiskerBelow.setAttribute('x1', boxBelow);\n whiskerBelow.setAttribute('x2', barBelow);\n whiskerBelow.setAttribute('y1', position[0]);\n whiskerBelow.setAttribute('y2', position[0]);\n }\n }\n\n outliers.map(outliervalue => {\n\n let outlier = document.createElementNS(this.graph.ns, 'circle');\n\n outlier.setAttribute('r', 2);\n\n if (this.options.orientation == 'y') {\n\n outlier.setAttribute('cx', position[0]);\n outlier.setAttribute('cy', outliervalue);\n } else {\n\n outlier.setAttribute('cy', position[0]);\n outlier.setAttribute('cx', outliervalue);\n }\n\n this.setOutlierStyle(outlier);\n\n this.groupMain.appendChild(outlier);\n });\n\n if (barAbove !== undefined) {\n this.groupMain.appendChild(whiskerAbove);\n }\n\n if (barBelow !== undefined) {\n this.groupMain.appendChild(whiskerBelow);\n }\n\n if (boxAbove !== undefined) {\n this.groupMain.appendChild(rectAbove);\n }\n\n if (boxBelow !== undefined) {\n this.groupMain.appendChild(rectBelow);\n }\n\n this.groupMain.appendChild(lineMean);\n\n this.applyWhiskerStyle(whiskerAbove, whiskerBelow);\n }\n }\n\n applyBoxStyle(above, below) {\n\n above.setAttribute('stroke', this.getBoxAboveLineColor());\n above.setAttribute('stroke-width', this.getBoxAboveLineWidth());\n\n if (this.getBoxAboveFillColor() !== undefined) {\n above.setAttribute('fill', this.getBoxAboveFillColor());\n }\n if (this.getBoxAboveFillOpacity() !== undefined) {\n above.setAttribute('fill-opacity', this.getBoxAboveFillOpacity());\n }\n\n below.setAttribute('stroke', this.getBoxBelowLineColor());\n below.setAttribute('stroke-width', this.getBoxBelowLineWidth());\n\n if (this.getBoxBelowFillColor() !== undefined) {\n below.setAttribute('fill', this.getBoxBelowFillColor());\n }\n if (this.getBoxAboveFillOpacity() !== undefined) {\n below.setAttribute('fill-opacity', this.getBoxBelowFillOpacity());\n }\n }\n\n applyWhiskerStyle(above, below) {\n\n above.setAttribute('stroke', this.getBarAboveLineColor());\n above.setAttribute('stroke-width', this.getBarAboveLineWidth());\n\n below.setAttribute('stroke', this.getBarBelowLineColor());\n below.setAttribute('stroke-width', this.getBarBelowLineWidth());\n }\n\n applyMeanStyle(line) {\n\n line.setAttribute('stroke', this.getMeanLineColor());\n line.setAttribute('stroke-width', this.getMeanLineWidth());\n }\n\n setOutlierStyle(outlier) {\n\n outlier.setAttribute('stroke', this.getOutlierLineColor());\n outlier.setAttribute('stroke-width', this.getOutlierLineWidth());\n\n if (this.getBoxBelowFillColor() !== undefined) {\n outlier.setAttribute('fill', this.getOutlierFillColor());\n }\n if (this.getBoxAboveFillOpacity() !== undefined) {\n outlier.setAttribute('fill-opacity', this.getOutlierFillOpacity());\n }\n }\n /**\n * Returns the index of a category based on its name\n * @param {String} name - The name of the category\n */\n getCategoryIndex(name) {\n\n if (!this.categories) {\n throw new Error('No categories were defined. Probably axis.setSeries was not called');\n }\n\n for (var i = 0; i < this.categories.length; i++) {\n\n if (this.categories[i].name == name) {\n return i;\n }\n }\n\n return false;\n }\n\n // Markers now allowed\n setMarkers() {}\n\n boxPos(box, mean, extremity, blnX) {\n\n if (mean > extremity) {\n\n box.setAttribute(blnX ? 'x' : 'y', extremity);\n box.setAttribute(blnX ? 'width' : 'height', mean - extremity);\n } else {\n\n box.setAttribute(blnX ? 'x' : 'y', mean);\n box.setAttribute(blnX ? 'width' : 'height', extremity - mean);\n }\n }\n\n getUsedCategories() {\n let xymode = this.options.orientation == 'y' ? 'x' : 'y';\n\n let categories = this.data.map(d => d[xymode]);\n\n if (Array.isArray(this._linkedToScatterSeries)) {\n this._linkedToScatterSeries.map(scatter_serie => {\n\n scatter_serie.getUsedCategories().map(scatter_serie_cat => {\n let index;\n if ((index = categories.indexOf(scatter_serie_cat)) > -1) {\n categories.splice(index, 1);\n }\n });\n });\n }\n\n return categories;\n }\n\n linkToScatterSerie(...series) {\n this._linkedToScatterSeries = series;\n }\n}\n\n/**\n * Colored serie line\n * @example graph.newSerie( name, options, \"color\" );\n * @see Graph#newSerie\n * @augments SerieLine\n */\nclass SerieLineColor extends SerieLine {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n this.lines = this.lines || {};\n }\n\n setColors(colors) {\n this.colors = colors;\n }\n\n _draw() {\n\n var self = this,\n data = this._dataToUse,\n toBreak,\n i = 0,\n j,\n k,\n m,\n x,\n y,\n k,\n o,\n lastX = false,\n lastY = false,\n xpx,\n ypx,\n xpx2,\n ypx2,\n xAxis = this.getXAxis(),\n yAxis = this.getYAxis(),\n xMin = xAxis.getCurrentMin(),\n yMin = yAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n yMax = yAxis.getCurrentMax();\n\n // Y crossing\n this.eraseLines();\n\n if (this.isFlipped()) {\n \n }\n\n this.currentLine = '';\n m = this.waveform.getLength();\n\n for (j = 0; j < m; j += 2) {\n\n x = this.waveform.getX(j);\n y = this.waveform.getY(j);\n\n if (x < xMin && lastX < xMin || x > xMax && lastX > xMax || (y < yMin && lastY < yMin || y > yMax && lastY > yMax) && !this.options.lineToZero) {\n lastX = x;\n lastY = y;\n continue;\n }\n\n this.counter2 = j;\n\n if (this.markersShown()) {\n this.getMarkerCurrentFamily(this.counter2);\n }\n\n xpx2 = this.getX(x);\n ypx2 = this.getY(y);\n\n if (xpx2 == xpx && ypx2 == ypx) {\n continue;\n }\n\n if (isNaN(xpx2) || isNaN(ypx2)) {\n if (this.counter > 0) {\n\n // this._createLine();\n }\n continue;\n }\n\n var color = this.colors[j];\n\n this._addPoint(xpx2, ypx2, x, y, xpx, ypx, lastX, lastY, j, color, false, true);\n\n xpx = xpx2;\n ypx = ypx2;\n\n lastX = x;\n lastY = y;\n }\n\n this.latchLines();\n\n if (this._tracker) {\n\n if (this._trackerDom) {\n this._trackerDom.remove();\n }\n\n var cloned = this.groupLines.cloneNode(true);\n this.groupMain.appendChild(cloned);\n\n for (var i = 0, l = cloned.children.length; i < l; i++) {\n\n cloned.children[i].setAttribute('stroke', 'transparent');\n cloned.children[i].setAttribute('stroke-width', '25px');\n cloned.children[i].setAttribute('pointer-events', 'stroke');\n }\n\n self._trackerDom = cloned;\n\n self.groupMain.addEventListener('mousemove', function (e) {\n var coords = self.graph._getXY(e),\n ret = self.handleMouseMove(false, false);\n self._trackingCallback(self, ret, coords.x, coords.y);\n });\n\n self.groupMain.addEventListener('mouseleave', function (e) {\n self._trackingOutCallback(self);\n });\n }\n return this;\n }\n\n _addPoint(xpx, ypx, x, y, xpxbefore, ypxbefore, xbefore, ybefore, j, color, move, allowMarker) {\n\n if (xpxbefore === undefined || ypxbefore === undefined) {\n return;\n }\n\n if (isNaN(xpx) || isNaN(ypx)) {\n return;\n }\n\n if (color._rgb) {\n color = 'rgba(' + color._rgb[0] + ',' + color._rgb[1] + ',' + color._rgb[2] + ',' + (color._rgb[3] || 1) + ')';\n }\n\n var line = this.lines[color];\n if (!line) {\n line = this.lines[color] = {\n object: document.createElementNS(this.graph.ns, 'path'),\n path: '',\n color: color\n };\n line.object.setAttribute('stroke', color);\n line.color = color;\n // this.applyLineStyle( line );\n this.groupLines.appendChild(line.object);\n }\n\n line.path += 'M ' + xpxbefore + ' ' + ypxbefore + ' L ' + xpx + ' ' + ypx;\n\n if (this.hasErrors()) {\n this.errorAddPoint(j, x, y, xpx, ypx);\n }\n\n /*if ( this.markersShown() && allowMarker !== false ) {\n drawMarkerXY( this, this.markerFamilies[ this.selectionType ][ this.markerCurrentFamily ], xpx, ypx );\n }*/\n }\n\n removeExtraLines() {}\n\n // Returns the DOM\n latchLines() {\n\n for (var i in this.lines) {\n this.lines[i].object.setAttribute('d', this.lines[i].path);\n }\n }\n\n // Returns the DOM\n eraseLines() {\n\n for (var i in this.lines) {\n this.lines[i].path = '';\n this.lines[i].object.setAttribute('d', '');\n }\n }\n\n /**\n * Applies the current style to a line element. Mostly used internally\n * @memberof SerieLine\n */\n applyLineStyle(line) {\n\n //line.setAttribute( 'stroke', this.getLineColor() );\n line.setAttribute('stroke-width', this.getLineWidth());\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n } else {\n line.removeAttribute('stroke-dasharray');\n }\n line.setAttribute('fill', 'none');\n //\tline.setAttribute('shape-rendering', 'optimizeSpeed');\n }\n}\n\nvar type = 'scatter';\n\n/**\n * @static\n * @augments Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\nclass SerieScatter extends Serie {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n this.id = Math.random() + Date.now();\n this.shapes = []; // Stores all shapes\n this.shown = true;\n this.data = [];\n\n this.shapesDetails = [];\n this.shapes = [];\n\n this._type = type;\n\n mapEventEmission(this.options, this);\n\n this._isMinOrMax = {\n x: {\n min: false,\n max: false\n },\n y: {\n min: false,\n max: false\n }\n };\n\n this.groupPoints = document.createElementNS(this.graph.ns, 'g');\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.additionalData = {};\n\n this.selectedStyleGeneral = {};\n this.selectedStyleModifiers = {};\n\n this.groupPoints.addEventListener('mouseover', e => {\n var id = parseInt(e.target.parentElement.getAttribute('data-shapeid'));\n this.emit('mouseover', id, this.waveform.getX(id), this.waveform.getY(id));\n });\n\n this.groupPoints.addEventListener('mouseout', e => {\n var id = parseInt(e.target.parentElement.getAttribute('data-shapeid'));\n this.emit('mouseout', id, this.waveform.getX(id), this.waveform.getY(id));\n });\n\n this.minX = Number.MAX_VALUE;\n this.minY = Number.MAX_VALUE;\n this.maxX = Number.MIN_VALUE;\n this.maxY = Number.MIN_VALUE;\n\n this.groupMain.appendChild(this.groupPoints);\n this.currentAction = false;\n\n if (this.initExtended1) {\n this.initExtended1();\n }\n\n this.styles = {};\n this.styles.unselected = {};\n this.styles.selected = {};\n\n this.styles.unselected.default = {\n shape: 'circle',\n cx: 0,\n cy: 0,\n r: 3,\n stroke: 'transparent',\n fill: 'black'\n };\n\n this.styles.selected.default = {\n shape: 'circle',\n cx: 0,\n cy: 0,\n r: 4,\n stroke: 'transparent',\n fill: 'black'\n };\n }\n\n /**\n * Applies for x as the category axis\n * @example serie.setDataCategory( { x: \"someName\", y: Waveform } );\n */\n setDataCategory(data) {\n\n for (let dataCategory of data) {\n\n this._checkY(dataCategory.y.getMaxY());\n this._checkY(dataCategory.y.getMinY());\n }\n\n this.data = data;\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n return this;\n }\n\n /**\n * Removes all DOM points\n * @private\n */\n empty() {\n\n while (this.groupPoints.firstChild) {\n this.groupPoints.removeChild(this.groupPoints.firstChild);\n }\n }\n\n getSymbolForLegend() {\n\n if (this.symbol) {\n return this.symbol;\n }\n\n var g = document.createElementNS(this.graph.ns, 'g');\n g.setAttribute('data-shapeid', -1);\n var shape = this.doShape(g, this.styles.unselected.default);\n\n var style = this.getStyle('unselected', -1, true);\n\n for (var i in style[-1]) {\n if (i == 'shape') {\n continue;\n }\n shape.setAttribute(i, style[-1][i]);\n }\n\n return g;\n }\n\n /**\n * Sets style to the scatter points\n * First argument is the style applied by default to all points\n * Second argument is an array of modifiers that allows customization of any point of the scatter plot. Data for each elements of the array will augment allStyles, so be sure to reset the style if needed.\n * All parameters - except shape - will be set as parameters to the DOM element of the shape\n *\n * @example\n * var modifiers = [];\n * modifiers[ 20 ] = { shape: 'circle', r: 12, fill: 'rgba(0, 100, 255, 0.3)', stroke: 'rgb(0, 150, 255)' };\n * serie.setStyle( { shape: 'circle', r: 2, fill: 'rgba(255, 0, 0, 0.3)', stroke: 'rgb(255, 100, 0)' }, modifiers ); // Will modify scatter point n°20\n *\n * @param {Object} allStyles - The general style for all markers\n * @param {Object} [ modifiers ] - The general style for all markers\n * @param {String} [ selectionMode=\"unselected\" ] - The selection mode to which this style corresponds. Default is unselected\n *\n */\n setStyle(all, modifiers, mode = 'unselected') {\n\n if (typeof modifiers == 'string') {\n mode = modifiers;\n modifiers = false;\n }\n\n /*\n if( ! this.styles[ mode ] ) {\n }\n if ( mode !== \"selected\" && mode !== \"unselected\" ) {\n throw \"Style mode is not correct. Should be selected or unselected\";\n }\n */\n\n this.styles[mode] = this.styles[mode] || {};\n this.styles[mode].all = all;\n this.styles[mode].modifiers = modifiers;\n\n this.styleHasChanged(mode);\n\n return this;\n }\n\n /**\n * Redraws the serie\n * @private\n * @param {force} Boolean - Forces redraw even if the data hasn't changed\n */\n draw(force) {\n // Serie redrawing\n\n if (!force && !this.hasDataChanged() && !this.hasStyleChanged('unselected')) {\n return;\n }\n\n var x,\n y,\n xpx,\n ypx,\n j = 0;\n\n var isCategory = this.getXAxis().getType() == 'category';\n\n this._drawn = true;\n\n this.dataHasChanged(false);\n this.styleHasChanged(false);\n this.groupMain.removeChild(this.groupPoints);\n\n var keys = [];\n\n j = 0;\n if (this.hasErrors()) {\n this.errorDrawInit();\n }\n\n if (isCategory) {\n\n let k = 0;\n\n for (; j < this.data.length; j++) {\n\n if (!this.categoryIndices.hasOwnProperty(this.data[j].x)) {\n continue;\n }\n\n if (this.error) {\n // this.errorAddPoint( j, position[ 0 ] + position[ 1 ] / 2, 0, this.getX( position[ 0 ] + position[ 1 ] / 2 ), ypx );\n }\n\n for (var n = 0, l = this.data[j].y.getLength(); n < l; n++) {\n\n //let xpos = i / ( l - 1 ) * ( position[ 1 ] ) + position[ 0 ];\n\n ypx = this.getY(this.data[j].y.getY(n));\n xpx = this.getX(n / (l - 1) * (0.8 / this.nbCategories) + this.categoryIndices[this.data[j].x] + 0.1 / this.nbCategories);\n n++;\n\n this.shapesDetails[k] = this.shapesDetails[k] || [];\n this.shapesDetails[k][0] = xpx;\n this.shapesDetails[k][1] = ypx;\n keys.push(k);\n k++;\n }\n }\n } else {\n\n for (; j < this.waveform.getLength(); j++) {\n\n if (this.waveform.getX(j) < this.getXAxis().getCurrentMin() || this.waveform.getX(j) > this.getXAxis().getCurrentMax() || this.waveform.getY(j) < this.getYAxis().getCurrentMin() || this.waveform.getY(j) > this.getYAxis().getCurrentMax()) {\n\n if (this.shapes[j]) {\n this.shapes[j].setAttribute('display', 'none');\n }\n continue;\n }\n\n if (this.shapes[j]) {\n this.shapes[j].setAttribute('display', 'initial');\n }\n\n xpx = this.getX(this.waveform.getX(j));\n ypx = this.getY(this.waveform.getY(j));\n\n if (this.hasErrors()) {\n this.errorAddPoint(j, this.waveform.getX(j), this.waveform.getY(j), xpx, ypx);\n }\n\n this.shapesDetails[j] = this.shapesDetails[j] || [];\n this.shapesDetails[j][0] = xpx;\n this.shapesDetails[j][1] = ypx;\n keys.push(j);\n\n //this.shapes[ j / 2 ] = this.shapes[ j / 2 ] || undefined;\n }\n }\n\n if (this.hasErrors()) {\n this.errorDraw();\n }\n\n // This will automatically create the shapes\n this.applyStyle('unselected', keys);\n\n this.groupMain.appendChild(this.groupPoints);\n }\n\n _addPoint(xpx, ypx, k) {\n\n let shape;\n let g = document.createElementNS(this.graph.ns, 'g');\n g.setAttribute('transform', 'translate(' + xpx + ', ' + ypx + ')');\n g.setAttribute('data-shapeid', k);\n\n if (this.extraStyle && this.extraStyle[k]) {\n\n shape = this.doShape(g, this.extraStyle[k]);\n } else if (this.stdStylePerso) {\n\n shape = this.doShape(g, this.stdStylePerso);\n } else {\n\n shape = this.doShape(g, this.stdStyle);\n }\n\n this.shapes[k] = shape;\n this.groupPoints.appendChild(g);\n }\n\n doShape(group, shape) {\n var el = document.createElementNS(this.graph.ns, shape.shape);\n group.appendChild(el);\n return el;\n }\n\n getStyle(selection, index, noSetPosition) {\n\n var selection = selection || 'unselected';\n var indices;\n\n var styles = {};\n\n if (typeof index == 'number') {\n indices = [index];\n } else if (Array.isArray(index)) {\n indices = index;\n }\n\n var shape, index, modifier, style; // loop variables\n var styleAll;\n\n if (this.styles[selection].all !== undefined) {\n\n styleAll = this.styles[selection].all;\n\n if (typeof styleAll == 'function') {\n\n styleAll = styleAll();\n } else if (styleAll === false) {\n\n styleAll = {};\n }\n }\n\n var i = 0,\n l = indices.length;\n\n for (; i < l; i++) {\n\n index = indices[i];\n shape = this.shapes[index];\n\n if ((modifier = this.styles[selection].modifiers) && (typeof modifier == 'function' || modifier[index])) {\n\n if (typeof modifier == 'function') {\n\n style = modifier(index, shape);\n } else if (modifier[index]) {\n\n style = modifier[index];\n }\n\n styles[index] = Object.assign({}, styleAll, style);\n } else if (styleAll !== undefined) {\n\n styles[index] = styleAll;\n } else {\n\n styles[index] = this.styles[selection].default;\n }\n\n if (!styles[index]) {\n styles[index] = styleAll;\n }\n\n if (!shape) {\n // Shape doesn't exist, let's create it\n\n if (!styles[index].shape) {\n console.error(style);\n throw 'No shape was defined with this style.';\n }\n\n var g = document.createElementNS(this.graph.ns, 'g');\n g.setAttribute('data-shapeid', index);\n this.shapes[index] = this.doShape(g, styles[index]);\n this.groupPoints.appendChild(g);\n shape = this.shapes[index];\n }\n\n if (!noSetPosition) {\n shape.parentNode.setAttribute('transform', 'translate(' + this.shapesDetails[index][0] + ', ' + this.shapesDetails[index][1] + ')');\n }\n }\n\n return styles;\n }\n\n applyStyle(selection, index, noSetPosition) {\n\n var i, j;\n var styles = this.getStyle(selection, index, noSetPosition);\n\n for (i in styles) {\n\n for (j in styles[i]) {\n\n if (j !== 'shape') {\n\n if (styles[i][j]) {\n\n this.shapes[i].setAttribute(j, styles[i][j]);\n } else {\n\n this.shapes[i].removeAttribute(j);\n }\n }\n }\n }\n }\n\n unselectPoint(index) {\n this.selectPoint(index, false);\n }\n\n selectPoint(index, setOn, selectionType) {\n\n if (this.shapesDetails[index][2] && this.shapesDetails[index][2] == selectionType) {\n return;\n }\n\n if (typeof setOn == 'string') {\n selectionType = setOn;\n setOn = undefined;\n }\n\n if (Array.isArray(index)) {\n return this.selectPoints(index);\n }\n\n if (this.shapes[index] && this.shapesDetails[index]) {\n\n if ((this.shapesDetails[index][2] || setOn === false) && setOn !== true) {\n\n var selectionStyle = this.shapesDetails[index][2];\n this.shapesDetails[index][2] = false;\n\n var allStyles = this.getStyle(selectionStyle, index, true);\n for (var i in allStyles[index]) {\n this.shapes[index].removeAttribute(i);\n }\n\n this.applyStyle('unselected', index, true);\n } else {\n\n selectionType = selectionType || 'selected';\n this.shapesDetails[index][2] = selectionType;\n\n this.applyStyle(selectionType, index, true);\n }\n }\n }\n\n getUsedCategories() {\n\n if (typeof this.data[0] == 'object') {\n return this.data.map(d => d.x);\n }\n\n return [];\n }\n\n}\n\nmix(SerieScatter, ErrorBarMixin);\n\n/**\n * @static\n * @extends Serie\n * @example graph.newSerie( name, options, \"scatter\" );\n * @see Graph#newSerie\n */\nclass SerieZone extends Serie {\n\n static default() {\n return {\n fillColor: 'rgba( 0, 0, 0, 0.1 )',\n lineColor: 'rgba( 0, 0, 0, 1 )',\n lineWidth: '1px'\n };\n }\n constructor(graph, name, options) {\n super(...arguments);\n\n this.selectionType = 'unselected';\n this.id = guid();\n\n this.groupZones = document.createElementNS(this.graph.ns, 'g');\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n this.lineZone = document.createElementNS(this.graph.ns, 'path');\n this.lineZone.setAttribute('stroke', 'black');\n this.lineZone.setAttribute('stroke-width', '1px');\n\n this.groupMain.appendChild(this.groupZones);\n this.groupZones.appendChild(this.lineZone);\n\n this.applyLineStyle(this.lineZone);\n this.styleHasChanged();\n\n this.clip = document.createElementNS(this.graph.ns, 'clipPath');\n this.clipId = guid();\n this.clip.setAttribute('id', this.clipId);\n\n this.graph.defs.appendChild(this.clip);\n }\n\n /**\n * Assigns a collection of waveforms that make up the zone\n * The waveforms will appended one after the other, without break\n * @param {...Waveform} waveforms - The collection of waveforms\n * @return {SerieZone} - The current serie zone instance\n * @memberof SerieZone\n */\n setWaveform(...waveforms) {\n this.waveforms = waveforms;\n\n this.waveforms = this.waveforms.map(wave => {\n\n if (!(wave instanceof Waveform)) {\n return new Waveform(wave);\n } else {\n return wave;\n }\n });\n\n this.minX = this.waveforms[0].getXMin();\n this.maxX = this.waveforms[0].getXMax();\n this.minY = this.waveforms[0].getMin();\n this.maxY = this.waveforms[0].getMax();\n\n this.waveforms.map(wave => {\n\n this.minX = Math.min(wave.getXMin(), this.minX);\n this.maxX = Math.max(wave.getXMin(), this.maxX);\n this.minY = Math.min(wave.getMin(), this.minY);\n this.maxY = Math.max(wave.getMax(), this.maxY);\n });\n\n this.graph.updateDataMinMaxAxes();\n this.dataHasChanged();\n return this;\n }\n\n setWaveforms() {\n return this.setWaveform(...arguments);\n }\n\n getWaveforms() {\n return this.waveforms;\n }\n\n setMinMaxWaveforms(min, max) {\n this.waveforms = [min, max.reverse()];\n return this;\n }\n\n /**\n * Removes all the dom concerning this serie from the drawing zone\n */\n empty() {\n\n while (this.group.firstChild) {\n this.group.removeChild(this.group.firstChild);\n }\n }\n\n /**\n * Redraws the serie\n * @private\n *\n * @param {force} Boolean - Forces redraw even if the data hasn't changed\n */\n draw(force) {\n // Serie redrawing\n\n if (force || this.hasDataChanged()) {\n\n if (!this.waveforms) {\n return;\n }\n\n let dataX = 0,\n dataY = 0,\n xpx = 0,\n ypx = 0,\n j = 0,\n line = '',\n buffer,\n move = false;\n\n const xminpx = this.getXAxis().getMinPx(),\n xmaxpx = this.getXAxis().getMaxPx(),\n yminpx = this.getYAxis().getMinPx(),\n ymaxpx = this.getYAxis().getMaxPx();\n\n const xmin = this.getXAxis().getCurrentMin(),\n xmax = this.getXAxis().getCurrentMax(),\n ymin = this.getYAxis().getCurrentMin(),\n ymax = this.getYAxis().getCurrentMax();\n\n //this.clipRect.setAttribute( \"x\", Math.min( xmin, xmax ) );\n //this.clipRect.setAttribute( \"y\", Math.min( ymin, ymax ) );\n //this.clipRect.setAttribute( \"width\", Math.abs( xmax - xmin ) );\n //this.clipRect.setAttribute( \"height\", Math.abs( ymax - ymin ) );\n\n this.groupMain.removeChild(this.groupZones);\n\n for (let waveform of this.waveforms) {\n\n for (j = 0; j < waveform.getLength(); j += 1) {\n dataX = waveform.getX(j, true);\n dataY = waveform.getY(j, true);\n\n // The y axis in screen coordinate is inverted vs cartesians\n if (dataY[j] < ymin) {\n ypx = this.getY(ymin);\n } else if (dataY[j] > ymax) {\n ypx = this.getY(ymax);\n }\n\n if (dataX !== dataX) {\n continue;\n }\n\n if (dataY !== dataY) {\n // Let's make a new line\n\n if (line.length == 0) {\n continue;\n }\n\n line += 'L ' + xpx + ', ' + this.getY(waveform.getMinY());\n move = true;\n continue;\n }\n\n ypx = this.getY(dataY);\n xpx = this.getX(dataX);\n\n if (dataX < xmin || dataX > xmax) {\n buffer = [dataX, dataY[j], xpx, ypx];\n continue;\n }\n\n if (move) {\n line += ' M ' + xpx + ', ' + this.getY(waveform.getMinY()) + ' ';\n move = false;\n }\n\n if (line.length > 0) {\n line += ' L ';\n }\n\n if (buffer) {\n line += buffer[2] + ',' + buffer[3] + ' ';\n buffer = false;\n } else {\n line += xpx + ',' + ypx + ' ';\n }\n }\n }\n\n if (line !== '') {\n this.lineZone.setAttribute('d', 'M ' + line + ' z');\n } else {\n this.lineZone.setAttribute('d', '');\n }\n this.groupMain.appendChild(this.groupZones);\n }\n\n if (this.hasStyleChanged(this.selectionType)) {\n this.applyLineStyle(this.lineZone);\n this.styleHasChanged(false);\n }\n }\n\n /**\n * Applies the computed style to the DOM element fed as a parameter\n * @private\n *\n * @param {SVGLineElement} line - The line to which the style has to be applied to\n */\n applyLineStyle(line) {\n\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth());\n line.setAttribute('fill', this.getFillColor());\n line.setAttribute('fill-opacity', this.getFillOpacity());\n line.setAttribute('stroke-opacity', this.getLineOpacity());\n }\n\n /**\n * Sets the line width\n *\n * @param {Number} width - The line width\n * @returns {SerieZone} - The current serie\n */\n setLineWidth(width) {\n this.options.lineWidth = width;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line width\n *\n * @returns {Number} - The line width\n */\n getLineWidth() {\n return this.options.lineWidth;\n }\n\n /**\n * Sets the line opacity\n *\n * @param {Number} opacity - The line opacity\n * @returns {SerieZone} - The current serie\n */\n setLineOpacity(opacity) {\n this.options.lineOpacity = opacity;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line opacity\n *\n * @returns {Number} - The line opacity\n */\n getLineOpacity() {\n return this.options.lineOpacity;\n }\n\n /**\n * Sets the line color\n *\n * @param {String} color - The line color\n * @returns {SerieZone} - The current serie\n */\n setLineColor(color) {\n this.options.lineColor = color;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the line width\n *\n * @returns {Number} - The line width\n */\n getLineColor() {\n return this.options.lineColor;\n }\n\n /**\n * Sets the fill opacity\n *\n * @param {Number} opacity - The fill opacity\n * @returns {SerieZone} - The current serie\n */\n setFillOpacity(opacity) {\n this.options.fillOpacity = opacity;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the fill opacity\n *\n * @returns {Number} - The fill opacity\n */\n getFillOpacity() {\n return this.options.fillOpacity;\n }\n\n /**\n * Sets the fill color\n *\n * @param {Number} width - The line width\n * @returns {Number} - The line width\n */\n setFillColor(color) {\n this.options.fillColor = color;\n this.styleHasChanged();\n return this;\n }\n\n /**\n * Gets the fill color\n *\n * @returns {Number} - The fill color\n */\n getFillColor() {\n return this.options.fillColor;\n }\n\n}\n\n/**\n * Serie line with 3D projection\n * @example graph.newSerie( name, options, \"line\" );\n * @see Graph#newSerie\n * @extends SerieLine\n */\nclass SerieZone3D extends SerieZone {\n\n static default() {\n return {\n zpos: 0\n };\n }\n constructor(graph, name, options) {\n super(...arguments);\n }\n\n /**\n * Sets the z-position\n * @memberof SerieZone3D\n * @param {Number} zPos - The position in the z axis\n */\n setZPos(zPos) {\n this.options.zpos = zPos;\n return this;\n }\n\n setz() {\n return this.setZPos(...arguments);\n }\n}\n\nmix(SerieZone3D, Serie3DMixin);\n\n/**\n * Density map serie\n * @example graph.newSerie( name, options, \"densitymap\" );\n * @see Graph#newSerie\n * @augments Serie\n */\nclass SerieDensityMap extends Serie {\n\n constructor(graph, name, options) {\n\n super(...arguments);\n mapEventEmission(this.options, this); // Register events\n\n this.groupMain = document.createElementNS(this.graph.ns, 'g');\n\n this.rects = [];\n this.paths = [];\n\n this.recalculateBinsOnDraw = false;\n }\n /**\n * Sets the data of the serie. Careful, only one format allowed for now.\n * @memberof SerieDensityMap\n * @param {Array} data - A vector containing 2-elements arrays\n * @return {SerieDensityMap} The current instance\n * @example serie.setData( [ [ x1, y1 ], [ x2, y2 ], ..., [ xn, yn ] ] );\n */\n setData(data) {\n\n this.minX = this.maxX = this.minY = this.maxY = 0;\n var i = 0,\n l = data.length;\n this.data = data;\n\n this.minX = Number.POSITIVE_INFINITY;\n this.minY = Number.POSITIVE_INFINITY;\n this.maxX = Number.NEGATIVE_INFINITY;\n this.maxY = Number.NEGATIVE_INFINITY;\n\n for (i = 0; i < l; i++) {\n this._checkX(data[i][0]);\n this._checkY(data[i][1]);\n }\n\n this.dataHasChanged();\n this.graph.updateDataMinMaxAxes();\n\n return this;\n }\n\n /**\n * Calculates the bins from the (x,y) dataset\n * @memberof SerieDensityMap\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} numX - The number of x bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @param {Number} numY - The number of y bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n calculateDensity(fromX, deltaX, numX, fromY, deltaY, numY) {\n\n var densitymap = [],\n i,\n l = this.data.length,\n indexX,\n indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n for (i = 0; i < l; i++) {\n indexX = ~~((this.data[i][0] - fromX) / deltaX);\n indexY = ~~((this.data[i][1] - fromY) / deltaY);\n\n if (indexX > numX || indexY > numY || indexX < 0 || indexY < 0) {\n continue;\n }\n\n densitymap[indexX] = densitymap[indexX] || [];\n densitymap[indexX][indexY] = densitymap[indexX][indexY] + 1 || 1;\n\n binMin = densitymap[indexX][indexY] < binMin ? densitymap[indexX][indexY] : binMin;\n binMax = densitymap[indexX][indexY] > binMax ? densitymap[indexX][indexY] : binMax;\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = numX;\n this.maxIndexY = numY;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = numX;\n this.numY = numY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Sets the density map from a precalculated data set\n * @memberof SerieDensityMap\n * @param {Array} densitymap - A 2D-array containing the map\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n setDensityMap(densitymap, fromX, deltaX, numX, fromY, deltaY, numY) {\n\n var i,\n j,\n l = this.data.length;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n for (i = 0; i < densitymap.length; i++) {\n\n for (j = 0; j < densitymap[i].length; j++) {\n binMin = densitymap[i][j] < binMin ? densitymap[i][j] : binMin;\n binMax = densitymap[i][j] > binMax ? densitymap[i][j] : binMax;\n }\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = densitymap.length;\n this.maxIndexY = densitymap[0].length;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = this.maxIndexX;\n this.numY = this.maxIndexY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Calculates the bins from the (x,y) dataset using bin weighing\n * Will assign a set of (x,y) to the 4 neighbouring bins according to its exact position\n * @memberof SerieDensityMap\n * @param {Number} fromX - The first x element to consider\n * @param {Number} deltaX - The x spacing between two bins\n * @param {Number} numX - The number of x bins\n * @param {Number} fromY - The first y element to consider\n * @param {Number} deltaY - The y spacing between two bins\n * @param {Number} numY - The number of y bins\n * @return {Array} The generated density map\n * @see SerieDensityMap#autoBins\n * @see SerieDensityMap#autoColorMapBinBoundaries\n * @see SerieDensityMap#setPxPerBin\n */\n calculateDensityWeighted(fromX, deltaX, numX, fromY, deltaY, numY) {\n\n var densitymap = [],\n i,\n l = this.data.length,\n indexX,\n indexY;\n\n var binMin = Number.POSITIVE_INFINITY;\n var binMax = Number.NEGATIVE_INFINITY;\n\n var compX, compY;\n var exactX, exactY;\n var indexXLow, indexXHigh, indexYLow, indexYHigh;\n\n for (i = 0; i < l; i++) {\n exactX = (this.data[i][0] - fromX) / deltaX - 0.5;\n exactY = (this.data[i][1] - fromY) / deltaY - 0.5;\n\n indexX = Math.floor(exactX);\n indexY = Math.floor(exactY);\n\n indexXLow = indexX; //Math.floor( exactX );\n indexYLow = indexY; //Math.floor( exactY );\n\n indexXHigh = indexX + 1; //Math.ceil( exactX );\n indexYHigh = indexY + 1; //Math.ceil( exactY );\n\n compX = 1 - (exactX - indexX);\n compY = 1 - (exactY - indexY);\n\n //console.log( exactY, indexY );\n //console.log( compY, indexYLow, indexYHigh );\n if (indexX > numX || indexY > numY || indexX < 0 || indexY < 0) {\n continue;\n }\n\n densitymap[indexXLow] = densitymap[indexXLow] || [];\n densitymap[indexXHigh] = densitymap[indexXHigh] || [];\n\n densitymap[indexXLow][indexYLow] = densitymap[indexXLow][indexYLow] || 0;\n densitymap[indexXHigh][indexYLow] = densitymap[indexXHigh][indexYLow] || 0;\n densitymap[indexXLow][indexYHigh] = densitymap[indexXLow][indexYHigh] || 0;\n densitymap[indexXHigh][indexYHigh] = densitymap[indexXHigh][indexYHigh] || 0;\n\n densitymap[indexXLow][indexYLow] += compX * compY;\n densitymap[indexXHigh][indexYLow] += (1 - compX) * compY;\n densitymap[indexXLow][indexYHigh] += compX * (1 - compY);\n densitymap[indexXHigh][indexYHigh] += (1 - compX) * (1 - compY);\n\n // A loop would be nicer, but would it be faster ?\n binMin = densitymap[indexXLow][indexYLow] < binMin ? densitymap[indexXLow][indexYLow] : binMin;\n binMax = densitymap[indexXLow][indexYLow] > binMax ? densitymap[indexXLow][indexYLow] : binMax;\n binMin = densitymap[indexXHigh][indexYLow] < binMin ? densitymap[indexXHigh][indexYLow] : binMin;\n binMax = densitymap[indexXHigh][indexYLow] > binMax ? densitymap[indexXHigh][indexYLow] : binMax;\n binMin = densitymap[indexXLow][indexYHigh] < binMin ? densitymap[indexXLow][indexYHigh] : binMin;\n binMax = densitymap[indexXLow][indexYHigh] > binMax ? densitymap[indexXLow][indexYHigh] : binMax;\n binMin = densitymap[indexXHigh][indexYHigh] < binMin ? densitymap[indexXHigh][indexYHigh] : binMin;\n binMax = densitymap[indexXHigh][indexYHigh] > binMax ? densitymap[indexXHigh][indexYHigh] : binMax;\n\n //binMax = Math.max( binMax, densitymap[ indexX ][ indexY ] );\n }\n\n this.maxIndexX = numX;\n this.maxIndexY = numY;\n\n this.binMin = binMin;\n this.binMax = binMax;\n\n this.deltaX = deltaX;\n this.deltaY = deltaY;\n\n this.fromX = fromX;\n this.fromY = fromY;\n\n this.numX = numX;\n this.numY = numY;\n\n this.densitymap = densitymap;\n return densitymap;\n }\n\n /**\n * Calculates the density map based on the minimum and maximum values found in the data array\n * @memberof SerieDensityMap\n * @param {Number} [ numX = 400 ] - The number of x bins\n * @param {Number} [ numY = numX ] - The number of y bins\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n autoBins(numX, numY) {\n\n this.numX = numX || 400;\n this.numY = numY || this.numX;\n\n this.calculateDensity(this.minX, (this.maxX - this.minX) / numX, numX, this.minY, (this.maxY - this.minY) / numY, numY);\n\n this.recalculateBinsOnDraw = false;\n\n return this;\n }\n\n /**\n * Only calculates the density map upon redraw based on the current state of the graph. In this mode, a fixed number of pixels per bin is used to calculate the number of bins and fed into\n * the calculation of the density map. In this method, the color map spans on the full scale of the density map values (i.e. a subrange cannot be defined, like you would do using {@link SerieDensityMap#setColorMapBinBoundaries}).\n * @memberof SerieDensityMap\n * @param {Number} pxPerBinX - The number of x bins per pixels. Should be an integer, but technically it doesn't have to\n * @param {Number} pxPerBinY - The number of y bins per pixels. Should be an integer, but technically it doesn't have to\n * @param {Boolean} weightedDensityMap - Whether jsGraph should use weighted density mapping or not\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n setPxPerBin(pxPerBinX, pxPerBinY, weightedDensityMap) {\n\n if (pxPerBinX) {\n this.calculationDensityMap({\n from: 'min',\n to: 'max',\n pxPerBin: pxPerBinX,\n weighted: weightedDensityMap\n });\n }\n\n if (pxPerBinY) {\n this.calculationDensityMap(false, {\n from: 'min',\n to: 'max',\n pxPerBin: pxPerBinY,\n weighted: weightedDensityMap\n });\n }\n\n return this;\n }\n\n /**\n * Sets bins in the ```x``` or ```y``` direction based on a from value, a to value and a number of bins.\n * @memberof SerieDensityMap\n * @param {String} mode - ```x``` or ```y```\n * @param {Number} from - The from value of the bin for the calculation with ```calculateDensityMap```\n * @param {Number} to - The to value\n * @param {Number} num - The number of bins\n * @return {SerieDensityMap} The current instance\n * @see SerieDensityMap#calculateDensity\n */\n setBinsFromTo(mode, from, to, num) {\n\n this.densityMapCalculation = this.densityMapCalculation || {};\n\n this.densityMapCalculation[mode] = {\n from: from,\n to: to,\n numBins: num\n };\n this.calculationDensityMap();\n return this;\n }\n\n calculationDensityMap(x, y) {\n\n this.method = this.calculateDensityAdvanced;\n this.densityMapCalculation = this.densityMapCalculation || {};\n\n if (x) {\n this.densityMapCalculation.x = x;\n }\n\n if (y) {\n this.densityMapCalculation.y = y;\n }\n }\n\n calculateDensityAdvanced() {\n\n var results = {\n x: {\n from: 0,\n num: 0,\n delta: 0,\n weighing: false\n },\n\n y: {\n from: 0,\n num: 0,\n delta: 0,\n weighing: false\n }\n };\n\n var widthValues = {\n x: this.graph.drawingSpaceWidth,\n y: this.graph.drawingSpaceHeight\n };\n var axisGetter = {\n x: this.getXAxis,\n y: this.getYAxis\n };\n\n var weighing = false;\n\n for (var i in this.densityMapCalculation) {\n\n if (this.densityMapCalculation[i].weighted) {\n weighing = true;\n results[i].weighing = true;\n }\n\n if (this.densityMapCalculation[i].pxPerBin) {\n\n // In value\n\n var from = this.densityMapCalculation[i].from == 'min' ? axisGetter[i].call(this).getCurrentMin() : this.densityMapCalculation[i].from;\n var to = this.densityMapCalculation[i].to == 'max' ? axisGetter[i].call(this).getCurrentMax() : this.densityMapCalculation[i].to;\n\n // In px\n var dimension = Math.abs(axisGetter[i].call(this).getRelPx(to - from));\n results[i].num = Math.ceil(widthValues[i] / this.densityMapCalculation[i].pxPerBin);\n\n //console.log( from, from - axisGetter[ i ].call( this ).getRelVal( ( results[i ].num * this.densityMapCalculation[ i ].pxPerBin - dimension ) / 2 ), ( results[i ].num * this.densityMapCalculation[ i ].pxPerBin - dimension ) / 2 );\n results[i].from = from - Math.abs(axisGetter[i].call(this).getRelVal((results[i].num * this.densityMapCalculation[i].pxPerBin - dimension) / 2));\n results[i].delta = Math.abs(axisGetter[i].call(this).getRelVal(this.densityMapCalculation[i].pxPerBin));\n } else {\n\n results[i].num = this.densityMapCalculation[i].numBins || 400;\n results[i].from = this.densityMapCalculation[i].from == 'min' ? axisGetter[i].call(this).getCurrentMin() : this.densityMapCalculation[i].from;\n results[i].delta = this.densityMapCalculation[i].to ? ((this.densityMapCalculation[i].to == 'max' ? axisGetter[i].call(this).getCurrentMax() : this.densityMapCalculation[i].to) - results[i].from) / results[i].num : this.densityMapCalculate[i].delta;\n }\n\n // console.log( axisGetter[ i ].call( this ).getCurrentMin(), axisGetter[ i ].call( this ).getCurrentMax(), )\n }\n //console.log( this.getYAxis().getCurrentMin(), this.getYAxis().getCurrentMax(), this.graph.drawingSpaceHeight );\n\n //console.log( this.densityMapCalculation );\n\n (weighing ? this.calculateDensityWeighted : this.calculateDensity).call(this, results.x.from, results.x.delta, results.x.num, results.y.from, results.y.delta, results.y.num);\n }\n\n /**\n * Selects a subrange of bins for the color mapping. There is no need to recalculate the color map after calling this method\n * @memberof SerieDensityMap\n * @param {Number} binMin - The minimum bin value\n * @param {Number} binMax - The maximum bin value\n * @return {SerieDensityMap} The current instance\n * @example // In this case, all bins with values below binMin * 2 (the middle scale) will be rendered with the first color of the color map\n * serie.setColorMapBinBoundaries( serie.binMin * 2, serie.binMax );\n */\n setColorMapBinBoundaries(min, max) {\n this.colorMapMin = min;\n this.colorMapMax = max;\n return this;\n }\n\n /**\n * Calls {@link SerieDensityMap#setColorMapBinBoundaries} using the minimum and maximum bin values calculated by {@link SerieDensityMap#calculateDensity}. This function must be called, since colorMinMap and colorMaxMap are not set automatically when the density map is calculated.\n * @memberof SerieDensityMap\n * @param {Number} binMin - The minimum bin value\n * @param {Number} binMax - The maximum bin value\n * @return {SerieDensityMap} The current instance\n */\n autoColorMapBinBoundaries() {\n this.colorMapMin = this.binMin;\n this.colorMapMax = this.binMax;\n return this;\n }\n\n /**\n * Allows the use of a callback to determine the color map min and max value just before the density map is redrawn. This is very useful when the density map is recalculate before redraw, such as in the case where bins per pixels are used\n * @memberof SerieDensityMap\n * @param {(String|Function)} callback - The callback function to call. Should return an array with two elements ```[ colorMapMin, colorMapMax ]```. This parameter can also take the value ```auto```, in which case ```autoColorMapBinBoundaries``` will be called before redraw\n * @return {SerieDensityMap} The current instance\n */\n onRedrawColorMapBinBoundaries(callback) {\n this.callbackColorMapMinMax = callback;\n return this;\n }\n\n /**\n * Generates a color map based on a serie of HSL(A) values.\n * @summary Colors can scale linearly, logarithmically (enhances short range differences) or exponentially (enhances long range differences).\n * One word of advice though. SVG being not canvas, jsGraph has to create a path for each color value of the color map. In other words, if you're asking for 16-bit coloring (65536 values), 65536 SVG paths will be created and your browser will start to suffer from it.\n * As of now, all the colors in colorStops will be places at equal distances from each other between colorMapMin and colorMapMax set by {@link autoColorMapBinBoundaries} or {@link setColorMapBinBoundaries}\n * @memberof SerieDensityMap\n * @param {Array} colorStops - An array of objects, each having the following format: { h: [ 0-360], s: 0-1, l: 0-1, a: 0-1}\n * @param {Number} numColors - The number of colors to compute.\n * @param {String} [ method = \"linear\" ] - The method to use to calculate the density map: linear, exp, or log\n * @return {SerieDensityMap} The current instance\n */\n colorMapHSL(colorStops, numColors, method) {\n\n method = method || 'linear';\n\n var methods = {\n 'exp': function (value) {\n return (Math.exp(value / numColors * 1) - Math.exp(0)) / (Math.exp(1) - Math.exp(0));\n },\n 'log': function (value) {\n return (Math.log(value + 1) - Math.log(1)) / (Math.log(numColors + 1) - Math.log(1));\n },\n 'linear': function (value) {\n return (value - 0) / (numColors - 0);\n }\n };\n\n var k = 0,\n colorMap = [],\n opacities = [];\n\n var color = {\n h: null,\n s: null,\n l: null,\n a: null\n };\n\n var ratio, first;\n\n var slices = colorStops.length - 1;\n\n for (var i = 0; i <= numColors; i++) {\n\n ratio = methods[method](i);\n\n first = Math.floor(ratio * slices);\n\n if (first == colorStops.length - 1) {\n // Handle 1\n first = slices - 1;\n }\n\n ratio = (ratio - first / slices) / (1 / slices);\n\n for (var j in color) {\n color[j] = (colorStops[first + 1][j] - colorStops[first][j]) * ratio + colorStops[first][j];\n }\n\n colorMap[k] = 'hsl(' + color.h + ', ' + Math.round(color.s * 100) + '%, ' + Math.round(color.l * 100) + '%)'; //this.HSVtoRGB( color.h, color.s, color.v );\n opacities[k] = color.a;\n k++;\n }\n\n this.opacities = opacities;\n this.colorMap = colorMap;\n this.colorMapNum = numColors;\n return this;\n }\n\n /**\n * Calls {@link SerieDensityMap#colorMapHSV} using 100 colors.\n * @memberof SerieDensityMap\n * @param {Array} colorStops - An array of objects, each having the following format: { h: [ 0-360], s: 0-1, l: 0-1, a: 0-1}\n * @param {String} [ method = \"linear\" ] - The method to use to calculate the density map: linear, exp or log\n * @return {SerieDensityMap} The current instance\n */\n autoColorMapHSL(colorStops, method = 'linear') {\n this.colorMapHSV(colorStops, 100, method);\n return this;\n }\n\n /* byteToHex( b ) {\n return hexChar[ ( b >> 4 ) & 0x0f ] + hexChar[ b & 0x0f ];\n }\n */\n /*\n HSVtoRGB( h, s, v ) {\n var r, g, b, i, f, p, q, t;\n if ( arguments.length === 1 ) {\n s = h.s, v = h.v, h = h.h;\n }\n i = Math.floor( h * 6 );\n f = h * 6 - i;\n p = v * ( 1 - s );\n q = v * ( 1 - f * s );\n t = v * ( 1 - ( 1 - f ) * s );\n switch ( i % 6 ) {\n case 0:\n r = v, g = t, b = p;\n break;\n case 1:\n r = q, g = v, b = p;\n break;\n case 2:\n r = p, g = v, b = t;\n break;\n case 3:\n r = p, g = q, b = v;\n break;\n case 4:\n r = t, g = p, b = v;\n break;\n case 5:\n r = v, g = p, b = q;\n break;\n }\n return \"#\" + this.byteToHex( Math.floor( r * 255 ) ) + this.byteToHex( Math.floor( g * 255 ) ) + this.byteToHex( Math.floor( b * 255 ) );\n }\n */\n\n /**\n * Returns the color index (```[ 0 - 1 ]```) for a certain value, based on colorMapMin and colorMapMax.\n * @memberof SerieDensityMap\n * @param {Number} binValue - The value of the bin\n * @return {Number} The color index\n */\n getColorIndex(binValue) {\n\n return Math.max(0, Math.min(this.colorMapNum, Math.floor((binValue - this.colorMapMin) / (this.colorMapMax - this.colorMapMin) * this.colorMapNum)));\n }\n\n /**\n * Draws the serie\n * @memberof SerieDensityMap\n * @private\n */\n draw() {\n\n var colorIndex;\n\n if (this.method) {\n this.method();\n }\n\n if (!this.callbackColorMapMinMax || this.colorMapMin == undefined || this.colorMapMax == undefined || this.callbackColorMapMinMax == 'auto') {\n\n this.autoColorMapBinBoundaries();\n } else {\n var val = this.callbackColorMapMinMax(this.binMin, this.binMax);\n\n this.setColorMapBinBoundaries(val[0], val[1]);\n }\n\n var deltaXPx = this.getXAxis().getRelPx(this.deltaX),\n deltaYPx = this.getYAxis().getRelPx(this.deltaY);\n\n for (var i = 0; i < this.paths.length; i++) {\n this.paths[i] = '';\n }\n\n for (var i = 0; i < this.maxIndexX; i++) {\n\n for (var j = 0; j < this.maxIndexY; j++) {\n\n if (this.densitymap[i] == undefined || this.densitymap[i][j] == undefined) {\n continue;\n }\n\n colorIndex = this.getColorIndex(this.densitymap[i][j]);\n if (!this.paths[colorIndex]) {\n this.paths[colorIndex] = '';\n }\n\n this.paths[colorIndex] += ' M ' + this.getXAxis().getPx(i * this.deltaX + this.fromX) + ' ' + this.getYAxis().getPx(j * this.deltaY + this.fromY) + ' h ' + deltaXPx + ' v ' + deltaYPx + ' h -' + deltaXPx + ' z';\n }\n }\n /*\n this.maxIndexX = indexX;\n this.maxIndexY = indexY;*/\n\n this.drawRects();\n }\n\n /**\n * Draws the rectangles\n * @memberof SerieDensityMap\n * @private\n */\n drawRects() {\n\n for (var i = 0; i < this.paths.length; i++) {\n\n if (!this.rects[i]) {\n this.rects[i] = document.createElementNS(this.graph.ns, 'path');\n this.rects[i].setAttribute('shape-rendering', 'crispEdges');\n }\n\n if (this.paths[i] !== undefined) {\n this.rects[i].setAttribute('d', this.paths[i]);\n this.rects[i].setAttribute('fill', this.colorMap[i]);\n this.rects[i].setAttribute('fill-opacity', this.opacities[i]);\n }\n this.groupMain.appendChild(this.rects[i]);\n }\n }\n\n /**\n * Sets the options of the serie\n * @see SerieDensityMapDefaultOptions\n * @param {Object} options - A object containing the options to set\n * @return {SerieDensityMap} The current serie\n * @memberof SerieDensityMap\n */\n setOptions(options) {\n this.options = extend$1(true, {}, this.defaults(), options || {});\n // Unselected style\n\n return this;\n }\n}\n\n/**\n * Constructor for the contour serie. Do not use this constructor directly, but use the {@link Graph#newSerie} method\n * @private\n * @extends Serie\n * @example graph.newSerie( name, options, \"contour\" );\n * @see Graph#newSerie\n */\nclass SerieContour extends SerieLine {\n\n constructor(graph, name, options) {\n super(...arguments);\n\n this.negativeDelta = 0;\n this.positiveDelta = 0;\n\n this.negativeThreshold = 0;\n this.positiveThreshold = 0;\n\n this.groupMain.setAttribute('clip-path', 'url(#_clipplot' + graph._creation + ')');\n }\n\n /**\n * Sets the contour lines\n * @memberof SerieContour.prototype\n * @param {Object} data - The object data\n * @param {Number} data.minX - The minimum x value\n * @param {Number} data.maxX - The maximum x value\n * @param {Number} data.minY - The minimum y value\n * @param {Number} data.maxY - The maximum y value\n * @param {Object[]} data.segments - The segments making up the contour lines\n * @param {Number[]} data.segments.lines - An array of alternating (x1,y1,x2,y2) quadruplet\n * @param {Number} data.segments.zValue - The corresponding z-value of this array\n * @return {Serie} The current serie\n */\n setData(data, arg, type) {\n\n var x,\n dx,\n arg = arg || '2D',\n type = type || 'float',\n i,\n l = data.length,\n j,\n k,\n arr,\n datas = [];\n\n if (!(data instanceof Array)) {\n\n if (typeof data == 'object') {\n // Def v2\n this.minX = data.minX;\n this.minY = data.minY;\n this.maxX = data.maxX;\n this.maxY = data.maxY;\n\n data = data.segments;\n l = data.length;\n }\n }\n\n for (i = 0; i < l; i++) {\n k = data[i].lines.length;\n arr = this._addData(type, k);\n\n for (j = 0; j < k; j += 2) {\n\n arr[j] = data[i].lines[j];\n this._checkX(arr[j]);\n arr[j + 1] = data[i].lines[j + 1];\n this._checkY(arr[j + 1]);\n }\n\n datas.push({\n lines: arr,\n zValue: data[i].zValue\n });\n }\n this.data = datas;\n this.graph.updateDataMinMaxAxes();\n\n this.dataHasChanged(true);\n\n return this;\n }\n\n /**\n * Draws the serie if the data has changed\n * @memberof SerieContour.prototype\n * @param {Boolean} force - Forces redraw even if the data hasn't changed\n * @return {Serie} The current serie\n */\n draw(force) {\n\n if (force || this.hasDataChanged()) {\n\n this.currentLine = 0;\n var x,\n y,\n xpx,\n ypx,\n xpx2,\n ypx2,\n i = 0,\n l = this.data.length,\n j = 0,\n k,\n m,\n currentLine,\n domLine,\n arr;\n this.minZ = Infinity;\n this.maxZ = -Infinity;\n\n var next = this.groupLines.nextSibling;\n this.groupMain.removeChild(this.groupLines);\n this.zValues = {};\n\n var incrXFlip = 0;\n var incrYFlip = 1;\n if (this.getFlip()) {\n incrXFlip = 0;\n incrYFlip = 1;\n }\n\n var minY = this.getYAxis().getCurrentMin();\n var minX = this.getXAxis().getCurrentMin();\n\n var maxX = this.getXAxis().getCurrentMax();\n var maxY = this.getYAxis().getCurrentMax();\n\n this.counter = 0;\n this.currentLineId = 0;\n\n for (; i < l; i++) {\n this.currentLine = '';\n j = 0;\n for (arr = this.data[i].lines, m = arr.length; j < m; j += 4) {\n\n if (arr[j + incrXFlip] < minX && arr[j + 2 + incrXFlip] < minX || arr[j + incrYFlip] < minY && arr[j + 2 + incrYFlip] < minY || arr[j + incrYFlip] > maxY && arr[j + 2 + incrYFlip] > maxY || arr[j + incrXFlip] > maxX && arr[j + 2 + incrXFlip] > maxX) {\n continue;\n }\n\n xpx2 = this.getX(arr[j + incrXFlip]);\n ypx2 = this.getY(arr[j + incrYFlip]);\n\n xpx = this.getX(arr[j + 2 + incrXFlip]);\n ypx = this.getY(arr[j + 2 + incrYFlip]);\n\n if (xpx == xpx2 && ypx == ypx2) {\n continue;\n }\n\n /*\tif( j > 0 && ( lastxpx !== undefined && lastypx !== undefined && Math.abs( xpx2 - lastxpx ) <= 30 && Math.abs( ypx2 - lastypx ) <= 30 ) ) {\n currentLine += \"L\";\n } else {\n currentLine += \"M\";\n }\n */\n\n this.currentLine += 'M ';\n this.currentLine += xpx2;\n this.currentLine += ' ';\n this.currentLine += ypx2;\n\n this.currentLine += 'L ';\n this.currentLine += xpx;\n this.currentLine += ' ';\n this.currentLine += ypx;\n\n this.counter++;\n\n \n }\n\n this.currentLine += ' z';\n\n domLine = this._createLine();\n domLine.setAttribute('data-zvalue', this.data[i].zValue);\n\n this.zValues[this.data[i].zValue] = {\n dom: domLine\n };\n\n this.minZ = Math.min(this.minZ, this.data[i].zValue);\n this.maxZ = Math.max(this.maxZ, this.data[i].zValue);\n }\n\n i++;\n\n for (i = this.currentLine + 1; i < this.lines.length; i++) {\n this.groupLines.removeChild(this.lines[i]);\n this.lines.splice(i, 1);\n }\n\n i = 0;\n\n for (; i < l; i++) {\n this.setColorTo(this.lines[i], this.data[i].zValue, this.minZ, this.maxZ);\n }\n\n this.onMouseWheel(0, {\n shiftKey: false\n });\n this.groupMain.insertBefore(this.groupLines, next);\n } else if (this.hasStyleChanged(this.selectionType)) {\n\n for (; i < l; i++) {\n this.setColorTo(this.lines[i], this.data[i].zValue, this.minZ, this.maxZ);\n }\n }\n }\n\n onMouseWheel(delta, e, fixed, positive) {\n\n delta /= 250;\n\n if (fixed !== undefined) {\n\n if (!positive) {\n this.negativeThreshold = -fixed * this.minZ;\n this.negativeDelta = -Math.pow(Math.abs(this.negativeThreshold / -this.minZ), 1 / 3);\n }\n\n if (positive) {\n this.positiveThreshold = fixed * this.maxZ;\n this.positiveDelta = Math.pow(this.positiveThreshold / this.maxZ, 1 / 3);\n }\n } else {\n\n if (!e.shiftKey || !this.options.hasNegative) {\n\n this.positiveDelta = Math.min(1, Math.max(0, this.positiveDelta + Math.min(0.1, Math.max(-0.1, delta))));\n this.positiveThreshold = this.maxZ * Math.pow(this.positiveDelta, 3);\n } else {\n\n this.negativeDelta = Math.min(0, Math.max(-1, this.negativeDelta + Math.min(0.1, Math.max(-0.1, delta))));\n this.negativeThreshold = -this.minZ * Math.pow(this.negativeDelta, 3);\n }\n }\n\n if (isNaN(this.positiveDelta)) {\n this.positiveDelta = 0;\n }\n\n if (isNaN(this.negativeDelta)) {\n this.negativeDelta = 0;\n }\n\n for (var i in this.zValues) {\n\n this.zValues[i].dom.setAttribute('display', i >= 0 && i >= this.positiveThreshold || i <= 0 && i <= this.negativeThreshold ? 'block' : 'none');\n }\n\n if (this._shapeZoom) {\n\n if (!this.options.hasNegative) {\n this._shapeZoom.hideHandleNeg();\n } else {\n\n this._shapeZoom.setHandleNeg(-Math.pow(this.negativeDelta, 3), this.minZ);\n this._shapeZoom.showHandleNeg();\n }\n\n this._shapeZoom.setHandlePos(Math.pow(this.positiveDelta, 3), this.maxZ);\n }\n }\n\n /**\n * Sets rainbow colors based on hsl format\n * @memberof SerieContour.prototype\n * @param {Object} colors\n * @param {Object} colors.fromPositive\n * @param {Number} colors.fromPositive.h\n * @param {Number} colors.fromPositive.s\n * @param {Number} colors.fromPositive.l\n * @param {Object} colors.toPositive\n * @param {Number} colors.toPositive.h\n * @param {Number} colors.toPositive.s\n * @param {Number} colors.toPositive.l\n * @param {Object} colors.fromNegative\n * @param {Number} colors.fromNegative.h\n * @param {Number} colors.fromNegative.s\n * @param {Number} colors.fromNegative.l\n * @param {Object} colors.toNegative\n * @param {Number} colors.toNegative.h\n * @param {Number} colors.toNegative.s\n * @param {Number} colors.toNegative.l\n * @return {Serie} The current serie\n */\n setDynamicColor(colors) {\n this.lineColors = colors;\n\n this.styleHasChanged();\n }\n\n setNegative(bln) {\n this.options.hasNegative = bln;\n\n if (bln) {\n this.negativeThreshold = 0;\n }\n }\n\n setColorTo(line, zValue, min, max) {\n\n if (!this.lineColors) {\n return;\n }\n\n var hsl = {\n h: 0,\n s: 0,\n l: 0\n };\n\n for (var i in hsl) {\n\n if (zValue > 0) {\n hsl[i] = this.lineColors.fromPositive[i] + (this.lineColors.toPositive[i] - this.lineColors.fromPositive[i]) * (zValue / max);\n } else {\n hsl[i] = this.lineColors.fromNegative[i] + (this.lineColors.toNegative[i] - this.lineColors.fromNegative[i]) * (zValue / min);\n }\n }\n\n hsl.h /= 360;\n\n var rgb = hslToRgb(hsl.h, hsl.s, hsl.l);\n\n line.setAttribute('stroke', 'rgb(' + rgb.join() + ')');\n }\n\n getSymbolForLegend() {\n\n if (!this.lineForLegend) {\n\n var line = document.createElementNS(this.graph.ns, 'ellipse');\n\n line.setAttribute('cx', 7);\n line.setAttribute('cy', 0);\n line.setAttribute('rx', 8);\n line.setAttribute('ry', 3);\n\n line.setAttribute('cursor', 'pointer');\n this.lineForLegend = line;\n }\n\n this.applyLineStyle(this.lineForLegend, this.maxZ);\n\n return this.lineForLegend;\n }\n\n applyLineStyle(line, overwriteValue) {\n line.setAttribute('stroke', this.getLineColor());\n line.setAttribute('stroke-width', this.getLineWidth() + (this.isSelected() ? 2 : 0));\n if (this.getLineDashArray()) {\n line.setAttribute('stroke-dasharray', this.getLineDashArray());\n }\n line.setAttribute('fill', 'none');\n\n this.setColorTo(line, overwriteValue !== undefined ? overwriteValue : line.getAttribute('data-zvalue'), this.minZ, this.maxZ);\n // line.setAttribute('shape-rendering', 'optimizeSpeed');\n\n this.hasStyleChanged(false);\n }\n\n setShapeZoom(shape) {\n this._shapeZoom = shape;\n }\n\n}\n\n/**\n * Shape class that should be extended\n * @class Shape\n * @static\n */\nclass Shape extends EventEmitter {\n\n constructor() {\n super();\n }\n\n /**\n * Initializes the shape\n * @param {Graph} graph - The graph containing the shape\n * @param {Object} properties - The properties object (not copied)\n * @return {Shape} The current shape\n */\n init(graph, properties) {\n\n var self = this;\n\n this.graph = graph;\n this.properties = properties || {};\n this.handles = [];\n this.options = this.options || {};\n\n this.group = document.createElementNS(this.graph.ns, 'g');\n\n this.group.setAttribute('clip-path', 'url(#_clipplot' + graph._creation + ')');\n\n this._selected = false;\n this.createDom();\n\n if (this._dom) {\n this._dom.jsGraphIsShape = this;\n }\n\n this.group.jsGraphIsShape = this;\n\n this.classes = [];\n this.transforms = [];\n\n if (this._data.masker) {\n\n var maskPath = document.createElementNS(this.graph.ns, 'mask');\n this.maskingId = Math.random();\n maskPath.setAttribute('id', this.maskingId);\n\n this.maskDomWrapper = document.createElementNS(this.graph.ns, 'rect');\n this.maskDomWrapper.setAttribute('fill', 'white');\n maskPath.appendChild(this.maskDomWrapper);\n\n var maskDom = this._dom.cloneNode();\n maskPath.appendChild(maskDom);\n\n this.maskDom = maskDom;\n\n this.graph.defs.appendChild(maskPath);\n }\n\n if (this.group) {\n\n if (this._dom && !this.isHTML()) {\n this.group.appendChild(this._dom);\n }\n\n this.group.addEventListener('mouseover', function (e) {\n\n self.handleMouseOver(e);\n });\n\n this.group.addEventListener('mouseout', function (e) {\n\n self.handleMouseOut(e);\n });\n\n this.group.addEventListener('mousedown', function (e) {\n\n self.graph.focus();\n\n self.handleMouseDown(e);\n });\n\n this.group.addEventListener('click', this.handleClick.bind(this));\n\n this.group.addEventListener('dblclick', function (e) {\n\n //e.preventDefault();\n // e.stopPropagation();\n\n self.handleDblClick(e);\n });\n }\n\n //\t\t\tthis.group.appendChild(this.rectEvent);\n\n this.initImpl();\n\n this.graph.emit('shapeNew', this);\n\n return this;\n }\n\n /**\n * Implentation of the init method. To be extended if necessary on extended Shape classes\n */\n initImpl() {}\n\n /**\n * @return {Object} The shape's underlying data object\n */\n getData() {\n return this._data;\n }\n\n /**\n * @returns {String} The type of the shape\n */\n getType() {\n return this.type;\n }\n\n /**\n * Removes the shape from the DOM and unlinks it from the graph\n */\n kill(keepDom) {\n\n if (this._inDom && !keepDom) {\n this.graph.removeShapeFromDom(this);\n }\n\n if (!keepDom) {\n this.graph._removeShape(this);\n }\n\n this.graph.stopElementMoving(this);\n this.graph.emit('shapeRemoved', this);\n this.emit('removed', this);\n\n this._inDom = false;\n }\n\n /**\n * Hides the shape\n * @return {Shape} The current shape\n */\n hide() {\n\n if (this.hidden) {\n return this;\n }\n\n this.hidden = true;\n if (!this.isHTML()) {\n this.group.style.display = 'none';\n } else {\n this._dom.style.display = 'none';\n }\n return this;\n }\n\n /**\n * Returns whether the shape is hidden or not\n * @return {Boolean} true if the shape is hidden, false otherwise\n */\n isHidden() {\n return this.hidden;\n }\n\n /**\n * Returns whether the shape is visible or not\n * @return {Boolean} true if the shape is visible, false if it is hidden\n */\n isVisible() {\n return !this.hidden;\n }\n\n /**\n * Shows the shape\n * @return {Shape} The current shape\n */\n show() {\n\n if (!this.hidden) {\n return this;\n }\n\n this.hidden = false;\n if (!this.isHTML()) {\n this.group.style.display = 'initial';\n } else {\n this._dom.style.display = 'initial';\n }\n\n this.redraw();\n return this;\n }\n\n /**\n * Adds a class to the shape DOM\n * @param {String} className - The class to add\n * @return {Shape} The current shape\n */\n addClass(className) {\n this.classes = this.classes || [];\n if (this.classes.indexOf(className) == -1) {\n this.classes.push(className);\n }\n this.makeClasses();\n return this;\n }\n\n /**\n * Removes a class from the shape DOM\n * @param {String} className - The class to remove\n * @return {Shape} The current shape\n */\n removeClass(className) {\n this.classes.splice(this.classes.indexOf(className), 1);\n this.makeClasses();\n return this;\n }\n\n /**\n * Builds the classes\n * @private\n * @return {Shape} The current shape\n */\n makeClasses() {\n\n if (this._dom) {\n this._dom.setAttribute('class', this.classes.join(' '));\n }\n\n return this;\n }\n\n /**\n * Triggers a ```shapeChanged``` event on the graph and a ```changed``` event on the shape\n * @return {Shape} The current shape\n */\n changed(event, parameters) {\n\n if (event) {\n this.graph.emit(event, this, parameters);\n this.emit(event, this, parameters);\n }\n\n this.emit('changed', this, parameters);\n this.graph.emit('shapeChanged', this, parameters);\n return this;\n }\n\n /**\n * Creates an event receptacle with the coordinates of the shape bounding box\n * @return {Shape} The current shape\n */\n setEventReceptacle() {\n\n if (!this.rectEvent) {\n this.rectEvent = document.createElementNS(this.graph.ns, 'rect');\n this.rectEvent.setAttribute('pointer-events', 'fill');\n this.rectEvent.setAttribute('fill', 'transparent');\n this.group.appendChild(this.rectEvent);\n this.rectEvent.jsGraphIsShape = this;\n }\n\n var box = this.group.getBBox();\n this.rectEvent.setAttribute('x', box.x);\n this.rectEvent.setAttribute('y', box.y - 10);\n this.rectEvent.setAttribute('width', box.width);\n this.rectEvent.setAttribute('height', box.height + 20);\n }\n\n /**\n * Assigns a serie to the shape\n * @param {Serie} The serie that owns the shape\n * @return {Shape} The current shape\n */\n setSerie(serie) {\n\n if (!serie) {\n return;\n }\n\n this.serie = serie;\n\n if (!serie.getXAxis || !serie.getYAxis) {\n console.error(serie);\n throw 'Serie does not implement the getXAxis or getYAxis method';\n }\n this.xAxis = serie.getXAxis();\n this.yAxis = serie.getYAxis();\n return this;\n }\n\n /**\n * @return {Serie} The serie associated to the shape\n */\n getSerie() {\n return this.serie;\n }\n\n /**\n * Assigns the shape to the default x and y axes of the graph, only if they don't exist yet\n * @return {Shape} The current shape\n * @see Graph#getXAxis\n * @see Graph#getYAxis\n */\n autoAxes() {\n\n if (!this.xAxis) {\n this.xAxis = this.graph.getXAxis();\n }\n\n if (!this.yAxis) {\n this.yAxis = this.graph.getYAxis();\n }\n\n return this;\n }\n\n /**\n * Assigns the shape to an x axis\n * @param {XAxis} The X axis related to the shape\n * @return {Shape} The current shape\n */\n setXAxis(axis) {\n this.xAxis = axis;\n return this;\n }\n\n /**\n * Assigns the shape to an y axis\n * @param {YAxis} The Y axis related to the shape\n * @return {Shape} The current shape\n */\n setYAxis(axis) {\n this.yAxis = axis;\n }\n\n /**\n * Returns the x axis associated to the shape. If non-existent, assigns it automatically\n * @return {XAxis} The x axis associated to the shape.\n */\n getXAxis() {\n\n if (!this.xAxis) {\n this.autoAxes();\n }\n\n return this.xAxis;\n }\n\n /**\n * Returns the y axis associated to the shape. If non-existent, assigns it automatically\n * @return {YAxis} The y axis associated to the shape.\n */\n getYAxis() {\n\n if (!this.yAxis) {\n this.autoAxes();\n }\n\n return this.yAxis;\n }\n\n /**\n * Sets the layer of the shape\n * @param {Number} layer - The layer number (1 being the lowest)\n * @return {Shape} The current shape\n * @see Shape#getLayer\n */\n setLayer(layer) {\n this.setProp('layer', layer);\n return this;\n }\n\n /**\n * Returns the layer on which the shape is placed\n * @return {Number} The layer number (1 being the lowest layer)\n */\n getLayer() {\n var layer = this.getProp('layer');\n\n if (layer !== undefined) {\n return layer;\n }\n\n return 1;\n }\n\n /**\n * Initial drawing of the shape. Adds it to the DOM and creates the labels. If the shape was already in the DOM, the method simply recreates the labels and reapplies the shape style, unless ```force``` is set to ```true```\n * @param {Boolean} force - Forces adding the shape to the DOM (useful if the shape has changed layer)\n * @param {Boolean} preventRedraw - Prevents the redraw method\n * @return {Shape} The current shape\n */\n draw(force, preventRedraw) {\n\n if (!this._inDom || force) {\n\n this.appendToDom();\n this._inDom = true;\n }\n\n this.makeLabels();\n\n if (!preventRedraw) {\n this.redraw();\n }\n\n this.applyStyle();\n\n return this;\n }\n\n /**\n * Redraws the shape. Repositions it, applies the style and updates the labels\n * @return {Shape} The current shape\n */\n redraw() {\n\n if (this.hidden) {\n return this;\n }\n\n this.position = this.applyPosition();\n\n this.redrawImpl();\n if (!this.position) {\n this.updateLabels();\n return this;\n }\n\n this.updateLabels();\n this._applyTransforms();\n return this;\n }\n\n /**\n * Implementation of the redraw method. Extended Shape classes should override this method\n */\n redrawImpl() {}\n\n /**\n * Sets all dumpable properties of the shape\n * @param {Object} properties - The properties object\n * @return {Shape} The current shape\n */\n setProperties(properties) {\n this.properties = properties;\n\n if (!Array.isArray(this.properties.position)) {\n this.properties.position = [this.properties.position];\n }\n var self = this;\n for (var i = 0, l = this.properties.position.length; i < l; i++) {\n\n var pos = Position.check(this.properties.position[i], function (relativeTo) {\n return self.getRelativePosition(relativeTo);\n });\n\n this.properties.position[i] = pos;\n }\n\n this.emit('propertiesChanged');\n return this;\n }\n\n getRelativePosition(relativePosition) {\n\n var result;\n if ((result = /position([0-9]*)/.exec(relativePosition)) !== null) {\n return this.getPosition(result[1]);\n } else if ((result = /labelPosition([0-9]*)/.exec(relativePosition)) !== null) {\n return this.getLabelPosition(result[1]);\n }\n }\n\n /**\n * Gets all dumpable properties of the shape\n * @return {Object} properties - The properties object\n */\n getProperties(properties) {\n return this.properties;\n }\n\n /**\n * Sets a property to the shape that is remembered and can be later reexported (or maybe reimported)\n * @param {String} prop - The property to save\n * @param val - The value to save\n * @param [ index = 0 ] - The index of the property array to save the property\n * @return {Shape} The current shape\n */\n setProp(prop, val, index) {\n this.properties = this.properties || {};\n this.properties[prop] = this.properties[prop] || [];\n this.properties[prop][index || 0] = val;\n this.emit('propertyChanged', prop);\n return this;\n }\n\n /**\n * Returns a property of the shape\n * @param {String} prop - The property to retrieve\n * @param [ index = 0 ] - The index of the property array\n */\n getProp(prop, index) {\n return (this.properties[prop] || [])[index || 0];\n }\n\n /**\n * Returns all the properties of the shape\n * @param {String} prop - The property to retrieve\n */\n getProps(prop, index) {\n return this.properties[prop] || [];\n }\n\n /**\n * Adds a property to the property array\n * @param {String} prop - The property to add\n * @param val - The value to save\n */\n addProp(prop, value) {\n this.properties[prop] = this.properties[prop] || [];\n this.properties[prop].push(value);\n }\n\n /**\n * Resets the property array\n * @param {String} prop - The property to reset\n */\n resetProp(prop) {\n this.properties[prop] = [];\n }\n\n /**\n * Sets a DOM property to the shape\n */\n setDom(prop, val, noForce) {\n if (this._dom) {\n\n if (!noForce || !hasSavedAttribute(this._dom, prop)) {\n this._dom.setAttribute(prop, val);\n }\n }\n }\n\n /**\n * Sets a DOM property to the shape group\n */\n setDomGroup(prop, val) {\n if (this.group) {\n this.group.setAttribute(prop, val);\n }\n }\n\n /**\n * Saves the stroke color\n * @return {Shape} The current shape\n */\n setStrokeColor(color) {\n this.setProp('strokeColor', color);\n this.overwriteSavedProp('stroke', color);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the stroke color\n * @return {String} The stroke color of the shape\n */\n getStrokeColor() {\n return this.getProp('strokeColor');\n }\n\n /**\n * Saves the fill color\n * @param {String} color - The filling color\n * @return {Shape} The current shape\n */\n setFillColor(color) {\n\n this.setProp('fillColor', color);\n this.overwriteSavedProp('fill', color);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the fill color\n * @return {String} The fill color of the shape\n */\n getFillColor() {\n return this.getProp('fillColor');\n }\n\n /**\n * Saves the opacity of the filling color of the shape\n * @param {Number} opacity - The filling opacity (0 to 1)\n * @return {Shape} The current shape\n */\n setFillOpacity(opacity) {\n this.setProp('fillOpacity', opacity);\n this.overwriteSavedProp('fill-opacity', opacity);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Saves the stroke width\n * @param {String} width - The stroke width\n * @return {Shape} The current shape\n */\n setStrokeWidth(width) {\n this.setProp('strokeWidth', width);\n this.overwriteSavedProp('stroke-width', width);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Returns the stroke width\n * @return {String} The stroke width of the shape\n */\n getStrokeWidth() {\n return this.getProp('strokeWidth');\n }\n\n /**\n * Saves the stroke dash array\n * @param {String} dasharray - The dasharray string\n * @example shape.setStrokeDasharray(\"5,5,1,4\");\n * shape.applyStyle();\n * @return {Shape} The current shape\n */\n setStrokeDasharray(dasharray) {\n this.setProp('strokeDasharray', dasharray);\n this.overwriteSavedProp('stroke-dasharray', dasharray);\n this.applySelectedStyle();\n return this;\n }\n\n /**\n * Sets any extra attributes to the DOM element of the shape\n * @param {Object} attributes - An extra attribute array to apply to the shape DOM\n * @example shape.setAttributes( { \"data-bindable\" : true } );\n * shape.applyStyle();\n * @return {Shape} The current shape\n */\n setAttributes(attributes) {\n this.setProp('attributes', attributes);\n return this;\n }\n\n overwriteSavedProp(prop, newValue) {\n overwriteDomAttribute(this._dom, prop, newValue);\n }\n\n /**\n * Adds an extra attribute to the shape\n * @param {String} attributeName - The name of the attribute\n * @param {String} attributeValue - The value of the attribute\n * @return {Shape} The current shape\n */\n addAttribute(attributeName, attributeValue) {\n var added = {};\n added[attributeName] = attributeValue;\n this.addProp('attributes', added);\n return this;\n }\n\n /**\n * Adds a transform property to the shape.\n * @param {String} type - The transform type (\"rotate\", \"transform\" or \"scale\")\n * @param {String} args - The arguments following the transform\n * @return {Shape} The current shape\n */\n addTransform(type, args) {\n this.addProp('transforms', {\n type: type,\n arguments: Array.isArray(args) ? args : [args]\n });\n return this;\n }\n\n /**\n * Resets the transforms\n * @see Shape#addTransform\n * @return {Shape} The current shape\n */\n resetTransforms() {\n this.resetProp('transforms');\n return this;\n }\n\n /**\n * Sets the text of the label\n * @param {String} text - The text of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelText(text, index = 0) {\n this.setProp('labelText', text, index);\n return this;\n }\n\n /**\n * Sets the text of the label\n * @param {String} data - Some additional HTML tags that will be set to the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelData(data, text, index = 0) {\n this.setProp('labelData', text, index);\n return this;\n }\n\n /**\n * Returns the text of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {String} The text of the label\n */\n getLabelText(text, index = 0) {\n return this.getProp('labelText', index);\n }\n\n /**\n * Displays a hidden label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n displayLabel(index = 0) {\n this.setProp('labelVisible', true, index);\n return this;\n }\n\n /**\n * Hides a displayed label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n hideLabel(index = 0) {\n this.setProp('labelVisible', false, index);\n return this;\n }\n\n /**\n * Sets the color of the label\n * @param {String} color - The color of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelColor(color, index = 0) {\n this.setProp('labelColor', color, index);\n return this;\n }\n\n /**\n * Sets the font size of the label\n * @param {String} size - The font size (in px) of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelFontSize(size, index = 0) {\n this.setProp('labelFontSize', size, index);\n return this;\n }\n\n /**\n * Returns the position of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Position} The current position of the label\n */\n getLabelPosition(index = 0) {\n return this.getProp('labelPosition', index);\n }\n\n /**\n * Sets the position of the label\n * @param {Position} position - The position of the label\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelPosition(position, index) {\n\n var self;\n var pos = Position.check(position, function (relativeTo) {\n return self.getRelativePosition(relativeTo);\n });\n\n this.setProp('labelPosition', pos, index || 0);\n return this;\n }\n\n /**\n * Sets the angle of the label\n * @param {Number} angle - The angle of the label in degrees (0 to 360°)\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelAngle(angle, index) {\n this.setProp('labelAngle', angle, index || 0);\n return this;\n }\n\n /**\n * Sets the baseline of the label, which affects its y position with respect to the text direction. For text along the x direction, different baselines will reference differently the text to the ```y``` coordinate.\n * @param {String} baseline - The baseline of the label. Most common baselines are ```no-change```, ```central```, ```middle``` and ```hanging```. You will find an explanation of those significations on the [corresponding MDN article]{@link https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/dominant-baseline}\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBaseline(baseline, index) {\n this.setProp('labelBaseline', baseline, index || 0);\n return this;\n }\n\n /**\n * Sets the anchoring of the label.\n * @param {String} anchor - The anchor of the label. Values can be ```start```, ```middle```, ```end``` or ```inherit```.\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelAnchor(anchor, index) {\n this.setProp('labelAnchor', anchor, index || 0);\n return this;\n }\n\n /**\n * Sets the anchoring of the label.\n * @param {String} size - The font size in px\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelSize(size, index) {\n this.setProp('labelSize', size, index || 0);\n return this;\n }\n\n /**\n * Sets the color of the stroke of the label.\n * @param {String} color - The color of the stroke\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelStrokeColor(color, index) {\n this.setProp('labelStrokeColor', color, index || 0);\n return this;\n }\n\n /**\n * Sets the width of the stroke of the label.\n * @param {Number} width - The width of the stroke\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelStrokeWidth(width, index) {\n this.setProp('labelStrokeWidth', width, index || 0);\n return this;\n }\n\n /**\n * Sets the color of the background of the label.\n * @param {String} color - The color of the background\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBackgroundColor(color, index) {\n this.setProp('labelBackgroundColor', color, index || 0);\n return this;\n }\n\n /**\n * Sets the opacity of the background of the label.\n * @param {Number} opacity - The opacity of the background, between 0 and 1\n * @param {Number} [ index = 0 ] - The index of the label\n * @return {Shape} The current shape\n */\n setLabelBackgroundOpacity(opacity, index) {\n this.setProp('labelBackgroundOpacity', opacity, index || 0);\n return this;\n }\n\n /**\n * Applies the generic style to the shape. This is a method that applies to most shapes, hence should not be overridden. However if you create a bundle of shapes that extend another one, you may use it to set common style properties to all your shapes.\n * @return {Shape} The current shape\n */\n applyGenericStyle() {\n\n this.setDom('fill', this.getProp('fillColor'), true);\n this.setDom('fill-opacity', this.getProp('fillOpacity'), true);\n this.setDom('stroke', this.getProp('strokeColor'), true);\n this.setDom('stroke-width', this.getProp('strokeWidth'), true);\n this.setDom('stroke-dasharray', this.getProp('strokeDasharray'), true);\n\n var attributes = this.getProps('attributes');\n for (var j = 0, l = attributes.length; j < l; j++) {\n\n for (var i in attributes[j]) {\n this.setDom(i, typeof attributes[j][i] == 'function' ? attributes[j][i].call(this, i) : attributes[j][i], true);\n }\n }\n\n this._applyTransforms();\n\n return this;\n }\n\n /**\n * Applies the style to the shape. This method can be extended to apply specific style to the shapes\n * @return {Shape} The current shape\n */\n applyStyle() {\n\n return this.applyGenericStyle();\n }\n\n /**\n * Returns a computed position object\n * @param {(Number|Position)} [ index = 0 ] - The index of the position to compute\n * @param {Position} relToPosition - A base position from which to compute the position (useful for dx values)\n * @return {Object} The computed position object in the format { x: x_in_px, y: y_in_px }\n */\n calculatePosition(index) {\n\n var position;\n\n position = index instanceof Position ? index : this.getPosition(index);\n\n if (!position) {\n return;\n }\n\n if (position && position.compute) {\n return position.compute(this.graph, this.getXAxis(), this.getYAxis(), this.getSerie());\n }\n\n this.graph.throw();\n }\n\n /**\n * Returns a stored position object\n * @param {Number} [ index = 0 ] - The index of the position to compute\n * @return {Position} The position at the proper index, or undefined\n */\n getPosition(index) {\n\n var pos = this.getProp('position', index || 0);\n this.setProp('position', pos = Position.check(pos), index);\n return pos;\n }\n\n /**\n * Sets a position object\n * @param {Position} position - The position object to store\n * @param {Number} [ index = 0 ] - The index of the position to store\n * @return {Shape} The current shape\n */\n setPosition(position, index) {\n\n var self = this;\n var pos = Position.check(position, function (relativeTo) {\n return self.getRelativePosition(relativeTo);\n });\n\n return this.setProp('position', pos, index || 0);\n }\n\n /**\n * Sorts the positions\n * @param {Function} sortFunction - Function passed into the ```Array.sort``` method\n * @return {Position} The current shape\n */\n sortPositions(sortFunction) {\n this.getProps('position').sort(sortFunction);\n return this;\n }\n\n /**\n * Applies the style to the shape. This method can be extended to apply specific style to the shapes\n * @private\n * @return {Shape} The current shape\n */\n _applyTransforms() {\n\n var transforms = this.getProp('transforms'),\n transformString = '';\n\n if (!transforms) {\n return;\n }\n transforms = Array.isArray(transforms) ? transforms : [transforms];\n\n if (transforms.length == 0) {\n return;\n }\n\n for (var i = 0; i < transforms.length; i++) {\n\n transformString += transforms[i].type + '(';\n\n switch (transforms[i].type) {\n\n case 'translate':\n\n let transform = transforms[i].arguments[0].compute(this.graph, this.getXAxis(), this.getYAxis(), this.getSerie());\n\n transformString += transform.x;\n transformString += ', ';\n transformString += transform.y;\n break;\n\n case 'rotate':\n\n transformString += transforms[i].arguments[0];\n transformString += ', ';\n\n if (transforms[i].arguments.length == 1) {\n var p = this.computePosition(0);\n transformString += p.x + ', ' + p.y;\n } else {\n\n transformString += Position.getDeltaPx(transforms[i].arguments[1], this.getXAxis()).replace('px', '');\n transformString += ', ';\n transformString += Position.getDeltaPx(transforms[i].arguments[2], this.getYAxis()).replace('px', '');\n }\n\n break;\n }\n\n transformString += ') ';\n }\n\n this.setDomGroup('transform', transformString);\n return this;\n }\n\n /**\n * Creates all the labels\n * @private\n * @returns {Shape} The current shape\n */\n makeLabels() {\n\n this._labels = this._labels || [];\n this._labelsBackground = this._labelsBackground || [];\n\n this._labels.map(label => {\n this.group.removeChild(label);\n });\n\n this._labelsBackground.map(bg => {\n this.group.removeChild(bg);\n });\n\n this._labels = [];\n this._labelsBackground[i] = [];\n\n var i = 0;\n\n while (this.getProp('labelText', i) !== undefined) {\n\n if (!this._labels[i]) {\n\n this._labels[i] = document.createElementNS(this.graph.ns, 'text');\n this._labels[i].setAttribute('data-label-i', i);\n this._labels[i].jsGraphIsShape = this;\n\n this._labelsBackground[i] = document.createElementNS(this.graph.ns, 'rect');\n this._labelsBackground[i].setAttribute('data-label-i', i);\n this._labelsBackground[i].jsGraphIsShape = this;\n\n this.group.appendChild(this._labelsBackground[i]);\n this.group.appendChild(this._labels[i]);\n\n this._labels[i].addEventListener('dblclick', e => {\n e.stopPropagation();\n\n this.labelDblClickListener(e);\n });\n\n this._labelsBackground[i].addEventListener('dblclick', e => {\n e.stopPropagation();\n\n this.labelDblClickListener(e);\n });\n }\n\n i++;\n }\n\n this.updateLabels();\n\n return this;\n }\n\n /**\n * Determines if the label is editable\n * @param {Number} labelIndex - The index of the label\n * @return {Boolean} ```true``` if the label is editable, ```false``` otherwise\n */\n isLabelEditable(labelIndex) {\n return this.getProp('labelEditable', labelIndex || 0);\n }\n\n /**\n * Applies the label data to the dom object\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {Shape} The current shape\n */\n updateLabels() {\n\n this._labels = this._labels || [];\n\n for (var i = 0, l = this._labels.length; i < l; i++) {\n this._applyLabelData(i);\n }\n }\n\n /**\n * Applies the label data to the dom object\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {Shape} The current shape\n */\n _applyLabelData(labelIndex) {\n\n labelIndex = labelIndex || 0;\n\n /** Sets the position */\n\n var visible = this.getProp('labelVisible', labelIndex);\n\n if (visible === false) {\n this._labels[labelIndex].setAttribute('display', 'none');\n this._labelsBackground[labelIndex].setAttribute('display', 'none');\n return;\n } else {\n this._labels[labelIndex].setAttribute('display', 'initial');\n this._labelsBackground[labelIndex].setAttribute('display', 'initial');\n }\n\n var position = this.calculatePosition(Position.check(this.getProp('labelPosition', labelIndex)));\n\n if (isNaN(position.x) || isNaN(position.y) || position.y === false || position.x === false) {\n /*console.warn( \"Cannot compute positioning for labelIndex \" + labelIndex + \" with text \" + this.getProp( \"labelText\", labelIndex ) );\n console.log( this, this._labels );\n console.trace();*/\n return;\n }\n\n if (position.x != 'NaNpx' && !isNaN(position.x) && position.x !== 'NaN' && position.x !== false) {\n\n this._labels[labelIndex].setAttribute('x', position.x);\n this._labels[labelIndex].setAttribute('y', position.y);\n }\n\n /** Sets the angle */\n var currAngle = this.getProp('labelAngle', labelIndex) || 0;\n if (currAngle != 0) {\n\n var x = this._labels[labelIndex].getAttribute('x'),\n y = this._labels[labelIndex].getAttribute('y');\n\n this._labels[labelIndex].setAttribute('transform', 'rotate(' + currAngle + ' ' + x + ' ' + y + ')');\n // this._labelsBackground[ labelIndex ].setAttribute( 'transform', 'rotate(' + currAngle + ' ' + x + ' ' + y + ')' );\n }\n\n let labelData = this.getProp('labelHTMLData', labelIndex) || {};\n\n for (var i in labelData) {\n\n this._labels[labelIndex].setAttribute(i, labelData[i]);\n this._labelsBackground[labelIndex].setAttribute(i, labelData[i]);\n }\n\n /** Sets the baseline */\n this._labels[labelIndex].setAttribute('dominant-baseline', this.getProp('labelBaseline', labelIndex) || 'no-change');\n\n /** Sets the text */\n this._labels[labelIndex].textContent = this.getProp('labelText', labelIndex);\n\n /** Sets the color */\n this._labels[labelIndex].setAttribute('fill', this.getProp('labelColor', labelIndex) || 'black');\n\n /** Sets the size */\n this._labels[labelIndex].setAttribute('font-size', this.getProp('labelSize', labelIndex) + 'px' || '12px');\n\n /** Sets the anchor */\n this._labels[labelIndex].setAttribute('text-anchor', this._getLabelAnchor(labelIndex));\n\n /** Sets the stroke */\n this._labels[labelIndex].setAttribute('stroke', this.getProp('labelStrokeColor', labelIndex) || 'black');\n\n /** Sets the stroke */\n this._labels[labelIndex].setAttribute('stroke-width', this.getProp('labelStrokeWidth', labelIndex) || 0 + 'px');\n\n this._labels[labelIndex].setAttribute('stroke-location', 'outside');\n\n let rect = this._labels[labelIndex].getBBox();\n\n this._labelsBackground[labelIndex].setAttribute('x', rect.x);\n this._labelsBackground[labelIndex].setAttribute('y', rect.y);\n this._labelsBackground[labelIndex].setAttribute('width', rect.width);\n this._labelsBackground[labelIndex].setAttribute('height', rect.height);\n\n this._labelsBackground[labelIndex].setAttribute('fill', this.getProp('labelBackgroundColor') || 'transparent');\n this._labelsBackground[labelIndex].setAttribute('fill-opacity', this.getProp('labelBackgroundOpacity') || 1);\n\n return this;\n }\n\n /**\n * Temporarily empties the labels, until the next rendering.\n * This is used when the shape should not be displayed\n * @returns {Shape} The current shape instance\n */\n emptyLabels() {\n\n for (var i = 0, l = this._labels.length; i < l; i++) {\n /** Sets the baseline */\n this._labels[i].textContent = '';\n }\n\n return this;\n }\n\n /**\n * Returns the anchor of the label\n * @private\n * @param {Number} labelIndex - The index of the label\n * @returns {String} The anchor in SVG string\n */\n _getLabelAnchor(labelIndex) {\n var anchor = this.getProp('labelAnchor', labelIndex);\n switch (anchor) {\n case 'middle':\n case 'start':\n case 'end':\n return anchor;\n break;\n\n case 'right':\n return 'end';\n break;\n\n case 'left':\n return 'start';\n break;\n\n default:\n return 'start';\n break;\n }\n }\n\n /**\n * Returns the shape selection status\n * @returns {Boolean} true is the shape is selected, false otherwise\n */\n isSelected() {\n return this._selectStatus || false;\n }\n\n /**\n * Sets or queries whether the shape can have handles. Even if the property is set to false, the getter can return true if the property ```statichandles``` is true (used when handles never disappear)\n * @param {Boolean} setter - If used, defined if the shape has handles or not\n * @returns {Boolean} true is the shape has handles, false otherwise\n * @example Shape.hasHandles( true ); // Sets that the shape has handles\n * @example Shape.hasHandles( false ); // Sets that the shape has no handles\n * @example Shape.hasHandles( ); // Queries the shape to determine if it has handles or not. Also returns true if handles are static\n */\n hasHandles(setter) {\n\n if (setter !== undefined) {\n this.setProp('handles', setter);\n }\n\n return !!this.getProp('handles') || !!this.getProp('staticHandles');\n }\n\n /**\n * Adds shape handles\n * @private\n * @return {Shape} The current shape\n */\n addHandles() {\n\n if (this.isLocked()) {\n return;\n }\n\n if (!this.handlesInDom) {\n\n this.handlesInDom = true;\n\n for (var i = 1; i < this.handles.length; i++) {\n\n if (this.handles[i]) {\n this.group.appendChild(this.handles[i]);\n }\n }\n }\n\n return this;\n }\n\n /**\n * Remove shape handles\n * @private\n * @return {Shape} The current shape\n */\n removeHandles() {\n\n this.hideHandles();\n this.handles = [];\n }\n\n /**\n * Hide shape handles\n * @private\n * @return {Shape} The current shape\n */\n hideHandles() {\n\n if (!this.handlesInDom) {\n return this;\n }\n\n for (var i = 1; i < this.handles.length; i++) {\n this.group.removeChild(this.handles[i]);\n }\n\n this.handlesInDom = false;\n return this;\n }\n\n /**\n * @protected\n * @return {Boolean} ```true``` if the handles are in the DOM\n */\n areHandlesInDom() {\n\n return this.handlesInDom;\n }\n\n /**\n * Selects the shape. Should only be called from jsGraph main instance\n * @private\n * @param {Boolean} [ mute = false ] - Mutes the method (no event emission)\n * @returns {Shape} the current shape\n */\n _select(mute) {\n\n if (!this.isSelectable()) {\n return false;\n }\n\n // Put on the stack\n this.appendToDom();\n //this.graph.appendShapeToDom( this ); // Put the shape on top of the stack !\n\n this._selectStatus = true;\n\n this.applySelectedStyle();\n\n if (this.hasHandles() && !this.hasStaticHandles()) {\n\n this.addHandles();\n this.setHandles();\n }\n\n if (!mute) {\n this.graph.emit('shapeSelected', this);\n }\n }\n\n applySelectedStyle() {\n\n if (!this._selectStatus) {\n return;\n }\n\n var style = this.getSelectStyle();\n var style2 = {};\n for (var i in style) {\n if (typeof style[i] == 'function') {\n style2[i] = style[i].call(this);\n } else {\n style2[i] = style[i];\n }\n }\n\n saveDomAttributes(this._dom, style2, 'select');\n }\n\n /**\n * Unselects the shape. Should only be called from jsGraph main instance\n * @private\n * @param {Boolean} [ mute = false ] - Mutes the method (no event emission)\n * @returns {Shape} the current shape\n */\n _unselect(mute) {\n\n this._selectStatus = false;\n\n restoreDomAttributes(this._dom, 'select');\n\n if (this.hasHandles() && !this.hasStaticHandles()) {\n this.hideHandles();\n }\n\n if (!mute) {\n this.graph.emit('shapeUnselected', this);\n }\n }\n\n /**\n * Returns the special style of the shape when it is selected.\n * @see Shape#setSelectStyle\n * @param {Object} The SVG attributes to apply to the shape\n */\n getSelectStyle() {\n return this.selectStyle;\n }\n\n /**\n * Defines the style that is applied to the shape when it is selected. The style extends the default style of the shape\n * @param {Object} [ attr = {} ] - The SVG attributes to apply to the shape\n * @example rectangle.setSelectStyle( { fill: 'red' } );\n * @returns {Shape} the current shape\n */\n setSelectStyle(attr) {\n this.selectStyle = attr;\n this.applySelectedStyle(); // Maybe the shape is already selected\n return this;\n }\n\n /**\n * Assigns static handles to the shape. In this mode, handles will not disappear\n * @param {Boolean} staticHandles - true to enable static handles, false to disable them.\n * @returns {Shape} the current shape\n */\n setStaticHandles(staticHandles) {\n this.setProp('staticHandles', staticHandles);\n }\n\n /**\n * @returns {Boolean} ```true``` if the shape has static handles, ```false``` otherwise\n */\n hasStaticHandles(staticHandles) {\n return !!this.getProp('staticHandles');\n }\n\n /**\n * Creates the handles for the shape\n * @param {Number} nb - The number of handles\n * @param {String} type - The type of SVG shape to use\n * @param {Object} [ attr = {} ] - The SVG attributes to apply to the handles\n * @param {Function} [ callbackEach ] - An additional callback the user can provide to further personalize the handles\n * @returns {Shape} the current shape\n * @private\n */\n _createHandles(nb, type, attr, callbackEach) {\n\n if (this.handles && this.handles.length > 0) {\n return;\n }\n\n for (var i = 1, l = nb; i <= l; i++) {\n\n (j => {\n\n var self = this;\n\n var handle = document.createElementNS(self.graph.ns, type);\n handle.jsGraphIsShape = true;\n\n if (attr) {\n for (var k in attr) {\n handle.setAttribute(k, attr[k]);\n }\n }\n\n handle.addEventListener('mousedown', e => {\n\n if (self.isResizable()) {\n\n e.preventDefault();\n e.stopPropagation();\n\n self.graph.emit('beforeShapeResize', self);\n this.emit('beforeShapeResize');\n\n if (!self.graph.prevent(false)) {\n\n self.resizing = true;\n self.handleSelected = j;\n self.handleMouseDown(e);\n }\n }\n });\n\n if (callbackEach) {\n callbackEach(self.handles[j]);\n }\n\n self.handles[j] = handle;\n }).call(this, i);\n }\n\n return this.handles;\n }\n\n /**\n * Creates the handles for the shape. Should be implemented by the children shapes classes.\n */\n createHandles() {\n\n if (this.hasStaticHandles()) {\n this.addHandles();\n this.setHandles();\n }\n }\n\n /**\n * Handles mouse down event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseDownImpl() {}\n\n /**\n * Handles the mouse move event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseMoveImpl() {}\n\n /**\n * Handles mouse up event\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleMouseUpImpl() {}\n\n /**\n * Called when the shape is created\n * @private\n * @param {Event} e - The native event.prototype\n */\n handleCreateImpl() {}\n\n /**\n * Handles mouse down events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDownImpl} method.prototype\n */\n handleMouseDown(e) {\n\n //this.handleSelected = false;\n\n if (this.isLocked()) {\n return;\n }\n\n if (this.isMovable() || this.isResizable()) {\n\n this.graph.elementMoving(this);\n }\n\n if (this.getProp('selectOnMouseDown')) {\n this.graph.selectShape(this);\n }\n\n if (this.isMovable()) {\n if (!this.resizing) {\n\n this.graph.emit('beforeShapeMove', self);\n\n if (!this.graph.prevent(false)) {\n\n this.moving = true;\n this.moved = false;\n }\n }\n }\n\n this._mouseCoords = this.graph._getXY(e);\n return this.handleMouseDownImpl(e, this._mouseCoords);\n }\n\n /**\n * Handles mouse click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDownClick} method\n * @private\n */\n handleClick(e) {\n\n this.graph.emit('shapeClicked', this);\n this.emit('shapeClicked');\n\n if (!this.isSelectable()) {\n return false;\n }\n\n if (!e.shiftKey) {\n this.graph.unselectShapes();\n }\n\n if (this.getProp('selectOnClick')) {\n\n this.graph.selectShape(this);\n }\n }\n\n /**\n * Handles mouse click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseUpImpl} method\n * @private\n */\n handleMouseMove(e) {\n //console.log( this.resizinh, this.moving, this.isSelected(), this._mouseCoords );\n if ((this.resizing || this.moving) && !this.isSelected()) {\n this.graph.selectShape(this);\n }\n\n this.graph.emit('beforeShapeMouseMove', this);\n this.emit('beforeShapeMouseMove');\n\n if (this.graph.prevent(false) || !this._mouseCoords) {\n return false;\n }\n\n this.moved = true;\n var coords = this.graph._getXY(e);\n var deltaX = this.getXAxis().getRelVal(coords.x - this._mouseCoords.x),\n deltaY = this.getYAxis().getRelVal(coords.y - this._mouseCoords.y);\n\n if (deltaX != 0 || deltaY !== 0) {\n this.preventUnselect = true;\n }\n\n this._mouseCoords = coords;\n\n var ret = this.handleMouseMoveImpl(e, deltaX, deltaY, coords.x - this._mouseCoords.x, coords.y - this._mouseCoords.y);\n\n return ret;\n }\n\n /**\n * Handles mouse up events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseUpImpl} method\n * @private\n */\n handleMouseUp(e) {\n\n if (this.moving && this.moved) {\n\n this.graph.emit('shapeMoved', this);\n this.emit('shapeMoved');\n }\n\n if (this.handleSelected || this.resize) {\n\n this.graph.emit('shapeResized', this);\n this.emit('shapeResized');\n }\n\n this.moving = false;\n this.resizing = false;\n this.handleSelected = false;\n this.graph.elementMoving(false);\n\n return this.handleMouseUpImpl(e);\n }\n\n /**\n * Handles double click events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseDblClickImpl} method\n * @private\n */\n handleDblClick(e) {}\n\n /**\n * Handles mouse over events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseOverImpl} method\n * @private\n */\n handleMouseOver() {\n\n if (this.getProp('highlightOnMouseOver')) {\n\n if (!this.moving && !this.resizing) {\n this.highlight();\n }\n }\n\n this.graph.emit('shapeMouseOver', this);\n }\n\n /**\n * Handles mouse out events\n * @param {Event} e - The native event\n * @return The result of the {@link Shape#handleMouseOutImpl} method\n * @private\n */\n handleMouseOut() {\n\n if (this.getProp('highlightOnMouseOver')) {\n this.unHighlight();\n }\n\n this.graph.emit('shapeMouseOut', this);\n }\n\n /*\n * Updated July 1st, 2015\n */\n\n /**\n * Locks the shape (prevents selection, resizing and moving)\n * @return {Shape} The current shape\n */\n lock() {\n this.setProp('locked', true);\n return this;\n }\n\n /**\n * Unlocks the shape (prevents selection, resizing and moving)\n * @return {Shape} The current shape\n */\n unlock() {\n this.setProp('locked', false);\n return this;\n }\n\n /**\n * @return {Boolean} True if the shape is locked, false otherwise\n */\n isLocked() {\n return this.getProp('locked') || this.graph.shapesLocked;\n }\n\n /**\n * Makes the shape moveable\n * @return {Shape} The current shape\n */\n movable(bln) {\n this.setProp('movable', true);\n }\n\n /**\n * Makes the shape non-moveable\n * @return {Shape} The current shape\n */\n unmovable() {\n this.setProp('movable', false);\n return false;\n }\n\n /**\n * @return {Boolean} True if the shape is movable, false otherwise\n */\n isMovable() {\n return this.getProp('movable');\n }\n\n /**\n * Makes the shape resizable\n * @return {Shape} The current shape\n */\n resizable() {\n this.setProp('resizable', true);\n }\n\n /**\n * Makes the shape non-resizable\n * @return {Shape} The current shape\n */\n unresizable() {\n this.setProp('resizable', false);\n }\n\n /**\n * @return {Boolean} True if the shape is resizable, false otherwise\n */\n isResizable() {\n return this.getProp('resizable');\n }\n\n /**\n * Makes the shape selectable\n * @return {Shape} The current shape\n */\n selectable() {\n this.setProp('selectable', true);\n }\n\n /**\n * Makes the shape non-selectable\n * @return {Shape} The current shape\n */\n unselectable() {\n this.graph.unselectShape(this);\n this.setProp('selectable', false);\n }\n\n /**\n * @return {Boolean} True if the shape is selectable, false otherwise\n */\n isSelectable() {\n return this.getProp('selectable');\n }\n\n /**\n * Highlights the shape with attributes\n * @returns {Shape} The current shape\n * @param {Object} [ attributes ] - A hashmap of attributes to apply. If omitted, {@link Shape#getHighlightAttributes} will be called\n * @param {String} [ saveDomName=highlight ] - The name to which the current shape attributes will be saved to be recovered later with the {@link Shape#unHighlight} method\n * @example shape.highlight( { fill: 'red', 'fill-opacity': 0.5 } );\n * @see Shape#unHighlight\n */\n highlight(attributes, saveDomName) {\n\n if (!attributes) {\n attributes = this.getHighlightAttributes();\n }\n\n if (!saveDomName) {\n saveDomName = 'highlight';\n }\n\n saveDomAttributes(this._dom, attributes, saveDomName);\n this.highlightImpl();\n return this;\n }\n\n /**\n * Removes the highlight properties from the same\n * @returns {Shape} The current shape\n * @param {String} [ saveDomName=highlight ] - The name to which the current shape attributes will be saved to be recovered later with the {@link Shape#unHighlight} method\n * @see Shape#highlight\n */\n unHighlight(saveDomName) {\n\n if (!saveDomName) {\n saveDomName = 'highlight';\n }\n\n restoreDomAttributes(this._dom, saveDomName);\n this.unHighlightImpl();\n return this;\n }\n\n highlightImpl() {}\n unHighlightImpl() {}\n\n /**\n * @returns {Object} The attributes taken by the shape when highlighted\n * @see Shape#highlight\n */\n getHighlightAttributes() {\n return this._highlightAttributes;\n }\n\n /**\n * Sets the attributes the shape will take when highlighted\n * @param {Object} [ attributes ] - A hashmap of attributes to apply when the shape is highlighted\n * @returns {Shape} The current shape\n * @see Shape#highlight\n */\n setHighlightAttributes(attributes) {\n this._highlightAttributes = attributes;\n return this;\n }\n\n /**\n * Returns the masking id of the shape. Returns null if the shape does not behave as a mask\n * @returns {String} The ```id``` attribute of the shape\n */\n getMaskingID() {\n return this.maskingId;\n }\n\n /**\n * Masks the current shape with another shape passed as the first parameter of the method\n * @param {Shape} maskingShape - The shape used to mask the current shape\n * @return {Shape} The current shape\n */\n maskWith(maskingShape) {\n\n const maskingId = maskingShape.getMaskingID();\n\n if (maskingId) {\n\n this._dom.setAttribute('mask', 'url(#' + maskingId + ')');\n } else {\n\n this._dom.removeAttribute('mask');\n }\n }\n\n /**\n * Manually updates the mask of the shape. This is needed because the shape needs to be surrounded by a white rectangle (because transparent is treated as black and will not render the shape)\n * This method will work well for rectangles but should be overridden for other shapes\n * @return {Shape} The current shape\n * @todo Explore a way to make it compatible for all kinds of shapes. Maybe the masker position should span the whole graph...\n */\n updateMask() {\n return;\n if (!this.maskDom) {\n return; // eslint-disable-line no-useless-return\n }\n\n var position = {\n x: 'min',\n y: 'min'\n };\n var position2 = {\n x: 'max',\n y: 'max'\n };\n\n position = this._getPosition(position);\n position2 = this._getPosition(position2);\n\n this.maskDomWrapper.setAttribute('x', Math.min(position.x, position2.x));\n this.maskDomWrapper.setAttribute('y', Math.min(position.y, position2.y));\n\n this.maskDomWrapper.setAttribute('width', Math.abs(position2.x - position.x));\n this.maskDomWrapper.setAttribute('height', Math.abs(position2.y - position.y));\n\n for (var i = 0; i < this._dom.attributes.length; i++) {\n this.maskDom.setAttribute(this._dom.attributes[i].name, this._dom.attributes[i].value);\n }\n\n this.maskDom.setAttribute('fill', 'black');\n\n return this;\n }\n\n labelDblClickListener(e) {\n\n var i = parseInt(e.target.getAttribute('data-label-i'));\n\n var self = this;\n\n if (isNaN(i)) {\n return;\n }\n\n if (!this.isLabelEditable(i)) {\n return;\n }\n\n e.preventDefault();\n e.stopPropagation();\n\n var shapeLabel = document.createElement('input');\n shapeLabel.setAttribute('type', 'text');\n shapeLabel.setAttribute('value', self.getProp('labelText', i));\n\n self.graph.wrapper.prepend(shapeLabel);\n shapeLabel.select();\n\n setCSS(shapeLabel, {\n position: 'absolute',\n marginTop: parseInt(e.target.getAttribute('y').replace('px', '')) + this.graph.getPaddingTop() - 10 + 'px',\n marginLeft: parseInt(e.target.getAttribute('x').replace('px', '')) + this.graph.getPaddingLeft() - 50 + 'px',\n textAlign: 'center',\n width: '100px'\n });\n\n const previousValue = self.getLabelText(i);\n\n const blurEvent = function () {\n\n self.setLabelText(shapeLabel.value, i);\n self._labels[i].textContent = shapeLabel.value;\n\n const nextValue = shapeLabel.value;\n\n shapeLabel.remove();\n shapeLabel.removeEventListener('blur', blurEvent);\n shapeLabel = false;\n\n self.changed('shapeLabelChanged', {\n previousValue: previousValue,\n nextValue: nextValue\n });\n };\n\n shapeLabel.addEventListener('blur', blurEvent);\n\n shapeLabel.addEventListener('keyup', function (e) {\n\n if (e.keyCode === 13) {\n blurEvent();\n }\n });\n shapeLabel.addEventListener('keypress', function (e) {\n e.stopPropagation();\n });\n shapeLabel.addEventListener('keydown', function (e) {\n e.stopPropagation();\n });\n shapeLabel.focus();\n }\n\n /**\n * Appends the shape DOM to its parent\n * @private\n * @return {Shape} The current shape\n */\n appendToDom() {\n\n if (this._forcedParentDom) {\n\n this._forcedParentDom.appendChild(this.group);\n } else {\n this.graph.appendShapeToDom(this);\n }\n return this;\n }\n\n /**\n * Forces the DOM parent (instead of the normal layer)\n * @return {Shape} The current shape\n */\n forceParentDom(dom) {\n\n this._forcedParentDom = dom;\n\n return this;\n }\n\n isHTML() {\n return false;\n }\n}\n\n/**\n * @alias Shape#calculatePosition\n */\nShape.prototype.computePosition = Shape.prototype.calculatePosition;\n\n/**\n * @alias Shape#displayLabel\n */\nShape.prototype.showLabel = Shape.prototype.displayLabel;\n\n/**\n * @alias Shape#kill\n */\nShape.prototype.remove = Shape.prototype.kill;\n\n/**\n * Displays a surface under a line serie\n * @extends GraphShape\n */\nclass ShapeSurfaceUnderCurve extends Shape {\n\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'path');\n }\n\n createHandles() {\n\n this._createHandles(2, 'line', {\n 'stroke-width': '3',\n 'stroke': 'transparent',\n 'pointer-events': 'stroke',\n 'cursor': 'ew-resize'\n });\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY) {\n\n if (this.isLocked()) {\n return;\n }\n\n if (this.moving) {\n\n this.getPosition(0).deltaPosition('x', deltaX, this.getXAxis());\n this.getPosition(1).deltaPosition('x', deltaX, this.getXAxis());\n } else if (this.serie && this.handleSelected) {\n\n this.resizingPosition = this.handleSelected == 1 ? this.getPosition(0) : this.getPosition(1);\n\n var value = this.serie.searchClosestValue(this.getXAxis().getVal(this.graph._getXY(e).x - this.graph.getPaddingLeft()));\n\n if (!value) {\n return;\n }\n\n if (this.resizingPosition.x != value.xMin) {\n this.preventUnselect = true;\n }\n\n this.resizingPosition.x = value.xMin;\n } else if (this.handleSelected) {\n\n this.resizingPosition = this.handleSelected == 1 ? this.getPosition(0) : this.getPosition(1);\n this.resizingPosition.deltaPosition('x', deltaX, this.getXAxis());\n }\n\n this.applyPosition();\n }\n /*\n redrawImpl: function() {\n //var doDraw = this.setPosition();\n //\tthis.setDom('fill', 'url(#' + 'patternFill' + this.graph._creation + ')')\n if ( this.position != this.doDraw ) {\n this.group.setAttribute( \"visibility\", this.position ? \"visible\" : 'hidden' );\n this.doDraw = this.position;\n }\n },\n */\n applyPosition() {\n\n if (!this.serie) {\n return;\n }\n\n var posXY = this.computePosition(0),\n posXY2 = this.computePosition(1),\n w = Math.abs(posXY.x - posXY2.x),\n x = Math.min(posXY.x, posXY2.x);\n\n // this.reversed = x == posXY2.x;\n\n if (w < 2 || x + w < 0 || x > this.graph.getDrawingWidth()) {\n this.setDom('d', '');\n return false;\n }\n\n var v1 = this.serie.searchClosestValue(this.getPosition(0).x),\n v2 = this.serie.searchClosestValue(this.getPosition(1).x),\n v3,\n i,\n j,\n init,\n max,\n k,\n x,\n y,\n firstX,\n firstY,\n currentLine,\n maxY = 0,\n minY = Number.MAX_VALUE;\n\n if (!v1 || !v2) {\n return false;\n }\n\n if (v1.xBeforeIndex > v2.xBeforeIndex) {\n v3 = v1;\n v1 = v2;\n v2 = v3;\n\n //this.handleSelected = ( this.handleSelected == 1 ) ? 2 : 1;\n }\n\n this.counter = 0;\n\n for (i = v1.dataIndex; i <= v2.dataIndex; i++) {\n this.currentLine = '';\n init = i == v1.dataIndex ? v1.xBeforeIndexArr : 0;\n max = i == v2.dataIndex ? v2.xBeforeIndexArr : this.serie.data[i].length;\n k = 0;\n\n if (init == max) {\n max++;\n }\n\n for (j = init; j <= max; j += 2) {\n\n x = this.serie.getX(this.serie.data[i][j + 0]);\n y = this.serie.getY(this.serie.data[i][j + 1]);\n\n maxY = Math.max(this.serie.data[i][j + 1], maxY);\n minY = Math.min(this.serie.data[i][j + 1], minY);\n\n if (j == init) {\n this.firstX = x;\n this.firstY = y;\n }\n\n if (k > 0) {\n this.currentLine += ' L ' + x + ' ' + y + ' ';\n } else {\n this.currentLine += ' M ' + x + ' ' + y + ' ';\n }\n\n //this.serie._addPoint( x, y, false, this.currentLine );\n k++;\n }\n\n this.lastX = x;\n this.lastY = y;\n\n if (!this.firstX || !this.firstY || !this.lastX || !this.lastY) {\n return;\n }\n\n this.currentLine += ' V ' + this.getYAxis().getPx(0) + ' H ' + this.firstX + ' z';\n this.setDom('d', this.currentLine);\n }\n\n this.maxY = this.serie.getY(maxY);\n this.setHandles();\n\n this.changed();\n\n return true;\n }\n\n setHandles() {\n\n if (!this.firstX) {\n return;\n }\n\n var posXY = this.computePosition(0),\n posXY2 = this.computePosition(1);\n\n if (posXY.x < posXY2.x) {\n\n this.handles[1].setAttribute('x1', this.firstX);\n this.handles[1].setAttribute('x2', this.firstX);\n\n this.handles[2].setAttribute('x1', this.lastX);\n this.handles[2].setAttribute('x2', this.lastX);\n } else {\n\n this.handles[1].setAttribute('x1', this.lastX);\n this.handles[1].setAttribute('x2', this.lastX);\n\n this.handles[2].setAttribute('x1', this.firstX);\n this.handles[2].setAttribute('x2', this.firstX);\n }\n this.handles[1].setAttribute('y1', this.getYAxis().getMaxPx());\n this.handles[1].setAttribute('y2', this.serie.getY(0));\n\n this.handles[2].setAttribute('y1', this.getYAxis().getMaxPx());\n this.handles[2].setAttribute('y2', this.serie.getY(0));\n }\n}\n\n/**\n * Represents a line\n * @extends Shape\n * @see Graph#newShape\n */\nclass ShapeLine extends Shape {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'line');\n\n if (!this.getStrokeColor()) {\n this.setStrokeColor('black');\n }\n\n if (!this.getStrokeWidth()) {\n this.setStrokeWidth(1);\n }\n }\n\n /**\n * Creates the handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {\n\n this._createHandles(2, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n var position = this.calculatePosition(0);\n var position2 = this.calculatePosition(1);\n\n if (!position || !position.x || !position.y) {\n return;\n }\n\n this.setDom('x2', position.x);\n this.setDom('y2', position.y);\n\n this.setDom('y1', position2.y);\n this.setDom('x1', position2.x);\n\n this.currentPos2x = position2.x;\n this.currentPos2y = position2.y;\n\n this.currentPos1x = position.x;\n this.currentPos1y = position.y;\n\n return true;\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n if (this.isLocked()) {\n return;\n }\n\n var pos = this.getPosition(0);\n var pos2 = this.getPosition(1);\n\n var posToChange;\n if (this.handleSelected == 1) {\n\n posToChange = pos;\n } else if (this.handleSelected == 2) {\n\n posToChange = pos2;\n }\n\n if (posToChange) {\n\n if (!this._data.vertical) {\n posToChange.deltaPosition('x', deltaX, this.getXAxis());\n }\n\n if (!this._data.horizontal) {\n posToChange.deltaPosition('y', deltaY, this.getYAxis());\n }\n }\n\n if (this.moving) {\n console.log(this._data);\n // If the pos2 is defined by a delta, no need to move them\n if (pos.x && !this._data.noX) {\n pos.deltaPosition('x', deltaX, this.getXAxis());\n }\n if (pos.y && !this._data.noY) {\n pos.deltaPosition('y', deltaY, this.getYAxis());\n }\n\n // If the pos2 is defined by a delta, no need to move them\n if (pos2.x && !this._data.noX) {\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n }\n if (pos2.y && !this._data.noY) {\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n }\n }\n\n if (this._data.forcedCoords) {\n\n var forced = this._data.forcedCoords;\n\n if (forced.y !== undefined) {\n\n if (typeof forced.y == 'function') {\n pos2.y = pos.y = forced.y(this);\n } else {\n pos2.y = forced.y;\n pos.y = forced.y;\n }\n }\n\n if (forced.x !== undefined) {\n\n if (typeof forced.x == 'function') {\n pos2.x = pos.x = forced.x(this);\n } else {\n pos2.x = forced.x;\n pos.x = forced.x;\n }\n }\n }\n\n if (this.rectEvent) {\n this.setEventReceptacle();\n }\n\n this.redraw();\n this.changed();\n this.setHandles();\n\n return true;\n }\n\n /**\n * Sets the handle position\n * @private\n */\n setHandles() {\n\n if (!this.areHandlesInDom()) {\n return;\n }\n\n if (isNaN(this.currentPos1x)) {\n return;\n }\n\n this.handles[1].setAttribute('x', this.currentPos1x);\n this.handles[1].setAttribute('y', this.currentPos1y);\n\n this.handles[2].setAttribute('x', this.currentPos2x);\n this.handles[2].setAttribute('y', this.currentPos2y);\n }\n\n /**\n * Creates an line receptacle with the coordinates of the line, but continuous and thicker\n * @return {Shape} The current shape\n */\n setEventReceptacle() {\n\n if (!this.currentPos1x) {\n return;\n }\n\n if (!this.rectEvent) {\n this.rectEvent = document.createElementNS(this.graph.ns, 'line');\n this.rectEvent.setAttribute('pointer-events', 'stroke');\n this.rectEvent.setAttribute('stroke', 'transparent');\n this.rectEvent.jsGraphIsShape = this;\n this.group.appendChild(this.rectEvent);\n }\n\n this.rectEvent.setAttribute('x1', this.currentPos1x);\n this.rectEvent.setAttribute('y1', this.currentPos1y);\n this.rectEvent.setAttribute('x2', this.currentPos2x);\n this.rectEvent.setAttribute('y2', this.currentPos2y);\n this.rectEvent.setAttribute('stroke-width', this.getProp('strokeWidth') + 2);\n }\n}\n\n/**\n * Displays an arrow\n * @extends GraphShapeLine\n */\nclass ShapeArrow extends ShapeLine {\n\n constructor(graph) {\n\n super(graph);\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'line');\n this._dom.setAttribute('marker-end', 'url(#arrow' + this.graph._creation + ')');\n\n this.createHandles(this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n\n this.setStrokeColor('black');\n this.setStrokeWidth(1);\n }\n}\n\n/**\n * Displays an ellipse\n * @extends Shape\n */\nclass ShapeEllipse extends Shape {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'ellipse');\n }\n\n applyPosition() {\n\n var pos = this.computePosition(0);\n\n this.setDom('cx', pos.x || 0);\n this.setDom('cy', pos.y || 0);\n\n let posR = this.graph.newPosition({\n\n dx: this.getProp('rx'),\n dy: this.getProp('ry') || this.getProp('rx')\n\n });\n\n let posComputed = this.calculatePosition(posR);\n\n this.setDom('rx', Math.abs(posComputed.x) || 0);\n this.setDom('ry', Math.abs(posComputed.y) || 0);\n return true;\n }\n\n setR(rx, ry) {\n this.setProp('rx', rx);\n this.setProp('ry', ry);\n return this;\n }\n\n handleMouseUpImpl() {\n this.triggerChange();\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {}\n}\n\n/**\n * Blank shape used to display label\n * Use myShapelabel.setLabelText(); and associated methods\n * @extend GraphShape\n */\nclass ShapeLabel extends Shape {\n\n constructor(graph, options) {\n\n super(graph, options);\n }\n\n createDom() {\n return false;\n }\n\n applyPosition() {\n return true;\n }\n}\n\n/**\n * Represents a line that extends the Shape class. Used by the plugin {@link PluginSerieLineDifference}\n * @extends Shape\n * @see Graph#newShape\n */\nclass ShapePolyline extends Shape {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'path');\n\n if (!this.getStrokeColor()) {\n this.setStrokeColor('black');\n }\n\n if (this.getStrokeWidth() == undefined) {\n this.setStrokeWidth(1);\n }\n }\n\n /**\n * No handles for the polyline\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {}\n\n /**\n * Force the points of the polyline already computed in pixels\n * @param {String} a SVG string to be used in the ```d``` attribute of the path.\n * @return {ShapePolyline} The current polyline instance\n */\n setPointsPx(points) {\n this.setProp('pxPoints', points);\n return this;\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n let pxPoints;\n let pos = this.computePosition(0);\n\n if (pxPoints = this.getProp('pxPoints')) {\n\n pxPoints = ' M ' + pos.x + ' ' + pos.y + ' ' + pxPoints;\n this.setDom('d', pxPoints);\n } else if (this.points) {\n\n var xAxis, yAxis;\n\n if (this.serie) {\n\n xAxis = this.serie.getXAxis();\n yAxis = this.serie.getYAxis();\n } else if (this.xAxis && this.yAxis) {\n\n xAxis = this.xAxis;\n yAxis = this.yAxis;\n }\n\n this.setDom('d', 'M ' + this.points.map(function (p) {\n return xAxis.getPx(p[0]) + ', ' + yAxis.getPx(p[1]);\n }).join(' L '));\n }\n\n this.changed();\n return true;\n }\n}\n\n/**\n * Displays an integral with NMR style\n * @extends ShapeSurfaceUnderCurve\n */\nclass ShapeNMRIntegral extends Shape {\n\n constructor(graph, options) {\n\n super(graph, options);\n\n this.nbHandles = 2;\n }\n\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'path');\n this._domShadow = document.createElementNS(this.graph.ns, 'path');\n this._domShadow.jsGraphIsShape = this;\n this._dom.setAttribute('pointer-events', 'stroke');\n this._domShadow.setAttribute('pointer-events', 'stroke');\n this._domShadow.setAttribute('stroke-width', '12');\n this._domShadow.setAttribute('fill', 'transparent');\n this._domShadow.setAttribute('stroke', 'transparent');\n this.group.appendChild(this._domShadow);\n }\n\n initImpl() {\n this.setFillColor('transparent');\n this.setStrokeColor('black');\n }\n\n createHandles() {\n\n this._createHandles(2, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white'\n });\n\n this.handles[1].setAttribute('fill', 'red');\n }\n\n xor(a, b) {\n return a && !b || !a && b;\n }\n\n applyPosition() {\n\n let x,\n y,\n xVal,\n yVal,\n axis = this.getAxis(),\n points = [];\n\n let currentLine = '',\n baseLine = this.getProp('baseLine', 0) || 300,\n ratio;\n\n if (!this.serie) {\n throw 'No serie exists for this shape';\n }\n /*\n this.sortPositions( ( a, b ) => {\n return a.x - b.x;\n } );\n */\n let pos1 = this.getPosition(0);\n let pos2 = this.getPosition(1);\n\n if (pos1.x < this.serie.getXAxis().getCurrentMin() && pos2.x < this.serie.getXAxis().getCurrentMin() || pos1.x > this.serie.getXAxis().getCurrentMax() && pos2.x > this.serie.getXAxis().getCurrentMax()) {\n this.setDom('d', '');\n this._domShadow.setAttribute('d', '');\n\n this.hideLabel(0);\n return false;\n }\n\n this.showLabel(0);\n\n let sum = 0;\n\n let j;\n let waveform = this.serie.getWaveform();\n\n if (!waveform) {\n return;\n }\n\n let index1 = waveform.getIndexFromX(pos1[axis], true, Math.floor),\n index2 = waveform.getIndexFromX(pos2[axis], true, Math.ceil),\n index3,\n flipped = false;\n\n if (index1 == index2) {\n // At least one px please !\n if (waveform.getReductionType() == 'aggregate') {\n index2 += 4; // Aggregated state\n } else {\n index2++; // Non aggregated state\n }\n }\n\n if (index2 < index1) {\n index3 = index1;\n index1 = index2;\n index2 = index3;\n flipped = true;\n }\n\n let firstX, firstY, firstXVal, firstYVal, lastX, lastXVal, lastY, lastYVal;\n let data = waveform.getDataInUse();\n\n let condition, incrementation;\n\n if (waveform.getReductionType() == 'aggregate') {\n \n }\n\n if (waveform.getXMonotoneousAscending() && // Ascending\n 1 == 1 || !waveform.getXMonotoneousAscending() && // Ascending\n 1 == 2) {\n\n j = index2;\n condition = true;\n incrementation = -1;\n } else {\n\n j = index1;\n condition = false;\n incrementation = 1;\n }\n\n for (; condition ? j >= index1 : j <= index2; j += incrementation) {\n\n xVal = waveform.getX(j, true);\n yVal = waveform.getY(j, true);\n\n x = this.serie.getX(xVal);\n y = this.serie.getY(yVal);\n\n /*\n if ( ! normalSums && j % 4 == 0 && j >= index1 && data.sums ) { // Sums are located every 4 element\n sum += data.sums[ j ];// * ( waveform.getX( j, true ) - waveform.getX( j - 3, true ) ); // y * (out-in)\n } else if( normalSums ) {\n */\n sum += waveform.getY(j, true); // * ( waveform.getX( j, true ) - waveform.getX( j - 1, true ) ); // y * (out-in)\n //}\n\n if (!firstX) {\n\n firstX = x;\n firstY = y;\n firstXVal = waveform.getX(j);\n firstYVal = waveform.getY(j);\n }\n\n if (lastX == undefined) {\n\n lastX = x;\n lastXVal = waveform.getX(j);\n lastYVal = waveform.getY(j);\n continue;\n }\n\n lastX = x;\n points.push([x, y, sum]);\n lastXVal = xVal;\n }\n\n lastXVal = false;\n lastYVal = false;\n lastX = false;\n if (sum == 0) {\n sum = 1;\n }\n\n this._sumVal = waveform.integrate(pos1.x, pos2.x);\n\n if (!this.ratio) {\n // 150px / unit\n ratio = 200 / sum;\n } else {\n // Already existing\n ratio = this.ratio * (this.sumVal / sum);\n }\n let py;\n\n if (points.length == 0) {\n return;\n }\n\n for (var i = 0, l = points.length; i < l; i++) {\n\n py = baseLine - points[i][2] * ratio;\n\n if (i > 0 && (points[i - 1][2] > sum / 2 && points[i][2] <= sum / 2 || points[i - 1][2] < sum / 2 && points[i][2] >= sum / 2)) {\n\n let pos = baseLine - (points[i - 1][2] + points[i][2]) / 2 * ratio;\n\n this.setPosition({\n x: points[i][0] + 'px',\n y: pos + 'px'\n\n }, 3);\n\n this.setLabelPosition(this.getPosition(3), 0);\n }\n\n currentLine += ' L ' + points[i][0] + ', ' + py + ' ';\n\n this.lastPointX = points[i][0];\n this.lastPointY = py;\n }\n\n this.points = points;\n this._sum = sum;\n\n if (this.serie.isFlipped()) {\n currentLine = ' M ' + baseLine + ', ' + firstX + ' ' + currentLine;\n } else {\n currentLine = ' M ' + firstX + ', ' + baseLine + ' ' + currentLine;\n }\n\n this.firstPointX = firstX;\n this.firstPointY = baseLine;\n\n this.setDom('d', currentLine);\n this._domShadow.setAttribute('d', currentLine);\n\n this.firstX = firstX;\n this.firstY = firstY;\n /*\n if ( this._selected ) {\n this.select();\n }\n this.setHandles();*/\n\n this.serie.ratioLabel && this.updateIntegralValue(this.serie.ratioLabel) || this.updateLabels();\n\n this.changed();\n this.handleCondition = !this.xor(incrementation == -1, flipped);\n this.setHandles();\n\n this.updateIntegralValue();\n\n return true;\n }\n\n updateIntegralValue(ratioLabel = this.serie.ratioLabel, forceValue) {\n console.log(ratioLabel);\n if (ratioLabel) {\n this.serie.ratioLabel = ratioLabel;\n }\n\n if (!isNaN(forceValue) && !isNaN(this.sumVal) && this.sumVal) {\n this.serie.ratioLabel = forceValue / this.sumVal;\n }\n\n this.setLabelText(ratioLabel ? (Math.round(100 * this.sumVal * ratioLabel) / 100).toPrecision(3) : 'N/A', 0);\n this.updateLabels();\n return this.serie.ratioLabel;\n }\n\n getAxis() {\n return this._data.axis || 'x';\n }\n\n /**\n * User to screen coordinate transform. In (unit)/(px), (unit) being the unit of the integral (x * y)\n * @type {Number}\n */\n set ratio(r) {\n this._ratio = r;\n }\n\n get ratio() {\n return this._ratio;\n }\n\n get sum() {\n return this._sum;\n }\n\n get sumVal() {\n return this._sumVal;\n }\n\n selectStyle() {\n this.setDom('stroke-width', '2px');\n }\n\n selectHandles() {} // Cancel areaundercurve\n\n setHandles() {\n\n if (this.points == undefined) {\n return;\n }\n\n if (!this.isSelected()) {\n return;\n }\n\n this.addHandles();\n\n if (this.handleCondition) {\n\n this.handles[1].setAttribute('x', this.firstPointX);\n this.handles[1].setAttribute('y', this.firstPointY);\n this.handles[2].setAttribute('x', this.lastPointX);\n this.handles[2].setAttribute('y', this.lastPointY);\n } else {\n\n this.handles[2].setAttribute('x', this.firstPointX);\n this.handles[2].setAttribute('y', this.firstPointY);\n this.handles[1].setAttribute('x', this.lastPointX);\n this.handles[1].setAttribute('y', this.lastPointY);\n }\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n if (this.isLocked()) {\n return;\n }\n\n var pos = this.getPosition(0);\n var pos2 = this.getPosition(1);\n\n var posToChange;\n\n if (this.handleSelected == 1) {\n\n posToChange = pos;\n } else if (this.handleSelected == 2) {\n\n posToChange = pos2;\n }\n\n if (posToChange) {\n\n if (!this._data.vertical) {\n posToChange.deltaPosition('x', deltaX, this.getXAxis());\n }\n }\n\n if (this.moving) {\n\n // If the pos2 is defined by a delta, no need to move them\n if (pos.x) {\n pos.deltaPosition('x', deltaX, this.getXAxis());\n }\n\n // If the pos2 is defined by a delta, no need to move them\n if (pos2.x) {\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n }\n }\n\n if (this.rectEvent) {\n this.setEventReceptacle();\n }\n\n this.redraw();\n this.changed();\n\n return true;\n }\n}\n\n/**\n * Represents a rectangle that extends the Shape class\n * @class ShapeRectangle\n * @augments Shape\n * @see Graph#newShape\n */\nclass ShapeRectangle extends Shape {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n this._dom = document.createElementNS(this.graph.ns, 'rect');\n\n if (!this.getStrokeColor()) {\n this.setStrokeColor('black');\n }\n\n if (!this.getStrokeWidth()) {\n this.setStrokeWidth(1);\n }\n\n if (!this.getFillColor()) {\n this.setFillColor('transparent');\n }\n\n return this;\n }\n\n /**\n * Creates the Handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {\n if (!this.hasHandles()) {\n return;\n }\n\n /*\n this._data.handles = this._data.handles || {\n type: 'corners'\n };\n */\n\n var handles = this.getProp('handles');\n\n if (typeof handles != 'object') {\n handles = {};\n }\n\n if (!handles.type) {\n handles.type = 'corners';\n }\n\n switch (handles.type) {\n\n case 'sides':\n\n extend$1(handles, {\n sides: {\n top: true,\n bottom: true,\n left: true,\n right: true\n }\n });\n\n var j = 0;\n for (var i in handles.sides) {\n if (handles.sides[i]) {\n j++;\n }\n }\n\n this._createHandles(j, 'g').map(function (g) {\n\n var r = document.createElementNS(self.graph.ns, 'rect');\n r.setAttribute('x', '-3');\n r.setAttribute('width', '6');\n r.setAttribute('y', '-6');\n r.setAttribute('height', '12');\n r.setAttribute('stroke', 'black');\n r.setAttribute('fill', 'white');\n r.setAttribute('cursor', 'pointer');\n\n g.appendChild(r);\n });\n\n var j = 1;\n\n for (var i in handles.sides) {\n if (handles.sides[i]) {\n this.handles[i] = this['handle' + j];\n this.sides[j] = i;\n j++;\n }\n }\n\n break;\n\n case 'corners':\n this._createHandles(4, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white'\n });\n\n if (this.handles) {\n this.handles[2].setAttribute('cursor', 'nesw-resize');\n this.handles[4].setAttribute('cursor', 'nesw-resize');\n\n this.handles[1].setAttribute('cursor', 'nwse-resize');\n this.handles[3].setAttribute('cursor', 'nwse-resize');\n }\n\n break;\n\n case 'seamlessX':\n\n this._createHandles(2, 'rect', {\n transform: 'translate(-3 -3)',\n stroke: 'transparent',\n fill: 'transparent',\n width: '20px',\n cursor: 'ew-resize'\n });\n\n break;\n }\n\n super.createHandles();\n\n return this;\n }\n\n /**\n * Updates the position\n * @memberof ShapeRectangle\n * @private\n * @return {Shape} The current shape\n */\n applyPosition() {\n\n var pos = this.computePosition(0),\n pos2 = this.computePosition(1),\n x,\n y,\n width,\n height;\n\n if (pos.x < pos2.x) {\n x = pos.x;\n width = pos2.x - pos.x;\n } else {\n x = pos2.x;\n width = pos.x - pos2.x;\n }\n\n if (pos.y < pos2.y) {\n y = pos.y;\n height = pos2.y - pos.y;\n } else {\n y = pos2.y;\n height = pos.y - pos2.y;\n }\n\n this.currentX = x;\n this.currentY = y;\n this.currentW = width;\n this.currentH = height;\n\n if (!isNaN(x) && !isNaN(y) && x !== false && y !== false) {\n\n this.setDom('width', width);\n this.setDom('height', height);\n this.setDom('x', x);\n this.setDom('y', y);\n\n this.setHandles();\n this.updateMask();\n\n return true;\n }\n\n return false;\n }\n\n /**\n * Implements mouse move event\n * @private\n * @return {Shape} The current shape\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n var handles = this.getProp('handles');\n\n if (!this.moving && !this.handleSelected) {\n return;\n }\n\n var pos = this.getPosition(0);\n var pos2 = this.getPosition(1);\n\n var invX = this.getXAxis().isFlipped(),\n invY = this.getYAxis().isFlipped(),\n posX = pos.x,\n posY = pos.y,\n pos2X = pos2.x,\n pos2Y = pos2.y;\n\n if (this.moving) {\n\n pos.deltaPosition('x', deltaX, this.getXAxis());\n pos.deltaPosition('y', deltaY, this.getYAxis());\n\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n } else {\n\n switch (handles.type) {\n\n case 'seamlessX':\n // Do nothing for now\n\n switch (this.handleSelected) {\n\n case 1:\n pos.deltaPosition('x', deltaX, this.getXAxis());\n break;\n\n case 2:\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n break;\n }\n\n break;\n\n case 'sides':\n // Do nothing for now\n\n switch (this.sides[this.handleSelected]) {\n\n case 'left':\n pos.deltaPosition('x', deltaX, this.getXAxis());\n break;\n\n case 'right':\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n break;\n\n case 'top':\n pos.deltaPosition('y', deltaY, this.getYAxis());\n break;\n\n case 'bottom':\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n break;\n\n }\n\n break;\n\n case 'corners':\n default:\n\n if (this.handleSelected == 1) {\n\n pos.deltaPosition('x', deltaX, this.getXAxis());\n pos.deltaPosition('y', deltaY, this.getYAxis());\n } else if (this.handleSelected == 2) {\n\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n pos.deltaPosition('y', deltaY, this.getYAxis());\n } else if (this.handleSelected == 3) {\n\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n pos2.deltaPosition('x', deltaX, this.getXAxis());\n } else if (this.handleSelected == 4) {\n\n pos.deltaPosition('x', deltaX, this.getXAxis());\n pos2.deltaPosition('y', deltaY, this.getYAxis());\n }\n\n break;\n\n }\n }\n\n this.redraw();\n this.changed();\n this.setHandles();\n\n return true;\n }\n\n /**\n * Places handles properly\n * @private\n * @return {Shape} The current shape\n */\n setHandles() {\n\n if (this.isLocked() || !this.isSelectable() && !this._staticHandles) {\n return;\n }\n\n if (!this.handlesInDom) {\n return;\n }\n\n var pos = this.computePosition(0);\n var pos2 = this.computePosition(1);\n\n var handles = this.getProp('handles');\n\n switch (handles.type) {\n\n case 'seamlessX':\n\n if (this.handles[1]) {\n this.handles[1].setAttribute('transform', 'translate(-10) translate(' + pos.x + ')');\n this.handles[1].setAttribute('height', Math.abs(pos2.y - pos.y));\n this.handles[1].setAttribute('y', Math.min(pos2.y, pos.y));\n }\n\n if (this.handles[2]) {\n this.handles[2].setAttribute('transform', 'translate(-10) translate(' + pos2.x + ')');\n this.handles[2].setAttribute('height', Math.abs(pos2.y - pos.y));\n this.handles[2].setAttribute('y', Math.min(pos2.y, pos.y));\n }\n\n break;\n\n case 'sides':\n\n if (this.handles.left) {\n this.handles.left.setAttribute('transform', 'translate(' + this.currentX + ' ' + (this.currentY + this.currentH / 2) + ')');\n }\n\n if (this.handles.right) {\n this.handles.right.setAttribute('transform', 'translate( ' + (this.currentX + this.currentW) + ' ' + (this.currentY + this.currentH / 2) + ')');\n }\n\n if (this.handles.top) {\n this.handles.top.setAttribute('transform', 'translate( ' + (this.currentX + this.currentW / 2) + ' ' + this.currentY + ')');\n }\n\n if (this.handles.bottom) {\n this.handles.bottom.setAttribute('transform', 'translate( ' + (this.currentX + this.currentW / 2) + ' ' + (this.currentY + this.currentH) + ')');\n }\n\n break;\n\n case 'corners':\n default:\n\n this.handles[1].setAttribute('x', pos.x);\n this.handles[1].setAttribute('y', pos.y);\n\n this.handles[2].setAttribute('x', pos2.x);\n this.handles[2].setAttribute('y', pos.y);\n\n this.handles[3].setAttribute('x', pos2.x);\n this.handles[3].setAttribute('y', pos2.y);\n\n this.handles[4].setAttribute('x', pos.x);\n this.handles[4].setAttribute('y', pos2.y);\n\n break;\n\n }\n }\n\n}\n\nclass ShapePeakIntegration2D extends ShapeRectangle {\n\n constructor(graph, options) {\n\n super(graph, options);\n this.nbHandles = 4;\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'rect');\n this._dom.element = this;\n\n this.createHandles(this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n\n redrawImpl() {\n\n this.setPosition();\n this.setHandles();\n this.setBindableToDom(this._dom);\n }\n\n}\n\n/**\n * Displays a cross\n * @extends Shape\n */\nclass ShapeCross extends Shape {\n\n constructor(graph, options) {\n super(graph, options);\n this.nbHandles = 1;\n }\n\n /**\n * Width of the cross, also available from the constructor\n * @type {Number} width\n */\n get width() {\n return this.options.width || 10;\n }\n\n set width(l) {\n this.options.width = l;\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'path');\n this._dom.setAttribute('d', 'M -' + this.width / 2 + ' 0 h ' + this.width + ' m -' + this.width / 2 + ' -' + this.width / 2 + ' v ' + this.width + '');\n }\n\n createHandles() {\n\n this._createHandles(this.nbHandles, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n applyPosition() {\n\n var position = this.calculatePosition(0);\n if (!position || !position.x || !position.y) {\n return;\n }\n\n this.setDom('transform', 'translate( ' + position.x + ', ' + position.y + ')');\n\n this.currentPos1x = position.x;\n this.currentPos1y = position.y;\n\n return true;\n }\n\n redrawImpl() {\n\n this.setHandles();\n }\n\n handleCreateImpl() {}\n\n handleMouseDownImpl(e) {\n\n this.moving = true;\n\n return true;\n }\n\n handleMouseUpImpl() {\n\n this.triggerChange();\n return true;\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n if (this.isLocked()) {\n return;\n }\n\n var pos = this.getFromData('pos');\n\n if (this.moving) {\n\n pos.x = this.graph.deltaPosition(pos.x, deltaX, this.getXAxis());\n pos.y = this.graph.deltaPosition(pos.y, deltaY, this.getYAxis());\n }\n\n this.redrawImpl();\n\n return true;\n }\n\n setHandles() {\n\n if (!this.areHandlesInDom()) {\n return;\n }\n\n if (isNaN(this.currentPos1x)) {\n return;\n }\n\n this.handles[1].setAttribute('x', this.currentPos1x);\n this.handles[1].setAttribute('y', this.currentPos1y);\n }\n\n selectStyle() {\n this.setDom('stroke', 'red');\n this.setDom('stroke-width', '2');\n }\n}\n\n/**\n * Shows a horizontal line with three little vertical bars. Very useful to demonstrate a peak start, end and middle value\n * @extends ShapeLine\n */\nclass ShapePeakBoundaries extends ShapeLine {\n\n constructor(graph) {\n super(graph);\n this.lineHeight = 6;\n }\n\n createDom() {\n\n this._dom = document.createElementNS(this.graph.ns, 'line');\n this.line1 = document.createElementNS(this.graph.ns, 'line');\n this.line2 = document.createElementNS(this.graph.ns, 'line');\n this.line3 = document.createElementNS(this.graph.ns, 'line');\n\n this.rectBoundary = document.createElementNS(this.graph.ns, 'path');\n\n this.rectBoundary.setAttribute('fill', 'transparent');\n this.rectBoundary.setAttribute('stroke', 'none');\n this.rectBoundary.setAttribute('pointer-events', 'fill');\n\n this.rectBoundary.jsGraphIsShape = true;\n\n this.group.appendChild(this.rectBoundary);\n this.group.appendChild(this.line1);\n this.group.appendChild(this.line2);\n this.group.appendChild(this.line3);\n this._dom.element = this;\n }\n\n createHandles() {\n this._createHandles(3, 'rect', {\n transform: 'translate(-3 -3)',\n width: 6,\n height: 6,\n stroke: 'black',\n fill: 'white',\n cursor: 'nwse-resize'\n });\n }\n\n redrawImpl() {\n\n this.line1.setAttribute('stroke', this.getStrokeColor());\n this.line2.setAttribute('stroke', this.getStrokeColor());\n this.line3.setAttribute('stroke', this.getStrokeColor());\n\n this.line1.setAttribute('stroke-width', this.getStrokeWidth());\n this.line2.setAttribute('stroke-width', this.getStrokeWidth());\n this.line3.setAttribute('stroke-width', this.getStrokeWidth());\n\n this.setHandles();\n this.redrawLines();\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Redraws the vertical lines according to the positions.\n * Position 0 is the left line, position 1 is the right line and position 2 is the center line\n * @returns {ShapePeakBoundaries} The shape instance\n */\n redrawLines() {\n\n var posLeft = this.computePosition(0);\n var posRight = this.computePosition(1);\n var posCenter = this.computePosition(2);\n\n if (posLeft.x && posRight.x && posCenter.x && this.posYPx) {\n\n var height = this.lineHeight;\n this.rectBoundary.setAttribute('d', 'M ' + posLeft.x + ' ' + (this.posYPx - height) + ' v ' + 2 * height + ' H ' + posRight.x + ' v ' + -2 * height + 'z');\n this.line1.setAttribute('x1', posLeft.x);\n this.line1.setAttribute('x2', posLeft.x);\n\n this.line2.setAttribute('x1', posRight.x);\n this.line2.setAttribute('x2', posRight.x);\n\n this.line3.setAttribute('x1', posCenter.x);\n this.line3.setAttribute('x2', posCenter.x);\n\n this._dom.setAttribute('x1', posLeft.x);\n this._dom.setAttribute('x2', posRight.x);\n\n this.redrawY(height);\n }\n\n return this;\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Redraws the vertical positions of the shape\n * @returns {ShapePeakBoundaries} The shape instance\n */\n redrawY() {\n\n if (!this.posYPx) {\n return this;\n }\n\n var height = this.lineHeight;\n\n this.line1.setAttribute('y1', this.posYPx - height);\n this.line1.setAttribute('y2', this.posYPx + height);\n\n this.line2.setAttribute('y1', this.posYPx - height);\n this.line2.setAttribute('y2', this.posYPx + height);\n\n this.line3.setAttribute('y1', this.posYPx - height);\n this.line3.setAttribute('y2', this.posYPx + height);\n\n this._dom.setAttribute('y1', this.posYPx);\n this._dom.setAttribute('y2', this.posYPx);\n\n return this;\n }\n\n setHandles() {\n\n if (!this.posYPx) {\n return;\n }\n\n var posLeft = this.computePosition(0);\n var posRight = this.computePosition(1);\n var posCenter = this.computePosition(2);\n\n if (posLeft.x && posRight.x && posCenter.x) {\n\n this.handles[1].setAttribute('x', posLeft.x);\n this.handles[1].setAttribute('y', this.posYPx);\n\n this.handles[2].setAttribute('x', posRight.x);\n this.handles[2].setAttribute('y', this.posYPx);\n\n this.handles[3].setAttribute('x', posCenter.x);\n this.handles[3].setAttribute('y', this.posYPx);\n }\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Sets the y position of the shape\n * @param {Number} y - The y position in px\n * @returns {ShapePeakBoundaries} The shape instance\n */\n setY(y) {\n this.posYPx = y;\n return this;\n }\n\n /**\n * @memberof ShapePeakBoundaries\n * Sets the height of the peak lines\n * @param {Number} height - The height of the lines in px\n * @returns {ShapePeakBoundaries} The shape instance\n */\n setLineHeight(height) {\n this.lineHeihgt = height;\n }\n\n handleMouseMoveImpl(e, deltaX, deltaY) {\n\n if (this.isLocked()) {\n return;\n }\n\n var posLeft = this.getPosition(0);\n var posRight = this.getPosition(1);\n var posCenter = this.getPosition(2);\n\n switch (this.handleSelected) {\n\n case 1:\n // left\n posLeft.deltaPosition('x', deltaX, this.getXAxis());\n\n if (Math.abs(posCenter.x - posRight.x) > Math.abs(posRight.x - posLeft.x) || Math.abs(posCenter.x - posLeft.x) > Math.abs(posRight.x - posLeft.x)) {\n posCenter.x = posLeft.x + (posRight.x - posLeft.x) * 0.1;\n }\n break;\n\n case 2:\n // left\n\n posRight.deltaPosition('x', deltaX, this.getXAxis());\n\n if (Math.abs(posCenter.x - posRight.x) > Math.abs(posRight.x - posLeft.x) || Math.abs(posCenter.x - posLeft.x) > Math.abs(posRight.x - posLeft.x)) {\n posCenter.x = posRight.x + (posLeft.x - posRight.x) * 0.1;\n }\n\n break;\n\n case 3:\n // left\n\n posCenter.deltaPosition('x', deltaX, this.getXAxis());\n\n if (Math.abs(posCenter.x - posRight.x) > Math.abs(posRight.x - posLeft.x) || Math.abs(posCenter.x - posLeft.x) > Math.abs(posRight.x - posLeft.x)) {\n return;\n }\n\n break;\n\n }\n\n this.setLabelPosition({\n y: this.getLabelPosition(0).y,\n x: posCenter.x\n });\n\n this.updateLabels();\n this.redrawLines();\n this.setHandles();\n }\n\n applyPosition() {\n\n this.redrawLines();\n return true;\n }\n\n}\n\n/**\n * Represents a line\n * @extends Shape\n * @see Graph#newShape\n */\nclass ShapeHTML extends Shape {\n\n constructor(graph, options) {\n super(graph, options);\n }\n\n /**\n * Creates the DOM\n * @private\n * @return {Shape} The current shape\n */\n createDom() {\n\n this._dom = document.createElement('div');\n // this._dom.setAttribute( \"requiredExtensions\", \"http://www.w3.org/1999/xhtml\" );\n\n this._dom.setAttribute('style', 'position: absolute');\n let div = document.createElement('div');\n this._dom.appendChild(div);\n this.div = div;\n }\n\n /**\n * Creates the handles\n * @private\n * @return {Shape} The current shape\n */\n createHandles() {}\n\n setHeight(height) {\n this.setProp('height', height);\n }\n\n setWidth(width) {\n this.setProp('width', width);\n }\n\n setContent(content) {\n this.setProp('content', content);\n }\n\n setRenderer(method) {\n this._renderer = method;\n }\n\n redraw() {\n\n if (this._renderer) {\n this._renderer(this.div);\n } else {\n this.div.innerHTML = this.getProp('content');\n }\n\n super.redraw(...arguments);\n }\n\n /**\n * Recalculates the positions and applies them\n * @private\n * @return {Boolean} Whether the shape should be redrawn\n */\n applyPosition() {\n\n var position = this.calculatePosition(0);\n\n if (!position || !isNumeric$1(position.x) || !isNumeric$1(position.y)) {\n return;\n }\n this._dom.style.left = position.x + 'px';\n this._dom.style.top = position.y + 'px';\n\n this.currentPosX = position.x;\n this.currentPosY = position.y;\n\n return true;\n }\n\n /**\n * Handles mouse move events\n * @private\n */\n handleMouseMoveImpl(e, deltaX, deltaY, deltaXPx, deltaYPx) {\n\n return true;\n }\n\n /**\n * Sets the handle position\n * @private\n */\n setHandles() {}\n\n isHTML() {\n return true;\n }\n}\n\n/**\n * Represents a plugin\n * @interface\n */\nclass Plugin extends EventEmitter {\n\n static default() {\n return {};\n }\n\n constructor(options) {\n super(...arguments);\n\n this.options = Object.assign({}, Plugin.default(), this.constructor.default(), options);\n }\n\n /**\n * Init function called by jsGraph on load\n */\n init(graph) {\n this.graph = graph;\n }\n\n /**\n * Handles the mousedown event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseDown() {}\n\n /**\n * Handles the mouseup event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseUp() {}\n\n /**\n * Handles the mousemove event from jsGraph\n * @param {Graph} graph - The graph instance\n * @param {Number} x - The x position in px\n * @param {Number} y - The y position in px\n * @param {Event} e - The original event\n * @param {SVGElement} target - The target element\n */\n onMouseMove() {}\n}\n\n/**\n * Constructor for the drag plugin. Do not use this constructor directly.\n * @class PluginDrag\n * @implements Plugin\n */\nclass PluginDrag extends Plugin {\n\n static default() {\n return {\n\n dragX: true,\n dragY: true,\n persistanceX: false,\n persistanceY: false\n\n };\n }\n\n /**\n * @private\n */\n init(graph) {\n\n this.graph = graph;\n this.time = null;\n this.totaltime = 2000;\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, target) {\n this._draggingX = x;\n this._draggingY = y;\n\n this._lastDraggingX = this._draggingX;\n this._lastDraggingY = this._draggingY;\n\n this.stopAnimation = true;\n\n this.moved = false;\n\n return true;\n }\n\n /**\n * @memberof PluginDrag\n * @private\n */\n onMouseMove(graph, x, y, e, target) {\n\n var deltaX = x - this._draggingX;\n var deltaY = y - this._draggingY;\n\n if (this.options.dragX) {\n graph._applyToAxes(function (axis) {\n axis.setCurrentMin(axis.getVal(axis.getMinPx() - deltaX));\n axis.setCurrentMax(axis.getVal(axis.getMaxPx() - deltaX));\n }, false, true, false);\n }\n\n if (this.options.dragY) {\n\n graph._applyToAxes(function (axis) {\n axis.setCurrentMin(axis.getVal(axis.getMinPx() - deltaY));\n axis.setCurrentMax(axis.getVal(axis.getMaxPx() - deltaY));\n }, false, false, true);\n }\n\n this._lastDraggingX = this._draggingX;\n this._lastDraggingY = this._draggingY;\n\n this._draggingX = x;\n this._draggingY = y;\n\n this.moved = true;\n\n this.time = Date.now();\n\n this.emit('dragging');\n\n graph.draw(true);\n }\n\n onMouseUp(graph, x, y, e, target) {\n\n var dt = Date.now() - this.time;\n\n if (x == this._lastDraggingX || y == this._lastDraggingY) {\n\n if (this.moved) {\n this.emit('dragged');\n }\n\n return;\n }\n\n this.speedX = (x - this._lastDraggingX) / dt;\n this.speedY = (y - this._lastDraggingY) / dt;\n\n if (isNaN(this.speedX) || isNaN(this.speedY)) {\n this.emit('dragged');\n return;\n }\n\n graph._applyToAxes(function (axis) {\n axis._pluginDragMin = axis.getCurrentMin();\n axis._pluginDragMax = axis.getCurrentMax();\n }, false, true, true);\n\n this.stopAnimation = false;\n this.accelerationX = -this.speedX / this.totaltime;\n this.accelerationY = -this.speedY / this.totaltime;\n\n if (this.options.persistanceX || this.options.persistanceY) {\n\n this._persistanceMove(graph);\n } else {\n\n this.emit('dragged');\n }\n }\n\n _persistanceMove(graph) {\n\n var self = this;\n\n if (self.stopAnimation) {\n self.emit('dragged');\n return;\n }\n\n window.requestAnimationFrame(function () {\n\n var dt = Date.now() - self.time;\n var dx = (0.5 * self.accelerationX * dt + self.speedX) * dt;\n var dy = (0.5 * self.accelerationY * dt + self.speedY) * dt;\n\n if (self.options.persistanceX) {\n\n graph._applyToAxes(function (axis) {\n\n axis.setCurrentMin(-axis.getRelVal(dx) + axis._pluginDragMin);\n axis.setCurrentMax(-axis.getRelVal(dx) + axis._pluginDragMax);\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n }, false, true, false);\n }\n\n if (self.options.persistanceY) {\n\n graph._applyToAxes(function (axis) {\n\n axis.setCurrentMin(-axis.getRelVal(dy) + axis._pluginDragMin);\n axis.setCurrentMax(-axis.getRelVal(dy) + axis._pluginDragMax);\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n }, false, false, true);\n }\n\n graph.draw();\n\n if (dt < self.totaltime) {\n self.emit('dragging');\n self._persistanceMove(graph);\n } else {\n self.emit('dragged');\n }\n });\n }\n}\n\n/**\n * @class PluginShape\n * @implements Plugin\n */\nclass PluginShape extends Plugin {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n return {};\n }\n\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n\n super.init(graph, options);\n this.shapeType = options.type;\n }\n\n /**\n * Sets the shape that is created by the plugin\n * @param {String} shapeType - The type of the shape\n */\n setShape(shapeType) {\n this.shapeInfo.shapeType = shapeType;\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, target) {\n\n if (!this.shapeType && !this.options.url) {\n return;\n }\n\n var self = this;\n\n var xVal, yVal;\n\n this.count = this.count || 0;\n\n x -= graph.getPaddingLeft();\n y -= graph.getPaddingTop();\n\n xVal = graph.getXAxis().getVal(x);\n yVal = graph.getYAxis().getVal(y);\n\n var shapeInfo = {\n\n position: [{\n x: xVal,\n y: yVal\n }, {\n x: xVal,\n y: yVal\n }],\n\n onChange: function (newData) {\n graph.triggerEvent('onAnnotationChange', newData);\n },\n\n locked: false,\n selectable: true,\n resizable: true,\n movable: true\n };\n\n let shapeProperties = this.options.properties;\n\n extend$1(true, shapeInfo, this.options);\n\n this.emit('beforeNewShape', e, shapeInfo);\n\n if (this.graph.prevent(false)) {\n return;\n }\n\n var shape = graph.newShape(shapeInfo.type, shapeInfo, false, shapeProperties);\n\n this.emit('createdShape', e, shape);\n\n if (shape) {\n self.currentShape = shape;\n self.currentShapeEvent = e;\n }\n\n graph.once('mouseUp', () => {\n console.log(this.currentShape);\n if (!this.currentShape) {\n // The mouse has moved\n self.emit('newShape', e, shape);\n }\n });\n }\n\n /**\n * @private\n */\n onMouseMove(graph, x, y, e) {\n\n if (this.currentShape) {\n console.log('mv');\n this.count++;\n\n var shape = this.currentShape;\n\n this.currentShape = false;\n\n if (graph.selectedSerie && !shape.serie) {\n shape.setSerie(graph.selectedSerie);\n }\n\n shape.resizing = true;\n\n if (shape.options && shape.options.onCreate) {\n shape.options.onCreate.call(shape);\n }\n\n shape.draw();\n graph.selectShape(shape);\n shape.handleMouseDown(this.currentShapeEvent, true);\n shape.handleSelected = this.options.handleSelected || 1;\n shape.handleMouseMove(e, true);\n }\n }\n\n /**\n * @private\n */\n onMouseUp() {\n\n if (this.currentShape) {\n // No need to kill it as it hasn't been actually put in the dom right now\n\n // Norman 30 July 2017: Yes but it's added in the jsGraph stack. We need to remove it. See #176\n // From now on killing the shape will result in removing it from the stack as well.\n this.currentShape.kill();\n this.currentShape = false;\n }\n }\n\n}\n\n/**\n * @extends Plugin\n */\nclass PluginSelectScatter extends Plugin {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n return {};\n }\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n\n this._path = document.createElementNS(graph.ns, 'path');\n\n setAttributeTo(this._path, {\n 'display': 'none',\n 'fill': 'rgba(0,0,0,0.1)',\n 'stroke': 'rgba(0,0,0,1)',\n 'shape-rendering': 'crispEdges',\n 'x': 0,\n 'y': 0,\n 'height': 0,\n 'width': 0,\n 'd': ''\n });\n\n this.graph = graph;\n\n graph.dom.appendChild(this._path);\n }\n\n /**\n * Assigns the scatter serie that should be selected to the plugin\n * @param {ScatterSerie} serie - The serie\n * @return {PluginSelectScatter} The current plugin instance\n */\n setSerie(serie) {\n this.serie = serie;\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, mute) {\n\n if (!this.serie) {\n return;\n }\n\n this.path = 'M ' + x + ' ' + y + ' ';\n this.currentX = x;\n this.currentY = y;\n\n this.xs = [this.serie.getXAxis().getVal(x - graph.getPaddingLeft())];\n this.ys = [this.serie.getYAxis().getVal(y - graph.getPaddingTop())];\n this._path.setAttribute('d', '');\n this._path.setAttribute('display', 'block');\n }\n\n /**\n * @private\n */\n onMouseMove(graph, x, y, e, mute) {\n\n if (Math.pow(x - this.currentX, 2) + Math.pow(y - this.currentY, 2) > 25) {\n\n this.path += ' L ' + x + ' ' + y + ' ';\n this.currentX = x;\n this.currentY = y;\n\n this.xs.push(this.serie.getXAxis().getVal(x - graph.getPaddingLeft()));\n this.ys.push(this.serie.getYAxis().getVal(y - graph.getPaddingTop()));\n\n this._path.setAttribute('d', this.path + ' z');\n\n this.findPoints();\n }\n }\n\n /**\n * @private\n */\n findPoints() {\n\n var data = this.serie.waveform;\n var selected = [];\n var counter = 0,\n j2;\n for (var i = 0, l = data.getLength(); i < l; i += 1) {\n\n counter = 0;\n for (var j = 0, k = this.xs.length; j < k; j += 1) {\n\n if (j == k - 1) {\n j2 = 0;\n } else {\n j2 = j + 1;\n }\n\n if (this.ys[j] < data.getY(i) && this.ys[j2] > data.getY(i) || this.ys[j] > data.getY(i) && this.ys[j2] < data.getY(i)) {\n\n if (data.getX(i) > (data.getY(i) - this.ys[j]) / (this.ys[j2] - this.ys[j]) * (this.xs[j2] - this.xs[j]) + this.xs[j]) {\n counter++;\n }\n }\n }\n\n if (counter % 2 == 1) {\n selected.push(i);\n this.serie.selectPoint(i, true, 'selected');\n } else {\n this.serie.unselectPoint(i);\n }\n }\n\n this.selected = selected;\n this.emit('selectionProcess', selected);\n }\n\n /**\n * @private\n */\n onMouseUp(graph, x, y, e) {\n this._path.setAttribute('display', 'none');\n this.emit('selectionEnd', this.selected);\n }\n\n}\n\n/**\n * @class PluginZoom\n * @implements Plugin\n */\nclass PluginZoom extends Plugin {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n\n return {\n 'axes': 'all'\n };\n }\n\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n\n this._zoomingGroup = document.createElementNS(graph.ns, 'g');\n this._zoomingSquare = document.createElementNS(graph.ns, 'rect');\n this._zoomingSquare.setAttribute('display', 'none');\n\n setAttributeTo(this._zoomingSquare, {\n 'display': 'none',\n 'fill': 'rgba(171,12,12,0.2)',\n 'stroke': 'rgba(171,12,12,1)',\n 'shape-rendering': 'crispEdges',\n 'x': 0,\n 'y': 0,\n 'height': 0,\n 'width': 0,\n 'pointer-events': 'none'\n });\n\n this.graph = graph;\n graph.groupEvent.appendChild(this._zoomingGroup);\n this._zoomingGroup.appendChild(this._zoomingSquare);\n }\n\n /**\n * @private\n */\n onMouseDown(graph, x, y, e, mute) {\n\n var zoomMode = this.options.zoomMode;\n\n if (!zoomMode) {\n return;\n }\n\n this._zoomingMode = zoomMode;\n\n if (x === undefined) {\n this._backedUpZoomMode = this._zoomingMode;\n this._zoomingMode = 'y';\n x = 0;\n }\n\n if (y === undefined) {\n this._backedUpZoomMode = this._zoomingMode;\n this._zoomingMode = 'x';\n y = 0;\n }\n\n this._zoomingXStart = x;\n this._zoomingYStart = y;\n this.x1 = x - graph.getPaddingLeft();\n this.y1 = y - graph.getPaddingTop();\n\n this._zoomingSquare.setAttribute('width', 0);\n this._zoomingSquare.setAttribute('height', 0);\n this._zoomingSquare.setAttribute('display', 'block');\n\n switch (this._zoomingMode) {\n\n case 'x':\n this._zoomingSquare.setAttribute('y', graph.options.paddingTop);\n this._zoomingSquare.setAttribute('height', graph.getDrawingHeight() - graph.shift.bottom);\n break;\n\n case 'y':\n this._zoomingSquare.setAttribute('x', graph.options.paddingLeft /* + this.shift[1]*/);\n this._zoomingSquare.setAttribute('width', graph.getDrawingWidth() /* - this.shift[1] - this.shift[2]*/);\n break;\n\n case 'forceY2':\n\n this.y2 = graph.getYAxis().getPx(this.options.forcedY) + graph.options.paddingTop;\n\n break;\n\n }\n\n if (this.options.onZoomStart && !mute) {\n this.options.onZoomStart(graph, x, y, e, mute);\n }\n }\n\n /**\n * @private\n */\n onMouseMove(graph, x, y, e, mute) {\n\n //\tthis._zoomingSquare.setAttribute('display', 'none');\n\n //\tthis._zoomingSquare.setAttribute('transform', 'translate(' + Math.random() + ', ' + Math.random() + ') scale(10, 10)');\n switch (this._zoomingMode) {\n\n case 'xy':\n this._zoomingSquare.setAttribute('x', Math.min(this._zoomingXStart, x));\n this._zoomingSquare.setAttribute('y', Math.min(this._zoomingYStart, y));\n this._zoomingSquare.setAttribute('width', Math.abs(this._zoomingXStart - x));\n this._zoomingSquare.setAttribute('height', Math.abs(this._zoomingYStart - y));\n\n break;\n\n case 'forceY2':\n this._zoomingSquare.setAttribute('y', Math.min(this._zoomingYStart, this.y2));\n this._zoomingSquare.setAttribute('height', Math.abs(this._zoomingYStart - this.y2));\n this._zoomingSquare.setAttribute('x', Math.min(this._zoomingXStart, x));\n this._zoomingSquare.setAttribute('width', Math.abs(this._zoomingXStart - x));\n\n break;\n\n case 'x':\n this._zoomingSquare.setAttribute('x', Math.min(this._zoomingXStart, x));\n this._zoomingSquare.setAttribute('width', Math.abs(this._zoomingXStart - x));\n\n break;\n\n case 'y':\n this._zoomingSquare.setAttribute('y', Math.min(this._zoomingYStart, y));\n this._zoomingSquare.setAttribute('height', Math.abs(this._zoomingYStart - y));\n break;\n\n }\n\n if (this.options.onZoomMove && !mute) {\n\n this.options.onZoomMove(graph, x, y, e, mute);\n }\n //\t\tthis._zoomingSquare.setAttribute('display', 'block');\n }\n\n /**\n * @private\n */\n onMouseUp(graph, x, y, e, mute) {\n var self = this;\n this.removeZone();\n\n var _x = x - graph.options.paddingLeft;\n var _y = y - graph.options.paddingTop;\n\n this.emit('beforeZoom', {\n graph: graph,\n x: x,\n y: y,\n e: e,\n mute: mute\n });\n\n if (graph.prevent(false)) {\n\n // This doesn't work !\n //graph.prevent( true ); // Cancel future click event\n return;\n }\n\n if (x - this._zoomingXStart == 0 && this._zoomingMode != 'y' || y - this._zoomingYStart == 0 && this._zoomingMode != 'x') {\n return;\n }\n\n if (this.options.transition || this.options.smooth) {\n\n let modeX = false,\n modeY = false;\n\n if (this._zoomingMode == 'x' || this._zoomingMode == 'xy' || this._zoomingMode == 'forceY2') {\n\n this.fullX = false;\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min(axis.getVal(_x), axis.getVal(self.x1));\n axis._pluginZoomMaxFinal = Math.max(axis.getVal(_x), axis.getVal(self.x1));\n }, false, true, false);\n\n modeX = true;\n }\n\n if (this._zoomingMode == 'y' || this._zoomingMode == 'xy') {\n\n this.fullY = false;\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min(axis.getVal(_y), axis.getVal(self.y1));\n axis._pluginZoomMaxFinal = Math.max(axis.getVal(_y), axis.getVal(self.y1));\n }, false, false, true);\n\n modeY = true;\n }\n\n if (this._zoomingMode == 'forceY2') {\n\n this.fullY = false;\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = Math.min(axis.getVal(self.y2), axis.getVal(self.y1));\n axis._pluginZoomMaxFinal = Math.max(axis.getVal(self.y2), axis.getVal(self.y1));\n }, false, false, true);\n\n modeY = true;\n }\n\n this.transition(modeX, modeY, 'zoomEnd');\n } else {\n\n switch (this._zoomingMode) {\n case 'x':\n this.fullX = false;\n this.toAxes('_doZoom', [_x, this.x1], true, false);\n break;\n case 'y':\n this.fullY = false;\n this.toAxes('_doZoom', [_y, this.y1], false, true);\n break;\n case 'xy':\n this.fullX = false;\n this.fullY = false;\n this.toAxes('_doZoom', [_x, this.x1], true, false);\n this.toAxes('_doZoom', [_y, this.y1], false, true);\n break;\n\n case 'forceY2':\n\n this.fullX = false;\n this.fullY = false;\n\n this.toAxes('_doZoom', [_x, this.x1], true, false);\n this.toAxes('_doZoom', [this.y1, this.y2], false, true);\n\n break;\n }\n\n // graph.prevent( true ); // WHat are you doing ??\n graph.draw();\n\n if (this._backedUpZoomMode) {\n this._zoomingMode = this._backedUpZoomMode;\n }\n\n this.emit('zoomed');\n\n graph.pluginYieldActiveState();\n }\n }\n\n /**\n * @private\n */\n removeZone() {\n\n this._zoomingSquare.setAttribute('display', 'none');\n }\n\n /**\n * @private\n */\n onMouseWheel(delta, e, coordX, coordY, options) {\n\n if (!options) {\n options = {};\n }\n\n if (!options.baseline) {\n options.baseline = 0;\n }\n\n let baseline = options.baseline;\n\n if (options.baseline == 'mousePosition') {\n baseline = this.graph.getYAxis().getVal(coordY);\n console.log(baseline);\n }\n\n /*var serie;\n if ( ( serie = this.graph.getSelectedSerie() ) ) {\n if ( serie.getYAxis().handleMouseWheel( delta, e ) ) {\n return;\n }\n }*/\n\n var doX = options.direction == 'x';\n var doY = !(options.direction !== 'y');\n\n this.toAxes('handleMouseWheel', [delta, e, baseline], doX, doY);\n\n this.graph.drawSeries();\n }\n\n /**\n * @private\n */\n onDblClick(x, y, e, pref, mute) {\n\n var graph = this.graph;\n this.emit('beforeDblClick', {\n graph: graph,\n x: x,\n y: y,\n pref: pref,\n e: e,\n mute: mute\n });\n\n if (graph.prevent(false)) {\n return;\n }\n\n if (this.options.transition || this.options.smooth) {\n\n var modeX = false,\n modeY = false;\n\n if (pref.mode == 'xtotal' || pref.mode == 'total') {\n\n this.toAxes(function (axis) {\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getMinValue() - axis.options.axisDataSpacing.min * axis.getInterval();\n axis._pluginZoomMaxFinal = axis.getMaxValue() + axis.options.axisDataSpacing.max * axis.getInterval();\n }, false, true, false);\n\n modeX = true;\n }\n\n if (pref.mode == 'ytotal' || pref.mode == 'total') {\n\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getMinValue() - axis.options.axisDataSpacing.min * axis.getInterval();\n axis._pluginZoomMaxFinal = axis.getMaxValue() + axis.options.axisDataSpacing.max * axis.getInterval();\n }, false, false, true);\n\n modeY = true;\n }\n\n let x, y;\n\n if (pref.mode == 'gradualX' || pref.mode == 'gradualY' || pref.mode == 'gradual' || pref.mode == 'gradualXY') {\n\n x = false, y = false;\n\n if (pref.mode == 'gradualX' || pref.mode == 'gradual' || pref.mode == 'gradualXY') {\n x = true;\n modeX = true;\n }\n\n if (pref.mode == 'gradualY' || pref.mode == 'gradual' || pref.mode == 'gradualXY') {\n y = true;\n modeY = true;\n }\n\n this.toAxes(function (axis) {\n\n axis._pluginZoomMin = axis.getCurrentMin();\n axis._pluginZoomMax = axis.getCurrentMax();\n\n axis._pluginZoomMinFinal = axis.getCurrentMin() - (axis.getCurrentMax() - axis.getCurrentMin());\n axis._pluginZoomMaxFinal = axis.getCurrentMax() + (axis.getCurrentMax() - axis.getCurrentMin());\n }, false, x, y);\n }\n\n this.transition(modeX, modeY, 'dblClick');\n return;\n }\n\n var xAxis = this.graph.getXAxis(),\n yAxis = this.graph.getYAxis();\n\n if (pref.mode == 'xtotal') {\n\n this.toAxes('setMinMaxToFitSeries', null, true, false);\n this.fullX = true;\n this.fullY = false;\n } else if (pref.mode == 'ytotal') {\n\n this.toAxes('setMinMaxToFitSeries', null, false, true);\n this.fullX = false;\n this.fullY = true;\n } else if (pref.mode == 'total') {\n\n this.toAxes('setMinMaxToFitSeries', null, true, true);\n\n this.fullX = true;\n this.fullY = true;\n // Nothing to do here\n /* this.graph._applyToAxes( function( axis ) {\n axis.emit( 'zoom', axis.currentAxisMin, axis.currentAxisMax, axis );\n }, null, true, true );\n */\n } else {\n\n x -= this.graph.options.paddingLeft;\n y -= this.graph.options.paddingTop;\n\n var xMin = xAxis.getCurrentMin(),\n xMax = xAxis.getCurrentMax(),\n xActual = xAxis.getVal(x),\n diffX = xMax - xMin,\n yMin = yAxis.getCurrentMin(),\n yMax = yAxis.getCurrentMax(),\n yActual = yAxis.getVal(y),\n diffY = yMax - yMin;\n\n if (pref.mode == 'gradualXY' || pref.mode == 'gradualX') {\n\n var ratio = (xActual - xMin) / (xMax - xMin);\n xMin = Math.max(xAxis.getMinValue() - xAxis.getInterval() * xAxis.options.axisDataSpacing.min, xMin - diffX * ratio);\n xMax = Math.min(xAxis.getMaxValue() + xAxis.getInterval() * xAxis.options.axisDataSpacing.max, xMax + diffX * (1 - ratio));\n xAxis.setCurrentMin(xMin);\n xAxis.setCurrentMax(xMax);\n\n if (xAxis.options.onZoom) {\n xAxis.options.onZoom(xMin, xMax);\n }\n\n xAxis.cacheCurrentMin();\n xAxis.cacheCurrentMax();\n xAxis.cacheInterval();\n }\n\n if (pref.mode == 'gradualXY' || pref.mode == 'gradualY') {\n\n var ratio = (yActual - yMin) / (yMax - yMin);\n yMin = Math.max(yAxis.getMinValue() - yAxis.getInterval() * yAxis.options.axisDataSpacing.min, yMin - diffY * ratio);\n yMax = Math.min(yAxis.getMaxValue() + yAxis.getInterval() * yAxis.options.axisDataSpacing.max, yMax + diffY * (1 - ratio));\n yAxis.setCurrentMin(yMin);\n yAxis.setCurrentMax(yMax);\n\n if (yAxis.options.onZoom) {\n yAxis.options.onZoom(yMin, yMax);\n }\n\n yAxis.cacheCurrentMin();\n yAxis.cacheCurrentMax();\n yAxis.cacheInterval();\n }\n }\n\n graph.pluginYieldActiveState();\n\n this.graph.draw();\n /*\n this.emit( \"dblClick\", {\n graph: graph,\n x: x,\n y: y,\n pref: pref,\n e: e,\n mute: mute\n } );\n if ( this.options.onDblClick && !mute ) {\n this.options.onDblClick( graph, x, y, e, mute );\n }*/\n }\n\n transition(modeX, modeY, eventName) {\n\n var self = this,\n maxTime = 500;\n\n if (!self.gradualUnzoomStart) {\n self.gradualUnzoomStart = Date.now();\n }\n\n window.requestAnimationFrame(function () {\n\n var dt = Date.now() - self.gradualUnzoomStart;\n\n if (dt > maxTime) {\n dt = maxTime;\n }\n var progress = Math.sin(dt / maxTime * Math.PI / 2);\n\n self.toAxes(function (axis) {\n\n axis.setCurrentMin(axis._pluginZoomMin + (axis._pluginZoomMinFinal - axis._pluginZoomMin) * progress);\n axis.setCurrentMax(axis._pluginZoomMax + (axis._pluginZoomMaxFinal - axis._pluginZoomMax) * progress);\n\n axis.cacheCurrentMin();\n axis.cacheCurrentMax();\n axis.cacheInterval();\n }, false, modeX, modeY);\n\n self.graph.draw();\n\n if (dt < maxTime) {\n\n self.transition(modeX, modeY, eventName);\n self.emit('zooming');\n } else {\n\n self.emit('zoomed');\n self.graph.pluginYieldActiveState();\n\n if (eventName) {\n self.emit(eventName);\n }\n self.gradualUnzoomStart = 0;\n }\n });\n }\n\n isFullX() {\n return this.fullX;\n }\n\n isFullY() {\n return this.fullY;\n }\n\n toAxes(func, params, tb, lr) {\n\n var axes = this.options.axes;\n\n if (!axes || axes == 'serieSelected' && !this.graph.getSelectedSerie()) {\n axes = 'all';\n }\n\n switch (axes) {\n\n case 'all':\n this.graph._applyToAxes.apply(this.graph, arguments);\n break;\n\n case 'serieSelected':\n\n var serie = this.graph.getSelectedSerie();\n if (serie) {\n\n if (tb) {\n\n if (typeof func == 'string') {\n serie.getXAxis()[func].apply(serie.getXAxis(), params);\n } else {\n func.apply(serie.getXAxis(), params);\n }\n }\n\n if (lr) {\n\n if (typeof func == 'string') {\n serie.getYAxis()[func].apply(serie.getYAxis(), params);\n } else {\n func.apply(serie.getYAxis(), params);\n }\n }\n }\n\n break;\n\n default:\n\n if (!Array.isArray(axes)) {\n axes = [axes];\n }\n\n for (let axis of axes) {\n\n if (axis.isX() && tb) {\n // Not the best check\n\n if (typeof func == 'string') {\n axis[func].apply(axis, params);\n } else {\n func.apply(axis, params);\n }\n } else if (axis.isY() && lr) {\n // Not the best check\n\n if (typeof func == 'string') {\n axis[func].apply(axis, params);\n } else {\n func.apply(axis, params);\n }\n }\n }\n break;\n }\n }\n\n}\n\nvar memory = {};\nvar memoryHead = {};\n\nfunction getFromMemory(store, index) {\n var obj, head;\n\n if (memory[store] && memory[store][index]) {\n\n head = memoryHead[store];\n\n obj = memory[store][index];\n obj.prev = head;\n obj.next = head.next;\n head.next.prev = obj;\n head.next = obj;\n\n memoryHead[store] = obj;\n return obj.data;\n }\n}\n\n\n\nfunction get(store, index) {\n var result;\n if ((result = getFromMemory(store, index)) != undefined) {\n return result;\n }\n}\n\n/**\n * @class PluginTimeSerieManager\n * @implements Plugin\n */\nclass PluginTimeSerieManager extends Plugin {\n\n constructor() {\n\n super(...arguments);\n\n this.series = [];\n this.plugins = [];\n this.currentSlots = {};\n\n this.requestLevels = new Map();\n this.update = (noRecalculate, force) => {\n\n this.series.forEach(function (serie) {\n\n this.updateSerie(serie, noRecalculate);\n });\n\n if (!noRecalculate) {\n this.recalculateSeries(force);\n }\n };\n }\n\n static default() {\n\n return {\n\n LRUName: 'PluginTimeSerieManager',\n intervals: [1000, 15000, 60000, 900000, 3600000, 8640000],\n maxParallelRequests: 3,\n optimalPxPerPoint: 2,\n nbPoints: 1000,\n url: ''\n };\n }\n\n /**\n * Init method\n * @private\n * @memberof PluginTimeSerieManager\n */\n init(graph, options) {\n this.graph = graph;\n get.create(this.options.LRUName, 200);\n this.requestsRunning = 0;\n }\n\n setURL(url) {\n this.options.url = url;\n return this;\n }\n\n setAvailableIntervals() {\n this.options.intervals = arguments;\n }\n\n newSerie(serieName, serieOptions, serieType, dbElements, noZoneSerie) {\n var s = this.graph.newSerie(serieName, serieOptions, serieType);\n\n this.currentSlots[serieName] = {\n min: 0,\n max: 0,\n interval: 0\n };\n\n s.on('hide', function () {\n\n if (s._zoneSerie) {\n\n s._zoneSerie.hide();\n }\n });\n\n s.on('show', function () {\n\n if (s._zoneSerie) {\n s._zoneSerie.show();\n }\n });\n\n s.setInfo('timeSerieManagerDBElements', dbElements);\n\n if (!noZoneSerie) {\n s._zoneSerie = this.graph.newSerie(serieName + '_zone', {}, Graph$1.SERIE_ZONE);\n }\n\n this.series.push(s);\n return s;\n }\n\n registerPlugin(plugin, event) {\n\n var index;\n if ((index = this.plugins.indexOf(plugin)) > -1) {\n\n for (var i = 1; i < arguments.length; i++) {\n plugin.removeListener(arguments[i], this.update);\n }\n }\n\n for (var i = 1; i < arguments.length; i++) {\n plugin.on(arguments[i], this.update);\n }\n }\n\n updateSerie(serie, noRecalculate) {\n\n var self = this;\n var from = serie.getXAxis().getCurrentMin();\n var to = serie.getXAxis().getCurrentMax();\n var optimalInterval = this.getOptimalInterval(to - from);\n var optimalIntervalIndex = this.options.intervals.indexOf(optimalInterval);\n var interval;\n\n this.cleanRegister(optimalIntervalIndex);\n\n for (var i = optimalIntervalIndex; i <= optimalIntervalIndex + 1; i++) {\n\n interval = this.options.intervals[i];\n var startSlotId = self.computeSlotID(from, interval);\n var endSlotId = self.computeSlotID(to, interval);\n\n var intervalMultipliers = [[2, 5, 6], [1, 2, 4], [0, 1, 3]];\n\n intervalMultipliers.forEach(function (multiplier) {\n\n var firstSlotId = startSlotId - multiplier[0] * (endSlotId - startSlotId);\n var lastSlotId = endSlotId + multiplier[0] * (endSlotId - startSlotId);\n\n var slotId = firstSlotId;\n\n while (slotId <= lastSlotId) {\n\n if (self.computeTimeMin(slotId, interval) > Date.now()) {\n break;\n }\n\n self.register(serie, slotId, interval, interval == optimalInterval ? multiplier[1] : multiplier[2], true, noRecalculate);\n slotId++;\n }\n });\n }\n\n this.processRequests();\n }\n\n cleanRegister(interval) {\n\n if (!this.requestLevels) {\n return;\n }\n\n this.requestLevels.forEach(levelArray => {\n\n levelArray.forEach((levelElement, levelIndex) => {\n\n if (levelElement[4] < interval) {\n levelArray.splice(levelIndex, 1);\n }\n });\n });\n }\n\n register(serie, slotId, interval, priority, noProcess, noRecalculate) {\n\n var id = this.computeUniqueID(serie, slotId, interval);\n\n var data = get.get(this.options.LRUName, id);\n\n if (!data || this.computeTimeMax(slotId, interval) > Date.now() && data.timeout < Date.now() - (noRecalculate ? 5000 : 100000) && priority == 1) {\n\n this.request(serie, slotId, interval, priority, id, noProcess);\n }\n }\n\n request(serie, slotId, interval, priority, slotName, noProcess) {\n\n for (var i in this.requestLevels) {\n\n if (i == priority) {\n continue;\n }\n\n if (this.requestLevels[i][slotName]) {\n\n if (this.requestLevels[i][slotName][0] !== 1) {\n // If the request is not pending\n\n delete this.requestLevels[i][slotName];\n } else {\n this.requestLevels[i][slotName][5] = priority;\n }\n }\n }\n\n if (this.requestLevels[priority] && this.requestLevels[priority][slotName]) {\n return;\n }\n\n this.requestLevels[priority] = this.requestLevels[priority] || {};\n this.requestLevels[priority][slotName] = [0, slotName, serie.getName(), slotId, interval, priority, serie.getInfo('timeSerieManagerDBElements')];\n\n if (!noProcess) {\n this.processRequests();\n }\n }\n\n processRequests() {\n\n if (this.requestsRunning >= this.options.maxParallelRequests) {\n return;\n }\n\n var self = this,\n currentLevelChecking = 1,\n requestToMake;\n\n while (true) {\n\n for (var i in this.requestLevels[currentLevelChecking]) {\n\n if (this.requestLevels[currentLevelChecking][i][0] == 1) {\n // Running request\n continue;\n }\n\n requestToMake = this.requestLevels[currentLevelChecking][i];\n break;\n }\n\n if (requestToMake) {\n break;\n }\n\n currentLevelChecking++;\n\n if (currentLevelChecking > 10) {\n return;\n }\n }\n\n this.requestsRunning++;\n\n if (!requestToMake) {\n return;\n }\n\n requestToMake[0] = 1;\n\n ajaxGet({\n\n url: this.getURL(requestToMake),\n method: 'GET',\n json: true\n\n }).done(function (data) {\n\n if (data.status == 1) {\n // Success\n\n self.requestsRunning--;\n\n delete self.requestLevels[currentLevelChecking][i];\n\n get.store(self.options.LRUName, requestToMake[1], data.data); // Element 1 is the unique ID\n self.processRequests();\n\n if (requestToMake[5] == 1 && Object.keys(self.requestLevels[1]).length == 0) {\n\n self.recalculateSeries(true);\n }\n }\n });\n }\n\n computeTimeMax(slotId, interval) {\n return (slotId + 1) * (interval * this.options.nbPoints);\n }\n\n computeTimeMin(slotId, interval) {\n return slotId * (interval * this.options.nbPoints);\n }\n\n getURL(requestElements) {\n\n var url = this.options.url.replace('', requestElements[2]).replace('', this.computeTimeMin(requestElements[3], requestElements[4])).replace('', this.computeTimeMax(requestElements[3], requestElements[4])).replace('', requestElements[4]);\n\n var dbElements = requestElements[6] || {};\n\n for (var i in dbElements) {\n url = url.replace('<' + i + '>', dbElements[i]);\n }\n\n return url;\n }\n\n getOptimalInterval(totalspan) {\n\n var optimalInterval = (this.options.optimalPxPerPoint || 1) * totalspan / this.graph.getDrawingWidth(),\n diff = Infinity,\n optimalIntervalAmongAvailable;\n\n this.options.intervals.forEach(function (interval) {\n\n var newDiff = Math.min(diff, Math.abs(interval - optimalInterval));\n if (diff !== newDiff) {\n\n optimalIntervalAmongAvailable = interval;\n diff = newDiff;\n }\n });\n\n return optimalIntervalAmongAvailable || 1000;\n }\n\n computeUniqueID(serie, slotId, interval) {\n var extra = '';\n var info = serie.getInfo('timeSerieManagerDBElements');\n for (var i in info) {\n extra += ';' + i + ':' + info[i];\n }\n\n return serie.getName() + ';' + slotId + ';' + interval + extra;\n }\n\n computeSlotID(time, interval) {\n return Math.floor(time / (interval * this.options.nbPoints));\n }\n\n computeSlotTime(slotId, interval) {\n return slotId * (interval * this.options.nbPoints);\n }\n\n getZoneSerie(serie) {\n return serie._zoneSerie;\n }\n\n updateZoneSerie(serieName) {\n\n var serie = this.graph.getSerie(serieName);\n\n if (!serie) {\n return;\n }\n\n if (!serie._zoneSerie) {\n return;\n }\n\n serie._zoneSerie.setXAxis(serie.getXAxis());\n serie._zoneSerie.setYAxis(serie.getYAxis());\n serie._zoneSerie.setFillColor(serie.getLineColor());\n serie._zoneSerie.setLineColor(serie.getLineColor());\n serie._zoneSerie.setFillOpacity(0.2);\n serie._zoneSerie.setLineOpacity(0.3);\n }\n\n recalculateSeries(force) {\n\n var self = this;\n\n if (this.locked) {\n return;\n }\n\n this.changed = false;\n\n this.series.map(function (serie) {\n self.recalculateSerie(serie, force);\n });\n\n /*if ( this.changed ) {\n self.graph._applyToAxes( \"scaleToFitAxis\", [ this.graph.getXAxis(), false, undefined, undefined, false, true ], false, true );\n }\n */\n this.changed = false;\n //self.graph.autoscaleAxes();\n\n self.graph.draw();\n }\n\n recalculateSerie(serie, force) {\n\n var from = serie.getXAxis().getCurrentMin(),\n to = serie.getXAxis().getCurrentMax(),\n interval = this.getOptimalInterval(to - from);\n\n var startSlotId = this.computeSlotID(from, interval);\n var endSlotId = this.computeSlotID(to, interval);\n\n var data = [];\n var dataMinMax = [];\n\n if (!force && interval == this.currentSlots[serie.getName()].interval && this.currentSlots[serie.getName()].min <= startSlotId && this.currentSlots[serie.getName()].max >= endSlotId) {\n return;\n }\n\n startSlotId -= 2;\n endSlotId += 2;\n\n this.currentSlots[serie.getName()].min = startSlotId;\n this.currentSlots[serie.getName()].max = endSlotId;\n this.currentSlots[serie.getName()].interval = interval;\n\n var slotId = startSlotId;\n\n while (slotId <= endSlotId) {\n\n const lruData = get.get(this.options.LRUName, this.computeUniqueID(serie, slotId, interval));\n if (lruData) {\n\n data = data.concat(lruData.data.mean);\n dataMinMax = dataMinMax.concat(lruData.data.minmax);\n } else {\n\n this.recalculateSerieUpwards(serie, slotId, interval, data, dataMinMax);\n }\n\n slotId++;\n }\n\n this.changed = true;\n\n serie.setData(data);\n\n if (serie._zoneSerie) {\n serie._zoneSerie.setData(dataMinMax);\n }\n }\n\n setIntervalCheck(interval) {\n\n if (this.interval) {\n clearInterval(this.interval);\n }\n\n this.update(true, true);\n this.interval = setInterval(() => {\n this.update(true, false);\n }, interval);\n }\n\n recalculateSerieUpwards(serie, downSlotId, downInterval, data, dataMinMax) {\n\n var intervals = this.options.intervals.slice(0);\n intervals.sort();\n\n var nextInterval = intervals[intervals.indexOf(downInterval) + 1] || -1;\n if (nextInterval < 0) {\n return [];\n }\n\n var newSlotTime = this.computeSlotTime(downSlotId, downInterval);\n var newSlotTimeEnd = this.computeSlotTime(downSlotId + 1, downInterval);\n var newSlotId = this.computeSlotID(newSlotTime, nextInterval),\n start = false;\n\n const lruData = get.get(this.options.LRUName, this.computeUniqueID(serie, newSlotId, nextInterval));\n if (lruData) {\n\n for (var i = 0, l = lruData.data.mean.length; i < l; i += 2) {\n\n if (lruData.data.mean[i] < newSlotTime) {\n continue;\n } else if (start === false) {\n start = i;\n }\n\n if (lruData.data.mean[i] >= newSlotTimeEnd) {\n\n data = data.concat(lruData.data.mean.slice(start, i));\n dataMinMax = data.concat(lruData.data.minmax.slice(start, i));\n\n return;\n }\n }\n }\n\n return this.recalculateSerieUpwards(serie, newSlotId, nextInterval, data, dataMinMax);\n }\n\n lockRedraw() {\n this.locked = true;\n }\n\n unlockRedraw() {\n this.locked = false;\n }\n\n isRedrawLocked() {\n return !!this.locked;\n }\n}\n\n/**\n * @class PluginSerieLineDifference\n * @implements Plugin\n */\nclass PluginSerieLineDifference extends Plugin {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n return {\n\n positiveStyle: {\n\n fillColor: 'green',\n fillOpacity: 0.2,\n strokeWidth: 0\n },\n\n negativeStyle: {\n fillColor: 'red',\n fillOpacity: 0.2,\n strokeWidth: 0\n },\n\n from: 0,\n to: 0\n };\n }\n\n /**\n * Init method\n * @private\n */\n init(graph, options) {\n this.graph = graph;\n\n this.pathsPositive = [];\n this.pathsNegative = [];\n\n this.positivePolyline = this.graph.newShape('polyline').draw();\n\n this.positivePolyline.setFillColor(this.options.positiveStyle.fillColor).setFillOpacity(this.options.positiveStyle.fillOpacity).setStrokeWidth(this.options.positiveStyle.strokeWidth).applyStyle();\n\n this.negativePolyline = this.graph.newShape('polyline').draw();\n\n this.negativePolyline.setFillColor(this.options.negativeStyle.fillColor).setFillOpacity(this.options.negativeStyle.fillOpacity).setStrokeWidth(this.options.negativeStyle.strokeWidth).applyStyle();\n }\n\n /**\n * Assigns the two series for the shape. Postive values are defined when ```serieTop``` is higher than ```serieBottom```.\n * @param {SerieLine} serieTop - The top serie\n * @param {SerieLine} serieBottom - The bottom serie\n */\n setSeries(serieTop, serieBottom) {\n this.serie1 = serieTop;\n this.serie2 = serieBottom;\n }\n\n /**\n * Assigns the boundaries\n */\n setBoundaries(from, to) {\n this.options.from = from;\n this.options.to = to;\n }\n\n /**\n * @returns the starting value used to draw the zone\n */\n getFrom() {\n return this.options.from;\n }\n\n /**\n * @returns the ending value used to draw the zone\n */\n getTo() {\n return this.options.to;\n }\n\n /**\n * Calculates and draws the zone series\n * @returns {Plugin} The current plugin instance\n */\n draw() {\n\n var self = this;\n var s1 = this.serie1.searchClosestValue(this.getFrom());\n var i1, j1, i2, j2, y, y2, crossing;\n\n var top = [];\n var bottom = [];\n\n var bottomBroken;\n\n if (!s1) {\n i1 = 0;\n j1 = 0;\n } else {\n\n i1 = s1.dataIndex;\n j1 = s1.xAfterIndex * 2;\n }\n\n y = this.interpolate(this.serie1, this.getFrom());\n top.push(this.getFrom()); // x\n top.push(y); // y\n\n y = this.interpolate(this.serie2, this.getFrom());\n bottom.push(this.getFrom()); // x\n bottom.push(y); // y\n\n var s2;\n\n var order;\n\n function nextSet() {\n\n if (order === true) {\n self.pathsPositive.push([top, bottom]);\n } else if (order === false) {\n self.pathsNegative.push([top, bottom]);\n }\n\n top = [];\n bottom = [];\n order = undefined;\n }\n var ended;\n for (; i1 < this.serie1.data.length; i1++) {\n\n for (; j1 < this.serie1.data[i1].length; j1 += 2) {\n\n if (this.serie1.data[i1][j1] > this.getTo()) {\n // FINISHED !\n\n y = this.interpolate(this.serie1, this.getTo());\n y2 = this.interpolate(this.serie2, this.getTo());\n\n crossing = this.computeCrossing(top[top.length - 2], top[top.length - 1], this.getTo(), y, bottom[bottom.length - 2], bottom[bottom.length - 1], this.getTo(), y2);\n\n if (crossing) {\n\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n nextSet();\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n\n order = this.serie1.data[i1][j1 + 1] > this.serie2.data[i2][j2 + 1];\n }\n\n top.push(this.getTo()); // x\n top.push(y); // y\n\n bottom.push(this.getTo()); // x\n bottom.push(y2); // y\n\n ended = true;\n break;\n }\n\n if (!s2) {\n s2 = this.serie2.searchClosestValue(this.serie1.data[i1][j1]); // Finds the first point\n\n if (s2) {\n i2 = s2.dataIndex;\n j2 = s2.xBeforeIndex * 2;\n\n // TODO: Add here first points\n\n y = this.interpolate(this.serie2, this.serie1.data[i1][j1]);\n\n top.push(this.serie1.data[i1][j1]); // x\n top.push(this.serie1.data[i1][j1 + 1]); // y\n\n bottom.push(this.serie1.data[i1][j1]); // x\n bottom.push(y); // y\n\n order = this.serie1.data[i1][j1 + 1] > y;\n } else {\n continue;\n }\n }\n\n bottomBroken = false;\n\n crossing = this.computeCrossing(top[top.length - 2], top[top.length - 1], this.serie1.data[i1][j1], this.serie1.data[i1][j1 + 1], bottom[bottom.length - 2], bottom[bottom.length - 1], this.serie2.data[i2][j2], this.serie2.data[i2][j2 + 1]);\n\n if (crossing) {\n\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n nextSet();\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n\n order = this.serie1.data[i1][j1 + 1] > this.serie2.data[i2][j2 + 1];\n }\n\n while (this.serie2.data[i2][j2] < this.serie1.data[i1][j1]) {\n\n bottom.push(this.serie2.data[i2][j2]);\n bottom.push(this.serie2.data[i2][j2 + 1]);\n\n j2 += 2;\n if (j2 == this.serie2.data[i2].length) {\n bottomBroken = this.serie2.data[i2][j2 - 2];\n i2++;\n j2 = 0;\n break;\n }\n\n crossing = this.computeCrossing(top[top.length - 2], top[top.length - 1], this.serie1.data[i1][j1], this.serie1.data[i1][j1 + 1], bottom[bottom.length - 2], bottom[bottom.length - 1], this.serie2.data[i2][j2], this.serie2.data[i2][j2 + 1]);\n\n if (crossing) {\n\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n nextSet();\n top.push(crossing.x);\n top.push(crossing.y);\n bottom.push(crossing.x);\n bottom.push(crossing.y);\n\n order = this.serie1.data[i1][j1 + 1] > this.serie2.data[i2][j2 + 1];\n }\n }\n\n if (bottomBroken === false) {\n top.push(this.serie1.data[i1][j1]);\n top.push(this.serie1.data[i1][j1 + 1]);\n } else {\n\n top.push(bottomBroken);\n top.push(this.interpolate(this.serie1, bottomBroken));\n\n s2 = false;\n j1 -= 2;\n nextSet();\n }\n }\n\n if (ended) {\n nextSet();\n break;\n }\n // End of X\n\n y = this.interpolate(this.serie2, top[top.length - 2]);\n if (y) {\n bottom.push(top[top.length - 2]);\n bottom.push(y);\n }\n\n nextSet();\n\n j1 = 0;\n s2 = false;\n }\n\n var d = this.pathsPositive.reduce(makePaths, '');\n this.positivePolyline.setPointsPx(d).redraw();\n\n var d = this.pathsNegative.reduce(makePaths, '');\n this.negativePolyline.setPointsPx(d).redraw();\n\n //pathsBottom.map( function( map ) { makePaths( map, self.options.negativeStyle ); } );\n\n function makePaths(d, path) {\n\n for (var i = 0; i < path[0].length; i += 2) {\n if (i == 0) {\n d += 'M ';\n }\n d += ' ' + Math.round(self.serie1.getXAxis().getPx(path[0][i])) + ', ' + Math.round(self.serie1.getYAxis().getPx(path[0][i + 1]));\n if (i < path[0].length - 2) {\n d += ' L ';\n }\n }\n\n for (var i = path[1].length - 2; i >= 0; i -= 2) {\n d += ' L ' + Math.round(self.serie2.getXAxis().getPx(path[1][i])) + ', ' + Math.round(self.serie2.getYAxis().getPx(path[1][i + 1]));\n if (i == 0) {\n d += ' z ';\n }\n }\n return d;\n }\n }\n\n /**\n * Finds the interpolated y value at point ```valX``` of the serie ```serie```\n * @returns {(Number|Boolean)} The interpolated y value is possible, ```false``` otherwise\n * @param {Serie} serie - The serie for which the y value should be computed\n * @param {Number} valX - The x value\n */\n interpolate(serie, valX) {\n\n var value = serie.searchClosestValue(valX);\n\n if (!value) {\n return false;\n }\n\n if (value.xMax == undefined) {\n return value.yMin;\n }\n\n if (value.xMin == undefined) {\n return value.yMax;\n }\n\n var ratio = (valX - value.xMin) / (value.xMax - value.xMin);\n return (1 - ratio) * value.yMin + ratio * value.yMax;\n }\n\n /**\n * Finds the crossing point between two vector and returns it, or ```false``` if it is not within the x boundaries\n * @returns {(Object|Boolean)} An object containing the crossing point in the following format: ```{ x: xCrossing, y: yCrossing }``` or ```false``` if no crossing point can be found\n * @param {Number} x11 - First x point of the first vector\n * @param {Number} y11 - First y point of the first vector\n * @param {Number} x12 - Second x point of the first vector\n * @param {Number} y12 - Second y point of the first vector\n * @param {Number} x21 - First x point of the second vector\n * @param {Number} y21 - First y point of the second vector\n * @param {Number} y22 - Second x point of the second vector\n * @param {Number} y22 - Second y point of the second vector\n */\n computeCrossing(x11, y11, x12, y12, x21, y21, x22, y22) {\n var a1 = (y12 - y11) / (x12 - x11);\n var a2 = (y22 - y21) / (x22 - x21);\n\n var b1 = y12 - a1 * x12;\n var b2 = y22 - a2 * x22;\n\n if (x11 == x12 || x21 == x22) {\n\n return false;\n }\n\n if (a1 == a2) {\n return {\n x: x11,\n y1: y11,\n y2: y11\n };\n }\n\n var x = (b1 - b2) / (a2 - a1);\n\n if (x > x12 || x < x11 || x < x21 || x > x22) {\n return false;\n }\n\n return {\n x: x,\n y: a1 * x + b1\n };\n }\n\n /**\n * @returns The positive polyline\n */\n getPositivePolyline() {\n return this.positivePolyline;\n }\n\n /**\n * @returns The negative polyline\n */\n getNegativePolyline() {\n return this.negativePolyline;\n }\n\n}\n\nclass SerieLineExtended extends SerieLine {\n\n constructor() {\n super(...arguments);\n this.subSeries = [];\n }\n\n setData() {\n super.setData(...arguments);\n this.subSeries.map(sub => {\n sub.data = this.data;\n });\n return this;\n }\n\n draw() {\n this.eraseMarkers();\n return this;\n }\n\n getSymbolForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getSymbolForLegend();\n }\n\n getMarkerForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getMarkerForLegend();\n }\n}\n\nclass SerieScatterExtended extends SerieScatter {\n\n constructor() {\n super(...arguments);\n this.subSeries = [];\n }\n\n setData() {\n super.setData(...arguments);\n this.subSeries.map(sub => {\n sub.data = this.data;\n });\n return this;\n }\n\n draw() {\n return this;\n }\n\n getSymbolForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getSymbolForLegend();\n }\n\n getMarkerForLegend() {\n if (!this.subSeries[0]) {\n return false;\n }\n\n return this.subSeries[0].getMarkerForLegend();\n }\n}\n\nvar excludingMethods = ['constructor', 'init', 'draw', 'setLineColor', 'setLineWidth', 'setLineStyle', 'getLineColor', 'getLineWidth', 'getLineStyle', 'setMarkers', 'showMarkers', 'hideMarkers', 'getMarkerDom', 'getMarkerDomIndependant', 'getMarkerPath', 'eraseMarkers', '_recalculateMarkerPoints'];\nvar addMethods = [];\n\nObject.getOwnPropertyNames(SerieLine.prototype).concat(addMethods).map(function (i) {\n\n if (excludingMethods.indexOf(i) > -1) {\n return;\n }\n\n SerieLineExtended.prototype[i] = function (j) {\n\n return function () {\n\n var args = arguments;\n this.subSeries.map(subSerie => {\n subSerie[j](...args);\n });\n };\n }(i);\n});\n\n/**\n * Axis splitting plugin\n * @augments Plugin\n */\nclass PluginAxisSplitting extends Plugin {\n\n constructor(options) {\n super(...arguments);\n this.series = new Map();\n }\n\n static defaults() {\n\n return {\n axes: {\n margins: {\n high: 5,\n low: 5\n }\n }\n };\n }\n\n init(graph) {\n this.graph = graph;\n }\n\n /**\n * Creates a new bottom split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newXAxis(options) {\n return this.newBottomAxis(options);\n }\n\n /**\n * Creates a new left split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newYAxis(options) {\n return this.newLeftAxis(options);\n }\n\n /**\n * Creates a new top split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newTopAxis(options) {\n options = this.getOptions(options);\n return new SplitXAxis(this.graph, 'top', options);\n }\n\n /**\n * Creates a new bottom split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newBottomAxis(options) {\n options = this.getOptions(options);\n return new SplitXAxis(this.graph, 'bottom', options);\n }\n\n /**\n * Creates a new left split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newLeftAxis(options) {\n options = this.getOptions(options);\n return new SplitYAxis(this.graph, 'left', options);\n }\n\n /**\n * Creates a new right split axis\n * @param {Object} [ options = {} ] The axis options\n * @return {Axis} The newly created split axis\n */\n newRightAxis(options) {\n options = this.getOptions(options);\n return new SplitYAxis(this.graph, 'right', options);\n }\n\n getOptions(options) {\n var defaults = {\n marginMin: this.options.axes.margins.low,\n marginMax: this.options.axes.margins.high\n };\n return extend$1(true, defaults, options);\n }\n\n preDraw() {\n\n var xAxis, yAxis;\n\n // for ( let { serie } of this.series.values() ) {\n this.series.forEach(({\n serie\n }) => {\n\n xAxis = serie.getXAxis();\n yAxis = serie.getYAxis();\n\n let splits = 1;\n\n if (xAxis.splitNumber) {\n splits *= xAxis.splitNumber;\n }\n\n if (yAxis.splitNumber) {\n splits *= yAxis.splitNumber;\n }\n\n while (serie.subSeries.length < splits) {\n\n const name = serie.getName() + '_' + serie.subSeries.length;\n\n const s = this.graph.newSerie(name, {}, serie.getType() || Graph$1.SERIE_LINE);\n\n s.excludedFromLegend = true;\n s.styles = serie.styles;\n s.data = serie.data; // Copy data\n\n if (serie.getType() == Graph$1.SERIE_LINE) {\n s.markerPoints = serie.markerPoints;\n s.markerFamilies = serie.markerFamilies;\n }\n\n serie.subSeries.push(s);\n }\n\n while (serie.subSeries.length > splits) {\n\n let subserie = this.graph.getSerie(serie.getName() + '_' + (serie.subSeries.length - 1));\n\n if (subserie && subserie.kill) {\n subserie.kill();\n }\n serie.subSeries.pop();\n }\n\n if (!serie.getXAxis().splitNumber && serie.getXAxis().splitAxis) {\n serie.getXAxis().splitAxis();\n }\n\n if (!serie.getYAxis().splitNumber && serie.getYAxis().splitAxis) {\n serie.getYAxis().splitAxis();\n }\n\n // Re-assign axes to the sub series\n serie.subSeries.map((sserie, index) => {\n\n var xSubAxis, ySubAxis;\n\n //sserie.groupMarkers = firstSubSerie.groupMarkers;\n\n if (serie.getXAxis().getSubAxis) {\n let subAxisIndex = index % (xAxis.splitNumber || 1);\n xSubAxis = serie.getXAxis().getSubAxis(subAxisIndex);\n } else {\n xSubAxis = serie.getXAxis();\n }\n\n sserie.setXAxis(xSubAxis);\n\n if (serie.getYAxis().getSubAxis) {\n\n let subAxisIndex = Math.floor(index / (xAxis.splitNumber || 1));\n ySubAxis = serie.getYAxis().getSubAxis(subAxisIndex);\n } else {\n ySubAxis = serie.getYAxis();\n }\n\n sserie.setYAxis(ySubAxis);\n\n sserie.draw(true);\n });\n //}\n });\n }\n\n /**\n * Creates a new serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @param {String} type - The type of the serie\n * @return {Serie} The created serie\n */\n newSerie(name, options = {}, type) {\n\n switch (type) {\n\n case 'line':\n return this.newLineSerie(name, options);\n break;\n\n case 'scatter':\n return this.newScatterSerie(name, options);\n break;\n }\n\n throw 'Cannot create a split serie of type ' + type;\n }\n\n /**\n * Creates a new line serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @return {Serie} The created serie\n */\n newLineSerie(name, options) {\n var serieObj = {\n type: 'lineSerie',\n serie: new SerieLineExtended(name, options, 'line')\n };\n this.series.set(name, serieObj);\n serieObj.serie.init(this.graph, name, options);\n this.graph.series.push(serieObj.serie);\n return serieObj.serie;\n }\n\n /**\n * Creates a new scatter serie\n * @param {(String|Number)} name - The name of the serie\n * @param {Object} [ options = {} ] The options of the serie\n * @return {Serie} The created serie\n */\n newScatterSerie(name, options) {\n var serieObj = {\n type: 'scatterSerie',\n serie: new SerieScatterExtended(name, options, 'scatter')\n };\n this.series.set(name, serieObj);\n serieObj.serie.init(this.graph, options);\n this.graph.series.push(serieObj.serie);\n return serieObj.serie;\n }\n\n}\n\nvar defaultAxisConstructorOptions = {\n splitMarks: true\n};\n\nvar SplitAxis = function (mixin) {\n\n var delegateMethods = ['turnGridsOff', 'turnGridsOn', 'gridsOff', 'gridsOn', 'setEngineering', 'setScientificScaleExponent', 'setScientific', 'setLabelColor', 'setSecondaryGridDasharray', 'setPrimaryGridDasharray', 'setSecondaryGridsOpacity', 'setPrimaryGridOpacity', 'setSecondaryGridWidth', 'setPrimaryGridWidth', 'setSecondaryGridColor', 'setPrimaryGridColor', 'setTicksLabelColor', 'setSecondaryTicksColor', 'setPrimaryTicksColor', 'setAxisColor', 'secondaryGridOn', 'secondaryGridOff', 'primaryGridOff', 'primaryGridOn', 'setSecondaryGrid', 'setPrimaryGrid', 'setGrids', 'setTickPosition', 'setExponentialFactor', 'setExponentialLabelFactor', 'setGridLinesStyle', 'forcePrimaryTickUnitMin', 'forcePrimaryTickUnitMax', 'forcePrimaryTickUnit', 'flip', 'show', 'hide', 'setDisplay'];\n\n /**\n * Split axis\n * @mixes AxisX\n * @mixes AxisY\n * @name SplitAxis\n * @static\n */\n var cl = class SplitAxis extends mixin {\n\n constructor(graph, position, options = {}) {\n\n super(graph, position, options);\n this.axes = [];\n this.position = position;\n this.constructorOptions = extend$1(true, {}, defaultAxisConstructorOptions, options);\n\n this._splitVal = [];\n }\n\n /**\n * Calls a callback onto each chunk axes. The callback receives two parameters: 1) the ```axis``` itself and 2) the ```index``` of the axis in the stack\n * @param {Function} callback - The callback to be applied to each axes\n * @return {SplitAxis} The current axis instance\n */\n all(callback) {\n\n if (!(typeof callback == 'function')) {\n return;\n }\n\n this.axes.map(callback);\n return this;\n }\n\n /**\n * Splits the axis into chunks at the positions defined as a list of parameters.\n * @param {Function} ...splits - The positions of axis splitting\n * @return {SplitAxis} The current axis instance\n * @example axis.splitAxis( 0.2, 0.5, 0.8 ); // Creates 4 chunks (0-20%, 20%-50%, 50%-80%, 80%-100%)\n */\n splitAxis(...splits) {\n\n splits.push(1);\n let splitNumber = splits.length;\n\n while (this.axes.length > splitNumber) {\n this.axes.pop().kill(true, true);\n }\n\n while (this.axes.length < splitNumber) {\n let axis = new (this.getConstructor())(this.graph, this.position, this.constructorOptions);\n this.axes.push(axis);\n axis.zoomLock = true;\n axis.init(this.graph, this.constructorOptions);\n }\n\n let from = 0;\n let i = 0;\n for (let axis of this.axes) {\n\n axis.options.marginMin = 10;\n axis.options.marginMax = 10;\n\n if (i == 0) {\n axis.options.marginMin = 0;\n }\n\n if (i == this.axes.length - 1) {\n axis.options.marginMax = 0;\n }\n\n axis.setSpan(from, from = splits[i]);\n axis.setMinMaxFlipped();\n i++;\n }\n\n this._splits = splits;\n return this;\n }\n\n /**\n * Fixes the major tick interval of all axes based on the one provided as a parameter\n * @param {Number} axisIndex - The index of the reference axis (starting at 0)\n * @return {SplitAxis} The current axis instance\n */\n fixGridIntervalBasedOnAxis(axisIndex) {\n\n this.fixGridFor = axisIndex;\n this.graph._axisHasChanged();\n return this;\n }\n\n /**\n * Spreads the chunks of the axis based on the relative interval of each one of them, so that the unit / px is constant for each chunk\n * @param {Boolean} bln - ```true``` to enable the spread, ```false``` otherwise\n * @return {SplitAxis} The current axis instance\n */\n splitSpread(bln) {\n this.autoSpread = !!bln;\n return this;\n }\n\n hasAxis(axis) {\n return this.axes.indexOf(axis) > -1;\n }\n\n _splitSpread() {\n\n let splits = [],\n total = 0,\n currentSplit = 0;\n //console.log( this._splitVal );\n for (let split of this._splitVal) {\n total += split[1] - split[0];\n }\n\n for (let split of this._splitVal) {\n\n splits.push(currentSplit += (split[1] - split[0]) / total);\n }\n\n splits.pop();\n this.splitAxis(...splits);\n }\n\n /**\n * Defines the boundaries of each chunk in axis unit.\n * @param {Array<(Array|Number)>} values - An array of either 2-component arrays (from-to) or number (mean)\n * @example axis.setChunkBoundaries( [ [ 12, 20 ], [ 100, 200 ] ] ); // First chunk from 12 to 20, second one from 100 to 200\n * @example axis.setChunkBoundaries( [ 12, [ 100, 200 ] ] ); // Second chunk from 100 to 200, first chunk with a mean at 12 and min / max determined by the relative widths of the chunks\n * @return {SplitAxis} The current axis instance\n */\n setChunkBoundaries(values) {\n\n let index = 0,\n baseWidth,\n baseWidthIndex;\n\n for (let axis of this.axes) {\n // List all axes\n\n // Two elements in the array => becomes the new reference\n if (Array.isArray(values[index]) && values[index].length > 1 && !baseWidth) {\n baseWidth = values[index][1] - values[index][0];\n baseWidthIndex = index;\n }\n\n if (values[index].length == 1 || !Array.isArray(values[index])) {\n axis._mean = values[index];\n\n if (Array.isArray(axis._mean)) {\n axis._mean = axis._mean[0];\n }\n } else {\n\n axis.forceMin(values[index][0]).forceMax(values[index][1]);\n }\n\n index++;\n }\n\n this._baseWidthVal = baseWidth;\n this._baseWidthIndex = baseWidthIndex;\n\n this._splitVal = values;\n\n this.graph._axisHasChanged();\n\n return this;\n }\n\n setMinMaxToFitSeries() {\n\n if (!this._splitVal || this._splitVal.length < 1) {\n super.setMinMaxToFitSeries(...arguments);\n this._splitVal[0] = this._splitVal[0] || [];\n this._splitVal[this._splitVal.length - 1] = this._splitVal[this._splitVal.length - 1] || [];\n\n this._splitVal[0][0] = this.getCurrentMin();\n this._splitVal[this._splitVal.length - 1][1] = this.getCurrentMax();\n this.setChunkBoundaries(this._splitVal);\n }\n }\n\n draw() {\n\n if (this.autoSpread) {\n this._splitSpread();\n }\n\n let max = 0;\n let unit;\n let subAxis;\n let spanReference;\n\n if (this._baseWidthIndex >= 0 && (subAxis = this.getSubAxis(this._baseWidthIndex))) {\n spanReference = subAxis.getSpan();\n }\n\n subAxis = undefined;\n\n if (this.fixGridFor >= 0 && (subAxis = this.getSubAxis(this.fixGridFor))) {\n\n if (subAxis._mean !== undefined) {\n let width = (subAxis.getSpan()[1] - subAxis.getSpan()[0]) / (spanReference[1] - spanReference[0]) * this._baseWidthVal;\n subAxis.forceMin(subAxis._mean - width / 2);\n subAxis.forceMax(subAxis._mean + width / 2);\n }\n\n max = subAxis.draw();\n unit = subAxis.getPrimaryTickUnit();\n }\n\n this.axes.map(axis => {\n\n if (subAxis === axis) {\n return;\n }\n\n if (axis._mean !== undefined) {\n let width = (axis.getSpan()[1] - axis.getSpan()[0]) / (spanReference[1] - spanReference[0]) * this._baseWidthVal;\n axis.forceMin(axis._mean - width / 2);\n axis.forceMax(axis._mean + width / 2);\n }\n\n if (unit) {\n axis.forcePrimaryTickUnit(unit);\n }\n\n max = Math.max(max, axis.draw());\n });\n\n // this.drawLabel();\n this.writeUnit();\n\n return max;\n }\n\n setMinPx(min) {\n\n super.setMinPx(min);\n for (let axis of this.axes) {\n axis.setMinPx(min);\n }\n }\n\n setMaxPx(max) {\n\n super.setMaxPx(max);\n\n for (let axis of this.axes) {\n axis.setMaxPx(max);\n }\n }\n\n setShift() {\n\n super.setShift(...arguments);\n\n for (let axis of this.axes) {\n axis.setShift(...arguments);\n }\n }\n\n init() {\n super.init(...arguments);\n this.splitAxis();\n }\n\n getAxisPosition() {\n var max = 0;\n\n this.axes.map(axis => {\n max = Math.max(max, axis.getAxisPosition());\n });\n\n return max;\n }\n\n getSubAxis(index) {\n\n if (this.axes.length <= index) {\n throw 'Impossible to reach axis. Index ' + index + ' is out of range';\n }\n\n return this.axes[index];\n }\n\n get splitNumber() {\n return this._splits.length;\n }\n };\n\n delegateMethods.map(methodName => {\n\n cl.prototype[methodName] = function (method) {\n\n return function () {\n //super[ method ]( ...arguments )\n\n this.axes.map(axis => {\n axis[method](...arguments);\n });\n return this;\n };\n }(methodName);\n });\n\n return cl;\n};\n\nclass SplitXAxis extends SplitAxis(AxisX) {\n\n constructor(graph, topbottom, options) {\n super(...arguments);\n this.topbottom = topbottom;\n }\n\n getConstructor() {\n return AxisX;\n }\n\n getAxisPosition() {\n var max = super.getAxisPosition(...arguments);\n\n this.labelPosY = max;\n\n if (this.getLabel()) {\n max += this.graph.options.fontSize;\n }\n\n return max;\n }\n\n drawLabel() {\n super.drawLabel();\n this.label.setAttribute('y', (this.top ? -1 : 1) * (this.graph.options.fontSize + this.labelPosY));\n }\n\n draw() {\n var height = super.draw(...arguments);\n this.drawLabel();\n return height;\n }\n\n}\n\nclass SplitYAxis extends SplitAxis(AxisY) {\n\n constructor(graph, leftright, options) {\n super(...arguments);\n ///this.leftright = leftright;\n }\n\n getConstructor() {\n return AxisY;\n }\n /*\n draw() {\n if ( this.getLabel() ) {\n this.axes.map( ( axis ) => {\n axis.setAxisPosition( this.graph.options.fontSize );\n } ); // Extra shift allowed for the label\n //this.setShift( this.graph.options.fontSize );\n }\n return super.draw( ...arguments );\n }\n */\n drawLabel() {\n super.drawLabel();\n }\n\n equalizePosition(width) {\n\n var widthAfter = width;\n\n if (this.getLabel()) {\n this.axes.map(axis => {\n widthAfter = Math.max(axis.equalizePosition(width), widthAfter);\n }); // Extra shift allowed for the label\n //this.setShift( this.graph.options.fontSize );\n }\n\n if (this.getLabel()) {\n this.placeLabel(this.left ? -widthAfter : widthAfter);\n return widthAfter + this.graph.options.fontSize;\n }\n }\n\n}\n\nmix(SplitXAxis, new AxisX());\nmix(SplitYAxis, new AxisY());\n\n/**\n * The intent of this plugin is to provide methods for the user to make the traces on the graph automatically different\n * Options to provide colorization, markers and line styles should be provided\n * @extends Plugin\n */\nclass PluginMakeTracesDifferent extends Plugin {\n\n constructor() {\n super(...arguments);\n }\n\n init(graph, options) {\n super.init(graph, options);\n }\n // Load this with defaults\n static default() {\n\n return {};\n }\n\n checkHSL(color) {\n\n let result = {},\n hue,\n saturation,\n lightness;\n\n if (hue = color.h || color.hue) {\n\n if (hue < 1) {\n hue = Math.round(hue * 360);\n }\n\n result.hue = hue;\n } else {\n result.h = 0;\n }\n\n if (saturation = color.s || color.saturation) {\n\n if (saturation > 1) {\n saturation /= 100;\n }\n\n result.saturation = saturation;\n } else {\n result.saturation = 0.75;\n }\n\n if (lightness = color.lightness || color.l) {\n\n if (lightness > 1) {\n lightness /= 100;\n }\n\n result.lightness = lightness;\n } else {\n result.lightness = 0.5;\n }\n\n return result;\n }\n\n buildHSLString(hsl) {\n return 'hsl( ' + Math.round(hsl.h) + ', ' + Math.round(hsl.s * 100) + '%, ' + Math.round(hsl.l * 100) + '%)';\n }\n\n colorizeAll(options) {\n\n let series, seriesLength;\n\n if (options.serieTypes) {\n\n if (!Array.isArray(options.serieTypes)) {\n options.serieTypes = [options.serieTypes];\n }\n\n series = this.graph.allSeries(...options.serieTypes);\n } else {\n series = this.graph.getSeries();\n }\n\n seriesLength = series.length;\n\n if (!options.startingColorHSL) {\n\n if (options.colorHSL) {\n options.startingColorHSL = this.checkHSL(options.colorHSL);\n } else {\n throw 'No starting color was provided. There must exist either options.colorHSL or options.startingColorHSL';\n }\n }\n\n if (!options.endingColorHSL) {\n\n if (!options.affect || !['h', 's', 'l', 'hue', 'saturation', 'lightness'].include(options.affect)) {\n options.affect = 'h';\n }\n\n switch (options.affect) {\n\n case 'h':\n case 'hue':\n options.endingColorHSL = {\n h: options.startingColorHSL.h + 300,\n s: options.startingColorHSL.s,\n l: options.startingColorHSL.l\n };\n break;\n\n case 'saturation':\n case 's':\n let endS;\n\n if (options.startingColorHSL.s > 0.5) {\n endS = 0;\n } else {\n endS = 1;\n }\n\n options.endingColorHSL = {\n h: options.startingColorHSL.h,\n s: endS,\n l: options.startingColorHSL.l\n };\n break;\n\n case 'lightness':\n case 'l':\n let endL;\n\n if (options.startingColorHSL.l > 0.5) {\n endL = 0;\n } else {\n endL = 0.75;\n }\n\n options.endingColorHSL = {\n h: options.startingColorHSL.h,\n s: options.startingColorHSL.s,\n l: endL\n };\n break;\n }\n } else {\n options.endingColorHSL = Object.assign({}, options.startingColorHSL, options.endingColorHSL);\n }\n\n return series.map((serie, index) => {\n\n if (!serie.setLineColor) {\n throw 'The serie ' + serie.getName() + ' does not implement the method `startingColor`';\n }\n\n const colorString = this.buildHSLString({\n h: options.startingColorHSL.h + index / (seriesLength - 1) * (options.endingColorHSL.h - options.startingColorHSL.h),\n s: options.startingColorHSL.s + index / (seriesLength - 1) * (options.endingColorHSL.s - options.startingColorHSL.s),\n l: options.startingColorHSL.l + index / (seriesLength - 1) * (options.endingColorHSL.l - options.startingColorHSL.l)\n });\n\n serie.setLineColor(colorString);\n return colorString;\n });\n }\n}\n\n/*\n What is it ?\n It is a plugin for automatic peak detection on a line serie\n\n How to use ?\n Basic usage:\n\n let graph = new Graph(\"dom\", {\n plugins: {\n 'peakPicking': {}\n }\n }\n );\n\n let wv = Graph.newWaveform();\n wv.setData( [ 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 ] );\n let s = graph.newSerie(\"serie\").setWaveform( wv ).autoAxis();\n\n graph.getPlugin('peakPicking').setSerie( s );\n graph.draw();\n*/\n\n/**\n * @extends Plugin\n */\nclass PluginPeakPicking extends Plugin {\n\n constructor() {\n super(...arguments);\n }\n\n static default() {\n\n return {\n autoPeakPicking: false,\n autoPeakPickingNb: 4,\n autoPeakPickingMinDistance: 10,\n autoPeakPickingFormat: false,\n autoPeakPickingAllowAllY: false\n };\n }\n\n init(graph, options) {\n\n super.init(graph, options);\n this.picks = [];\n\n for (var n = 0, m = this.options.autoPeakPickingNb; n < m; n++) {\n\n var shape = this.graph.newShape({\n type: 'label',\n label: {\n text: '',\n position: {\n x: 0\n },\n anchor: 'middle'\n\n },\n\n selectable: true,\n\n shapeOptions: {\n minPosY: 15\n }\n\n });\n\n shape.draw();\n\n this.picks.push(shape);\n }\n }\n\n setSerie(serie) {\n this.serie = serie;\n }\n\n serieRemoved(serie) {\n\n if (this.serie == serie) {\n this.picks.map(pick => {\n pick.kill();\n });\n }\n }\n\n preDraw() {\n\n if (!this.serie) {\n return;\n }\n\n this.detectedPeaks = [];\n this.lastYPeakPicking = false;\n }\n\n postDraw() {\n\n if (!this.serie) {\n return;\n }\n let lookForMaxima = true;\n let lookForMinima = false;\n let lastYPeakPicking;\n let peaks = [];\n\n let waveform = this.serie.getWaveform();\n\n if (!waveform) {\n throw 'The serie must have a waveform for the peak picking to work';\n }\n\n let length = waveform.getLength(),\n i = 0,\n y;\n\n for (; i < length; i++) {\n\n y = waveform.getY(i);\n\n if (this.serie.options.lineToZero) {\n peaks.push([waveform.getX(i), y]);\n continue;\n }\n\n if (!lastYPeakPicking) {\n lastYPeakPicking = [waveform.getX(i), y];\n continue;\n }\n\n if (y >= lastYPeakPicking[1] && lookForMaxima || y <= lastYPeakPicking[1] && lookForMinima) {\n\n lastYPeakPicking = [waveform.getX(i), y];\n } else if (y < lastYPeakPicking[1] && lookForMaxima || y > lastYPeakPicking[1] && lookForMinima) {\n\n if (lookForMinima) {\n lookForMinima = false;\n lookForMaxima = true;\n } else {\n\n lookForMinima = true;\n lookForMaxima = false;\n\n peaks.push(lastYPeakPicking);\n lastYPeakPicking = false;\n }\n\n lastYPeakPicking = [waveform.getX(i), y];\n }\n }\n\n var ys = peaks;\n var x,\n px,\n passed = [],\n px,\n l = ys.length,\n k,\n m,\n index;\n\n i = 0;\n\n var selected = this.graph.selectedShapes.map(function (shape) {\n return shape.getProp('xval');\n });\n\n ys.sort(function (a, b) {\n return b[1] - a[1];\n });\n\n m = 0;\n\n for (; i < l; i++) {\n\n x = ys[i][0];\n px = this.serie.getX(x);\n k = 0;\n y = this.serie.getY(ys[i][1]);\n\n if (px < this.serie.getXAxis().getMinPx() || px > this.serie.getXAxis().getMaxPx()) {\n continue;\n }\n\n if (!this.options.autoPeakPickingAllowAllY && (y > this.serie.getYAxis().getMinPx() || y < this.serie.getYAxis().getMaxPx())) {\n\n continue;\n }\n\n // Distance check\n for (; k < passed.length; k++) {\n if (Math.abs(passed[k] - px) < this.options.autoPeakPickingMinDistance) {\n break;\n }\n }\n if (k < passed.length) {\n continue;\n }\n\n // Distance check end\n\n // If the retained one has already been selected somewhere, continue;\n if ((index = selected.indexOf(x)) > -1) {\n passed.push(px);\n continue;\n }\n\n if (!this.picks[m]) {\n return;\n }\n\n //console.log( this.getYAxis().getDataMax(), this.getYAxis().getCurrentMin(), y );\n // this.picks[ m ].show();\n\n if (this.serie.getYAxis().getPx(ys[i][1]) - 20 < 0) {\n\n this.picks[m].setLabelPosition({\n x: x,\n y: '5px'\n });\n\n this.picks[m].setLabelBaseline('hanging');\n } else {\n\n this.picks[m].setLabelBaseline('no-change');\n\n this.picks[m].setLabelPosition({\n x: x,\n y: ys[i][1],\n dy: '-15px'\n });\n }\n\n this.picks[m].setProp('xval', x);\n\n if (this.options.autoPeakPickingFormat) {\n\n this.picks[m].setLabelText(this.options.autoPeakPickingFormat.call(this.picks[m], x, m));\n } else {\n this.picks[m].setLabelText(String(Math.round(x * 1000) / 1000));\n }\n\n this.picks[m].makeLabels();\n\n m++;\n while (this.picks[m] && this.picks[m].isSelected()) {\n m++;\n }\n\n if (passed.length == this.options.autoPeakPickingNb) {\n break;\n }\n }\n }\n\n /**\n * Hides the automatic peak picking (see the autoPeakPicking option)\n * @memberof SerieLine\n */\n hidePeakPicking(lock) {\n\n if (!this._hidePeakPickingLocked) {\n this._hidePeakPickingLocked = lock;\n }\n\n if (!this.graph.picks) {\n return;\n }\n for (var i = 0; i < this.graph.picks.length; i++) {\n this.graph.picks[i].hide();\n }\n }\n\n /**\n * Shows the automatic peak picking (see the autoPeakPicking option)\n * @memberof SerieLine\n */\n showPeakPicking(unlock) {\n\n if (this._hidePeakPickingLocked && !unlock) {\n return;\n }\n\n if (!this.graph.picks) {\n return;\n }\n\n for (var i = 0; i < this.graph.picks.length; i++) {\n this.graph.picks[i].show();\n }\n }\n\n killPeakPicking() {\n\n if (this.picks) {\n for (var i = 0, l = this.picks.length; i < l; i++) {\n this.picks[i].kill();\n }\n }\n }\n}\n\n// Corrent naming is important here !\n\nGraph$1.registerConstructor('graph.position', Position);\n\nGraph$1.registerConstructor('graph.axis.x', AxisX);\nGraph$1.registerConstructor('graph.axis.y', AxisY);\nGraph$1.registerConstructor('graph.axis.x.bar', AxisXBar);\nGraph$1.registerConstructor('graph.axis.x.time', GraphTimeAxis);\n\nGraph$1.registerConstructor('graph.serie.line', SerieLine);\nGraph$1.registerConstructor('graph.serie.line.3d', SerieLine3D);\nGraph$1.registerConstructor('graph.serie.line.color', SerieLineColor);\nGraph$1.registerConstructor('graph.serie.contour', SerieContour);\nGraph$1.registerConstructor('graph.serie.bar', SerieBar);\nGraph$1.registerConstructor('graph.serie.box', SerieBox);\nGraph$1.registerConstructor('graph.serie.scatter', SerieScatter);\nGraph$1.registerConstructor('graph.serie.zone', SerieZone);\nGraph$1.registerConstructor('graph.serie.zone.3d', SerieZone3D);\nGraph$1.registerConstructor('graph.serie.densitymap', SerieDensityMap);\n\nGraph$1.registerConstructor(Graph$1.SERIE_LINE, SerieLine);\nGraph$1.registerConstructor(Graph$1.SERIE_LINE_3D, SerieLine3D);\nGraph$1.registerConstructor(Graph$1.SERIE_LINE_COLORED, SerieLineColor);\nGraph$1.registerConstructor(Graph$1.SERIE_CONTOUR, SerieContour);\nGraph$1.registerConstructor(Graph$1.SERIE_BAR, SerieBar);\nGraph$1.registerConstructor(Graph$1.SERIE_BOX, SerieBox);\nGraph$1.registerConstructor(Graph$1.SERIE_SCATTER, SerieScatter);\nGraph$1.registerConstructor(Graph$1.SERIE_ZONE, SerieZone);\nGraph$1.registerConstructor(Graph$1.SERIE_ZONE_3D, SerieZone3D);\nGraph$1.registerConstructor(Graph$1.SERIE_DENSITYMAP, SerieDensityMap);\n\n//Graph.registerConstructor( \"graph.serie.line.broken\", GraphSerieLineBroken );\n\nGraph$1.registerConstructor('graph.plugin.shape', PluginShape);\nGraph$1.registerConstructor('graph.plugin.drag', PluginDrag);\nGraph$1.registerConstructor('graph.plugin.zoom', PluginZoom);\nGraph$1.registerConstructor('graph.plugin.selectScatter', PluginSelectScatter);\nGraph$1.registerConstructor('graph.plugin.timeSerieManager', PluginTimeSerieManager);\nGraph$1.registerConstructor('graph.plugin.serielinedifference', PluginSerieLineDifference);\nGraph$1.registerConstructor('graph.plugin.serieLineDifference', PluginSerieLineDifference);\nGraph$1.registerConstructor('graph.plugin.axissplitting', PluginAxisSplitting);\nGraph$1.registerConstructor('graph.plugin.makeTracesDifferent', PluginMakeTracesDifferent);\nGraph$1.registerConstructor('graph.plugin.peakPicking', PluginPeakPicking);\n\nGraph$1.registerConstructor('graph.shape', Shape);\nGraph$1.registerConstructor('graph.shape.areaundercurve', ShapeSurfaceUnderCurve);\nGraph$1.registerConstructor('graph.shape.arrow', ShapeArrow);\nGraph$1.registerConstructor('graph.shape.ellipse', ShapeEllipse);\nGraph$1.registerConstructor('graph.shape.label', ShapeLabel);\nGraph$1.registerConstructor('graph.shape.polyline', ShapePolyline);\nGraph$1.registerConstructor('graph.shape.line', ShapeLine);\nGraph$1.registerConstructor('graph.shape.nmrintegral', ShapeNMRIntegral);\nGraph$1.registerConstructor('graph.shape.html', ShapeHTML);\nGraph$1.registerConstructor('graph.shape.peakintegration2d', ShapePeakIntegration2D);\n// Graph.registerConstructor( \"graph.shape.peakinterval\", GraphShapePeakInterval );\n// Graph.registerConstructor( \"graph.shape.peakinterval2\", GraphShapePeakInterval2 );\n// Graph.registerConstructor( \"graph.shape.rangex\", GraphShapeRangeX );\nGraph$1.registerConstructor('graph.shape.rect', ShapeRectangle);\nGraph$1.registerConstructor('graph.shape.rectangle', ShapeRectangle);\nGraph$1.registerConstructor('graph.shape.cross', ShapeCross);\n//Graph.registerConstructor( \"graph.shape.zoom2d\", GraphShapeZoom2D );\nGraph$1.registerConstructor('graph.shape.peakboundariescenter', ShapePeakBoundaries);\n\n// Graph.registerConstructor( \"graph.toolbar\", GraphToolbar );\nGraph$1.registerConstructor('graph.legend', Legend);\nGraph$1.registerConstructor('graph.waveform', Waveform);\n\nexport default Graph$1;\n\n//# sourceMappingURL=jsgraph-module.js.map"]} \ No newline at end of file diff --git a/dist/jsgraph.js b/dist/jsgraph.js index 33478bd5b..ea783faf6 100644 --- a/dist/jsgraph.js +++ b/dist/jsgraph.js @@ -4533,13 +4533,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ var min = this.getBoundaryAxis(this.axis[axisvars[j]][i], 'min', usingZValues); var max = this.getBoundaryAxis(this.axis[axisvars[j]][i], 'max', usingZValues); - if (isFinite(min)) { - axis.setMinValueData(min); - } - if (isFinite(max)) { axis.setMaxValueData(max); } + if (isFinite(min)) { + axis.setMinValueData(min); + } } } } @@ -6792,7 +6791,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ try { util.setAttributeTo(this.dom, { - 'data-jsgraph-version': 'v2.0.71' + 'data-jsgraph-version': 'v2.0.72' }); } catch (e) { // ignore @@ -7601,15 +7600,15 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (typeof exports !== "undefined") { - factory(module, exports, require('./fit_lm.js'), require('./data_aggregator.js')); + factory(module, exports, require('./fit_lm'), require('extend')); } else { var mod = { exports: {} }; - factory(mod, mod.exports, global.fit_lm, global.data_aggregator); + factory(mod, mod.exports, global.fit_lm, global.extend); global.waveform = mod.exports; } -})(this, function (module, exports, _fit_lm, _data_aggregator) { +})(this, function (module, exports, _fit_lm, _extend) { 'use strict'; Object.defineProperty(exports, "__esModule", { @@ -7618,7 +7617,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ var _fit_lm2 = _interopRequireDefault(_fit_lm); - var _data_aggregator2 = _interopRequireDefault(_data_aggregator); + var _extend2 = _interopRequireDefault(_extend); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { @@ -7660,29 +7659,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ this.xOffset = xOffset; this.xScale = xScale; - - // Error bar handling - this.errors = { - - nb: 0, - - bars: { - above: null, - below: null - }, - - boxes: { - above: null, - below: null - } - }; - this.setData(data); - - this.BELOW = Waveform.BELOW; - this.ABOVE = Waveform.ABOVE; - this.BOX = Waveform.BOX; - this.BAR = Waveform.BAR; } /** [ [ x1, y1 ], [ x2, y2 ] ] */ @@ -7734,7 +7711,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ data.map(function (el, index) { - if (!nanable && Number.isNaN(el[0]) || Number.isNaN(el[1])) { + if (!nanable && (el[0] !== el[0] || el[1] !== el[1])) { warnNaN = true; } @@ -7754,9 +7731,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } }, { key: 'getY', - value: function getY(index) { - var optimized = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - + value: function getY(index, optimized) { if (optimized && this.dataInUse) { return this.dataInUse.y[index] * this.getScale() + this.getShift(); @@ -7773,7 +7748,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ if (Array.isArray(waveform)) { waveform = new Waveform(waveform); } else { - throw 'Cannot set X waveform. Data is not a valid array.'; + throw "Cannot set X waveform. Data is not a valid array."; } } @@ -7789,20 +7764,14 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ }, { key: 'getXWaveform', value: function getXWaveform() { - if (this.xdata) { return this.xdata; } - var wave = new Waveform(), - xs = []; + var wave = new Waveform(); for (var i = 0; i < this.getLength(); i += 1) { - xs.push(this.getX(i)); + wave.append(this.getX(i)); } - - wave.setData(xs); - - this.xdata = wave; return wave; } }, { @@ -7823,11 +7792,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ value: function setTypedArrayClass(constructor) { if (this.getTypedArrayClass() && this.isNaNAllowed() && !this.isNaNAllowed(constructor)) { - this.warn('NaN values are not allowed by the new constructor (' + constructor.name + ') while it was allowed by the previous one (' + this._typedArrayClass.name + ')'); + this.warn("NaN values are not allowed by the new constructor (" + constructor.name + ") while it was allowed by the previous one (" + this._typedArrayClass.name + ")"); } if (this.getTypedArrayClass() && this.isUnsigned() && !this.isUnsigned(constructor)) { - this.warn('You are switching from signed values to unsigned values. You may experience data corruption if there were some negative values.'); + this.warn("You are switching from signed values to unsigned values. You may experience data corruption if there were some negative values."); } this._typedArrayClass = constructor; @@ -7855,7 +7824,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ var constructor = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._typedArrayClass; - // The following types accept unsigned numbers + // The following types accept NaNs return constructor == Uint8Array || constructor == Uint8ClampedArray || constructor == Uint16Array || constructor == Uint32Array; } }, { @@ -7881,11 +7850,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ key: 'prepend', value: function prepend(x, y) { - if (typeof x == 'function') { + if (typeof x == "function") { x = x(this); } - if (typeof y == 'function') { + if (typeof y == "function") { y = y(this); } @@ -7906,15 +7875,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ key: 'append', value: function append(x, y) { - if (!this.data) { - this.data = []; - } - - if (typeof x == 'function') { + if (typeof x == "function") { x = x(this); } - if (typeof y == 'function') { + if (typeof y == "function") { y = y(this); } @@ -7926,9 +7891,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } if (this.monotoneous) { - if (y >= this.data[this.data.y] && this.getMonotoneousAscending() === false) { + if (y > this.data[this.data.y] && this.getMonotoneousAscending() === false) { this.monotoneous = false; - } else if (y <= this.data[this.data.y] && this.getMonotoneousAscending() === true) { + } else if (y < this.data[this.data.y] && this.getMonotoneousAscending() === true) { this.monotoneous = false; } } @@ -7961,10 +7926,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } }, { key: '_setData', - value: function _setData() { - var dataY = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.data; - - + value: function _setData(dataY) { var l = dataY.length; var i = 1, monoDir = dataY[1] > dataY[0], @@ -7989,25 +7951,8 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ this._monotoneousAscending = dataY[1] > dataY[0]; } - if (this.hasErrorBars()) { - // If prefer to loop again here - - for (i = 0; i < l; i++) { - - if (dataY[i] === dataY[i]) { - // NaN support - - minY = Math.min(minY, dataY[i] - this.getMaxError(i, 'below')); - maxY = Math.max(maxY, dataY[i] + this.getMaxError(i, 'above')); - } - } - - this.minY = minY; - this.maxY = maxY; - } else { - this.minY = minY; - this.maxY = maxY; - } + this.minY = minY; + this.maxY = maxY; this.data = dataY; @@ -8022,7 +7967,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return; } - if (!this.xdata) { + if (this.xdata) { + + this.minX = this.xdata.getMin(); + this.maxX = this.xdata.getMax(); + } else { var b1 = this.xOffset + this.xScale * this.getLength(), b2 = this.xOffset; @@ -8055,7 +8004,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ position = this.getIndexFromData(val, data, this.data.getMonotoneousAscending(), roundingMethod); - if (useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateY') { + if (useDataToUse && this.dataInUse && this.dataInUseType == "aggregateY") { // In case of aggregation, round to the closest element of 4. return position - position % 4; } @@ -8074,66 +8023,18 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ if (useDataToUse && this.dataInUse) { xdata = this.dataInUse.x; } else if (this.xdata) { - xdata = this.xdata.data; + xdata = this.xdata.getData(); } var position = void 0; if (this.hasXWaveform()) { - // The x value HAS to be rescaled position = this.xdata.getIndexFromData(xval, xdata, this.xdata.getMonotoneousAscending(), roundingMethod); } else { position = Math.max(0, Math.min(this.getLength() - 1, roundingMethod((xval - this.xOffset) / this.xScale))); } - if (useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateX') { - // In case of aggregation, round to the closest element of 4. - return position - position % 4; - } - - return position; - } - }, { - key: 'getIndexFromXY', - value: function getIndexFromXY(xval, yval) { - var useDataToUse = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var roundingMethod = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Math.round; - var scaleX = arguments[4]; - var scaleY = arguments[5]; - - - var xdata = void 0, - ydata = void 0; - - if (useDataToUse && this.dataInUse) { - - xdata = this.dataInUse.x; - ydata = this.dataInUse.y; - } else if (this.xdata) { - - xdata = this.xdata.data; - ydata = this.data; - } - - var position = void 0; - - if (this.isXMonotoneous()) { - // X lookup only - - if (this.hasXWaveform()) { - // The x value HAS to be rescaled - position = this.xdata.getIndexFromData(xval, xdata, this.xdata.getMonotoneousAscending(), roundingMethod); - } else { - position = Math.max(0, Math.min(this.getLength() - 1, roundingMethod((xval - this.xOffset) / this.xScale))); - } - } else if (!isNaN(yval)) { - - position = this.getIndexFromDataXY(xval, xdata, yval, ydata, scaleX, scaleY); - } else { - return; - } - - if (useDataToUse && this.dataInUse && this.dataInUseType == 'aggregateX') { + if (useDataToUse && this.dataInUse && this.dataInUseType == "aggregateX") { // In case of aggregation, round to the closest element of 4. return position - position % 4; } @@ -8142,38 +8043,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } }, { key: 'getIndexFromData', - value: function getIndexFromData(val, valCollection, isAscending) { - - var data = void 0, - position = void 0; - - val -= this.getShift(); - val /= this.getScale(); + value: function getIndexFromData(val, valCollection, isAscending, roundingMethod) { if (!this.isMonotoneous()) { console.trace(); - throw 'Impossible to get the index from a non-monotoneous wave !'; + throw "Impossible to get the index from a non-monotoneous wave !"; } - return binarySearch(val, valCollection, !isAscending); - } - }, { - key: 'getIndexFromDataXY', - value: function getIndexFromDataXY(valX, dataX, valY, dataY) { - var scaleX = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; - var scaleY = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1; - - var data = void 0, position = void 0; - valX -= this.getXShift(); - valX /= this.getXScale(); - - valY -= this.getShift(); - valY /= this.getScale(); + val -= this.getShift(); + val /= this.getScale(); - return euclidianSearch(valX, valY, dataX, dataY, scaleX, scaleY); + return binarySearch(val, valCollection, !isAscending); } }, { key: 'getReductionType', @@ -8183,12 +8066,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ }, { key: 'getXMin', value: function getXMin() { - return this.xdata ? this.xdata.getMin() : this.minX; + return this.minX * this.getXScale() + this.getXShift(); } }, { key: 'getXMax', value: function getXMax() { - return this.xdata ? this.xdata.getMax() : this.maxX; + return this.maxX * this.getXScale() + this.getXShift(); } }, { key: 'getYMin', @@ -8213,12 +8096,13 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ }, { key: 'getMinX', value: function getMinX() { - return this.getXMin(); + + return this.minX * this.getXScale() + this.getXShift(); } }, { key: 'getMaxX', value: function getMaxX() { - return this.getXMax(); + return this.maxX * this.getXScale() + this.getXShift(); } }, { key: 'getMinY', @@ -8274,6 +8158,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ // this.minY = ( this.minY - this.getShift() ) * scale; // this.maxY = ( this.maxY - this.getShift() ) * scale; this.scale = scale; + return this; } }, { key: 'setXShift', @@ -8281,7 +8166,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ var shift = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; - if (!this.hasXWaveform()) { + if (!this.hasXWaveform) { return this; } @@ -8294,7 +8179,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } }, { key: 'getXShift', - value: function getXShift(shift) { + value: function getXShift() { + var shift = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; + if (!this.hasXWaveform) { return 0; @@ -8328,9 +8215,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ }, { key: 'getLength', value: function getLength() { - if (!this.data) { - return 0; - } return this.data.length; } }, { @@ -8372,7 +8256,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return new Promise(function (resolver, rejector) { - var fit = new _fit_lm2.default(Object.assign({}, { + var fit = new _fit_lm2.default((0, _extend2.default)({}, { dataY: self, dataX: self.getXWaveform(), @@ -8515,7 +8399,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ key: 'requireMonotonicity', value: function requireMonotonicity() { if (!this.isMonotoneous()) { - throw 'The wave must be monotonic'; + throw "The wave must be monotonic"; } } }, { @@ -8536,7 +8420,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ key: 'invert', value: function invert(data) { - var d = data || this.data; + var d = dataY || this.data; d.reverse(); if (this.isMonotoneous()) { @@ -8575,11 +8459,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ var l = this.getLength(); if (!options.xPosition) { - throw 'No position calculation method provided'; + throw "No position calculation method provided"; } if (!options.resampleToPx) { - throw 'No "resampleToPx" method was provided. Unit: px per point'; + throw "No \"resampleToPx\" method was provided. Unit: px per point"; } if (options.minX > options.maxX) { @@ -8662,7 +8546,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ resampleMax = Math.max(resampleMax, dataY[i]); } - this.dataInUseType = 'resampled'; + this.dataInUseType = "resampled"; this.dataInUse = data; return dataMinMax; } @@ -8670,31 +8554,40 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ key: 'interpolate', value: function interpolate(x) { - var xIndex = void 0; var yData = this.getDataY(); - - x = (x - this.getXShift()) / this.getXScale(); + var xIndex = void 0; if (this.xdata) { - var xData = this.xdata.getData(), - _xIndex = binarySearch(x, xData, !this.xdata.getMonotoneousAscending()); - - if (xData[_xIndex] == x) { - return yData[_xIndex]; + var xData = this.xdata.getData(); + xIndex = binarySearch(x, xData, !this.xdata.getMonotoneousAscending()); + if (xData[xIndex] == x) { + return yData[xIndex]; } - return (x - xData[_xIndex]) / (xData[_xIndex + 1] - xData[_xIndex]) * (yData[_xIndex + 1] - yData[_xIndex]) + yData[_xIndex]; + return (x - xData[xIndex]) / (xData[xIndex + 1] - xData[xIndex]) * (yData[xIndex + 1] - yData[xIndex]) + yData[xIndex]; } else { xIndex = (x - this.xOffset) / this.xScale; var xIndexF = Math.floor(xIndex); return (xIndex - xIndexF) * (yData[xIndexF + 1] - yData[xIndexF]) + yData[xIndexF]; } } + }, { + key: 'interpolateIndex_X', + value: function interpolateIndex_X(index) { + + var yData = this.getDataY(); + if (this.xdata) { + var xData = this.xdata.getData(); + var indexStart = Math.floor(index); + + return (index - indexStart) * (xData[indexStart + 1] - xData[indexStart]) + xData[indexStart]; + } + } }, { key: 'getMonotoneousAscending', value: function getMonotoneousAscending() { if (!this.isMonotoneous()) { - return 'The waveform is not monotoneous'; + return "The waveform is not monotoneous"; } return this._monotoneousAscending; @@ -8887,12 +8780,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ var pow2 = pow2floor(this.getLength()); - this._dataAggregating = (0, _data_aggregator2.default)({ + this._dataAggregating = aggregator({ - minX: this.getMinX(), - maxX: this.getMaxX(), - minY: this.getMinY(), - maxY: this.getMaxY(), + minX: this.minX, + maxX: this.maxX, + minY: this.minY, + maxY: this.maxY, data: this.data, xdata: this.xdata ? this.xdata.getData() : undefined, xScale: this.xScale, @@ -8903,7 +8796,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ }).then(function (event) { _this._dataAggregated = event.aggregates; - console.log(_this._dataAggregated); _this._dataAggregating = false; }); } @@ -8926,14 +8818,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } */ - if (pxWidth > 2147483647) { - pxWidth = 2147483647; - } var level = pow2ceil(pxWidth); if (this._dataAggregated[level]) { - this.dataInUseType = 'aggregate' + this._dataAggregationDirection; + this.dataInUseType = "aggregate" + this._dataAggregationDirection; this.dataInUse = this._dataAggregated[level]; return; } else if (this._dataAggregating) { @@ -8941,7 +8830,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return this._dataAggregating; } - this.dataInUseType = 'none'; + this.dataInUseType = "none"; this.dataInUse = { y: this.data, x: this.getXWaveform().data @@ -9079,7 +8968,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ }, { key: 'getUnit', value: function getUnit() { - return this.unit || ''; + return this.unit || ""; } }, { key: 'getXUnit', @@ -9088,7 +8977,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return this.xdata.getUnit(); } - return this.xunit | ''; + return this.xunit | ""; } }, { key: 'hasXUnit', @@ -9104,7 +8993,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ key: 'findLevels', value: function findLevels(level, options) { - options = Object.assign({ + options = (0, _extend2.default)({ box: 1, edge: 'both', @@ -9118,7 +9007,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ var indices = []; var i = 0; - while (lvlIndex = this.findLevel(level, Object.assign({}, options, { + while (lvlIndex = this.findLevel(level, (0, _extend2.default)(true, {}, options, { rangeP: [lastLvlIndex, options.rangeP[1]] }))) { indices.push(lvlIndex); @@ -9136,7 +9025,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ key: 'findLevel', value: function findLevel(level, options) { - options = Object.assign({ + options = (0, _extend2.default)({ box: 1, edge: 'both', @@ -9158,7 +9047,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ box++; } - if (options.direction == 'descending') { + if (options.direction == "descending") { i = options.rangeP[1], l = options.rangeP[0], increment = -1; } else { i = options.rangeP[0], l = options.rangeP[1], increment = +1; @@ -9166,7 +9055,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ for (;; i += increment) { - if (options.direction == 'descending') { + if (options.direction == "descending") { if (i < l) { break; } @@ -9200,7 +9089,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ for (j = i + (box - 1) / 2; j >= i - (box - 1) / 2; j--) { - if (this.data[j] >= level && this.data[j - 1] < level) { + if (this.data[j] >= level && this.data[j - 1] <= level) { // Find a crossing switch (options.rounding) { @@ -9227,7 +9116,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ for (j = i + (box - 1) / 2; j >= i - (box - 1) / 2; j--) { - if (this.data[j] <= level && this.data[j - 1] > level) { + if (this.data[j] <= level && this.data[j - 1] >= level) { // Find a crossing switch (options.rounding) { @@ -9318,316 +9207,18 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ this.setData(this.data); } - }, { - key: 'setErrorBarX', - value: function setErrorBarX(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - xWave.setErrorBar(waveform); - return this; - } - }, { - key: 'setErrorBarXBelow', - value: function setErrorBarXBelow(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - xWave.setErrorBarBelow(waveform); - return this; - } - }, { - key: 'setErrorBarXAbove', - value: function setErrorBarXAbove(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - xWave.setErrorBarAbove(waveform); - return this; - } - }, { - key: 'setErrorBoxX', - value: function setErrorBoxX(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - xWave.setErrorBoxAbove(waveform); - xWave.setErrorBoxBelow(waveform); - return this; - } - }, { - key: 'setErrorBoxXBelow', - value: function setErrorBoxXBelow(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - - xWave.setErrorBoxBelow(waveform); - return this; - } - }, { - key: 'setErrorBoxXAbove', - value: function setErrorBoxXAbove(waveform) { - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - var xWave = this.getXWaveform(); - xWave.setErrorBoxAbove(waveform); - return this; - } - }, { - key: 'setErrorBar', - value: function setErrorBar(waveform) { - var checkMinMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - this.errors.nb++; - this.errors.nb++; - this.errors.bars.bottom = waveform; - this.errors.bars.top = waveform; - - if (checkMinMax) { - this._setData(); - } - } - }, { - key: 'setErrorBarBelow', - value: function setErrorBarBelow(waveform) { - var checkMinMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - this.errors.nb++; - this.errors.bars.below = waveform; - - if (checkMinMax) { - this._setData(); - } - } - }, { - key: 'setErrorBarAbove', - value: function setErrorBarAbove(waveform) { - var checkMinMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - this.errors.nb++; - this.errors.bars.above = waveform; - - if (checkMinMax) { - this._setData(); - } - } - }, { - key: 'setErrorBox', - value: function setErrorBox(waveform) { - var checkMinMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - this.errors.nb++; - this.errors.nb++; - this.errors.boxes.above = waveform; - this.errors.boxes.below = waveform; - - if (checkMinMax) { - this._setData(); - } - } - }, { - key: 'setErrorBoxBelow', - value: function setErrorBoxBelow(waveform) { - var checkMinMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - this.errors.nb++; - this.errors.boxes.below = waveform; - - if (checkMinMax) { - this._setData(); - } - } - }, { - key: 'setErrorBoxAbove', - value: function setErrorBoxAbove(waveform) { - var checkMinMax = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - - - if (Array.isArray(waveform)) { - waveform = new Waveform(waveform); - } - - this.errors.boxes.above = waveform; - if (checkMinMax) { - this._setData(); - } - } - }, { - key: 'getMaxError', - value: function getMaxError(i) { - var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Waveform.ABOVE; - - - return Math.max(this.getMaxErrorType(i, side, Waveform.BOX), this.getMaxErrorType(i, side, Waveform.BAR)); - } - }, { - key: 'getMaxErrorType', - value: function getMaxErrorType(i) { - var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Waveform.ABOVE; - var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Waveform.BOX; - - - var stack = void 0; - if (type == Waveform.BOX) { - stack = this.errors.boxes; - } else if (type == Waveform.BAR) { - stack = this.errors.bars; - } else { - throw 'Unknown type of error'; - } - - var waveform = void 0; - if (!(waveform = stack[side])) { - if (side == Waveform.ABOVE) { - if (stack[side] == Waveform.BELOW) { - waveform = stack.below; - } - } else { - if (stack[side] == Waveform.ABOVE) { - waveform = stack.above; - } - } - } - - if (!waveform) { - return 0; - } - - return waveform.getY(i); - } - }, { - key: 'getErrorBarXBelow', - value: function getErrorBarXBelow(index) { - return this.getErrorX(index, Waveform.BELOW, Waveform.BAR); - } - }, { - key: 'getErrorBarXAbove', - value: function getErrorBarXAbove(index) { - return this.getErrorX(index, Waveform.ABOVE, Waveform.BAR); - } - }, { - key: 'getErrorBoxXBelow', - value: function getErrorBoxXBelow(index) { - return this.getErrorX(index, Waveform.BELOW, Waveform.BOX); - } - }, { - key: 'getErrorBoxXAbove', - value: function getErrorBoxXAbove(index) { - return this.getErrorX(index, Waveform.ABOVE, Waveform.BOX); - } - }, { - key: 'getErrorBarYBelow', - value: function getErrorBarYBelow(index) { - return this.getError(index, Waveform.BELOW, Waveform.BAR); - } - }, { - key: 'getErrorBarYAbove', - value: function getErrorBarYAbove(index) { - return this.getError(index, Waveform.ABOVE, Waveform.BAR); - } - }, { - key: 'getErrorBoxYBelow', - value: function getErrorBoxYBelow(index) { - return this.getError(index, Waveform.BELOW, Waveform.BOX); - } - }, { - key: 'getErrorBoxYAbove', - value: function getErrorBoxYAbove(index) { - return this.getError(index, Waveform.ABOVE, Waveform.BOX); - } - }, { - key: 'getErrorX', - value: function getErrorX(index) { - var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Waveform.ABOVE; - var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Waveform.BAR; - - - if (!this.hasXWaveform()) { - return false; - } - - return this.xdata.getError(index, side, type); - } - }, { - key: 'getError', - value: function getError(index) { - var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Waveform.ABOVE; - var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : Waveform.BAR; - - - var errors = type == Waveform.BAR ? this.errors.bars : this.errors.boxes; - - if (!errors) { - return false; - } - - var wave = void 0; - if (wave = side == Waveform.ABOVE ? errors.above : errors.below) { - - if (wave == Waveform.ABOVE && side == Waveform.BELOW) { - wave = errors.above; - } else if (wave == Waveform.BELOW && side == Waveform.ABOVE) { - wave = errors.below; - } - - if (!wave) { - return false; - } - - return wave.getY(index); - } - } - }, { - key: 'hasErrorBars', - value: function hasErrorBars() { - - return this.errors.nb > 0 || this.hasXWaveform() && this.xdata.errors.nb > 0; - } }]); return Waveform; }(); + ; + + var MULTIPLY = Symbol(); + var ADD = Symbol(); + var SUBTRACT = Symbol(); + var DIVIDE = Symbol(); + // http://stackoverflow.com/questions/26965171/fast-nearest-power-of-2-in-javascript function pow2ceil(v) { v--; @@ -9652,30 +9243,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return (value - valueBefore) / (valueAfter - valueBefore) * (indexAfter - indexBefore) + indexBefore; } - function euclidianSearch(targetX, targetY, haystackX, haystackY) { - var scaleX = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1; - var scaleY = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1; - - - var distance = Number.MAX_VALUE, - distance_i = void 0; - - var index = -1; - - for (var i = 0, l = haystackX.length; i < l; i++) { - - distance_i = Math.pow((targetX - haystackX[i]) * scaleX, 2) + Math.pow((targetY - haystackY[i]) * scaleY, 2); - - if (distance_i < distance) { - - index = i; - distance = distance_i; - } - } - - return index; - } - function binarySearch(target, haystack, reverse) { var seedA = 0, @@ -9696,7 +9263,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ while (true) { i++; if (i > 100) { - throw 'Error loop'; + throw "Error loop"; } seedInt = Math.floor((seedA + seedB) / 2); @@ -9741,19 +9308,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } } - Waveform.BELOW = Symbol(); - Waveform.ABOVE = Symbol(); - - Waveform.BOX = Symbol(); - Waveform.BAR = Symbol(); - - var MULTIPLY = Symbol(); - var ADD = Symbol(); - var SUBTRACT = Symbol(); - var DIVIDE = Symbol(); - - //module.exports = Waveform; - exports.default = Waveform; module.exports = exports['default']; }); @@ -10131,27 +9685,16 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ return _this; } - _createClass(SerieLine, [{ - key: 'setWaveform', - value: function setWaveform(waveform) { - - if (!(waveform instanceof _waveform2.default)) { - throw 'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance'; - } - - this.waveform = waveform; - - this.minX = this.waveform.getXMin(); - this.maxX = this.waveform.getXMax(); - this.minY = this.waveform.getMin(); - this.maxY = this.waveform.getMax(); + /** + * Sets the options of the serie + * @see SerieLineDefaultOptions + * @param {Object} options - A object containing the options to set + * @return {SerieLine} The current serie + * @memberof SerieLine + */ - this.graph.updateDataMinMaxAxes(); - this.dataHasChanged(); - return this; - } - }, { + _createClass(SerieLine, [{ key: 'setOptions', value: function setOptions(options) { this.options = util.extend(true, {}, SerieLine.prototype.defaults, options || {}); @@ -13115,7 +12658,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ value: function setWaveform(waveform) { if (!(waveform instanceof _waveform2.default)) { - throw 'Cannot assign waveform to serie. Waveform is not of the proper Waveform instance'; + console.trace(); + console.error(waveform); + throw new Error('Cannot assign waveform to serie. Waveform is not of the proper Waveform instance'); } this.waveform = waveform; @@ -14222,8 +13767,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ // 25.10.2017. This is to help in the case there's no autoscaling if (isNaN(this.getCurrentMin())) { - this.setCurrentMin(this.getMinValue()); - this.cache(); + //this.setCurrentMin( this.getMinValue() ); + //this.cache(); + } } }, { @@ -14232,9 +13778,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ this.dataMax = max; // 25.10.2017. This is to help in the case there's no autoscaling + // 02.02.2018. Don't agree with this. Next time, put a link to show the use of this piece of code if (isNaN(this.getCurrentMax())) { - this.setCurrentMax(this.getMaxValue()); - this.cache(); + // this.setCurrentMax( this.getMaxValue() ); + //this.cache(); + } } }, { @@ -14590,7 +14138,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ if (val === undefined || this.getForcedMin() !== false && (val < this.getForcedMin() || val === undefined)) { val = this.getMinValue(); } - this.currentAxisMin = val; if (this.options.logScale) { this.currentAxisMin = Math.max(1e-50, val); @@ -15260,6 +14807,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ // Ex 50 / (100) * (1000 - 700) + 700 //console.log( value, this.getCurrentMin(), this.getMaxPx(), this.getMinPx(), this.getCurrentInterval() ); + if (!this.options.logScale) { return (value - this.getCurrentMin()) / this.getCurrentInterval() * (this.getMaxPx() - this.getMinPx()) + this.getMinPx(); @@ -17654,20 +17202,20 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } if (this.moving) { - + console.log(this._data); // If the pos2 is defined by a delta, no need to move them - if (pos.x) { + if (pos.x && !this._data.noX) { pos.deltaPosition('x', deltaX, this.getXAxis()); } - if (pos.y) { + if (pos.y && !this._data.noY) { pos.deltaPosition('y', deltaY, this.getYAxis()); } // If the pos2 is defined by a delta, no need to move them - if (pos2.x) { + if (pos2.x && !this._data.noX) { pos2.deltaPosition('x', deltaX, this.getXAxis()); } - if (pos2.y) { + if (pos2.y && !this._data.noY) { pos2.deltaPosition('y', deltaY, this.getYAxis()); } } @@ -26480,260 +26028,94 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ /* 319 */ /***/ (function(module, exports, __webpack_require__) { -var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) { - if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [module, exports], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), - __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? - (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - } else if (typeof exports !== "undefined") { - factory(module, exports); - } else { - var mod = { - exports: {} - }; - factory(mod, mod.exports); - global.data_aggregator = mod.exports; - } -})(this, function (module, exports) { - 'use strict'; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - var dataAggregator; - - if (typeof URL === 'undefined' || typeof URL.createObjectURL === 'undefined' || typeof Blob === 'undefined' || typeof Worker === 'undefined') { - dataAggregator = function dataAggregator() {}; - } else { - var aggregatorWorker; - var queue = {}; - - var string = function () { - - onmessage = function onmessage(e) { - - var data = e.data.data, - // The initial data - maxX = e.data.maxX, - minX = e.data.minX, - maxY = e.data.maxY, - minY = e.data.minY, - direction = e.data.direction; - - var numPoints = e.data.numPoints; // Total number of points in the slot - var l = data.length; // Number of data in the original buffer - var i = 0; - var k = -4; - var slots = []; - var dataAggregatedX = []; - var dataAggregatedY = []; - var aggregationSum = []; - var getX = void 0; - var slotNumber = void 0; - var lastAggregationX = void 0; - var lastAggregation = void 0; - var lastAggregationSum = void 0; - var newAggregation = void 0; - var newAggregationX = void 0; - - if (e.data.xdata) { - - getX = function getX(index) { - return e.data.xdata[index]; - }; - } else { - getX = function getX(index) { - return index * e.data.xScale + e.data.xOffset; - }; - } - - var aggregations = {}; - - // Direction x - if (direction == 'x') { - var dataPerSlot = numPoints / (maxX - minX); // Computed number of aggregation per slot - - for (; i < l; i++) { - - // dataPerSlot: 1 / 1000 ( compression by 1'000 ) - //console.log( dataPerSlot, getX( i ) ); - slotNumber = Math.floor((getX(i) - minX) * dataPerSlot); - - if (slots[k] !== slotNumber) { - k += 4; - slots[k] = slotNumber; - - var slotX = (slotNumber + 0.5) / dataPerSlot + minX; - - dataAggregatedX[k] = slotX; - dataAggregatedX[k + 1] = slotX; - dataAggregatedX[k + 2] = slotX; - dataAggregatedX[k + 3] = slotX; - - dataAggregatedY[k] = data[i]; - dataAggregatedY[k + 1] = data[i]; - dataAggregatedY[k + 2] = data[i]; - dataAggregatedY[k + 3] = data[i]; - aggregationSum[k] = 0; - } - - dataAggregatedY[k + 1] = Math.min(data[i], dataAggregatedY[k + 1]); - dataAggregatedY[k + 2] = Math.max(data[i], dataAggregatedY[k + 2]); - dataAggregatedY[k + 3] = data[i]; - aggregationSum[k] += data[i]; - } - } else { - // y - - var _dataPerSlot = numPoints / (maxY - minY); // Computed number of aggregation per slot - - for (; i < l; i++) { - - // dataPerSlot: 1 / 1000 ( compression by 1'000 ) - //console.log( dataPerSlot, getX( i ) ); - slotNumber = Math.floor((data[i] - minY) * _dataPerSlot); - - if (slots[k] !== slotNumber) { - k += 4; - slots[k] = slotNumber; - - var slotY = (slotNumber + 0.5) / _dataPerSlot + minY; - - dataAggregatedY[k] = slotY; - dataAggregatedY[k + 1] = slotY; - dataAggregatedY[k + 2] = slotY; - dataAggregatedY[k + 3] = slotY; - - dataAggregatedX[k] = data[i]; - dataAggregatedX[k + 1] = data[i]; - dataAggregatedX[k + 2] = data[i]; - dataAggregatedX[k + 3] = data[i]; - aggregationSum[k] = 0; - } - dataAggregatedX[k + 1] = Math.min(getX(i), dataAggregatedX[k + 1]); - dataAggregatedX[k + 2] = Math.max(getX(i), dataAggregatedX[k + 2]); - dataAggregatedX[k + 3] = getX(i); - aggregationSum[k] += getX(i); - } - } - - aggregations[numPoints] = { - x: dataAggregatedX, - y: dataAggregatedY, - sums: aggregationSum - }; - - lastAggregation = dataAggregatedY; - lastAggregationX = dataAggregatedX; - lastAggregationSum = aggregationSum; - - while (numPoints > 256) { - - numPoints /= 2; - - newAggregation = []; - newAggregationX = []; - - k = 0; - - if (direction == 'x') { - - for (i = 0, l = lastAggregation.length - 8; i < l; i += 8) { - - newAggregationX[k] = (lastAggregationX[i] + lastAggregationX[i + 4]) / 2; - newAggregationX[k + 1] = newAggregationX[k]; - newAggregationX[k + 2] = newAggregationX[k]; - newAggregationX[k + 3] = newAggregationX[k]; - - newAggregation[k] = lastAggregation[i]; - newAggregation[k + 1] = Math.min(lastAggregation[i + 1], lastAggregation[i + 5]); - newAggregation[k + 2] = Math.max(lastAggregation[i + 2], lastAggregation[i + 6]); - newAggregation[k + 3] = lastAggregation[i + 7]; - - aggregationSum[k] = (lastAggregationSum[i] + lastAggregationSum[i + 4]) / 2; - - k += 4; - } - } else { - - for (i = 0, l = lastAggregation.length - 8; i < l; i += 8) { - - newAggregation[k] = (lastAggregation[i] + lastAggregation[i + 4]) / 2; - newAggregation[k + 1] = newAggregation[k]; - newAggregation[k + 2] = newAggregation[k]; - newAggregation[k + 3] = newAggregation[k]; - - newAggregationX[k] = lastAggregationX[i]; - newAggregationX[k + 1] = Math.min(lastAggregationX[i + 1], lastAggregationX[i + 5]); - newAggregationX[k + 2] = Math.max(lastAggregationX[i + 2], lastAggregationX[i + 6]); - newAggregationX[k + 3] = lastAggregationX[i + 7]; - - aggregationSum[k] = (lastAggregationSum[i] + lastAggregationSum[i + 4]) / 2; - - k += 4; - } - } - - aggregations[numPoints] = { - x: newAggregationX, - y: newAggregation, - sums: aggregationSum - }; - - lastAggregation = newAggregation; - lastAggregationX = newAggregationX; - lastAggregationSum = aggregationSum; - - aggregationSum = []; - } - - postMessage({ - aggregates: aggregations, - _queueId: e.data._queueId - }); - }; - }.toString(); +"use strict"; - string = string.replace(/^\s*function\s*\(\s*\)\s*\{/, ''); - string = string.replace(/}\s*$/, ''); - /* - if ( typeof URL == "undefined" ) { - module.exports = function() {}; - } else { - */ - var workerUrl = URL.createObjectURL(new Blob([string], { - type: 'application/javascript' - })); +var hasOwn = Object.prototype.hasOwnProperty; +var toStr = Object.prototype.toString; - aggregatorWorker = new Worker(workerUrl); +var isArray = function isArray(arr) { + if (typeof Array.isArray === 'function') { + return Array.isArray(arr); + } - aggregatorWorker.onmessage = function (e) { + return toStr.call(arr) === '[object Array]'; +}; - var id = e.data._queueId; - delete e.data._queueId; - queue[id](e.data); - delete queue[id]; - }; +var isPlainObject = function isPlainObject(obj) { + if (!obj || toStr.call(obj) !== '[object Object]') { + return false; + } - dataAggregator = function dataAggregator(toOptimize) { + var hasOwnConstructor = hasOwn.call(obj, 'constructor'); + var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); + // Not own constructor property must be Object + if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { + return false; + } - var requestId = Date.now(); - toOptimize._queueId = requestId; + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + var key; + for (key in obj) { /**/ } - var prom = new Promise(function (resolver) { - queue[requestId] = resolver; - }); + return typeof key === 'undefined' || hasOwn.call(obj, key); +}; - aggregatorWorker.postMessage(toOptimize); - return prom; - }; - } +module.exports = function extend() { + var options, name, src, copy, copyIsArray, clone; + var target = arguments[0]; + var i = 1; + var length = arguments.length; + var deep = false; + + // Handle a deep copy situation + if (typeof target === 'boolean') { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { + target = {}; + } + + for (; i < length; ++i) { + options = arguments[i]; + // Only deal with non-null/undefined values + if (options != null) { + // Extend the base object + for (name in options) { + src = target[name]; + copy = options[name]; + + // Prevent never-ending loop + if (target !== copy) { + // Recurse if we're merging plain objects or arrays + if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { + if (copyIsArray) { + copyIsArray = false; + clone = src && isArray(src) ? src : []; + } else { + clone = src && isPlainObject(src) ? src : {}; + } + + // Never move original objects, clone them + target[name] = extend(deep, clone, copy); + + // Don't bring in undefined values + } else if (typeof copy !== 'undefined') { + target[name] = copy; + } + } + } + } + } + + // Return the modified object + return target; +}; - exports.default = dataAggregator; - module.exports = exports['default']; -}); /***/ }), /* 320 */ @@ -32800,7 +32182,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ } this.setHandles();*/ - this.ratioLabel && this.updateIntegralValue(this.ratioLabel) || this.updateLabels(); + this.serie.ratioLabel && this.updateIntegralValue(this.serie.ratioLabel) || this.updateLabels(); this.changed(); this.handleCondition = !this.xor(incrementation == -1, flipped); @@ -32813,21 +32195,21 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ }, { key: 'updateIntegralValue', value: function updateIntegralValue() { - var ratioLabel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.ratioLabel; + var ratioLabel = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.serie.ratioLabel; var forceValue = arguments[1]; - + console.log(ratioLabel); if (ratioLabel) { - this.ratioLabel = ratioLabel; + this.serie.ratioLabel = ratioLabel; } - if (forceValue !== undefined) { - this.ratioLabel = forceValue / this.sumVal; + if (!isNaN(forceValue) && !isNaN(this.sumVal) && this.sumVal) { + this.serie.ratioLabel = forceValue / this.sumVal; } this.setLabelText(ratioLabel ? (Math.round(100 * this.sumVal * ratioLabel) / 100).toPrecision(3) : 'N/A', 0); this.updateLabels(); - return this.ratioLabel; + return this.serie.ratioLabel; } }, { key: 'getAxis', diff --git a/dist/jsgraph.min.js b/dist/jsgraph.min.js index f68431f92..9d10dc94d 100644 --- a/dist/jsgraph.min.js +++ b/dist/jsgraph.min.js @@ -1,3 +1,3 @@ -/*! jsGraph (c) 2014 Norman Pellet, MIT license, v@2.0.71, Date: 2018-01-27T22:52Z */ +/*! jsGraph (c) 2014 Norman Pellet, MIT license, v@2.0.72, Date: 2018-03-03T17:59Z */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Graph=e():t.Graph=e()}("undefined"!=typeof self?self:this,function(){return function(t){function e(n){if(i[n])return i[n].exports;var r=i[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var i={};return e.m=t,e.c=i,e.d=function(t,i,n){e.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:n})},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=133)}([function(t,e,i){var n=i(2),r=i(27),s=i(12),o=i(13),a=i(28),u="prototype",h=function(t,e,i){var l,c,f,p,d=t&h.F,g=t&h.G,y=t&h.S,v=t&h.P,m=t&h.B,x=g?n:y?n[e]||(n[e]={}):(n[e]||{})[u],b=g?r:r[e]||(r[e]={}),k=b[u]||(b[u]={});g&&(i=e);for(l in i)f=((c=!d&&x&&void 0!==x[l])?x:i)[l],p=m&&c?a(f,n):v&&"function"==typeof f?a(Function.call,f):f,x&&o(x,l,f,t&h.U),b[l]!=f&&s(b,l,p),v&&k[l]!=f&&(k[l]=f)};n.core=r,h.F=1,h.G=2,h.S=4,h.P=8,h.B=16,h.W=32,h.U=64,h.R=128,t.exports=h},function(t,e,i){var n=i(5);t.exports=function(t){if(!n(t))throw TypeError(t+" is not an object!");return t}},function(t,e){var i=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,i){var n,r,s;!function(i,o){r=[e],void 0!==(s="function"==typeof(n=o)?n.apply(e,r):n)&&(t.exports=s)}(0,function(t){"use strict";function e(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}function i(t,e){return t._savedAttributes&&void 0!==t._savedAttributes[e]}function n(t,e){if(t&&t._savedAttributesIds){t._savedAttributesIds.splice(t._savedAttributesIds.indexOf(e),1),delete t._attributes[e];var i={};for(var n in t._savedAttributes)i[n]=t._savedAttributes[n];for(var n=0,r=t._savedAttributesIds.length;n=0},t.hue2rgb=e,t.hslToRgb=function(t,i,n){var r,s,o;if(0==i)r=s=o=n;else{var a=n<.5?n*(1+i):n+i-n*i,u=2*n-a;r=e(u,a,t+1/3),s=e(u,a,t),o=e(u,a,t-1/3)}return[Math.round(255*r),Math.round(255*s),Math.round(255*o)]},t.saveDomAttributes=function(t,e,i){if(t){t._savedAttributesIds=t._savedAttributesIds||[],t._savedAttributesIds.indexOf(i)>-1&&n(t,i),t._savedAttributes=t._savedAttributes||{},t._attributes=t._attributes||{},t._attributes[i]=e,t._savedAttributesIds.push(i);for(var r in e)t._savedAttributes[r]||(t._savedAttributes[r]=t.getAttribute(r)),t.setAttribute(r,e[r])}},t.hasSavedAttribute=i,t.overwriteDomAttribute=function(t,e,n){i(t,e)&&(t._savedAttributes[e]=n)},t.restoreDomAttributes=n,t.debounce=function(t,e,i){var n;return function(){var r=this,s=arguments,o=i&&!n;clearTimeout(n),n=setTimeout(function(){n=null,i||t.apply(r,s)},e),o&&t.apply(r,s)}},t.SVGParser=function(t){return(new DOMParser).parseFromString(t,"image/svg+xml")},t.reverseArray=function(t){var e=null,i=null;for(e=0,i=t.length-1;e0?r(n(t),9007199254740991):0}},function(t,e,i){var n=i(20);t.exports=function(t){return Object(n(t))}},function(t,e){var i={}.hasOwnProperty;t.exports=function(t,e){return i.call(t,e)}},function(t,e,i){var n=i(8),r=i(31);t.exports=i(7)?function(t,e,i){return n.f(t,e,r(1,i))}:function(t,e,i){return t[e]=i,t}},function(t,e,i){var n=i(2),r=i(12),s=i(11),o=i(34)("src"),a="toString",u=Function[a],h=(""+u).split(a);i(27).inspectSource=function(t){return u.call(t)},(t.exports=function(t,e,i,a){var u="function"==typeof i;u&&(s(i,"name")||r(i,"name",e)),t[e]!==i&&(u&&(s(i,o)||r(i,o,t[e]?""+t[e]:h.join(String(e)))),t===n?t[e]=i:a?t[e]?t[e]=i:r(t,e,i):(delete t[e],r(t,e,i)))})(Function.prototype,a,function(){return"function"==typeof this&&this[o]||u.call(this)})},function(t,e){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,e,i){var n=i(51),r=i(20);t.exports=function(t){return n(r(t))}},function(t,e,i){var n=i(0),r=i(3),s=i(20),o=/"/g,a=function(t,e,i,n){var r=String(s(t)),a="<"+e;return""!==i&&(a+=" "+i+'="'+String(n).replace(o,""")+'"'),a+">"+r+""};t.exports=function(t,e){var i={};i[t]=e(a),n(n.P+n.F*r(function(){var e=""[t]('"');return e!==e.toLowerCase()||e.split('"').length>3}),"String",i)}},function(t,e,i){var n=i(52),r=i(31),s=i(15),o=i(22),a=i(11),u=i(99),h=Object.getOwnPropertyDescriptor;e.f=i(7)?h:function(t,e){if(t=s(t),e=o(e,!0),u)try{return h(t,e)}catch(t){}if(a(t,e))return r(!n.f.call(t,e),t[e])}},function(t,e,i){var n=i(11),r=i(10),s=i(72)("IE_PROTO"),o=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=r(t),n(t,s)?t[s]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?o:null}},function(t,e){var i={}.toString;t.exports=function(t){return i.call(t).slice(8,-1)}},function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,e,i){var n=i(3);t.exports=function(t,e){return!!t&&n(function(){e?t.call(null,function(){},1):t.call(null)})}},function(t,e,i){var n=i(5);t.exports=function(t,e){if(!n(t))return t;var i,r;if(e&&"function"==typeof(i=t.toString)&&!n(r=i.call(t)))return r;if("function"==typeof(i=t.valueOf)&&!n(r=i.call(t)))return r;if(!e&&"function"==typeof(i=t.toString)&&!n(r=i.call(t)))return r;throw TypeError("Can't convert object to primitive value")}},function(t,e,i){var n=i(0),r=i(27),s=i(3);t.exports=function(t,e){var i=(r.Object||{})[t]||Object[t],o={};o[t]=e(i),n(n.S+n.F*s(function(){i(1)}),"Object",o)}},function(t,e,i){var n=i(28),r=i(51),s=i(10),o=i(9),a=i(225);t.exports=function(t,e){var i=1==t,u=2==t,h=3==t,l=4==t,c=6==t,f=5==t||c,p=e||a;return function(e,a,d){for(var g,y,v=s(e),m=r(v),x=n(a,d,3),b=o(m.length),k=0,M=i?p(e,b):u?p(e,0):void 0;b>k;k++)if((f||k in m)&&(g=m[k],y=x(g,k,v),t))if(i)M[k]=y;else if(y)switch(t){case 3:return!0;case 5:return g;case 6:return k;case 2:M.push(g)}else if(l)return!1;return c?-1:h||l?l:M}}},function(t,e,i){var n,r,s;!function(o,a){r=[t,e,i(54),i(4),i(55)],void 0!==(s="function"==typeof(n=a)?n.apply(e,r):n)&&(t.exports=s)}(0,function(t,e,i,n,r){"use strict";function s(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=s(i),a=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e.default=t,e}(n),u=s(r),h=function(){function t(t,e){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:0;return this.setProp("labelText",t,e),this}},{key:"setLabelData",value:function(t,e){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.setProp("labelData",e,i),this}},{key:"getLabelText",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.getProp("labelText",e)}},{key:"displayLabel",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.setProp("labelVisible",!0,t),this}},{key:"hideLabel",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.setProp("labelVisible",!1,t),this}},{key:"setLabelColor",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.setProp("labelColor",t,e),this}},{key:"setLabelFontSize",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.setProp("labelFontSize",t,e),this}},{key:"getLabelPosition",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.getProp("labelPosition",t)}},{key:"setLabelPosition",value:function(t,e){var i=o.default.check(t,function(t){return(void 0).getRelativePosition(t)});return this.setProp("labelPosition",i,e||0),this}},{key:"setLabelAngle",value:function(t,e){return this.setProp("labelAngle",t,e||0),this}},{key:"setLabelBaseline",value:function(t,e){return this.setProp("labelBaseline",t,e||0),this}},{key:"setLabelAnchor",value:function(t,e){return this.setProp("labelAnchor",t,e||0),this}},{key:"setLabelSize",value:function(t,e){return this.setProp("labelSize",t,e||0),this}},{key:"setLabelStrokeColor",value:function(t,e){return this.setProp("labelStrokeColor",t,e||0),this}},{key:"setLabelStrokeWidth",value:function(t,e){return this.setProp("labelStrokeWidth",t,e||0),this}},{key:"setLabelBackgroundColor",value:function(t,e){return this.setProp("labelBackgroundColor",t,e||0),this}},{key:"setLabelBackgroundOpacity",value:function(t,e){return this.setProp("labelBackgroundOpacity",t,e||0),this}},{key:"applyGenericStyle",value:function(){this.setDom("fill",this.getProp("fillColor"),!0),this.setDom("fill-opacity",this.getProp("fillOpacity"),!0),this.setDom("stroke",this.getProp("strokeColor"),!0),this.setDom("stroke-width",this.getProp("strokeWidth"),!0),this.setDom("stroke-dasharray",this.getProp("strokeDasharray"),!0);for(var t=this.getProps("attributes"),e=0,i=t.length;e0)){for(var s=1,o=t;s<=o;s++)(function(t){var s=r,o=document.createElementNS(s.graph.ns,e);if(o.jsGraphIsShape=!0,i)for(var a in i)o.setAttribute(a,i[a]);o.addEventListener("mousedown",function(e){s.isResizable()&&(e.preventDefault(),e.stopPropagation(),s.graph.emit("beforeShapeResize",s),r.emit("beforeShapeResize"),s.graph.prevent(!1)||(s.resizing=!0,s.handleSelected=t,s.handleMouseDown(e)))}),n&&n(s.handles[t]),s.handles[t]=o}).call(this,s);return this.handles}}},{key:"createHandles",value:function(){this.hasStaticHandles()&&(this.addHandles(),this.setHandles())}},{key:"handleMouseDownImpl",value:function(){}},{key:"handleMouseMoveImpl",value:function(){}},{key:"handleMouseUpImpl",value:function(){}},{key:"handleCreateImpl",value:function(){}},{key:"handleMouseDown",value:function(t){if(!this.isLocked())return(this.isMovable()||this.isResizable())&&this.graph.elementMoving(this),this.getProp("selectOnMouseDown")&&this.graph.selectShape(this),this.isMovable()&&(this.resizing||(this.graph.emit("beforeShapeMove",self),this.graph.prevent(!1)||(this.moving=!0,this.moved=!1))),this._mouseCoords=this.graph._getXY(t),this.handleMouseDownImpl(t,this._mouseCoords)}},{key:"handleClick",value:function(t){if(this.graph.emit("shapeClicked",this),this.emit("shapeClicked"),!this.isSelectable())return!1;t.shiftKey||this.graph.unselectShapes(),this.getProp("selectOnClick")&&this.graph.selectShape(this)}},{key:"handleMouseMove",value:function(t){if(!this.resizing&&!this.moving||this.isSelected()||this.graph.selectShape(this),this.graph.emit("beforeShapeMouseMove",this),this.emit("beforeShapeMouseMove"),this.graph.prevent(!1)||!this._mouseCoords)return!1;this.moved=!0;var e=this.graph._getXY(t),i=this.getXAxis().getRelVal(e.x-this._mouseCoords.x),n=this.getYAxis().getRelVal(e.y-this._mouseCoords.y);0==i&&0===n||(this.preventUnselect=!0),this._mouseCoords=e;return this.handleMouseMoveImpl(t,i,n,e.x-this._mouseCoords.x,e.y-this._mouseCoords.y)}},{key:"handleMouseUp",value:function(t){return this.moving&&this.moved&&(this.graph.emit("shapeMoved",this),this.emit("shapeMoved")),(this.handleSelected||this.resize)&&(this.graph.emit("shapeResized",this),this.emit("shapeResized")),this.moving=!1,this.resizing=!1,this.handleSelected=!1,this.graph.elementMoving(!1),this.handleMouseUpImpl(t)}},{key:"handleDblClick",value:function(t){}},{key:"handleMouseOver",value:function(){this.getProp("highlightOnMouseOver")&&(this.moving||this.resizing||this.highlight()),this.graph.emit("shapeMouseOver",this)}},{key:"handleMouseOut",value:function(){this.getProp("highlightOnMouseOver")&&this.unHighlight(),this.graph.emit("shapeMouseOut",this)}},{key:"lock",value:function(){return this.setProp("locked",!0),this}},{key:"unlock",value:function(){return this.setProp("locked",!1),this}},{key:"isLocked",value:function(){return this.getProp("locked")||this.graph.shapesLocked}},{key:"movable",value:function(t){this.setProp("movable",!0)}},{key:"unmovable",value:function(){return this.setProp("movable",!1),!1}},{key:"isMovable",value:function(){return this.getProp("movable")}},{key:"resizable",value:function(){this.setProp("resizable",!0)}},{key:"unresizable",value:function(){this.setProp("resizable",!1)}},{key:"isResizable",value:function(){return this.getProp("resizable")}},{key:"selectable",value:function(){this.setProp("selectable",!0)}},{key:"unselectable",value:function(){this.graph.unselectShape(this),this.setProp("selectable",!1)}},{key:"isSelectable",value:function(){return this.getProp("selectable")}},{key:"highlight",value:function(t,e){return t||(t=this.getHighlightAttributes()),e||(e="highlight"),a.saveDomAttributes(this._dom,t,e),this.highlightImpl(),this}},{key:"unHighlight",value:function(t){return t||(t="highlight"),a.restoreDomAttributes(this._dom,t),this.unHighlightImpl(),this}},{key:"highlightImpl",value:function(){}},{key:"unHighlightImpl",value:function(){}},{key:"getHighlightAttributes",value:function(){return this._highlightAttributes}},{key:"setHighlightAttributes",value:function(t){return this._highlightAttributes=t,this}},{key:"getMaskingID",value:function(){return this.maskingId}},{key:"maskWith",value:function(t){var e=t.getMaskingID();e?this._dom.setAttribute("mask","url(#"+e+")"):this._dom.removeAttribute("mask")}},{key:"updateMask",value:function(){return}},{key:"labelDblClickListener",value:function(t){var e=parseInt(t.target.getAttribute("data-label-i")),i=this;if(!isNaN(e)&&this.isLabelEditable(e)){t.preventDefault(),t.stopPropagation();var n=document.createElement("input");n.setAttribute("type","text"),n.setAttribute("value",i.getProp("labelText",e)),i.graph.wrapper.prepend(n),n.select(),a.setCSS(n,{position:"absolute",marginTop:parseInt(t.target.getAttribute("y").replace("px",""))+this.graph.getPaddingTop()-10+"px",marginLeft:parseInt(t.target.getAttribute("x").replace("px",""))+this.graph.getPaddingLeft()-50+"px",textAlign:"center",width:"100px"});var r=i.getLabelText(e),s=function t(){i.setLabelText(n.value,e),i._labels[e].textContent=n.value;var s=n.value;n.remove(),n.removeEventListener("blur",t),n=!1,i.changed("shapeLabelChanged",{previousValue:r,nextValue:s})};n.addEventListener("blur",s),n.addEventListener("keyup",function(t){13===t.keyCode&&s()}),n.addEventListener("keypress",function(t){t.stopPropagation()}),n.addEventListener("keydown",function(t){t.stopPropagation()}),n.focus()}}},{key:"appendToDom",value:function(){return this._forcedParentDom?this._forcedParentDom.appendChild(this.group):this.graph.appendShapeToDom(this),this}},{key:"forceParentDom",value:function(t){return this._forcedParentDom=t,this}},{key:"isHTML",value:function(){return!1}}]),e}();l.prototype.computePosition=l.prototype.calculatePosition,l.prototype.showLabel=l.prototype.displayLabel,l.prototype.remove=l.prototype.kill,e.default=l,t.exports=e.default})},function(t,e,i){var n,r,s;!function(o,a){r=[t,e,i(55)],void 0!==(s="function"==typeof(n=a)?n.apply(e,r):n)&&(t.exports=s)}(0,function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t){return t&&t.__esModule?t:{default:t}}(i),r=function(){function t(t,e){for(var i=0;ii;)r[i]=e[i++];return r},jt=function(t,e,i){R(t,e,{get:function(){return this._d[i]}})},It=function(t){var e,i,n,r,s,o,a=M(t),u=arguments.length,l=u>1?arguments[1]:void 0,c=void 0!==l,f=P(a);if(void 0!=f&&!A(f)){for(o=f.call(a),n=[],e=0;!(s=o.next()).done;e++)n.push(s.value);a=n}for(c&&u>2&&(l=h(l,arguments[2],2)),e=0,i=g(a.length),r=Tt(this,i);i>e;e++)r[e]=c?l(a[e],e):a[e];return r},Nt=function(){for(var t=0,e=arguments.length,i=Tt(this,e);e>t;)i[t]=arguments[t++];return i},Yt=!!V&&s(function(){vt.call(new V(1))}),Ft=function(){return vt.apply(Yt?gt.call(Et(this)):Et(this),arguments)},Bt={copyWithin:function(t,e){return Y.call(Et(this),t,e,arguments.length>2?arguments[2]:void 0)},every:function(t){return it(Et(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return N.apply(Et(this),arguments)},filter:function(t){return Xt(this,tt(Et(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return nt(Et(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return rt(Et(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){$(Et(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return ot(Et(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return st(Et(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return pt.apply(Et(this),arguments)},lastIndexOf:function(t){return lt.apply(Et(this),arguments)},map:function(t){return wt(Et(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return ct.apply(Et(this),arguments)},reduceRight:function(t){return ft.apply(Et(this),arguments)},reverse:function(){for(var t,e=Et(this).length,i=Math.floor(e/2),n=0;n1?arguments[1]:void 0)},sort:function(t){return dt.call(Et(this),t)},subarray:function(t,e){var i=Et(this),n=i.length,r=y(t,n);return new(T(i,i[kt]))(i.buffer,i.byteOffset+r*i.BYTES_PER_ELEMENT,g((void 0===e?n:y(e,n))-r))}},Rt=function(t,e){return Xt(this,gt.call(Et(this),t,e))},Ht=function(t){Et(this);var e=Lt(arguments[1],1),i=this.length,n=M(t),r=g(n.length),s=0;if(r+e>i)throw W(St);for(;s255?255:255&n),r.v[d](i*e+r.o,n,Pt)}(this,i,t)},enumerable:!0})};x?(y=i(function(t,i,n,r){l(t,y,h,"_d");var s,o,a,u,c=0,p=0;if(k(i)){if(!(i instanceof J||(u=b(i))==U||u==G))return At in i?Dt(y,i):It.call(y,i);s=i,p=Lt(n,e);var d=i.byteLength;if(void 0===r){if(d%e)throw W(St);if((o=d-p)<0)throw W(St)}else if((o=g(r)*e)+p>d)throw W(St);a=o/e}else a=Ot(i,!0),s=new J(o=a*e);for(f(t,"_d",{b:s,o:p,l:o,e:a,v:new Q(s)});c0?n:i)(t)}},function(t,e){var i=0,n=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++i+n).toString(36))}},function(t,e){t.exports=!1},function(t,e,i){var n=i(101),r=i(73);t.exports=Object.keys||function(t){return n(t,r)}},function(t,e,i){var n=i(33),r=Math.max,s=Math.min;t.exports=function(t,e){return(t=n(t))<0?r(t+e,0):s(t,e)}},function(t,e,i){var n=i(1),r=i(102),s=i(73),o=i(72)("IE_PROTO"),a=function(){},u=function(){var t,e=i(70)("iframe"),n=s.length;for(e.style.display="none",i(75).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("