| @@ -0,0 +1,258 @@ | ||
| 'use strict'; | ||
|
|
||
| import H from '../parts/Globals.js'; | ||
| import '../parts/Utilities.js'; | ||
|
|
||
| var each = H.each, | ||
| merge = H.merge, | ||
| isArray = H.isArray, | ||
| defined = H.defined, | ||
| SMA = H.seriesTypes.sma; | ||
|
|
||
| // Utils: | ||
| function minInArray(arr, index) { | ||
| return H.reduce(arr, function (min, target) { | ||
| return Math.min(min, target[index]); | ||
| }, Infinity); | ||
| } | ||
|
|
||
| function maxInArray(arr, index) { | ||
| return H.reduce(arr, function (min, target) { | ||
| return Math.max(min, target[index]); | ||
| }, 0); | ||
| } | ||
|
|
||
| H.seriesType('stochastic', 'sma', | ||
| /** | ||
| * Stochastic oscillator. This series requires the `linkedTo` option to be | ||
| * set and should be loaded after the `stock/indicators/indicators.js` file. | ||
| * | ||
| * @extends {plotOptions.sma} | ||
| * @product highstock | ||
| * @sample {highstock} stock/indicators/stochastic | ||
| * Stochastic oscillator | ||
| * @since 6.0.0 | ||
| * @optionparent plotOptions.stochastic | ||
| */ | ||
| { | ||
| name: 'Stochastic (14, 3)', | ||
| /** | ||
| * @excluding index,period | ||
| */ | ||
| params: { | ||
| /** | ||
| * Periods for Stochastic oscillator: [%K, %D]. | ||
| * | ||
| * @default [14, 3] | ||
| * @type {Array} | ||
| * @since 6.0.0 | ||
| * @product highstock | ||
| */ | ||
| periods: [14, 3] | ||
| }, | ||
| marker: { | ||
| enabled: false | ||
| }, | ||
| tooltip: { | ||
| pointFormat: '<span style="color:{point.color}">\u25CF</span><b> {series.name}</b><br/>%K: {point.y}<br/>%D: {point.smoothed}<br/>' | ||
| }, | ||
| /** | ||
| * Smoothed line options. | ||
| * | ||
| * @since 6.0.0 | ||
| * @product highstock | ||
| */ | ||
| smoothedLine: { | ||
| /** | ||
| * Styles for a smoothed line. | ||
| * | ||
| * @since 6.0.0 | ||
| * @product highstock | ||
| */ | ||
| styles: { | ||
| /** | ||
| * Pixel width of the line. | ||
| * | ||
| * @type {Number} | ||
| * @since 6.0.0 | ||
| * @product highstock | ||
| */ | ||
| lineWidth: 1, | ||
| /** | ||
| * Color of the line. If not set, it's inherited from | ||
| * [plotOptions.stochastic.color]( | ||
| * #plotOptions.stochastic.color). | ||
| * | ||
| * @type {String} | ||
| * @since 6.0.0 | ||
| * @product highstock | ||
| */ | ||
| lineColor: undefined | ||
| } | ||
| }, | ||
| dataGrouping: { | ||
| approximation: 'averages' | ||
| } | ||
| }, /** @lends Highcharts.Series.prototype */ { | ||
| nameComponents: ['periods'], | ||
| nameBase: 'Stochastic', | ||
| pointArrayMap: ['y', 'smoothed'], | ||
| parallelArrays: ['x', 'y', 'smoothed'], | ||
| pointValKey: 'y', | ||
| init: function () { | ||
| SMA.prototype.init.apply(this, arguments); | ||
|
|
||
| // Set default color for lines: | ||
| this.options = merge({ | ||
| smoothedLine: { | ||
| styles: { | ||
| lineColor: this.color | ||
| } | ||
| } | ||
| }, this.options); | ||
| }, | ||
| toYData: function (point) { | ||
| return [point.y, point.smoothed]; | ||
| }, | ||
| translate: function () { | ||
| var indicator = this; | ||
|
|
||
| SMA.prototype.translate.apply(indicator); | ||
|
|
||
| each(indicator.points, function (point) { | ||
| if (point.smoothed !== null) { | ||
| point.plotSmoothed = indicator.yAxis.toPixels( | ||
| point.smoothed, | ||
| true | ||
| ); | ||
| } | ||
| }); | ||
| }, | ||
| drawGraph: function () { | ||
| var indicator = this, | ||
| mainLinePoints = indicator.points, | ||
| pointsLength = mainLinePoints.length, | ||
| mainLineOptions = indicator.options, | ||
| mainLinePath = indicator.graph, | ||
| gappedExtend = { | ||
| options: { | ||
| gapSize: mainLineOptions.gapSize | ||
| } | ||
| }, | ||
| smoothing = [], | ||
| point; | ||
|
|
||
| // Generate points for %K and %D lines: | ||
| while (pointsLength--) { | ||
| point = mainLinePoints[pointsLength]; | ||
| smoothing.push({ | ||
| plotX: point.plotX, | ||
| plotY: point.plotSmoothed, | ||
| isNull: !defined(point.plotSmoothed) | ||
| }); | ||
| } | ||
|
|
||
| // Modify options and generate smoothing line: | ||
| indicator.points = smoothing; | ||
| indicator.options = merge( | ||
| mainLineOptions.smoothedLine.styles, | ||
| gappedExtend | ||
| ); | ||
| indicator.graph = indicator.graphSmoothed; | ||
| SMA.prototype.drawGraph.call(indicator); | ||
| indicator.graphSmoothed = indicator.graph; | ||
|
|
||
| // Restore options and draw a main line: | ||
| indicator.points = mainLinePoints; | ||
| indicator.options = mainLineOptions; | ||
| indicator.graph = mainLinePath; | ||
| SMA.prototype.drawGraph.call(indicator); | ||
| }, | ||
| getValues: function (series, params) { | ||
| var periodK = params.periods[0], | ||
| periodD = params.periods[1], | ||
| xVal = series.xData, | ||
| yVal = series.yData, | ||
| yValLen = yVal ? yVal.length : 0, | ||
| SO = [], // 0- date, 1-%K, 2-%D | ||
| xData = [], | ||
| yData = [], | ||
| slicedY, | ||
| close = 3, | ||
| low = 2, | ||
| high = 1, | ||
| CL, HL, LL, K, | ||
| D = null, | ||
| points, | ||
| i; | ||
|
|
||
|
|
||
| // Stochastic requires close value | ||
| if ( | ||
| xVal.length < periodK || | ||
| !isArray(yVal[0]) || | ||
| yVal[0].length !== 4 | ||
| ) { | ||
| return false; | ||
| } | ||
|
|
||
| // For a N-period, we start from N-1 point, to calculate Nth point | ||
| // That is why we later need to comprehend slice() elements list | ||
| // with (+1) | ||
| for (i = periodK - 1; i < yValLen; i++) { | ||
| slicedY = yVal.slice(i - periodK + 1, i + 1); | ||
|
|
||
| // Calculate %K | ||
| LL = minInArray(slicedY, low); // Lowest low in %K periods | ||
| CL = yVal[i][close] - LL; | ||
| HL = maxInArray(slicedY, high) - LL; | ||
| K = CL / HL * 100; | ||
|
|
||
| // Calculate smoothed %D, which is SMA of %K | ||
| if (i >= periodK + periodD) { | ||
| points = SMA.prototype.getValues.call(this, { | ||
| xData: xData.slice(i - periodD - periodK, i - periodD), | ||
| yData: yData.slice(i - periodD - periodK, i - periodD) | ||
| }, { | ||
| period: periodD | ||
| }); | ||
| D = points.yData[0]; | ||
| } | ||
|
|
||
| SO.push([xVal[i], K, D]); | ||
| xData.push(xVal[i]); | ||
| yData.push([K, D]); | ||
| } | ||
|
|
||
| return { | ||
| values: SO, | ||
| xData: xData, | ||
| yData: yData | ||
| }; | ||
| } | ||
| } | ||
| ); | ||
|
|
||
| /** | ||
| * A Stochastic indicator. If the [type](#series.stochastic.type) option is not | ||
| * specified, it is inherited from [chart.type](#chart.type). | ||
| * | ||
| * @type {Object} | ||
| * @since 6.0.0 | ||
| * @extends series,plotOptions.stochastic | ||
| * @excluding data,dataParser,dataURL | ||
| * @product highstock | ||
| * @apioption series.stochastic | ||
| */ | ||
|
|
||
| /** | ||
| * An array of data points for the series. For the `stochastic` series type, | ||
| * points are calculated dynamically. | ||
| * | ||
| * @type {Array<Object|Array>} | ||
| * @since 6.0.0 | ||
| * @extends series.line.data | ||
| * @product highstock | ||
| * @apioption series.stochastic.data | ||
| */ | ||
|
|
| @@ -0,0 +1,183 @@ | ||
| /** | ||
| * (c) 2010-2017 Paweł Dalek | ||
| * | ||
| * Volume Weighted Average Price (VWAP) indicator for Highstock | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import H from '../parts/Globals.js'; | ||
| import '../parts/Utilities.js'; | ||
|
|
||
| var isArray = H.isArray, | ||
| seriesType = H.seriesType; | ||
|
|
||
| /** | ||
| * The Volume Weighted Average Price (VWAP) series type. | ||
| * | ||
| * @constructor seriesTypes.vwap | ||
| * @augments seriesTypes.sma | ||
| */ | ||
| seriesType('vwap', 'sma', | ||
| /** | ||
| * Volume Weighted Average Price indicator. | ||
| * | ||
| * This series requires `linkedTo` option to be set. | ||
| * | ||
| * @extends {plotOptions.sma} | ||
| * @product highstock | ||
| * @sample {highstock} stock/indicators/vwap | ||
| * Volume Weighted Average Price indicator | ||
| * @since 6.0.0 | ||
| * @optionparent plotOptions.vwap | ||
| */ | ||
| { | ||
| /** | ||
| * @excluding index | ||
| */ | ||
| params: { | ||
| period: 30, | ||
| /** | ||
| * The id of volume series which is mandatory. For example using | ||
| * OHLC data, volumeSeriesID='volume' means the indicator will be | ||
| * calculated using OHLC and volume values. | ||
| * | ||
| * @type {String} | ||
| * @since 6.0.0 | ||
| * @product highstock | ||
| */ | ||
| volumeSeriesID: 'volume' | ||
| } | ||
| }, { | ||
| /** | ||
| * Returns the final values of the indicator ready to be presented on a | ||
| * chart | ||
| * @returns {Object} Object containing computed VWAP | ||
| **/ | ||
| getValues: function (series, params) { | ||
| var indicator = this, | ||
| chart = series.chart, | ||
| xValues = series.xData, | ||
| yValues = series.yData, | ||
| period = params.period, | ||
| isOHLC = true, | ||
| volumeSeries; | ||
|
|
||
| // Checks if volume series exists | ||
| if (!(volumeSeries = chart.get(params.volumeSeriesID))) { | ||
| return H.error( | ||
| 'Series ' + | ||
| params.volumeSeriesID + | ||
| ' not found! Check `volumeSeriesID`.', | ||
| true | ||
| ); | ||
| } | ||
|
|
||
| // Checks if series data fits the OHLC format | ||
| if (!(isArray(yValues[0]))) { | ||
| isOHLC = false; | ||
| } | ||
|
|
||
| return indicator.calculateVWAPValues( | ||
| isOHLC, | ||
| xValues, | ||
| yValues, | ||
| volumeSeries, | ||
| period | ||
| ); | ||
| }, | ||
| /** | ||
| * Main algorithm used to calculate Volume Weighted Average Price (VWAP) | ||
| * values | ||
| * @param {Boolean} isOHLC says if data has OHLC format | ||
| * @param {Array} xValues array of timestamps | ||
| * @param {Array} yValues | ||
| * array of yValues, can be an array of a four arrays (OHLC) or | ||
| * array of values (line) | ||
| * @param {Array} volumeSeries volume series | ||
| * @param {Number} period number of points to be calculated | ||
| * @returns {Object} Object contains computed VWAP | ||
| **/ | ||
| calculateVWAPValues: function ( | ||
| isOHLC, | ||
| xValues, | ||
| yValues, | ||
| volumeSeries, | ||
| period | ||
| ) { | ||
| var volumeValues = volumeSeries.yData, | ||
| volumeLength = volumeSeries.xData.length, | ||
| pointsLength = xValues.length, | ||
| cumulativePrice = [], | ||
| cumulativeVolume = [], | ||
| xData = [], | ||
| yData = [], | ||
| VWAP = [], | ||
| commonLength, | ||
| typicalPrice, | ||
| cPrice, | ||
| cVolume, | ||
| i, | ||
| j; | ||
|
|
||
| if (pointsLength <= volumeLength) { | ||
| commonLength = pointsLength; | ||
| } else { | ||
| commonLength = volumeLength; | ||
| } | ||
|
|
||
| for (i = 0, j = 0; i < commonLength; i++) { | ||
| // Depending on whether series is OHLC or line type, price is | ||
| // average of the high, low and close or a simple value | ||
| typicalPrice = isOHLC ? | ||
| ((yValues[i][1] + yValues[i][2] + yValues[i][3]) / 3) : | ||
| yValues[i]; | ||
| typicalPrice *= volumeValues[i]; | ||
|
|
||
| cPrice = j ? | ||
| (cumulativePrice[i - 1] + typicalPrice) : | ||
| typicalPrice; | ||
| cVolume = j ? | ||
| (cumulativeVolume[i - 1] + volumeValues[i]) : | ||
| volumeValues[i]; | ||
|
|
||
| cumulativePrice.push(cPrice); | ||
| cumulativeVolume.push(cVolume); | ||
|
|
||
| VWAP.push([xValues[i], (cPrice / cVolume)]); | ||
| xData.push(VWAP[i][0]); | ||
| yData.push(VWAP[i][1]); | ||
|
|
||
| j++; | ||
|
|
||
| if (j === period) { | ||
| j = 0; | ||
| } | ||
| } | ||
|
|
||
| return { | ||
| values: VWAP, | ||
| xData: xData, | ||
| yData: yData | ||
| }; | ||
| } | ||
| }); | ||
|
|
||
| /** | ||
| * A `Volume Weighted Average Price (VWAP)` series. If the | ||
| * [type](#series.vwap.type) option is not specified, it is inherited from | ||
| * [chart.type](#chart.type). | ||
| * | ||
| * @type {Object} | ||
| * @since 6.0.0 | ||
| * @extends series,plotOptions.vwap | ||
| * @excluding data,dataParser,dataURL | ||
| * @product highstock | ||
| * @apioption series.vwap | ||
| */ | ||
|
|
||
| /** | ||
| * @extends series.sma.data | ||
| * @product highstock | ||
| * @apioption series.vwap.data | ||
| */ |
| @@ -0,0 +1,139 @@ | ||
| /** | ||
| * (c) 2010-2017 Kacper Madej | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
|
|
||
| 'use strict'; | ||
| import H from '../parts/Globals.js'; | ||
| import '../parts/Utilities.js'; | ||
|
|
||
| var isArray = H.isArray, | ||
| seriesType = H.seriesType; | ||
|
|
||
| // Utils: | ||
| function accumulateAverage(points, xVal, yVal, i, index) { | ||
| var xValue = xVal[i], | ||
| yValue = index < 0 ? yVal[i] : yVal[i][index]; | ||
|
|
||
| points.push([xValue, yValue]); | ||
| } | ||
|
|
||
| function weightedSumArray(array, pLen) { | ||
| // The denominator is the sum of the number of days as a triangular number. | ||
| // If there are 5 days, the triangular numbers are 5, 4, 3, 2, and 1. | ||
| // The sum is 5 + 4 + 3 + 2 + 1 = 15. | ||
| var denominator = (pLen + 1) / 2 * pLen; | ||
|
|
||
| // reduce VS loop => reduce | ||
| return array.reduce(function (prev, cur, i) { | ||
| return [null, prev[1] + cur[1] * (i + 1)]; | ||
| })[1] / denominator; | ||
| } | ||
|
|
||
| function populateAverage(points, xVal, yVal, i) { | ||
| var pLen = points.length, | ||
| wmaY = weightedSumArray(points, pLen), | ||
| wmaX = xVal[i - 1]; | ||
|
|
||
| points.shift(); // remove point until range < period | ||
|
|
||
| return [wmaX, wmaY]; | ||
| } | ||
|
|
||
| /** | ||
| * The SMA series type. | ||
| * | ||
| * @constructor seriesTypes.wma | ||
| * @augments seriesTypes.sma | ||
| */ | ||
| seriesType('wma', 'sma', | ||
| /** | ||
| * Weighted moving average indicator (WMA). This series requires `linkedTo` | ||
| * option to be set. | ||
| * | ||
| * @extends {plotOptions.sma} | ||
| * @product highstock | ||
| * @sample {highstock} stock/indicators/wma | ||
| * Weighted moving average indicator | ||
| * @since 6.0.0 | ||
| * @optionparent plotOptions.wma | ||
| */ | ||
| { | ||
| params: { | ||
| index: 3, | ||
| period: 9 | ||
| } | ||
| }, /** @lends Highcharts.Series.prototype */ { | ||
| getValues: function (series, params) { | ||
| var period = params.period, | ||
| xVal = series.xData, | ||
| yVal = series.yData, | ||
| yValLen = yVal ? yVal.length : 0, | ||
| range = 1, | ||
| xValue = xVal[0], | ||
| yValue = yVal[0], | ||
| WMA = [], | ||
| xData = [], | ||
| yData = [], | ||
| index = -1, | ||
| i, points, WMAPoint; | ||
|
|
||
| if (xVal.length < period) { | ||
| return false; | ||
| } | ||
|
|
||
| // Switch index for OHLC / Candlestick | ||
| if (isArray(yVal[0])) { | ||
| index = params.index; | ||
| yValue = yVal[0][index]; | ||
| } | ||
| // Starting point | ||
| points = [[xValue, yValue]]; | ||
|
|
||
| // Accumulate first N-points | ||
| while (range !== period) { | ||
| accumulateAverage(points, xVal, yVal, range, index); | ||
| range++; | ||
| } | ||
|
|
||
| // Calculate value one-by-one for each period in visible data | ||
| for (i = range; i < yValLen; i++) { | ||
| WMAPoint = populateAverage(points, xVal, yVal, i); | ||
| WMA.push(WMAPoint); | ||
| xData.push(WMAPoint[0]); | ||
| yData.push(WMAPoint[1]); | ||
|
|
||
| accumulateAverage(points, xVal, yVal, i, index); | ||
| } | ||
|
|
||
| WMAPoint = populateAverage(points, xVal, yVal, i); | ||
| WMA.push(WMAPoint); | ||
| xData.push(WMAPoint[0]); | ||
| yData.push(WMAPoint[1]); | ||
|
|
||
| return { | ||
| values: WMA, | ||
| xData: xData, | ||
| yData: yData | ||
| }; | ||
| } | ||
| }); | ||
|
|
||
| /** | ||
| * A `WMA` series. If the [type](#series.wma.type) option is not | ||
| * specified, it is inherited from [chart.type](#chart.type). | ||
| * | ||
| * @type {Object} | ||
| * @since 6.0.0 | ||
| * @extends series,plotOptions.wma | ||
| * @excluding data,dataParser,dataURL | ||
| * @product highstock | ||
| * @apioption series.wma | ||
| */ | ||
|
|
||
| /** | ||
| * @extends series.sma.data | ||
| * @product highstock | ||
| * @apioption series.wma.data | ||
| */ |
| @@ -0,0 +1,226 @@ | ||
| /** | ||
| * (c) 2010-2017 Kacper Madej | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
|
|
||
| 'use strict'; | ||
| import H from '../parts/Globals.js'; | ||
| import '../parts/Utilities.js'; | ||
|
|
||
| var seriesType = H.seriesType, | ||
| UNDEFINED; | ||
|
|
||
| /** | ||
| * The Zig Zag series type. | ||
| * | ||
| * @constructor seriesTypes.zigzag | ||
| * @augments seriesTypes.sma | ||
| */ | ||
| seriesType('zigzag', 'sma', | ||
| /** | ||
| * Zig Zag indicator. | ||
| * | ||
| * This series requires `linkedTo` option to be set. | ||
| * | ||
| * @extends {plotOptions.sma} | ||
| * @product highstock | ||
| * @sample {highstock} stock/indicators/zigzag | ||
| * Zig Zag indicator | ||
| * @since 6.0.0 | ||
| * @optionparent plotOptions.zigzag | ||
| */ | ||
| { | ||
| /** | ||
| * @excluding index,period | ||
| */ | ||
| params: { | ||
| /** | ||
| * The point index which indicator calculations will base - low | ||
| * value. | ||
| * | ||
| * For example using OHLC data, index=2 means the indicator will be | ||
| * calculated using Low values. | ||
| * | ||
| * @type {Number} | ||
| * @since 6.0.0 | ||
| * @product highstock | ||
| */ | ||
| lowIndex: 2, | ||
| /** | ||
| * The point index which indicator calculations will base - high | ||
| * value. | ||
| * | ||
| * For example using OHLC data, index=1 means the indicator will be | ||
| * calculated using High values. | ||
| * | ||
| * @type {Number} | ||
| * @since 6.0.0 | ||
| * @product highstock | ||
| */ | ||
| highIndex: 1, | ||
| /** | ||
| * The threshold for the value change. | ||
| * | ||
| * For example deviation=1 means the indicator will ignore all price | ||
| * movements less than 1%. | ||
| * | ||
| * @type {Number} | ||
| * @since 6.0.0 | ||
| * @product highstock | ||
| */ | ||
| deviation: 1 | ||
| } | ||
| }, { | ||
| nameComponents: ['deviation'], | ||
| nameSuffixes: ['%'], | ||
| nameBase: 'Zig Zag', | ||
| getValues: function (series, params) { | ||
| var lowIndex = params.lowIndex, | ||
| highIndex = params.highIndex, | ||
| deviation = params.deviation / 100, | ||
| deviations = { | ||
| 'low': 1 + deviation, | ||
| 'high': 1 - deviation | ||
| }, | ||
| xVal = series.xData, | ||
| yVal = series.yData, | ||
| yValLen = yVal ? yVal.length : 0, | ||
| Zigzag = [], | ||
| xData = [], | ||
| yData = [], | ||
| i, j, | ||
| ZigzagPoint, | ||
| firstZigzagLow, | ||
| firstZigzagHigh, | ||
| directionUp, | ||
| zigZagLen, | ||
| exitLoop = false, | ||
| yIndex = false; | ||
|
|
||
| // Exit if not enught points or no low or high values | ||
| if ( | ||
| xVal.length <= 1 || | ||
| ( | ||
| yValLen && | ||
| ( | ||
| yVal[0][lowIndex] === UNDEFINED || | ||
| yVal[0][highIndex] === UNDEFINED | ||
| ) | ||
| ) | ||
| ) { | ||
| return false; | ||
| } | ||
|
|
||
| // Set first zigzag point candidate | ||
| firstZigzagLow = yVal[0][lowIndex]; | ||
| firstZigzagHigh = yVal[0][highIndex]; | ||
|
|
||
| // Search for a second zigzag point candidate, | ||
| // this will also set first zigzag point | ||
| for (i = 1; i < yValLen; i++) { | ||
| // requried change to go down | ||
| if (yVal[i][lowIndex] <= firstZigzagHigh * deviations.high) { | ||
| Zigzag.push([xVal[0], firstZigzagHigh]); | ||
| // second zigzag point candidate | ||
| ZigzagPoint = [xVal[i], yVal[i][lowIndex]]; | ||
| // next line will be going up | ||
| directionUp = true; | ||
| exitLoop = true; | ||
|
|
||
| // requried change to go up | ||
| } else if ( | ||
| yVal[i][highIndex] >= firstZigzagLow * deviations.low | ||
| ) { | ||
| Zigzag.push([xVal[0], firstZigzagLow]); | ||
| // second zigzag point candidate | ||
| ZigzagPoint = [xVal[i], yVal[i][highIndex]]; | ||
| // next line will be going down | ||
| directionUp = false; | ||
| exitLoop = true; | ||
|
|
||
| } | ||
| if (exitLoop) { | ||
| xData.push(Zigzag[0][0]); | ||
| yData.push(Zigzag[0][1]); | ||
| j = i++; | ||
| i = yValLen; | ||
| } | ||
| } | ||
|
|
||
| // Search for next zigzags | ||
| for (i = j; i < yValLen; i++) { | ||
| if (directionUp) { // next line up | ||
|
|
||
| // lower when going down -> change zigzag candidate | ||
| if (yVal[i][lowIndex] <= ZigzagPoint[1]) { | ||
| ZigzagPoint = [xVal[i], yVal[i][lowIndex]]; | ||
| } | ||
|
|
||
| // requried change to go down -> new zigzagpoint and | ||
| // direction change | ||
| if (yVal[i][highIndex] >= ZigzagPoint[1] * deviations.low) { | ||
| yIndex = highIndex; | ||
| } | ||
|
|
||
| } else { // next line down | ||
|
|
||
| // higher when going up -> change zigzag candidate | ||
| if (yVal[i][highIndex] >= ZigzagPoint[1]) { | ||
| ZigzagPoint = [xVal[i], yVal[i][highIndex]]; | ||
| } | ||
|
|
||
| // requried change to go down -> new zigzagpoint and | ||
| // direction change | ||
| if (yVal[i][lowIndex] <= ZigzagPoint[1] * deviations.high) { | ||
| yIndex = lowIndex; | ||
| } | ||
| } | ||
| if (yIndex !== false) { // new zigzag point and direction change | ||
| Zigzag.push(ZigzagPoint); | ||
| xData.push(ZigzagPoint[0]); | ||
| yData.push(ZigzagPoint[1]); | ||
| ZigzagPoint = [xVal[i], yVal[i][yIndex]]; | ||
| directionUp = !directionUp; | ||
|
|
||
| yIndex = false; | ||
| } | ||
| } | ||
|
|
||
| zigZagLen = Zigzag.length; | ||
|
|
||
| // no zigzag for last point | ||
| if ( | ||
| zigZagLen !== 0 && | ||
| Zigzag[zigZagLen - 1][0] < xVal[yValLen - 1] | ||
| ) { | ||
| // set last point from zigzag candidate | ||
| Zigzag.push(ZigzagPoint); | ||
| xData.push(ZigzagPoint[0]); | ||
| yData.push(ZigzagPoint[1]); | ||
| } | ||
| return { | ||
| values: Zigzag, | ||
| xData: xData, | ||
| yData: yData | ||
| }; | ||
| } | ||
| }); | ||
|
|
||
| /** | ||
| * A `Zig Zag` series. If the [type](#series.zigzag.type) option is not | ||
| * specified, it is inherited from [chart.type](#chart.type). | ||
| * | ||
| * @type {Object} | ||
| * @since 6.0.0 | ||
| * @extends series,plotOptions.zigzag | ||
| * @excluding data,dataParser,dataURL | ||
| * @product highstock | ||
| * @apioption series.zigzag | ||
| */ | ||
|
|
||
| /** | ||
| * @extends series.sma.data | ||
| * @product highstock | ||
| * @apioption series.zigzag.data | ||
| */ |
| @@ -0,0 +1,17 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * 3D features for Highcharts JS | ||
| * | ||
| * @license: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../parts-3d/Math.js'; | ||
| import '../parts-3d/SVGRenderer.js'; | ||
| import '../parts-3d/Chart.js'; | ||
| import '../parts-3d/Axis.js'; | ||
| import '../parts-3d/Series.js'; | ||
| import '../parts-3d/Column.js'; | ||
| import '../parts-3d/Pie.js'; | ||
| import '../parts-3d/Scatter.js'; | ||
| import '../parts-3d/VMLRenderer.js'; |
| @@ -0,0 +1,20 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2016 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../parts-more/Pane.js'; | ||
| import '../parts-more/RadialAxis.js'; | ||
| import '../parts-more/AreaRangeSeries.js'; | ||
| import '../parts-more/AreaSplineRangeSeries.js'; | ||
| import '../parts-more/ColumnRangeSeries.js'; | ||
| import '../parts-more/GaugeSeries.js'; | ||
| import '../parts-more/BoxPlotSeries.js'; | ||
| import '../parts-more/ErrorBarSeries.js'; | ||
| import '../parts-more/WaterfallSeries.js'; | ||
| import '../parts-more/PolygonSeries.js'; | ||
| import '../parts-more/BubbleSeries.js'; | ||
| import '../parts-more/Polar.js'; |
| @@ -0,0 +1,36 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2016 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import Highcharts from '../parts/Globals.js'; | ||
| import '../parts/SvgRenderer.js'; | ||
| import '../parts/Html.js'; | ||
| import '../parts/Axis.js'; | ||
| import '../parts/DateTimeAxis.js'; | ||
| import '../parts/LogarithmicAxis.js'; | ||
| import '../parts/PlotLineOrBand.js'; | ||
| import '../parts/Tooltip.js'; | ||
| import '../parts/Pointer.js'; | ||
| import '../parts/TouchPointer.js'; | ||
| import '../parts/MSPointer.js'; | ||
| import '../parts/Legend.js'; | ||
| import '../parts/Chart.js'; | ||
| import '../parts/ScrollablePlotArea.js'; | ||
| import '../parts/Stacking.js'; | ||
| import '../parts/Dynamics.js'; | ||
| import '../parts/AreaSeries.js'; | ||
| import '../parts/SplineSeries.js'; | ||
| import '../parts/AreaSplineSeries.js'; | ||
| import '../parts/ColumnSeries.js'; | ||
| import '../parts/BarSeries.js'; | ||
| import '../parts/ScatterSeries.js'; | ||
| import '../parts/PieSeries.js'; | ||
| import '../parts/DataLabels.js'; | ||
| import '../modules/overlapping-datalabels.src.js'; | ||
| import '../parts/Interaction.js'; | ||
| import '../parts/Responsive.js'; | ||
| export default Highcharts; |
| @@ -0,0 +1,35 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2011-2016 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import Highcharts from '../parts/Globals.js'; | ||
| import '../parts/Utilities.js'; | ||
| import '../parts/Options.js'; | ||
| import '../parts/Color.js'; | ||
| import '../parts/SvgRenderer.js'; | ||
| import '../parts/Html.js'; | ||
| import '../parts/Tick.js'; | ||
| import '../parts/Axis.js'; | ||
| import '../parts/LogarithmicAxis.js'; | ||
| import '../parts/PlotLineOrBand.js'; | ||
| import '../parts/Tooltip.js'; | ||
| import '../parts/Pointer.js'; | ||
| import '../parts/TouchPointer.js'; | ||
| import '../parts/MSPointer.js'; | ||
| import '../parts/Legend.js'; | ||
| import '../parts/Chart.js'; | ||
| import '../parts/Point.js'; | ||
| import '../parts/Series.js'; | ||
| import '../parts/Dynamics.js'; | ||
| import '../parts/ColumnSeries.js'; | ||
| import '../parts/ScatterSeries.js'; | ||
| import '../parts/DataLabels.js'; | ||
| import '../modules/overlapping-datalabels.src.js'; | ||
| import '../parts/Interaction.js'; | ||
| import '../parts/Responsive.js'; | ||
| import './modules/map.src.js'; | ||
| export default Highcharts; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2016 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import Highcharts from './highcharts.src.js'; | ||
| import './modules/stock.src.js'; | ||
| export default Highcharts; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Sebastian Bochan | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/accumulation-distribution.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Sebastian Bochan | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/atr.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Paweł Fus | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/bollinger-bands.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Sebastian Bochan | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/cci.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2010-2017 Highsoft AS | ||
| * Author: Sebastian Domas | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/cmf.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Sebastian Bochan | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/ema.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Sebastian Bochan | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/ichimoku-kinko-hyo.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Pawel Fus, Sebastian Bochan | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/indicators.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Sebastian Bochan | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/macd.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Money Flow Index indicator for Highstock | ||
| * | ||
| * (c) 2010-2017 Grzegorz Blachliński | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/mfi.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Sebastian Bochan | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/momentum.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Paweł Fus | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/pivot-points.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Paweł Fus | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/price-envelopes.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Parabolic SAR Indicator for Highstock | ||
| * | ||
| * (c) 2010-2017 Grzegorz Blachliński | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/psar.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Kacper Madej | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/roc.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Paweł Fus | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/rsi.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Paweł Fus | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/stochastic.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Paweł Dalek | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/volume-by-price.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Paweł Dalek | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/vwap.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Kacper Madej | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/wma.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Indicator series type for Highstock | ||
| * | ||
| * (c) 2010-2017 Kacper Madej | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../indicators/zigzag.src.js'; |
| @@ -0,0 +1,13 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Accessibility module | ||
| * | ||
| * (c) 2010-2017 Highsoft AS | ||
| * Author: Oystein Moseng | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/a11y-i18n.src.js'; | ||
| import '../../modules/screen-reader.src.js'; | ||
| import '../../modules/keyboard-navigation.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Annotations module | ||
| * | ||
| * (c) 2009-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/annotations.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Boost module | ||
| * | ||
| * (c) 2010-2017 Highsoft AS | ||
| * Author: Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/boost-canvas.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Boost module | ||
| * | ||
| * (c) 2010-2017 Highsoft AS | ||
| * Author: Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/boost.src.js'; |
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/broken-axis.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Bullet graph series type for Highcharts | ||
| * | ||
| * (c) 2010-2017 Kacper Madej | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/bullet.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Data module | ||
| * | ||
| * (c) 2012-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/data.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Drag-panes module | ||
| * | ||
| * (c) 2010-2017 Highsoft AS | ||
| * Author: Kacper Madej | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/drag-panes.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Highcharts Drilldown module | ||
| * | ||
| * Author: Torstein Honsi | ||
| * License: www.highcharts.com/license | ||
| * | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/drilldown.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Exporting module | ||
| * | ||
| * (c) 2010-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/export-data.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Exporting module | ||
| * | ||
| * (c) 2010-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/exporting.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Highcharts funnel module | ||
| * | ||
| * (c) 2010-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/funnel.src.js'; |
| @@ -0,0 +1,12 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Gantt series | ||
| * | ||
| * (c) 2016 Lars A. V. Cabrera | ||
| * | ||
| * --- WORK IN PROGRESS --- | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../parts-gantt/gantt.js'; |
| @@ -0,0 +1,12 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * GridAxis | ||
| * | ||
| * (c) 2016 Lars A. V. Cabrera | ||
| * | ||
| * --- WORK IN PROGRESS --- | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../parts-gantt/grid-axis.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../parts-map/ColorAxis.js'; | ||
| import '../../parts-map/ColorSeriesMixin.js'; | ||
| import '../../parts-map/HeatmapSeries.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2010-2017 Highsoft AS | ||
| * Author: Sebastian Domas | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/histogram.src.js'; | ||
| import '../../modules/bellcurve.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Item series type for Highcharts | ||
| * | ||
| * (c) 2010-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/item-series.src.js'; |
| @@ -0,0 +1,21 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Highmaps as a plugin for Highcharts or Highstock. | ||
| * | ||
| * (c) 2011-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../parts-map/MapAxis.js'; | ||
| import '../../parts-map/ColorAxis.js'; | ||
| import '../../parts-map/ColorSeriesMixin.js'; | ||
| import '../../parts-map/MapNavigation.js'; | ||
| import '../../parts-map/MapPointer.js'; | ||
| import '../../parts-map/MapSeries.js'; | ||
| import '../../parts-map/MapLineSeries.js'; | ||
| import '../../parts-map/MapPointSeries.js'; | ||
| import '../../parts-map/MapBubbleSeries.js'; | ||
| import '../../parts-map/HeatmapSeries.js'; | ||
| import '../../parts-map/GeoJSON.js'; | ||
| import '../../parts-map/Map.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Plugin for displaying a message when there is no data visible in chart. | ||
| * | ||
| * (c) 2010-2017 Highsoft AS | ||
| * Author: Oystein Moseng | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/no-data-to-display.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Client side exporting module | ||
| * | ||
| * (c) 2015 Torstein Honsi / Oystein Moseng | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/offline-exporting.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Old IE (v6, v7, v8) module for Highcharts v6+. | ||
| * | ||
| * (c) 2010-2017 Highsoft AS | ||
| * Author: Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/oldie.src.js'; |
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/overlapping-datalabels.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Support for parallel coordinates in Highcharts | ||
| * | ||
| * (c) 2010-2017 Pawel Fus | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/parallel-coordinates.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Pareto series type for Highcharts | ||
| * | ||
| * (c) 2010-2017 Sebastian Bochan | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/pareto.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Module for adding patterns and images as point fills. | ||
| * | ||
| * (c) 2010-2018 Highsoft AS | ||
| * Author: Torstein Hønsi, Øystein Moseng | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/pattern-fill.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Sankey diagram module | ||
| * | ||
| * (c) 2010-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/sankey.src.js'; |
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/series-label.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Solid angular gauge module | ||
| * | ||
| * (c) 2010-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/solid-gauge.src.js'; |
| @@ -0,0 +1,12 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * StaticScale | ||
| * | ||
| * (c) 2016 Torstein Honsi, Lars A. V. Cabrera | ||
| * | ||
| * --- WORK IN PROGRESS --- | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/static-scale.src.js'; |
| @@ -0,0 +1,19 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Highstock as a plugin for Highcharts | ||
| * | ||
| * (c) 2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../parts/OrdinalAxis.js'; | ||
| import './broken-axis.src.js'; | ||
| import '../../parts/DataGrouping.js'; | ||
| import '../../parts/OHLCSeries.js'; | ||
| import '../../parts/CandlestickSeries.js'; | ||
| import '../../parts/FlagsSeries.js'; | ||
| import '../../parts/Scrollbar.js'; | ||
| import '../../parts/Navigator.js'; | ||
| import '../../parts/RangeSelector.js'; | ||
| import '../../parts/StockChart.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Streamgraph module | ||
| * | ||
| * (c) 2010-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/streamgraph.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2016 Highsoft AS | ||
| * Authors: Jon Arild Nygard | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/sunburst.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Tilemap module | ||
| * | ||
| * (c) 2010-2017 Highsoft AS | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/tilemap.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2014 Highsoft AS | ||
| * Authors: Jon Arild Nygard / Oystein Moseng | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/treemap.src.js'; |
| @@ -0,0 +1,11 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * Variable Pie module for Highcharts | ||
| * | ||
| * (c) 2010-2017 Grzegorz Blachliński | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/variable-pie.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Highcharts variwide module | ||
| * | ||
| * (c) 2010-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/variwide.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Vector plot series module | ||
| * | ||
| * (c) 2010-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/vector.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * Wind barb series module | ||
| * | ||
| * (c) 2010-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/windbarb.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2016 Highsoft AS | ||
| * Authors: Jon Arild Nygard | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/wordcloud.src.js'; |
| @@ -0,0 +1,10 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * X-range series | ||
| * | ||
| * (c) 2010-2017 Torstein Honsi, Lars A. V. Cabrera | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../modules/xrange.src.js'; |
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Highsoft AS | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../themes/avocado.js'; |
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Highsoft AS | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../themes/avocado.js'; |
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../themes/dark-blue.js'; |
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../themes/dark-green.js'; |
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../themes/dark-unica.js'; |
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../themes/gray.js'; |
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../themes/grid-light.js'; |
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../themes/grid.js'; |
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../themes/sand-signika.js'; |
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../themes/skies.js'; |
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Highsoft AS | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../themes/sunset.js'; |
| @@ -0,0 +1,9 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2009-2017 Highsoft AS | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import '../../themes/sunset.js'; |
| @@ -0,0 +1,91 @@ | ||
| /** | ||
| * (c) 2010-2017 Christer Vasseng, Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import H from '../parts/Globals.js'; | ||
| /** | ||
| * @typedef {Object} AjaxSettings | ||
| * @property {String} url - The URL to call | ||
| * @property {('get'|'post'|'update'|'delete')} type - The verb to use | ||
| * @property {('json'|'xml'|'text'|'octet')} dataType - The data type expected | ||
| * @property {Function} success - Function to call on success | ||
| * @property {Function} error - Function to call on error | ||
| * @property {Object} data - The payload to send | ||
| * @property {Object} headers - The headers; keyed on header name | ||
| */ | ||
|
|
||
| /** | ||
| * Perform an Ajax call. | ||
| * | ||
| * @memberof Highcharts | ||
| * @param {AjaxSettings} - The Ajax settings to use | ||
| * | ||
| */ | ||
| H.ajax = function (attr) { | ||
| var options = H.merge(true, { | ||
| url: false, | ||
| type: 'GET', | ||
| dataType: 'json', | ||
| success: false, | ||
| error: false, | ||
| data: false, | ||
| headers: {} | ||
| }, attr), | ||
| headers = { | ||
| json: 'application/json', | ||
| xml: 'application/xml', | ||
| text: 'text/plain', | ||
| octet: 'application/octet-stream' | ||
| }, | ||
| r = new XMLHttpRequest(); | ||
|
|
||
| function handleError(xhr, err) { | ||
| if (options.error) { | ||
| options.error(xhr, err); | ||
| } else { | ||
| // Maybe emit a highcharts error event here | ||
| } | ||
| } | ||
|
|
||
| if (!options.url) { | ||
| return false; | ||
| } | ||
|
|
||
| r.open(options.type.toUpperCase(), options.url, true); | ||
| r.setRequestHeader( | ||
| 'Content-Type', | ||
| headers[options.dataType] || headers.text | ||
| ); | ||
|
|
||
| H.objectEach(options.headers, function (val, key) { | ||
| r.setRequestHeader(key, val); | ||
| }); | ||
|
|
||
| r.onreadystatechange = function () { | ||
| var res; | ||
|
|
||
| if (r.readyState === 4) { | ||
| if (r.status === 200) { | ||
| res = r.responseText; | ||
| if (options.dataType === 'json') { | ||
| try { | ||
| res = JSON.parse(res); | ||
| } catch (e) { | ||
| return handleError(r, e); | ||
| } | ||
| } | ||
| return options.success && options.success(res); | ||
| } | ||
|
|
||
| handleError(r, r.responseText); | ||
| } | ||
| }; | ||
|
|
||
| try { | ||
| options.data = JSON.stringify(options.data); | ||
| } catch (e) {} | ||
|
|
||
| r.send(options.data || true); | ||
| }; |
| @@ -0,0 +1,84 @@ | ||
| /** | ||
| * (c) 2010-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import H from '../parts/Globals.js'; | ||
| import '../parts/Utilities.js'; | ||
| var deg2rad = H.deg2rad, | ||
| isNumber = H.isNumber, | ||
| pick = H.pick, | ||
| relativeLength = H.relativeLength; | ||
| H.CenteredSeriesMixin = { | ||
| /** | ||
| * Get the center of the pie based on the size and center options relative | ||
| * to the plot area. Borrowed by the polar and gauge series types. | ||
| */ | ||
| getCenter: function () { | ||
|
|
||
| var options = this.options, | ||
| chart = this.chart, | ||
| slicingRoom = 2 * (options.slicedOffset || 0), | ||
| handleSlicingRoom, | ||
| plotWidth = chart.plotWidth - 2 * slicingRoom, | ||
| plotHeight = chart.plotHeight - 2 * slicingRoom, | ||
| centerOption = options.center, | ||
| positions = [ | ||
| pick(centerOption[0], '50%'), | ||
| pick(centerOption[1], '50%'), | ||
| options.size || '100%', | ||
| options.innerSize || 0 | ||
| ], | ||
| smallestSize = Math.min(plotWidth, plotHeight), | ||
| i, | ||
| value; | ||
|
|
||
| for (i = 0; i < 4; ++i) { | ||
| value = positions[i]; | ||
| handleSlicingRoom = i < 2 || (i === 2 && /%$/.test(value)); | ||
|
|
||
| // i == 0: centerX, relative to width | ||
| // i == 1: centerY, relative to height | ||
| // i == 2: size, relative to smallestSize | ||
| // i == 3: innerSize, relative to size | ||
| positions[i] = relativeLength( | ||
| value, | ||
| [plotWidth, plotHeight, smallestSize, positions[2]][i] | ||
| ) + (handleSlicingRoom ? slicingRoom : 0); | ||
|
|
||
| } | ||
| // innerSize cannot be larger than size (#3632) | ||
| if (positions[3] > positions[2]) { | ||
| positions[3] = positions[2]; | ||
| } | ||
| return positions; | ||
| }, | ||
| /** | ||
| * getStartAndEndRadians - Calculates start and end angles in radians. | ||
| * Used in series types such as pie and sunburst. | ||
| * | ||
| * @param {Number} start Start angle in degrees. | ||
| * @param {Number} end Start angle in degrees. | ||
| * @return {object} Returns an object containing start and end angles as | ||
| * radians. | ||
| */ | ||
| getStartAndEndRadians: function getStartAndEndRadians(start, end) { | ||
| var startAngle = isNumber(start) ? start : 0, // must be a number | ||
| endAngle = ( | ||
| ( | ||
| isNumber(end) && // must be a number | ||
| end > startAngle && // must be larger than the start angle | ||
| // difference must be less than 360 degrees | ||
| (end - startAngle) < 360 | ||
| ) ? | ||
| end : | ||
| startAngle + 360 | ||
| ), | ||
| correction = -90; | ||
| return { | ||
| start: deg2rad * (startAngle + correction), | ||
| end: deg2rad * (endAngle + correction) | ||
| }; | ||
| } | ||
| }; |
| @@ -0,0 +1,140 @@ | ||
| 'use strict'; | ||
| import H from '../parts/Globals.js'; | ||
| import '../parts/Series.js'; | ||
|
|
||
| var each = H.each, | ||
| Series = H.Series, | ||
| addEvent = H.addEvent, | ||
| noop = H.noop; | ||
|
|
||
|
|
||
| /* *************************************************************************** | ||
| * | ||
| * DERIVED SERIES MIXIN | ||
| * | ||
| **************************************************************************** */ | ||
|
|
||
| /** | ||
| * Provides methods for auto setting/updating series data based on the based | ||
| * series data. | ||
| * | ||
| * @mixin | ||
| **/ | ||
| var derivedSeriesMixin = { | ||
| /** | ||
| * Initialise series | ||
| * | ||
| * returns {undefined} | ||
| **/ | ||
| init: function () { | ||
| Series.prototype.init.apply(this, arguments); | ||
|
|
||
| this.initialised = false; | ||
| this.baseSeries = null; | ||
| this.eventRemovers = []; | ||
|
|
||
| this.addEvents(); | ||
| }, | ||
|
|
||
| /** | ||
| * Method to be implemented - inside the method the series has already access | ||
| * to the base series via m `this.baseSeries` and the bases data is | ||
| * initialised. It should return data in the format accepted by | ||
| * `Series.setData()` method | ||
| * | ||
| * @returns {Array} - an array of data | ||
| **/ | ||
| setDerivedData: noop, | ||
|
|
||
| /** | ||
| * Sets base series for the series | ||
| * | ||
| * returns {undefined} | ||
| **/ | ||
| setBaseSeries: function () { | ||
| var chart = this.chart, | ||
| baseSeriesOptions = this.options.baseSeries, | ||
| baseSeries = | ||
| baseSeriesOptions && | ||
| (chart.series[baseSeriesOptions] || chart.get(baseSeriesOptions)); | ||
|
|
||
| this.baseSeries = baseSeries || null; | ||
| }, | ||
|
|
||
| /** | ||
| * Adds events for the series | ||
| * | ||
| * @returns {undefined} | ||
| **/ | ||
| addEvents: function () { | ||
| var derivedSeries = this, | ||
| chartSeriesLinked; | ||
|
|
||
| chartSeriesLinked = addEvent( | ||
| this.chart, | ||
| 'afterLinkSeries', | ||
| function () { | ||
| derivedSeries.setBaseSeries(); | ||
|
|
||
| if (derivedSeries.baseSeries && !derivedSeries.initialised) { | ||
| derivedSeries.setDerivedData(); | ||
| derivedSeries.addBaseSeriesEvents(); | ||
| derivedSeries.initialised = true; | ||
| } | ||
| } | ||
| ); | ||
|
|
||
| this.eventRemovers.push( | ||
| chartSeriesLinked | ||
| ); | ||
| }, | ||
|
|
||
| /** | ||
| * Adds events to the base series - it required for recalculating the data in | ||
| * the series if the base series is updated / removed / etc. | ||
| * | ||
| * @returns {undefined} | ||
| **/ | ||
| addBaseSeriesEvents: function () { | ||
| var derivedSeries = this, | ||
| updatedDataRemover, | ||
| destroyRemover; | ||
|
|
||
| updatedDataRemover = addEvent( | ||
| derivedSeries.baseSeries, | ||
| 'updatedData', | ||
| function () { | ||
| derivedSeries.setDerivedData(); | ||
| } | ||
| ); | ||
|
|
||
| destroyRemover = addEvent( | ||
| derivedSeries.baseSeries, | ||
| 'destroy', | ||
| function () { | ||
| derivedSeries.baseSeries = null; | ||
| derivedSeries.initialised = false; | ||
| } | ||
| ); | ||
|
|
||
| derivedSeries.eventRemovers.push( | ||
| updatedDataRemover, | ||
| destroyRemover | ||
| ); | ||
| }, | ||
|
|
||
| /** | ||
| * Destroys the series | ||
| * | ||
| * @returns {undefined} | ||
| **/ | ||
| destroy: function () { | ||
| each(this.eventRemovers, function (remover) { | ||
| remover(); | ||
| }); | ||
|
|
||
| Series.prototype.destroy.apply(this, arguments); | ||
| } | ||
| }; | ||
|
|
||
| export default derivedSeriesMixin; |
| @@ -0,0 +1,42 @@ | ||
| var isFn = function (x) { | ||
| return typeof x === 'function'; | ||
| }; | ||
|
|
||
| /** | ||
| * draw - Handles the drawing of a point. | ||
| * TODO: add type checking. | ||
| * | ||
| * @param {object} params Parameters. | ||
| * @return {undefined} Returns undefined. | ||
| */ | ||
| var draw = function draw(params) { | ||
| var point = this, | ||
| graphic = point.graphic, | ||
| animate = params.animate, | ||
| attr = params.attr, | ||
| onComplete = params.onComplete, | ||
| css = params.css, | ||
| group = params.group, | ||
| renderer = params.renderer, | ||
| shape = params.shapeArgs, | ||
| type = params.shapeType; | ||
|
|
||
| if (point.shouldDraw()) { | ||
| if (!graphic) { | ||
| point.graphic = graphic = renderer[type](shape).add(group); | ||
| } | ||
| graphic.css(css).attr(attr).animate(animate, undefined, onComplete); | ||
| } else if (graphic) { | ||
| graphic.animate(animate, undefined, function () { | ||
| point.graphic = graphic = graphic.destroy(); | ||
| if (isFn(onComplete)) { | ||
| onComplete(); | ||
| } | ||
| }); | ||
| } | ||
| if (graphic) { | ||
| graphic.addClass(point.getClassName(), true); | ||
| } | ||
| }; | ||
|
|
||
| export default draw; |
| @@ -0,0 +1,154 @@ | ||
| /** | ||
| * (c) 2010-2017 Torstein Honsi | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
| 'use strict'; | ||
| import H from '../parts/Globals.js'; | ||
|
|
||
| var each = H.each, | ||
| defined = H.defined, | ||
| seriesTypes = H.seriesTypes, | ||
| stableSort = H.stableSort; | ||
|
|
||
| var onSeriesMixin = { | ||
|
|
||
| /** | ||
| * Override getPlotBox. If the onSeries option is valid, return the plot box | ||
| * of the onSeries, otherwise proceed as usual. | ||
| */ | ||
| getPlotBox: function () { | ||
| return H.Series.prototype.getPlotBox.call( | ||
| ( | ||
| this.options.onSeries && | ||
| this.chart.get(this.options.onSeries) | ||
| ) || this | ||
| ); | ||
| }, | ||
|
|
||
| /** | ||
| * Extend the translate method by placing the point on the related series | ||
| */ | ||
| translate: function () { | ||
|
|
||
| seriesTypes.column.prototype.translate.apply(this); | ||
|
|
||
| var series = this, | ||
| options = series.options, | ||
| chart = series.chart, | ||
| points = series.points, | ||
| cursor = points.length - 1, | ||
| point, | ||
| lastPoint, | ||
| optionsOnSeries = options.onSeries, | ||
| onSeries = optionsOnSeries && chart.get(optionsOnSeries), | ||
| onKey = options.onKey || 'y', | ||
| step = onSeries && onSeries.options.step, | ||
| onData = onSeries && onSeries.points, | ||
| i = onData && onData.length, | ||
| inverted = chart.inverted, | ||
| xAxis = series.xAxis, | ||
| yAxis = series.yAxis, | ||
| xOffset = 0, | ||
| leftPoint, | ||
| lastX, | ||
| rightPoint, | ||
| currentDataGrouping, | ||
| distanceRatio; | ||
|
|
||
| // relate to a master series | ||
| if (onSeries && onSeries.visible && i) { | ||
| xOffset = (onSeries.pointXOffset || 0) + (onSeries.barW || 0) / 2; | ||
| currentDataGrouping = onSeries.currentDataGrouping; | ||
| lastX = ( | ||
| onData[i - 1].x + | ||
| (currentDataGrouping ? currentDataGrouping.totalRange : 0) | ||
| ); // #2374 | ||
|
|
||
| // sort the data points | ||
| stableSort(points, function (a, b) { | ||
| return (a.x - b.x); | ||
| }); | ||
|
|
||
| onKey = 'plot' + onKey[0].toUpperCase() + onKey.substr(1); | ||
| while (i-- && points[cursor]) { | ||
| leftPoint = onData[i]; | ||
| point = points[cursor]; | ||
| point.y = leftPoint.y; | ||
|
|
||
| if (leftPoint.x <= point.x && leftPoint[onKey] !== undefined) { | ||
| if (point.x <= lastX) { // #803 | ||
|
|
||
| point.plotY = leftPoint[onKey]; | ||
|
|
||
| // interpolate between points, #666 | ||
| if (leftPoint.x < point.x && !step) { | ||
| rightPoint = onData[i + 1]; | ||
| if (rightPoint && rightPoint[onKey] !== undefined) { | ||
| // the distance ratio, between 0 and 1 | ||
| distanceRatio = (point.x - leftPoint.x) / | ||
| (rightPoint.x - leftPoint.x); | ||
| point.plotY += | ||
| distanceRatio * | ||
| // the plotY distance | ||
| (rightPoint[onKey] - leftPoint[onKey]); | ||
| point.y += | ||
| distanceRatio * | ||
| (rightPoint.y - leftPoint.y); | ||
| } | ||
| } | ||
| } | ||
| cursor--; | ||
| i++; // check again for points in the same x position | ||
| if (cursor < 0) { | ||
| break; | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| // Add plotY position and handle stacking | ||
| each(points, function (point, i) { | ||
|
|
||
| var stackIndex; | ||
|
|
||
| point.plotX += xOffset; // #2049 | ||
|
|
||
| // Undefined plotY means the point is either on axis, outside series | ||
| // range or hidden series. If the series is outside the range of the | ||
| // x axis it should fall through with an undefined plotY, but then | ||
| // we must remove the shapeArgs (#847). For inverted charts, we need | ||
| // to calculate position anyway, because series.invertGroups is not | ||
| // defined | ||
| if (point.plotY === undefined || inverted) { | ||
| if (point.plotX >= 0 && point.plotX <= xAxis.len) { | ||
| // We're inside xAxis range | ||
| if (inverted) { | ||
| point.plotY = xAxis.translate(point.x, 0, 1, 0, 1); | ||
| point.plotX = defined(point.y) ? | ||
| yAxis.translate(point.y, 0, 0, 0, 1) : 0; | ||
| } else { | ||
| point.plotY = chart.chartHeight - xAxis.bottom - | ||
| (xAxis.opposite ? xAxis.height : 0) + | ||
| xAxis.offset - yAxis.top; // #3517 | ||
| } | ||
| } else { | ||
| point.shapeArgs = {}; // 847 | ||
| } | ||
| } | ||
|
|
||
| // if multiple flags appear at the same x, order them into a stack | ||
| lastPoint = points[i - 1]; | ||
| if (lastPoint && lastPoint.plotX === point.plotX) { | ||
| if (lastPoint.stackIndex === undefined) { | ||
| lastPoint.stackIndex = 0; | ||
| } | ||
| stackIndex = lastPoint.stackIndex + 1; | ||
| } | ||
| point.stackIndex = stackIndex; // #3639 | ||
| }); | ||
|
|
||
| this.onSeries = onSeries; | ||
| } | ||
| }; | ||
| export default onSeriesMixin; |
| @@ -0,0 +1,233 @@ | ||
| import H from '../parts/Globals.js'; | ||
| var each = H.each, | ||
| extend = H.extend, | ||
| isArray = H.isArray, | ||
| isBoolean = function (x) { | ||
| return typeof x === 'boolean'; | ||
| }, | ||
| isFn = function (x) { | ||
| return typeof x === 'function'; | ||
| }, | ||
| isObject = H.isObject, | ||
| isNumber = H.isNumber, | ||
| merge = H.merge, | ||
| pick = H.pick, | ||
| reduce = H.reduce; | ||
| // TODO Combine buildTree and buildNode with setTreeValues | ||
| // TODO Remove logic from Treemap and make it utilize this mixin. | ||
| var setTreeValues = function setTreeValues(tree, options) { | ||
| var before = options.before, | ||
| idRoot = options.idRoot, | ||
| mapIdToNode = options.mapIdToNode, | ||
| nodeRoot = mapIdToNode[idRoot], | ||
| levelIsConstant = ( | ||
| isBoolean(options.levelIsConstant) ? | ||
| options.levelIsConstant : | ||
| true | ||
| ), | ||
| points = options.points, | ||
| point = points[tree.i], | ||
| optionsPoint = point && point.options || {}, | ||
| childrenTotal = 0, | ||
| children = [], | ||
| value; | ||
| extend(tree, { | ||
| levelDynamic: tree.level - (levelIsConstant ? 0 : nodeRoot.level), | ||
| name: pick(point && point.name, ''), | ||
| visible: ( | ||
| idRoot === tree.id || | ||
| (isBoolean(options.visible) ? options.visible : false) | ||
| ) | ||
| }); | ||
| if (isFn(before)) { | ||
| tree = before(tree, options); | ||
| } | ||
| // First give the children some values | ||
| each(tree.children, function (child, i) { | ||
| var newOptions = extend({}, options); | ||
| extend(newOptions, { | ||
| index: i, | ||
| siblings: tree.children.length, | ||
| visible: tree.visible | ||
| }); | ||
| child = setTreeValues(child, newOptions); | ||
| children.push(child); | ||
| if (child.visible) { | ||
| childrenTotal += child.val; | ||
| } | ||
| }); | ||
| tree.visible = childrenTotal > 0 || tree.visible; | ||
| // Set the values | ||
| value = pick(optionsPoint.value, childrenTotal); | ||
| extend(tree, { | ||
| children: children, | ||
| childrenTotal: childrenTotal, | ||
| isLeaf: tree.visible && !childrenTotal, | ||
| val: value | ||
| }); | ||
| return tree; | ||
| }; | ||
|
|
||
| var getColor = function getColor(node, options) { | ||
| var index = options.index, | ||
| mapOptionsToLevel = options.mapOptionsToLevel, | ||
| parentColor = options.parentColor, | ||
| parentColorIndex = options.parentColorIndex, | ||
| series = options.series, | ||
| colors = options.colors, | ||
| siblings = options.siblings, | ||
| points = series.points, | ||
| getColorByPoint, | ||
| point, | ||
| level, | ||
| colorByPoint, | ||
| colorIndexByPoint, | ||
| color, | ||
| colorIndex; | ||
| function variation(color) { | ||
| var colorVariation = level && level.colorVariation; | ||
| if (colorVariation) { | ||
| if (colorVariation.key === 'brightness') { | ||
| return H.color(color).brighten( | ||
| colorVariation.to * (index / siblings) | ||
| ).get(); | ||
| } | ||
| } | ||
|
|
||
| return color; | ||
| } | ||
|
|
||
| if (node) { | ||
| point = points[node.i]; | ||
| level = mapOptionsToLevel[node.level] || {}; | ||
| getColorByPoint = point && level.colorByPoint; | ||
|
|
||
| if (getColorByPoint) { | ||
| colorIndexByPoint = point.index % (colors ? | ||
| colors.length : | ||
| series.chart.options.chart.colorCount | ||
| ); | ||
| colorByPoint = colors && colors[colorIndexByPoint]; | ||
| } | ||
|
|
||
|
|
||
| // Select either point color, level color or inherited color. | ||
| color = pick( | ||
| point && point.options.color, | ||
| level && level.color, | ||
| colorByPoint, | ||
| parentColor && variation(parentColor), | ||
| series.color | ||
| ); | ||
|
|
||
| colorIndex = pick( | ||
| point && point.options.colorIndex, | ||
| level && level.colorIndex, | ||
| colorIndexByPoint, | ||
| parentColorIndex, | ||
| options.colorIndex | ||
| ); | ||
| } | ||
| return { | ||
| color: color, | ||
| colorIndex: colorIndex | ||
| }; | ||
| }; | ||
|
|
||
| /** | ||
| * getLevelOptions - Creates a map from level number to its given options. | ||
| * @param {Object} params Object containing parameters. | ||
| * @param {Object} params.defaults Object containing default options. The | ||
| * default options are merged with the userOptions to get the final options for | ||
| * a specific level. | ||
| * @param {Number} params.from The lowest level number. | ||
| * @param {Array} params.levels User options from series.levels. | ||
| * @param {Number} params.to The highest level number. | ||
| * @return {null|Object} Returns a map from level number to its given options. | ||
| * Returns null if invalid input parameters. | ||
| */ | ||
| var getLevelOptions = function getLevelOptions(params) { | ||
| var result = null, | ||
| defaults, | ||
| converted, | ||
| i, | ||
| from, | ||
| to, | ||
| levels; | ||
| if (isObject(params)) { | ||
| result = {}; | ||
| from = isNumber(params.from) ? params.from : 1; | ||
| levels = params.levels; | ||
| converted = {}; | ||
| defaults = isObject(params.defaults) ? params.defaults : {}; | ||
| if (isArray(levels)) { | ||
| converted = reduce(levels, function (obj, item) { | ||
| var level, | ||
| levelIsConstant, | ||
| options; | ||
| if (isObject(item) && isNumber(item.level)) { | ||
| options = merge({}, item); | ||
| levelIsConstant = ( | ||
| isBoolean(options.levelIsConstant) ? | ||
| options.levelIsConstant : | ||
| defaults.levelIsConstant | ||
| ); | ||
| // Delete redundant properties. | ||
| delete options.levelIsConstant; | ||
| delete options.level; | ||
| // Calculate which level these options apply to. | ||
| level = item.level + (levelIsConstant ? 0 : from - 1); | ||
| if (isObject(obj[level])) { | ||
| extend(obj[level], options); | ||
| } else { | ||
| obj[level] = options; | ||
| } | ||
| } | ||
| return obj; | ||
| }, {}); | ||
| } | ||
| to = isNumber(params.to) ? params.to : 1; | ||
| for (i = 0; i <= to; i++) { | ||
| result[i] = merge( | ||
| {}, | ||
| defaults, | ||
| isObject(converted[i]) ? converted[i] : {} | ||
| ); | ||
| } | ||
| } | ||
| return result; | ||
| }; | ||
|
|
||
| /** | ||
| * Update the rootId property on the series. Also makes sure that it is | ||
| * accessible to exporting. | ||
| * @param {object} series The series to operate on. | ||
| * @returns Returns the resulting rootId after update. | ||
| */ | ||
| var updateRootId = function (series) { | ||
| var rootId, | ||
| options; | ||
| if (isObject(series)) { | ||
| // Get the series options. | ||
| options = isObject(series.options) ? series.options : {}; | ||
|
|
||
| // Calculate the rootId. | ||
| rootId = pick(series.rootNode, options.rootId, ''); | ||
|
|
||
| // Set rootId on series.userOptions to pick it up in exporting. | ||
| if (isObject(series.userOptions)) { | ||
| series.userOptions.rootId = rootId; | ||
| } | ||
| // Set rootId on series to pick it up on next update. | ||
| series.rootNode = rootId; | ||
| } | ||
| return rootId; | ||
| }; | ||
|
|
||
| var result = { | ||
| getColor: getColor, | ||
| getLevelOptions: getLevelOptions, | ||
| setTreeValues: setTreeValues, | ||
| updateRootId: updateRootId | ||
| }; | ||
| export default result; |
| @@ -0,0 +1,180 @@ | ||
| /** | ||
| * @license @product.name@ JS v@product.version@ (@product.date@) | ||
| * | ||
| * (c) 2010-2017 Highsoft AS | ||
| * Author: Sebastian Domas | ||
| * | ||
| * License: www.highcharts.com/license | ||
| */ | ||
|
|
||
| 'use strict'; | ||
| import H from '../parts/Globals.js'; | ||
| import '../parts/Utilities.js'; | ||
| import derivedSeriesMixin from '../mixins/derived-series.js'; | ||
|
|
||
| var seriesType = H.seriesType, | ||
| correctFloat = H.correctFloat, | ||
| isNumber = H.isNumber, | ||
| merge = H.merge, | ||
| reduce = H.reduce; | ||
|
|
||
|
|
||
| /** **************************************************************************** | ||
| * | ||
| * BELL CURVE | ||
| * | ||
| ******************************************************************************/ | ||
|
|
||
| function mean(data) { | ||
| var length = data.length, | ||
| sum = reduce(data, function (sum, value) { | ||
| return (sum += value); | ||
| }, 0); | ||
|
|
||
| return length > 0 && sum / length; | ||
| } | ||
|
|
||
| function standardDeviation(data, average) { | ||
| var len = data.length, | ||
| sum; | ||
|
|
||
| average = isNumber(average) ? average : mean(data); | ||
|
|
||
| sum = reduce(data, function (sum, value) { | ||
| var diff = value - average; | ||
| return (sum += diff * diff); | ||
| }, 0); | ||
|
|
||
| return len > 1 && Math.sqrt(sum / (len - 1)); | ||
| } | ||
|
|
||
| function normalDensity(x, mean, standardDeviation) { | ||
| var translation = x - mean; | ||
| return Math.exp( | ||
| -(translation * translation) / | ||
| (2 * standardDeviation * standardDeviation) | ||
| ) / (standardDeviation * Math.sqrt(2 * Math.PI)); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Bell curve class | ||
| * | ||
| * @constructor seriesTypes.bellcurve | ||
| * @augments seriesTypes.areaspline | ||
| * @mixes DerivedSeriesMixin | ||
| **/ | ||
|
|
||
| /** | ||
| * A bell curve is an areaspline series which represents the probability density | ||
| * function of the normal distribution. It calculates mean and standard | ||
| * deviation of the base series data and plots the curve according to the | ||
| * calculated parameters. | ||
| * | ||
| * @product highcharts | ||
| * @sample {highcharts} highcharts/demo/bellcurve/ Bell curve | ||
| * @since 6.0.0 | ||
| * @extends plotOptions.areaspline | ||
| * @excluding boostThreshold,connectNulls,stacking,pointInterval, | ||
| * pointIntervalUnit | ||
| * @optionparent plotOptions.bellcurve | ||
| **/ | ||
| seriesType('bellcurve', 'areaspline', { | ||
| /** | ||
| * This option allows to define the length of the bell curve. A unit of the | ||
| * length of the bell curve is standard deviation. | ||
| * | ||
| * @sample highcharts/plotoptions/bellcurve-intervals-pointsininterval | ||
| * Intervals and points in interval | ||
| */ | ||
| intervals: 3, | ||
|
|
||
| /** | ||
| * Defines how many points should be plotted within 1 interval. See | ||
| * `plotOptions.bellcurve.intervals`. | ||
| * | ||
| * @sample highcharts/plotoptions/bellcurve-intervals-pointsininterval | ||
| * Intervals and points in interval | ||
| */ | ||
| pointsInInterval: 3, | ||
|
|
||
| marker: { | ||
| enabled: false | ||
| } | ||
|
|
||
| }, merge(derivedSeriesMixin, { | ||
| setMean: function () { | ||
| this.mean = correctFloat(mean(this.baseSeries.yData)); | ||
| }, | ||
|
|
||
| setStandardDeviation: function () { | ||
| this.standardDeviation = correctFloat( | ||
| standardDeviation(this.baseSeries.yData, this.mean) | ||
| ); | ||
| }, | ||
|
|
||
| setDerivedData: function () { | ||
| if (this.baseSeries.yData.length > 1) { | ||
| this.setMean(); | ||
| this.setStandardDeviation(); | ||
| this.setData( | ||
| this.derivedData(this.mean, this.standardDeviation), false | ||
| ); | ||
| } | ||
| }, | ||
|
|
||
| derivedData: function (mean, standardDeviation) { | ||
| var intervals = this.options.intervals, | ||
| pointsInInterval = this.options.pointsInInterval, | ||
| x = mean - intervals * standardDeviation, | ||
| stop = intervals * pointsInInterval * 2 + 1, | ||
| increment = standardDeviation / pointsInInterval, | ||
| data = [], | ||
| i; | ||
|
|
||
| for (i = 0; i < stop; i++) { | ||
| data.push([x, normalDensity(x, mean, standardDeviation)]); | ||
| x += increment; | ||
| } | ||
|
|
||
| return data; | ||
| } | ||
| })); | ||
|
|
||
|
|
||
| /** | ||
| * A `bellcurve` series. If the [type](#series.bellcurve.type) option is not | ||
| * specified, it is inherited from [chart.type](#chart.type). | ||
| * | ||
| * For options that apply to multiple series, it is recommended to add | ||
| * them to the [plotOptions.series](#plotOptions.series) options structure. | ||
| * To apply to all series of this specific type, apply it to | ||
| * [plotOptions.bellcurve](#plotOptions.bellcurve). | ||
| * | ||
| * @type {Object} | ||
| * @since 6.0.0 | ||
| * @extends series,plotOptions.bellcurve | ||
| * @excluding dataParser,dataURL,data | ||
| * @product highcharts | ||
| * @apioption series.bellcurve | ||
| */ | ||
|
|
||
| /** | ||
| * An integer identifying the index to use for the base series, or a string | ||
| * representing the id of the series. | ||
| * | ||
| * @type {Number|String} | ||
| * @default undefined | ||
| * @apioption series.bellcurve.baseSeries | ||
| */ | ||
|
|
||
| /** | ||
| * An array of data points for the series. For the `bellcurve` series type, | ||
| * points are calculated dynamically. | ||
| * | ||
| * @type {Array<Object|Array>} | ||
| * @since 6.0.0 | ||
| * @extends series.areaspline.data | ||
| * @product highcharts | ||
| * @apioption series.bellcurve.data | ||
| */ |