-
Notifications
You must be signed in to change notification settings - Fork 3.5k
/
ErrorBarSeries.js
46 lines (42 loc) · 1.73 KB
/
ErrorBarSeries.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* ****************************************************************************
* Start error bar series code *
*****************************************************************************/
// 1 - set default options
defaultPlotOptions.errorbar = merge(defaultPlotOptions.boxplot, {
color: '#000000',
grouping: false,
linkedTo: ':previous',
tooltip: {
pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.low}</b> - <b>{point.high}</b><br/>'
},
whiskerWidth: null
});
// 2 - Create the series object
seriesTypes.errorbar = extendClass(seriesTypes.boxplot, {
type: 'errorbar',
pointArrayMap: ['low', 'high'], // array point configs are mapped to this
toYData: function (point) { // return a plain array for speedy calculation
return [point.low, point.high];
},
pointValKey: 'high', // defines the top of the tracker
doQuartiles: false,
drawDataLabels: seriesTypes.arearange ? function () {
var valKey = this.pointValKey;
seriesTypes.arearange.prototype.drawDataLabels.call(this);
// Arearange drawDataLabels does not reset point.y to high, but to low after drawing. #4133
each(this.data, function (point) {
point.y = point[valKey];
});
} : noop,
/**
* Get the width and X offset, either on top of the linked series column
* or standalone
*/
getColumnMetrics: function () {
return (this.linkedParent && this.linkedParent.columnMetrics) ||
seriesTypes.column.prototype.getColumnMetrics.call(this);
}
});
/* ****************************************************************************
* End error bar series code *
*****************************************************************************/