highcharts-rails 4.2.7 → 5.0.0

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.markdown +34 -0
  3. data/Gemfile +4 -0
  4. data/Rakefile +53 -32
  5. data/app/assets/javascripts/highcharts.js +18775 -17176
  6. data/app/assets/javascripts/highcharts/highcharts-3d.js +1849 -1563
  7. data/app/assets/javascripts/highcharts/highcharts-more.js +2162 -1988
  8. data/app/assets/javascripts/highcharts/modules/accessibility.js +1005 -0
  9. data/app/assets/javascripts/highcharts/modules/annotations.js +408 -401
  10. data/app/assets/javascripts/highcharts/modules/boost.js +561 -546
  11. data/app/assets/javascripts/highcharts/modules/broken-axis.js +330 -324
  12. data/app/assets/javascripts/highcharts/modules/data.js +973 -965
  13. data/app/assets/javascripts/highcharts/modules/drilldown.js +783 -723
  14. data/app/assets/javascripts/highcharts/modules/exporting.js +864 -785
  15. data/app/assets/javascripts/highcharts/modules/funnel.js +290 -306
  16. data/app/assets/javascripts/highcharts/modules/heatmap.js +701 -645
  17. data/app/assets/javascripts/highcharts/modules/no-data-to-display.js +150 -132
  18. data/app/assets/javascripts/highcharts/modules/offline-exporting.js +414 -355
  19. data/app/assets/javascripts/highcharts/modules/overlapping-datalabels.js +164 -0
  20. data/app/assets/javascripts/highcharts/modules/series-label.js +473 -448
  21. data/app/assets/javascripts/highcharts/modules/solid-gauge.js +279 -271
  22. data/app/assets/javascripts/highcharts/modules/treemap.js +921 -886
  23. data/app/assets/javascripts/highcharts/themes/dark-blue.js +307 -244
  24. data/app/assets/javascripts/highcharts/themes/dark-green.js +303 -244
  25. data/app/assets/javascripts/highcharts/themes/dark-unica.js +231 -201
  26. data/app/assets/javascripts/highcharts/themes/gray.js +314 -245
  27. data/app/assets/javascripts/highcharts/themes/grid-light.js +91 -66
  28. data/app/assets/javascripts/highcharts/themes/grid.js +124 -96
  29. data/app/assets/javascripts/highcharts/themes/sand-signika.js +119 -94
  30. data/app/assets/javascripts/highcharts/themes/skies.js +108 -85
  31. data/lib/highcharts/version.rb +1 -1
  32. metadata +13 -14
  33. data/app/assets/javascripts/highcharts/adapters/standalone-framework.js +0 -1
  34. data/app/assets/javascripts/highcharts/modules/canvas-tools.js +0 -3115
  35. data/app/assets/javascripts/highcharts/modules/map.js +0 -2117
@@ -1,720 +1,776 @@
1
1
  /**
2
- * @license Highcharts JS v4.2.7 (2016-09-21)
2
+ * @license Highcharts JS v5.0.0 (2016-09-29)
3
3
  *
4
- * (c) 2011-2016 Torstein Honsi
4
+ * (c) 2009-2016 Torstein Honsi
5
5
  *
6
6
  * License: www.highcharts.com/license
7
7
  */
8
- /* eslint indent: [2, 4] */
9
- (function (factory) {
8
+ (function(factory) {
10
9
  if (typeof module === 'object' && module.exports) {
11
10
  module.exports = factory;
12
11
  } else {
13
12
  factory(Highcharts);
14
13
  }
15
- }(function (Highcharts) {
16
-
17
-
18
- var UNDEFINED,
19
- Axis = Highcharts.Axis,
20
- Chart = Highcharts.Chart,
21
- Color = Highcharts.Color,
22
- Legend = Highcharts.Legend,
23
- LegendSymbolMixin = Highcharts.LegendSymbolMixin,
24
- Series = Highcharts.Series,
25
- Point = Highcharts.Point,
26
-
27
- defaultOptions = Highcharts.getOptions(),
28
- each = Highcharts.each,
29
- extend = Highcharts.extend,
30
- extendClass = Highcharts.extendClass,
31
- isNumber = Highcharts.isNumber,
32
- merge = Highcharts.merge,
33
- pick = Highcharts.pick,
34
- seriesTypes = Highcharts.seriesTypes,
35
- wrap = Highcharts.wrap,
36
- noop = function () {};
37
-
38
-
39
-
40
-
41
- /**
42
- * The ColorAxis object for inclusion in gradient legends
43
- */
44
- var ColorAxis = Highcharts.ColorAxis = function () {
45
- this.init.apply(this, arguments);
46
- };
47
- extend(ColorAxis.prototype, Axis.prototype);
48
- extend(ColorAxis.prototype, {
49
- defaultColorAxisOptions: {
50
- lineWidth: 0,
51
- minPadding: 0,
52
- maxPadding: 0,
53
- gridLineWidth: 1,
54
- tickPixelInterval: 72,
55
- startOnTick: true,
56
- endOnTick: true,
57
- offset: 0,
58
- marker: {
59
- animation: {
60
- duration: 50
14
+ }(function(Highcharts) {
15
+ (function(H) {
16
+ /**
17
+ * (c) 2010-2016 Torstein Honsi
18
+ *
19
+ * License: www.highcharts.com/license
20
+ */
21
+ 'use strict';
22
+ var Axis = H.Axis,
23
+ Chart = H.Chart,
24
+ color = H.color,
25
+ ColorAxis,
26
+ each = H.each,
27
+ extend = H.extend,
28
+ isNumber = H.isNumber,
29
+ Legend = H.Legend,
30
+ LegendSymbolMixin = H.LegendSymbolMixin,
31
+ noop = H.noop,
32
+ merge = H.merge,
33
+ pick = H.pick,
34
+ wrap = H.wrap;
35
+
36
+ /**
37
+ * The ColorAxis object for inclusion in gradient legends
38
+ */
39
+ ColorAxis = H.ColorAxis = function() {
40
+ this.init.apply(this, arguments);
41
+ };
42
+ extend(ColorAxis.prototype, Axis.prototype);
43
+ extend(ColorAxis.prototype, {
44
+ defaultColorAxisOptions: {
45
+ lineWidth: 0,
46
+ minPadding: 0,
47
+ maxPadding: 0,
48
+ gridLineWidth: 1,
49
+ tickPixelInterval: 72,
50
+ startOnTick: true,
51
+ endOnTick: true,
52
+ offset: 0,
53
+ marker: {
54
+ animation: {
55
+ duration: 50
56
+ },
57
+ width: 0.01,
58
+
59
+ color: '#999999'
60
+
61
+ },
62
+ labels: {
63
+ overflow: 'justify'
61
64
  },
62
- color: 'gray',
63
- width: 0.01
65
+ minColor: '#e6ebf5',
66
+ maxColor: '#003399',
67
+ tickLength: 5,
68
+ showInLegend: true
64
69
  },
65
- labels: {
66
- overflow: 'justify'
70
+ init: function(chart, userOptions) {
71
+ var horiz = chart.options.legend.layout !== 'vertical',
72
+ options;
73
+
74
+ this.coll = 'colorAxis';
75
+
76
+ // Build the options
77
+ options = merge(this.defaultColorAxisOptions, {
78
+ side: horiz ? 2 : 1,
79
+ reversed: !horiz
80
+ }, userOptions, {
81
+ opposite: !horiz,
82
+ showEmpty: false,
83
+ title: null
84
+ });
85
+
86
+ Axis.prototype.init.call(this, chart, options);
87
+
88
+ // Base init() pushes it to the xAxis array, now pop it again
89
+ //chart[this.isXAxis ? 'xAxis' : 'yAxis'].pop();
90
+
91
+ // Prepare data classes
92
+ if (userOptions.dataClasses) {
93
+ this.initDataClasses(userOptions);
94
+ }
95
+ this.initStops(userOptions);
96
+
97
+ // Override original axis properties
98
+ this.horiz = horiz;
99
+ this.zoomEnabled = false;
100
+
101
+ // Add default values
102
+ this.defaultLegendLength = 200;
67
103
  },
68
- minColor: '#EFEFFF',
69
- maxColor: '#003875',
70
- tickLength: 5,
71
- showInLegend: true
72
- },
73
- init: function (chart, userOptions) {
74
- var horiz = chart.options.legend.layout !== 'vertical',
75
- options;
76
-
77
- this.coll = 'colorAxis';
78
-
79
- // Build the options
80
- options = merge(this.defaultColorAxisOptions, {
81
- side: horiz ? 2 : 1,
82
- reversed: !horiz
83
- }, userOptions, {
84
- opposite: !horiz,
85
- showEmpty: false,
86
- title: null
87
- });
88
-
89
- Axis.prototype.init.call(this, chart, options);
90
-
91
- // Base init() pushes it to the xAxis array, now pop it again
92
- //chart[this.isXAxis ? 'xAxis' : 'yAxis'].pop();
93
-
94
- // Prepare data classes
95
- if (userOptions.dataClasses) {
96
- this.initDataClasses(userOptions);
97
- }
98
- this.initStops(userOptions);
99
-
100
- // Override original axis properties
101
- this.horiz = horiz;
102
- this.zoomEnabled = false;
103
-
104
- // Add default values
105
- this.defaultLegendLength = 200;
106
- },
107
-
108
- /*
109
- * Return an intermediate color between two colors, according to pos where 0
110
- * is the from color and 1 is the to color.
111
- * NOTE: Changes here should be copied
112
- * to the same function in drilldown.src.js and solid-gauge-src.js.
113
- */
114
- tweenColors: function (from, to, pos) {
115
- // Check for has alpha, because rgba colors perform worse due to lack of
116
- // support in WebKit.
117
- var hasAlpha,
118
- ret;
119
-
120
- // Unsupported color, return to-color (#3920)
121
- if (!to.rgba.length || !from.rgba.length) {
122
- ret = to.input || 'none';
123
-
124
- // Interpolate
125
- } else {
126
- from = from.rgba;
127
- to = to.rgba;
128
- hasAlpha = (to[3] !== 1 || from[3] !== 1);
129
- ret = (hasAlpha ? 'rgba(' : 'rgb(') +
130
- Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' +
131
- Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' +
132
- Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) +
133
- (hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')';
134
- }
135
- return ret;
136
- },
137
-
138
- initDataClasses: function (userOptions) {
139
- var axis = this,
140
- chart = this.chart,
141
- dataClasses,
142
- colorCounter = 0,
143
- options = this.options,
144
- len = userOptions.dataClasses.length;
145
- this.dataClasses = dataClasses = [];
146
- this.legendItems = [];
147
-
148
- each(userOptions.dataClasses, function (dataClass, i) {
149
- var colors;
150
-
151
- dataClass = merge(dataClass);
152
- dataClasses.push(dataClass);
153
- if (!dataClass.color) {
154
- if (options.dataClassColor === 'category') {
155
- colors = chart.options.colors;
156
- dataClass.color = colors[colorCounter++];
157
- // loop back to zero
158
- if (colorCounter === colors.length) {
159
- colorCounter = 0;
104
+
105
+ /*
106
+ * Return an intermediate color between two colors, according to pos where 0
107
+ * is the from color and 1 is the to color.
108
+ * NOTE: Changes here should be copied
109
+ * to the same function in drilldown.src.js and solid-gauge-src.js.
110
+ */
111
+ tweenColors: function(from, to, pos) {
112
+ // Check for has alpha, because rgba colors perform worse due to lack of
113
+ // support in WebKit.
114
+ var hasAlpha,
115
+ ret;
116
+
117
+ // Unsupported color, return to-color (#3920)
118
+ if (!to.rgba.length || !from.rgba.length) {
119
+ ret = to.input || 'none';
120
+
121
+ // Interpolate
122
+ } else {
123
+ from = from.rgba;
124
+ to = to.rgba;
125
+ hasAlpha = (to[3] !== 1 || from[3] !== 1);
126
+ ret = (hasAlpha ? 'rgba(' : 'rgb(') +
127
+ Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' +
128
+ Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' +
129
+ Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) +
130
+ (hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')';
131
+ }
132
+ return ret;
133
+ },
134
+
135
+ initDataClasses: function(userOptions) {
136
+ var axis = this,
137
+ chart = this.chart,
138
+ dataClasses,
139
+ colorCounter = 0,
140
+ colorCount = chart.options.chart.colorCount,
141
+ options = this.options,
142
+ len = userOptions.dataClasses.length;
143
+ this.dataClasses = dataClasses = [];
144
+ this.legendItems = [];
145
+
146
+ each(userOptions.dataClasses, function(dataClass, i) {
147
+ var colors;
148
+
149
+ dataClass = merge(dataClass);
150
+ dataClasses.push(dataClass);
151
+ if (!dataClass.color) {
152
+ if (options.dataClassColor === 'category') {
153
+
154
+ colors = chart.options.colors;
155
+ colorCount = colors.length;
156
+ dataClass.color = colors[colorCounter];
157
+
158
+ dataClass.colorIndex = colorCounter;
159
+
160
+ // increase and loop back to zero
161
+ colorCounter++;
162
+ if (colorCounter === colorCount) {
163
+ colorCounter = 0;
164
+ }
165
+ } else {
166
+ dataClass.color = axis.tweenColors(
167
+ color(options.minColor),
168
+ color(options.maxColor),
169
+ len < 2 ? 0.5 : i / (len - 1) // #3219
170
+ );
160
171
  }
161
- } else {
162
- dataClass.color = axis.tweenColors(
163
- Color(options.minColor),
164
- Color(options.maxColor),
165
- len < 2 ? 0.5 : i / (len - 1) // #3219
166
- );
167
172
  }
173
+ });
174
+ },
175
+
176
+ initStops: function(userOptions) {
177
+ this.stops = userOptions.stops || [
178
+ [0, this.options.minColor],
179
+ [1, this.options.maxColor]
180
+ ];
181
+ each(this.stops, function(stop) {
182
+ stop.color = color(stop[1]);
183
+ });
184
+ },
185
+
186
+ /**
187
+ * Extend the setOptions method to process extreme colors and color
188
+ * stops.
189
+ */
190
+ setOptions: function(userOptions) {
191
+ Axis.prototype.setOptions.call(this, userOptions);
192
+
193
+ this.options.crosshair = this.options.marker;
194
+ },
195
+
196
+ setAxisSize: function() {
197
+ var symbol = this.legendSymbol,
198
+ chart = this.chart,
199
+ legendOptions = chart.options.legend || {},
200
+ x,
201
+ y,
202
+ width,
203
+ height;
204
+
205
+ if (symbol) {
206
+ this.left = x = symbol.attr('x');
207
+ this.top = y = symbol.attr('y');
208
+ this.width = width = symbol.attr('width');
209
+ this.height = height = symbol.attr('height');
210
+ this.right = chart.chartWidth - x - width;
211
+ this.bottom = chart.chartHeight - y - height;
212
+
213
+ this.len = this.horiz ? width : height;
214
+ this.pos = this.horiz ? x : y;
215
+ } else {
216
+ // Fake length for disabled legend to avoid tick issues and such (#5205)
217
+ this.len = (this.horiz ? legendOptions.symbolWidth : legendOptions.symbolHeight) || this.defaultLegendLength;
168
218
  }
169
- });
170
- },
171
-
172
- initStops: function (userOptions) {
173
- this.stops = userOptions.stops || [
174
- [0, this.options.minColor],
175
- [1, this.options.maxColor]
176
- ];
177
- each(this.stops, function (stop) {
178
- stop.color = Color(stop[1]);
179
- });
180
- },
219
+ },
181
220
 
182
- /**
183
- * Extend the setOptions method to process extreme colors and color
184
- * stops.
185
- */
186
- setOptions: function (userOptions) {
187
- Axis.prototype.setOptions.call(this, userOptions);
188
-
189
- this.options.crosshair = this.options.marker;
190
- },
191
-
192
- setAxisSize: function () {
193
- var symbol = this.legendSymbol,
194
- chart = this.chart,
195
- legendOptions = chart.options.legend || {},
196
- x,
197
- y,
198
- width,
199
- height;
200
-
201
- if (symbol) {
202
- this.left = x = symbol.attr('x');
203
- this.top = y = symbol.attr('y');
204
- this.width = width = symbol.attr('width');
205
- this.height = height = symbol.attr('height');
206
- this.right = chart.chartWidth - x - width;
207
- this.bottom = chart.chartHeight - y - height;
208
-
209
- this.len = this.horiz ? width : height;
210
- this.pos = this.horiz ? x : y;
211
- } else {
212
- // Fake length for disabled legend to avoid tick issues and such (#5205)
213
- this.len = (this.horiz ? legendOptions.symbolWidth : legendOptions.symbolHeight) || this.defaultLegendLength;
214
- }
215
- },
221
+ /**
222
+ * Translate from a value to a color
223
+ */
224
+ toColor: function(value, point) {
225
+ var pos,
226
+ stops = this.stops,
227
+ from,
228
+ to,
229
+ color,
230
+ dataClasses = this.dataClasses,
231
+ dataClass,
232
+ i;
233
+
234
+ if (dataClasses) {
235
+ i = dataClasses.length;
236
+ while (i--) {
237
+ dataClass = dataClasses[i];
238
+ from = dataClass.from;
239
+ to = dataClass.to;
240
+ if ((from === undefined || value >= from) && (to === undefined || value <= to)) {
241
+ color = dataClass.color;
242
+ if (point) {
243
+ point.dataClass = i;
244
+ point.colorIndex = dataClass.colorIndex;
245
+ }
246
+ break;
247
+ }
248
+ }
216
249
 
217
- /**
218
- * Translate from a value to a color
219
- */
220
- toColor: function (value, point) {
221
- var pos,
222
- stops = this.stops,
223
- from,
224
- to,
225
- color,
226
- dataClasses = this.dataClasses,
227
- dataClass,
228
- i;
229
-
230
- if (dataClasses) {
231
- i = dataClasses.length;
232
- while (i--) {
233
- dataClass = dataClasses[i];
234
- from = dataClass.from;
235
- to = dataClass.to;
236
- if ((from === UNDEFINED || value >= from) && (to === UNDEFINED || value <= to)) {
237
- color = dataClass.color;
238
- if (point) {
239
- point.dataClass = i;
250
+ } else {
251
+
252
+ if (this.isLog) {
253
+ value = this.val2lin(value);
254
+ }
255
+ pos = 1 - ((this.max - value) / ((this.max - this.min) || 1));
256
+ i = stops.length;
257
+ while (i--) {
258
+ if (pos > stops[i][0]) {
259
+ break;
240
260
  }
241
- break;
242
261
  }
243
- }
262
+ from = stops[i] || stops[i + 1];
263
+ to = stops[i + 1] || from;
244
264
 
245
- } else {
265
+ // The position within the gradient
266
+ pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1);
246
267
 
247
- if (this.isLog) {
248
- value = this.val2lin(value);
268
+ color = this.tweenColors(
269
+ from.color,
270
+ to.color,
271
+ pos
272
+ );
249
273
  }
250
- pos = 1 - ((this.max - value) / ((this.max - this.min) || 1));
251
- i = stops.length;
252
- while (i--) {
253
- if (pos > stops[i][0]) {
254
- break;
274
+ return color;
275
+ },
276
+
277
+ /**
278
+ * Override the getOffset method to add the whole axis groups inside the legend.
279
+ */
280
+ getOffset: function() {
281
+ var group = this.legendGroup,
282
+ sideOffset = this.chart.axisOffset[this.side];
283
+
284
+ if (group) {
285
+
286
+ // Hook for the getOffset method to add groups to this parent group
287
+ this.axisParent = group;
288
+
289
+ // Call the base
290
+ Axis.prototype.getOffset.call(this);
291
+
292
+ // First time only
293
+ if (!this.added) {
294
+
295
+ this.added = true;
296
+
297
+ this.labelLeft = 0;
298
+ this.labelRight = this.width;
255
299
  }
300
+ // Reset it to avoid color axis reserving space
301
+ this.chart.axisOffset[this.side] = sideOffset;
256
302
  }
257
- from = stops[i] || stops[i + 1];
258
- to = stops[i + 1] || from;
303
+ },
304
+
305
+ /**
306
+ * Create the color gradient
307
+ */
308
+ setLegendColor: function() {
309
+ var grad,
310
+ horiz = this.horiz,
311
+ options = this.options,
312
+ reversed = this.reversed,
313
+ one = reversed ? 1 : 0,
314
+ zero = reversed ? 0 : 1;
315
+
316
+ grad = horiz ? [one, 0, zero, 0] : [0, zero, 0, one]; // #3190
317
+ this.legendColor = {
318
+ linearGradient: {
319
+ x1: grad[0],
320
+ y1: grad[1],
321
+ x2: grad[2],
322
+ y2: grad[3]
323
+ },
324
+ stops: options.stops || [
325
+ [0, options.minColor],
326
+ [1, options.maxColor]
327
+ ]
328
+ };
329
+ },
259
330
 
260
- // The position within the gradient
261
- pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1);
331
+ /**
332
+ * The color axis appears inside the legend and has its own legend symbol
333
+ */
334
+ drawLegendSymbol: function(legend, item) {
335
+ var padding = legend.padding,
336
+ legendOptions = legend.options,
337
+ horiz = this.horiz,
338
+ width = pick(legendOptions.symbolWidth, horiz ? this.defaultLegendLength : 12),
339
+ height = pick(legendOptions.symbolHeight, horiz ? 12 : this.defaultLegendLength),
340
+ labelPadding = pick(legendOptions.labelPadding, horiz ? 16 : 30),
341
+ itemDistance = pick(legendOptions.itemDistance, 10);
262
342
 
263
- color = this.tweenColors(
264
- from.color,
265
- to.color,
266
- pos
267
- );
268
- }
269
- return color;
270
- },
343
+ this.setLegendColor();
271
344
 
272
- /**
273
- * Override the getOffset method to add the whole axis groups inside the legend.
274
- */
275
- getOffset: function () {
276
- var group = this.legendGroup,
277
- sideOffset = this.chart.axisOffset[this.side];
345
+ // Create the gradient
346
+ item.legendSymbol = this.chart.renderer.rect(
347
+ 0,
348
+ legend.baseline - 11,
349
+ width,
350
+ height
351
+ ).attr({
352
+ zIndex: 1
353
+ }).add(item.legendGroup);
354
+
355
+ // Set how much space this legend item takes up
356
+ this.legendItemWidth = width + padding + (horiz ? itemDistance : labelPadding);
357
+ this.legendItemHeight = height + padding + (horiz ? labelPadding : 0);
358
+ },
359
+ /**
360
+ * Fool the legend
361
+ */
362
+ setState: noop,
363
+ visible: true,
364
+ setVisible: noop,
365
+ getSeriesExtremes: function() {
366
+ var series;
367
+ if (this.series.length) {
368
+ series = this.series[0];
369
+ this.dataMin = series.valueMin;
370
+ this.dataMax = series.valueMax;
371
+ }
372
+ },
373
+ drawCrosshair: function(e, point) {
374
+ var plotX = point && point.plotX,
375
+ plotY = point && point.plotY,
376
+ crossPos,
377
+ axisPos = this.pos,
378
+ axisLen = this.len;
379
+
380
+ if (point) {
381
+ crossPos = this.toPixels(point[point.series.colorKey]);
382
+ if (crossPos < axisPos) {
383
+ crossPos = axisPos - 2;
384
+ } else if (crossPos > axisPos + axisLen) {
385
+ crossPos = axisPos + axisLen + 2;
386
+ }
278
387
 
279
- if (group) {
388
+ point.plotX = crossPos;
389
+ point.plotY = this.len - crossPos;
390
+ Axis.prototype.drawCrosshair.call(this, e, point);
391
+ point.plotX = plotX;
392
+ point.plotY = plotY;
280
393
 
281
- // Hook for the getOffset method to add groups to this parent group
282
- this.axisParent = group;
394
+ if (this.cross) {
395
+ this.cross
396
+ .addClass('highcharts-coloraxis-marker')
397
+ .add(this.legendGroup);
283
398
 
284
- // Call the base
285
- Axis.prototype.getOffset.call(this);
286
399
 
287
- // First time only
288
- if (!this.added) {
400
+ this.cross.attr({
401
+ fill: this.crosshair.color
402
+ });
289
403
 
290
- this.added = true;
291
404
 
292
- this.labelLeft = 0;
293
- this.labelRight = this.width;
405
+ }
294
406
  }
295
- // Reset it to avoid color axis reserving space
296
- this.chart.axisOffset[this.side] = sideOffset;
297
- }
298
- },
407
+ },
408
+ getPlotLinePath: function(a, b, c, d, pos) {
409
+ return isNumber(pos) ? // crosshairs only // #3969 pos can be 0 !!
410
+ (this.horiz ? ['M', pos - 4, this.top - 6, 'L', pos + 4, this.top - 6, pos, this.top, 'Z'] : ['M', this.left, pos, 'L', this.left - 6, pos + 6, this.left - 6, pos - 6, 'Z']) :
411
+ Axis.prototype.getPlotLinePath.call(this, a, b, c, d);
412
+ },
413
+
414
+ update: function(newOptions, redraw) {
415
+ var chart = this.chart,
416
+ legend = chart.legend;
417
+
418
+ each(this.series, function(series) {
419
+ series.isDirtyData = true; // Needed for Axis.update when choropleth colors change
420
+ });
421
+
422
+ // When updating data classes, destroy old items and make sure new ones are created (#3207)
423
+ if (newOptions.dataClasses && legend.allItems) {
424
+ each(legend.allItems, function(item) {
425
+ if (item.isDataClass) {
426
+ item.legendGroup.destroy();
427
+ }
428
+ });
429
+ chart.isDirtyLegend = true;
430
+ }
431
+
432
+ // Keep the options structure updated for export. Unlike xAxis and yAxis, the colorAxis is
433
+ // not an array. (#3207)
434
+ chart.options[this.coll] = merge(this.userOptions, newOptions);
435
+
436
+ Axis.prototype.update.call(this, newOptions, redraw);
437
+ if (this.legendItem) {
438
+ this.setLegendColor();
439
+ legend.colorizeItem(this, true);
440
+ }
441
+ },
442
+
443
+ /**
444
+ * Get the legend item symbols for data classes
445
+ */
446
+ getDataClassLegendSymbols: function() {
447
+ var axis = this,
448
+ chart = this.chart,
449
+ legendItems = this.legendItems,
450
+ legendOptions = chart.options.legend,
451
+ valueDecimals = legendOptions.valueDecimals,
452
+ valueSuffix = legendOptions.valueSuffix || '',
453
+ name;
454
+
455
+ if (!legendItems.length) {
456
+ each(this.dataClasses, function(dataClass, i) {
457
+ var vis = true,
458
+ from = dataClass.from,
459
+ to = dataClass.to;
460
+
461
+ // Assemble the default name. This can be overridden by legend.options.labelFormatter
462
+ name = '';
463
+ if (from === undefined) {
464
+ name = '< ';
465
+ } else if (to === undefined) {
466
+ name = '> ';
467
+ }
468
+ if (from !== undefined) {
469
+ name += H.numberFormat(from, valueDecimals) + valueSuffix;
470
+ }
471
+ if (from !== undefined && to !== undefined) {
472
+ name += ' - ';
473
+ }
474
+ if (to !== undefined) {
475
+ name += H.numberFormat(to, valueDecimals) + valueSuffix;
476
+ }
477
+ // Add a mock object to the legend items
478
+ legendItems.push(extend({
479
+ chart: chart,
480
+ name: name,
481
+ options: {},
482
+ drawLegendSymbol: LegendSymbolMixin.drawRectangle,
483
+ visible: true,
484
+ setState: noop,
485
+ isDataClass: true,
486
+ setVisible: function() {
487
+ vis = this.visible = !vis;
488
+ each(axis.series, function(series) {
489
+ each(series.points, function(point) {
490
+ if (point.dataClass === i) {
491
+ point.setVisible(vis);
492
+ }
493
+ });
494
+ });
495
+
496
+ chart.legend.colorizeItem(this, vis);
497
+ }
498
+ }, dataClass));
499
+ });
500
+ }
501
+ return legendItems;
502
+ },
503
+ name: '' // Prevents 'undefined' in legend in IE8
504
+ });
299
505
 
300
506
  /**
301
- * Create the color gradient
507
+ * Handle animation of the color attributes directly
302
508
  */
303
- setLegendColor: function () {
304
- var grad,
305
- horiz = this.horiz,
306
- options = this.options,
307
- reversed = this.reversed,
308
- one = reversed ? 1 : 0,
309
- zero = reversed ? 0 : 1;
310
-
311
- grad = horiz ? [one, 0, zero, 0] : [0, zero, 0, one]; // #3190
312
- this.legendColor = {
313
- linearGradient: { x1: grad[0], y1: grad[1], x2: grad[2], y2: grad[3] },
314
- stops: options.stops || [
315
- [0, options.minColor],
316
- [1, options.maxColor]
317
- ]
509
+ each(['fill', 'stroke'], function(prop) {
510
+ H.Fx.prototype[prop + 'Setter'] = function() {
511
+ this.elem.attr(prop, ColorAxis.prototype.tweenColors(color(this.start), color(this.end), this.pos));
318
512
  };
319
- },
513
+ });
320
514
 
321
515
  /**
322
- * The color axis appears inside the legend and has its own legend symbol
516
+ * Extend the chart getAxes method to also get the color axis
323
517
  */
324
- drawLegendSymbol: function (legend, item) {
325
- var padding = legend.padding,
326
- legendOptions = legend.options,
327
- horiz = this.horiz,
328
- width = pick(legendOptions.symbolWidth, horiz ? this.defaultLegendLength : 12),
329
- height = pick(legendOptions.symbolHeight, horiz ? 12 : this.defaultLegendLength),
330
- labelPadding = pick(legendOptions.labelPadding, horiz ? 16 : 30),
331
- itemDistance = pick(legendOptions.itemDistance, 10);
332
-
333
- this.setLegendColor();
334
-
335
- // Create the gradient
336
- item.legendSymbol = this.chart.renderer.rect(
337
- 0,
338
- legend.baseline - 11,
339
- width,
340
- height
341
- ).attr({
342
- zIndex: 1
343
- }).add(item.legendGroup);
344
-
345
- // Set how much space this legend item takes up
346
- this.legendItemWidth = width + padding + (horiz ? itemDistance : labelPadding);
347
- this.legendItemHeight = height + padding + (horiz ? labelPadding : 0);
348
- },
349
- /**
350
- * Fool the legend
351
- */
352
- setState: noop,
353
- visible: true,
354
- setVisible: noop,
355
- getSeriesExtremes: function () {
356
- var series;
357
- if (this.series.length) {
358
- series = this.series[0];
359
- this.dataMin = series.valueMin;
360
- this.dataMax = series.valueMax;
361
- }
362
- },
363
- drawCrosshair: function (e, point) {
364
- var plotX = point && point.plotX,
365
- plotY = point && point.plotY,
366
- crossPos,
367
- axisPos = this.pos,
368
- axisLen = this.len;
369
-
370
- if (point) {
371
- crossPos = this.toPixels(point[point.series.colorKey]);
372
- if (crossPos < axisPos) {
373
- crossPos = axisPos - 2;
374
- } else if (crossPos > axisPos + axisLen) {
375
- crossPos = axisPos + axisLen + 2;
376
- }
518
+ wrap(Chart.prototype, 'getAxes', function(proceed) {
377
519
 
378
- point.plotX = crossPos;
379
- point.plotY = this.len - crossPos;
380
- Axis.prototype.drawCrosshair.call(this, e, point);
381
- point.plotX = plotX;
382
- point.plotY = plotY;
520
+ var options = this.options,
521
+ colorAxisOptions = options.colorAxis;
383
522
 
384
- if (this.cross) {
385
- this.cross
386
- .attr({
387
- fill: this.crosshair.color
388
- })
389
- .add(this.legendGroup);
390
- }
523
+ proceed.call(this);
524
+
525
+ this.colorAxis = [];
526
+ if (colorAxisOptions) {
527
+ new ColorAxis(this, colorAxisOptions); // eslint-disable-line no-new
391
528
  }
392
- },
393
- getPlotLinePath: function (a, b, c, d, pos) {
394
- return isNumber(pos) ? // crosshairs only // #3969 pos can be 0 !!
395
- (this.horiz ?
396
- ['M', pos - 4, this.top - 6, 'L', pos + 4, this.top - 6, pos, this.top, 'Z'] :
397
- ['M', this.left, pos, 'L', this.left - 6, pos + 6, this.left - 6, pos - 6, 'Z']
398
- ) :
399
- Axis.prototype.getPlotLinePath.call(this, a, b, c, d);
400
- },
401
-
402
- update: function (newOptions, redraw) {
403
- var chart = this.chart,
404
- legend = chart.legend;
405
-
406
- each(this.series, function (series) {
407
- series.isDirtyData = true; // Needed for Axis.update when choropleth colors change
408
- });
409
-
410
- // When updating data classes, destroy old items and make sure new ones are created (#3207)
411
- if (newOptions.dataClasses && legend.allItems) {
412
- each(legend.allItems, function (item) {
413
- if (item.isDataClass) {
414
- item.legendGroup.destroy();
529
+ });
530
+
531
+
532
+ /**
533
+ * Wrap the legend getAllItems method to add the color axis. This also removes the
534
+ * axis' own series to prevent them from showing up individually.
535
+ */
536
+ wrap(Legend.prototype, 'getAllItems', function(proceed) {
537
+ var allItems = [],
538
+ colorAxis = this.chart.colorAxis[0];
539
+
540
+ if (colorAxis && colorAxis.options) {
541
+ if (colorAxis.options.showInLegend) {
542
+ // Data classes
543
+ if (colorAxis.options.dataClasses) {
544
+ allItems = allItems.concat(colorAxis.getDataClassLegendSymbols());
545
+ // Gradient legend
546
+ } else {
547
+ // Add this axis on top
548
+ allItems.push(colorAxis);
415
549
  }
550
+ }
551
+
552
+ // Don't add the color axis' series
553
+ each(colorAxis.series, function(series) {
554
+ series.options.showInLegend = false;
416
555
  });
417
- chart.isDirtyLegend = true;
418
556
  }
419
557
 
420
- // Keep the options structure updated for export. Unlike xAxis and yAxis, the colorAxis is
421
- // not an array. (#3207)
422
- chart.options[this.coll] = merge(this.userOptions, newOptions);
558
+ return allItems.concat(proceed.call(this));
559
+ });
423
560
 
424
- Axis.prototype.update.call(this, newOptions, redraw);
425
- if (this.legendItem) {
426
- this.setLegendColor();
427
- legend.colorizeItem(this, true);
561
+ wrap(Legend.prototype, 'colorizeItem', function(proceed, item, visible) {
562
+ proceed.call(this, item, visible);
563
+ if (visible && item.legendColor) {
564
+ item.legendSymbol.attr({
565
+ fill: item.legendColor
566
+ });
428
567
  }
429
- },
568
+ });
430
569
 
570
+ }(Highcharts));
571
+ (function(H) {
431
572
  /**
432
- * Get the legend item symbols for data classes
573
+ * (c) 2010-2016 Torstein Honsi
574
+ *
575
+ * License: www.highcharts.com/license
433
576
  */
434
- getDataClassLegendSymbols: function () {
435
- var axis = this,
436
- chart = this.chart,
437
- legendItems = this.legendItems,
438
- legendOptions = chart.options.legend,
439
- valueDecimals = legendOptions.valueDecimals,
440
- valueSuffix = legendOptions.valueSuffix || '',
441
- name;
442
-
443
- if (!legendItems.length) {
444
- each(this.dataClasses, function (dataClass, i) {
445
- var vis = true,
446
- from = dataClass.from,
447
- to = dataClass.to;
577
+ 'use strict';
578
+ var defined = H.defined,
579
+ each = H.each,
580
+ noop = H.noop,
581
+ seriesTypes = H.seriesTypes;
448
582
 
449
- // Assemble the default name. This can be overridden by legend.options.labelFormatter
450
- name = '';
451
- if (from === UNDEFINED) {
452
- name = '< ';
453
- } else if (to === UNDEFINED) {
454
- name = '> ';
455
- }
456
- if (from !== UNDEFINED) {
457
- name += Highcharts.numberFormat(from, valueDecimals) + valueSuffix;
458
- }
459
- if (from !== UNDEFINED && to !== UNDEFINED) {
460
- name += ' - ';
461
- }
462
- if (to !== UNDEFINED) {
463
- name += Highcharts.numberFormat(to, valueDecimals) + valueSuffix;
583
+ /**
584
+ * Mixin for maps and heatmaps
585
+ */
586
+ H.colorPointMixin = {
587
+ /**
588
+ * Set the visibility of a single point
589
+ */
590
+ setVisible: function(vis) {
591
+ var point = this,
592
+ method = vis ? 'show' : 'hide';
593
+
594
+ // Show and hide associated elements
595
+ each(['graphic', 'dataLabel'], function(key) {
596
+ if (point[key]) {
597
+ point[key][method]();
464
598
  }
465
-
466
- // Add a mock object to the legend items
467
- legendItems.push(extend({
468
- chart: chart,
469
- name: name,
470
- options: {},
471
- drawLegendSymbol: LegendSymbolMixin.drawRectangle,
472
- visible: true,
473
- setState: noop,
474
- isDataClass: true,
475
- setVisible: function () {
476
- vis = this.visible = !vis;
477
- each(axis.series, function (series) {
478
- each(series.points, function (point) {
479
- if (point.dataClass === i) {
480
- point.setVisible(vis);
481
- }
482
- });
483
- });
484
-
485
- chart.legend.colorizeItem(this, vis);
486
- }
487
- }, dataClass));
488
599
  });
489
600
  }
490
- return legendItems;
491
- },
492
- name: '' // Prevents 'undefined' in legend in IE8
493
- });
494
-
495
- /**
496
- * Handle animation of the color attributes directly
497
- */
498
- each(['fill', 'stroke'], function (prop) {
499
- Highcharts.Fx.prototype[prop + 'Setter'] = function () {
500
- this.elem.attr(prop, ColorAxis.prototype.tweenColors(Color(this.start), Color(this.end), this.pos));
501
601
  };
502
- });
503
-
504
- /**
505
- * Extend the chart getAxes method to also get the color axis
506
- */
507
- wrap(Chart.prototype, 'getAxes', function (proceed) {
508
-
509
- var options = this.options,
510
- colorAxisOptions = options.colorAxis;
511
-
512
- proceed.call(this);
513
-
514
- this.colorAxis = [];
515
- if (colorAxisOptions) {
516
- new ColorAxis(this, colorAxisOptions); // eslint-disable-line no-new
517
- }
518
- });
519
-
520
-
521
- /**
522
- * Wrap the legend getAllItems method to add the color axis. This also removes the
523
- * axis' own series to prevent them from showing up individually.
524
- */
525
- wrap(Legend.prototype, 'getAllItems', function (proceed) {
526
- var allItems = [],
527
- colorAxis = this.chart.colorAxis[0];
528
-
529
- if (colorAxis) {
530
- if (colorAxis.options.showInLegend) {
531
- // Data classes
532
- if (colorAxis.options.dataClasses) {
533
- allItems = allItems.concat(colorAxis.getDataClassLegendSymbols());
534
- // Gradient legend
535
- } else {
536
- // Add this axis on top
537
- allItems.push(colorAxis);
538
- }
539
- }
540
602
 
541
- // Don't add the color axis' series
542
- each(colorAxis.series, function (series) {
543
- series.options.showInLegend = false;
544
- });
545
- }
546
-
547
- return allItems.concat(proceed.call(this));
548
- });
549
- /**
550
- * Mixin for maps and heatmaps
551
- */
552
- var colorPointMixin = {
553
- /**
554
- * Set the visibility of a single point
555
- */
556
- setVisible: function (vis) {
557
- var point = this,
558
- method = vis ? 'show' : 'hide';
559
-
560
- // Show and hide associated elements
561
- each(['graphic', 'dataLabel'], function (key) {
562
- if (point[key]) {
563
- point[key][method]();
564
- }
565
- });
566
- }
567
- };
568
- var colorSeriesMixin = {
569
-
570
- pointAttrToOptions: { // mapping between SVG attributes and the corresponding options
571
- stroke: 'borderColor',
572
- 'stroke-width': 'borderWidth',
573
- fill: 'color',
574
- dashstyle: 'dashStyle'
575
- },
576
- pointArrayMap: ['value'],
577
- axisTypes: ['xAxis', 'yAxis', 'colorAxis'],
578
- optionalAxis: 'colorAxis',
579
- trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup'],
580
- getSymbol: noop,
581
- parallelArrays: ['x', 'y', 'value'],
582
- colorKey: 'value',
603
+ H.colorSeriesMixin = {
604
+ pointArrayMap: ['value'],
605
+ axisTypes: ['xAxis', 'yAxis', 'colorAxis'],
606
+ optionalAxis: 'colorAxis',
607
+ trackerGroups: ['group', 'markerGroup', 'dataLabelsGroup'],
608
+ getSymbol: noop,
609
+ parallelArrays: ['x', 'y', 'value'],
610
+ colorKey: 'value',
583
611
 
584
- /**
585
- * In choropleth maps, the color is a result of the value, so this needs translation too
586
- */
587
- translateColors: function () {
588
- var series = this,
589
- nullColor = this.options.nullColor,
590
- colorAxis = this.colorAxis,
591
- colorKey = this.colorKey;
592
612
 
593
- each(this.data, function (point) {
594
- var value = point[colorKey],
595
- color;
613
+ pointAttribs: seriesTypes.column.prototype.pointAttribs,
596
614
 
597
- color = point.options.color ||
598
- (value === null ? nullColor : (colorAxis && value !== undefined) ? colorAxis.toColor(value, point) : point.color || series.color);
599
615
 
600
- if (color) {
601
- point.color = color;
602
- }
603
- });
604
- }
605
- };
606
-
607
- /**
608
- * Extend the default options with map options
609
- */
610
- defaultOptions.plotOptions.heatmap = merge(defaultOptions.plotOptions.scatter, {
611
- animation: false,
612
- borderWidth: 0,
613
- nullColor: '#F8F8F8',
614
- dataLabels: {
615
- formatter: function () { // #2945
616
- return this.point.value;
617
- },
618
- inside: true,
619
- verticalAlign: 'middle',
620
- crop: false,
621
- overflow: false,
622
- padding: 0 // #3837
623
- },
624
- marker: null,
625
- pointRange: null, // dynamically set to colsize by default
626
- tooltip: {
627
- pointFormat: '{point.x}, {point.y}: {point.value}<br/>'
628
- },
629
- states: {
630
- normal: {
631
- animation: true
616
+ /**
617
+ * In choropleth maps, the color is a result of the value, so this needs translation too
618
+ */
619
+ translateColors: function() {
620
+ var series = this,
621
+ nullColor = this.options.nullColor,
622
+ colorAxis = this.colorAxis,
623
+ colorKey = this.colorKey;
624
+
625
+ each(this.data, function(point) {
626
+ var value = point[colorKey],
627
+ color;
628
+
629
+ color = point.options.color ||
630
+ (value === null ? nullColor : (colorAxis && value !== undefined) ? colorAxis.toColor(value, point) : point.color || series.color);
631
+
632
+ if (color) {
633
+ point.color = color;
634
+ }
635
+ });
632
636
  },
633
- hover: {
634
- halo: false, // #3406, halo is not required on heatmaps
635
- brightness: 0.2
637
+
638
+ /**
639
+ * Get the color attibutes to apply on the graphic
640
+ */
641
+ colorAttribs: function(point) {
642
+ var ret = {};
643
+ if (defined(point.color)) {
644
+ ret[this.colorProp || 'fill'] = point.color;
645
+ }
646
+ return ret;
636
647
  }
637
- }
638
- });
639
-
640
- // The Heatmap series type
641
- seriesTypes.heatmap = extendClass(seriesTypes.scatter, merge(colorSeriesMixin, {
642
- type: 'heatmap',
643
- pointArrayMap: ['y', 'value'],
644
- hasPointSpecificOptions: true,
645
- pointClass: extendClass(Point, colorPointMixin),
646
- supportsDrilldown: true,
647
- getExtremesFromAll: true,
648
- directTouch: true,
648
+ };
649
649
 
650
+ }(Highcharts));
651
+ (function(H) {
650
652
  /**
651
- * Override the init method to add point ranges on both axes.
653
+ * (c) 2010-2016 Torstein Honsi
654
+ *
655
+ * License: www.highcharts.com/license
652
656
  */
653
- init: function () {
654
- var options;
655
- seriesTypes.scatter.prototype.init.apply(this, arguments);
656
-
657
- options = this.options;
658
- options.pointRange = pick(options.pointRange, options.colsize || 1); // #3758, prevent resetting in setData
659
- this.yAxis.axisPointRange = options.rowsize || 1; // general point range
660
- },
661
- translate: function () {
662
- var series = this,
663
- options = series.options,
664
- xAxis = series.xAxis,
665
- yAxis = series.yAxis,
666
- between = function (x, a, b) {
667
- return Math.min(Math.max(a, x), b);
668
- };
669
-
670
- series.generatePoints();
671
-
672
- each(series.points, function (point) {
673
- var xPad = (options.colsize || 1) / 2,
674
- yPad = (options.rowsize || 1) / 2,
675
- x1 = between(Math.round(xAxis.len - xAxis.translate(point.x - xPad, 0, 1, 0, 1)), -xAxis.len, 2 * xAxis.len),
676
- x2 = between(Math.round(xAxis.len - xAxis.translate(point.x + xPad, 0, 1, 0, 1)), -xAxis.len, 2 * xAxis.len),
677
- y1 = between(Math.round(yAxis.translate(point.y - yPad, 0, 1, 0, 1)), -yAxis.len, 2 * yAxis.len),
678
- y2 = between(Math.round(yAxis.translate(point.y + yPad, 0, 1, 0, 1)), -yAxis.len, 2 * yAxis.len);
679
-
680
- // Set plotX and plotY for use in K-D-Tree and more
681
- point.plotX = point.clientX = (x1 + x2) / 2;
682
- point.plotY = (y1 + y2) / 2;
683
-
684
- point.shapeType = 'rect';
685
- point.shapeArgs = {
686
- x: Math.min(x1, x2),
687
- y: Math.min(y1, y2),
688
- width: Math.abs(x2 - x1),
689
- height: Math.abs(y2 - y1)
690
- };
691
- });
692
-
693
- series.translateColors();
694
-
695
- // Make sure colors are updated on colorAxis update (#2893)
696
- if (this.chart.hasRendered) {
697
- each(series.points, function (point) {
698
- point.shapeArgs.fill = point.options.color || point.color; // #3311
699
- });
657
+ 'use strict';
658
+ var colorPointMixin = H.colorPointMixin,
659
+ colorSeriesMixin = H.colorSeriesMixin,
660
+ each = H.each,
661
+ LegendSymbolMixin = H.LegendSymbolMixin,
662
+ merge = H.merge,
663
+ noop = H.noop,
664
+ pick = H.pick,
665
+ Series = H.Series,
666
+ seriesType = H.seriesType,
667
+ seriesTypes = H.seriesTypes;
668
+
669
+ // The Heatmap series type
670
+ seriesType('heatmap', 'scatter', {
671
+ animation: false,
672
+ borderWidth: 0,
673
+
674
+ nullColor: '#f7f7f7',
675
+
676
+ dataLabels: {
677
+ formatter: function() { // #2945
678
+ return this.point.value;
679
+ },
680
+ inside: true,
681
+ verticalAlign: 'middle',
682
+ crop: false,
683
+ overflow: false,
684
+ padding: 0 // #3837
685
+ },
686
+ marker: null,
687
+ pointRange: null, // dynamically set to colsize by default
688
+ tooltip: {
689
+ pointFormat: '{point.x}, {point.y}: {point.value}<br/>'
690
+ },
691
+ states: {
692
+ normal: {
693
+ animation: true
694
+ },
695
+ hover: {
696
+ halo: false, // #3406, halo is not required on heatmaps
697
+ brightness: 0.2
698
+ }
700
699
  }
701
- },
702
- drawPoints: seriesTypes.column.prototype.drawPoints,
703
- animate: noop,
704
- getBox: noop,
705
- drawLegendSymbol: LegendSymbolMixin.drawRectangle,
706
- alignDataLabel: seriesTypes.column.prototype.alignDataLabel,
707
- getExtremes: function () {
708
- // Get the extremes from the value data
709
- Series.prototype.getExtremes.call(this, this.valueData);
710
- this.valueMin = this.dataMin;
711
- this.valueMax = this.dataMax;
700
+ }, merge(colorSeriesMixin, {
701
+ pointArrayMap: ['y', 'value'],
702
+ hasPointSpecificOptions: true,
703
+ supportsDrilldown: true,
704
+ getExtremesFromAll: true,
705
+ directTouch: true,
706
+
707
+ /**
708
+ * Override the init method to add point ranges on both axes.
709
+ */
710
+ init: function() {
711
+ var options;
712
+ seriesTypes.scatter.prototype.init.apply(this, arguments);
713
+
714
+ options = this.options;
715
+ options.pointRange = pick(options.pointRange, options.colsize || 1); // #3758, prevent resetting in setData
716
+ this.yAxis.axisPointRange = options.rowsize || 1; // general point range
717
+ },
718
+ translate: function() {
719
+ var series = this,
720
+ options = series.options,
721
+ xAxis = series.xAxis,
722
+ yAxis = series.yAxis,
723
+ between = function(x, a, b) {
724
+ return Math.min(Math.max(a, x), b);
725
+ };
726
+
727
+ series.generatePoints();
728
+
729
+ each(series.points, function(point) {
730
+ var xPad = (options.colsize || 1) / 2,
731
+ yPad = (options.rowsize || 1) / 2,
732
+ x1 = between(Math.round(xAxis.len - xAxis.translate(point.x - xPad, 0, 1, 0, 1)), -xAxis.len, 2 * xAxis.len),
733
+ x2 = between(Math.round(xAxis.len - xAxis.translate(point.x + xPad, 0, 1, 0, 1)), -xAxis.len, 2 * xAxis.len),
734
+ y1 = between(Math.round(yAxis.translate(point.y - yPad, 0, 1, 0, 1)), -yAxis.len, 2 * yAxis.len),
735
+ y2 = between(Math.round(yAxis.translate(point.y + yPad, 0, 1, 0, 1)), -yAxis.len, 2 * yAxis.len);
736
+
737
+ // Set plotX and plotY for use in K-D-Tree and more
738
+ point.plotX = point.clientX = (x1 + x2) / 2;
739
+ point.plotY = (y1 + y2) / 2;
740
+
741
+ point.shapeType = 'rect';
742
+ point.shapeArgs = {
743
+ x: Math.min(x1, x2),
744
+ y: Math.min(y1, y2),
745
+ width: Math.abs(x2 - x1),
746
+ height: Math.abs(y2 - y1)
747
+ };
748
+ });
712
749
 
713
- // Get the extremes from the y data
714
- Series.prototype.getExtremes.call(this);
715
- }
750
+ series.translateColors();
751
+ },
752
+ drawPoints: function() {
753
+ seriesTypes.column.prototype.drawPoints.call(this);
716
754
 
717
- }));
755
+ each(this.points, function(point) {
756
+ point.graphic.attr(this.colorAttribs(point, point.state));
757
+ }, this);
758
+ },
759
+ animate: noop,
760
+ getBox: noop,
761
+ drawLegendSymbol: LegendSymbolMixin.drawRectangle,
762
+ alignDataLabel: seriesTypes.column.prototype.alignDataLabel,
763
+ getExtremes: function() {
764
+ // Get the extremes from the value data
765
+ Series.prototype.getExtremes.call(this, this.valueData);
766
+ this.valueMin = this.dataMin;
767
+ this.valueMax = this.dataMax;
768
+
769
+ // Get the extremes from the y data
770
+ Series.prototype.getExtremes.call(this);
771
+ }
718
772
 
773
+ }), colorPointMixin);
719
774
 
775
+ }(Highcharts));
720
776
  }));