highcharts_rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +106 -0
- data/Rakefile +6 -0
- data/highcharts_rails.gemspec +27 -0
- data/lib/highcharts_rails/version.rb +3 -0
- data/lib/highcharts_rails.rb +8 -0
- data/vendor/assets/javascripts/highcharts-3d.src.js +2139 -0
- data/vendor/assets/javascripts/highcharts-more.src.js +2982 -0
- data/vendor/assets/javascripts/highcharts.src.js +22947 -0
- data/vendor/assets/javascripts/js/highcharts-3d.src.js +2085 -0
- data/vendor/assets/javascripts/js/highcharts-more.src.js +2820 -0
- data/vendor/assets/javascripts/js/highcharts.src.js +20917 -0
- data/vendor/assets/javascripts/js/modules/accessibility.src.js +1072 -0
- data/vendor/assets/javascripts/js/modules/annotations.src.js +408 -0
- data/vendor/assets/javascripts/js/modules/boost.src.js +652 -0
- data/vendor/assets/javascripts/js/modules/broken-axis.src.js +338 -0
- data/vendor/assets/javascripts/js/modules/data.src.js +981 -0
- data/vendor/assets/javascripts/js/modules/drilldown.src.js +756 -0
- data/vendor/assets/javascripts/js/modules/exporting.src.js +953 -0
- data/vendor/assets/javascripts/js/modules/funnel.src.js +290 -0
- data/vendor/assets/javascripts/js/modules/gantt.src.js +791 -0
- data/vendor/assets/javascripts/js/modules/grid-axis.src.js +545 -0
- data/vendor/assets/javascripts/js/modules/heatmap.src.js +798 -0
- data/vendor/assets/javascripts/js/modules/no-data-to-display.src.js +150 -0
- data/vendor/assets/javascripts/js/modules/offline-exporting.src.js +492 -0
- data/vendor/assets/javascripts/js/modules/overlapping-datalabels.src.js +164 -0
- data/vendor/assets/javascripts/js/modules/series-label.src.js +606 -0
- data/vendor/assets/javascripts/js/modules/solid-gauge.src.js +305 -0
- data/vendor/assets/javascripts/js/modules/treemap.src.js +881 -0
- data/vendor/assets/javascripts/js/modules/xrange-series.src.js +254 -0
- data/vendor/assets/javascripts/js/themes/dark-blue.js +317 -0
- data/vendor/assets/javascripts/js/themes/dark-green.js +314 -0
- data/vendor/assets/javascripts/js/themes/dark-unica.js +243 -0
- data/vendor/assets/javascripts/js/themes/gray.js +326 -0
- data/vendor/assets/javascripts/js/themes/grid-light.js +99 -0
- data/vendor/assets/javascripts/js/themes/grid.js +131 -0
- data/vendor/assets/javascripts/js/themes/sand-signika.js +129 -0
- data/vendor/assets/javascripts/js/themes/skies.js +112 -0
- data/vendor/assets/javascripts/lib/canvg.src.js +3073 -0
- data/vendor/assets/javascripts/lib/jspdf.src.js +3031 -0
- data/vendor/assets/javascripts/lib/rgbcolor.src.js +299 -0
- data/vendor/assets/javascripts/lib/svg2pdf.src.js +1451 -0
- data/vendor/assets/javascripts/modules/accessibility.src.js +1072 -0
- data/vendor/assets/javascripts/modules/annotations.src.js +408 -0
- data/vendor/assets/javascripts/modules/boost.src.js +652 -0
- data/vendor/assets/javascripts/modules/broken-axis.src.js +338 -0
- data/vendor/assets/javascripts/modules/data.src.js +981 -0
- data/vendor/assets/javascripts/modules/drilldown.src.js +797 -0
- data/vendor/assets/javascripts/modules/exporting.src.js +882 -0
- data/vendor/assets/javascripts/modules/funnel.src.js +304 -0
- data/vendor/assets/javascripts/modules/gantt.src.js +815 -0
- data/vendor/assets/javascripts/modules/grid-axis.src.js +547 -0
- data/vendor/assets/javascripts/modules/heatmap.src.js +810 -0
- data/vendor/assets/javascripts/modules/no-data-to-display.src.js +161 -0
- data/vendor/assets/javascripts/modules/offline-exporting.src.js +492 -0
- data/vendor/assets/javascripts/modules/overlapping-datalabels.src.js +164 -0
- data/vendor/assets/javascripts/modules/series-label.src.js +606 -0
- data/vendor/assets/javascripts/modules/solid-gauge.src.js +316 -0
- data/vendor/assets/javascripts/modules/treemap.src.js +935 -0
- data/vendor/assets/javascripts/modules/xrange-series.src.js +276 -0
- data/vendor/assets/javascripts/themes/dark-blue.js +317 -0
- data/vendor/assets/javascripts/themes/dark-green.js +314 -0
- data/vendor/assets/javascripts/themes/dark-unica.js +243 -0
- data/vendor/assets/javascripts/themes/gray.js +326 -0
- data/vendor/assets/javascripts/themes/grid-light.js +99 -0
- data/vendor/assets/javascripts/themes/grid.js +131 -0
- data/vendor/assets/javascripts/themes/sand-signika.js +129 -0
- data/vendor/assets/javascripts/themes/skies.js +112 -0
- data/vendor/assets/stylesheets/highcharts.scss +610 -0
- metadata +161 -0
@@ -0,0 +1,305 @@
|
|
1
|
+
/**
|
2
|
+
* @license Highcharts JS v5.0.6 (2016-12-07)
|
3
|
+
* Solid angular gauge module
|
4
|
+
*
|
5
|
+
* (c) 2010-2016 Torstein Honsi
|
6
|
+
*
|
7
|
+
* License: www.highcharts.com/license
|
8
|
+
*/
|
9
|
+
(function(factory) {
|
10
|
+
if (typeof module === 'object' && module.exports) {
|
11
|
+
module.exports = factory;
|
12
|
+
} else {
|
13
|
+
factory(Highcharts);
|
14
|
+
}
|
15
|
+
}(function(Highcharts) {
|
16
|
+
(function(H) {
|
17
|
+
/**
|
18
|
+
* Solid angular gauge module
|
19
|
+
*
|
20
|
+
* (c) 2010-2016 Torstein Honsi
|
21
|
+
*
|
22
|
+
* License: www.highcharts.com/license
|
23
|
+
*/
|
24
|
+
|
25
|
+
'use strict';
|
26
|
+
|
27
|
+
var pInt = H.pInt,
|
28
|
+
pick = H.pick,
|
29
|
+
each = H.each,
|
30
|
+
isNumber = H.isNumber,
|
31
|
+
colorAxisMethods;
|
32
|
+
|
33
|
+
// These methods are defined in the ColorAxis object, and copied here.
|
34
|
+
// If we implement an AMD system we should make ColorAxis a dependency.
|
35
|
+
colorAxisMethods = {
|
36
|
+
|
37
|
+
|
38
|
+
initDataClasses: function(userOptions) {
|
39
|
+
var axis = this,
|
40
|
+
chart = this.chart,
|
41
|
+
dataClasses,
|
42
|
+
colorCounter = 0,
|
43
|
+
options = this.options;
|
44
|
+
this.dataClasses = dataClasses = [];
|
45
|
+
|
46
|
+
each(userOptions.dataClasses, function(dataClass, i) {
|
47
|
+
var colors;
|
48
|
+
|
49
|
+
dataClass = H.merge(dataClass);
|
50
|
+
dataClasses.push(dataClass);
|
51
|
+
if (!dataClass.color) {
|
52
|
+
if (options.dataClassColor === 'category') {
|
53
|
+
colors = chart.options.colors;
|
54
|
+
dataClass.color = colors[colorCounter++];
|
55
|
+
// loop back to zero
|
56
|
+
if (colorCounter === colors.length) {
|
57
|
+
colorCounter = 0;
|
58
|
+
}
|
59
|
+
} else {
|
60
|
+
dataClass.color = axis.tweenColors(H.color(options.minColor), H.color(options.maxColor), i / (userOptions.dataClasses.length - 1));
|
61
|
+
}
|
62
|
+
}
|
63
|
+
});
|
64
|
+
},
|
65
|
+
|
66
|
+
initStops: function(userOptions) {
|
67
|
+
this.stops = userOptions.stops || [
|
68
|
+
[0, this.options.minColor],
|
69
|
+
[1, this.options.maxColor]
|
70
|
+
];
|
71
|
+
each(this.stops, function(stop) {
|
72
|
+
stop.color = H.color(stop[1]);
|
73
|
+
});
|
74
|
+
},
|
75
|
+
/**
|
76
|
+
* Translate from a value to a color
|
77
|
+
*/
|
78
|
+
toColor: function(value, point) {
|
79
|
+
var pos,
|
80
|
+
stops = this.stops,
|
81
|
+
from,
|
82
|
+
to,
|
83
|
+
color,
|
84
|
+
dataClasses = this.dataClasses,
|
85
|
+
dataClass,
|
86
|
+
i;
|
87
|
+
|
88
|
+
if (dataClasses) {
|
89
|
+
i = dataClasses.length;
|
90
|
+
while (i--) {
|
91
|
+
dataClass = dataClasses[i];
|
92
|
+
from = dataClass.from;
|
93
|
+
to = dataClass.to;
|
94
|
+
if ((from === undefined || value >= from) && (to === undefined || value <= to)) {
|
95
|
+
color = dataClass.color;
|
96
|
+
if (point) {
|
97
|
+
point.dataClass = i;
|
98
|
+
}
|
99
|
+
break;
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
} else {
|
104
|
+
|
105
|
+
if (this.isLog) {
|
106
|
+
value = this.val2lin(value);
|
107
|
+
}
|
108
|
+
pos = 1 - ((this.max - value) / (this.max - this.min));
|
109
|
+
i = stops.length;
|
110
|
+
while (i--) {
|
111
|
+
if (pos > stops[i][0]) {
|
112
|
+
break;
|
113
|
+
}
|
114
|
+
}
|
115
|
+
from = stops[i] || stops[i + 1];
|
116
|
+
to = stops[i + 1] || from;
|
117
|
+
|
118
|
+
// The position within the gradient
|
119
|
+
pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1);
|
120
|
+
|
121
|
+
color = this.tweenColors(
|
122
|
+
from.color,
|
123
|
+
to.color,
|
124
|
+
pos
|
125
|
+
);
|
126
|
+
}
|
127
|
+
return color;
|
128
|
+
},
|
129
|
+
/*
|
130
|
+
* Return an intermediate color between two colors, according to pos where 0
|
131
|
+
* is the from color and 1 is the to color.
|
132
|
+
*/
|
133
|
+
tweenColors: function(from, to, pos) {
|
134
|
+
// Check for has alpha, because rgba colors perform worse due to lack of
|
135
|
+
// support in WebKit.
|
136
|
+
var hasAlpha,
|
137
|
+
ret;
|
138
|
+
|
139
|
+
// Unsupported color, return to-color (#3920)
|
140
|
+
if (!to.rgba.length || !from.rgba.length) {
|
141
|
+
ret = to.input || 'none';
|
142
|
+
|
143
|
+
// Interpolate
|
144
|
+
} else {
|
145
|
+
from = from.rgba;
|
146
|
+
to = to.rgba;
|
147
|
+
hasAlpha = (to[3] !== 1 || from[3] !== 1);
|
148
|
+
ret = (hasAlpha ? 'rgba(' : 'rgb(') +
|
149
|
+
Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' +
|
150
|
+
Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' +
|
151
|
+
Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) +
|
152
|
+
(hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')';
|
153
|
+
}
|
154
|
+
return ret;
|
155
|
+
}
|
156
|
+
};
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Handle animation of the color attributes directly
|
160
|
+
*/
|
161
|
+
each(['fill', 'stroke'], function(prop) {
|
162
|
+
H.Fx.prototype[prop + 'Setter'] = function() {
|
163
|
+
this.elem.attr(
|
164
|
+
prop,
|
165
|
+
colorAxisMethods.tweenColors(
|
166
|
+
H.color(this.start),
|
167
|
+
H.color(this.end),
|
168
|
+
this.pos
|
169
|
+
),
|
170
|
+
null,
|
171
|
+
true
|
172
|
+
);
|
173
|
+
};
|
174
|
+
});
|
175
|
+
|
176
|
+
// The solidgauge series type
|
177
|
+
H.seriesType('solidgauge', 'gauge', {
|
178
|
+
colorByPoint: true
|
179
|
+
|
180
|
+
}, {
|
181
|
+
|
182
|
+
/**
|
183
|
+
* Extend the translate function to extend the Y axis with the necessary
|
184
|
+
* decoration (#5895).
|
185
|
+
*/
|
186
|
+
translate: function() {
|
187
|
+
var axis = this.yAxis;
|
188
|
+
H.extend(axis, colorAxisMethods);
|
189
|
+
|
190
|
+
// Prepare data classes
|
191
|
+
if (!axis.dataClasses && axis.options.dataClasses) {
|
192
|
+
axis.initDataClasses(axis.options);
|
193
|
+
}
|
194
|
+
axis.initStops(axis.options);
|
195
|
+
|
196
|
+
// Generate points and inherit data label position
|
197
|
+
H.seriesTypes.gauge.prototype.translate.call(this);
|
198
|
+
},
|
199
|
+
|
200
|
+
/**
|
201
|
+
* Draw the points where each point is one needle
|
202
|
+
*/
|
203
|
+
drawPoints: function() {
|
204
|
+
var series = this,
|
205
|
+
yAxis = series.yAxis,
|
206
|
+
center = yAxis.center,
|
207
|
+
options = series.options,
|
208
|
+
renderer = series.chart.renderer,
|
209
|
+
overshoot = options.overshoot,
|
210
|
+
overshootVal = isNumber(overshoot) ? overshoot / 180 * Math.PI : 0,
|
211
|
+
thresholdAngleRad;
|
212
|
+
|
213
|
+
// Handle the threshold option
|
214
|
+
if (isNumber(options.threshold)) {
|
215
|
+
thresholdAngleRad = yAxis.startAngleRad + yAxis.translate(
|
216
|
+
options.threshold,
|
217
|
+
null,
|
218
|
+
null,
|
219
|
+
null,
|
220
|
+
true
|
221
|
+
);
|
222
|
+
}
|
223
|
+
this.thresholdAngleRad = pick(thresholdAngleRad, yAxis.startAngleRad);
|
224
|
+
|
225
|
+
|
226
|
+
each(series.points, function(point) {
|
227
|
+
var graphic = point.graphic,
|
228
|
+
rotation = yAxis.startAngleRad + yAxis.translate(point.y, null, null, null, true),
|
229
|
+
radius = (pInt(pick(point.options.radius, options.radius, 100)) * center[2]) / 200,
|
230
|
+
innerRadius = (pInt(pick(point.options.innerRadius, options.innerRadius, 60)) * center[2]) / 200,
|
231
|
+
shapeArgs,
|
232
|
+
d,
|
233
|
+
toColor = yAxis.toColor(point.y, point),
|
234
|
+
axisMinAngle = Math.min(yAxis.startAngleRad, yAxis.endAngleRad),
|
235
|
+
axisMaxAngle = Math.max(yAxis.startAngleRad, yAxis.endAngleRad),
|
236
|
+
minAngle,
|
237
|
+
maxAngle;
|
238
|
+
|
239
|
+
if (toColor === 'none') { // #3708
|
240
|
+
toColor = point.color || series.color || 'none';
|
241
|
+
}
|
242
|
+
if (toColor !== 'none') {
|
243
|
+
point.color = toColor;
|
244
|
+
}
|
245
|
+
|
246
|
+
// Handle overshoot and clipping to axis max/min
|
247
|
+
rotation = Math.max(axisMinAngle - overshootVal, Math.min(axisMaxAngle + overshootVal, rotation));
|
248
|
+
|
249
|
+
// Handle the wrap option
|
250
|
+
if (options.wrap === false) {
|
251
|
+
rotation = Math.max(axisMinAngle, Math.min(axisMaxAngle, rotation));
|
252
|
+
}
|
253
|
+
|
254
|
+
minAngle = Math.min(rotation, series.thresholdAngleRad);
|
255
|
+
maxAngle = Math.max(rotation, series.thresholdAngleRad);
|
256
|
+
|
257
|
+
if (maxAngle - minAngle > 2 * Math.PI) {
|
258
|
+
maxAngle = minAngle + 2 * Math.PI;
|
259
|
+
}
|
260
|
+
|
261
|
+
point.shapeArgs = shapeArgs = {
|
262
|
+
x: center[0],
|
263
|
+
y: center[1],
|
264
|
+
r: radius,
|
265
|
+
innerR: innerRadius,
|
266
|
+
start: minAngle,
|
267
|
+
end: maxAngle,
|
268
|
+
fill: toColor
|
269
|
+
};
|
270
|
+
point.startR = radius; // For PieSeries.animate
|
271
|
+
|
272
|
+
if (graphic) {
|
273
|
+
d = shapeArgs.d;
|
274
|
+
graphic.animate(shapeArgs);
|
275
|
+
if (d) {
|
276
|
+
shapeArgs.d = d; // animate alters it
|
277
|
+
}
|
278
|
+
} else {
|
279
|
+
point.graphic = renderer.arc(shapeArgs)
|
280
|
+
.addClass('highcharts-point')
|
281
|
+
.attr({
|
282
|
+
fill: toColor,
|
283
|
+
'sweep-flag': 0
|
284
|
+
})
|
285
|
+
.add(series.group);
|
286
|
+
|
287
|
+
|
288
|
+
}
|
289
|
+
});
|
290
|
+
},
|
291
|
+
|
292
|
+
/**
|
293
|
+
* Extend the pie slice animation by animating from start angle and up
|
294
|
+
*/
|
295
|
+
animate: function(init) {
|
296
|
+
|
297
|
+
if (!init) {
|
298
|
+
this.startAngleRad = this.thresholdAngleRad;
|
299
|
+
H.seriesTypes.pie.prototype.animate.call(this, init);
|
300
|
+
}
|
301
|
+
}
|
302
|
+
});
|
303
|
+
|
304
|
+
}(Highcharts));
|
305
|
+
}));
|