echarts 4.2.0-rc.2 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/KEYS +60 -0
  2. package/LICENSE +7 -8
  3. package/dist/echarts-en.common.js +1250 -717
  4. package/dist/echarts-en.common.min.js +1 -1
  5. package/dist/echarts-en.js +2284 -1763
  6. package/dist/echarts-en.js.map +1 -1
  7. package/dist/echarts-en.min.js +1 -1
  8. package/dist/echarts-en.simple.js +1001 -560
  9. package/dist/echarts-en.simple.min.js +1 -1
  10. package/dist/echarts.common.js +1250 -717
  11. package/dist/echarts.common.min.js +1 -1
  12. package/dist/echarts.js +2284 -1763
  13. package/dist/echarts.js.map +1 -1
  14. package/dist/echarts.min.js +1 -1
  15. package/dist/echarts.simple.js +1001 -560
  16. package/dist/echarts.simple.min.js +1 -1
  17. package/dist/extension/dataTool.js +32 -33
  18. package/dist/extension/dataTool.js.map +1 -1
  19. package/lib/chart/graph/GraphView.js +17 -9
  20. package/lib/chart/graph/forceHelper.js +15 -20
  21. package/lib/chart/helper/Line.js +5 -1
  22. package/lib/chart/map/MapSeries.js +32 -26
  23. package/lib/chart/map/MapView.js +93 -40
  24. package/lib/chart/pie/labelLayout.js +23 -16
  25. package/lib/chart/sankey/sankeyLayout.js +18 -17
  26. package/lib/chart/sunburst/SunburstPiece.js +10 -5
  27. package/lib/chart/themeRiver/ThemeRiverSeries.js +26 -29
  28. package/lib/chart/tree/layoutHelper.js +57 -10
  29. package/lib/chart/treemap/treemapLayout.js +13 -7
  30. package/lib/component/axis/AxisBuilder.js +11 -2
  31. package/lib/component/helper/MapDraw.js +4 -0
  32. package/lib/component/helper/RoamController.js +3 -3
  33. package/lib/component/legend/LegendView.js +19 -1
  34. package/lib/component/legend/ScrollableLegendView.js +105 -70
  35. package/lib/coord/axisHelper.js +24 -1
  36. package/lib/coord/axisTickLabelBuilder.js +7 -12
  37. package/lib/coord/geo/Geo.js +1 -1
  38. package/lib/data/List.js +111 -36
  39. package/lib/echarts.js +13 -4
  40. package/lib/model/Model.js +1 -1
  41. package/lib/model/mixin/textStyle.js +1 -1
  42. package/lib/scale/Time.js +14 -4
  43. package/lib/util/format.js +30 -1
  44. package/lib/util/graphic.js +114 -27
  45. package/lib/util/model.js +27 -1
  46. package/lib/util/number.js +12 -33
  47. package/lib/visual/visualSolution.js +1 -1
  48. package/package.json +3 -4
  49. package/src/chart/graph/GraphView.js +15 -10
  50. package/src/chart/graph/forceHelper.js +17 -24
  51. package/src/chart/helper/Line.js +5 -1
  52. package/src/chart/map/MapSeries.js +28 -31
  53. package/src/chart/map/MapView.js +96 -38
  54. package/src/chart/pie/labelLayout.js +19 -14
  55. package/src/chart/sankey/sankeyLayout.js +17 -19
  56. package/src/chart/sunburst/SunburstPiece.js +11 -3
  57. package/src/chart/themeRiver/ThemeRiverSeries.js +18 -33
  58. package/src/chart/tree/layoutHelper.js +56 -10
  59. package/src/chart/treemap/treemapLayout.js +13 -7
  60. package/src/component/axis/AxisBuilder.js +7 -1
  61. package/src/component/helper/MapDraw.js +5 -1
  62. package/src/component/helper/RoamController.js +3 -4
  63. package/src/component/legend/LegendView.js +20 -1
  64. package/src/component/legend/ScrollableLegendView.js +119 -85
  65. package/src/coord/axisHelper.js +19 -0
  66. package/src/coord/axisTickLabelBuilder.js +10 -13
  67. package/src/coord/geo/Geo.js +1 -1
  68. package/src/data/List.js +107 -28
  69. package/src/echarts.js +11 -5
  70. package/src/model/Model.js +1 -1
  71. package/src/model/mixin/textStyle.js +1 -0
  72. package/src/scale/Time.js +14 -4
  73. package/src/util/format.js +39 -1
  74. package/src/util/graphic.js +110 -28
  75. package/src/util/model.js +25 -0
  76. package/src/util/number.js +12 -33
  77. package/src/visual/visualSolution.js +1 -1
  78. package/extension/dataTool/quantile.js +0 -82
  79. package/lib/component/tooltip/TooltipContentManager.js +0 -126
  80. package/lib/util/nest.js +0 -148
  81. package/src/component/tooltip/TooltipContentManager.js +0 -120
  82. package/src/util/nest.js +0 -127
@@ -17,6 +17,15 @@
17
17
  * under the License.
18
18
  */
19
19
 
20
+ /*
21
+ * A third-party license is embeded for some of the code in this file:
22
+ * The method "quantile" was copied from "d3.js".
23
+ * (See more details in the comment of the method below.)
24
+ * The use of the source code of this file is also subject to the terms
25
+ * and consitions of the license of "d3.js" (BSD-3Clause, see
26
+ * </licenses/LICENSE-d3>).
27
+ */
28
+
20
29
  import * as zrUtil from 'zrender/src/core/util';
21
30
 
22
31
  var RADIAN_EPSILON = 1e-4;
@@ -432,39 +441,9 @@ export function nice(val, round) {
432
441
  }
433
442
 
434
443
  /**
435
- * BSD 3-Clause
436
- *
437
- * Copyright (c) 2010-2015, Michael Bostock
438
- * All rights reserved.
439
- *
440
- * Redistribution and use in source and binary forms, with or without
441
- * modification, are permitted provided that the following conditions are met:
442
- *
443
- * * Redistributions of source code must retain the above copyright notice, this
444
- * list of conditions and the following disclaimer.
445
- *
446
- * * Redistributions in binary form must reproduce the above copyright notice,
447
- * this list of conditions and the following disclaimer in the documentation
448
- * and/or other materials provided with the distribution.
449
- *
450
- * * The name Michael Bostock may not be used to endorse or promote products
451
- * derived from this software without specific prior written permission.
452
- *
453
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
454
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
455
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
456
- * DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
457
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
458
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
459
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
460
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
461
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
462
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
463
- */
464
-
465
- /**
466
- * @see <https://github.com/mbostock/d3/blob/master/src/arrays/quantile.js>
467
- * @see <http://en.wikipedia.org/wiki/Quantile>
444
+ * This code was copied from "d3.js"
445
+ * <https://github.com/d3/d3/blob/9cc9a875e636a1dcf36cc1e07bdf77e1ad6e2c74/src/arrays/quantile.js>.
446
+ * See the license statement at the head of this file.
468
447
  * @param {Array.<number>} ascArr
469
448
  */
470
449
  export function quantile(ascArr, p) {
@@ -195,7 +195,7 @@ export function incrementalApplyVisual(stateList, visualMappings, getValueState,
195
195
 
196
196
  // Consider performance
197
197
  if (rawDataItem && rawDataItem.visualMap === false) {
198
- return;
198
+ continue;
199
199
  }
200
200
 
201
201
  var value = dim != null
@@ -1,82 +0,0 @@
1
-
2
- /*
3
- * Licensed to the Apache Software Foundation (ASF) under one
4
- * or more contributor license agreements. See the NOTICE file
5
- * distributed with this work for additional information
6
- * regarding copyright ownership. The ASF licenses this file
7
- * to you under the Apache License, Version 2.0 (the
8
- * "License"); you may not use this file except in compliance
9
- * with the License. You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing,
14
- * software distributed under the License is distributed on an
15
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- * KIND, either express or implied. See the License for the
17
- * specific language governing permissions and limitations
18
- * under the License.
19
- */
20
-
21
- /*
22
- * Licensed to the Apache Software Foundation (ASF) under one
23
- * or more contributor license agreements. See the NOTICE file
24
- * distributed with this work for additional information
25
- * regarding copyright ownership. The ASF licenses this file
26
- * to you under the Apache License, Version 2.0 (the
27
- * "License"); you may not use this file except in compliance
28
- * with the License. You may obtain a copy of the License at
29
- *
30
- * http://www.apache.org/licenses/LICENSE-2.0
31
- *
32
- * Unless required by applicable law or agreed to in writing,
33
- * software distributed under the License is distributed on an
34
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
35
- * KIND, either express or implied. See the License for the
36
- * specific language governing permissions and limitations
37
- * under the License.
38
- */
39
-
40
- /**
41
- * Copyright (c) 2010-2015, Michael Bostock
42
- * All rights reserved.
43
- *
44
- * Redistribution and use in source and binary forms, with or without
45
- * modification, are permitted provided that the following conditions are met:
46
- *
47
- * * Redistributions of source code must retain the above copyright notice, this
48
- * list of conditions and the following disclaimer.
49
- *
50
- * * Redistributions in binary form must reproduce the above copyright notice,
51
- * this list of conditions and the following disclaimer in the documentation
52
- * and/or other materials provided with the distribution.
53
- *
54
- * * The name Michael Bostock may not be used to endorse or promote products
55
- * derived from this software without specific prior written permission.
56
- *
57
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
58
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
59
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
60
- * DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
61
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
62
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
63
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
64
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
65
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
66
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
67
- */
68
-
69
- /**
70
- * @see <https://github.com/mbostock/d3/blob/master/src/arrays/quantile.js>
71
- * @see <http://en.wikipedia.org/wiki/Quantile>
72
- * @param {Array.<number>} ascArr
73
- */
74
- function _default(ascArr, p) {
75
- var H = (ascArr.length - 1) * p + 1,
76
- h = Math.floor(H),
77
- v = +ascArr[h - 1],
78
- e = H - h;
79
- return e ? v + e * (ascArr[h] - v) : v;
80
- }
81
-
82
- module.exports = _default;
@@ -1,126 +0,0 @@
1
-
2
- /*
3
- * Licensed to the Apache Software Foundation (ASF) under one
4
- * or more contributor license agreements. See the NOTICE file
5
- * distributed with this work for additional information
6
- * regarding copyright ownership. The ASF licenses this file
7
- * to you under the Apache License, Version 2.0 (the
8
- * "License"); you may not use this file except in compliance
9
- * with the License. You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing,
14
- * software distributed under the License is distributed on an
15
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- * KIND, either express or implied. See the License for the
17
- * specific language governing permissions and limitations
18
- * under the License.
19
- */
20
-
21
- var zrUtil = require("zrender/lib/core/util");
22
-
23
- var TooltipContent = require("./TooltipContent");
24
-
25
- /*
26
- * Licensed to the Apache Software Foundation (ASF) under one
27
- * or more contributor license agreements. See the NOTICE file
28
- * distributed with this work for additional information
29
- * regarding copyright ownership. The ASF licenses this file
30
- * to you under the Apache License, Version 2.0 (the
31
- * "License"); you may not use this file except in compliance
32
- * with the License. You may obtain a copy of the License at
33
- *
34
- * http://www.apache.org/licenses/LICENSE-2.0
35
- *
36
- * Unless required by applicable law or agreed to in writing,
37
- * software distributed under the License is distributed on an
38
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
39
- * KIND, either express or implied. See the License for the
40
- * specific language governing permissions and limitations
41
- * under the License.
42
- */
43
- // var each = zrUtil.each;
44
-
45
- /**
46
- * @alias module:echarts/component/tooltip/TooltipContentManager
47
- * @constructor
48
- */
49
- function TooltipContentManager(container, api) {
50
- /**
51
- * @private
52
- */
53
- this._contents = {
54
- // Default tooltip content
55
- main: new TooltipContent(container, api)
56
- };
57
- }
58
-
59
- TooltipContentManager.prototype = {
60
- constructor: TooltipContentManager,
61
-
62
- /**
63
- * Update when tooltip is rendered
64
- */
65
- update: function () {
66
- this._each('update');
67
- },
68
-
69
- /**
70
- * @param {module:echarts/component/tooltip/TooltipModel}
71
- * @param {string} [key='main']
72
- */
73
- show: function (tooltipModel, key) {
74
- key = key || 'main';
75
-
76
- this._giveContent(key).show(tooltipModel);
77
- },
78
-
79
- /**
80
- * Create content if not exists.
81
- */
82
- _giveContent: function (key) {
83
- return this._contents[key] || (this._contents[key] = new TooltipContent());
84
- },
85
- setContent: function (content) {
86
- this.el.innerHTML = content;
87
- },
88
- setEnterable: function (enterable) {
89
- this._enterable = enterable;
90
- },
91
- getSize: function () {
92
- var el = this.el;
93
- return [el.clientWidth, el.clientHeight];
94
- },
95
- moveTo: function (x, y) {
96
- var style = this.el.style;
97
- style.left = x + 'px';
98
- style.top = y + 'px';
99
- this._x = x;
100
- this._y = y;
101
- },
102
- hide: function () {
103
- this.el.style.display = 'none';
104
- this._show = false;
105
- },
106
- // showLater: function ()
107
- hideLater: function (time) {
108
- if (this._show && !(this._inContent && this._enterable)) {
109
- if (time) {
110
- this._hideDelay = time; // Set show false to avoid invoke hideLater mutiple times
111
-
112
- this._show = false;
113
- this._hideTimeout = setTimeout(zrUtil.bind(this.hide, this), time);
114
- } else {
115
- this.hide();
116
- }
117
- }
118
- },
119
- _each: function (method, args) {
120
- zrUtil.each(this._contents, function (content) {
121
- content[method].apply(content, args);
122
- });
123
- }
124
- };
125
- var _default = TooltipContentManager;
126
- module.exports = _default;
package/lib/util/nest.js DELETED
@@ -1,148 +0,0 @@
1
-
2
- /*
3
- * Licensed to the Apache Software Foundation (ASF) under one
4
- * or more contributor license agreements. See the NOTICE file
5
- * distributed with this work for additional information
6
- * regarding copyright ownership. The ASF licenses this file
7
- * to you under the Apache License, Version 2.0 (the
8
- * "License"); you may not use this file except in compliance
9
- * with the License. You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing,
14
- * software distributed under the License is distributed on an
15
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- * KIND, either express or implied. See the License for the
17
- * specific language governing permissions and limitations
18
- * under the License.
19
- */
20
-
21
- var zrUtil = require("zrender/lib/core/util");
22
-
23
- /*
24
- * Licensed to the Apache Software Foundation (ASF) under one
25
- * or more contributor license agreements. See the NOTICE file
26
- * distributed with this work for additional information
27
- * regarding copyright ownership. The ASF licenses this file
28
- * to you under the Apache License, Version 2.0 (the
29
- * "License"); you may not use this file except in compliance
30
- * with the License. You may obtain a copy of the License at
31
- *
32
- * http://www.apache.org/licenses/LICENSE-2.0
33
- *
34
- * Unless required by applicable law or agreed to in writing,
35
- * software distributed under the License is distributed on an
36
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
37
- * KIND, either express or implied. See the License for the
38
- * specific language governing permissions and limitations
39
- * under the License.
40
- */
41
-
42
- /*
43
- * The implementation references to d3.js. The use of the source
44
- * code of this file is also subject to the terms and consitions
45
- * of its license (BSD-3Clause, see <echarts/src/licenses/LICENSE-d3>).
46
- */
47
-
48
- /**
49
- * nest helper used to group by the array.
50
- * can specified the keys and sort the keys.
51
- */
52
- function nest() {
53
- var keysFunction = [];
54
- var sortKeysFunction = [];
55
- /**
56
- * map an Array into the mapObject.
57
- * @param {Array} array
58
- * @param {number} depth
59
- */
60
-
61
- function map(array, depth) {
62
- if (depth >= keysFunction.length) {
63
- return array;
64
- }
65
-
66
- var i = -1;
67
- var n = array.length;
68
- var keyFunction = keysFunction[depth++];
69
- var mapObject = {};
70
- var valuesByKey = {};
71
-
72
- while (++i < n) {
73
- var keyValue = keyFunction(array[i]);
74
- var values = valuesByKey[keyValue];
75
-
76
- if (values) {
77
- values.push(array[i]);
78
- } else {
79
- valuesByKey[keyValue] = [array[i]];
80
- }
81
- }
82
-
83
- zrUtil.each(valuesByKey, function (value, key) {
84
- mapObject[key] = map(value, depth);
85
- });
86
- return mapObject;
87
- }
88
- /**
89
- * transform the Map Object to multidimensional Array
90
- * @param {Object} map
91
- * @param {number} depth
92
- */
93
-
94
-
95
- function entriesMap(mapObject, depth) {
96
- if (depth >= keysFunction.length) {
97
- return mapObject;
98
- }
99
-
100
- var array = [];
101
- var sortKeyFunction = sortKeysFunction[depth++];
102
- zrUtil.each(mapObject, function (value, key) {
103
- array.push({
104
- key: key,
105
- values: entriesMap(value, depth)
106
- });
107
- });
108
-
109
- if (sortKeyFunction) {
110
- return array.sort(function (a, b) {
111
- return sortKeyFunction(a.key, b.key);
112
- });
113
- }
114
-
115
- return array;
116
- }
117
-
118
- return {
119
- /**
120
- * specified the key to groupby the arrays.
121
- * users can specified one more keys.
122
- * @param {Function} d
123
- */
124
- key: function (d) {
125
- keysFunction.push(d);
126
- return this;
127
- },
128
-
129
- /**
130
- * specified the comparator to sort the keys
131
- * @param {Function} order
132
- */
133
- sortKeys: function (order) {
134
- sortKeysFunction[keysFunction.length - 1] = order;
135
- return this;
136
- },
137
-
138
- /**
139
- * the array to be grouped by.
140
- * @param {Array} array
141
- */
142
- entries: function (array) {
143
- return entriesMap(map(array, 0), 0);
144
- }
145
- };
146
- }
147
-
148
- module.exports = nest;
@@ -1,120 +0,0 @@
1
-
2
- /*
3
- * Licensed to the Apache Software Foundation (ASF) under one
4
- * or more contributor license agreements. See the NOTICE file
5
- * distributed with this work for additional information
6
- * regarding copyright ownership. The ASF licenses this file
7
- * to you under the Apache License, Version 2.0 (the
8
- * "License"); you may not use this file except in compliance
9
- * with the License. You may obtain a copy of the License at
10
- *
11
- * http://www.apache.org/licenses/LICENSE-2.0
12
- *
13
- * Unless required by applicable law or agreed to in writing,
14
- * software distributed under the License is distributed on an
15
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
- * KIND, either express or implied. See the License for the
17
- * specific language governing permissions and limitations
18
- * under the License.
19
- */
20
-
21
- import * as zrUtil from 'zrender/src/core/util';
22
- import TooltipContent from './TooltipContent';
23
-
24
- // var each = zrUtil.each;
25
-
26
- /**
27
- * @alias module:echarts/component/tooltip/TooltipContentManager
28
- * @constructor
29
- */
30
- function TooltipContentManager(container, api) {
31
-
32
- /**
33
- * @private
34
- */
35
- this._contents = {
36
- // Default tooltip content
37
- main: new TooltipContent(container, api)
38
- };
39
- }
40
-
41
- TooltipContentManager.prototype = {
42
-
43
- constructor: TooltipContentManager,
44
-
45
- /**
46
- * Update when tooltip is rendered
47
- */
48
- update: function () {
49
- this._each('update');
50
- },
51
-
52
- /**
53
- * @param {module:echarts/component/tooltip/TooltipModel}
54
- * @param {string} [key='main']
55
- */
56
- show: function (tooltipModel, key) {
57
- key = key || 'main';
58
- this._giveContent(key).show(tooltipModel);
59
- },
60
-
61
- /**
62
- * Create content if not exists.
63
- */
64
- _giveContent: function (key) {
65
- return this._contents[key] || (
66
- this._contents[key] = new TooltipContent()
67
- );
68
- },
69
-
70
- setContent: function (content) {
71
- this.el.innerHTML = content;
72
- },
73
-
74
- setEnterable: function (enterable) {
75
- this._enterable = enterable;
76
- },
77
-
78
- getSize: function () {
79
- var el = this.el;
80
- return [el.clientWidth, el.clientHeight];
81
- },
82
-
83
- moveTo: function (x, y) {
84
- var style = this.el.style;
85
- style.left = x + 'px';
86
- style.top = y + 'px';
87
-
88
- this._x = x;
89
- this._y = y;
90
- },
91
-
92
- hide: function () {
93
- this.el.style.display = 'none';
94
- this._show = false;
95
- },
96
-
97
- // showLater: function ()
98
-
99
- hideLater: function (time) {
100
- if (this._show && !(this._inContent && this._enterable)) {
101
- if (time) {
102
- this._hideDelay = time;
103
- // Set show false to avoid invoke hideLater mutiple times
104
- this._show = false;
105
- this._hideTimeout = setTimeout(zrUtil.bind(this.hide, this), time);
106
- }
107
- else {
108
- this.hide();
109
- }
110
- }
111
- },
112
-
113
- _each: function (method, args) {
114
- zrUtil.each(this._contents, function (content) {
115
- content[method].apply(content, args);
116
- });
117
- }
118
- };
119
-
120
- export default TooltipContentManager;
package/src/util/nest.js DELETED
@@ -1,127 +0,0 @@
1
- /*
2
- * Licensed to the Apache Software Foundation (ASF) under one
3
- * or more contributor license agreements. See the NOTICE file
4
- * distributed with this work for additional information
5
- * regarding copyright ownership. The ASF licenses this file
6
- * to you under the Apache License, Version 2.0 (the
7
- * "License"); you may not use this file except in compliance
8
- * with the License. You may obtain a copy of the License at
9
- *
10
- * http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing,
13
- * software distributed under the License is distributed on an
14
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15
- * KIND, either express or implied. See the License for the
16
- * specific language governing permissions and limitations
17
- * under the License.
18
- */
19
-
20
- /*
21
- * The implementation references to d3.js. The use of the source
22
- * code of this file is also subject to the terms and consitions
23
- * of its license (BSD-3Clause, see <echarts/src/licenses/LICENSE-d3>).
24
- */
25
-
26
-
27
- import * as zrUtil from 'zrender/src/core/util';
28
-
29
- /**
30
- * nest helper used to group by the array.
31
- * can specified the keys and sort the keys.
32
- */
33
- export default function nest() {
34
-
35
- var keysFunction = [];
36
- var sortKeysFunction = [];
37
-
38
- /**
39
- * map an Array into the mapObject.
40
- * @param {Array} array
41
- * @param {number} depth
42
- */
43
- function map(array, depth) {
44
- if (depth >= keysFunction.length) {
45
- return array;
46
- }
47
- var i = -1;
48
- var n = array.length;
49
- var keyFunction = keysFunction[depth++];
50
- var mapObject = {};
51
- var valuesByKey = {};
52
-
53
- while (++i < n) {
54
- var keyValue = keyFunction(array[i]);
55
- var values = valuesByKey[keyValue];
56
-
57
- if (values) {
58
- values.push(array[i]);
59
- }
60
- else {
61
- valuesByKey[keyValue] = [array[i]];
62
- }
63
- }
64
-
65
- zrUtil.each(valuesByKey, function (value, key) {
66
- mapObject[key] = map(value, depth);
67
- });
68
-
69
- return mapObject;
70
- }
71
-
72
- /**
73
- * transform the Map Object to multidimensional Array
74
- * @param {Object} map
75
- * @param {number} depth
76
- */
77
- function entriesMap(mapObject, depth) {
78
- if (depth >= keysFunction.length) {
79
- return mapObject;
80
- }
81
- var array = [];
82
- var sortKeyFunction = sortKeysFunction[depth++];
83
-
84
- zrUtil.each(mapObject, function (value, key) {
85
- array.push({
86
- key: key, values: entriesMap(value, depth)
87
- });
88
- });
89
-
90
- if (sortKeyFunction) {
91
- return array.sort(function (a, b) {
92
- return sortKeyFunction(a.key, b.key);
93
- });
94
- }
95
-
96
- return array;
97
- }
98
-
99
- return {
100
- /**
101
- * specified the key to groupby the arrays.
102
- * users can specified one more keys.
103
- * @param {Function} d
104
- */
105
- key: function (d) {
106
- keysFunction.push(d);
107
- return this;
108
- },
109
-
110
- /**
111
- * specified the comparator to sort the keys
112
- * @param {Function} order
113
- */
114
- sortKeys: function (order) {
115
- sortKeysFunction[keysFunction.length - 1] = order;
116
- return this;
117
- },
118
-
119
- /**
120
- * the array to be grouped by.
121
- * @param {Array} array
122
- */
123
- entries: function (array) {
124
- return entriesMap(map(array, 0), 0);
125
- }
126
- };
127
- }