highcharts-rails 5.0.14 → 6.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +60 -0
- data/Rakefile +54 -5
- data/app/assets/images/highcharts/earth.svg +432 -0
- data/app/assets/javascripts/highcharts.js +5103 -3147
- data/app/assets/javascripts/highcharts/highcharts-3d.js +930 -277
- data/app/assets/javascripts/highcharts/highcharts-more.js +1374 -249
- data/app/assets/javascripts/highcharts/lib/canvg.js +3073 -0
- data/app/assets/javascripts/highcharts/lib/jspdf.js +16624 -0
- data/app/assets/javascripts/highcharts/lib/rgbcolor.js +299 -0
- data/app/assets/javascripts/highcharts/lib/svg2pdf.js +3488 -0
- data/app/assets/javascripts/highcharts/modules/accessibility.js +654 -212
- data/app/assets/javascripts/highcharts/modules/annotations.js +1552 -274
- data/app/assets/javascripts/highcharts/modules/boost-canvas.js +773 -0
- data/app/assets/javascripts/highcharts/modules/boost.js +636 -210
- data/app/assets/javascripts/highcharts/modules/broken-axis.js +2 -2
- data/app/assets/javascripts/highcharts/modules/bullet.js +364 -0
- data/app/assets/javascripts/highcharts/modules/data.js +766 -38
- data/app/assets/javascripts/highcharts/modules/drag-panes.js +588 -0
- data/app/assets/javascripts/highcharts/modules/drilldown.js +106 -36
- data/app/assets/javascripts/highcharts/modules/export-data.js +597 -0
- data/app/assets/javascripts/highcharts/modules/exporting.js +424 -162
- data/app/assets/javascripts/highcharts/modules/funnel.js +144 -22
- data/app/assets/javascripts/highcharts/modules/gantt.js +1154 -0
- data/app/assets/javascripts/highcharts/modules/grid-axis.js +1 -1
- data/app/assets/javascripts/highcharts/modules/heatmap.js +406 -80
- data/app/assets/javascripts/highcharts/modules/histogram-bellcurve.js +513 -0
- data/app/assets/javascripts/highcharts/modules/item-series.js +126 -0
- data/app/assets/javascripts/highcharts/modules/no-data-to-display.js +31 -13
- data/app/assets/javascripts/highcharts/modules/offline-exporting.js +179 -57
- data/app/assets/javascripts/highcharts/modules/oldie.js +1378 -0
- data/app/assets/javascripts/highcharts/modules/overlapping-datalabels.js +8 -6
- data/app/assets/javascripts/highcharts/modules/parallel-coordinates.js +494 -0
- data/app/assets/javascripts/highcharts/modules/pareto.js +275 -0
- data/app/assets/javascripts/highcharts/modules/sankey.js +641 -0
- data/app/assets/javascripts/highcharts/modules/series-label.js +355 -145
- data/app/assets/javascripts/highcharts/modules/solid-gauge.js +122 -1
- data/app/assets/javascripts/highcharts/modules/static-scale.js +64 -0
- data/app/assets/javascripts/highcharts/modules/stock.js +1944 -676
- data/app/assets/javascripts/highcharts/modules/streamgraph.js +139 -0
- data/app/assets/javascripts/highcharts/modules/sunburst.js +2403 -0
- data/app/assets/javascripts/highcharts/modules/tilemap.js +1199 -0
- data/app/assets/javascripts/highcharts/modules/treemap.js +538 -134
- data/app/assets/javascripts/highcharts/modules/variable-pie.js +490 -0
- data/app/assets/javascripts/highcharts/modules/variwide.js +283 -0
- data/app/assets/javascripts/highcharts/modules/vector.js +294 -0
- data/app/assets/javascripts/highcharts/modules/windbarb.js +490 -0
- data/app/assets/javascripts/highcharts/modules/wordcloud.js +681 -0
- data/app/assets/javascripts/highcharts/modules/xrange.js +615 -0
- data/app/assets/javascripts/highcharts/themes/avocado.js +54 -0
- data/app/assets/javascripts/highcharts/themes/dark-blue.js +6 -6
- data/app/assets/javascripts/highcharts/themes/dark-green.js +6 -6
- data/app/assets/javascripts/highcharts/themes/dark-unica.js +6 -6
- data/app/assets/javascripts/highcharts/themes/gray.js +14 -10
- data/app/assets/javascripts/highcharts/themes/grid-light.js +6 -6
- data/app/assets/javascripts/highcharts/themes/grid.js +7 -5
- data/app/assets/javascripts/highcharts/themes/sand-signika.js +8 -7
- data/app/assets/javascripts/highcharts/themes/skies.js +15 -9
- data/app/assets/javascripts/highcharts/themes/sunset.js +53 -0
- data/app/assets/stylesheets/highcharts/highcharts.css +802 -0
- data/app/assets/stylesheets/highcharts/highcharts.scss +665 -0
- data/lib/highcharts/version.rb +1 -1
- metadata +31 -1
@@ -0,0 +1,615 @@
|
|
1
|
+
/**
|
2
|
+
* @license Highcharts JS v6.0.0 (2017-10-04)
|
3
|
+
* X-range series
|
4
|
+
*
|
5
|
+
* (c) 2010-2017 Torstein Honsi, Lars A. V. Cabrera
|
6
|
+
*
|
7
|
+
* License: www.highcharts.com/license
|
8
|
+
*/
|
9
|
+
'use strict';
|
10
|
+
(function(factory) {
|
11
|
+
if (typeof module === 'object' && module.exports) {
|
12
|
+
module.exports = factory;
|
13
|
+
} else {
|
14
|
+
factory(Highcharts);
|
15
|
+
}
|
16
|
+
}(function(Highcharts) {
|
17
|
+
(function(H) {
|
18
|
+
/**
|
19
|
+
* X-range series module
|
20
|
+
*
|
21
|
+
* (c) 2010-2017 Torstein Honsi, Lars A. V. Cabrera
|
22
|
+
*
|
23
|
+
* License: www.highcharts.com/license
|
24
|
+
*/
|
25
|
+
|
26
|
+
/**
|
27
|
+
* @todo
|
28
|
+
* - JSDoc
|
29
|
+
* - New series checklist
|
30
|
+
*/
|
31
|
+
|
32
|
+
|
33
|
+
var defined = H.defined,
|
34
|
+
color = H.Color,
|
35
|
+
columnType = H.seriesTypes.column,
|
36
|
+
each = H.each,
|
37
|
+
isNumber = H.isNumber,
|
38
|
+
isObject = H.isObject,
|
39
|
+
merge = H.merge,
|
40
|
+
pick = H.pick,
|
41
|
+
seriesType = H.seriesType,
|
42
|
+
seriesTypes = H.seriesTypes,
|
43
|
+
wrap = H.wrap,
|
44
|
+
Axis = H.Axis,
|
45
|
+
Point = H.Point,
|
46
|
+
Series = H.Series;
|
47
|
+
|
48
|
+
/**
|
49
|
+
* The X-range series displays ranges on the X axis, typically time intervals
|
50
|
+
* with a start and end date.
|
51
|
+
*
|
52
|
+
* @extends {plotOptions.column}
|
53
|
+
* @excluding boostThreshold,crisp,cropThreshold,depth,edgeColor,edgeWidth,
|
54
|
+
* findNearestPointBy,getExtremesFromAll,grouping,groupPadding,
|
55
|
+
* negativeColor,pointInterval,pointIntervalUnit,pointPlacement,
|
56
|
+
* pointRange,pointStart,softThreshold,stacking,threshold
|
57
|
+
* @product highcharts
|
58
|
+
* @sample {highcharts} highcharts/demo/x-range/
|
59
|
+
* X-range
|
60
|
+
* @sample {highcharts} highcharts/css/x-range/
|
61
|
+
* Styled mode X-range
|
62
|
+
* @sample {highcharts} highcharts/chart/inverted-xrange/
|
63
|
+
* Inverted X-range
|
64
|
+
* @since 6.0.0
|
65
|
+
* @optionparent plotOptions.xrange
|
66
|
+
*/
|
67
|
+
seriesType('xrange', 'column', {
|
68
|
+
/**
|
69
|
+
* In an X-range series, this option makes all points of the same Y-axis
|
70
|
+
* category the same color.
|
71
|
+
*/
|
72
|
+
colorByPoint: true,
|
73
|
+
dataLabels: {
|
74
|
+
verticalAlign: 'middle',
|
75
|
+
inside: true,
|
76
|
+
/**
|
77
|
+
* The default formatter for X-range data labels displays the percentage
|
78
|
+
* of the partial fill amount.
|
79
|
+
*/
|
80
|
+
formatter: function() {
|
81
|
+
var point = this.point,
|
82
|
+
amount = point.partialFill;
|
83
|
+
if (isObject(amount)) {
|
84
|
+
amount = amount.amount;
|
85
|
+
}
|
86
|
+
if (!defined(amount)) {
|
87
|
+
amount = 0;
|
88
|
+
}
|
89
|
+
return (amount * 100) + '%';
|
90
|
+
}
|
91
|
+
},
|
92
|
+
tooltip: {
|
93
|
+
headerFormat: '<span style="font-size: 0.85em">{point.x} - {point.x2}</span><br/>',
|
94
|
+
pointFormat: '<span style="color:{point.color}">\u25CF</span> {series.name}: <b>{point.yCategory}</b><br/>'
|
95
|
+
},
|
96
|
+
borderRadius: 3
|
97
|
+
/**
|
98
|
+
* A partial fill for each point, typically used to visualize how much of
|
99
|
+
* a task is performed. The partial fill object can be set either on series
|
100
|
+
* or point level.
|
101
|
+
*
|
102
|
+
* @sample {highcharts} highcharts/demo/x-range
|
103
|
+
* X-range with partial fill
|
104
|
+
* @type {Object}
|
105
|
+
* @product highcharts
|
106
|
+
* @apioption plotOptions.xrange.partialFill
|
107
|
+
*/
|
108
|
+
/**
|
109
|
+
* The fill color to be used for partial fills. Defaults to a darker shade
|
110
|
+
* of the point color.
|
111
|
+
*
|
112
|
+
* @type {Color}
|
113
|
+
* @product highcharts
|
114
|
+
* @apioption plotOptions.xrange.partialFill.fill
|
115
|
+
*/
|
116
|
+
|
117
|
+
}, {
|
118
|
+
type: 'xrange',
|
119
|
+
forceDL: true,
|
120
|
+
parallelArrays: ['x', 'x2', 'y'],
|
121
|
+
requireSorting: false,
|
122
|
+
animate: seriesTypes.line.prototype.animate,
|
123
|
+
cropShoulder: 1,
|
124
|
+
getExtremesFromAll: true,
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Borrow the column series metrics, but with swapped axes. This gives free
|
128
|
+
* access to features like groupPadding, grouping, pointWidth etc.
|
129
|
+
*/
|
130
|
+
getColumnMetrics: function() {
|
131
|
+
var metrics,
|
132
|
+
chart = this.chart;
|
133
|
+
|
134
|
+
function swapAxes() {
|
135
|
+
each(chart.series, function(s) {
|
136
|
+
var xAxis = s.xAxis;
|
137
|
+
s.xAxis = s.yAxis;
|
138
|
+
s.yAxis = xAxis;
|
139
|
+
});
|
140
|
+
}
|
141
|
+
|
142
|
+
swapAxes();
|
143
|
+
|
144
|
+
metrics = columnType.prototype.getColumnMetrics.call(this);
|
145
|
+
|
146
|
+
swapAxes();
|
147
|
+
|
148
|
+
return metrics;
|
149
|
+
},
|
150
|
+
|
151
|
+
/**
|
152
|
+
* Override cropData to show a point where x or x2 is outside visible range,
|
153
|
+
* but one of them is inside.
|
154
|
+
*/
|
155
|
+
cropData: function(xData, yData, min, max) {
|
156
|
+
|
157
|
+
// Replace xData with x2Data to find the appropriate cropStart
|
158
|
+
var cropData = Series.prototype.cropData,
|
159
|
+
crop = cropData.call(this, this.x2Data, yData, min, max);
|
160
|
+
|
161
|
+
// Re-insert the cropped xData
|
162
|
+
crop.xData = xData.slice(crop.start, crop.end);
|
163
|
+
|
164
|
+
return crop;
|
165
|
+
},
|
166
|
+
|
167
|
+
translatePoint: function(point) {
|
168
|
+
var series = this,
|
169
|
+
xAxis = series.xAxis,
|
170
|
+
metrics = series.columnMetrics,
|
171
|
+
minPointLength = series.options.minPointLength || 0,
|
172
|
+
plotX = point.plotX,
|
173
|
+
posX = pick(point.x2, point.x + (point.len || 0)),
|
174
|
+
plotX2 = xAxis.translate(posX, 0, 0, 0, 1),
|
175
|
+
length = plotX2 - plotX,
|
176
|
+
widthDifference,
|
177
|
+
shapeArgs,
|
178
|
+
partialFill,
|
179
|
+
inverted = this.chart.inverted,
|
180
|
+
borderWidth = pick(series.options.borderWidth, 1),
|
181
|
+
crisper = borderWidth % 2 / 2;
|
182
|
+
|
183
|
+
if (minPointLength) {
|
184
|
+
widthDifference = minPointLength - length;
|
185
|
+
if (widthDifference < 0) {
|
186
|
+
widthDifference = 0;
|
187
|
+
}
|
188
|
+
plotX -= widthDifference / 2;
|
189
|
+
plotX2 += widthDifference / 2;
|
190
|
+
}
|
191
|
+
|
192
|
+
plotX = Math.max(plotX, -10);
|
193
|
+
plotX2 = Math.min(Math.max(plotX2, -10), xAxis.len + 10);
|
194
|
+
|
195
|
+
point.shapeArgs = {
|
196
|
+
x: Math.floor(Math.min(plotX, plotX2)) + crisper,
|
197
|
+
y: Math.floor(point.plotY + metrics.offset) + crisper,
|
198
|
+
width: Math.round(Math.abs(plotX2 - plotX)),
|
199
|
+
height: Math.round(metrics.width),
|
200
|
+
r: series.options.borderRadius
|
201
|
+
};
|
202
|
+
|
203
|
+
// Tooltip position
|
204
|
+
point.tooltipPos[0] += inverted ? 0 : length / 2;
|
205
|
+
point.tooltipPos[1] -= inverted ? length / 2 : metrics.width / 2;
|
206
|
+
|
207
|
+
// Add a partShapeArgs to the point, based on the shapeArgs property
|
208
|
+
partialFill = point.partialFill;
|
209
|
+
if (partialFill) {
|
210
|
+
// Get the partial fill amount
|
211
|
+
if (isObject(partialFill)) {
|
212
|
+
partialFill = partialFill.amount;
|
213
|
+
}
|
214
|
+
// If it was not a number, assume 0
|
215
|
+
if (!isNumber(partialFill)) {
|
216
|
+
partialFill = 0;
|
217
|
+
}
|
218
|
+
shapeArgs = point.shapeArgs;
|
219
|
+
point.partShapeArgs = {
|
220
|
+
x: shapeArgs.x,
|
221
|
+
y: shapeArgs.y,
|
222
|
+
width: shapeArgs.width,
|
223
|
+
height: shapeArgs.height,
|
224
|
+
r: series.options.borderRadius
|
225
|
+
};
|
226
|
+
point.clipRectArgs = {
|
227
|
+
x: shapeArgs.x,
|
228
|
+
y: shapeArgs.y,
|
229
|
+
width: Math.round(shapeArgs.width * partialFill),
|
230
|
+
height: shapeArgs.height
|
231
|
+
};
|
232
|
+
}
|
233
|
+
},
|
234
|
+
|
235
|
+
translate: function() {
|
236
|
+
columnType.prototype.translate.apply(this, arguments);
|
237
|
+
each(this.points, function(point) {
|
238
|
+
this.translatePoint(point);
|
239
|
+
}, this);
|
240
|
+
},
|
241
|
+
|
242
|
+
/**
|
243
|
+
* Aligns an individual dataLabel.
|
244
|
+
*
|
245
|
+
* TODO: Do we need this for inside datalabels? Seems to work.
|
246
|
+
*
|
247
|
+
* @param {Object} point the point belonging to the dataLabel
|
248
|
+
* @param {Object} dataLabel the dataLabel configuration object
|
249
|
+
* @param {Object} options dataLabel options for the series
|
250
|
+
* @param {Object} alignTo
|
251
|
+
* @param {Boolean} isNew Wheter the label is new or already existed
|
252
|
+
* @return {void}
|
253
|
+
* /
|
254
|
+
alignDataLabel: function (point, dataLabel, options, alignTo, isNew) {
|
255
|
+
var chart = this.chart,
|
256
|
+
align = options.align,
|
257
|
+
inverted = chart.inverted,
|
258
|
+
plotX = pick(point.plotX, -9999),
|
259
|
+
plotY = pick(point.plotY, -9999),
|
260
|
+
verticalAlign = options.verticalAlign,
|
261
|
+
inside = options.inside,
|
262
|
+
pointBox = point.shapeArgs,
|
263
|
+
labelBox = dataLabel.getBBox(),
|
264
|
+
labelTextBox = dataLabel.text.getBBox(),
|
265
|
+
attr = {},
|
266
|
+
visible =
|
267
|
+
this.visible &&
|
268
|
+
(
|
269
|
+
labelTextBox.width <= pointBox.width &&
|
270
|
+
labelTextBox.height <= pointBox.height
|
271
|
+
) &&
|
272
|
+
(
|
273
|
+
this.forceDL ||
|
274
|
+
chart.isInsidePlot(plotX, Math.round(plotY), inverted)
|
275
|
+
);
|
276
|
+
|
277
|
+
if (visible) {
|
278
|
+
if (align === 'right') {
|
279
|
+
if (inside) {
|
280
|
+
attr.x = pointBox.x + pointBox.width - labelBox.width;
|
281
|
+
} else {
|
282
|
+
attr.x = pointBox.x - labelBox.width;
|
283
|
+
}
|
284
|
+
} else if (align === 'left') {
|
285
|
+
if (inside) {
|
286
|
+
attr.x = pointBox.x;
|
287
|
+
} else {
|
288
|
+
attr.x = pointBox.x + pointBox.width + labelBox.x;
|
289
|
+
}
|
290
|
+
} else { // Center
|
291
|
+
attr.x = pointBox.x + pointBox.width / 2 - labelBox.width / 2;
|
292
|
+
}
|
293
|
+
|
294
|
+
if (verticalAlign === 'bottom') {
|
295
|
+
if (inside) {
|
296
|
+
attr.y = pointBox.y + pointBox.height - labelBox.height;
|
297
|
+
} else {
|
298
|
+
attr.y = pointBox.y - labelBox.height;
|
299
|
+
}
|
300
|
+
} else if (verticalAlign === 'top') {
|
301
|
+
if (inside) {
|
302
|
+
attr.y = pointBox.y;
|
303
|
+
} else {
|
304
|
+
attr.y = pointBox.y + pointBox.height;
|
305
|
+
}
|
306
|
+
} else { // Middle
|
307
|
+
attr.y = pointBox.y + pointBox.height / 2 - labelBox.height / 2;
|
308
|
+
}
|
309
|
+
|
310
|
+
dataLabel[isNew ? 'attr' : 'animate'](attr);
|
311
|
+
}
|
312
|
+
},
|
313
|
+
*/
|
314
|
+
/**
|
315
|
+
* Draws a single point in the series. Needed for partial fill.
|
316
|
+
*
|
317
|
+
* This override turns point.graphic into a group containing the original
|
318
|
+
* graphic and an overlay displaying the partial fill.
|
319
|
+
*
|
320
|
+
* @param {Object} point an instance of Point in the series
|
321
|
+
* @param {string} verb 'animate' (animates changes) or 'attr' (sets
|
322
|
+
* options)
|
323
|
+
* @returns {void}
|
324
|
+
*/
|
325
|
+
drawPoint: function(point, verb) {
|
326
|
+
var series = this,
|
327
|
+
seriesOpts = series.options,
|
328
|
+
renderer = series.chart.renderer,
|
329
|
+
graphic = point.graphic,
|
330
|
+
type = point.shapeType,
|
331
|
+
shapeArgs = point.shapeArgs,
|
332
|
+
partShapeArgs = point.partShapeArgs,
|
333
|
+
clipRectArgs = point.clipRectArgs,
|
334
|
+
pfOptions = point.partialFill,
|
335
|
+
fill,
|
336
|
+
state = point.selected && 'select',
|
337
|
+
cutOff = seriesOpts.stacking && !seriesOpts.borderRadius;
|
338
|
+
|
339
|
+
if (!point.isNull) {
|
340
|
+
|
341
|
+
// Original graphic
|
342
|
+
if (graphic) { // update
|
343
|
+
point.graphicOriginal[verb](
|
344
|
+
merge(shapeArgs)
|
345
|
+
);
|
346
|
+
|
347
|
+
} else {
|
348
|
+
point.graphic = graphic = renderer.g('point')
|
349
|
+
.addClass(point.getClassName())
|
350
|
+
.add(point.group || series.group);
|
351
|
+
|
352
|
+
point.graphicOriginal = renderer[type](shapeArgs)
|
353
|
+
.addClass(point.getClassName())
|
354
|
+
.addClass('highcharts-partfill-original')
|
355
|
+
.add(graphic);
|
356
|
+
}
|
357
|
+
|
358
|
+
// Partial fill graphic
|
359
|
+
if (partShapeArgs) {
|
360
|
+
if (point.graphicOverlay) {
|
361
|
+
point.graphicOverlay[verb](
|
362
|
+
merge(partShapeArgs)
|
363
|
+
);
|
364
|
+
point.clipRect.animate(
|
365
|
+
merge(clipRectArgs)
|
366
|
+
);
|
367
|
+
|
368
|
+
} else {
|
369
|
+
|
370
|
+
point.clipRect = renderer.clipRect(
|
371
|
+
clipRectArgs.x,
|
372
|
+
clipRectArgs.y,
|
373
|
+
clipRectArgs.width,
|
374
|
+
clipRectArgs.height
|
375
|
+
);
|
376
|
+
|
377
|
+
point.graphicOverlay = renderer[type](partShapeArgs)
|
378
|
+
.addClass('highcharts-partfill-overlay')
|
379
|
+
.add(graphic)
|
380
|
+
.clip(point.clipRect);
|
381
|
+
}
|
382
|
+
}
|
383
|
+
|
384
|
+
|
385
|
+
|
386
|
+
// Presentational
|
387
|
+
point.graphicOriginal
|
388
|
+
.attr(series.pointAttribs(point, state))
|
389
|
+
.shadow(seriesOpts.shadow, null, cutOff);
|
390
|
+
if (partShapeArgs) {
|
391
|
+
// Ensure pfOptions is an object
|
392
|
+
if (!isObject(pfOptions)) {
|
393
|
+
pfOptions = {};
|
394
|
+
}
|
395
|
+
if (isObject(seriesOpts.partialFill)) {
|
396
|
+
pfOptions = merge(pfOptions, seriesOpts.partialFill);
|
397
|
+
}
|
398
|
+
|
399
|
+
fill = (
|
400
|
+
pfOptions.fill ||
|
401
|
+
color(point.color || series.color).brighten(-0.3).get()
|
402
|
+
);
|
403
|
+
|
404
|
+
point.graphicOverlay
|
405
|
+
.attr(series.pointAttribs(point, state))
|
406
|
+
.attr({
|
407
|
+
'fill': fill
|
408
|
+
})
|
409
|
+
.shadow(seriesOpts.shadow, null, cutOff);
|
410
|
+
}
|
411
|
+
|
412
|
+
|
413
|
+
} else if (graphic) {
|
414
|
+
point.graphic = graphic.destroy(); // #1269
|
415
|
+
}
|
416
|
+
},
|
417
|
+
|
418
|
+
drawPoints: function() {
|
419
|
+
var series = this,
|
420
|
+
chart = this.chart,
|
421
|
+
options = series.options,
|
422
|
+
animationLimit = options.animationLimit || 250,
|
423
|
+
verb = chart.pointCount < animationLimit ? 'animate' : 'attr';
|
424
|
+
|
425
|
+
// draw the columns
|
426
|
+
each(series.points, function(point) {
|
427
|
+
series.drawPoint(point, verb);
|
428
|
+
});
|
429
|
+
}
|
430
|
+
|
431
|
+
/**
|
432
|
+
* Override to remove stroke from points.
|
433
|
+
* For partial fill.
|
434
|
+
* /
|
435
|
+
pointAttribs: function () {
|
436
|
+
var series = this,
|
437
|
+
retVal = columnType.prototype.pointAttribs.apply(series, arguments);
|
438
|
+
|
439
|
+
//retVal['stroke-width'] = 0;
|
440
|
+
return retVal;
|
441
|
+
}
|
442
|
+
*/
|
443
|
+
|
444
|
+
// Point class properties
|
445
|
+
}, {
|
446
|
+
|
447
|
+
/**
|
448
|
+
* Extend init so that `colorByPoint` for x-range means that one color is
|
449
|
+
* applied per Y axis category.
|
450
|
+
*/
|
451
|
+
init: function() {
|
452
|
+
|
453
|
+
Point.prototype.init.apply(this, arguments);
|
454
|
+
|
455
|
+
var colors,
|
456
|
+
series = this.series,
|
457
|
+
colorCount = series.chart.options.chart.colorCount;
|
458
|
+
|
459
|
+
if (!this.y) {
|
460
|
+
this.y = 0;
|
461
|
+
}
|
462
|
+
|
463
|
+
|
464
|
+
if (series.options.colorByPoint) {
|
465
|
+
colors = series.options.colors || series.chart.options.colors;
|
466
|
+
colorCount = colors.length;
|
467
|
+
|
468
|
+
if (!this.options.color && colors[this.y % colorCount]) {
|
469
|
+
this.color = colors[this.y % colorCount];
|
470
|
+
}
|
471
|
+
}
|
472
|
+
|
473
|
+
this.colorIndex = this.y % colorCount;
|
474
|
+
|
475
|
+
return this;
|
476
|
+
},
|
477
|
+
|
478
|
+
// Add x2 and yCategory to the available properties for tooltip formats
|
479
|
+
getLabelConfig: function() {
|
480
|
+
var point = this,
|
481
|
+
cfg = Point.prototype.getLabelConfig.call(point),
|
482
|
+
yCats = point.series.yAxis.categories;
|
483
|
+
|
484
|
+
cfg.x2 = point.x2;
|
485
|
+
cfg.yCategory = point.yCategory = yCats && yCats[point.y];
|
486
|
+
return cfg;
|
487
|
+
},
|
488
|
+
tooltipDateKeys: ['x', 'x2'],
|
489
|
+
|
490
|
+
isValid: function() {
|
491
|
+
return typeof this.x === 'number' &&
|
492
|
+
typeof this.x2 === 'number';
|
493
|
+
}
|
494
|
+
});
|
495
|
+
|
496
|
+
/**
|
497
|
+
* Max x2 should be considered in xAxis extremes
|
498
|
+
*/
|
499
|
+
wrap(Axis.prototype, 'getSeriesExtremes', function(proceed) {
|
500
|
+
var axis = this,
|
501
|
+
axisSeries = axis.series,
|
502
|
+
dataMax,
|
503
|
+
modMax;
|
504
|
+
proceed.call(axis);
|
505
|
+
if (axis.isXAxis) {
|
506
|
+
dataMax = pick(axis.dataMax, -Number.MAX_VALUE);
|
507
|
+
each(axisSeries, function(series) {
|
508
|
+
if (series.x2Data) {
|
509
|
+
each(series.x2Data, function(val) {
|
510
|
+
if (val > dataMax) {
|
511
|
+
dataMax = val;
|
512
|
+
modMax = true;
|
513
|
+
}
|
514
|
+
});
|
515
|
+
}
|
516
|
+
});
|
517
|
+
if (modMax) {
|
518
|
+
axis.dataMax = dataMax;
|
519
|
+
}
|
520
|
+
}
|
521
|
+
});
|
522
|
+
|
523
|
+
|
524
|
+
/**
|
525
|
+
* An `xrange` series. If the [type](#series.xrange.type) option is not
|
526
|
+
* specified, it is inherited from [chart.type](#chart.type).
|
527
|
+
*
|
528
|
+
* For options that apply to multiple series, it is recommended to add
|
529
|
+
* them to the [plotOptions.series](#plotOptions.series) options structure.
|
530
|
+
* To apply to all series of this specific type, apply it to [plotOptions.
|
531
|
+
* xrange](#plotOptions.xrange).
|
532
|
+
*
|
533
|
+
* @type {Object}
|
534
|
+
* @extends series,plotOptions.xrange
|
535
|
+
* @product highcharts highstock
|
536
|
+
* @apioption series.xrange
|
537
|
+
*/
|
538
|
+
|
539
|
+
/**
|
540
|
+
* An array of data points for the series. For the `xrange` series type,
|
541
|
+
* points can be given in the following ways:
|
542
|
+
*
|
543
|
+
* 1. An array of objects with named values. The objects are point
|
544
|
+
* configuration objects as seen below.
|
545
|
+
*
|
546
|
+
* ```js
|
547
|
+
* data: [{
|
548
|
+
* x: Date.UTC(2017, 0, 1),
|
549
|
+
* x2: Date.UTC(2017, 0, 3),
|
550
|
+
* name: "Test",
|
551
|
+
* y: 0,
|
552
|
+
* color: "#00FF00"
|
553
|
+
* }, {
|
554
|
+
* x: Date.UTC(2017, 0, 4),
|
555
|
+
* x2: Date.UTC(2017, 0, 5),
|
556
|
+
* name: "Deploy",
|
557
|
+
* y: 1,
|
558
|
+
* color: "#FF0000"
|
559
|
+
* }]
|
560
|
+
* ```
|
561
|
+
*
|
562
|
+
* @type {Array<Object|Array|Number>}
|
563
|
+
* @extends series.line.data
|
564
|
+
* @sample {highcharts} highcharts/chart/reflow-true/ Numerical values
|
565
|
+
* @sample {highcharts} highcharts/series/data-array-of-arrays/ Arrays of numeric x and y
|
566
|
+
* @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/ Arrays of datetime x and y
|
567
|
+
* @sample {highcharts} highcharts/series/data-array-of-name-value/ Arrays of point.name and y
|
568
|
+
* @sample {highcharts} highcharts/series/data-array-of-objects/ Config objects
|
569
|
+
* @product highcharts highstock
|
570
|
+
* @apioption series.xrange.data
|
571
|
+
*/
|
572
|
+
|
573
|
+
|
574
|
+
/**
|
575
|
+
* The ending X value of the range point.
|
576
|
+
*
|
577
|
+
* @sample {highcharts} highcharts/demo/x-range
|
578
|
+
* X-range
|
579
|
+
* @type {Number}
|
580
|
+
* @product highcharts
|
581
|
+
* @apioption plotOptions.xrange.data.x2
|
582
|
+
*/
|
583
|
+
|
584
|
+
/**
|
585
|
+
* A partial fill for each point, typically used to visualize how much of
|
586
|
+
* a task is performed. The partial fill object can be set either on series
|
587
|
+
* or point level.
|
588
|
+
*
|
589
|
+
* @sample {highcharts} highcharts/demo/x-range
|
590
|
+
* X-range with partial fill
|
591
|
+
* @type {Object|Number}
|
592
|
+
* @product highcharts
|
593
|
+
* @apioption plotOptions.xrange.data.partialFill
|
594
|
+
*/
|
595
|
+
|
596
|
+
/**
|
597
|
+
* The amount of the X-range point to be filled. Values can be 0-1 and are
|
598
|
+
* converted to percentages in the default data label formatter.
|
599
|
+
*
|
600
|
+
* @type {Number}
|
601
|
+
* @product highcharts
|
602
|
+
* @apioption plotOptions.xrange.data.partialFill.amount
|
603
|
+
*/
|
604
|
+
|
605
|
+
/**
|
606
|
+
* The fill color to be used for partial fills. Defaults to a darker shade
|
607
|
+
* of the point color.
|
608
|
+
*
|
609
|
+
* @type {Color}
|
610
|
+
* @product highcharts
|
611
|
+
* @apioption plotOptions.xrange.data.partialFill.fill
|
612
|
+
*/
|
613
|
+
|
614
|
+
}(Highcharts));
|
615
|
+
}));
|