corrade-nucleus-nucleons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /**
2 * @license Highcharts JS v5.0.10 (2017-03-31)
3 *
4 * (c) 2014 Highsoft AS
5 * Authors: Jon Arild Nygard / Oystein Moseng
6 *
7 * License: www.highcharts.com/license
8 */
9 'use strict';
10 (function(factory) {
11 if (typeof module === 'object' && module.exports) {
12 module.exports = factory;
13 } else {
14 factory(Highcharts);
15 }
16 }(function(Highcharts) {
17 (function(H) {
18 /**
19 * (c) 2014 Highsoft AS
20 * Authors: Jon Arild Nygard / Oystein Moseng
21 *
22 * License: www.highcharts.com/license
23 */
24  
25 var seriesType = H.seriesType,
26 seriesTypes = H.seriesTypes,
27 map = H.map,
28 merge = H.merge,
29 extend = H.extend,
30 noop = H.noop,
31 each = H.each,
32 grep = H.grep,
33 isNumber = H.isNumber,
34 isString = H.isString,
35 pick = H.pick,
36 Series = H.Series,
37 stableSort = H.stableSort,
38 color = H.Color,
39 eachObject = function(list, func, context) {
40 var key;
41 context = context || this;
42 for (key in list) {
43 if (list.hasOwnProperty(key)) {
44 func.call(context, list[key], key, list);
45 }
46 }
47 },
48 reduce = function(arr, func, previous, context) {
49 context = context || this;
50 arr = arr || []; // @note should each be able to handle empty values automatically?
51 each(arr, function(current, i) {
52 previous = func.call(context, previous, current, i, arr);
53 });
54 return previous;
55 },
56 // @todo find correct name for this function.
57 // @todo Similar to reduce, this function is likely redundant
58 recursive = function(item, func, context) {
59 var next;
60 context = context || this;
61 next = func.call(context, item);
62 if (next !== false) {
63 recursive(next, func, context);
64 }
65 };
66  
67 // The Treemap series type
68 seriesType('treemap', 'scatter', {
69 showInLegend: false,
70 marker: false,
71 dataLabels: {
72 enabled: true,
73 defer: false,
74 verticalAlign: 'middle',
75 formatter: function() { // #2945
76 return this.point.name || this.point.id;
77 },
78 inside: true
79 },
80 tooltip: {
81 headerFormat: '',
82 pointFormat: '<b>{point.name}</b>: {point.value}</b><br/>'
83 },
84 ignoreHiddenPoint: true,
85 layoutAlgorithm: 'sliceAndDice',
86 layoutStartingDirection: 'vertical',
87 alternateStartingDirection: false,
88 levelIsConstant: true,
89 drillUpButton: {
90 position: {
91 align: 'right',
92 x: -10,
93 y: 10
94 }
95 },
96  
97 // Presentational options
98 borderColor: '#e6e6e6',
99 borderWidth: 1,
100 opacity: 0.15,
101 states: {
102 hover: {
103 borderColor: '#999999',
104 brightness: seriesTypes.heatmap ? 0 : 0.1,
105 opacity: 0.75,
106 shadow: false
107 }
108 }
109  
110  
111 // Prototype members
112 }, {
113 pointArrayMap: ['value'],
114 axisTypes: seriesTypes.heatmap ? ['xAxis', 'yAxis', 'colorAxis'] : ['xAxis', 'yAxis'],
115 optionalAxis: 'colorAxis',
116 getSymbol: noop,
117 parallelArrays: ['x', 'y', 'value', 'colorValue'],
118 colorKey: 'colorValue', // Point color option key
119 translateColors: seriesTypes.heatmap && seriesTypes.heatmap.prototype.translateColors,
120 trackerGroups: ['group', 'dataLabelsGroup'],
121 /**
122 * Creates an object map from parent id to childrens index.
123 * @param {Array} data List of points set in options.
124 * @param {string} data[].parent Parent id of point.
125 * @param {Array} ids List of all point ids.
126 * @return {Object} Map from parent id to children index in data.
127 */
128 getListOfParents: function(data, ids) {
129 var listOfParents = reduce(data, function(prev, curr, i) {
130 var parent = pick(curr.parent, '');
131 if (prev[parent] === undefined) {
132 prev[parent] = [];
133 }
134 prev[parent].push(i);
135 return prev;
136 }, {});
137  
138 // If parent does not exist, hoist parent to root of tree.
139 eachObject(listOfParents, function(children, parent, list) {
140 if ((parent !== '') && (H.inArray(parent, ids) === -1)) {
141 each(children, function(child) {
142 list[''].push(child);
143 });
144 delete list[parent];
145 }
146 });
147 return listOfParents;
148 },
149 /**
150 * Creates a tree structured object from the series points
151 */
152 getTree: function() {
153 var series = this,
154 allIds = map(this.data, function(d) {
155 return d.id;
156 }),
157 parentList = series.getListOfParents(this.data, allIds);
158  
159 series.nodeMap = [];
160 return series.buildNode('', -1, 0, parentList, null);
161 },
162 init: function(chart, options) {
163 var series = this;
164 Series.prototype.init.call(series, chart, options);
165 if (series.options.allowDrillToNode) {
166 H.addEvent(series, 'click', series.onClickDrillToNode);
167 }
168 },
169 buildNode: function(id, i, level, list, parent) {
170 var series = this,
171 children = [],
172 point = series.points[i],
173 node,
174 child;
175  
176 // Actions
177 each((list[id] || []), function(i) {
178 child = series.buildNode(series.points[i].id, i, (level + 1), list, id);
179 children.push(child);
180 });
181 node = {
182 id: id,
183 i: i,
184 children: children,
185 level: level,
186 parent: parent,
187 visible: false // @todo move this to better location
188 };
189 series.nodeMap[node.id] = node;
190 if (point) {
191 point.node = node;
192 }
193 return node;
194 },
195 setTreeValues: function(tree) {
196 var series = this,
197 options = series.options,
198 childrenTotal = 0,
199 children = [],
200 val,
201 point = series.points[tree.i];
202 // Parents of the root node is by default visible
203 recursive(series.nodeMap[series.rootNode], function(node) {
204 var next = false,
205 p = node.parent;
206 node.visible = true;
207 if (p || p === '') {
208 next = series.nodeMap[p];
209 }
210 return next;
211 });
212 // Children of the root node is by default visible
213 recursive(series.nodeMap[series.rootNode].children, function(children) {
214 var next = false;
215 each(children, function(child) {
216 child.visible = true;
217 if (child.children.length) {
218 next = (next || []).concat(child.children);
219 }
220 });
221 return next;
222 });
223  
224 // First give the children some values
225 each(tree.children, function(child) {
226 child = series.setTreeValues(child);
227 children.push(child);
228  
229 if (!child.ignore) {
230 childrenTotal += child.val;
231 } else {
232 // @todo Add predicate to avoid looping already ignored children
233 recursive(child.children, function(children) {
234 var next = false;
235 each(children, function(node) {
236 extend(node, {
237 ignore: true,
238 isLeaf: false,
239 visible: false
240 });
241 if (node.children.length) {
242 next = (next || []).concat(node.children);
243 }
244 });
245 return next;
246 });
247 }
248 });
249 // Sort the children
250 stableSort(children, function(a, b) {
251 return a.sortIndex - b.sortIndex;
252 });
253 // Set the values
254 val = pick(point && point.options.value, childrenTotal);
255 if (point) {
256 point.value = val;
257 }
258 extend(tree, {
259 children: children,
260 childrenTotal: childrenTotal,
261 // Ignore this node if point is not visible
262 ignore: !(pick(point && point.visible, true) && (val > 0)),
263 isLeaf: tree.visible && !childrenTotal,
264 levelDynamic: (options.levelIsConstant ? tree.level : (tree.level - series.nodeMap[series.rootNode].level)),
265 name: pick(point && point.name, ''),
266 sortIndex: pick(point && point.sortIndex, -val),
267 val: val
268 });
269 return tree;
270 },
271 /**
272 * Recursive function which calculates the area for all children of a node.
273 * @param {Object} node The node which is parent to the children.
274 * @param {Object} area The rectangular area of the parent.
275 */
276 calculateChildrenAreas: function(parent, area) {
277 var series = this,
278 options = series.options,
279 level = this.levelMap[parent.levelDynamic + 1],
280 algorithm = pick((series[level && level.layoutAlgorithm] && level.layoutAlgorithm), options.layoutAlgorithm),
281 alternate = options.alternateStartingDirection,
282 childrenValues = [],
283 children;
284  
285 // Collect all children which should be included
286 children = grep(parent.children, function(n) {
287 return !n.ignore;
288 });
289  
290 if (level && level.layoutStartingDirection) {
291 area.direction = level.layoutStartingDirection === 'vertical' ? 0 : 1;
292 }
293 childrenValues = series[algorithm](area, children);
294 each(children, function(child, index) {
295 var values = childrenValues[index];
296 child.values = merge(values, {
297 val: child.childrenTotal,
298 direction: (alternate ? 1 - area.direction : area.direction)
299 });
300 child.pointValues = merge(values, {
301 x: (values.x / series.axisRatio),
302 width: (values.width / series.axisRatio)
303 });
304 // If node has children, then call method recursively
305 if (child.children.length) {
306 series.calculateChildrenAreas(child, child.values);
307 }
308 });
309 },
310 setPointValues: function() {
311 var series = this,
312 xAxis = series.xAxis,
313 yAxis = series.yAxis;
314 each(series.points, function(point) {
315 var node = point.node,
316 values = node.pointValues,
317 x1,
318 x2,
319 y1,
320 y2,
321 crispCorr = 0;
322  
323  
324 // Get the crisp correction in classic mode. For this to work in
325 // styled mode, we would need to first add the shape (without x, y,
326 // width and height), then read the rendered stroke width using
327 // point.graphic.strokeWidth(), then modify and apply the shapeArgs.
328 // This applies also to column series, but the downside is
329 // performance and code complexity.
330 crispCorr = (
331 (series.pointAttribs(point)['stroke-width'] || 0) % 2
332 ) / 2;
333  
334  
335 // Points which is ignored, have no values.
336 if (values && node.visible) {
337 x1 = Math.round(xAxis.translate(values.x, 0, 0, 0, 1)) - crispCorr;
338 x2 = Math.round(xAxis.translate(values.x + values.width, 0, 0, 0, 1)) - crispCorr;
339 y1 = Math.round(yAxis.translate(values.y, 0, 0, 0, 1)) - crispCorr;
340 y2 = Math.round(yAxis.translate(values.y + values.height, 0, 0, 0, 1)) - crispCorr;
341 // Set point values
342 point.shapeType = 'rect';
343 point.shapeArgs = {
344 x: Math.min(x1, x2),
345 y: Math.min(y1, y2),
346 width: Math.abs(x2 - x1),
347 height: Math.abs(y2 - y1)
348 };
349 point.plotX = point.shapeArgs.x + (point.shapeArgs.width / 2);
350 point.plotY = point.shapeArgs.y + (point.shapeArgs.height / 2);
351 } else {
352 // Reset visibility
353 delete point.plotX;
354 delete point.plotY;
355 }
356 });
357 },
358 setColorRecursive: function(node, color, colorIndex) {
359 var series = this,
360 point,
361 level;
362 if (node) {
363 point = series.points[node.i];
364 level = series.levelMap[node.levelDynamic];
365 // Select either point color, level color or inherited color.
366 color = pick(
367 point && point.options.color,
368 level && level.color,
369 color,
370 series.color
371 );
372 colorIndex = pick(
373 point && point.options.colorIndex,
374 level && level.colorIndex,
375 colorIndex,
376 series.colorIndex
377 );
378  
379 if (point) {
380 point.color = color;
381 point.colorIndex = colorIndex;
382 }
383  
384 // Do it all again with the children
385 if (node.children.length) {
386 each(node.children, function(child) {
387 series.setColorRecursive(child, color, colorIndex);
388 });
389 }
390 }
391 },
392 algorithmGroup: function(h, w, d, p) {
393 this.height = h;
394 this.width = w;
395 this.plot = p;
396 this.direction = d;
397 this.startDirection = d;
398 this.total = 0;
399 this.nW = 0;
400 this.lW = 0;
401 this.nH = 0;
402 this.lH = 0;
403 this.elArr = [];
404 this.lP = {
405 total: 0,
406 lH: 0,
407 nH: 0,
408 lW: 0,
409 nW: 0,
410 nR: 0,
411 lR: 0,
412 aspectRatio: function(w, h) {
413 return Math.max((w / h), (h / w));
414 }
415 };
416 this.addElement = function(el) {
417 this.lP.total = this.elArr[this.elArr.length - 1];
418 this.total = this.total + el;
419 if (this.direction === 0) {
420 // Calculate last point old aspect ratio
421 this.lW = this.nW;
422 this.lP.lH = this.lP.total / this.lW;
423 this.lP.lR = this.lP.aspectRatio(this.lW, this.lP.lH);
424 // Calculate last point new aspect ratio
425 this.nW = this.total / this.height;
426 this.lP.nH = this.lP.total / this.nW;
427 this.lP.nR = this.lP.aspectRatio(this.nW, this.lP.nH);
428 } else {
429 // Calculate last point old aspect ratio
430 this.lH = this.nH;
431 this.lP.lW = this.lP.total / this.lH;
432 this.lP.lR = this.lP.aspectRatio(this.lP.lW, this.lH);
433 // Calculate last point new aspect ratio
434 this.nH = this.total / this.width;
435 this.lP.nW = this.lP.total / this.nH;
436 this.lP.nR = this.lP.aspectRatio(this.lP.nW, this.nH);
437 }
438 this.elArr.push(el);
439 };
440 this.reset = function() {
441 this.nW = 0;
442 this.lW = 0;
443 this.elArr = [];
444 this.total = 0;
445 };
446 },
447 algorithmCalcPoints: function(directionChange, last, group, childrenArea) {
448 var pX,
449 pY,
450 pW,
451 pH,
452 gW = group.lW,
453 gH = group.lH,
454 plot = group.plot,
455 keep,
456 i = 0,
457 end = group.elArr.length - 1;
458 if (last) {
459 gW = group.nW;
460 gH = group.nH;
461 } else {
462 keep = group.elArr[group.elArr.length - 1];
463 }
464 each(group.elArr, function(p) {
465 if (last || (i < end)) {
466 < end)) { if (group.direction === 0) {
467 < end)) { pX = plot.x;
468 < end)) { pY = plot.y;
469 < end)) { pW = gW;
470 < end)) { pH = p / pW;
471 < end)) { } else {
472 < end)) { pX = plot.x;
473 < end)) { pY = plot.y;
474 < end)) { pH = gH;
475 < end)) { pW = p / pH;
476 < end)) { }
477 < end)) { childrenArea.push({
478 < end)) { x: pX,
479 < end)) { y: pY,
480 < end)) { width: pW,
481 < end)) { height: pH
482 < end)) { });
483 < end)) { if (group.direction === 0) {
484 < end)) { plot.y = plot.y + pH;
485 < end)) { } else {
486 < end)) { plot.x = plot.x + pW;
487 < end)) { }
488 < end)) { }
489 < end)) { i = i + 1;
490 < end)) { });
491 < end)) { // Reset variables
492 < end)) { group.reset();
493 < end)) { if (group.direction === 0) {
494 < end)) { group.width = group.width - gW;
495 < end)) { } else {
496 < end)) { group.height = group.height - gH;
497 < end)) { }
498 < end)) { plot.y = plot.parent.y + (plot.parent.height - group.height);
499 < end)) { plot.x = plot.parent.x + (plot.parent.width - group.width);
500 < end)) { if (directionChange) {
501 < end)) { group.direction = 1 - group.direction;
502 < end)) { }
503 < end)) { // If not last, then add uncalculated element
504 < end)) { if (!last) {
505 < end)) { group.addElement(keep);
506 < end)) { }
507 < end)) { },
508 < end)) { algorithmLowAspectRatio: function(directionChange, parent, children) {
509 < end)) { var childrenArea = [],
510 < end)) { series = this,
511 < end)) { pTot,
512 < end)) { plot = {
513 < end)) { x: parent.x,
514 < end)) { y: parent.y,
515 < end)) { parent: parent
516 < end)) { },
517 < end)) { direction = parent.direction,
518 < end)) { i = 0,
519 < end)) { end = children.length - 1,
520 < end)) { group = new this.algorithmGroup(parent.height, parent.width, direction, plot); // eslint-disable-line new-cap
521 < end)) { // Loop through and calculate all areas
522 < end)) { each(children, function(child) {
523 < end)) { pTot = (parent.width * parent.height) * (child.val / parent.val);
524 < end)) { group.addElement(pTot);
525 < end)) { if (group.lP.nR > group.lP.lR) {
526 < end)) { series.algorithmCalcPoints(directionChange, false, group, childrenArea, plot);
527 < end)) { }
528 < end)) { // If last child, then calculate all remaining areas
529 < end)) { if (i === end) {
530 < end)) { series.algorithmCalcPoints(directionChange, true, group, childrenArea, plot);
531 < end)) { }
532 < end)) { i = i + 1;
533 < end)) { });
534 < end)) { return childrenArea;
535 < end)) { },
536 < end)) { algorithmFill: function(directionChange, parent, children) {
537 < end)) { var childrenArea = [],
538 < end)) { pTot,
539 < end)) { direction = parent.direction,
540 < end)) { x = parent.x,
541 < end)) { y = parent.y,
542 < end)) { width = parent.width,
543 < end)) { height = parent.height,
544 < end)) { pX,
545 < end)) { pY,
546 < end)) { pW,
547 < end)) { pH;
548 < end)) { each(children, function(child) {
549 < end)) { pTot = (parent.width * parent.height) * (child.val / parent.val);
550 < end)) { pX = x;
551 < end)) { pY = y;
552 < end)) { if (direction === 0) {
553 < end)) { pH = height;
554 < end)) { pW = pTot / pH;
555 < end)) { width = width - pW;
556 < end)) { x = x + pW;
557 < end)) { } else {
558 < end)) { pW = width;
559 < end)) { pH = pTot / pW;
560 < end)) { height = height - pH;
561 < end)) { y = y + pH;
562 < end)) { }
563 < end)) { childrenArea.push({
564 < end)) { x: pX,
565 < end)) { y: pY,
566 < end)) { width: pW,
567 < end)) { height: pH
568 < end)) { });
569 < end)) { if (directionChange) {
570 < end)) { direction = 1 - direction;
571 < end)) { }
572 < end)) { });
573 < end)) { return childrenArea;
574 < end)) { },
575 < end)) { strip: function(parent, children) {
576 < end)) { return this.algorithmLowAspectRatio(false, parent, children);
577 < end)) { },
578 < end)) { squarified: function(parent, children) {
579 < end)) { return this.algorithmLowAspectRatio(true, parent, children);
580 < end)) { },
581 < end)) { sliceAndDice: function(parent, children) {
582 < end)) { return this.algorithmFill(true, parent, children);
583 < end)) { },
584 < end)) { stripes: function(parent, children) {
585 < end)) { return this.algorithmFill(false, parent, children);
586 < end)) { },
587 < end)) { translate: function() {
588 < end)) { var series = this,
589 < end)) { rootId = series.rootNode = pick(series.rootNode, series.options.rootId, ''),
590 < end)) { rootNode,
591 < end)) { pointValues,
592 < end)) { seriesArea,
593 < end)) { tree,
594 < end)) { val;
595  
596 < end)) { // Call prototype function
597 < end)) { Series.prototype.translate.call(series);
598 < end)) { // Create a object map from level to options
599 < end)) { series.levelMap = reduce(series.options.levels, function(arr, item) {
600 < end)) { arr[item.level] = item;
601 < end)) { return arr;
602 < end)) { }, {});
603 < end)) { tree = series.tree = series.getTree(); // @todo Only if series.isDirtyData is true
604 < end)) { rootNode = series.nodeMap[rootId];
605 < end)) { if (
606 < end)) { rootId !== '' &&
607 < end)) { (!rootNode || !rootNode.children.length)
608 < end)) { ) {
609 < end)) { series.drillToNode('', false);
610 < end)) { rootId = series.rootNode;
611 < end)) { rootNode = series.nodeMap[rootId];
612 < end)) { }
613 < end)) { series.setTreeValues(tree);
614  
615 < end)) { // Calculate plotting values.
616 < end)) { series.axisRatio = (series.xAxis.len / series.yAxis.len);
617 < end)) { series.nodeMap[''].pointValues = pointValues = {
618 < end)) { x: 0,
619 < end)) { y: 0,
620 < end)) { width: 100,
621 < end)) { height: 100
622 < end)) { };
623 < end)) { series.nodeMap[''].values = seriesArea = merge(pointValues, {
624 < end)) { width: (pointValues.width * series.axisRatio),
625 < end)) { direction: (series.options.layoutStartingDirection === 'vertical' ? 0 : 1),
626 < end)) { val: tree.val
627 < end)) { });
628 < end)) { series.calculateChildrenAreas(tree, seriesArea);
629  
630 < end)) { // Logic for point colors
631 < end)) { if (series.colorAxis) {
632 < end)) { series.translateColors();
633 < end)) { } else if (!series.options.colorByPoint) {
634 < end)) { series.setColorRecursive(series.tree);
635 < end)) { }
636  
637 < end)) { // Update axis extremes according to the root node.
638 < end)) { if (series.options.allowDrillToNode) {
639 < end)) { val = rootNode.pointValues;
640 < end)) { series.xAxis.setExtremes(val.x, val.x + val.width, false);
641 < end)) { series.yAxis.setExtremes(val.y, val.y + val.height, false);
642 < end)) { series.xAxis.setScale();
643 < end)) { series.yAxis.setScale();
644 < end)) { }
645  
646 < end)) { // Assign values to points.
647 < end)) { series.setPointValues();
648 < end)) { },
649 < end)) { /**
650 < end)) { * Extend drawDataLabels with logic to handle custom options related to the treemap series:
651 < end)) { * - Points which is not a leaf node, has dataLabels disabled by default.
652 < end)) { * - Options set on series.levels is merged in.
653 < end)) { * - Width of the dataLabel is set to match the width of the point shape.
654 < end)) { */
655 < end)) { drawDataLabels: function() {
656 < end)) { var series = this,
657 < end)) { points = grep(series.points, function(n) {
658 < end)) { return n.node.visible;
659 < end)) { }),
660 < end)) { options,
661 < end)) { level;
662 < end)) { each(points, function(point) {
663 < end)) { level = series.levelMap[point.node.levelDynamic];
664 < end)) { // Set options to new object to avoid problems with scope
665 < end)) { options = {
666 < end)) { style: {}
667 < end)) { };
668  
669 < end)) { // If not a leaf, then label should be disabled as default
670 < end)) { if (!point.node.isLeaf) {
671 < end)) { options.enabled = false;
672 < end)) { }
673  
674 < end)) { // If options for level exists, include them as well
675 < end)) { if (level && level.dataLabels) {
676 < end)) { options = merge(options, level.dataLabels);
677 < end)) { series._hasPointLabels = true;
678 < end)) { }
679  
680 < end)) { // Set dataLabel width to the width of the point shape.
681 < end)) { if (point.shapeArgs) {
682 < end)) { options.style.width = point.shapeArgs.width;
683 < end)) { if (point.dataLabel) {
684 < end)) { point.dataLabel.css({
685 < end)) { width: point.shapeArgs.width + 'px'
686 < end)) { });
687 < end)) { }
688 < end)) { }
689  
690 < end)) { // Merge custom options with point options
691 < end)) { point.dlOptions = merge(options, point.options.dataLabels);
692 < end)) { });
693 < end)) { Series.prototype.drawDataLabels.call(this);
694 < end)) { },
695  
696 < end)) { /**
697 < end)) { * Over the alignment method by setting z index
698 < end)) { */
699 < end)) { alignDataLabel: function(point) {
700 < end)) { seriesTypes.column.prototype.alignDataLabel.apply(this, arguments);
701 < end)) { if (point.dataLabel) {
702 < end)) { point.dataLabel.attr({
703 < end)) { zIndex: point.node.zIndex + 1
704 < end)) { });
705 < end)) { }
706 < end)) { },
707  
708  
709 < end)) { /**
710 < end)) { * Get presentational attributes
711 < end)) { */
712 < end)) { pointAttribs: function(point, state) {
713 < end)) { var level = this.levelMap[point.node.levelDynamic] || {},
714 < end)) { options = this.options,
715 < end)) { attr,
716 < end)) { stateOptions = (state && options.states[state]) || {},
717 < end)) { className = point.getClassName(),
718 < end)) { opacity;
719  
720 < end)) { // Set attributes by precedence. Point trumps level trumps series. Stroke width uses pick
721 < end)) { // because it can be 0.
722 < end)) { attr = {
723 < end)) { 'stroke': point.borderColor || level.borderColor || stateOptions.borderColor || options.borderColor,
724 < end)) { 'stroke-width': pick(point.borderWidth, level.borderWidth, stateOptions.borderWidth, options.borderWidth),
725 < end)) { 'dashstyle': point.borderDashStyle || level.borderDashStyle || stateOptions.borderDashStyle || options.borderDashStyle,
726 < end)) { 'fill': point.color || this.color
727 < end)) { };
728  
729 < end)) { // Hide levels above the current view
730 < end)) { if (className.indexOf('highcharts-above-level') !== -1) {
731 < end)) { attr.fill = 'none';
732 < end)) { attr['stroke-width'] = 0;
733  
734 < end)) { // Nodes with children that accept interaction
735 < end)) { } else if (className.indexOf('highcharts-internal-node-interactive') !== -1) {
736 < end)) { opacity = pick(stateOptions.opacity, options.opacity);
737 < end)) { attr.fill = color(attr.fill).setOpacity(opacity).get();
738 < end)) { attr.cursor = 'pointer';
739 < end)) { // Hide nodes that have children
740 < end)) { } else if (className.indexOf('highcharts-internal-node') !== -1) {
741 < end)) { attr.fill = 'none';
742  
743 < end)) { } else if (state) {
744 < end)) { // Brighten and hoist the hover nodes
745 < end)) { attr.fill = color(attr.fill).brighten(stateOptions.brightness).get();
746 < end)) { }
747 < end)) { return attr;
748 < end)) { },
749  
750  
751 < end)) { /**
752 < end)) { * Extending ColumnSeries drawPoints
753 < end)) { */
754 < end)) { drawPoints: function() {
755 < end)) { var series = this,
756 < end)) { points = grep(series.points, function(n) {
757 < end)) { return n.node.visible;
758 < end)) { });
759  
760 < end)) { each(points, function(point) {
761 < end)) { var groupKey = 'levelGroup-' + point.node.levelDynamic;
762 < end)) { if (!series[groupKey]) {
763 < end)) { series[groupKey] = series.chart.renderer.g(groupKey)
764 < end)) { .attr({
765 < end)) { zIndex: 1000 - point.node.levelDynamic // @todo Set the zIndex based upon the number of levels, instead of using 1000
766 < end)) { })
767 < end)) { .add(series.group);
768 < end)) { }
769 < end)) { point.group = series[groupKey];
770  
771 < end)) { });
772 < end)) { // Call standard drawPoints
773 < end)) { seriesTypes.column.prototype.drawPoints.call(this);
774  
775 < end)) { // If drillToNode is allowed, set a point cursor on clickables & add drillId to point
776 < end)) { if (series.options.allowDrillToNode) {
777 < end)) { each(points, function(point) {
778 < end)) { if (point.graphic) {
779 < end)) { point.drillId = series.options.interactByLeaf ? series.drillToByLeaf(point) : series.drillToByGroup(point);
780 < end)) { }
781 < end)) { });
782 < end)) { }
783 < end)) { },
784 < end)) { /**
785 < end)) { * Add drilling on the suitable points
786 < end)) { */
787 < end)) { onClickDrillToNode: function(event) {
788 < end)) { var series = this,
789 < end)) { point = event.point,
790 < end)) { drillId = point && point.drillId;
791 < end)) { // If a drill id is returned, add click event and cursor.
792 < end)) { if (isString(drillId)) {
793 < end)) { point.setState(''); // Remove hover
794 < end)) { series.drillToNode(drillId);
795 < end)) { }
796 < end)) { },
797 < end)) { /**
798 < end)) { * Finds the drill id for a parent node.
799 < end)) { * Returns false if point should not have a click event
800 < end)) { * @param {Object} point
801 < end)) { * @return {string || boolean} Drill to id or false when point should not have a click event
802 < end)) { */
803 < end)) { drillToByGroup: function(point) {
804 < end)) { var series = this,
805 < end)) { drillId = false;
806 < end)) { if ((point.node.level - series.nodeMap[series.rootNode].level) === 1 && !point.node.isLeaf) {
807 < end)) { drillId = point.id;
808 < end)) { }
809 < end)) { return drillId;
810 < end)) { },
811 < end)) { /**
812 < end)) { * Finds the drill id for a leaf node.
813 < end)) { * Returns false if point should not have a click event
814 < end)) { * @param {Object} point
815 < end)) { * @return {string || boolean} Drill to id or false when point should not have a click event
816 < end)) { */
817 < end)) { drillToByLeaf: function(point) {
818 < end)) { var series = this,
819 < end)) { drillId = false,
820 < end)) { nodeParent;
821 < end)) { if ((point.node.parent !== series.rootNode) && (point.node.isLeaf)) {
822 < end)) { nodeParent = point.node;
823 < end)) { while (!drillId) {
824 < end)) { nodeParent = series.nodeMap[nodeParent.parent];
825 < end)) { if (nodeParent.parent === series.rootNode) {
826 < end)) { drillId = nodeParent.id;
827 < end)) { }
828 < end)) { }
829 < end)) { }
830 < end)) { return drillId;
831 < end)) { },
832 < end)) { drillUp: function() {
833 < end)) { var series = this,
834 < end)) { node = series.nodeMap[series.rootNode];
835 < end)) { if (node && isString(node.parent)) {
836 < end)) { series.drillToNode(node.parent);
837 < end)) { }
838 < end)) { },
839 < end)) { drillToNode: function(id, redraw) {
840 < end)) { var series = this,
841 < end)) { nodeMap = series.nodeMap,
842 < end)) { node = nodeMap[id];
843 < end)) { series.rootNode = id;
844 < end)) { if (id === '') {
845 < end)) { series.drillUpButton = series.drillUpButton.destroy();
846 < end)) { } else {
847 < end)) { series.showDrillUpButton((node && node.name || id));
848 < end)) { }
849 < end)) { this.isDirty = true; // Force redraw
850 < end)) { if (pick(redraw, true)) {
851 < end)) { this.chart.redraw();
852 < end)) { }
853 < end)) { },
854 < end)) { showDrillUpButton: function(name) {
855 < end)) { var series = this,
856 < end)) { backText = (name || '< Back'),
857 < end)) { buttonOptions = series.options.drillUpButton,
858 < end)) { attr,
859 < end)) { states;
860  
861 < end)) { if (buttonOptions.text) {
862 < end)) { backText = buttonOptions.text;
863 < end)) { }
864 < end)) { if (!this.drillUpButton) {
865 < end)) { attr = buttonOptions.theme;
866 < end)) { states = attr && attr.states;
867  
868 < end)) { this.drillUpButton = this.chart.renderer.button(
869 < end)) { backText,
870 < end)) { null,
871 < end)) { null,
872 < end)) { function() {
873 < end)) { series.drillUp();
874 < end)) { },
875 < end)) { attr,
876 < end)) { states && states.hover,
877 < end)) { states && states.select
878 < end)) { )
879 < end)) { .attr({
880 < end)) { align: buttonOptions.position.align,
881 < end)) { zIndex: 7
882 < end)) { })
883 < end)) { .add()
884 < end)) { .align(buttonOptions.position, false, buttonOptions.relativeTo || 'plotBox');
885 < end)) { } else {
886 < end)) { this.drillUpButton.attr({
887 < end)) { text: backText
888 < end)) { })
889 < end)) { .align();
890 < end)) { }
891 < end)) { },
892 < end)) { buildKDTree: noop,
893 < end)) { drawLegendSymbol: H.LegendSymbolMixin.drawRectangle,
894 < end)) { getExtremes: function() {
895 < end)) { // Get the extremes from the value data
896 < end)) { Series.prototype.getExtremes.call(this, this.colorValueData);
897 < end)) { this.valueMin = this.dataMin;
898 < end)) { this.valueMax = this.dataMax;
899  
900 < end)) { // Get the extremes from the y data
901 < end)) { Series.prototype.getExtremes.call(this);
902 < end)) { },
903 < end)) { getExtremesFromAll: true,
904 < end)) { bindAxes: function() {
905 < end)) { var treeAxis = {
906 < end)) { endOnTick: false,
907 < end)) { gridLineWidth: 0,
908 < end)) { lineWidth: 0,
909 < end)) { min: 0,
910 < end)) { dataMin: 0,
911 < end)) { minPadding: 0,
912 < end)) { max: 100,
913 < end)) { dataMax: 100,
914 < end)) { maxPadding: 0,
915 < end)) { startOnTick: false,
916 < end)) { title: null,
917 < end)) { tickPositions: []
918 < end)) { };
919 < end)) { Series.prototype.bindAxes.call(this);
920 < end)) { H.extend(this.yAxis.options, treeAxis);
921 < end)) { H.extend(this.xAxis.options, treeAxis);
922 < end)) { }
923  
924 < end)) { // Point class
925 < end)) { }, {
926 < end)) { getClassName: function() {
927 < end)) { var className = H.Point.prototype.getClassName.call(this),
928 < end)) { series = this.series,
929 < end)) { options = series.options;
930  
931 < end)) { // Above the current level
932 < end)) { if (this.node.level <= series.nodeMap[series.rootNode].level) {
933 < end)) { className += ' highcharts-above-level';
934  
935 < end)) { } else if (!this.node.isLeaf && !pick(options.interactByLeaf, !options.allowDrillToNode)) {
936 < end)) { className += ' highcharts-internal-node-interactive';
937  
938 < end)) { } else if (!this.node.isLeaf) {
939 < end)) { className += ' highcharts-internal-node';
940 < end)) { }
941 < end)) { return className;
942 < end)) { },
943 < end)) { isValid: function() {
944 < end)) { return isNumber(this.value);
945 < end)) { },
946 < end)) { setState: function(state) {
947 < end)) { H.Point.prototype.setState.call(this, state);
948  
949 < end)) { // Graphic does not exist when point is not visible.
950 < end)) { if (this.graphic) {
951 < end)) { this.graphic.attr({
952 < end)) { zIndex: state === 'hover' ? 1 : 0
953 < end)) { });
954 < end)) { }
955 < end)) { },
956 < end)) { setVisible: seriesTypes.pie.prototype.pointClass.prototype.setVisible
957 < end)) { });
958  
959 < end)) { }(Highcharts));
960 < end)) {}));