highcharts-rails 3.0.10 → 4.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Highcharts JS v3.0.10 (2014-03-10)
2
+ * @license Highcharts JS v4.0.0 (2014-04-22)
3
3
  * Plugin for displaying a message when there is no data visible in chart.
4
4
  *
5
5
  * (c) 2010-2014 Highsoft AS
@@ -0,0 +1,224 @@
1
+ /**
2
+ * @license Highcharts JS v4.0.0 (2014-04-22)
3
+ * Solid angular gauge module
4
+ *
5
+ * (c) 2010-2014 Torstein Honsi
6
+ *
7
+ * License: www.highcharts.com/license
8
+ */
9
+
10
+ /*global Highcharts*/
11
+ (function (H) {
12
+ "use strict";
13
+
14
+ var defaultPlotOptions = H.getOptions().plotOptions,
15
+ pInt = H.pInt,
16
+ pick = H.pick,
17
+ each = H.each,
18
+ colorAxisMethods,
19
+ UNDEFINED;
20
+
21
+ // The default options
22
+ defaultPlotOptions.solidgauge = H.merge(defaultPlotOptions.gauge, {
23
+ colorByPoint: true
24
+ });
25
+
26
+
27
+ // These methods are defined in the ColorAxis object, and copied here.
28
+ // If we implement an AMD system we should make ColorAxis a dependency.
29
+ colorAxisMethods = {
30
+
31
+
32
+ initDataClasses: function (userOptions) {
33
+ var axis = this,
34
+ chart = this.chart,
35
+ dataClasses,
36
+ colorCounter = 0,
37
+ options = this.options;
38
+ this.dataClasses = dataClasses = [];
39
+
40
+ each(userOptions.dataClasses, function (dataClass, i) {
41
+ var colors;
42
+
43
+ dataClass = H.merge(dataClass);
44
+ dataClasses.push(dataClass);
45
+ if (!dataClass.color) {
46
+ if (options.dataClassColor === 'category') {
47
+ colors = chart.options.colors;
48
+ dataClass.color = colors[colorCounter++];
49
+ // loop back to zero
50
+ if (colorCounter === colors.length) {
51
+ colorCounter = 0;
52
+ }
53
+ } else {
54
+ dataClass.color = axis.tweenColors(H.Color(options.minColor), H.Color(options.maxColor), i / (userOptions.dataClasses.length - 1));
55
+ }
56
+ }
57
+ });
58
+ },
59
+
60
+ initStops: function (userOptions) {
61
+ this.stops = userOptions.stops || [
62
+ [0, this.options.minColor],
63
+ [1, this.options.maxColor]
64
+ ];
65
+ each(this.stops, function (stop) {
66
+ stop.color = H.Color(stop[1]);
67
+ });
68
+ },
69
+ /**
70
+ * Translate from a value to a color
71
+ */
72
+ toColor: function (value, point) {
73
+ var pos,
74
+ stops = this.stops,
75
+ from,
76
+ to,
77
+ color,
78
+ dataClasses = this.dataClasses,
79
+ dataClass,
80
+ i;
81
+
82
+ if (dataClasses) {
83
+ i = dataClasses.length;
84
+ while (i--) {
85
+ dataClass = dataClasses[i];
86
+ from = dataClass.from;
87
+ to = dataClass.to;
88
+ if ((from === UNDEFINED || value >= from) && (to === UNDEFINED || value <= to)) {
89
+ color = dataClass.color;
90
+ if (point) {
91
+ point.dataClass = i;
92
+ }
93
+ break;
94
+ }
95
+ }
96
+
97
+ } else {
98
+
99
+ if (this.isLog) {
100
+ value = this.val2lin(value);
101
+ }
102
+ pos = 1 - ((this.max - value) / (this.max - this.min));
103
+ i = stops.length;
104
+ while (i--) {
105
+ if (pos > stops[i][0]) {
106
+ break;
107
+ }
108
+ }
109
+ from = stops[i] || stops[i + 1];
110
+ to = stops[i + 1] || from;
111
+
112
+ // The position within the gradient
113
+ pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1);
114
+
115
+ color = this.tweenColors(
116
+ from.color,
117
+ to.color,
118
+ pos
119
+ );
120
+ }
121
+ return color;
122
+ },
123
+ tweenColors: function (from, to, pos) {
124
+ // Check for has alpha, because rgba colors perform worse due to lack of
125
+ // support in WebKit.
126
+ var hasAlpha = (to.rgba[3] !== 1 || from.rgba[3] !== 1);
127
+
128
+ if (from.rgba.length === 0 || to.rgba.length === 0) {
129
+ return 'none';
130
+ }
131
+ return (hasAlpha ? 'rgba(' : 'rgb(') +
132
+ Math.round(to.rgba[0] + (from.rgba[0] - to.rgba[0]) * (1 - pos)) + ',' +
133
+ Math.round(to.rgba[1] + (from.rgba[1] - to.rgba[1]) * (1 - pos)) + ',' +
134
+ Math.round(to.rgba[2] + (from.rgba[2] - to.rgba[2]) * (1 - pos)) +
135
+ (hasAlpha ? (',' + (to.rgba[3] + (from.rgba[3] - to.rgba[3]) * (1 - pos))) : '') + ')';
136
+ }
137
+ };
138
+
139
+ // The series prototype
140
+ H.seriesTypes.solidgauge = H.extendClass(H.seriesTypes.gauge, {
141
+ type: 'solidgauge',
142
+
143
+ bindAxes: function () {
144
+ var axis;
145
+ H.seriesTypes.gauge.prototype.bindAxes.call(this);
146
+
147
+ axis = this.yAxis;
148
+ H.extend(axis, colorAxisMethods);
149
+
150
+ // Prepare data classes
151
+ if (axis.options.dataClasses) {
152
+ axis.initDataClasses(axis.options);
153
+ }
154
+ axis.initStops(axis.options);
155
+ },
156
+
157
+ /**
158
+ * Draw the points where each point is one needle
159
+ */
160
+ drawPoints: function () {
161
+ var series = this,
162
+ yAxis = series.yAxis,
163
+ center = yAxis.center,
164
+ options = series.options,
165
+ renderer = series.chart.renderer;
166
+
167
+ H.each(series.points, function (point) {
168
+ var graphic = point.graphic,
169
+ rotation = yAxis.startAngleRad + yAxis.translate(point.y, null, null, null, true),
170
+ radius = (pInt(pick(options.radius, 100)) * center[2]) / 200,
171
+ innerRadius = (pInt(pick(options.innerRadius, 60)) * center[2]) / 200,
172
+ shapeArgs,
173
+ d,
174
+ toColor = yAxis.toColor(point.y, point),
175
+ fromColor;
176
+
177
+ if (toColor !== 'none') {
178
+ fromColor = point.color;
179
+ point.color = toColor;
180
+ }
181
+
182
+ // Handle the wrap option
183
+ if (options.wrap === false) {
184
+ rotation = Math.max(yAxis.startAngleRad, Math.min(yAxis.endAngleRad, rotation));
185
+ }
186
+ rotation = rotation * 180 / Math.PI;
187
+
188
+ shapeArgs = {
189
+ x: center[0],
190
+ y: center[1],
191
+ r: radius,
192
+ innerR: innerRadius,
193
+ start: yAxis.startAngleRad,
194
+ end: rotation / (180 / Math.PI)
195
+ };
196
+
197
+ if (graphic) {
198
+ d = shapeArgs.d;
199
+
200
+ /*jslint unparam: true*/
201
+ graphic.attr({
202
+ fill: point.color
203
+ }).animate(shapeArgs, {
204
+ step: function (value, fx) {
205
+ graphic.attr('fill', colorAxisMethods.tweenColors(H.Color(fromColor), H.Color(toColor), fx.pos));
206
+ }
207
+ });
208
+ /*jslint unparam: false*/
209
+ shapeArgs.d = d; // animate alters it
210
+ } else {
211
+ point.graphic = renderer.arc(shapeArgs)
212
+ .attr({
213
+ stroke: options.borderColor || 'none',
214
+ 'stroke-width': options.borderWidth || 0,
215
+ fill: point.color
216
+ })
217
+ .add(series.group);
218
+ }
219
+ });
220
+ },
221
+ animate: null
222
+ });
223
+
224
+ }(Highcharts));
@@ -244,7 +244,7 @@ Highcharts.theme = {
244
244
 
245
245
  // special colors for some of the
246
246
  legendBackgroundColor: 'rgba(0, 0, 0, 0.5)',
247
- legendBackgroundColorSolid: 'rgb(35, 35, 70)',
247
+ background2: 'rgb(35, 35, 70)',
248
248
  dataLabelsColor: '#444',
249
249
  textColor: '#C0C0C0',
250
250
  maskColor: 'rgba(255,255,255,0.3)'
@@ -245,7 +245,7 @@ Highcharts.theme = {
245
245
 
246
246
  // special colors for some of the
247
247
  legendBackgroundColor: 'rgba(0, 0, 0, 0.5)',
248
- legendBackgroundColorSolid: 'rgb(35, 35, 70)',
248
+ background2: 'rgb(35, 35, 70)',
249
249
  dataLabelsColor: '#444',
250
250
  textColor: '#C0C0C0',
251
251
  maskColor: 'rgba(255,255,255,0.3)'
@@ -0,0 +1,213 @@
1
+ /**
2
+ * Dark theme for Highcharts JS
3
+ * @author Torstein Honsi
4
+ */
5
+
6
+ // Load the fonts
7
+ Highcharts.createElement('link', {
8
+ href: 'http://fonts.googleapis.com/css?family=Unica+One',
9
+ rel: 'stylesheet',
10
+ type: 'text/css'
11
+ }, null, document.getElementsByTagName('head')[0]);
12
+
13
+ Highcharts.theme = {
14
+ colors: ["#2b908f", "#90ee7e", "#f45b5b", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee",
15
+ "#55BF3B", "#DF5353", "#7798BF", "#aaeeee"],
16
+ chart: {
17
+ backgroundColor: {
18
+ linearGradient: { x1: 0, y1: 0, x2: 1, y2: 1 },
19
+ stops: [
20
+ [0, '#2a2a2b'],
21
+ [1, '#3e3e40']
22
+ ]
23
+ },
24
+ style: {
25
+ fontFamily: "'Unica One', sans-serif"
26
+ },
27
+ plotBorderColor: '#606063'
28
+ },
29
+ title: {
30
+ style: {
31
+ color: '#E0E0E3',
32
+ textTransform: 'uppercase',
33
+ fontSize: '20px'
34
+ }
35
+ },
36
+ subtitle: {
37
+ style: {
38
+ color: '#E0E0E3',
39
+ textTransform: 'uppercase'
40
+ }
41
+ },
42
+ xAxis: {
43
+ gridLineColor: '#707073',
44
+ labels: {
45
+ style: {
46
+ color: '#E0E0E3'
47
+ }
48
+ },
49
+ lineColor: '#707073',
50
+ minorGridLineColor: '#505053',
51
+ tickColor: '#707073',
52
+ title: {
53
+ style: {
54
+ color: '#A0A0A3'
55
+
56
+ }
57
+ }
58
+ },
59
+ yAxis: {
60
+ gridLineColor: '#707073',
61
+ labels: {
62
+ style: {
63
+ color: '#E0E0E3'
64
+ }
65
+ },
66
+ lineColor: '#707073',
67
+ minorGridLineColor: '#505053',
68
+ tickColor: '#707073',
69
+ tickWidth: 1,
70
+ title: {
71
+ style: {
72
+ color: '#A0A0A3'
73
+ }
74
+ }
75
+ },
76
+ tooltip: {
77
+ backgroundColor: 'rgba(0, 0, 0, 0.85)',
78
+ style: {
79
+ color: '#F0F0F0'
80
+ }
81
+ },
82
+ plotOptions: {
83
+ series: {
84
+ dataLabels: {
85
+ color: '#B0B0B3'
86
+ },
87
+ marker: {
88
+ lineColor: '#333'
89
+ }
90
+ },
91
+ boxplot: {
92
+ fillColor: '#505053'
93
+ },
94
+ candlestick: {
95
+ lineColor: 'white'
96
+ },
97
+ errorbar: {
98
+ color: 'white'
99
+ }
100
+ },
101
+ legend: {
102
+ itemStyle: {
103
+ color: '#E0E0E3'
104
+ },
105
+ itemHoverStyle: {
106
+ color: '#FFF'
107
+ },
108
+ itemHiddenStyle: {
109
+ color: '#606063'
110
+ }
111
+ },
112
+ credits: {
113
+ style: {
114
+ color: '#666'
115
+ }
116
+ },
117
+ labels: {
118
+ style: {
119
+ color: '#707073'
120
+ }
121
+ },
122
+
123
+ drilldown: {
124
+ activeAxisLabelStyle: {
125
+ color: '#F0F0F3'
126
+ },
127
+ activeDataLabelStyle: {
128
+ color: '#F0F0F3'
129
+ }
130
+ },
131
+
132
+ navigation: {
133
+ buttonOptions: {
134
+ symbolStroke: '#DDDDDD',
135
+ theme: {
136
+ fill: '#505053'
137
+ }
138
+ }
139
+ },
140
+
141
+ // scroll charts
142
+ rangeSelector: {
143
+ buttonTheme: {
144
+ fill: '#505053',
145
+ stroke: '#000000',
146
+ style: {
147
+ color: '#CCC'
148
+ },
149
+ states: {
150
+ hover: {
151
+ fill: '#707073',
152
+ stroke: '#000000',
153
+ style: {
154
+ color: 'white'
155
+ }
156
+ },
157
+ select: {
158
+ fill: '#000003',
159
+ stroke: '#000000',
160
+ style: {
161
+ color: 'white'
162
+ }
163
+ }
164
+ }
165
+ },
166
+ inputBoxBorderColor: '#505053',
167
+ inputStyle: {
168
+ backgroundColor: '#333',
169
+ color: 'silver'
170
+ },
171
+ labelStyle: {
172
+ color: 'silver'
173
+ }
174
+ },
175
+
176
+ navigator: {
177
+ handles: {
178
+ backgroundColor: '#666',
179
+ borderColor: '#AAA'
180
+ },
181
+ outlineColor: '#CCC',
182
+ maskFill: 'rgba(255,255,255,0.1)',
183
+ series: {
184
+ color: '#7798BF',
185
+ lineColor: '#A6C7ED'
186
+ },
187
+ xAxis: {
188
+ gridLineColor: '#505053'
189
+ }
190
+ },
191
+
192
+ scrollbar: {
193
+ barBackgroundColor: '#808083',
194
+ barBorderColor: '#808083',
195
+ buttonArrowColor: '#CCC',
196
+ buttonBackgroundColor: '#606063',
197
+ buttonBorderColor: '#606063',
198
+ rifleColor: '#FFF',
199
+ trackBackgroundColor: '#404043',
200
+ trackBorderColor: '#404043'
201
+ },
202
+
203
+ // special colors for some of the
204
+ legendBackgroundColor: 'rgba(0, 0, 0, 0.5)',
205
+ background2: '#505053',
206
+ dataLabelsColor: '#B0B0B3',
207
+ textColor: '#C0C0C0',
208
+ contrastTextColor: '#F0F0F3',
209
+ maskColor: 'rgba(255,255,255,0.3)'
210
+ };
211
+
212
+ // Apply the theme
213
+ Highcharts.setOptions(Highcharts.theme);