billboard.js 3.6.0-next.2 → 3.6.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 (43) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +4808 -7179
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +8271 -11777
  6. package/dist/billboard.pkgd.min.js +2 -3
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.js +27 -62
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-sparkline.js +303 -528
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +368 -648
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +305 -513
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +306 -500
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2169 -2362
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2940 -3599
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +3194 -4110
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2943 -3585
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +3084 -3931
  22. package/dist/theme/datalab.css +1 -1
  23. package/dist/theme/datalab.min.css +1 -1
  24. package/dist/theme/graph.css +1 -1
  25. package/dist/theme/graph.min.css +1 -1
  26. package/dist/theme/insight.css +1 -1
  27. package/dist/theme/insight.min.css +1 -1
  28. package/dist-esm/billboard.js +369 -192
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -8
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -12
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +3 -12
  32. package/dist-esm/plugin/billboardjs-plugin-tableview.js +3 -12
  33. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -8
  34. package/package.json +23 -23
  35. package/src/ChartInternal/data/IData.ts +8 -2
  36. package/src/ChartInternal/interactions/interaction.ts +39 -26
  37. package/src/ChartInternal/internals/color.ts +50 -0
  38. package/src/ChartInternal/internals/legend.ts +246 -145
  39. package/src/ChartInternal/shape/area.ts +9 -38
  40. package/src/ChartInternal/shape/bar.ts +20 -3
  41. package/src/config/Options/common/legend.ts +18 -3
  42. package/src/config/Options/shape/bar.ts +32 -0
  43. package/types/options.d.ts +30 -4
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.0-next.2
8
+ * @version 3.6.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -25,8 +25,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
25
25
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
26
26
  PERFORMANCE OF THIS SOFTWARE.
27
27
  ***************************************************************************** */
28
-
29
28
  /* global Reflect, Promise */
29
+
30
30
  var _extendStatics = function extendStatics(d, b) {
31
31
  _extendStatics = Object.setPrototypeOf || {
32
32
  __proto__: []
@@ -37,19 +37,14 @@ var _extendStatics = function extendStatics(d, b) {
37
37
  if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
38
38
  }
39
39
  };
40
-
41
40
  return _extendStatics(d, b);
42
41
  };
43
-
44
42
  function __extends(d, b) {
45
43
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + (b + "") + " is not a constructor or null");
46
-
47
44
  _extendStatics(d, b);
48
-
49
45
  function __() {
50
46
  this.constructor = d;
51
47
  }
52
-
53
48
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
54
49
  }
55
50
 
@@ -111,7 +106,7 @@ var Plugin = /** @class */ (function () {
111
106
  delete _this[key];
112
107
  });
113
108
  };
114
- Plugin.version = "3.6.0-next.2";
109
+ Plugin.version = "3.6.1";
115
110
  return Plugin;
116
111
  }());
117
112
  var Plugin$1 = Plugin;
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.0-next.2
8
+ * @version 3.6.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -23,8 +23,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
23
23
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
24
24
  PERFORMANCE OF THIS SOFTWARE.
25
25
  ***************************************************************************** */
26
-
27
26
  /* global Reflect, Promise */
27
+
28
28
  var _extendStatics = function extendStatics(d, b) {
29
29
  _extendStatics = Object.setPrototypeOf || {
30
30
  __proto__: []
@@ -35,35 +35,26 @@ var _extendStatics = function extendStatics(d, b) {
35
35
  if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
36
36
  }
37
37
  };
38
-
39
38
  return _extendStatics(d, b);
40
39
  };
41
-
42
40
  function __extends(d, b) {
43
41
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + (b + "") + " is not a constructor or null");
44
-
45
42
  _extendStatics(d, b);
46
-
47
43
  function __() {
48
44
  this.constructor = d;
49
45
  }
50
-
51
46
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
52
47
  }
53
-
54
48
  var _assign = function __assign() {
55
49
  _assign = Object.assign || function (t) {
56
50
  for (var s, i = 1, n = arguments.length; i < n; i++) {
57
51
  s = arguments[i];
58
-
59
52
  for (var p in s) {
60
53
  if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
61
54
  }
62
55
  }
63
-
64
56
  return t;
65
57
  };
66
-
67
58
  return _assign.apply(this, arguments);
68
59
  };
69
60
  function __spreadArray(to, from, pack) {
@@ -286,7 +277,7 @@ var Plugin = /** @class */ (function () {
286
277
  delete _this[key];
287
278
  });
288
279
  };
289
- Plugin.version = "3.6.0-next.2";
280
+ Plugin.version = "3.6.1";
290
281
  return Plugin;
291
282
  }());
292
283
  var Plugin$1 = Plugin;
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.0-next.2
8
+ * @version 3.6.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -29,8 +29,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
29
29
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
30
30
  PERFORMANCE OF THIS SOFTWARE.
31
31
  ***************************************************************************** */
32
-
33
32
  /* global Reflect, Promise */
33
+
34
34
  var _extendStatics = function extendStatics(d, b) {
35
35
  _extendStatics = Object.setPrototypeOf || {
36
36
  __proto__: []
@@ -41,35 +41,26 @@ var _extendStatics = function extendStatics(d, b) {
41
41
  if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
42
42
  }
43
43
  };
44
-
45
44
  return _extendStatics(d, b);
46
45
  };
47
-
48
46
  function __extends(d, b) {
49
47
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + (b + "") + " is not a constructor or null");
50
-
51
48
  _extendStatics(d, b);
52
-
53
49
  function __() {
54
50
  this.constructor = d;
55
51
  }
56
-
57
52
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
58
53
  }
59
-
60
54
  var _assign = function __assign() {
61
55
  _assign = Object.assign || function (t) {
62
56
  for (var s, i = 1, n = arguments.length; i < n; i++) {
63
57
  s = arguments[i];
64
-
65
58
  for (var p in s) {
66
59
  if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
67
60
  }
68
61
  }
69
-
70
62
  return t;
71
63
  };
72
-
73
64
  return _assign.apply(this, arguments);
74
65
  };
75
66
  function __spreadArray(to, from, pack) {
@@ -494,7 +485,7 @@ var Plugin = /** @class */ (function () {
494
485
  delete _this[key];
495
486
  });
496
487
  };
497
- Plugin.version = "3.6.0-next.2";
488
+ Plugin.version = "3.6.1";
498
489
  return Plugin;
499
490
  }());
500
491
  var Plugin$1 = Plugin;
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.0-next.2
8
+ * @version 3.6.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -23,8 +23,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
23
23
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
24
24
  PERFORMANCE OF THIS SOFTWARE.
25
25
  ***************************************************************************** */
26
-
27
26
  /* global Reflect, Promise */
27
+
28
28
  var _extendStatics = function extendStatics(d, b) {
29
29
  _extendStatics = Object.setPrototypeOf || {
30
30
  __proto__: []
@@ -35,35 +35,26 @@ var _extendStatics = function extendStatics(d, b) {
35
35
  if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
36
36
  }
37
37
  };
38
-
39
38
  return _extendStatics(d, b);
40
39
  };
41
-
42
40
  function __extends(d, b) {
43
41
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + (b + "") + " is not a constructor or null");
44
-
45
42
  _extendStatics(d, b);
46
-
47
43
  function __() {
48
44
  this.constructor = d;
49
45
  }
50
-
51
46
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
52
47
  }
53
-
54
48
  var _assign = function __assign() {
55
49
  _assign = Object.assign || function (t) {
56
50
  for (var s, i = 1, n = arguments.length; i < n; i++) {
57
51
  s = arguments[i];
58
-
59
52
  for (var p in s) {
60
53
  if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
61
54
  }
62
55
  }
63
-
64
56
  return t;
65
57
  };
66
-
67
58
  return _assign.apply(this, arguments);
68
59
  };
69
60
  function __spreadArray(to, from, pack) {
@@ -134,7 +125,7 @@ var Plugin = /** @class */ (function () {
134
125
  delete _this[key];
135
126
  });
136
127
  };
137
- Plugin.version = "3.6.0-next.2";
128
+ Plugin.version = "3.6.1";
138
129
  return Plugin;
139
130
  }());
140
131
  var Plugin$1 = Plugin;
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.0-next.2
8
+ * @version 3.6.1
9
9
  * @requires billboard.js
10
10
  * @summary billboard.js plugin
11
11
  */
@@ -26,8 +26,8 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
26
26
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
27
27
  PERFORMANCE OF THIS SOFTWARE.
28
28
  ***************************************************************************** */
29
-
30
29
  /* global Reflect, Promise */
30
+
31
31
  var _extendStatics = function extendStatics(d, b) {
32
32
  _extendStatics = Object.setPrototypeOf || {
33
33
  __proto__: []
@@ -38,19 +38,14 @@ var _extendStatics = function extendStatics(d, b) {
38
38
  if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
39
39
  }
40
40
  };
41
-
42
41
  return _extendStatics(d, b);
43
42
  };
44
-
45
43
  function __extends(d, b) {
46
44
  if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + (b + "") + " is not a constructor or null");
47
-
48
45
  _extendStatics(d, b);
49
-
50
46
  function __() {
51
47
  this.constructor = d;
52
48
  }
53
-
54
49
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
55
50
  }
56
51
  function __spreadArray(to, from, pack) {
@@ -270,7 +265,7 @@ var Plugin = /** @class */ (function () {
270
265
  delete _this[key];
271
266
  });
272
267
  };
273
- Plugin.version = "3.6.0-next.2";
268
+ Plugin.version = "3.6.1";
274
269
  return Plugin;
275
270
  }());
276
271
  var Plugin$1 = Plugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billboard.js",
3
- "version": "3.6.0-next.2",
3
+ "version": "3.6.1",
4
4
  "description": "Re-usable easy interface JavaScript chart library, based on D3 v4+",
5
5
  "homepage": "https://naver.github.io/billboard.js/",
6
6
  "main": "dist/billboard.js",
@@ -96,20 +96,20 @@
96
96
  "d3-zoom": "^3.0.0"
97
97
  },
98
98
  "devDependencies": {
99
- "@babel/core": "^7.19.1",
99
+ "@babel/core": "^7.19.3",
100
100
  "@babel/eslint-parser": "^7.19.1",
101
101
  "@babel/plugin-proposal-class-properties": "^7.18.6",
102
- "@babel/plugin-proposal-object-rest-spread": "^7.18.9",
102
+ "@babel/plugin-proposal-object-rest-spread": "^7.19.4",
103
103
  "@babel/plugin-transform-runtime": "^7.19.1",
104
- "@babel/preset-env": "^7.19.1",
104
+ "@babel/preset-env": "^7.19.4",
105
105
  "@babel/preset-typescript": "^7.18.6",
106
- "@babel/runtime": "^7.19.0",
106
+ "@babel/runtime": "^7.19.4",
107
107
  "@commitlint/cli": "17.1.2",
108
108
  "@commitlint/config-conventional": "^17.1.0",
109
- "@rollup/plugin-babel": "^5.3.1",
110
- "@rollup/plugin-node-resolve": "^14.1.0",
111
- "@rollup/plugin-replace": "^4.0.0",
112
- "@rollup/plugin-typescript": "^8.5.0",
109
+ "@rollup/plugin-babel": "^6.0.0",
110
+ "@rollup/plugin-node-resolve": "^15.0.0",
111
+ "@rollup/plugin-replace": "^5.0.0",
112
+ "@rollup/plugin-typescript": "^9.0.1",
113
113
  "@semantic-release/changelog": "^6.0.1",
114
114
  "@semantic-release/commit-analyzer": "^9.0.2",
115
115
  "@semantic-release/exec": "^6.0.3",
@@ -118,10 +118,10 @@
118
118
  "@semantic-release/release-notes-generator": "^10.0.3",
119
119
  "@types/chai": "^4.3.3",
120
120
  "@types/d3": "^7.4.0",
121
- "@types/mocha": "^9.1.1",
121
+ "@types/mocha": "^10.0.0",
122
122
  "@types/sinon": "^10.0.13",
123
- "@typescript-eslint/eslint-plugin": "^5.38.0",
124
- "@typescript-eslint/parser": "^5.38.0",
123
+ "@typescript-eslint/eslint-plugin": "^5.40.1",
124
+ "@typescript-eslint/parser": "^5.40.1",
125
125
  "babel-helper-modules": "^6.0.0",
126
126
  "babel-loader": "^8.2.5",
127
127
  "babel-plugin-add-module-exports": "^1.0.4",
@@ -137,27 +137,27 @@
137
137
  "chai": "^4.3.4",
138
138
  "clean-webpack-plugin": "^4.0.0",
139
139
  "cloc": "^2.10.0",
140
- "core-js": "^3.25.2",
140
+ "core-js": "^3.25.5",
141
141
  "coveralls": "^3.1.1",
142
142
  "cross-env": "^7.0.3",
143
143
  "css-loader": "^6.7.1",
144
- "css-minimizer-webpack-plugin": "^4.1.0",
144
+ "css-minimizer-webpack-plugin": "^4.2.2",
145
145
  "d3-color": "^3.1.0",
146
146
  "d3-delaunay": "^6.0.2",
147
147
  "d3-format": "^3.1.0",
148
148
  "d3-polygon": "^3.0.1",
149
149
  "docdash": "^1.2.0",
150
150
  "dtslint": "^4.2.1",
151
- "eslint": "^8.23.1",
151
+ "eslint": "^8.25.0",
152
152
  "eslint-config-naver": "^2.1.0",
153
153
  "eslint-plugin-import": "^2.26.0",
154
- "eslint-plugin-jsdoc": "^39.3.6",
154
+ "eslint-plugin-jsdoc": "^39.3.13",
155
155
  "eslint-webpack-plugin": "^3.2.0",
156
156
  "exports-loader": "^4.0.0",
157
157
  "hammer-simulator": "0.0.1",
158
158
  "husky": "^8.0.1",
159
159
  "istanbul-instrumenter-loader": "^3.0.1",
160
- "istanbul-lib-instrument": "^5.2.0",
160
+ "istanbul-lib-instrument": "^5.2.1",
161
161
  "jsdoc": "^3.6.11",
162
162
  "karma": "^6.4.1",
163
163
  "karma-chai": "^0.1.0",
@@ -172,20 +172,20 @@
172
172
  "lint-staged": "^13.0.3",
173
173
  "lite-fixture": "^1.0.2",
174
174
  "mini-css-extract-plugin": "^2.6.1",
175
- "mocha": "^10.0.0",
175
+ "mocha": "^10.1.0",
176
176
  "node-sass": "^7.0.3",
177
- "regenerator-runtime": "^0.13.7",
178
- "rollup": "^2.79.1",
177
+ "regenerator-runtime": "^0.13.10",
178
+ "rollup": "^3.2.3",
179
179
  "rollup-plugin-delete": "^2.0.0",
180
- "sass-loader": "^13.0.2",
180
+ "sass-loader": "^13.1.0",
181
181
  "semantic-release": "^19.0.5",
182
182
  "simulant": "^0.2.2",
183
- "sinon": "^14.0.0",
183
+ "sinon": "^14.0.1",
184
184
  "string-replace-loader": "^3.1.0",
185
185
  "style-loader": "^3.3.1",
186
186
  "terser-webpack-plugin": "^5.3.6",
187
187
  "tslib": "^2.4.0",
188
- "typescript": "4.8.3",
188
+ "typescript": "4.8.4",
189
189
  "webpack": "^5.74.0",
190
190
  "webpack-bundle-analyzer": "^4.6.1",
191
191
  "webpack-clean": "^1.2.5",
@@ -2,12 +2,18 @@
2
2
  * Copyright (c) 2017 ~ present NAVER Corp.
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
- export interface IDataRow {
6
- x: number;
5
+ type TDataRow = {
7
6
  value: number | null;
8
7
  id: string;
9
8
  index: number;
10
9
  name?: string;
10
+ };
11
+
12
+ export interface IDataRow extends TDataRow {
13
+ x: number;
14
+ }
15
+ export interface IArcDataRow extends TDataRow {
16
+ ratio: number;
11
17
  }
12
18
 
13
19
  export interface IData {
@@ -7,6 +7,7 @@ import {drag as d3Drag} from "d3-drag";
7
7
  import {$ARC, $AXIS, $COMMON, $SHAPE} from "../../config/classes";
8
8
  import {KEY} from "../../module/Cache";
9
9
  import {emulateEvent, getPointer, isNumber, isObject} from "../../module/util";
10
+ import type {IArcDataRow} from "../data/IData";
10
11
 
11
12
  export default {
12
13
  selectRectForSingle(context, eventRect, index: number): void {
@@ -27,24 +28,26 @@ export default {
27
28
  }
28
29
  }
29
30
 
30
- main.selectAll(`.${$SHAPE.shape}-${index}`)
31
+ const shapeAtIndex = main.selectAll(`.${$SHAPE.shape}-${index}`)
31
32
  .each(function() {
32
33
  d3Select(this).classed($COMMON.EXPANDED, true);
33
34
 
34
35
  if (isSelectionEnabled) {
35
36
  eventRect.style("cursor", isSelectionGrouped ? "pointer" : null);
36
37
  }
37
-
38
- if (!isTooltipGrouped) {
39
- $$.hideGridFocus?.();
40
- $$.hideTooltip();
41
-
42
- !isSelectionGrouped && $$.setExpand(index);
43
- }
44
38
  })
45
39
  .filter(function(d) {
46
40
  return $$.isWithinShape(this, d);
47
- })
41
+ });
42
+
43
+ if (shapeAtIndex.empty() && !isTooltipGrouped) {
44
+ $$.hideGridFocus?.();
45
+ $$.hideTooltip();
46
+
47
+ !isSelectionGrouped && $$.setExpand(index);
48
+ }
49
+
50
+ shapeAtIndex
48
51
  .call(selected => {
49
52
  const d = selected.data();
50
53
 
@@ -107,42 +110,52 @@ export default {
107
110
  * @param {number|object} d data object
108
111
  * @private
109
112
  */
110
- setOverOut(isOver: boolean, d): void {
113
+ setOverOut(isOver: boolean, d: number | IArcDataRow): void {
111
114
  const $$ = this;
112
115
  const {config, state: {hasRadar}, $el: {main}} = $$;
113
116
  const isArc = isObject(d);
114
117
 
115
118
  // Call event handler
116
119
  if (isArc || d !== -1) {
117
- let callback = config[isOver ? "data_onover" : "data_onout"].bind($$.api);
120
+ const callback = config[isOver ? "data_onover" : "data_onout"].bind($$.api);
118
121
 
119
122
  config.color_onover && $$.setOverColor(isOver, d, isArc);
120
123
 
121
- if (isArc) {
122
- callback(d, main.select(`.${$ARC.arc}${$$.getTargetSelectorSuffix(d.id)}`).node());
124
+ if (isArc && "id") {
125
+ callback(d, main.select(`.${$ARC.arc}${$$.getTargetSelectorSuffix((d as IArcDataRow).id)}`).node());
123
126
  } else if (!config.tooltip_grouped) {
124
- let last = $$.cache.get(KEY.setOverOut) || [];
127
+ const last = $$.cache.get(KEY.setOverOut) || [];
125
128
 
126
- const shape = main.selectAll(`.${$SHAPE.shape}-${d}`)
129
+ // select based on the index
130
+ const shapesAtIndex = main.selectAll(`.${$SHAPE.shape}-${d}`)
127
131
  .filter(function(d) {
128
132
  return $$.isWithinShape(this, d);
129
133
  });
130
134
 
131
- shape
132
- .each(function(d) {
133
- if (last.length === 0 || last.every(v => v !== this)) {
134
- callback(d, this);
135
- last.push(this);
136
- }
137
- });
135
+ // filter if has new selection
136
+ const shape = shapesAtIndex.filter(function() {
137
+ return last.every(v => v !== this);
138
+ });
138
139
 
139
- if (last.length > 0 && shape.empty()) {
140
- callback = config.data_onout.bind($$.api);
140
+ // call onout callback
141
+ if (!isOver || shapesAtIndex.empty() || (
142
+ last.length === shape.size() && shape.nodes().every(((v, i) => v !== last[i]))
143
+ )) {
144
+ while (last.length) {
145
+ const target = last.pop();
141
146
 
142
- last.forEach(v => callback(d3Select(v).datum(), v));
143
- last = [];
147
+ config.data_onout.bind($$.api)(d3Select(target).datum(), target);
148
+ }
144
149
  }
145
150
 
151
+ // call onover callback
152
+ shape.each(function() {
153
+ if (isOver) {
154
+ callback(d3Select(this).datum(), this);
155
+ last.push(this);
156
+ }
157
+ });
158
+
146
159
  $$.cache.add(KEY.setOverOut, last);
147
160
  } else {
148
161
  if (isOver) {
@@ -193,6 +193,56 @@ export default {
193
193
  }
194
194
  },
195
195
 
196
+ /**
197
+ * Get data gradient color url
198
+ * @param {string} id Data id
199
+ * @returns {string}
200
+ * @private
201
+ */
202
+ getGradienColortUrl(id: string): string {
203
+ return `url(#${this.state.datetimeId}-gradient${this.getTargetSelectorSuffix(id)})`;
204
+ },
205
+
206
+ /**
207
+ * Update linear gradient definition (for area & bar only)
208
+ * @private
209
+ */
210
+ updateLinearGradient(): void {
211
+ const $$ = this;
212
+ const {config, data: {targets}, state: {datetimeId}, $el: {defs}} = $$;
213
+
214
+ targets.forEach(d => {
215
+ const id = `${datetimeId}-gradient${$$.getTargetSelectorSuffix(d.id)}`;
216
+ const supportedType = ($$.isAreaType(d) && "area") || ($$.isBarType(d) && "bar");
217
+ const isRotated = config.axis_rotated;
218
+
219
+ if (supportedType && defs.select(`#${id}`).empty()) {
220
+ const color = $$.color(d);
221
+ const {
222
+ x = isRotated ? [1, 0] : [0, 0],
223
+ y = isRotated ? [0, 0] : [0, 1],
224
+ stops = [[0, color, 1], [1, color, 0]]
225
+ } = config[`${supportedType}_linearGradient`];
226
+
227
+ const linearGradient = defs.append("linearGradient")
228
+ .attr("id", `${id}`)
229
+ .attr("x1", x[0])
230
+ .attr("x2", x[1])
231
+ .attr("y1", y[0])
232
+ .attr("y2", y[1]);
233
+
234
+ stops.forEach(v => {
235
+ const stopColor = isFunction(v[1]) ? v[1].bind($$.api)(d.id) : v[1];
236
+
237
+ linearGradient.append("stop")
238
+ .attr("offset", v[0])
239
+ .attr("stop-color", stopColor || color)
240
+ .attr("stop-opacity", v[2]);
241
+ });
242
+ }
243
+ });
244
+ },
245
+
196
246
  /**
197
247
  * Set the data over color.
198
248
  * When is out, will restate in its previous color value