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