highcharts-rails 4.1.6 → 4.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +27 -0
- data/app/assets/javascripts/highcharts.js +129 -70
- data/app/assets/javascripts/highcharts/adapters/standalone-framework.js +1 -1
- data/app/assets/javascripts/highcharts/highcharts-3d.js +34 -29
- data/app/assets/javascripts/highcharts/highcharts-more.js +45 -44
- data/app/assets/javascripts/highcharts/modules/broken-axis.js +28 -23
- data/app/assets/javascripts/highcharts/modules/canvas-tools.js +1 -1
- data/app/assets/javascripts/highcharts/modules/data.js +1 -1
- data/app/assets/javascripts/highcharts/modules/drilldown.js +5 -1
- data/app/assets/javascripts/highcharts/modules/exporting.js +3 -2
- data/app/assets/javascripts/highcharts/modules/funnel.js +7 -2
- data/app/assets/javascripts/highcharts/modules/heatmap.js +1 -1
- data/app/assets/javascripts/highcharts/modules/no-data-to-display.js +14 -2
- data/app/assets/javascripts/highcharts/modules/solid-gauge.js +5 -3
- data/app/assets/javascripts/highcharts/modules/treemap.js +154 -112
- data/lib/highcharts/version.rb +1 -1
- metadata +1 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Highcharts JS v4.1.
|
2
|
+
* @license Highcharts JS v4.1.7 (2015-06-26)
|
3
3
|
* Solid angular gauge module
|
4
4
|
*
|
5
5
|
* (c) 2010-2014 Torstein Honsi
|
@@ -161,7 +161,7 @@
|
|
161
161
|
// The series prototype
|
162
162
|
H.seriesTypes.solidgauge = H.extendClass(H.seriesTypes.gauge, {
|
163
163
|
type: 'solidgauge',
|
164
|
-
|
164
|
+
pointAttrToOptions: {}, // #4301, don't inherit line marker's attribs
|
165
165
|
bindAxes: function () {
|
166
166
|
var axis;
|
167
167
|
H.seriesTypes.gauge.prototype.bindAxes.call(this);
|
@@ -238,7 +238,9 @@
|
|
238
238
|
if (graphic) {
|
239
239
|
d = shapeArgs.d;
|
240
240
|
graphic.animate(shapeArgs);
|
241
|
-
|
241
|
+
if (d) {
|
242
|
+
shapeArgs.d = d; // animate alters it
|
243
|
+
}
|
242
244
|
} else {
|
243
245
|
point.graphic = renderer.arc(shapeArgs)
|
244
246
|
.attr({
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license Highcharts JS v4.1.
|
2
|
+
* @license Highcharts JS v4.1.7 (2015-06-26)
|
3
3
|
*
|
4
4
|
* (c) 2014 Highsoft AS
|
5
5
|
* Authors: Jon Arild Nygard / Oystein Moseng
|
@@ -11,11 +11,13 @@
|
|
11
11
|
(function (H) {
|
12
12
|
var seriesTypes = H.seriesTypes,
|
13
13
|
merge = H.merge,
|
14
|
+
extend = H.extend,
|
14
15
|
extendClass = H.extendClass,
|
15
16
|
defaultOptions = H.getOptions(),
|
16
17
|
plotOptions = defaultOptions.plotOptions,
|
17
18
|
noop = function () { return; },
|
18
19
|
each = H.each,
|
20
|
+
grep = HighchartsAdapter.grep,
|
19
21
|
pick = H.pick,
|
20
22
|
Series = H.Series,
|
21
23
|
Color = H.Color;
|
@@ -96,24 +98,17 @@
|
|
96
98
|
},
|
97
99
|
setVisible: seriesTypes.pie.prototype.pointClass.prototype.setVisible
|
98
100
|
}),
|
101
|
+
// @todo Move to translate
|
99
102
|
handleLayout: function () {
|
100
|
-
var
|
101
|
-
tree = this.tree,
|
103
|
+
var tree = this.tree,
|
102
104
|
seriesArea;
|
103
105
|
if (this.points.length) {
|
104
106
|
// Assign variables
|
105
|
-
this.nodeMap = [];
|
106
|
-
tree = this.tree = this.getTree();
|
107
107
|
this.rootNode = pick(this.rootNode, "");
|
108
|
+
tree = this.tree = this.getTree();
|
108
109
|
this.levelMap = this.getLevels();
|
109
|
-
each(series.points, function (point) {
|
110
|
-
// Reset visibility
|
111
|
-
delete point.plotX;
|
112
|
-
delete point.plotY;
|
113
|
-
});
|
114
110
|
seriesArea = this.getSeriesArea(tree.val);
|
115
|
-
this.
|
116
|
-
this.calculateArea(tree, seriesArea);
|
111
|
+
this.calculateChildrenAreas(tree, seriesArea);
|
117
112
|
this.setPointValues();
|
118
113
|
}
|
119
114
|
},
|
@@ -123,7 +118,6 @@
|
|
123
118
|
getTree: function () {
|
124
119
|
var tree,
|
125
120
|
series = this,
|
126
|
-
i = 0,
|
127
121
|
parentList = [],
|
128
122
|
allIds = [],
|
129
123
|
key,
|
@@ -131,51 +125,13 @@
|
|
131
125
|
each(parentList[key], function (item) {
|
132
126
|
parentList[""].push(item);
|
133
127
|
});
|
134
|
-
},
|
135
|
-
getNodeTree = function (id, i, level, list, points, parent, visible) {
|
136
|
-
var children = [],
|
137
|
-
childrenTotal = 0,
|
138
|
-
val,
|
139
|
-
point = points[i],
|
140
|
-
nodeTree,
|
141
|
-
node,
|
142
|
-
name;
|
143
|
-
|
144
|
-
// Actions
|
145
|
-
if (visible) {
|
146
|
-
visible = pick(point && point.visible, true);
|
147
|
-
}
|
148
|
-
name = pick(point && point.name, "");
|
149
|
-
if (list[id] !== undefined) {
|
150
|
-
each(list[id], function (i) {
|
151
|
-
node = getNodeTree(points[i].id, i, (level + 1), list, points, id, visible);
|
152
|
-
if (node.visible || !series.options.ignoreHiddenPoint) {
|
153
|
-
childrenTotal += node.val;
|
154
|
-
series.insertElementSorted(children, node, function (el, el2) {
|
155
|
-
return el.val > el2.val;
|
156
|
-
});
|
157
|
-
}
|
158
|
-
});
|
159
|
-
}
|
160
|
-
val = pick((points[i] && points[i].value), childrenTotal, 0);
|
161
|
-
visible = val > 0 ? visible : false;
|
162
|
-
nodeTree = {
|
163
|
-
id: id,
|
164
|
-
i: i,
|
165
|
-
children: children,
|
166
|
-
childrenTotal: childrenTotal,
|
167
|
-
val: val,
|
168
|
-
level: level,
|
169
|
-
parent: parent,
|
170
|
-
name: name,
|
171
|
-
visible: visible
|
172
|
-
};
|
173
|
-
series.nodeMap[nodeTree.id] = nodeTree;
|
174
|
-
return nodeTree;
|
175
128
|
};
|
176
129
|
// Actions
|
130
|
+
this.nodeMap = [];
|
131
|
+
|
177
132
|
// Map children to index
|
178
|
-
|
133
|
+
// @todo Use data instead of points
|
134
|
+
each(this.points, function (point, index) {
|
179
135
|
var parent = "";
|
180
136
|
allIds.push(point.id);
|
181
137
|
if (point.parent !== undefined) {
|
@@ -184,8 +140,7 @@
|
|
184
140
|
if (parentList[parent] === undefined) {
|
185
141
|
parentList[parent] = [];
|
186
142
|
}
|
187
|
-
parentList[parent].push(
|
188
|
-
i = i + 1;
|
143
|
+
parentList[parent].push(index);
|
189
144
|
});
|
190
145
|
/*
|
191
146
|
* Quality check:
|
@@ -193,61 +148,141 @@
|
|
193
148
|
* - Add node id to parents children list
|
194
149
|
*/
|
195
150
|
for (key in parentList) {
|
196
|
-
if (parentList.hasOwnProperty(key)) {
|
197
|
-
|
198
|
-
|
199
|
-
insertItem(key);
|
200
|
-
delete parentList[key];
|
201
|
-
}
|
202
|
-
}
|
151
|
+
if ((parentList.hasOwnProperty(key)) && (key !== "") && (HighchartsAdapter.inArray(key, allIds) === -1)) {
|
152
|
+
insertItem(key);
|
153
|
+
delete parentList[key];
|
203
154
|
}
|
204
155
|
}
|
205
|
-
tree =
|
156
|
+
tree = series.buildNode("", -1, 0, parentList, null);
|
157
|
+
this.eachParents(this.nodeMap[this.rootNode], function (node) {
|
158
|
+
node.visible = true;
|
159
|
+
});
|
160
|
+
this.eachChildren(this.nodeMap[this.rootNode], function (node) {
|
161
|
+
node.visible = true;
|
162
|
+
});
|
163
|
+
this.setTreeValues(tree);
|
206
164
|
return tree;
|
207
165
|
},
|
208
|
-
|
209
|
-
var
|
210
|
-
|
211
|
-
|
166
|
+
buildNode: function (id, i, level, list, parent) {
|
167
|
+
var series = this,
|
168
|
+
children = [],
|
169
|
+
point = series.points[i],
|
170
|
+
node,
|
171
|
+
child;
|
172
|
+
|
173
|
+
// Actions
|
174
|
+
each((list[id] || []), function (i) {
|
175
|
+
child = series.buildNode(series.points[i].id, i, (level + 1), list, id);
|
176
|
+
children.push(child);
|
177
|
+
});
|
178
|
+
node = {
|
179
|
+
id: id,
|
180
|
+
i: i,
|
181
|
+
children: children,
|
182
|
+
level: level,
|
183
|
+
parent: parent,
|
184
|
+
visible: false // @todo move this to better location
|
185
|
+
};
|
186
|
+
series.nodeMap[node.id] = node;
|
187
|
+
if (point) {
|
188
|
+
point.node = node;
|
189
|
+
}
|
190
|
+
return node;
|
191
|
+
},
|
192
|
+
setTreeValues: function (tree) {
|
193
|
+
var series = this,
|
194
|
+
childrenTotal = 0,
|
195
|
+
sorted = [],
|
196
|
+
val,
|
197
|
+
point = series.points[tree.i];
|
198
|
+
|
199
|
+
// First give the children some values
|
200
|
+
each(tree.children, function (child) {
|
201
|
+
child = series.setTreeValues(child);
|
202
|
+
series.insertElementSorted(sorted, child, function (el, el2) {
|
203
|
+
return el.val > el2.val;
|
204
|
+
});
|
205
|
+
|
206
|
+
if (!child.ignore) {
|
207
|
+
childrenTotal += child.val;
|
208
|
+
} else {
|
209
|
+
// @todo Add predicate to avoid looping already ignored children
|
210
|
+
series.eachChildren(child, function (node) {
|
211
|
+
extend(node, {
|
212
|
+
ignore: true,
|
213
|
+
isLeaf: false,
|
214
|
+
visible: false
|
215
|
+
});
|
216
|
+
});
|
217
|
+
}
|
218
|
+
});
|
219
|
+
|
220
|
+
// Set the values
|
221
|
+
val = pick(point && point.value, childrenTotal);
|
222
|
+
extend(tree, {
|
223
|
+
children: sorted,
|
224
|
+
childrenTotal: childrenTotal,
|
225
|
+
// Ignore this node if point is not visible
|
226
|
+
ignore: !(pick(point && point.visible, true) && (val > 0)),
|
227
|
+
isLeaf: tree.visible && !childrenTotal,
|
228
|
+
name: pick(point && point.name, ""),
|
229
|
+
val: val
|
230
|
+
});
|
231
|
+
return tree;
|
232
|
+
},
|
233
|
+
eachChildren: function (node, callback) {
|
234
|
+
var series = this,
|
235
|
+
children = node.children;
|
236
|
+
callback(node);
|
237
|
+
if (children.length) {
|
238
|
+
each(children, function (child) {
|
239
|
+
series.eachChildren(child, callback);
|
240
|
+
});
|
241
|
+
}
|
242
|
+
},
|
243
|
+
eachParents: function (node, callback) {
|
244
|
+
var parent = this.nodeMap[node.parent];
|
245
|
+
callback(node);
|
246
|
+
if (parent) {
|
247
|
+
this.eachParents(parent, callback);
|
248
|
+
}
|
249
|
+
},
|
250
|
+
/**
|
251
|
+
* Recursive function which calculates the area for all children of a node.
|
252
|
+
* @param {Object} node The node which is parent to the children.
|
253
|
+
* @param {Object} area The rectangular area of the parent.
|
254
|
+
*/
|
255
|
+
calculateChildrenAreas: function (parent, area) {
|
256
|
+
var series = this,
|
212
257
|
options = series.options,
|
213
|
-
|
258
|
+
levelNumber = (options.levelIsConstant ? parent.level : (parent.level - this.nodeMap[this.rootNode].level)),
|
259
|
+
level = this.levelMap[levelNumber + 1],
|
260
|
+
algorithm = pick((series[level && level.layoutAlgorithm] && level.layoutAlgorithm), options.layoutAlgorithm),
|
214
261
|
alternate = options.alternateStartingDirection,
|
215
|
-
|
216
|
-
|
217
|
-
level,
|
218
|
-
levelNr = options.levelIsConstant ? node.level : (node.level - levelRoot),
|
262
|
+
childrenValues = [],
|
263
|
+
children,
|
219
264
|
point;
|
220
|
-
|
221
|
-
//
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
area.direction = level.layoutStartingDirection === 'vertical' ? 0 : 1;
|
229
|
-
}
|
265
|
+
|
266
|
+
// Collect all children which should be included
|
267
|
+
children = grep(parent.children, function (n) {
|
268
|
+
return !n.ignore;
|
269
|
+
});
|
270
|
+
|
271
|
+
if (level && level.layoutStartingDirection) {
|
272
|
+
area.direction = level.layoutStartingDirection === 'vertical' ? 0 : 1;
|
230
273
|
}
|
231
|
-
childrenValues = series[algorithm](area,
|
232
|
-
each(
|
233
|
-
levelNr = options.levelIsConstant ? child.level : (child.level - levelRoot);
|
274
|
+
childrenValues = series[algorithm](area, children);
|
275
|
+
each(children, function (child, index) {
|
234
276
|
point = series.points[child.i];
|
235
|
-
point.level =
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
childValues.direction = 1 - childValues.direction;
|
241
|
-
}
|
242
|
-
child.values = childValues;
|
243
|
-
point.node = child;
|
244
|
-
point.isLeaf = true;
|
277
|
+
point.level = levelNumber + 1;
|
278
|
+
child.values = merge(childrenValues[index], {
|
279
|
+
val: child.childrenTotal,
|
280
|
+
direction: (alternate ? 1 - area.direction : area.direction)
|
281
|
+
});
|
245
282
|
// If node has children, then call method recursively
|
246
283
|
if (child.children.length) {
|
247
|
-
|
248
|
-
series.calculateArea(child, childValues);
|
284
|
+
series.calculateChildrenAreas(child, child.values);
|
249
285
|
}
|
250
|
-
i = i + 1;
|
251
286
|
});
|
252
287
|
},
|
253
288
|
setPointValues: function () {
|
@@ -267,13 +302,14 @@
|
|
267
302
|
x2,
|
268
303
|
y1,
|
269
304
|
y2;
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
305
|
+
// Points which is ignored, have no values.
|
306
|
+
if (values) {
|
307
|
+
values.x = values.x / series.axisRatio;
|
308
|
+
values.width = values.width / series.axisRatio;
|
309
|
+
x1 = Math.round(xAxis.translate(values.x, 0, 0, 0, 1));
|
310
|
+
x2 = Math.round(xAxis.translate(values.x + values.width, 0, 0, 0, 1));
|
311
|
+
y1 = Math.round(yAxis.translate(values.y, 0, 0, 0, 1));
|
312
|
+
y2 = Math.round(yAxis.translate(values.y + values.height, 0, 0, 0, 1));
|
277
313
|
// Set point values
|
278
314
|
point.shapeType = 'rect';
|
279
315
|
point.shapeArgs = {
|
@@ -284,6 +320,10 @@
|
|
284
320
|
};
|
285
321
|
point.plotX = point.shapeArgs.x + (point.shapeArgs.width / 2);
|
286
322
|
point.plotY = point.shapeArgs.y + (point.shapeArgs.height / 2);
|
323
|
+
} else {
|
324
|
+
// Reset visibility
|
325
|
+
delete point.plotX;
|
326
|
+
delete point.plotY;
|
287
327
|
}
|
288
328
|
});
|
289
329
|
},
|
@@ -302,6 +342,7 @@
|
|
302
342
|
direction: d,
|
303
343
|
val: val
|
304
344
|
};
|
345
|
+
this.nodeMap[""].values = seriesArea;
|
305
346
|
return seriesArea;
|
306
347
|
},
|
307
348
|
getLevels: function () {
|
@@ -557,11 +598,11 @@
|
|
557
598
|
level;
|
558
599
|
each(points, function (point) {
|
559
600
|
level = series.levelMap[point.level];
|
560
|
-
// Set options to new object to problems with scope
|
601
|
+
// Set options to new object to avoid problems with scope
|
561
602
|
options = {style: {}};
|
562
603
|
|
563
604
|
// If not a leaf, then label should be disabled as default
|
564
|
-
if (!point.isLeaf) {
|
605
|
+
if (!point.node.isLeaf) {
|
565
606
|
options.enabled = false;
|
566
607
|
}
|
567
608
|
|
@@ -622,7 +663,7 @@
|
|
622
663
|
hover.zIndex = 1001;
|
623
664
|
hover.fill = Color(attr.fill).brighten(seriesOptions.states.hover.brightness).get();
|
624
665
|
// If not a leaf, then remove fill
|
625
|
-
if (!point.isLeaf) {
|
666
|
+
if (!point.node.isLeaf) {
|
626
667
|
if (pick(seriesOptions.interactByLeaf, !seriesOptions.allowDrillToNode)) {
|
627
668
|
attr.fill = 'none';
|
628
669
|
delete hover.fill;
|
@@ -638,6 +679,7 @@
|
|
638
679
|
delete hover.fill;
|
639
680
|
}
|
640
681
|
point.pointAttr[''] = H.extend(point.pointAttr[''], attr);
|
682
|
+
// @todo Move this to drawDataLabels
|
641
683
|
if (point.dataLabel) {
|
642
684
|
point.dataLabel.attr({ zIndex: (point.pointAttr[''].zIndex + 1) });
|
643
685
|
}
|
@@ -723,7 +765,7 @@
|
|
723
765
|
drillToByGroup: function (point) {
|
724
766
|
var series = this,
|
725
767
|
drillId = false;
|
726
|
-
if ((point.node.level - series.nodeMap[series.rootNode].level) === 1 && !point.isLeaf) {
|
768
|
+
if ((point.node.level - series.nodeMap[series.rootNode].level) === 1 && !point.node.isLeaf) {
|
727
769
|
drillId = point.id;
|
728
770
|
}
|
729
771
|
return drillId;
|
@@ -738,7 +780,7 @@
|
|
738
780
|
var series = this,
|
739
781
|
drillId = false,
|
740
782
|
nodeParent;
|
741
|
-
if ((point.node.parent !== series.rootNode) && (point.isLeaf)) {
|
783
|
+
if ((point.node.parent !== series.rootNode) && (point.node.isLeaf)) {
|
742
784
|
nodeParent = point.node;
|
743
785
|
while (!drillId) {
|
744
786
|
nodeParent = series.nodeMap[nodeParent.parent];
|
data/lib/highcharts/version.rb
CHANGED