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 | * |
3 | * |
|
4 | * (c) 2009-2017 Torstein Honsi |
4 | * (c) 2009-2017 Torstein Honsi |
|
5 | * |
5 | * |
|
6 | * License: www.highcharts.com/license |
6 | * License: www.highcharts.com/license |
|
7 | */ |
7 | */ |
|
Line 102... | Line 102... | |||
102 | |
102 | |
|
103 | // Prepare data classes |
103 | // Prepare data classes |
|
104 | if (userOptions.dataClasses) { |
104 | if (userOptions.dataClasses) { |
|
105 | this.initDataClasses(userOptions); |
105 | this.initDataClasses(userOptions); |
|
106 | } |
106 | } |
|
Line 107... | Line 107... | |||
107 | this.initStops(userOptions); |
107 | this.initStops(); |
|
108 | |
108 | |
|
109 | // Override original axis properties |
109 | // Override original axis properties |
|
Line 110... | Line 110... | |||
110 | this.horiz = horiz; |
110 | this.horiz = horiz; |
|
111 | this.zoomEnabled = false; |
111 | this.zoomEnabled = false; |
|
112 | |
112 | |
|
Line 113... | Line -... | |||
113 | // Add default values |
- | ||
114 | this.defaultLegendLength = 200; |
- | ||
115 | }, |
- | ||
116 | |
- | ||
117 | /* |
- | ||
118 | * Return an intermediate color between two colors, according to pos where 0 |
- | ||
119 | * is the from color and 1 is the to color. |
- | ||
120 | * NOTE: Changes here should be copied |
- | ||
121 | * to the same function in drilldown.src.js and solid-gauge-src.js. |
- | ||
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, |
- | ||
127 | ret; |
- | ||
128 | |
- | ||
129 | // Unsupported color, return to-color (#3920) |
- | ||
130 | if (!to.rgba.length || !from.rgba.length) { |
- | ||
131 | ret = to.input || 'none'; |
- | ||
132 | |
- | ||
133 | // Interpolate |
- | ||
134 | } else { |
- | ||
135 | from = from.rgba; |
- | ||
136 | to = to.rgba; |
- | ||
137 | hasAlpha = (to[3] !== 1 || from[3] !== 1); |
- | ||
138 | ret = (hasAlpha ? 'rgba(' : 'rgb(') + |
- | ||
139 | Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' + |
- | ||
140 | Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' + |
- | ||
141 | Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) + |
- | ||
142 | (hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')'; |
- | ||
143 | } |
113 | // Add default values |
|
144 | return ret; |
- | ||
145 | }, |
114 | this.defaultLegendLength = 200; |
|
146 | |
115 | }, |
|
147 | initDataClasses: function(userOptions) { |
116 | |
|
148 | var axis = this, |
117 | initDataClasses: function(userOptions) { |
|
149 | chart = this.chart, |
118 | var chart = this.chart, |
|
150 | dataClasses, |
119 | dataClasses, |
|
Line 169... | Line 138... | |||
169 | colorCounter++; |
138 | colorCounter++; |
|
170 | if (colorCounter === colorCount) { |
139 | if (colorCounter === colorCount) { |
|
171 | colorCounter = 0; |
140 | colorCounter = 0; |
|
172 | } |
141 | } |
|
173 | } else { |
142 | } else { |
|
174 | dataClass.color = axis.tweenColors( |
143 | dataClass.color = color(options.minColor).tweenTo( |
|
175 | color(options.minColor), |
- | ||
176 | color(options.maxColor), |
144 | color(options.maxColor), |
|
177 | len < 2 ? 0.5 : i / (len - 1) // #3219 |
145 | len < 2 ? 0.5 : i / (len - 1) // #3219 |
|
178 | ); |
146 | ); |
|
179 | } |
147 | } |
|
180 | } |
148 | } |
|
181 | }); |
149 | }); |
|
182 | }, |
150 | }, |
|
Line 183... | Line 151... | |||
183 | |
151 | |
|
184 | initStops: function(userOptions) { |
152 | initStops: function() { |
|
185 | this.stops = userOptions.stops || [ |
153 | this.stops = this.options.stops || [ |
|
186 | [0, this.options.minColor], |
154 | [0, this.options.minColor], |
|
187 | [1, this.options.maxColor] |
155 | [1, this.options.maxColor] |
|
188 | ]; |
156 | ]; |
|
189 | each(this.stops, function(stop) { |
157 | each(this.stops, function(stop) { |
|
Line 224... | Line 192... | |||
224 | // Fake length for disabled legend to avoid tick issues and such (#5205) |
192 | // Fake length for disabled legend to avoid tick issues and such (#5205) |
|
225 | this.len = (this.horiz ? legendOptions.symbolWidth : legendOptions.symbolHeight) || this.defaultLegendLength; |
193 | this.len = (this.horiz ? legendOptions.symbolWidth : legendOptions.symbolHeight) || this.defaultLegendLength; |
|
226 | } |
194 | } |
|
227 | }, |
195 | }, |
|
Line -... | Line 196... | |||
- | 196 | |
||
- | 197 | normalizedValue: function(value) { |
||
- | 198 | if (this.isLog) { |
||
- | 199 | value = this.val2lin(value); |
||
- | 200 | } |
||
- | 201 | return 1 - ((this.max - value) / ((this.max - this.min) || 1)); |
||
- | 202 | }, |
||
228 | |
203 | |
|
229 | /** |
204 | /** |
|
230 | * Translate from a value to a color |
205 | * Translate from a value to a color |
|
231 | */ |
206 | */ |
|
232 | toColor: function(value, point) { |
207 | toColor: function(value, point) { |
|
Line 255... | Line 230... | |||
255 | |
230 | } |
|
256 | |
231 | } |
|
Line 257... | Line 232... | |||
257 | |
232 | |
|
Line 258... | Line -... | |||
258 | |
- | ||
259 | |
233 | } else { |
|
260 | |
- | ||
261 | |
- | ||
262 | |
234 | |
|
263 | |
235 | pos = this.normalizedValue(value); |
|
264 | |
236 | i = stops.length; |
|
265 | |
237 | while (i--) { |
|
266 | |
238 | if (pos > stops[i][0]) { |
|
Line 271... | Line 243... | |||
271 | |
243 | to = stops[i + 1] || from; |
|
Line 272... | Line 244... | |||
272 | |
244 | |
|
273 | |
245 | // The position within the gradient |
|
Line 274... | Line 246... | |||
274 | |
246 | pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1); |
|
275 | |
- | ||
276 | |
247 | |
|
277 | |
248 | color = from.color.tweenTo( |
|
278 | |
249 | to.color, |
|
279 | |
250 | pos |
|
280 | |
251 | ); |
|
Line 314... | Line 285... | |||
314 | |
285 | * Create the color gradient |
|
315 | |
286 | */ |
|
316 | |
287 | setLegendColor: function() { |
|
317 | |
288 | var grad, |
|
318 | |
289 | horiz = this.horiz, |
|
319 | |
- | ||
320 | |
290 | reversed = this.reversed, |
|
321 | |
291 | one = reversed ? 1 : 0, |
|
322 | |
292 | zero = reversed ? 0 : 1; |
|
Line 323... | Line 293... | |||
323 | |
293 | |
|
Line 327... | Line 297... | |||
327 | |
297 | x1: grad[0], |
|
328 | |
298 | y1: grad[1], |
|
329 | |
299 | x2: grad[2], |
|
330 | |
300 | y2: grad[3] |
|
331 | |
301 | }, |
|
332 | |
302 | stops: this.stops |
|
333 | |
- | ||
334 | |
- | ||
335 | |
- | ||
336 | |
303 | }; |
|
337 | |
304 | }, |
|
Line 338... | Line 305... | |||
338 | |
305 | |
|
339 | |
306 | /** |
|
Line 428... | Line 395... | |||
428 | |
395 | < axisPos) { });> |
|
Line 429... | Line 396... | |||
429 | |
396 | < axisPos) {> |
|
430 | |
397 | < axisPos) { // When updating data classes, destroy old items and make sure new ones are created (#3207)> |
|
431 | |
398 | < axisPos) { if (newOptions.dataClasses && legend.allItems) {> |
|
432 | |
399 | < axisPos) { each(legend.allItems, function(item) {> |
|
433 | |
400 | < axisPos) { if (item.isDataClass && item.legendGroup) {> |
|
434 | |
401 | < axisPos) { item.legendGroup.destroy();> |
|
435 | |
402 | < axisPos) { }> |
|
436 | |
403 | < axisPos) { });> |
|
437 | |
404 | < axisPos) { chart.isDirtyLegend = true;> |
|
Line 447... | Line 414... | |||
447 | |
414 | < axisPos) { legend.colorizeItem(this, true);> |
|
448 | |
415 | < axisPos) { }> |
|
449 | |
416 | < axisPos) { },> |
|
Line 450... | Line 417... | |||
450 | |
417 | < axisPos) {> |
|
- | 418 | < axisPos) { /**> |
||
- | 419 | < axisPos) { * Extend basic axis remove by also removing the legend item.> |
||
- | 420 | < axisPos) { */> |
||
- | 421 | < axisPos) { remove: function() {> |
||
- | 422 | < axisPos) { if (this.legendItem) {> |
||
- | 423 | < axisPos) { this.chart.legend.destroyItem(this);> |
||
- | 424 | < axisPos) { }> |
||
- | 425 | < axisPos) { Axis.prototype.remove.call(this);> |
||
- | 426 | < axisPos) { },> |
||
- | 427 | < axisPos) {> |
||
451 | |
428 | < axisPos) { /**> |
|
452 | |
429 | < axisPos) { * Get the legend item symbols for data classes> |
|
453 | |
430 | < axisPos) { */> |
|
454 | |
431 | < axisPos) { getDataClassLegendSymbols: function() {> |
|
455 | |
432 | < axisPos) { var axis = this,> |
|
Line 516... | Line 493... | |||
516 | |
493 | < axisPos) {< '; */>> |
|
517 | |
494 | < axisPos) {< '; each(['fill', 'stroke'], function(prop) {>> |
|
518 | |
495 | < axisPos) {< '; H.Fx.prototype[prop + 'Setter'] = function() {>> |
|
519 | |
496 | < axisPos) {< '; this.elem.attr(>> |
|
520 | |
497 | < axisPos) {< '; prop,>> |
|
521 | |
- | ||
522 | |
498 | < axisPos) {< '; color(this.start).tweenTo(>> |
|
523 | |
499 | < axisPos) {< '; color(this.end),>> |
|
524 | |
500 | < axisPos) {< '; this.pos>> |
|
525 | |
501 | < axisPos) {< '; ),>> |
|
526 | |
502 | < axisPos) {< '; null,>> |
|
527 | |
503 | < axisPos) {< '; true>> |