/base/000_base/bower_components/highcharts/js/modules/stock.src.js |
@@ -1,5 +1,5 @@ |
/** |
* @license Highcharts JS v5.0.10 (2017-03-31) |
* @license Highcharts JS v5.0.12 (2017-05-24) |
* Highstock as a plugin for Highcharts |
* |
* (c) 2017 Torstein Honsi |
@@ -687,37 +687,6 @@ |
} |
}); |
|
|
|
/** |
* Extend getGraphPath by identifying gaps in the ordinal data so that we can draw a gap in the |
* line or area |
*/ |
Series.prototype.gappedPath = function() { |
var gapSize = this.options.gapSize, |
points = this.points.slice(), |
i = points.length - 1; |
|
if (gapSize && i > 0) { // #5008 |
|
// extension for ordinal breaks |
while (i--) { |
if (points[i + 1].x - points[i].x > this.closestPointRange * gapSize) { |
points.splice( // insert after this one |
i + 1, |
0, { |
isNull: true |
} |
); |
} |
} |
} |
|
// Call base method |
//return proceed.call(this, points, a, b); |
return this.getGraphPath(points); |
}; |
|
/* **************************************************************************** |
* End ordinal axis logic * |
*****************************************************************************/ |
@@ -879,17 +848,14 @@ |
length = 0, |
inBrk, |
repeat, |
brk, |
min = axis.userMin || axis.min, |
max = axis.userMax || axis.max, |
pointRangePadding = pick(axis.pointRangePadding, 0), |
start, |
i, |
j; |
i; |
|
// Min & max check (#4247) |
for (i in breaks) { |
brk = breaks[i]; |
each(breaks, function(brk) { |
repeat = brk.repeat || Infinity; |
if (axis.isInBreak(brk, min)) { |
min += (brk.to % repeat) - (min % repeat); |
@@ -897,11 +863,10 @@ |
if (axis.isInBreak(brk, max)) { |
max -= (max % repeat) - (brk.from % repeat); |
} |
} |
}); |
|
// Construct an array holding all breaks in the axis |
for (i in breaks) { |
brk = breaks[i]; |
each(breaks, function(brk) { |
start = brk.from; |
repeat = brk.repeat || Infinity; |
|
@@ -912,18 +877,18 @@ |
start += repeat; |
} |
|
for (j = start; j < max; j += repeat) { |
for (i = start; i < max; i += repeat) { |
breakArrayT.push({ |
value: j, |
value: i, |
move: 'in' |
}); |
breakArrayT.push({ |
value: j + (brk.to - brk.from), |
value: i + (brk.to - brk.from), |
move: 'out', |
size: brk.breakSize |
}); |
} |
} |
}); |
|
breakArrayT.sort(function(a, b) { |
var ret; |
@@ -939,8 +904,7 @@ |
inBrk = 0; |
start = min; |
|
for (i in breakArrayT) { |
brk = breakArrayT[i]; |
each(breakArrayT, function(brk) { |
inBrk += (brk.move === 'in' ? 1 : -1); |
|
if (inBrk === 1 && brk.move === 'in') { |
@@ -954,7 +918,7 @@ |
}); |
length += brk.value - start - (brk.size || 0); |
} |
} |
}); |
|
axis.breakArray = breakArray; |
|
@@ -966,7 +930,7 @@ |
|
if (axis.options.staticScale) { |
axis.transA = axis.options.staticScale; |
} else { |
} else if (axis.unitLength) { |
axis.transA *= (max - axis.min + pointRangePadding) / |
axis.unitLength; |
} |
@@ -1053,6 +1017,36 @@ |
}); |
}; |
|
|
/** |
* Extend getGraphPath by identifying gaps in the data so that we can draw a gap |
* in the line or area. This was moved from ordinal axis module to broken axis |
* module as of #5045. |
*/ |
H.Series.prototype.gappedPath = function() { |
var gapSize = this.options.gapSize, |
points = this.points.slice(), |
i = points.length - 1; |
|
if (gapSize && i > 0) { // #5008 |
|
// extension for ordinal breaks |
while (i--) { |
if (points[i + 1].x - points[i].x > this.closestPointRange * gapSize) { |
points.splice( // insert after this one |
i + 1, |
0, { |
isNull: true |
} |
); |
} |
} |
} |
|
// Call base method |
return this.getGraphPath(points); |
}; |
|
wrap(H.seriesTypes.column.prototype, 'drawPoints', drawPointsWrapped); |
wrap(H.Series.prototype, 'drawPoints', drawPointsWrapped); |
|
@@ -1173,9 +1167,10 @@ |
|
|
/** |
* Define the available approximation types. The data grouping approximations takes an array |
* or numbers as the first parameter. In case of ohlc, four arrays are sent in as four parameters. |
* Each array consists only of numbers. In case null values belong to the group, the property |
* Define the available approximation types. The data grouping |
* approximations takes an array or numbers as the first parameter. In case |
* of ohlc, four arrays are sent in as four parameters. Each array consists |
* only of numbers. In case null values belong to the group, the property |
* .hasNulls will be set to true on the array. |
*/ |
approximations = { |
@@ -1202,8 +1197,8 @@ |
var len = arr.length, |
ret = approximations.sum(arr); |
|
// If we have a number, return it divided by the length. If not, return |
// null or undefined based on what the sum method finds. |
// If we have a number, return it divided by the length. If not, |
// return null or undefined based on what the sum method finds. |
if (isNumber(ret) && len) { |
ret = ret / len; |
} |
@@ -1210,6 +1205,17 @@ |
|
return ret; |
}, |
// The same as average, but for series with multiple values, like area |
// ranges. |
averages: function() { // #5479 |
var ret = []; |
|
each(arguments, function(arr) { |
ret.push(approximations.average(arr)); |
}); |
|
return ret; |
}, |
open: function(arr) { |
return arr.length ? arr[0] : (arr.hasNulls ? null : undefined); |
}, |
@@ -1240,6 +1246,8 @@ |
|
if (isNumber(low) || isNumber(high)) { |
return [low, high]; |
} else if (low === null && high === null) { |
return null; |
} |
// else, return is undefined |
} |
@@ -1247,8 +1255,8 @@ |
|
|
/** |
* Takes parallel arrays of x and y data and groups the data into intervals defined by groupPositions, a collection |
* of starting x values for each group. |
* Takes parallel arrays of x and y data and groups the data into intervals |
* defined by groupPositions, a collection of starting x values for each group. |
*/ |
seriesProto.groupData = function(xData, yData, groupPositions, approximation) { |
var series = this, |
@@ -1261,20 +1269,36 @@ |
pointX, |
pointY, |
groupedY, |
handleYData = !!yData, // when grouping the fake extended axis for panning, we don't need to consider y |
values = [ |
[], |
[], |
[], |
[] |
], |
approximationFn = typeof approximation === 'function' ? approximation : approximations[approximation], |
// when grouping the fake extended axis for panning, |
// we don't need to consider y |
handleYData = !!yData, |
values = [], |
approximationFn = typeof approximation === 'function' ? |
approximation : |
approximations[approximation] || |
// if the approximation is not found use default series type |
// approximation (#2914) |
( |
specificOptions[series.type] && |
approximations[specificOptions[series.type].approximation] |
) || approximations[commonOptions.approximation], |
pointArrayMap = series.pointArrayMap, |
pointArrayMapLength = pointArrayMap && pointArrayMap.length, |
i, |
pos = 0, |
start = 0; |
start = 0, |
valuesLen, |
i, j; |
|
// Calculate values array size from pointArrayMap length |
if (pointArrayMapLength) { |
each(pointArrayMap, function() { |
values.push([]); |
}); |
} else { |
values.push([]); |
} |
valuesLen = pointArrayMapLength || 1; |
|
// Start with the first point within the X axis range (#2696) |
for (i = 0; i <= dataLength; i++) { |
if (xData[i] >= groupPositions[0]) { |
@@ -1284,9 +1308,12 @@ |
|
for (i; i <= dataLength; i++) { |
|
// when a new group is entered, summarize and initiate the previous group |
while ((groupPositions[pos + 1] !== undefined && xData[i] >= groupPositions[pos + 1]) || |
i === dataLength) { // get the last group |
// when a new group is entered, summarize and initiate |
// the previous group |
while (( |
groupPositions[pos + 1] !== undefined && |
xData[i] >= groupPositions[pos + 1] |
) || i === dataLength) { // get the last group |
|
// get group x and y |
pointX = groupPositions[pos]; |
@@ -1305,10 +1332,10 @@ |
|
// reset the aggregate arrays |
start = i; |
values[0] = []; |
values[1] = []; |
values[2] = []; |
values[3] = []; |
for (j = 0; j < valuesLen; j++) { |
values[j].length = 0; // faster than values[j] = [] |
values[j].hasNulls = false; |
} |
|
// Advance on the group positions |
pos += 1; |
@@ -1324,14 +1351,15 @@ |
break; |
} |
|
// for each raw data point, push it to an array that contains all values for this specific group |
// for each raw data point, push it to an array that contains all values |
// for this specific group |
if (pointArrayMap) { |
|
var index = series.cropStart + i, |
point = (data && data[index]) || series.pointClass.prototype.applyOptions.apply({ |
point = (data && data[index]) || |
series.pointClass.prototype.applyOptions.apply({ |
series: series |
}, [dataOptions[index]]), |
j, |
val; |
|
for (j = 0; j < pointArrayMapLength; j++) { |
@@ -1395,6 +1423,7 @@ |
hasGroupedData = true; |
|
series.isDirty = true; // force recreation of point instances in series.translate, #5699 |
series.points = null; // #6709 |
|
var extremes = xAxis.getExtremes(), |
xMin = extremes.min, |
@@ -1651,7 +1680,17 @@ |
}; |
|
/** |
* Force data grouping on all the axis' series. |
* Highstock only. Force data grouping on all the axis' series. |
* |
* @param {SeriesDatagroupingOptions} [dataGrouping] |
* A `dataGrouping` configuration. Use `false` to disable data grouping |
* dynamically. |
* @param {Boolean} [redraw=true] |
* Whether to redraw the chart or wait for a later call to {@link |
* Chart#redraw}. |
* |
* @function setDataGrouping |
* @memberOf Axis.prototype |
*/ |
Axis.prototype.setDataGrouping = function(dataGrouping, redraw) { |
var i; |
@@ -1730,7 +1769,7 @@ |
toYData: function(point) { // return a plain array for speedy calculation |
return [point.open, point.high, point.low, point.close]; |
}, |
pointValKey: 'high', |
pointValKey: 'close', |
|
|
|
@@ -1755,6 +1794,10 @@ |
point[translated[i]] = yAxis.toPixels(value, true); |
} |
}); |
|
// Align the tooltip to the high value to avoid covering the point |
point.tooltipPos[1] = |
point.plotHigh + yAxis.pos - series.chart.plotTop; |
}); |
}, |
|
@@ -1797,7 +1840,7 @@ |
'M', |
crispX, Math.round(point.yBottom), |
'L', |
crispX, Math.round(point.plotY) |
crispX, Math.round(point.plotHigh) |
]; |
|
// open |
@@ -1929,7 +1972,7 @@ |
topBox = Math.min(plotOpen, plotClose); |
bottomBox = Math.max(plotOpen, plotClose); |
halfWidth = Math.round(point.shapeArgs.width / 2); |
hasTopWhisker = Math.round(topBox) !== Math.round(point.plotY); |
hasTopWhisker = Math.round(topBox) !== Math.round(point.plotHigh); |
hasBottomWhisker = bottomBox !== point.yBottom; |
topBox = Math.round(topBox) + crispCorr; |
bottomBox = Math.round(bottomBox) + crispCorr; |
@@ -1952,7 +1995,7 @@ |
'M', |
crispX, topBox, |
'L', |
crispX, hasTopWhisker ? Math.round(point.plotY) : topBox, // #460, #2094 |
crispX, hasTopWhisker ? Math.round(point.plotHigh) : topBox, // #460, #2094 |
'M', |
crispX, bottomBox, |
'L', |
@@ -2886,7 +2929,7 @@ |
each(this._events, function(args) { |
removeEvent.apply(null, args); |
}); |
this._events = undefined; |
this._events.length = 0; |
}, |
|
/** |
@@ -2958,6 +3001,7 @@ |
scrollMin = Math.min(pick(axis.options.min, axis.min), axis.min, axis.dataMin), |
scrollMax = Math.max(pick(axis.options.max, axis.max), axis.max, axis.dataMax), |
scrollbar = axis.scrollbar, |
titleOffset = axis.titleOffset || 0, |
offsetsIndex, |
from, |
to; |
@@ -2970,7 +3014,10 @@ |
scrollbar.position( |
axis.left, |
axis.top + axis.height + 2 + axis.chart.scrollbarsOffsets[1] + |
(axis.opposite ? 0 : axis.axisTitleMargin + axis.offset), |
(axis.opposite ? |
0 : |
titleOffset + axis.axisTitleMargin + axis.offset |
), |
axis.width, |
axis.height |
); |
@@ -2978,7 +3025,10 @@ |
} else { |
scrollbar.position( |
axis.left + axis.width + 2 + axis.chart.scrollbarsOffsets[0] + |
(axis.opposite ? axis.axisTitleMargin + axis.offset : 0), |
(axis.opposite ? |
titleOffset + axis.axisTitleMargin + axis.offset : |
0 |
), |
axis.top, |
axis.width, |
axis.height |
@@ -3434,6 +3484,7 @@ |
scrollbarHeight = navigator.scrollbarHeight, |
navigatorSize, |
xAxis = navigator.xAxis, |
scrollbarXAxis = xAxis.fake ? chart.xAxis[0] : xAxis, |
navigatorEnabled = navigator.navigatorEnabled, |
zoomedMin, |
zoomedMax, |
@@ -3534,7 +3585,12 @@ |
if (inverted) { |
scrollbarTop = navigator.top - scrollbarHeight; |
scrollbarLeft = navigator.left - scrollbarHeight + |
(navigatorEnabled ? 0 : navigator.height); |
(navigatorEnabled || !scrollbarXAxis.opposite ? 0 : |
// Multiple axes has offsets: |
(scrollbarXAxis.titleOffset || 0) + |
// Self margin from the axis.title |
scrollbarXAxis.axisTitleMargin |
); |
scrollbarHeight = navigatorSize + 2 * scrollbarHeight; |
} else { |
scrollbarTop = navigator.top + |
@@ -5287,15 +5343,15 @@ |
* Destroys allocated elements. |
*/ |
destroy: function() { |
var minInput = this.minInput, |
maxInput = this.maxInput, |
key; |
var rSelector = this, |
minInput = rSelector.minInput, |
maxInput = rSelector.maxInput; |
|
this.unMouseDown(); |
this.unResize(); |
rSelector.unMouseDown(); |
rSelector.unResize(); |
|
// Destroy elements in collections |
destroyObjectProperties(this.buttons); |
destroyObjectProperties(rSelector.buttons); |
|
// Clear input element events |
if (minInput) { |
@@ -5306,18 +5362,18 @@ |
} |
|
// Destroy HTML and SVG elements |
for (key in this) { |
if (this[key] && key !== 'chart') { |
if (this[key].destroy) { // SVGElement |
this[key].destroy(); |
} else if (this[key].nodeType) { // HTML element |
H.objectEach(rSelector, function(val, key) { |
if (val && key !== 'chart') { |
if (val.destroy) { // SVGElement |
val.destroy(); |
} else if (val.nodeType) { // HTML element |
discardElement(this[key]); |
} |
} |
if (this[key] !== RangeSelector.prototype[key]) { |
this[key] = null; |
if (val !== RangeSelector.prototype[key]) { |
rSelector[key] = null; |
} |
} |
}, this); |
} |
}; |
|
@@ -5371,8 +5427,15 @@ |
range, |
// Get the true range from a start date |
getTrueRange = function(base, count) { |
var date = new Date(base); |
date['set' + timeName](date['get' + timeName]() + count); |
var date = new Date(base), |
basePeriod = date['get' + timeName](); |
|
date['set' + timeName](basePeriod + count); |
|
if (basePeriod === date['get' + timeName]()) { |
date.setDate(0); // #6537 |
} |
|
return date.getTime() - base; |
}; |
|
@@ -5480,6 +5543,7 @@ |
each = H.each, |
extend = H.extend, |
format = H.format, |
grep = H.grep, |
inArray = H.inArray, |
isNumber = H.isNumber, |
isString = H.isString, |
@@ -5499,8 +5563,39 @@ |
seriesInit = seriesProto.init, |
seriesProcessData = seriesProto.processData, |
pointTooltipFormatter = Point.prototype.tooltipFormatter; |
|
/** |
* A wrapper for Chart with all the default values for a Stock chart |
* Factory function for creating new stock charts. Creates a new {@link Chart| |
* Chart} object with different default options than the basic Chart. |
* |
* @function #stockChart |
* @memberOf Highcharts |
* |
* @param {String|HTMLDOMElement} renderTo |
* The DOM element to render to, or its id. |
* @param {Options} options |
* The chart options structure as described in the {@link |
* https://api.highcharts.com/highstock|options reference}. |
* @param {Function} callback |
* A function to execute when the chart object is finished loading and |
* rendering. In most cases the chart is built in one thread, but in |
* Internet Explorer version 8 or less the chart is sometimes initiated |
* before the document is ready, and in these cases the chart object |
* will not be finished synchronously. As a consequence, code that |
* relies on the newly built Chart object should always run in the |
* callback. Defining a {@link https://api.highcharts.com/highstock/chart.events.load| |
* chart.event.load} handler is equivalent. |
* |
* @return {Chart} |
* The chart object. |
* |
* @example |
* var chart = Highcharts.stockChart('container', { |
* series: [{ |
* data: [1, 2, 3, 4, 5, 6, 7, 8, 9], |
* pointInterval: 24 * 60 * 60 * 1000 |
* }] |
* }); |
*/ |
H.StockChart = H.stockChart = function(a, b, c) { |
var hasRenderToArg = isString(a) || a.nodeName, |
@@ -5711,8 +5806,8 @@ |
}); |
} |
|
// Ignore in case of color Axis. #3360, #3524 |
if (axis.coll === 'colorAxis') { |
// Ignore in case of colorAxis or zAxis. #3360, #3524, #6720 |
if (axis.coll !== 'xAxis' && axis.coll !== 'yAxis') { |
return proceed.apply(this, [].slice.call(arguments, 1)); |
} |
|
@@ -5738,7 +5833,13 @@ |
// lines (#2796). |
uniqueAxes = axes.length ? [] : [axis.isXAxis ? chart.yAxis[0] : chart.xAxis[0]]; //#3742 |
each(axes, function(axis2) { |
if (inArray(axis2, uniqueAxes) === -1) { |
if ( |
inArray(axis2, uniqueAxes) === -1 && |
// Do not draw on axis which overlap completely. #5424 |
!H.find(uniqueAxes, function(unique) { |
return unique.pos === axis2.pos && unique.len && axis2.len; |
}) |
) { |
uniqueAxes.push(axis2); |
} |
}); |
@@ -5992,7 +6093,17 @@ |
}; |
|
/** |
* The setCompare method can be called also from the outside after render time |
* Highstock only. Set the {@link |
* http://api.highcharts.com/highstock/plotOptions.series.compare| |
* compare} mode of the series after render time. In most cases it is more |
* useful running {@link Axis#setCompare} on the X axis to update all its |
* series. |
* |
* @function setCompare |
* @memberOf Series.prototype |
* |
* @param {String} compare |
* Can be one of `null`, `"percent"` or `"value"`. |
*/ |
seriesProto.setCompare = function(compare) { |
|
@@ -6066,7 +6177,7 @@ |
|
// find the first value for comparison |
for (i = 0; i < length - 1; i++) { |
compareValue = keyIndex > -1 ? |
compareValue = processedYData[i] && keyIndex > -1 ? |
processedYData[i][keyIndex] : |
processedYData[i]; |
if (isNumber(compareValue) && processedXData[i + 1] >= series.xAxis.min && compareValue !== 0) { |
@@ -6093,7 +6204,23 @@ |
}); |
|
/** |
* Add a utility method, setCompare, to the Y axis |
* Highstock only. Set the compare mode on all series belonging to an Y axis |
* after render time. |
* |
* @param {String} compare |
* The compare mode. Can be one of `null`, `"value"` or `"percent"`. |
* @param {Boolean} [redraw=true] |
* Whether to redraw the chart or to wait for a later call to {@link |
* Chart#redraw}, |
* |
* @function setCompare |
* @memberOf Axis.prototype |
* |
* @see {@link https://api.highcharts.com/highstock/series.plotOptions.compare| |
* series.plotOptions.compare} |
* |
* @sample stock/members/axis-setcompare/ |
* Set compoare |
*/ |
Axis.prototype.setCompare = function(compare, redraw) { |
if (!this.isXAxis) { |
@@ -6162,5 +6289,32 @@ |
proceed.call(this); |
}); |
|
wrap(Chart.prototype, 'getSelectedPoints', function(proceed) { |
var points = proceed.call(this); |
|
each(this.series, function(serie) { |
// series.points - for grouped points (#6445) |
if (serie.hasGroupedData) { |
points = points.concat(grep(serie.points || [], function(point) { |
return point.selected; |
})); |
} |
}); |
return points; |
}); |
|
wrap(Chart.prototype, 'update', function(proceed, options) { |
// Use case: enabling scrollbar from a disabled state. |
// Scrollbar needs to be initialized from a controller, Navigator in this |
// case (#6615) |
if ('scrollbar' in options && this.navigator) { |
merge(true, this.options.scrollbar, options.scrollbar); |
this.navigator.update({}, false); |
delete options.scrollbar; |
} |
|
return proceed.apply(this, Array.prototype.slice.call(arguments, 1)); |
}); |
|
}(Highcharts)); |
})); |