corrade-nucleus-nucleons – Diff between revs 1 and 11
?pathlinks?
Rev 1 | Rev 11 | |||
---|---|---|---|---|
Line 1... | Line 1... | |||
1 | /** |
1 | /** |
|
2 | * @license Highcharts JS v5.0.10 (2017-03-31) |
2 | * @license Highcharts JS v5.0.12 (2017-05-24) |
|
3 | * Solid angular gauge module |
3 | * Solid angular gauge module |
|
4 | * |
4 | * |
|
5 | * (c) 2010-2017 Torstein Honsi |
5 | * (c) 2010-2017 Torstein Honsi |
|
6 | * |
6 | * |
|
7 | * License: www.highcharts.com/license |
7 | * License: www.highcharts.com/license |
|
Line 68... | Line 68... | |||
68 | // If we implement an AMD system we should make ColorAxis a dependency. |
68 | // If we implement an AMD system we should make ColorAxis a dependency. |
|
69 | colorAxisMethods = { |
69 | colorAxisMethods = { |
|
Line 70... | Line 70... | |||
70 | |
70 | |
|
71 | |
- | ||
72 | initDataClasses: function(userOptions) { |
71 | |
|
73 | var axis = this, |
72 | initDataClasses: function(userOptions) { |
|
74 | chart = this.chart, |
73 | var chart = this.chart, |
|
75 | dataClasses, |
74 | dataClasses, |
|
76 | colorCounter = 0, |
75 | colorCounter = 0, |
|
Line 89... | Line 88... | |||
89 | // loop back to zero |
88 | // loop back to zero |
|
90 | if (colorCounter === colors.length) { |
89 | if (colorCounter === colors.length) { |
|
91 | colorCounter = 0; |
90 | colorCounter = 0; |
|
92 | } |
91 | } |
|
93 | } else { |
92 | } else { |
|
94 | dataClass.color = axis.tweenColors(H.color(options.minColor), H.color(options.maxColor), i / (userOptions.dataClasses.length - 1)); |
93 | dataClass.color = H.color(options.minColor).tweenTo( |
|
- | 94 | H.color(options.maxColor), |
||
- | 95 | i / (userOptions.dataClasses.length - 1) |
||
- | 96 | ); |
||
95 | } |
97 | } |
|
96 | } |
98 | } |
|
97 | }); |
99 | }); |
|
98 | }, |
100 | }, |
|
Line 150... | Line 152... | |||
150 | to = stops[i + 1] || from; |
152 | to = stops[i + 1] || from; |
|
Line 151... | Line 153... | |||
151 | |
153 | |
|
152 | // The position within the gradient |
154 | // The position within the gradient |
|
Line 153... | Line 155... | |||
153 | pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1); |
155 | pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1); |
|
154 | |
- | ||
155 | color = this.tweenColors( |
156 | |
|
156 | from.color, |
157 | color = from.color.tweenTo( |
|
157 | to.color, |
158 | to.color, |
|
158 | pos |
159 | pos |
|
159 | ); |
160 | ); |
|
160 | } |
- | ||
161 | return color; |
- | ||
162 | }, |
- | ||
163 | /* |
- | ||
164 | * Return an intermediate color between two colors, according to pos where 0 |
- | ||
165 | * is the from color and 1 is the to color. |
- | ||
166 | */ |
- | ||
167 | tweenColors: function(from, to, pos) { |
- | ||
168 | // Check for has alpha, because rgba colors perform worse due to lack of |
- | ||
169 | // support in WebKit. |
- | ||
170 | var hasAlpha, |
- | ||
171 | ret; |
- | ||
172 | |
- | ||
173 | // Unsupported color, return to-color (#3920) |
- | ||
174 | if (!to.rgba.length || !from.rgba.length) { |
- | ||
175 | ret = to.input || 'none'; |
- | ||
176 | |
- | ||
177 | // Interpolate |
- | ||
178 | } else { |
- | ||
179 | from = from.rgba; |
- | ||
180 | to = to.rgba; |
- | ||
181 | hasAlpha = (to[3] !== 1 || from[3] !== 1); |
- | ||
182 | ret = (hasAlpha ? 'rgba(' : 'rgb(') + |
- | ||
183 | Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' + |
- | ||
184 | Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' + |
- | ||
185 | Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) + |
- | ||
186 | (hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')'; |
- | ||
187 | } |
161 | } |
|
188 | return ret; |
162 | return color; |
|
Line 189... | Line -... | |||
189 | } |
- | ||
190 | }; |
- | ||
191 | |
- | ||
192 | /** |
- | ||
193 | * Handle animation of the color attributes directly |
- | ||
194 | */ |
- | ||
195 | each(['fill', 'stroke'], function(prop) { |
- | ||
196 | H.Fx.prototype[prop + 'Setter'] = function() { |
- | ||
197 | this.elem.attr( |
- | ||
198 | prop, |
- | ||
199 | colorAxisMethods.tweenColors( |
- | ||
200 | H.color(this.start), |
- | ||
201 | H.color(this.end), |
- | ||
202 | this.pos |
- | ||
203 | ), |
- | ||
204 | null, |
- | ||
205 | true |
- | ||
206 | ); |
- | ||
207 | }; |
163 | } |
|
208 | }); |
164 | }; |
|
209 | |
165 | |
|
Line 210... | Line 166... | |||
210 | // The solidgauge series type |
166 | // The solidgauge series type |
|
Line 311... | Line 267... | |||
311 | if (d) { |
267 | if (d) { |
|
312 | shapeArgs.d = d; // animate alters it |
268 | shapeArgs.d = d; // animate alters it |
|
313 | } |
269 | } |
|
314 | } else { |
270 | } else { |
|
315 | point.graphic = renderer.arc(shapeArgs) |
271 | point.graphic = renderer.arc(shapeArgs) |
|
316 | .addClass('highcharts-point') |
272 | .addClass(point.getClassName(), true) |
|
317 | .attr({ |
273 | .attr({ |
|
318 | fill: toColor, |
274 | fill: toColor, |
|
319 | 'sweep-flag': 0 |
275 | 'sweep-flag': 0 |
|
320 | }) |
276 | }) |
|
321 | .add(series.group); |
277 | .add(series.group); |