highcharts-rails 5.0.6 → 5.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.markdown +54 -0
  3. data/app/assets/javascripts/highcharts.js +542 -324
  4. data/app/assets/javascripts/highcharts/highcharts-3d.js +12 -2
  5. data/app/assets/javascripts/highcharts/highcharts-more.js +41 -47
  6. data/app/assets/javascripts/highcharts/modules/accessibility.js +20 -4
  7. data/app/assets/javascripts/highcharts/modules/annotations.js +1 -1
  8. data/app/assets/javascripts/highcharts/modules/boost.js +9 -3
  9. data/app/assets/javascripts/highcharts/modules/broken-axis.js +11 -13
  10. data/app/assets/javascripts/highcharts/modules/data.js +1 -1
  11. data/app/assets/javascripts/highcharts/modules/drilldown.js +28 -13
  12. data/app/assets/javascripts/highcharts/modules/exporting.js +1 -1
  13. data/app/assets/javascripts/highcharts/modules/funnel.js +1 -1
  14. data/app/assets/javascripts/highcharts/modules/grid-axis.js +1 -1
  15. data/app/assets/javascripts/highcharts/modules/heatmap.js +12 -7
  16. data/app/assets/javascripts/highcharts/modules/no-data-to-display.js +1 -1
  17. data/app/assets/javascripts/highcharts/modules/offline-exporting.js +71 -18
  18. data/app/assets/javascripts/highcharts/modules/overlapping-datalabels.js +1 -1
  19. data/app/assets/javascripts/highcharts/modules/series-label.js +1 -1
  20. data/app/assets/javascripts/highcharts/modules/solid-gauge.js +1 -1
  21. data/app/assets/javascripts/highcharts/modules/stock.js +6360 -0
  22. data/app/assets/javascripts/highcharts/modules/treemap.js +88 -90
  23. data/app/assets/javascripts/highcharts/modules/xrange-series.js +5 -1
  24. data/lib/highcharts/version.rb +1 -1
  25. metadata +2 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.6 (2016-12-07)
2
+ * @license Highcharts JS v5.0.7 (2017-01-17)
3
3
  *
4
4
  * (c) 2014 Highsoft AS
5
5
  * Authors: Jon Arild Nygard / Oystein Moseng
@@ -31,6 +31,7 @@
31
31
  each = H.each,
32
32
  grep = H.grep,
33
33
  isNumber = H.isNumber,
34
+ isString = H.isString,
34
35
  pick = H.pick,
35
36
  Series = H.Series,
36
37
  stableSort = H.stableSort,
@@ -148,44 +149,20 @@
148
149
  * Creates a tree structured object from the series points
149
150
  */
150
151
  getTree: function() {
151
- var tree,
152
- series = this,
152
+ var series = this,
153
153
  allIds = map(this.data, function(d) {
154
154
  return d.id;
155
155
  }),
156
156
  parentList = series.getListOfParents(this.data, allIds);
157
157
 
158
158
  series.nodeMap = [];
159
- tree = series.buildNode('', -1, 0, parentList, null);
160
- // Parents of the root node is by default visible
161
- recursive(this.nodeMap[this.rootNode], function(node) {
162
- var next = false,
163
- p = node.parent;
164
- node.visible = true;
165
- if (p || p === '') {
166
- next = series.nodeMap[p];
167
- }
168
- return next;
169
- });
170
- // Children of the root node is by default visible
171
- recursive(this.nodeMap[this.rootNode].children, function(children) {
172
- var next = false;
173
- each(children, function(child) {
174
- child.visible = true;
175
- if (child.children.length) {
176
- next = (next || []).concat(child.children);
177
- }
178
- });
179
- return next;
180
- });
181
- this.setTreeValues(tree);
182
- return tree;
159
+ return series.buildNode('', -1, 0, parentList, null);
183
160
  },
184
161
  init: function(chart, options) {
185
162
  var series = this;
186
163
  Series.prototype.init.call(series, chart, options);
187
164
  if (series.options.allowDrillToNode) {
188
- series.drillTo();
165
+ H.addEvent(series, 'click', series.onClickDrillToNode);
189
166
  }
190
167
  },
191
168
  buildNode: function(id, i, level, list, parent) {
@@ -221,6 +198,27 @@
221
198
  children = [],
222
199
  val,
223
200
  point = series.points[tree.i];
201
+ // Parents of the root node is by default visible
202
+ recursive(series.nodeMap[series.rootNode], function(node) {
203
+ var next = false,
204
+ p = node.parent;
205
+ node.visible = true;
206
+ if (p || p === '') {
207
+ next = series.nodeMap[p];
208
+ }
209
+ return next;
210
+ });
211
+ // Children of the root node is by default visible
212
+ recursive(series.nodeMap[series.rootNode].children, function(children) {
213
+ var next = false;
214
+ each(children, function(child) {
215
+ child.visible = true;
216
+ if (child.children.length) {
217
+ next = (next || []).concat(child.children);
218
+ }
219
+ });
220
+ return next;
221
+ });
224
222
 
225
223
  // First give the children some values
226
224
  each(tree.children, function(child) {
@@ -319,7 +317,8 @@
319
317
  x2,
320
318
  y1,
321
319
  y2,
322
- crispCorr = 0.5; // Assume 1px borderWidth for simplicity
320
+ strokeWidth = series.pointAttribs(point)['stroke-width'] || 0,
321
+ crispCorr = (strokeWidth % 2) / 2;
323
322
 
324
323
  // Points which is ignored, have no values.
325
324
  if (values && node.visible) {
@@ -563,56 +562,66 @@
563
562
  return this.algorithmFill(false, parent, children);
564
563
  },
565
564
  translate: function() {
566
- var pointValues,
565
+ var series = this,
566
+ rootId = series.rootNode = pick(series.rootNode, series.options.rootId, ''),
567
+ rootNode,
568
+ pointValues,
567
569
  seriesArea,
568
570
  tree,
569
571
  val;
570
572
 
571
573
  // Call prototype function
572
- Series.prototype.translate.call(this);
573
-
574
- // Assign variables
575
- this.rootNode = pick(this.options.rootId, '');
574
+ Series.prototype.translate.call(series);
576
575
  // Create a object map from level to options
577
- this.levelMap = reduce(this.options.levels, function(arr, item) {
576
+ series.levelMap = reduce(series.options.levels, function(arr, item) {
578
577
  arr[item.level] = item;
579
578
  return arr;
580
579
  }, {});
581
- tree = this.tree = this.getTree(); // @todo Only if series.isDirtyData is true
580
+ tree = series.tree = series.getTree(); // @todo Only if series.isDirtyData is true
581
+ rootNode = series.nodeMap[rootId];
582
+ if (
583
+ rootId !== '' &&
584
+ (!rootNode || !rootNode.children.length)
585
+ ) {
586
+ series.drillToNode('', false);
587
+ rootId = series.rootNode;
588
+ rootNode = series.nodeMap[rootId];
589
+ }
590
+ series.setTreeValues(tree);
582
591
 
583
592
  // Calculate plotting values.
584
- this.axisRatio = (this.xAxis.len / this.yAxis.len);
585
- this.nodeMap[''].pointValues = pointValues = {
593
+ series.axisRatio = (series.xAxis.len / series.yAxis.len);
594
+ series.nodeMap[''].pointValues = pointValues = {
586
595
  x: 0,
587
596
  y: 0,
588
597
  width: 100,
589
598
  height: 100
590
599
  };
591
- this.nodeMap[''].values = seriesArea = merge(pointValues, {
592
- width: (pointValues.width * this.axisRatio),
593
- direction: (this.options.layoutStartingDirection === 'vertical' ? 0 : 1),
600
+ series.nodeMap[''].values = seriesArea = merge(pointValues, {
601
+ width: (pointValues.width * series.axisRatio),
602
+ direction: (series.options.layoutStartingDirection === 'vertical' ? 0 : 1),
594
603
  val: tree.val
595
604
  });
596
- this.calculateChildrenAreas(tree, seriesArea);
605
+ series.calculateChildrenAreas(tree, seriesArea);
597
606
 
598
607
  // Logic for point colors
599
- if (this.colorAxis) {
600
- this.translateColors();
601
- } else if (!this.options.colorByPoint) {
602
- this.setColorRecursive(this.tree);
608
+ if (series.colorAxis) {
609
+ series.translateColors();
610
+ } else if (!series.options.colorByPoint) {
611
+ series.setColorRecursive(series.tree);
603
612
  }
604
613
 
605
614
  // Update axis extremes according to the root node.
606
- if (this.options.allowDrillToNode) {
607
- val = this.nodeMap[this.rootNode].pointValues;
608
- this.xAxis.setExtremes(val.x, val.x + val.width, false);
609
- this.yAxis.setExtremes(val.y, val.y + val.height, false);
610
- this.xAxis.setScale();
611
- this.yAxis.setScale();
615
+ if (series.options.allowDrillToNode) {
616
+ val = rootNode.pointValues;
617
+ series.xAxis.setExtremes(val.x, val.x + val.width, false);
618
+ series.yAxis.setExtremes(val.y, val.y + val.height, false);
619
+ series.xAxis.setScale();
620
+ series.yAxis.setScale();
612
621
  }
613
622
 
614
623
  // Assign values to points.
615
- this.setPointValues();
624
+ series.setPointValues();
616
625
  },
617
626
  /**
618
627
  * Extend drawDataLabels with logic to handle custom options related to the treemap series:
@@ -752,20 +761,15 @@
752
761
  /**
753
762
  * Add drilling on the suitable points
754
763
  */
755
- drillTo: function() {
756
- var series = this;
757
- H.addEvent(series, 'click', function(event) {
758
- var point = event.point,
759
- drillId = point.drillId,
760
- drillName;
761
- // If a drill id is returned, add click event and cursor.
762
- if (drillId) {
763
- drillName = series.nodeMap[series.rootNode].name || series.rootNode;
764
- point.setState(''); // Remove hover
765
- series.drillToNode(drillId);
766
- series.showDrillUpButton(drillName);
767
- }
768
- });
764
+ onClickDrillToNode: function(event) {
765
+ var series = this,
766
+ point = event.point,
767
+ drillId = point && point.drillId;
768
+ // If a drill id is returned, add click event and cursor.
769
+ if (isString(drillId)) {
770
+ point.setState(''); // Remove hover
771
+ series.drillToNode(drillId);
772
+ }
769
773
  },
770
774
  /**
771
775
  * Finds the drill id for a parent node.
@@ -803,32 +807,26 @@
803
807
  return drillId;
804
808
  },
805
809
  drillUp: function() {
806
- var drillPoint = null,
807
- node,
808
- parent;
809
- if (this.rootNode) {
810
- node = this.nodeMap[this.rootNode];
811
- if (node.parent !== null) {
812
- drillPoint = this.nodeMap[node.parent];
813
- } else {
814
- drillPoint = this.nodeMap[''];
815
- }
816
- }
817
-
818
- if (drillPoint !== null) {
819
- this.drillToNode(drillPoint.id);
820
- if (drillPoint.id === '') {
821
- this.drillUpButton = this.drillUpButton.destroy();
822
- } else {
823
- parent = this.nodeMap[drillPoint.parent];
824
- this.showDrillUpButton((parent.name || parent.id));
825
- }
810
+ var series = this,
811
+ node = series.nodeMap[series.rootNode];
812
+ if (node && isString(node.parent)) {
813
+ series.drillToNode(node.parent);
826
814
  }
827
815
  },
828
- drillToNode: function(id) {
829
- this.options.rootId = id;
816
+ drillToNode: function(id, redraw) {
817
+ var series = this,
818
+ nodeMap = series.nodeMap,
819
+ node = nodeMap[id];
820
+ series.rootNode = id;
821
+ if (id === '') {
822
+ series.drillUpButton = series.drillUpButton.destroy();
823
+ } else {
824
+ series.showDrillUpButton((node && node.name || id));
825
+ }
830
826
  this.isDirty = true; // Force redraw
831
- this.chart.redraw();
827
+ if (pick(redraw, true)) {
828
+ this.chart.redraw();
829
+ }
832
830
  },
833
831
  showDrillUpButton: function(name) {
834
832
  var series = this,
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v5.0.6 (2016-12-07)
2
+ * @license Highcharts JS v5.0.7 (2017-01-17)
3
3
  * X-range series
4
4
  *
5
5
  * (c) 2010-2016 Torstein Honsi, Lars A. V. Cabrera
@@ -135,6 +135,10 @@
135
135
  plotX = Math.max(plotX, -10);
136
136
  plotX2 = Math.min(Math.max(plotX2, -10), xAxis.len + 10);
137
137
 
138
+ if (plotX2 < plotX) { // #6107
139
+ plotX2 = plotX;
140
+ }
141
+
138
142
  point.shapeArgs = {
139
143
  x: plotX,
140
144
  y: point.plotY + metrics.offset,
@@ -1,3 +1,3 @@
1
1
  module Highcharts
2
- VERSION = "5.0.6"
2
+ VERSION = "5.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: highcharts-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.6
4
+ version: 5.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Per Christian B. Viken
@@ -89,6 +89,7 @@ files:
89
89
  - app/assets/javascripts/highcharts/modules/overlapping-datalabels.js
90
90
  - app/assets/javascripts/highcharts/modules/series-label.js
91
91
  - app/assets/javascripts/highcharts/modules/solid-gauge.js
92
+ - app/assets/javascripts/highcharts/modules/stock.js
92
93
  - app/assets/javascripts/highcharts/modules/treemap.js
93
94
  - app/assets/javascripts/highcharts/modules/xrange-series.js
94
95
  - app/assets/javascripts/highcharts/themes/dark-blue.js