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
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Highcharts JS
|
2
|
+
* @license Highcharts JS v6.0.0 (2017-10-04)
|
3
3
|
*
|
4
4
|
* (c) 2014 Highsoft AS
|
5
5
|
* Authors: Jon Arild Nygard / Oystein Moseng
|
@@ -14,7 +14,142 @@
|
|
14
14
|
factory(Highcharts);
|
15
15
|
}
|
16
16
|
}(function(Highcharts) {
|
17
|
-
(function(H) {
|
17
|
+
var result = (function(H) {
|
18
|
+
var each = H.each,
|
19
|
+
extend = H.extend,
|
20
|
+
isBoolean = function(x) {
|
21
|
+
return typeof x === 'boolean';
|
22
|
+
},
|
23
|
+
isFn = function(x) {
|
24
|
+
return typeof x === 'function';
|
25
|
+
},
|
26
|
+
pick = H.pick;
|
27
|
+
// TODO Combine buildTree and buildNode with setTreeValues
|
28
|
+
// TODO Remove logic from Treemap and make it utilize this mixin.
|
29
|
+
var setTreeValues = function setTreeValues(tree, options) {
|
30
|
+
var before = options.before,
|
31
|
+
idRoot = options.idRoot,
|
32
|
+
mapIdToNode = options.mapIdToNode,
|
33
|
+
nodeRoot = mapIdToNode[idRoot],
|
34
|
+
levelIsConstant = (
|
35
|
+
isBoolean(options.levelIsConstant) ?
|
36
|
+
options.levelIsConstant :
|
37
|
+
true
|
38
|
+
),
|
39
|
+
points = options.points,
|
40
|
+
point = points[tree.i],
|
41
|
+
optionsPoint = point && point.options || {},
|
42
|
+
childrenTotal = 0,
|
43
|
+
children = [],
|
44
|
+
value;
|
45
|
+
extend(tree, {
|
46
|
+
levelDynamic: tree.level - (levelIsConstant ? 0 : nodeRoot.level),
|
47
|
+
name: pick(point && point.name, ''),
|
48
|
+
visible: (
|
49
|
+
idRoot === tree.id ||
|
50
|
+
(isBoolean(options.visible) ? options.visible : false)
|
51
|
+
)
|
52
|
+
});
|
53
|
+
if (isFn(before)) {
|
54
|
+
tree = before(tree, options);
|
55
|
+
}
|
56
|
+
// First give the children some values
|
57
|
+
each(tree.children, function(child, i) {
|
58
|
+
var newOptions = extend({}, options);
|
59
|
+
extend(newOptions, {
|
60
|
+
index: i,
|
61
|
+
siblings: tree.children.length,
|
62
|
+
visible: tree.visible
|
63
|
+
});
|
64
|
+
child = setTreeValues(child, newOptions);
|
65
|
+
children.push(child);
|
66
|
+
if (child.visible) {
|
67
|
+
childrenTotal += child.val;
|
68
|
+
}
|
69
|
+
});
|
70
|
+
tree.visible = childrenTotal > 0 || tree.visible;
|
71
|
+
// Set the values
|
72
|
+
value = pick(optionsPoint.value, childrenTotal);
|
73
|
+
extend(tree, {
|
74
|
+
children: children,
|
75
|
+
childrenTotal: childrenTotal,
|
76
|
+
isLeaf: tree.visible && !childrenTotal,
|
77
|
+
val: value
|
78
|
+
});
|
79
|
+
return tree;
|
80
|
+
};
|
81
|
+
|
82
|
+
var getColor = function getColor(node, options) {
|
83
|
+
var index = options.index,
|
84
|
+
levelMap = options.levelMap,
|
85
|
+
parentColor = options.parentColor,
|
86
|
+
parentColorIndex = options.parentColorIndex,
|
87
|
+
series = options.series,
|
88
|
+
colors = options.colors,
|
89
|
+
siblings = options.siblings,
|
90
|
+
points = series.points,
|
91
|
+
getColorByPoint,
|
92
|
+
point,
|
93
|
+
level,
|
94
|
+
colorByPoint,
|
95
|
+
color,
|
96
|
+
colorIndex;
|
97
|
+
|
98
|
+
function variation(color) {
|
99
|
+
var colorVariation = level && level.colorVariation;
|
100
|
+
if (colorVariation) {
|
101
|
+
if (colorVariation.key === 'brightness') {
|
102
|
+
return H.color(color).brighten(
|
103
|
+
colorVariation.to * (index / siblings)
|
104
|
+
).get();
|
105
|
+
}
|
106
|
+
}
|
107
|
+
|
108
|
+
return color;
|
109
|
+
}
|
110
|
+
|
111
|
+
if (node) {
|
112
|
+
point = points[node.i];
|
113
|
+
level = levelMap[node.levelDynamic] || {};
|
114
|
+
getColorByPoint = (
|
115
|
+
point &&
|
116
|
+
(
|
117
|
+
isBoolean(level.colorByPoint) ?
|
118
|
+
level.colorByPoint :
|
119
|
+
!!series.options.colorByPoint
|
120
|
+
)
|
121
|
+
);
|
122
|
+
if (getColorByPoint) {
|
123
|
+
colorByPoint = colors[(point.index % colors.length)];
|
124
|
+
}
|
125
|
+
// Select either point color, level color or inherited color.
|
126
|
+
color = pick(
|
127
|
+
point && point.options.color,
|
128
|
+
level && level.color,
|
129
|
+
colorByPoint,
|
130
|
+
parentColor && variation(parentColor),
|
131
|
+
series.color
|
132
|
+
);
|
133
|
+
colorIndex = pick(
|
134
|
+
point && point.options.colorIndex,
|
135
|
+
level && level.colorIndex,
|
136
|
+
parentColorIndex,
|
137
|
+
options.colorIndex
|
138
|
+
);
|
139
|
+
}
|
140
|
+
return {
|
141
|
+
color: color,
|
142
|
+
colorIndex: colorIndex
|
143
|
+
};
|
144
|
+
};
|
145
|
+
|
146
|
+
var result = {
|
147
|
+
getColor: getColor,
|
148
|
+
setTreeValues: setTreeValues
|
149
|
+
};
|
150
|
+
return result;
|
151
|
+
}(Highcharts));
|
152
|
+
(function(H, mixinTreeSeries) {
|
18
153
|
/**
|
19
154
|
* (c) 2014 Highsoft AS
|
20
155
|
* Authors: Jon Arild Nygard / Oystein Moseng
|
@@ -29,6 +164,7 @@
|
|
29
164
|
extend = H.extend,
|
30
165
|
noop = H.noop,
|
31
166
|
each = H.each,
|
167
|
+
getColor = mixinTreeSeries.getColor,
|
32
168
|
grep = H.grep,
|
33
169
|
isNumber = H.isNumber,
|
34
170
|
isString = H.isString,
|
@@ -42,14 +178,7 @@
|
|
42
178
|
func.call(context, val, key, list);
|
43
179
|
});
|
44
180
|
},
|
45
|
-
reduce =
|
46
|
-
context = context || this;
|
47
|
-
arr = arr || []; // @note should each be able to handle empty values automatically?
|
48
|
-
each(arr, function(current, i) {
|
49
|
-
previous = func.call(context, previous, current, i, arr);
|
50
|
-
});
|
51
|
-
return previous;
|
52
|
-
},
|
181
|
+
reduce = H.reduce,
|
53
182
|
// @todo find correct name for this function.
|
54
183
|
// @todo Similar to reduce, this function is likely redundant
|
55
184
|
recursive = function(item, func, context) {
|
@@ -61,13 +190,72 @@
|
|
61
190
|
}
|
62
191
|
};
|
63
192
|
|
64
|
-
// The Treemap series type
|
65
193
|
/**
|
194
|
+
* A treemap displays hierarchical data using nested rectangles. The data can be
|
195
|
+
* laid out in varying ways depending on options.
|
196
|
+
*
|
197
|
+
* @sample highcharts/demo/treemap-large-dataset/ Treemap
|
198
|
+
*
|
66
199
|
* @extends {plotOptions.scatter}
|
200
|
+
* @excluding marker
|
201
|
+
* @product highcharts
|
67
202
|
* @optionparent plotOptions.treemap
|
68
203
|
*/
|
69
204
|
seriesType('treemap', 'scatter', {
|
70
205
|
|
206
|
+
/**
|
207
|
+
* When enabled the user can click on a point which is a parent and
|
208
|
+
* zoom in on its children.
|
209
|
+
*
|
210
|
+
* @type {Boolean}
|
211
|
+
* @sample {highcharts} highcharts/plotoptions/treemap-allowdrilltonode/ Enabled
|
212
|
+
* @default false
|
213
|
+
* @since 4.1.0
|
214
|
+
* @product highcharts
|
215
|
+
* @apioption plotOptions.treemap.allowDrillToNode
|
216
|
+
*/
|
217
|
+
|
218
|
+
/**
|
219
|
+
* When the series contains less points than the crop threshold, all
|
220
|
+
* points are drawn, event if the points fall outside the visible plot
|
221
|
+
* area at the current zoom. The advantage of drawing all points (including
|
222
|
+
* markers and columns), is that animation is performed on updates.
|
223
|
+
* On the other hand, when the series contains more points than the
|
224
|
+
* crop threshold, the series data is cropped to only contain points
|
225
|
+
* that fall within the plot area. The advantage of cropping away invisible
|
226
|
+
* points is to increase performance on large series.
|
227
|
+
*
|
228
|
+
* @type {Number}
|
229
|
+
* @default 300
|
230
|
+
* @since 4.1.0
|
231
|
+
* @product highcharts
|
232
|
+
* @apioption plotOptions.treemap.cropThreshold
|
233
|
+
*/
|
234
|
+
|
235
|
+
/**
|
236
|
+
* This option decides if the user can interact with the parent nodes
|
237
|
+
* or just the leaf nodes. When this option is undefined, it will be
|
238
|
+
* true by default. However when allowDrillToNode is true, then it will
|
239
|
+
* be false by default.
|
240
|
+
*
|
241
|
+
* @type {Boolean}
|
242
|
+
* @sample {highcharts} highcharts/plotoptions/treemap-interactbyleaf-false/ False
|
243
|
+
* @sample {highcharts} highcharts/plotoptions/treemap-interactbyleaf-true-and-allowdrilltonode/ InteractByLeaf and allowDrillToNode is true
|
244
|
+
* @since 4.1.2
|
245
|
+
* @product highcharts
|
246
|
+
* @apioption plotOptions.treemap.interactByLeaf
|
247
|
+
*/
|
248
|
+
|
249
|
+
/**
|
250
|
+
* The sort index of the point inside the treemap level.
|
251
|
+
*
|
252
|
+
* @type {Number}
|
253
|
+
* @sample {highcharts} highcharts/plotoptions/treemap-sortindex/ Sort by years
|
254
|
+
* @since 4.1.10
|
255
|
+
* @product highcharts
|
256
|
+
* @apioption plotOptions.treemap.sortIndex
|
257
|
+
*/
|
258
|
+
|
71
259
|
/**
|
72
260
|
* Whether to display this series type or specific series item in the
|
73
261
|
* legend.
|
@@ -79,6 +267,7 @@
|
|
79
267
|
showInLegend: false,
|
80
268
|
|
81
269
|
/**
|
270
|
+
* @ignore
|
82
271
|
*/
|
83
272
|
marker: false,
|
84
273
|
|
@@ -88,98 +277,18 @@
|
|
88
277
|
* @product highcharts
|
89
278
|
*/
|
90
279
|
dataLabels: {
|
91
|
-
|
92
|
-
/**
|
93
|
-
* Enable or disable the data labels.
|
94
|
-
*
|
95
|
-
* @type {Boolean}
|
96
|
-
* @sample {highcharts} highcharts/plotoptions/series-datalabels-enabled/ Data labels enabled
|
97
|
-
* @default true
|
98
|
-
* @since 4.1.0
|
99
|
-
* @product highcharts
|
100
|
-
*/
|
101
280
|
enabled: true,
|
102
|
-
|
103
|
-
/**
|
104
|
-
* Whether to defer displaying the data labels until the initial series
|
105
|
-
* animation has finished.
|
106
|
-
*
|
107
|
-
* @type {Boolean}
|
108
|
-
* @default false
|
109
|
-
* @since 4.1.0
|
110
|
-
* @product highcharts
|
111
|
-
*/
|
112
281
|
defer: false,
|
113
|
-
|
114
|
-
/**
|
115
|
-
* The vertical alignment of a data label. Can be one of top, middle
|
116
|
-
* or bottom. The default value depends on the data, for instance
|
117
|
-
* in a column chart, the label is above positive values and below
|
118
|
-
* negative values.
|
119
|
-
*
|
120
|
-
* @type {String}
|
121
|
-
* @default middle
|
122
|
-
* @since 4.1.0
|
123
|
-
* @product highcharts
|
124
|
-
*/
|
125
282
|
verticalAlign: 'middle',
|
126
|
-
|
127
|
-
/**
|
128
|
-
*/
|
129
283
|
formatter: function() { // #2945
|
130
284
|
return this.point.name || this.point.id;
|
131
285
|
},
|
132
|
-
|
133
|
-
/**
|
134
|
-
* Whether to align the data label inside the box or to the actual
|
135
|
-
* value point.
|
136
|
-
*
|
137
|
-
* @type {Boolean}
|
138
|
-
* @default true
|
139
|
-
* @since 4.1.0
|
140
|
-
* @product highcharts
|
141
|
-
*/
|
142
286
|
inside: true
|
143
287
|
},
|
144
288
|
|
145
|
-
/**
|
146
|
-
* @extends plotOptions.heatmap.tooltip
|
147
|
-
* @since 4.1.0
|
148
|
-
* @product highcharts
|
149
|
-
*/
|
150
289
|
tooltip: {
|
151
|
-
|
152
|
-
/**
|
153
|
-
* The HTML of the tooltip header line. Variables are enclosed by
|
154
|
-
* curly brackets. Available variables are point.key, series.name,
|
155
|
-
* series.color and other members from the point and series objects.
|
156
|
-
* The point.key variable contains the category name, x value or
|
157
|
-
* datetime string depending on the type of axis. For datetime axes,
|
158
|
-
* the point.key date format can be set using tooltip.xDateFormat.
|
159
|
-
*
|
160
|
-
* @type {String}
|
161
|
-
* @sample {highcharts} highcharts/tooltip/footerformat/ A HTML table in the tooltip
|
162
|
-
* @default ""
|
163
|
-
* @since 4.1.0
|
164
|
-
* @product highcharts
|
165
|
-
*/
|
166
290
|
headerFormat: '',
|
167
|
-
|
168
|
-
/**
|
169
|
-
* The HTML of the point's line in the tooltip. Variables are enclosed
|
170
|
-
* by curly brackets. Available variables are point.x, point.y, series.
|
171
|
-
* name and series.color and other properties on the same form. Furthermore,
|
172
|
-
* point.y can be extended by the tooltip.yPrefix and tooltip.ySuffix
|
173
|
-
* variables. This can also be overridden for each series, which makes
|
174
|
-
* it a good hook for displaying units.
|
175
|
-
*
|
176
|
-
* @type {String}
|
177
|
-
* @sample {highcharts} highcharts/tooltip/pointformat/ A different point format with value suffix
|
178
|
-
* @default "<b>{point.name}</b>: {point.value}</b><br/>"
|
179
|
-
* @since 4.1.0
|
180
|
-
* @product highcharts
|
181
|
-
*/
|
182
|
-
pointFormat: '<b>{point.name}</b>: {point.value}</b><br/>'
|
291
|
+
pointFormat: '<b>{point.name}</b>: {point.value}<br/>'
|
183
292
|
},
|
184
293
|
|
185
294
|
/**
|
@@ -252,24 +361,40 @@
|
|
252
361
|
levelIsConstant: true,
|
253
362
|
|
254
363
|
/**
|
364
|
+
* Options for the button appearing when drilling down in a treemap.
|
255
365
|
*/
|
256
366
|
drillUpButton: {
|
257
367
|
|
258
368
|
/**
|
369
|
+
* The position of the button.
|
259
370
|
*/
|
260
371
|
position: {
|
261
372
|
|
262
373
|
/**
|
374
|
+
* Horizontal alignment of the button.
|
375
|
+
* @validvalue ["left", "center", "right"]
|
263
376
|
*/
|
264
377
|
align: 'right',
|
265
378
|
|
266
379
|
/**
|
380
|
+
* Horizontal offset of the button.
|
381
|
+
* @default -10
|
382
|
+
* @type {Number}
|
267
383
|
*/
|
268
384
|
x: -10,
|
269
385
|
|
270
386
|
/**
|
387
|
+
* Vertical offset of the button.
|
271
388
|
*/
|
272
389
|
y: 10
|
390
|
+
|
391
|
+
/**
|
392
|
+
* Vertical alignment of the button.
|
393
|
+
*
|
394
|
+
* @default top
|
395
|
+
* @validvalue ["top", "middle", "bottom"]
|
396
|
+
* @apioption plotOptions.treemap.drillUpButton.position.verticalAlign
|
397
|
+
*/
|
273
398
|
}
|
274
399
|
},
|
275
400
|
|
@@ -285,6 +410,7 @@
|
|
285
410
|
borderColor: '#e6e6e6',
|
286
411
|
|
287
412
|
/**
|
413
|
+
* The width of the border surrounding each tree map item.
|
288
414
|
*/
|
289
415
|
borderWidth: 1,
|
290
416
|
|
@@ -317,13 +443,22 @@
|
|
317
443
|
hover: {
|
318
444
|
|
319
445
|
/**
|
446
|
+
* The border color for the hovered state.
|
320
447
|
*/
|
321
448
|
borderColor: '#999999',
|
322
449
|
|
323
450
|
/**
|
451
|
+
* Brightness for the hovered point. Defaults to 0 if the heatmap
|
452
|
+
* series is loaded, otherwise 0.1.
|
453
|
+
*
|
454
|
+
* @default null
|
455
|
+
* @type {Number}
|
324
456
|
*/
|
325
457
|
brightness: seriesTypes.heatmap ? 0 : 0.1,
|
326
|
-
|
458
|
+
/**
|
459
|
+
* @extends plotOptions.heatmap.states.hover.halo
|
460
|
+
*/
|
461
|
+
halo: false,
|
327
462
|
/**
|
328
463
|
* The opacity of a point in treemap. When a point has children,
|
329
464
|
* the visibility of the children is determined by the opacity.
|
@@ -336,12 +471,146 @@
|
|
336
471
|
opacity: 0.75,
|
337
472
|
|
338
473
|
/**
|
474
|
+
* The shadow option for hovered state.
|
339
475
|
*/
|
340
476
|
shadow: false
|
341
477
|
}
|
342
478
|
}
|
343
479
|
|
344
480
|
|
481
|
+
|
482
|
+
/**
|
483
|
+
* Set options on specific levels. Takes precedence over series options,
|
484
|
+
* but not point options.
|
485
|
+
*
|
486
|
+
* @type {Array<Object>}
|
487
|
+
* @sample {highcharts} highcharts/plotoptions/treemap-levels/
|
488
|
+
* Styling dataLabels and borders
|
489
|
+
* @sample {highcharts} highcharts/demo/treemap-with-levels/
|
490
|
+
* Different layoutAlgorithm
|
491
|
+
* @since 4.1.0
|
492
|
+
* @product highcharts
|
493
|
+
* @apioption plotOptions.treemap.levels
|
494
|
+
*/
|
495
|
+
|
496
|
+
/**
|
497
|
+
* Can set a `borderColor` on all points which lies on the same level.
|
498
|
+
*
|
499
|
+
* @type {Color}
|
500
|
+
* @since 4.1.0
|
501
|
+
* @product highcharts
|
502
|
+
* @apioption plotOptions.treemap.levels.borderColor
|
503
|
+
*/
|
504
|
+
|
505
|
+
/**
|
506
|
+
* Set the dash style of the border of all the point which lies on the
|
507
|
+
* level. See <a href"#plotoptions.scatter.dashstyle">
|
508
|
+
* plotOptions.scatter.dashStyle</a> for possible options.
|
509
|
+
*
|
510
|
+
* @type {String}
|
511
|
+
* @since 4.1.0
|
512
|
+
* @product highcharts
|
513
|
+
* @apioption plotOptions.treemap.levels.borderDashStyle
|
514
|
+
*/
|
515
|
+
|
516
|
+
/**
|
517
|
+
* Can set the borderWidth on all points which lies on the same level.
|
518
|
+
*
|
519
|
+
* @type {Number}
|
520
|
+
* @since 4.1.0
|
521
|
+
* @product highcharts
|
522
|
+
* @apioption plotOptions.treemap.levels.borderWidth
|
523
|
+
*/
|
524
|
+
|
525
|
+
/**
|
526
|
+
* Can set a color on all points which lies on the same level.
|
527
|
+
*
|
528
|
+
* @type {Color}
|
529
|
+
* @since 4.1.0
|
530
|
+
* @product highcharts
|
531
|
+
* @apioption plotOptions.treemap.levels.color
|
532
|
+
*/
|
533
|
+
|
534
|
+
/**
|
535
|
+
* A configuration object to define how the color of a child varies from the
|
536
|
+
* parent's color. The variation is distributed among the children of node.
|
537
|
+
* For example when setting brightness, the brightness change will range
|
538
|
+
* from the parent's original brightness on the first child, to the amount
|
539
|
+
* set in the `to` setting on the last node. This allows a gradient-like
|
540
|
+
* color scheme that sets children out from each other while highlighting
|
541
|
+
* the grouping on treemaps and sectors on sunburst charts.
|
542
|
+
*
|
543
|
+
* @type {Object}
|
544
|
+
* @sample highcharts/demo/sunburst/ Sunburst with color variation
|
545
|
+
* @since 6.0.0
|
546
|
+
* @product highcharts
|
547
|
+
* @apioption plotOptions.treemap.levels.colorVariation
|
548
|
+
*/
|
549
|
+
|
550
|
+
/**
|
551
|
+
* The key of a color variation. Currently supports `brightness` only.
|
552
|
+
*
|
553
|
+
* @type {String}
|
554
|
+
* @validvalue ["brightness"]
|
555
|
+
* @since 6.0.0
|
556
|
+
* @product highcharts
|
557
|
+
* @apioption plotOptions.treemap.levels.colorVariation.key
|
558
|
+
*/
|
559
|
+
|
560
|
+
/**
|
561
|
+
* The ending value of a color variation. The last sibling will receive this
|
562
|
+
* value.
|
563
|
+
*
|
564
|
+
* @type {Number}
|
565
|
+
* @since 6.0.0
|
566
|
+
* @product highcharts
|
567
|
+
* @apioption plotOptions.treemap.levels.colorVariation.to
|
568
|
+
*/
|
569
|
+
|
570
|
+
/**
|
571
|
+
* Can set the options of dataLabels on each point which lies on the
|
572
|
+
* level. [plotOptions.treemap.dataLabels](#plotOptions.treemap.dataLabels)
|
573
|
+
* for possible values.
|
574
|
+
*
|
575
|
+
* @type {Object}
|
576
|
+
* @default undefined
|
577
|
+
* @since 4.1.0
|
578
|
+
* @product highcharts
|
579
|
+
* @apioption plotOptions.treemap.levels.dataLabels
|
580
|
+
*/
|
581
|
+
|
582
|
+
/**
|
583
|
+
* Can set the layoutAlgorithm option on a specific level.
|
584
|
+
*
|
585
|
+
* @validvalue ["sliceAndDice", "stripes", "squarified", "strip"]
|
586
|
+
* @type {String}
|
587
|
+
* @since 4.1.0
|
588
|
+
* @product highcharts
|
589
|
+
* @apioption plotOptions.treemap.levels.layoutAlgorithm
|
590
|
+
*/
|
591
|
+
|
592
|
+
/**
|
593
|
+
* Can set the layoutStartingDirection option on a specific level.
|
594
|
+
*
|
595
|
+
* @validvalue ["vertical", "horizontal"]
|
596
|
+
* @type {String}
|
597
|
+
* @since 4.1.0
|
598
|
+
* @product highcharts
|
599
|
+
* @apioption plotOptions.treemap.levels.layoutStartingDirection
|
600
|
+
*/
|
601
|
+
|
602
|
+
/**
|
603
|
+
* Decides which level takes effect from the options set in the levels
|
604
|
+
* object.
|
605
|
+
*
|
606
|
+
* @type {Number}
|
607
|
+
* @sample {highcharts} highcharts/plotoptions/treemap-levels/
|
608
|
+
* Styling of both levels
|
609
|
+
* @since 4.1.0
|
610
|
+
* @product highcharts
|
611
|
+
* @apioption plotOptions.treemap.levels.level
|
612
|
+
*/
|
613
|
+
|
345
614
|
// Prototype members
|
346
615
|
}, {
|
347
616
|
pointArrayMap: ['value'],
|
@@ -351,7 +620,14 @@
|
|
351
620
|
getSymbol: noop,
|
352
621
|
parallelArrays: ['x', 'y', 'value', 'colorValue'],
|
353
622
|
colorKey: 'colorValue', // Point color option key
|
354
|
-
translateColors:
|
623
|
+
translateColors: (
|
624
|
+
seriesTypes.heatmap &&
|
625
|
+
seriesTypes.heatmap.prototype.translateColors
|
626
|
+
),
|
627
|
+
colorAttribs: (
|
628
|
+
seriesTypes.heatmap &&
|
629
|
+
seriesTypes.heatmap.prototype.colorAttribs
|
630
|
+
),
|
355
631
|
trackerGroups: ['group', 'dataLabelsGroup'],
|
356
632
|
/**
|
357
633
|
* Creates an object map from parent id to childrens index.
|
@@ -361,7 +637,7 @@
|
|
361
637
|
* @return {Object} Map from parent id to children index in data.
|
362
638
|
*/
|
363
639
|
getListOfParents: function(data, ids) {
|
364
|
-
var listOfParents = reduce(data, function(prev, curr, i) {
|
640
|
+
var listOfParents = reduce(data || [], function(prev, curr, i) {
|
365
641
|
var parent = pick(curr.parent, '');
|
366
642
|
if (prev[parent] === undefined) {
|
367
643
|
prev[parent] = [];
|
@@ -405,18 +681,21 @@
|
|
405
681
|
var series = this,
|
406
682
|
children = [],
|
407
683
|
point = series.points[i],
|
684
|
+
height = 0,
|
408
685
|
node,
|
409
686
|
child;
|
410
687
|
|
411
688
|
// Actions
|
412
689
|
each((list[id] || []), function(i) {
|
413
690
|
child = series.buildNode(series.points[i].id, i, (level + 1), list, id);
|
691
|
+
height = Math.max(child.height + 1, height);
|
414
692
|
children.push(child);
|
415
693
|
});
|
416
694
|
node = {
|
417
695
|
id: id,
|
418
696
|
i: i,
|
419
697
|
children: children,
|
698
|
+
height: height,
|
420
699
|
level: level,
|
421
700
|
parent: parent,
|
422
701
|
visible: false // @todo move this to better location
|
@@ -552,38 +831,44 @@
|
|
552
831
|
}
|
553
832
|
});
|
554
833
|
},
|
555
|
-
|
834
|
+
|
835
|
+
/**
|
836
|
+
* Set the node's color recursively, from the parent down.
|
837
|
+
*/
|
838
|
+
setColorRecursive: function(node, parentColor, colorIndex, index, siblings) {
|
556
839
|
var series = this,
|
557
|
-
|
558
|
-
|
840
|
+
chart = series && series.chart,
|
841
|
+
colors = chart && chart.options && chart.options.colors,
|
842
|
+
colorInfo,
|
843
|
+
point;
|
844
|
+
|
559
845
|
if (node) {
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
);
|
569
|
-
colorIndex = pick(
|
570
|
-
point && point.options.colorIndex,
|
571
|
-
level && level.colorIndex,
|
572
|
-
colorIndex,
|
573
|
-
series.colorIndex
|
574
|
-
);
|
846
|
+
colorInfo = getColor(node, {
|
847
|
+
colors: colors,
|
848
|
+
index: index,
|
849
|
+
levelMap: series.levelMap,
|
850
|
+
parentColor: parentColor,
|
851
|
+
parentColorIndex: colorIndex,
|
852
|
+
series: series,
|
853
|
+
siblings: siblings
|
854
|
+
});
|
575
855
|
|
856
|
+
point = series.points[node.i];
|
576
857
|
if (point) {
|
577
|
-
point.color = color;
|
578
|
-
point.colorIndex = colorIndex;
|
858
|
+
point.color = colorInfo.color;
|
859
|
+
point.colorIndex = colorInfo.colorIndex;
|
579
860
|
}
|
580
861
|
|
581
|
-
// Do it all again with the children
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
862
|
+
// Do it all again with the children
|
863
|
+
each(node.children || [], function(child, i) {
|
864
|
+
series.setColorRecursive(
|
865
|
+
child,
|
866
|
+
colorInfo.color,
|
867
|
+
colorInfo.colorIndex,
|
868
|
+
i,
|
869
|
+
node.children.length
|
870
|
+
);
|
871
|
+
});
|
587
872
|
}
|
588
873
|
},
|
589
874
|
algorithmGroup: function(h, w, d, p) {
|
@@ -793,10 +1078,11 @@
|
|
793
1078
|
// Call prototype function
|
794
1079
|
Series.prototype.translate.call(series);
|
795
1080
|
// Create a object map from level to options
|
796
|
-
series.levelMap = reduce(series.options.levels
|
797
|
-
arr
|
798
|
-
|
799
|
-
|
1081
|
+
series.levelMap = reduce(series.options.levels || [],
|
1082
|
+
function(arr, item) {
|
1083
|
+
arr[item.level] = item;
|
1084
|
+
return arr;
|
1085
|
+
}, {});
|
800
1086
|
tree = series.tree = series.getTree(); // @todo Only if series.isDirtyData is true
|
801
1087
|
rootNode = series.nodeMap[rootId];
|
802
1088
|
if (
|
@@ -929,20 +1215,33 @@
|
|
929
1215
|
* Get presentational attributes
|
930
1216
|
*/
|
931
1217
|
pointAttribs: function(point, state) {
|
932
|
-
var level = this.levelMap[point.node.levelDynamic] || {},
|
1218
|
+
var level = point && this.levelMap[point.node.levelDynamic] || {},
|
933
1219
|
options = this.options,
|
934
1220
|
attr,
|
935
1221
|
stateOptions = (state && options.states[state]) || {},
|
936
|
-
className = point.getClassName(),
|
1222
|
+
className = (point && point.getClassName()) || '',
|
937
1223
|
opacity;
|
938
1224
|
|
939
1225
|
// Set attributes by precedence. Point trumps level trumps series. Stroke width uses pick
|
940
1226
|
// because it can be 0.
|
941
1227
|
attr = {
|
942
|
-
'stroke':
|
943
|
-
|
944
|
-
|
945
|
-
|
1228
|
+
'stroke':
|
1229
|
+
(point && point.borderColor) ||
|
1230
|
+
level.borderColor ||
|
1231
|
+
stateOptions.borderColor ||
|
1232
|
+
options.borderColor,
|
1233
|
+
'stroke-width': pick(
|
1234
|
+
point && point.borderWidth,
|
1235
|
+
level.borderWidth,
|
1236
|
+
stateOptions.borderWidth,
|
1237
|
+
options.borderWidth
|
1238
|
+
),
|
1239
|
+
'dashstyle':
|
1240
|
+
(point && point.borderDashStyle) ||
|
1241
|
+
level.borderDashStyle ||
|
1242
|
+
stateOptions.borderDashStyle ||
|
1243
|
+
options.borderDashStyle,
|
1244
|
+
'fill': (point && point.color) || this.color
|
946
1245
|
};
|
947
1246
|
|
948
1247
|
// Hide levels above the current view
|
@@ -977,7 +1276,7 @@
|
|
977
1276
|
});
|
978
1277
|
|
979
1278
|
each(points, function(point) {
|
980
|
-
var groupKey = '
|
1279
|
+
var groupKey = 'level-group-' + point.node.levelDynamic;
|
981
1280
|
if (!series[groupKey]) {
|
982
1281
|
series[groupKey] = series.chart.renderer.g(groupKey)
|
983
1282
|
.attr({
|
@@ -991,6 +1290,8 @@
|
|
991
1290
|
// Call standard drawPoints
|
992
1291
|
seriesTypes.column.prototype.drawPoints.call(this);
|
993
1292
|
|
1293
|
+
|
1294
|
+
|
994
1295
|
// If drillToNode is allowed, set a point cursor on clickables & add drillId to point
|
995
1296
|
if (series.options.allowDrillToNode) {
|
996
1297
|
each(points, function(point) {
|
@@ -1059,6 +1360,7 @@
|
|
1059
1360
|
var series = this,
|
1060
1361
|
nodeMap = series.nodeMap,
|
1061
1362
|
node = nodeMap[id];
|
1363
|
+
series.idPreviousRoot = series.rootNode;
|
1062
1364
|
series.rootNode = id;
|
1063
1365
|
if (id === '') {
|
1064
1366
|
series.drillUpButton = series.drillUpButton.destroy();
|
@@ -1138,6 +1440,10 @@
|
|
1138
1440
|
Series.prototype.bindAxes.call(this);
|
1139
1441
|
H.extend(this.yAxis.options, treeAxis);
|
1140
1442
|
H.extend(this.xAxis.options, treeAxis);
|
1443
|
+
},
|
1444
|
+
utils: {
|
1445
|
+
recursive: recursive,
|
1446
|
+
reduce: reduce
|
1141
1447
|
}
|
1142
1448
|
|
1143
1449
|
// Point class
|
@@ -1159,8 +1465,13 @@
|
|
1159
1465
|
}
|
1160
1466
|
return className;
|
1161
1467
|
},
|
1468
|
+
|
1469
|
+
/**
|
1470
|
+
* A tree point is valid if it has han id too, assume it may be a parent
|
1471
|
+
* item.
|
1472
|
+
*/
|
1162
1473
|
isValid: function() {
|
1163
|
-
return isNumber(this.value);
|
1474
|
+
return this.id || isNumber(this.value);
|
1164
1475
|
},
|
1165
1476
|
setState: function(state) {
|
1166
1477
|
H.Point.prototype.setState.call(this, state);
|
@@ -1175,5 +1486,98 @@
|
|
1175
1486
|
setVisible: seriesTypes.pie.prototype.pointClass.prototype.setVisible
|
1176
1487
|
});
|
1177
1488
|
|
1178
|
-
|
1489
|
+
|
1490
|
+
/**
|
1491
|
+
* A `treemap` series. If the [type](#series.treemap.type) option is
|
1492
|
+
* not specified, it is inherited from [chart.type](#chart.type).
|
1493
|
+
*
|
1494
|
+
* For options that apply to multiple series, it is recommended to add
|
1495
|
+
* them to the [plotOptions.series](#plotOptions.series) options structure.
|
1496
|
+
* To apply to all series of this specific type, apply it to [plotOptions.
|
1497
|
+
* treemap](#plotOptions.treemap).
|
1498
|
+
*
|
1499
|
+
* @type {Object}
|
1500
|
+
* @extends series,plotOptions.treemap
|
1501
|
+
* @excluding dataParser,dataURL,stack
|
1502
|
+
* @product highcharts
|
1503
|
+
* @apioption series.treemap
|
1504
|
+
*/
|
1505
|
+
|
1506
|
+
/**
|
1507
|
+
* An array of data points for the series. For the `treemap` series
|
1508
|
+
* type, points can be given in the following ways:
|
1509
|
+
*
|
1510
|
+
* 1. An array of numerical values. In this case, the numerical values
|
1511
|
+
* will be interpreted as `value` options. Example:
|
1512
|
+
*
|
1513
|
+
* ```js
|
1514
|
+
* data: [0, 5, 3, 5]
|
1515
|
+
* ```
|
1516
|
+
*
|
1517
|
+
* 2. An array of objects with named values. The objects are point
|
1518
|
+
* configuration objects as seen below. If the total number of data
|
1519
|
+
* points exceeds the series' [turboThreshold](#series.treemap.turboThreshold),
|
1520
|
+
* this option is not available.
|
1521
|
+
*
|
1522
|
+
* ```js
|
1523
|
+
* data: [{
|
1524
|
+
* value: 9,
|
1525
|
+
* name: "Point2",
|
1526
|
+
* color: "#00FF00"
|
1527
|
+
* }, {
|
1528
|
+
* value: 6,
|
1529
|
+
* name: "Point1",
|
1530
|
+
* color: "#FF00FF"
|
1531
|
+
* }]
|
1532
|
+
* ```
|
1533
|
+
*
|
1534
|
+
* @type {Array<Object|Number>}
|
1535
|
+
* @extends series.heatmap.data
|
1536
|
+
* @excluding x,y
|
1537
|
+
* @sample {highcharts} highcharts/chart/reflow-true/ Numerical values
|
1538
|
+
* @sample {highcharts} highcharts/series/data-array-of-arrays/ Arrays of numeric x and y
|
1539
|
+
* @sample {highcharts} highcharts/series/data-array-of-arrays-datetime/ Arrays of datetime x and y
|
1540
|
+
* @sample {highcharts} highcharts/series/data-array-of-name-value/ Arrays of point.name and y
|
1541
|
+
* @sample {highcharts} highcharts/series/data-array-of-objects/ Config objects
|
1542
|
+
* @product highcharts
|
1543
|
+
* @apioption series.treemap.data
|
1544
|
+
*/
|
1545
|
+
|
1546
|
+
/**
|
1547
|
+
* The value of the point, resulting in a relative area of the point
|
1548
|
+
* in the treemap.
|
1549
|
+
*
|
1550
|
+
* @type {Number}
|
1551
|
+
* @product highcharts
|
1552
|
+
* @apioption series.treemap.data.value
|
1553
|
+
*/
|
1554
|
+
|
1555
|
+
/**
|
1556
|
+
* Serves a purpose only if a `colorAxis` object is defined in the chart
|
1557
|
+
* options. This value will decide which color the point gets from the
|
1558
|
+
* scale of the colorAxis.
|
1559
|
+
*
|
1560
|
+
* @type {Number}
|
1561
|
+
* @default undefined
|
1562
|
+
* @since 4.1.0
|
1563
|
+
* @product highcharts
|
1564
|
+
* @apioption series.treemap.data.colorValue
|
1565
|
+
*/
|
1566
|
+
|
1567
|
+
/**
|
1568
|
+
* Only for treemap. Use this option to build a tree structure. The
|
1569
|
+
* value should be the id of the point which is the parent. If no points
|
1570
|
+
* has a matching id, or this option is undefined, then the parent will
|
1571
|
+
* be set to the root.
|
1572
|
+
*
|
1573
|
+
* @type {String}
|
1574
|
+
* @sample {highcharts} highcharts/point/parent/ Point parent
|
1575
|
+
* @sample {highcharts} highcharts/demo/treemap-with-levels/ Example where parent id is not matching
|
1576
|
+
* @default undefined
|
1577
|
+
* @since 4.1.0
|
1578
|
+
* @product highcharts
|
1579
|
+
* @apioption series.treemap.data.parent
|
1580
|
+
*/
|
1581
|
+
|
1582
|
+
}(Highcharts, result));
|
1179
1583
|
}));
|