highstock-rails 1.3.10 → 2.1.10

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