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 104... | Line 104... | |||
104 | |
104 | |
|
105 | // Prepare data classes |
105 | // Prepare data classes |
|
106 | if (userOptions.dataClasses) { |
106 | if (userOptions.dataClasses) { |
|
107 | this.initDataClasses(userOptions); |
107 | this.initDataClasses(userOptions); |
|
108 | } |
108 | } |
|
Line 109... | Line 109... | |||
109 | this.initStops(userOptions); |
109 | this.initStops(); |
|
110 | |
110 | |
|
111 | // Override original axis properties |
111 | // Override original axis properties |
|
Line 112... | Line 112... | |||
112 | this.horiz = horiz; |
112 | this.horiz = horiz; |
|
113 | this.zoomEnabled = false; |
113 | this.zoomEnabled = false; |
|
114 | |
114 | |
|
Line 115... | Line -... | |||
115 | // Add default values |
- | ||
116 | this.defaultLegendLength = 200; |
- | ||
117 | }, |
- | ||
118 | |
- | ||
119 | /* |
- | ||
120 | * Return an intermediate color between two colors, according to pos where 0 |
- | ||
121 | * is the from color and 1 is the to color. |
- | ||
122 | * NOTE: Changes here should be copied |
- | ||
123 | * to the same function in drilldown.src.js and solid-gauge-src.js. |
- | ||
124 | */ |
- | ||
125 | tweenColors: function(from, to, pos) { |
- | ||
126 | // Check for has alpha, because rgba colors perform worse due to lack of |
- | ||
127 | // support in WebKit. |
- | ||
128 | var hasAlpha, |
- | ||
129 | ret; |
- | ||
130 | |
- | ||
131 | // Unsupported color, return to-color (#3920) |
- | ||
132 | if (!to.rgba.length || !from.rgba.length) { |
- | ||
133 | ret = to.input || 'none'; |
- | ||
134 | |
- | ||
135 | // Interpolate |
- | ||
136 | } else { |
- | ||
137 | from = from.rgba; |
- | ||
138 | to = to.rgba; |
- | ||
139 | hasAlpha = (to[3] !== 1 || from[3] !== 1); |
- | ||
140 | ret = (hasAlpha ? 'rgba(' : 'rgb(') + |
- | ||
141 | Math.round(to[0] + (from[0] - to[0]) * (1 - pos)) + ',' + |
- | ||
142 | Math.round(to[1] + (from[1] - to[1]) * (1 - pos)) + ',' + |
- | ||
143 | Math.round(to[2] + (from[2] - to[2]) * (1 - pos)) + |
- | ||
144 | (hasAlpha ? (',' + (to[3] + (from[3] - to[3]) * (1 - pos))) : '') + ')'; |
- | ||
145 | } |
115 | // Add default values |
|
146 | return ret; |
- | ||
147 | }, |
116 | this.defaultLegendLength = 200; |
|
148 | |
117 | }, |
|
149 | initDataClasses: function(userOptions) { |
118 | |
|
150 | var axis = this, |
119 | initDataClasses: function(userOptions) { |
|
151 | chart = this.chart, |
120 | var chart = this.chart, |
|
152 | dataClasses, |
121 | dataClasses, |
|
Line 175... | Line 144... | |||
175 | colorCounter++; |
144 | colorCounter++; |
|
176 | if (colorCounter === colorCount) { |
145 | if (colorCounter === colorCount) { |
|
177 | colorCounter = 0; |
146 | colorCounter = 0; |
|
178 | } |
147 | } |
|
179 | } else { |
148 | } else { |
|
180 | dataClass.color = axis.tweenColors( |
149 | dataClass.color = color(options.minColor).tweenTo( |
|
181 | color(options.minColor), |
- | ||
182 | color(options.maxColor), |
150 | color(options.maxColor), |
|
183 | len < 2 ? 0.5 : i / (len - 1) // #3219 |
151 | len < 2 ? 0.5 : i / (len - 1) // #3219 |
|
184 | ); |
152 | ); |
|
185 | } |
153 | } |
|
186 | } |
154 | } |
|
187 | }); |
155 | }); |
|
188 | }, |
156 | }, |
|
Line 189... | Line 157... | |||
189 | |
157 | |
|
190 | initStops: function(userOptions) { |
158 | initStops: function() { |
|
191 | this.stops = userOptions.stops || [ |
159 | this.stops = this.options.stops || [ |
|
192 | [0, this.options.minColor], |
160 | [0, this.options.minColor], |
|
193 | [1, this.options.maxColor] |
161 | [1, this.options.maxColor] |
|
194 | ]; |
162 | ]; |
|
195 | each(this.stops, function(stop) { |
163 | each(this.stops, function(stop) { |
|
Line 230... | Line 198... | |||
230 | // Fake length for disabled legend to avoid tick issues and such (#5205) |
198 | // Fake length for disabled legend to avoid tick issues and such (#5205) |
|
231 | this.len = (this.horiz ? legendOptions.symbolWidth : legendOptions.symbolHeight) || this.defaultLegendLength; |
199 | this.len = (this.horiz ? legendOptions.symbolWidth : legendOptions.symbolHeight) || this.defaultLegendLength; |
|
232 | } |
200 | } |
|
233 | }, |
201 | }, |
|
Line -... | Line 202... | |||
- | 202 | |
||
- | 203 | normalizedValue: function(value) { |
||
- | 204 | if (this.isLog) { |
||
- | 205 | value = this.val2lin(value); |
||
- | 206 | } |
||
- | 207 | return 1 - ((this.max - value) / ((this.max - this.min) || 1)); |
||
- | 208 | }, |
||
234 | |
209 | |
|
235 | /** |
210 | /** |
|
236 | * Translate from a value to a color |
211 | * Translate from a value to a color |
|
237 | */ |
212 | */ |
|
238 | toColor: function(value, point) { |
213 | toColor: function(value, point) { |
|
Line 261... | Line 236... | |||
261 | |
236 | } |
|
262 | |
237 | } |
|
Line 263... | Line 238... | |||
263 | |
238 | |
|
Line 264... | Line -... | |||
264 | |
- | ||
265 | |
239 | } else { |
|
266 | |
- | ||
267 | |
- | ||
268 | |
240 | |
|
269 | |
241 | pos = this.normalizedValue(value); |
|
270 | |
242 | i = stops.length; |
|
271 | |
243 | while (i--) { |
|
272 | |
244 | if (pos > stops[i][0]) { |
|
Line 277... | Line 249... | |||
277 | |
249 | to = stops[i + 1] || from; |
|
Line 278... | Line 250... | |||
278 | |
250 | |
|
279 | |
251 | // The position within the gradient |
|
Line 280... | Line 252... | |||
280 | |
252 | pos = 1 - (to[0] - pos) / ((to[0] - from[0]) || 1); |
|
281 | |
- | ||
282 | |
253 | |
|
283 | |
254 | color = from.color.tweenTo( |
|
284 | |
255 | to.color, |
|
285 | |
256 | pos |
|
286 | |
257 | ); |
|
Line 320... | Line 291... | |||
320 | |
291 | * Create the color gradient |
|
321 | |
292 | */ |
|
322 | |
293 | setLegendColor: function() { |
|
323 | |
294 | var grad, |
|
324 | |
295 | horiz = this.horiz, |
|
325 | |
- | ||
326 | |
296 | reversed = this.reversed, |
|
327 | |
297 | one = reversed ? 1 : 0, |
|
328 | |
298 | zero = reversed ? 0 : 1; |
|
Line 329... | Line 299... | |||
329 | |
299 | |
|
Line 333... | Line 303... | |||
333 | |
303 | x1: grad[0], |
|
334 | |
304 | y1: grad[1], |
|
335 | |
305 | x2: grad[2], |
|
336 | |
306 | y2: grad[3] |
|
337 | |
307 | }, |
|
338 | |
308 | stops: this.stops |
|
339 | |
- | ||
340 | |
- | ||
341 | |
- | ||
342 | |
309 | }; |
|
343 | |
310 | }, |
|
Line 344... | Line 311... | |||
344 | |
311 | |
|
345 | |
312 | /** |
|
Line 438... | Line 405... | |||
438 | |
405 | < axisPos) { });> |
|
Line 439... | Line 406... | |||
439 | |
406 | < axisPos) {> |
|
440 | |
407 | < axisPos) { // When updating data classes, destroy old items and make sure new ones are created (#3207)> |
|
441 | |
408 | < axisPos) { if (newOptions.dataClasses && legend.allItems) {> |
|
442 | |
409 | < axisPos) { each(legend.allItems, function(item) {> |
|
443 | |
410 | < axisPos) { if (item.isDataClass && item.legendGroup) {> |
|
444 | |
411 | < axisPos) { item.legendGroup.destroy();> |
|
445 | |
412 | < axisPos) { }> |
|
446 | |
413 | < axisPos) { });> |
|
447 | |
414 | < axisPos) { chart.isDirtyLegend = true;> |
|
Line 457... | Line 424... | |||
457 | |
424 | < axisPos) { legend.colorizeItem(this, true);> |
|
458 | |
425 | < axisPos) { }> |
|
459 | |
426 | < axisPos) { },> |
|
Line 460... | Line 427... | |||
460 | |
427 | < axisPos) {> |
|
- | 428 | < axisPos) { /**> |
||
- | 429 | < axisPos) { * Extend basic axis remove by also removing the legend item.> |
||
- | 430 | < axisPos) { */> |
||
- | 431 | < axisPos) { remove: function() {> |
||
- | 432 | < axisPos) { if (this.legendItem) {> |
||
- | 433 | < axisPos) { this.chart.legend.destroyItem(this);> |
||
- | 434 | < axisPos) { }> |
||
- | 435 | < axisPos) { Axis.prototype.remove.call(this);> |
||
- | 436 | < axisPos) { },> |
||
- | 437 | < axisPos) {> |
||
461 | |
438 | < axisPos) { /**> |
|
462 | |
439 | < axisPos) { * Get the legend item symbols for data classes> |
|
463 | |
440 | < axisPos) { */> |
|
464 | |
441 | < axisPos) { getDataClassLegendSymbols: function() {> |
|
465 | |
442 | < axisPos) { var axis = this,> |
|
Line 526... | Line 503... | |||
526 | |
503 | < axisPos) {< '; */>> |
|
527 | |
504 | < axisPos) {< '; each(['fill', 'stroke'], function(prop) {>> |
|
528 | |
505 | < axisPos) {< '; H.Fx.prototype[prop + 'Setter'] = function() {>> |
|
529 | |
506 | < axisPos) {< '; this.elem.attr(>> |
|
530 | |
507 | < axisPos) {< '; prop,>> |
|
531 | |
- | ||
532 | |
508 | < axisPos) {< '; color(this.start).tweenTo(>> |
|
533 | |
509 | < axisPos) {< '; color(this.end),>> |
|
534 | |
510 | < axisPos) {< '; this.pos>> |
|
535 | |
511 | < axisPos) {< '; ),>> |
|
536 | |
512 | < axisPos) {< '; null,>> |
|
537 | |
513 | < axisPos) {< '; true>> |