billboard.js 3.5.0 → 3.6.0-next.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 (75) hide show
  1. package/README.md +12 -2
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +159 -98
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +2 -2
  6. package/dist/billboard.pkgd.js +2416 -2173
  7. package/dist/billboard.pkgd.min.js +3 -3
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +2 -71
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.js +2 -71
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.js +2 -71
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -71
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2259 -2077
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2260 -2147
  20. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2261 -2148
  21. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2262 -2149
  22. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +2263 -2150
  23. package/dist/theme/datalab.css +1 -1
  24. package/dist/theme/datalab.min.css +1 -1
  25. package/dist/theme/graph.css +1 -1
  26. package/dist/theme/graph.min.css +1 -1
  27. package/dist/theme/insight.css +1 -1
  28. package/dist/theme/insight.min.css +1 -1
  29. package/dist-esm/billboard.js +149 -94
  30. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  31. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  32. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  33. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  34. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  35. package/package.json +30 -28
  36. package/src/Chart/api/data.ts +2 -2
  37. package/src/Chart/api/group.ts +1 -1
  38. package/src/Chart/api/selection.ts +1 -1
  39. package/src/ChartInternal/Axis/AxisRenderer.ts +3 -3
  40. package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -1
  41. package/src/ChartInternal/ChartInternal.ts +3 -3
  42. package/src/ChartInternal/data/convert.ts +4 -3
  43. package/src/ChartInternal/data/data.ts +1 -1
  44. package/src/ChartInternal/interactions/drag.ts +1 -1
  45. package/src/ChartInternal/internals/color.ts +5 -2
  46. package/src/ChartInternal/internals/domain.ts +1 -1
  47. package/src/ChartInternal/internals/format.ts +1 -1
  48. package/src/ChartInternal/internals/grid.ts +0 -1
  49. package/src/ChartInternal/internals/legend.ts +3 -2
  50. package/src/ChartInternal/internals/region.ts +1 -1
  51. package/src/ChartInternal/internals/scale.ts +1 -1
  52. package/src/ChartInternal/internals/size.axis.ts +1 -1
  53. package/src/ChartInternal/internals/style.ts +2 -2
  54. package/src/ChartInternal/internals/text.ts +2 -2
  55. package/src/ChartInternal/internals/tooltip.ts +1 -1
  56. package/src/ChartInternal/shape/arc.ts +3 -3
  57. package/src/ChartInternal/shape/area.ts +3 -2
  58. package/src/ChartInternal/shape/bar.ts +2 -2
  59. package/src/ChartInternal/shape/line.ts +5 -1
  60. package/src/ChartInternal/shape/point.ts +1 -1
  61. package/src/ChartInternal/shape/polar.ts +1 -1
  62. package/src/ChartInternal/shape/shape.ts +16 -8
  63. package/src/Plugin/sparkline/index.ts +1 -1
  64. package/src/Plugin/textoverlap/index.ts +1 -1
  65. package/src/config/Options/common/grid.ts +2 -2
  66. package/src/config/Options/common/legend.ts +3 -2
  67. package/src/config/Options/data/data.ts +19 -1
  68. package/src/config/Store/Element.ts +1 -1
  69. package/src/module/Cache.ts +1 -1
  70. package/src/module/generator.ts +1 -1
  71. package/src/module/util.ts +1 -74
  72. package/src/module/worker.ts +101 -0
  73. package/types/axis.d.ts +18 -3
  74. package/types/index.d.ts +1 -0
  75. package/types/options.d.ts +9 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "billboard.js",
3
- "version": "3.5.0",
3
+ "version": "3.6.0-next.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",
@@ -42,6 +42,7 @@
42
42
  "coveralls": "cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
43
43
  "jsdoc": "node ./config/jsdoc.js",
44
44
  "jsdoc:cmd": "jsdoc -c jsdoc.json",
45
+ "lint-staged": "lint-staged --config ./config/.lintstagedrc.json",
45
46
  "prepare": "husky install"
46
47
  },
47
48
  "sideEffects": [
@@ -95,32 +96,32 @@
95
96
  "d3-zoom": "^3.0.0"
96
97
  },
97
98
  "devDependencies": {
98
- "@babel/core": "^7.18.6",
99
- "@babel/eslint-parser": "^7.17.0",
99
+ "@babel/core": "^7.19.1",
100
+ "@babel/eslint-parser": "^7.19.1",
100
101
  "@babel/plugin-proposal-class-properties": "^7.18.6",
101
- "@babel/plugin-proposal-object-rest-spread": "^7.18.6",
102
- "@babel/plugin-transform-runtime": "^7.18.6",
103
- "@babel/preset-env": "^7.18.6",
102
+ "@babel/plugin-proposal-object-rest-spread": "^7.18.9",
103
+ "@babel/plugin-transform-runtime": "^7.19.1",
104
+ "@babel/preset-env": "^7.19.1",
104
105
  "@babel/preset-typescript": "^7.18.6",
105
- "@babel/runtime": "^7.18.6",
106
- "@commitlint/cli": "^15.0.0",
107
- "@commitlint/config-conventional": "^17.0.3",
106
+ "@babel/runtime": "^7.19.0",
107
+ "@commitlint/cli": "15.0.0",
108
+ "@commitlint/config-conventional": "^17.1.0",
108
109
  "@rollup/plugin-babel": "^5.3.1",
109
- "@rollup/plugin-node-resolve": "^13.2.1",
110
+ "@rollup/plugin-node-resolve": "^14.1.0",
110
111
  "@rollup/plugin-replace": "^4.0.0",
111
- "@rollup/plugin-typescript": "^8.3.3",
112
+ "@rollup/plugin-typescript": "^8.5.0",
112
113
  "@semantic-release/changelog": "^6.0.1",
113
114
  "@semantic-release/commit-analyzer": "^9.0.2",
114
115
  "@semantic-release/exec": "^6.0.3",
115
116
  "@semantic-release/git": "^10.0.1",
116
117
  "@semantic-release/npm": "^9.0.1",
117
118
  "@semantic-release/release-notes-generator": "^10.0.3",
118
- "@types/chai": "^4.3.1",
119
+ "@types/chai": "^4.3.3",
119
120
  "@types/d3": "^7.4.0",
120
121
  "@types/mocha": "^9.1.1",
121
- "@types/sinon": "^10.0.11",
122
- "@typescript-eslint/eslint-plugin": "^5.30.0",
123
- "@typescript-eslint/parser": "^5.30.0",
122
+ "@types/sinon": "^10.0.13",
123
+ "@typescript-eslint/eslint-plugin": "^5.37.0",
124
+ "@typescript-eslint/parser": "^5.37.0",
124
125
  "babel-helper-modules": "^6.0.0",
125
126
  "babel-loader": "^8.2.5",
126
127
  "babel-plugin-add-module-exports": "^1.0.4",
@@ -135,29 +136,29 @@
135
136
  "better-docs": "^2.7.2",
136
137
  "chai": "^4.3.4",
137
138
  "clean-webpack-plugin": "^4.0.0",
138
- "cloc": "^2.9.0",
139
- "core-js": "^3.23.3",
139
+ "cloc": "^2.10.0",
140
+ "core-js": "^3.25.1",
140
141
  "coveralls": "^3.1.1",
141
142
  "cross-env": "^7.0.3",
142
143
  "css-loader": "^6.7.1",
143
- "css-minimizer-webpack-plugin": "^4.0.0",
144
+ "css-minimizer-webpack-plugin": "^4.1.0",
144
145
  "d3-color": "^3.1.0",
145
146
  "d3-delaunay": "^6.0.2",
146
147
  "d3-format": "^3.1.0",
147
148
  "d3-polygon": "^3.0.1",
148
149
  "docdash": "^1.2.0",
149
150
  "dtslint": "^4.2.1",
150
- "eslint": "^8.18.0",
151
+ "eslint": "^8.23.1",
151
152
  "eslint-config-naver": "^2.1.0",
152
153
  "eslint-plugin-import": "^2.26.0",
153
- "eslint-plugin-jsdoc": "^39.3.3",
154
+ "eslint-plugin-jsdoc": "^39.3.6",
154
155
  "eslint-webpack-plugin": "^3.2.0",
155
156
  "exports-loader": "^4.0.0",
156
157
  "hammer-simulator": "0.0.1",
157
158
  "husky": "^8.0.1",
158
159
  "istanbul-instrumenter-loader": "^3.0.1",
159
160
  "istanbul-lib-instrument": "^5.2.0",
160
- "jsdoc": "^3.6.10",
161
+ "jsdoc": "^3.6.11",
161
162
  "karma": "^6.4.0",
162
163
  "karma-chai": "^0.1.0",
163
164
  "karma-chrome-launcher": "^3.1.1",
@@ -168,28 +169,29 @@
168
169
  "karma-sinon": "^1.0.5",
169
170
  "karma-sourcemap-loader": "^0.3.8",
170
171
  "karma-webpack": "^5.0.0",
172
+ "lint-staged": "^13.0.3",
171
173
  "lite-fixture": "^1.0.2",
172
174
  "mini-css-extract-plugin": "^2.6.1",
173
175
  "mocha": "^10.0.0",
174
- "node-sass": "^7.0.1",
176
+ "node-sass": "^7.0.3",
175
177
  "regenerator-runtime": "^0.13.7",
176
- "rollup": "^2.75.7",
178
+ "rollup": "^2.79.0",
177
179
  "rollup-plugin-delete": "^2.0.0",
178
180
  "sass-loader": "^13.0.2",
179
- "semantic-release": "^19.0.3",
181
+ "semantic-release": "^19.0.5",
180
182
  "simulant": "^0.2.2",
181
183
  "sinon": "^14.0.0",
182
184
  "string-replace-loader": "^3.1.0",
183
185
  "style-loader": "^3.3.1",
184
- "terser-webpack-plugin": "^5.3.3",
186
+ "terser-webpack-plugin": "^5.3.6",
185
187
  "tslib": "^2.4.0",
186
188
  "typescript": "4.6.2",
187
- "webpack": "^5.73.0",
188
- "webpack-bundle-analyzer": "^4.5.0",
189
+ "webpack": "^5.74.0",
190
+ "webpack-bundle-analyzer": "^4.6.1",
189
191
  "webpack-clean": "^1.2.5",
190
192
  "webpack-cli": "^4.10.0",
191
193
  "webpack-common-shake": "^2.1.0",
192
- "webpack-dev-server": "^4.9.2",
194
+ "webpack-dev-server": "^4.11.0",
193
195
  "webpack-merge": "^5.8.0",
194
196
  "webpackbar": "^5.0.2",
195
197
  "write-file-webpack-plugin": "^4.5.1"
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) 2017 ~ present NAVER Corp.
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
- import {DataItem} from "../../../types/types";
5
+ import type {DataItem} from "../../../types/types";
6
6
  import {extend, isUndefined, isArray} from "../../module/util";
7
- import {IDataRow} from "../../ChartInternal/data/IData";
7
+ import type {IDataRow} from "../../ChartInternal/data/IData";
8
8
 
9
9
  /**
10
10
  * Get data loaded in the chart.
@@ -18,7 +18,7 @@ export default {
18
18
  * ["data1", "data2"]
19
19
  * ]);
20
20
  */
21
- groups(groups: string[][]): string[][] {
21
+ groups<T = string[][]>(groups: T): T {
22
22
  const $$ = this.internal;
23
23
  const {config} = $$;
24
24
 
@@ -5,7 +5,7 @@
5
5
  import {select as d3Select} from "d3-selection";
6
6
  import {isDefined} from "../../module/util";
7
7
  import {$AREA, $LINE, $SELECT, $SHAPE} from "../../config/classes";
8
- import {DataItem} from "../../../types/types";
8
+ import type {DataItem} from "../../../types/types";
9
9
 
10
10
  export default {
11
11
  /**
@@ -4,7 +4,7 @@
4
4
  * @ignore
5
5
  */
6
6
  import {select as d3Select} from "d3-selection";
7
- import {d3Selection} from "../../../types/types";
7
+ import type {d3Selection} from "../../../types/types";
8
8
  import Helper from "./AxisRendererHelper";
9
9
  import {isArray, toArray, isFunction, isString, isNumber} from "../../module/util";
10
10
 
@@ -239,11 +239,11 @@ export default class AxisRenderer {
239
239
  * @private
240
240
  */
241
241
  getGeneratedTicks(count: number): (Date|number)[] {
242
- const len = this.generatedTicks.length - 1;
242
+ const len = this.generatedTicks?.length - 1;
243
243
  let res = this.generatedTicks;
244
244
 
245
245
  if (len > count) {
246
- const interval = Math.round((len / count) - 0.1);
246
+ const interval = Math.round((len / count) + 0.1);
247
247
 
248
248
  res = this.generatedTicks
249
249
  .map((v, i) => (i % interval === 0 ? v : null))
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import {getScale} from "../internals/scale";
7
7
  import {isDefined, isNumber, isString} from "../../module/util";
8
- import {d3Selection} from "../../../types/types";
8
+ import type {d3Selection} from "../../../types/types";
9
9
 
10
10
  export default class AxisRendererHelper {
11
11
  private owner;
@@ -10,7 +10,7 @@ import {
10
10
  utcFormat as d3UtcFormat
11
11
  } from "d3-time-format";
12
12
  import {select as d3Select} from "d3-selection";
13
- import {d3Selection} from "../../types/types";
13
+ import type {d3Selection} from "../../types/types";
14
14
  import {checkModuleImport} from "../module/error";
15
15
  import {$COMMON, $CIRCLE, $TEXT} from "../config/classes";
16
16
  import Store from "../config/Store/Store";
@@ -44,7 +44,7 @@ import text from "./internals/text";
44
44
  import title from "./internals/title";
45
45
  import tooltip from "./internals/tooltip";
46
46
  import transform from "./internals/transform";
47
- import type from "./internals/type";
47
+ import typeInternals from "./internals/type";
48
48
 
49
49
  /**
50
50
  * Internal chart class.
@@ -807,5 +807,5 @@ extend(ChartInternal.prototype, [
807
807
  title,
808
808
  tooltip,
809
809
  transform,
810
- type
810
+ typeInternals
811
811
  ]);
@@ -2,9 +2,10 @@
2
2
  * Copyright (c) 2017 ~ present NAVER Corp.
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
- import {runWorker, isUndefined, isDefined, isObject, isValue, notEmpty, isArray} from "../../module/util";
5
+ import {isUndefined, isDefined, isObject, isValue, notEmpty, isArray} from "../../module/util";
6
+ import {runWorker} from "../../module/worker";
6
7
  import {columns, json, rows, url} from "./convert.helper";
7
- import {IData} from "../data/IData";
8
+ import type {IData} from "../data/IData";
8
9
 
9
10
  /**
10
11
  * Get data key for JSON
@@ -198,7 +199,7 @@ export default {
198
199
  t.values.forEach((v, i) => (v.index = i));
199
200
 
200
201
  // this needs to be sorted because its index and value.index is identical
201
- $$.data.xs[t.id].sort((v1, v2) => v1 - v2);
202
+ $$.data.xs[t.id]?.sort((v1, v2) => v1 - v2);
202
203
  });
203
204
 
204
205
  // cache information about values
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import {$BAR, $CANDLESTICK, $COMMON} from "../../config/classes";
6
6
  import {KEY} from "../../module/Cache";
7
- import {IData, IDataRow} from "./IData";
7
+ import type {IData, IDataRow} from "./IData";
8
8
  import {
9
9
  findIndex,
10
10
  getUnique,
@@ -3,7 +3,7 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {select as d3Select} from "d3-selection";
6
- import {d3Selection} from "../../../types/types";
6
+ import type {d3Selection} from "../../../types/types";
7
7
  import {$BAR, $CIRCLE, $COMMON, $DRAG, $SELECT, $SHAPE} from "../../config/classes";
8
8
  import {getPathBox} from "../../module/util";
9
9
 
@@ -8,7 +8,7 @@ import {document} from "../../module/browser";
8
8
  import {$ARC, $COLOR, $SHAPE} from "../../config/classes";
9
9
  import {KEY} from "../../module/Cache";
10
10
  import {notEmpty, isFunction, isObject, isString} from "../../module/util";
11
- import {IArcData, IDataRow} from "../data/IData";
11
+ import type {IArcData, IDataRow} from "../data/IData";
12
12
  import {d3Selection} from "../../../types";
13
13
 
14
14
  /**
@@ -103,7 +103,10 @@ export default {
103
103
  }
104
104
 
105
105
  return function(d: IDataRow | IArcData | string): string {
106
- const id: string = (d as IDataRow).id || (d as IArcData).data?.id || d as string;
106
+ const id: string = (d as IDataRow).id ||
107
+ (d as IArcData).data?.id ||
108
+ d as string;
109
+
107
110
  const isLine = $$.isTypeOf(id, ["line", "spline", "step"]) || !config.data_types[id];
108
111
  let color;
109
112
 
@@ -3,7 +3,7 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {TYPE, TYPE_BY_CATEGORY} from "../../config/const";
6
- import {IData} from "../data/IData";
6
+ import type {IData} from "../data/IData";
7
7
  import {brushEmpty, getBrushSelection, getMinMax, isDefined, notEmpty, isValue, isObject, isNumber, diffDomain, parseDate, sortValue} from "../../module/util";
8
8
 
9
9
  export default {
@@ -3,7 +3,7 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {isValue, isFunction, isObjectType} from "../../module/util";
6
- import {AxisType} from "../../../types/types";
6
+ import type {AxisType} from "../../../types/types";
7
7
 
8
8
  /**
9
9
  * Get formatted
@@ -136,7 +136,6 @@ export default {
136
136
  const {axis, config, scale, state, $el: {grid, main}} = $$;
137
137
  const isRotated = config.axis_rotated;
138
138
  const pos = d => Math.ceil(scale.y(d));
139
-
140
139
  const gridValues =
141
140
  axis.y.getGeneratedTicks(config.grid_y_ticks) || $$.scale.y.ticks(config.grid_y_ticks);
142
141
 
@@ -606,10 +606,11 @@ export default {
606
606
 
607
607
  const getColor = id => {
608
608
  const data = $$.getDataById(id);
609
-
610
- return $$.levelColor ?
609
+ const color = $$.levelColor ?
611
610
  $$.levelColor(data.values[0].value) :
612
611
  $$.color(data);
612
+
613
+ return color;
613
614
  };
614
615
 
615
616
  const usePoint = config.legend_usePoint;
@@ -5,7 +5,7 @@
5
5
  import {select as d3Select} from "d3-selection"; // selection
6
6
  import {$REGION} from "../../config/classes";
7
7
  import {isValue, parseDate} from "../../module/util";
8
- import {AxisType} from "../../../types/types";
8
+ import type {AxisType} from "../../../types/types";
9
9
 
10
10
  export default {
11
11
  initRegion() {
@@ -10,7 +10,7 @@ import {
10
10
  scaleSymlog as d3ScaleSymlog
11
11
  } from "d3-scale";
12
12
  import {isString, isValue, parseDate} from "../../module/util";
13
- import {IDataRow, IGridData} from "../data/IData";
13
+ import type {IDataRow, IGridData} from "../data/IData";
14
14
 
15
15
 
16
16
  /**
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2017 ~ present NAVER Corp.
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
- import {AxisType} from "../../../types/types";
5
+ import type {AxisType} from "../../../types/types";
6
6
 
7
7
  export default {
8
8
  /**
@@ -3,8 +3,8 @@
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
5
  import {$SHAPE} from "../../config/classes";
6
- import {d3Selection} from "../../../types/types";
7
- import {IDataRow} from "../data/IData";
6
+ import type {d3Selection} from "../../../types/types";
7
+ import type {IDataRow} from "../data/IData";
8
8
  import {addCssRules, isFunction, isString} from "../../module/util";
9
9
 
10
10
  export default {
@@ -9,8 +9,8 @@ import {
9
9
  import {KEY} from "../../module/Cache";
10
10
  import {$COMMON, $TEXT} from "../../config/classes";
11
11
  import {capitalize, getBoundingRect, getRandom, isFunction, isNumber, isObject, isString, getTranslation, setTextValue} from "../../module/util";
12
- import {IDataRow, IArcData} from "../data/IData";
13
- import {AxisType} from "../../../types/types";
12
+ import type {IDataRow, IArcData} from "../data/IData";
13
+ import type {AxisType} from "../../../types/types";
14
14
 
15
15
  type Coord = {x: number, y: number};
16
16
  type Anchor = "start" | "middle" | "end";
@@ -5,7 +5,7 @@
5
5
  import {select as d3Select} from "d3-selection";
6
6
  import {document} from "../../module/browser";
7
7
  import {$ARC, $TOOLTIP} from "../../config/classes";
8
- import {IDataRow} from "../data/IData";
8
+ import type {IDataRow} from "../data/IData";
9
9
  import {getPointer, isFunction, isObject, isString, isValue, callFn, sanitise, tplProcess, isUndefined, parseDate} from "../../module/util";
10
10
 
11
11
  export default {
@@ -11,8 +11,8 @@ import {interpolate as d3Interpolate} from "d3-interpolate";
11
11
  import {document} from "../../module/browser";
12
12
  import {$ARC, $COMMON, $FOCUS, $GAUGE} from "../../config/classes";
13
13
  import {callFn, endall, isFunction, isNumber, isObject, isUndefined, setTextValue} from "../../module/util";
14
- import {d3Selection} from "../../../types/types";
15
- import {IArcData, IData} from "../data/IData";
14
+ import type {d3Selection} from "../../../types/types";
15
+ import type {IArcData, IData} from "../data/IData";
16
16
 
17
17
  export default {
18
18
  initPie(): void {
@@ -45,7 +45,7 @@ export default {
45
45
 
46
46
  // determine radius
47
47
  state.radiusExpanded = Math.min(state.arcWidth, state.arcHeight) / 2 * (
48
- $$.hasMultiArcGauge() ? 0.85 : 1
48
+ $$.hasMultiArcGauge() && config.gauge_label_show ? 0.85 : 1
49
49
  );
50
50
 
51
51
  state.radius = state.radiusExpanded * 0.95;
@@ -6,7 +6,7 @@ import {area as d3Area} from "d3-shape";
6
6
  import {select as d3Select} from "d3-selection";
7
7
  import {$AREA, $CIRCLE, $LINE} from "../../config/classes";
8
8
  import {getRandom, isFunction} from "../../module/util";
9
- import {IData, IDataRow} from "../data/IData";
9
+ import type {IData, IDataRow} from "../data/IData";
10
10
  import {d3Selection} from "../../../types";
11
11
 
12
12
  type Indices = {[key: string | "__max__"]: number};
@@ -202,11 +202,12 @@ export default {
202
202
  const y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id));
203
203
  const offset = areaOffset(d, i) || y0; // offset is for stacked area chart
204
204
  const posX = x(d);
205
+ const value = d.value as number;
205
206
  let posY = y(d);
206
207
 
207
208
  // fix posY not to overflow opposite quadrant
208
209
  if (config.axis_rotated && (
209
- (d.value > 0 && posY < y0) || (d.value < 0 && y0 < posY)
210
+ (value > 0 && posY < y0) || (value < 0 && y0 < posY)
210
211
  )) {
211
212
  posY = y0;
212
213
  }
@@ -2,10 +2,10 @@
2
2
  * Copyright (c) 2017 ~ present NAVER Corp.
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
- import {DataRow} from "../../../types/types";
5
+ import type {DataRow} from "../../../types/types";
6
6
  import {$BAR, $COMMON} from "../../config/classes";
7
7
  import {getRandom, isNumber} from "../../module/util";
8
- import {IDataRow} from "../data/IData";
8
+ import type {IDataRow} from "../data/IData";
9
9
 
10
10
  type BarTypeDataRow = DataRow<number | number[]>;
11
11
 
@@ -45,7 +45,11 @@ export default {
45
45
 
46
46
  // Areas
47
47
  if ($$.hasTypeOf("Area")) {
48
- $$.initArea(!area && mainLineEnter.empty() ? mainLineUpdate : mainLineEnter);
48
+ const mainLine = (
49
+ !area && mainLineEnter.empty() ? mainLineUpdate : mainLineEnter
50
+ ).filter($$.isAreaType.bind($$));
51
+
52
+ $$.initArea(mainLine);
49
53
  }
50
54
 
51
55
  $$.updateTargetForCircle(targets, mainLineEnter);
@@ -6,7 +6,7 @@ import {
6
6
  namespaces as d3Namespaces,
7
7
  select as d3Select
8
8
  } from "d3-selection";
9
- import {d3Selection} from "../../../types/types";
9
+ import type {d3Selection} from "../../../types/types";
10
10
  import {$CIRCLE, $COMMON, $SELECT} from "../../config/classes";
11
11
  import {document} from "../../module/browser";
12
12
  import {getBoundingRect, getPointer, getRandom, isFunction, isObject, isObjectType, isUndefined, isValue, toArray, notEmpty} from "../../module/util";
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import {$LEVEL} from "../../config/classes";
6
6
  import {getRange} from "../../module/util";
7
- import {IArcData, IData} from "../data/IData";
7
+ import type {IArcData, IData} from "../data/IData";
8
8
 
9
9
  /**
10
10
  * Get data max value
@@ -23,10 +23,10 @@ import {
23
23
  curveStep as d3CurveStep
24
24
  } from "d3-shape";
25
25
  import {select as d3Select} from "d3-selection";
26
- import {d3Selection} from "../../../types/types";
26
+ import type {d3Selection} from "../../../types/types";
27
27
  import CLASS from "../../config/classes";
28
28
  import {capitalize, getPointer, getRectSegList, getUnique, isObjectType, isNumber, isValue, isUndefined, notEmpty} from "../../module/util";
29
- import {IDataRow, IDataIndice, TIndices} from "../data/IData";
29
+ import type {IDataRow, IDataIndice, TIndices} from "../data/IData";
30
30
 
31
31
  export default {
32
32
  /**
@@ -305,6 +305,7 @@ export default {
305
305
  getShapeOffset(typeFilter, indices, isSub?: boolean): Function {
306
306
  const $$ = this;
307
307
  const {shapeOffsetTargets, indexMapByTargetId} = $$.getShapeOffsetData(typeFilter);
308
+ const groupsZeroAs = $$.config.data_groupsZeroAs;
308
309
 
309
310
  return (d, idx) => {
310
311
  const {id, value, x} = d;
@@ -316,18 +317,18 @@ export default {
316
317
  return scale(value[0]);
317
318
  }
318
319
 
319
- const y0 = scale($$.getShapeYMin(id));
320
-
321
320
  const dataXAsNumber = Number(x);
321
+ const y0 = scale(groupsZeroAs === "zero" ? 0 : $$.getShapeYMin(id));
322
322
  let offset = y0;
323
323
 
324
324
  shapeOffsetTargets
325
- .filter(t => t.id !== id)
325
+ .filter(t => t.id !== id && ind[t.id] === ind[id])
326
326
  .forEach(t => {
327
327
  const {id: tid, rowValueMapByXValue, rowValues, values: tvalues} = t;
328
328
 
329
329
  // for same stacked group (ind[tid] === ind[id])
330
- if (ind[tid] === ind[id] && indexMapByTargetId[tid] < indexMapByTargetId[id]) {
330
+ if (indexMapByTargetId[tid] < indexMapByTargetId[id]) {
331
+ const rValue = tvalues[dataXAsNumber];
331
332
  let row = rowValues[idx];
332
333
 
333
334
  // check if the x values line up
@@ -335,8 +336,15 @@ export default {
335
336
  row = rowValueMapByXValue[dataXAsNumber];
336
337
  }
337
338
 
338
- if (row?.value * value >= 0 && isNumber(tvalues[dataXAsNumber])) {
339
- offset += scale(tvalues[dataXAsNumber]) - y0;
339
+ if (row?.value * value >= 0 && isNumber(rValue)) {
340
+ const addOffset = value === 0 ? (
341
+ (groupsZeroAs === "positive" && rValue > 0) ||
342
+ (groupsZeroAs === "negative" && rValue < 0)
343
+ ) : true;
344
+
345
+ if (addOffset) {
346
+ offset += scale(rValue) - y0;
347
+ }
340
348
  }
341
349
  }
342
350
  });
@@ -5,7 +5,7 @@
5
5
  import {$COMMON} from "../../config/classes";
6
6
  import Plugin from "../Plugin";
7
7
  import Options from "./Options";
8
- import {IData} from "../../ChartInternal/data/IData";
8
+ import type {IData} from "../../ChartInternal/data/IData";
9
9
  import {loadConfig} from "../../config/config";
10
10
 
11
11
  /**
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) 2017 ~ present NAVER Corp.
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
- import {d3Selection} from "billboard.js/types/types";
5
+ import type {d3Selection} from "billboard.js/types/types";
6
6
  import {Delaunay as d3Delaunay} from "d3-delaunay";
7
7
  import {
8
8
  polygonCentroid as d3PolygonCentroid,
@@ -23,7 +23,7 @@ export default {
23
23
  * @property {boolean} [y.show=false] Show grids along x axis.
24
24
  * @property {Array} [y.lines=[]] Show additional grid lines along y axis.<br>
25
25
  * This option accepts array including object that has value, text, position and class.
26
- * @property {number} [y.ticks=10] Number of y grids to be shown.
26
+ * @property {number} [y.ticks=undefined] Number of y grids to be shown.
27
27
  * @property {object} focus Grid focus object
28
28
  * @property {boolean} [focus.edge=false] Show edged focus grid line.<br>**NOTE:** Available when [`tooltip.grouped=false`](#.tooltip) option is set.
29
29
  * @property {boolean} [focus.show=true] Show grid line when focus.
@@ -71,7 +71,7 @@ export default {
71
71
  grid_x_lines: <Lines> [],
72
72
  grid_y_show: false,
73
73
  grid_y_lines: <Lines> [],
74
- grid_y_ticks: 10,
74
+ grid_y_ticks: <number|undefined> undefined,
75
75
  grid_focus_edge: false,
76
76
  grid_focus_show: true,
77
77
  grid_focus_y: false,
@@ -16,7 +16,8 @@ export default {
16
16
  * @property {boolean} [legend.hide=false] Hide legend
17
17
  * If true given, all legend will be hidden. If string or array given, only the legend that has the id will be hidden.
18
18
  * @property {string|HTMLElement} [legend.contents.bindto=undefined] Set CSS selector or element reference to bind legend items.
19
- * @property {string|Function} [legend.contents.template=undefined] Set item's template.<br>
19
+ * - **NOTE:** Should be used along with `legend.contents.template`.
20
+ * @property {string|Function} [legend.contents.template="<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>"] Set item's template.<br>
20
21
  * - If set `string` value, within template the 'color' and 'title' can be replaced using template-like syntax string:
21
22
  * - {=COLOR}: data color value
22
23
  * - {=TITLE}: data title value
@@ -94,7 +95,7 @@ export default {
94
95
  legend_show: true,
95
96
  legend_hide: false,
96
97
  legend_contents_bindto: <string|HTMLElement|undefined> undefined,
97
- legend_contents_template: <string|(() => string)|undefined>undefined,
98
+ legend_contents_template: <string|(() => string)|undefined> "<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>",
98
99
  legend_position: <"bottom"|"right"|"inset"> "bottom",
99
100
  legend_inset_anchor: <"top-left"|"top-right"|"bottom-left"|"bottom-right"> "top-left",
100
101
  legend_inset_x: 10,