billboard.js 3.11.3 → 3.12.0-next.2
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.
- package/README.md +1 -5
- package/dist/billboard.css +13 -1
- package/dist/billboard.js +19672 -24210
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +26 -3
- package/dist/billboard.pkgd.js +24515 -30430
- package/dist/billboard.pkgd.min.js +33 -3
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +77 -175
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -3
- package/dist/plugin/billboardjs-plugin-sparkline.js +429 -1134
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +666 -1524
- package/dist/plugin/billboardjs-plugin-stanford.min.js +15 -3
- package/dist/plugin/billboardjs-plugin-tableview.js +503 -1175
- package/dist/plugin/billboardjs-plugin-tableview.min.js +30 -3
- package/dist/plugin/billboardjs-plugin-textoverlap.js +351 -1055
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +4 -3
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1387 -1854
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +5 -3
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2760 -3959
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +7 -3
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +3504 -5057
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +18 -3
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2906 -4072
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +33 -3
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +3076 -4506
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +7 -3
- package/dist/theme/dark.css +12 -1
- package/dist/theme/dark.min.css +2 -2
- package/dist/theme/datalab.css +12 -1
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +12 -1
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +12 -1
- package/dist/theme/insight.min.css +2 -2
- package/dist/theme/modern.css +12 -1
- package/dist/theme/modern.min.css +3 -4
- package/dist-esm/billboard.js +9297 -8527
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +20 -27
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +155 -149
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +302 -289
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +236 -236
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +41 -43
- package/package.json +29 -49
- package/src/Chart/api/axis.ts +6 -13
- package/src/Chart/api/chart.ts +12 -11
- package/src/Chart/api/data.ts +8 -7
- package/src/Chart/api/export.ts +28 -21
- package/src/Chart/api/flow.ts +4 -2
- package/src/Chart/api/grid.ts +1 -5
- package/src/Chart/api/load.ts +2 -2
- package/src/Chart/api/regions.ts +29 -5
- package/src/Chart/api/selection.ts +2 -2
- package/src/Chart/api/show.ts +2 -3
- package/src/Chart/api/subchart.ts +2 -2
- package/src/Chart/api/tooltip.ts +8 -9
- package/src/Chart/api/x.ts +2 -2
- package/src/Chart/api/zoom.ts +2 -2
- package/src/ChartInternal/Axis/Axis.ts +119 -44
- package/src/ChartInternal/Axis/AxisRenderer.ts +53 -38
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +2 -2
- package/src/ChartInternal/ChartInternal.ts +87 -55
- package/src/ChartInternal/data/IData.ts +31 -31
- package/src/ChartInternal/data/convert.helper.ts +66 -68
- package/src/ChartInternal/data/convert.ts +11 -11
- package/src/ChartInternal/data/data.ts +51 -27
- package/src/ChartInternal/data/load.ts +7 -6
- package/src/ChartInternal/interactions/drag.ts +2 -1
- package/src/ChartInternal/interactions/eventrect.ts +84 -32
- package/src/ChartInternal/interactions/flow.ts +14 -4
- package/src/ChartInternal/interactions/interaction.ts +51 -22
- package/src/ChartInternal/interactions/subchart.ts +27 -25
- package/src/ChartInternal/interactions/zoom.ts +29 -18
- package/src/ChartInternal/internals/category.ts +1 -1
- package/src/ChartInternal/internals/class.ts +6 -6
- package/src/ChartInternal/internals/clip.ts +8 -4
- package/src/ChartInternal/internals/color.ts +70 -42
- package/src/ChartInternal/internals/domain.ts +59 -28
- package/src/ChartInternal/internals/format.ts +5 -5
- package/src/ChartInternal/internals/grid.ts +131 -47
- package/src/ChartInternal/internals/legend.ts +93 -61
- package/src/ChartInternal/internals/redraw.ts +6 -2
- package/src/ChartInternal/internals/region.ts +5 -3
- package/src/ChartInternal/internals/scale.ts +28 -15
- package/src/ChartInternal/internals/selection.ts +14 -13
- package/src/ChartInternal/internals/size.axis.ts +18 -10
- package/src/ChartInternal/internals/size.ts +98 -67
- package/src/ChartInternal/internals/style.ts +21 -19
- package/src/ChartInternal/internals/text.ts +79 -43
- package/src/ChartInternal/internals/title.ts +2 -2
- package/src/ChartInternal/internals/tooltip.ts +78 -32
- package/src/ChartInternal/internals/transform.ts +4 -4
- package/src/ChartInternal/internals/type.ts +17 -12
- package/src/ChartInternal/shape/arc.ts +78 -44
- package/src/ChartInternal/shape/area.ts +19 -22
- package/src/ChartInternal/shape/bar.ts +41 -31
- package/src/ChartInternal/shape/bubble.ts +5 -5
- package/src/ChartInternal/shape/candlestick.ts +15 -13
- package/src/ChartInternal/shape/funnel.ts +317 -0
- package/src/ChartInternal/shape/gauge.ts +16 -9
- package/src/ChartInternal/shape/line.ts +62 -46
- package/src/ChartInternal/shape/point.common.ts +1 -4
- package/src/ChartInternal/shape/point.ts +54 -34
- package/src/ChartInternal/shape/polar.ts +4 -2
- package/src/ChartInternal/shape/radar.ts +40 -22
- package/src/ChartInternal/shape/shape.ts +84 -58
- package/src/ChartInternal/shape/treemap.ts +31 -20
- package/src/Plugin/bubblecompare/index.ts +1 -3
- package/src/Plugin/sparkline/index.ts +3 -4
- package/src/Plugin/stanford/ColorScale.ts +3 -2
- package/src/Plugin/stanford/Elements.ts +15 -6
- package/src/Plugin/stanford/Options.ts +5 -5
- package/src/Plugin/stanford/index.ts +13 -9
- package/src/Plugin/tableview/Options.ts +1 -1
- package/src/Plugin/tableview/const.ts +1 -4
- package/src/Plugin/tableview/index.ts +11 -9
- package/src/Plugin/textoverlap/index.ts +4 -6
- package/src/config/Options/Options.ts +3 -3
- package/src/config/Options/axis/axis.ts +36 -0
- package/src/config/Options/axis/x.ts +34 -14
- package/src/config/Options/axis/y.ts +13 -13
- package/src/config/Options/axis/y2.ts +23 -10
- package/src/config/Options/common/color.ts +4 -4
- package/src/config/Options/common/grid.ts +4 -4
- package/src/config/Options/common/legend.ts +12 -13
- package/src/config/Options/common/main.ts +23 -23
- package/src/config/Options/common/point.ts +17 -18
- package/src/config/Options/common/title.ts +2 -2
- package/src/config/Options/common/tooltip.ts +13 -11
- package/src/config/Options/data/axis.ts +2 -2
- package/src/config/Options/data/data.ts +48 -45
- package/src/config/Options/interaction/interaction.ts +1 -1
- package/src/config/Options/interaction/subchart.ts +2 -2
- package/src/config/Options/interaction/zoom.ts +9 -9
- package/src/config/Options/shape/arc.ts +10 -13
- package/src/config/Options/shape/area.ts +5 -7
- package/src/config/Options/shape/bar.ts +8 -10
- package/src/config/Options/shape/bubble.ts +1 -1
- package/src/config/Options/shape/candlestick.ts +2 -2
- package/src/config/Options/shape/donut.ts +4 -4
- package/src/config/Options/shape/funnel.ts +38 -0
- package/src/config/Options/shape/gauge.ts +6 -6
- package/src/config/Options/shape/line.ts +3 -3
- package/src/config/Options/shape/pie.ts +5 -5
- package/src/config/Options/shape/polar.ts +3 -3
- package/src/config/Options/shape/radar.ts +2 -2
- package/src/config/Options/shape/scatter.ts +1 -1
- package/src/config/Options/shape/treemap.ts +1 -1
- package/src/config/Store/Element.ts +8 -5
- package/src/config/Store/State.ts +20 -13
- package/src/config/classes.ts +14 -4
- package/src/config/config.ts +1 -1
- package/src/config/const.ts +2 -0
- package/src/config/resolver/axis.ts +4 -4
- package/src/config/resolver/interaction.ts +3 -7
- package/src/config/resolver/shape.ts +17 -12
- package/src/core.ts +2 -3
- package/src/index.esm.ts +3 -6
- package/src/index.ts +2 -2
- package/src/module/Cache.ts +2 -3
- package/src/module/browser.ts +15 -10
- package/src/module/error.ts +9 -8
- package/src/module/generator.ts +3 -5
- package/src/module/util.ts +62 -39
- package/src/module/worker.ts +14 -11
- package/src/scss/billboard.scss +18 -0
- package/src/scss/theme/dark.scss +17 -0
- package/src/scss/theme/datalab.scss +17 -0
- package/src/scss/theme/graph.scss +17 -0
- package/src/scss/theme/insight.scss +17 -0
- package/src/scss/theme/modern.scss +17 -0
- package/types/axis.d.ts +17 -0
- package/types/bb.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/options.d.ts +9 -0
- package/types/options.shape.d.ts +26 -1
- package/types/types.d.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "billboard.js",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.12.0-next.2",
|
|
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",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"build:plugin": "cross-env NODE_ENV=plugin webpack && cross-env NODE_ENV=plugin MODE=min webpack && cross-env NODE_ENV=plugin MODE=pkgd webpack && cross-env NODE_ENV=plugin MODE=pkgd-min webpack",
|
|
37
37
|
"build:plugin:types": "node ./config/type.d-plugin.js",
|
|
38
38
|
"release": "semantic-release",
|
|
39
|
-
"lint": "eslint
|
|
39
|
+
"lint": "eslint",
|
|
40
|
+
"format": "dprint fmt",
|
|
40
41
|
"loc": "cloc --by-file src",
|
|
41
42
|
"test": "node --max-old-space-size=3072 ./node_modules/karma/bin/karma start ./karma.conf.cjs",
|
|
42
43
|
"test:chrome": "cross-env TEST_TYPE=chrome npm test",
|
|
@@ -101,68 +102,47 @@
|
|
|
101
102
|
"d3-zoom": "^3.0.0"
|
|
102
103
|
},
|
|
103
104
|
"devDependencies": {
|
|
104
|
-
"@
|
|
105
|
-
"@
|
|
106
|
-
"@
|
|
107
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
|
|
108
|
-
"@babel/plugin-transform-runtime": "^7.24.0",
|
|
109
|
-
"@babel/preset-env": "^7.24.0",
|
|
110
|
-
"@babel/preset-typescript": "^7.23.3",
|
|
111
|
-
"@babel/runtime": "^7.24.0",
|
|
112
|
-
"@commitlint/cli": "19.0.3",
|
|
113
|
-
"@commitlint/config-conventional": "^19.0.3",
|
|
114
|
-
"@rollup/plugin-babel": "^6.0.4",
|
|
105
|
+
"@commitlint/cli": "19.3.0",
|
|
106
|
+
"@commitlint/config-conventional": "^19.2.2",
|
|
107
|
+
"@eslint/js": "^9.3.0",
|
|
115
108
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
116
109
|
"@rollup/plugin-replace": "^5.0.5",
|
|
117
110
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
118
111
|
"@semantic-release/changelog": "^6.0.3",
|
|
119
|
-
"@semantic-release/commit-analyzer": "^
|
|
112
|
+
"@semantic-release/commit-analyzer": "^12.0.0",
|
|
120
113
|
"@semantic-release/exec": "^6.0.3",
|
|
121
114
|
"@semantic-release/git": "^10.0.1",
|
|
122
|
-
"@semantic-release/npm": "^
|
|
123
|
-
"@semantic-release/release-notes-generator": "^
|
|
124
|
-
"@types/chai": "^4.3.
|
|
115
|
+
"@semantic-release/npm": "^12.0.1",
|
|
116
|
+
"@semantic-release/release-notes-generator": "^13.0.0",
|
|
117
|
+
"@types/chai": "^4.3.16",
|
|
125
118
|
"@types/d3": "^7.4.3",
|
|
126
119
|
"@types/mocha": "^10.0.6",
|
|
127
120
|
"@types/sinon": "^17.0.3",
|
|
128
|
-
"@typescript-eslint/eslint-plugin": "^7.2.0",
|
|
129
|
-
"@typescript-eslint/parser": "^7.2.0",
|
|
130
|
-
"babel-helper-modules": "^6.0.0",
|
|
131
|
-
"babel-loader": "^9.1.3",
|
|
132
|
-
"babel-plugin-add-module-exports": "^1.0.4",
|
|
133
|
-
"babel-plugin-minify-constant-folding": "^0.5.0",
|
|
134
|
-
"babel-plugin-minify-dead-code-elimination": "^0.5.2",
|
|
135
|
-
"babel-plugin-minify-guarded-expressions": "^0.4.4",
|
|
136
|
-
"babel-plugin-minify-numeric-literals": "^0.4.3",
|
|
137
|
-
"babel-plugin-minify-type-constructors": "^0.4.3",
|
|
138
|
-
"babel-plugin-transform-inline-consecutive-adds": "^0.4.3",
|
|
139
|
-
"babel-plugin-transform-merge-sibling-variables": "^6.9.5",
|
|
140
|
-
"babel-plugin-transform-minify-booleans": "^6.9.4",
|
|
141
121
|
"better-docs": "^2.7.3",
|
|
142
122
|
"chai": "^4.3.10",
|
|
143
123
|
"clean-webpack-plugin": "^4.0.0",
|
|
144
124
|
"cloc": "^2.11.0",
|
|
145
|
-
"core-js": "^3.
|
|
125
|
+
"core-js": "^3.37.1",
|
|
146
126
|
"coveralls": "^3.1.1",
|
|
147
127
|
"cross-env": "^7.0.3",
|
|
148
|
-
"css-loader": "^
|
|
149
|
-
"css-minimizer-webpack-plugin": "^6.0.0",
|
|
128
|
+
"css-loader": "^7.1.1",
|
|
150
129
|
"d3-color": "^3.1.0",
|
|
151
130
|
"d3-delaunay": "^6.0.4",
|
|
152
131
|
"d3-format": "^3.1.0",
|
|
153
132
|
"d3-polygon": "^3.0.1",
|
|
154
133
|
"docdash": "^2.0.2",
|
|
155
|
-
"
|
|
134
|
+
"dprint": "^0.45.1",
|
|
135
|
+
"esbuild-loader": "^4.1.0",
|
|
136
|
+
"eslint": "^9.3.0",
|
|
156
137
|
"eslint-config-naver": "^2.1.0",
|
|
157
138
|
"eslint-plugin-import": "^2.29.1",
|
|
158
|
-
"eslint-plugin-jsdoc": "^48.2.
|
|
159
|
-
"eslint-webpack-plugin": "^4.0.1",
|
|
139
|
+
"eslint-plugin-jsdoc": "^48.2.5",
|
|
160
140
|
"exports-loader": "^5.0.0",
|
|
161
141
|
"hammer-simulator": "0.0.1",
|
|
162
142
|
"husky": "^9.0.11",
|
|
163
143
|
"istanbul-instrumenter-loader": "^3.0.1",
|
|
164
144
|
"istanbul-lib-instrument": "^6.0.2",
|
|
165
|
-
"jsdoc": "^4.0.
|
|
145
|
+
"jsdoc": "^4.0.3",
|
|
166
146
|
"karma": "^6.4.3",
|
|
167
147
|
"karma-chai": "^0.1.0",
|
|
168
148
|
"karma-chrome-launcher": "^3.2.0",
|
|
@@ -175,28 +155,28 @@
|
|
|
175
155
|
"karma-webpack": "^5.0.1",
|
|
176
156
|
"lint-staged": "^15.2.2",
|
|
177
157
|
"lite-fixture": "^1.0.2",
|
|
178
|
-
"mini-css-extract-plugin": "^2.
|
|
179
|
-
"mocha": "^10.
|
|
158
|
+
"mini-css-extract-plugin": "^2.9.0",
|
|
159
|
+
"mocha": "^10.4.0",
|
|
180
160
|
"node-sass": "^9.0.0",
|
|
181
161
|
"regenerator-runtime": "^0.14.1",
|
|
182
|
-
"rollup": "^4.
|
|
162
|
+
"rollup": "^4.17.2",
|
|
183
163
|
"rollup-plugin-delete": "^2.0.0",
|
|
184
|
-
"sass-loader": "^14.
|
|
185
|
-
"semantic-release": "^23.
|
|
164
|
+
"sass-loader": "^14.2.1",
|
|
165
|
+
"semantic-release": "^23.1.1",
|
|
186
166
|
"simulant": "^0.2.2",
|
|
187
|
-
"sinon": "^
|
|
167
|
+
"sinon": "^18.0.0",
|
|
188
168
|
"string-replace-loader": "^3.1.0",
|
|
189
|
-
"style-loader": "^
|
|
169
|
+
"style-loader": "^4.0.0",
|
|
190
170
|
"taffydb": "^2.7.3",
|
|
191
|
-
"terser-webpack-plugin": "^5.3.10",
|
|
192
171
|
"tslib": "^2.6.2",
|
|
193
|
-
"typescript": "5.4.
|
|
194
|
-
"
|
|
195
|
-
"webpack
|
|
172
|
+
"typescript": "5.4.5",
|
|
173
|
+
"typescript-eslint": "^7.10.0",
|
|
174
|
+
"webpack": "^5.91.0",
|
|
175
|
+
"webpack-bundle-analyzer": "^4.10.2",
|
|
196
176
|
"webpack-clean": "^1.2.5",
|
|
197
177
|
"webpack-cli": "^5.1.4",
|
|
198
178
|
"webpack-common-shake": "^2.1.0",
|
|
199
|
-
"webpack-dev-server": "^5.0.
|
|
179
|
+
"webpack-dev-server": "^5.0.4",
|
|
200
180
|
"webpack-merge": "^5.10.0",
|
|
201
181
|
"webpackbar": "^6.0.1",
|
|
202
182
|
"write-file-webpack-plugin": "^4.5.1"
|
package/src/Chart/api/axis.ts
CHANGED
|
@@ -2,18 +2,11 @@
|
|
|
2
2
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
3
3
|
* billboard.js project is licensed under the MIT license
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import {isDefined, isNumber, isObjectType, isValue} from "../../module/util";
|
|
6
6
|
|
|
7
|
-
type AxisOption = {
|
|
8
|
-
x?: number | false;
|
|
9
|
-
y?: number | false;
|
|
10
|
-
y2?: number | false;
|
|
11
|
-
} | number | false;
|
|
7
|
+
type AxisOption = {x?: number | false, y?: number | false, y2?: number | false} | number | false;
|
|
12
8
|
|
|
13
|
-
type RangeAxisOption = {
|
|
14
|
-
min? : AxisOption;
|
|
15
|
-
max?: AxisOption;
|
|
16
|
-
};
|
|
9
|
+
type RangeAxisOption = {min?: AxisOption, max?: AxisOption};
|
|
17
10
|
|
|
18
11
|
/**
|
|
19
12
|
* Set the min/max value
|
|
@@ -155,7 +148,7 @@ const axis = {
|
|
|
155
148
|
* chart.axis.min(-50);
|
|
156
149
|
* chart.axis.min(false);
|
|
157
150
|
*/
|
|
158
|
-
min: function(min?: AxisOption): object|void {
|
|
151
|
+
min: function(min?: AxisOption): object | void {
|
|
159
152
|
const $$ = this.internal;
|
|
160
153
|
|
|
161
154
|
return isValue(min) || min === false ?
|
|
@@ -193,7 +186,7 @@ const axis = {
|
|
|
193
186
|
* chart.axis.max(10);
|
|
194
187
|
* chart.axis.max(false);
|
|
195
188
|
*/
|
|
196
|
-
max: function(max?: AxisOption): object|void {
|
|
189
|
+
max: function(max?: AxisOption): object | void {
|
|
197
190
|
const $$ = this.internal;
|
|
198
191
|
|
|
199
192
|
return isValue(max) || max === false ?
|
|
@@ -244,7 +237,7 @@ const axis = {
|
|
|
244
237
|
* chart.axis.range({ min: -50, max: 1000 });
|
|
245
238
|
* chart.axis.range({ min: false, max: false });
|
|
246
239
|
*/
|
|
247
|
-
range: function(range: RangeAxisOption): object|void {
|
|
240
|
+
range: function(range: RangeAxisOption): object | void {
|
|
248
241
|
const {axis} = this;
|
|
249
242
|
|
|
250
243
|
if (arguments.length) {
|
package/src/Chart/api/chart.ts
CHANGED
|
@@ -55,7 +55,6 @@ export default {
|
|
|
55
55
|
|
|
56
56
|
if (state.rendered) {
|
|
57
57
|
// reset possible zoom scale when is called from resize event
|
|
58
|
-
// eslint-disable-next-line prefer-rest-params
|
|
59
58
|
if (state.resizing) { // arguments[1] is given when is called from resize
|
|
60
59
|
$$.brush?.updateResize();
|
|
61
60
|
} else {
|
|
@@ -68,16 +67,18 @@ export default {
|
|
|
68
67
|
zoomResetBtn?.style("display", "none");
|
|
69
68
|
$$.scale.zoom = null;
|
|
70
69
|
|
|
71
|
-
soft ?
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
soft ?
|
|
71
|
+
$$.redraw({
|
|
72
|
+
withTransform: true,
|
|
73
|
+
withUpdateXDomain: true,
|
|
74
|
+
withUpdateOrgXDomain: true,
|
|
75
|
+
withLegend: true
|
|
76
|
+
}) :
|
|
77
|
+
$$.updateAndRedraw({
|
|
78
|
+
withLegend: true,
|
|
79
|
+
withTransition: false,
|
|
80
|
+
withTransitionForTransform: false
|
|
81
|
+
});
|
|
81
82
|
|
|
82
83
|
// reset subchart selection & selection state
|
|
83
84
|
if (!state.resizing && $$.brush) {
|
package/src/Chart/api/data.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* billboard.js project is licensed under the MIT license
|
|
4
4
|
*/
|
|
5
5
|
import type {DataItem} from "../../../types/types";
|
|
6
|
-
import {extend, isUndefined, isArray} from "../../module/util";
|
|
7
6
|
import type {IDataRow} from "../../ChartInternal/data/IData";
|
|
7
|
+
import {extend, isArray, isUndefined} from "../../module/util";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Get data loaded in the chart.
|
|
@@ -24,7 +24,7 @@ import type {IDataRow} from "../../ChartInternal/data/IData";
|
|
|
24
24
|
* // Get all data
|
|
25
25
|
* chart.data();
|
|
26
26
|
*/
|
|
27
|
-
const data = function(targetIds: string|string[]): DataItem[] {
|
|
27
|
+
const data = function(targetIds: string | string[]): DataItem[] {
|
|
28
28
|
const {targets} = this.internal.data;
|
|
29
29
|
|
|
30
30
|
if (!isUndefined(targetIds)) {
|
|
@@ -72,7 +72,8 @@ extend(data, {
|
|
|
72
72
|
* chart.data.values("data1");
|
|
73
73
|
* // --> [10, 20, 30, 40]
|
|
74
74
|
*/
|
|
75
|
-
values: function(targetIds?: string | string[], flat: boolean = true): number[]|number[][]
|
|
75
|
+
values: function(targetIds?: string | string[], flat: boolean = true): number[] | number[][]
|
|
76
|
+
| null {
|
|
76
77
|
let values: any = null;
|
|
77
78
|
|
|
78
79
|
if (targetIds) {
|
|
@@ -108,9 +109,9 @@ extend(data, {
|
|
|
108
109
|
* chart.data.names({
|
|
109
110
|
* data1: "New Name 1",
|
|
110
111
|
* data2: "New Name 2"
|
|
111
|
-
*});
|
|
112
|
+
* });
|
|
112
113
|
*/
|
|
113
|
-
names: function(names?: Array<{
|
|
114
|
+
names: function(names?: Array<{[key: string]: string | null}>): {[key: string]: string | null} {
|
|
114
115
|
const $$ = this.internal;
|
|
115
116
|
|
|
116
117
|
return $$.updateDataAttributes("names", names);
|
|
@@ -134,7 +135,7 @@ extend(data, {
|
|
|
134
135
|
* data2: "#000000"
|
|
135
136
|
* });
|
|
136
137
|
*/
|
|
137
|
-
colors: function(colors?: Array<{
|
|
138
|
+
colors: function(colors?: Array<{[key: string]: string}>): {[key: string]: string} {
|
|
138
139
|
return this.internal.updateDataAttributes("colors", colors);
|
|
139
140
|
},
|
|
140
141
|
|
|
@@ -157,7 +158,7 @@ extend(data, {
|
|
|
157
158
|
* data2: "y2"
|
|
158
159
|
* });
|
|
159
160
|
*/
|
|
160
|
-
axes: function(axes?: Array<{
|
|
161
|
+
axes: function(axes?: Array<{[key: string]: string}>): {[key: string]: string} {
|
|
161
162
|
return this.internal.updateDataAttributes("axes", axes);
|
|
162
163
|
},
|
|
163
164
|
|
package/src/Chart/api/export.ts
CHANGED
|
@@ -4,28 +4,23 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import {namespaces as d3Namespaces} from "d3-selection";
|
|
6
6
|
import {document, window} from "../../module/browser";
|
|
7
|
-
import {
|
|
7
|
+
import {getCssRules, isFunction, mergeObj, toArray} from "../../module/util";
|
|
8
8
|
|
|
9
9
|
type TExportOption = TSize & {
|
|
10
|
-
preserveAspectRatio: boolean
|
|
11
|
-
preserveFontStyle: boolean
|
|
12
|
-
mimeType: string
|
|
10
|
+
preserveAspectRatio: boolean,
|
|
11
|
+
preserveFontStyle: boolean,
|
|
12
|
+
mimeType: string
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
type TSize = {
|
|
16
|
-
x?: number;
|
|
17
|
-
y?: number;
|
|
18
|
-
width: number;
|
|
19
|
-
height: number;
|
|
20
|
-
};
|
|
15
|
+
type TSize = {x?: number, y?: number, width: number, height: number};
|
|
21
16
|
|
|
22
17
|
type TTextGlyph = {
|
|
23
18
|
[key: string]: TSize & {
|
|
24
|
-
fill: string
|
|
25
|
-
fontFamily: string
|
|
26
|
-
fontSize: string
|
|
27
|
-
textAnchor: string
|
|
28
|
-
transform: string
|
|
19
|
+
fill: string,
|
|
20
|
+
fontFamily: string,
|
|
21
|
+
fontSize: string,
|
|
22
|
+
textAnchor: string,
|
|
23
|
+
transform: string
|
|
29
24
|
}
|
|
30
25
|
};
|
|
31
26
|
|
|
@@ -36,10 +31,12 @@ type TTextGlyph = {
|
|
|
36
31
|
* @private
|
|
37
32
|
* @see https://developer.mozilla.org/ko/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
|
|
38
33
|
*/
|
|
39
|
-
const b64EncodeUnicode = (str: string): string =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
)
|
|
34
|
+
const b64EncodeUnicode = (str: string): string =>
|
|
35
|
+
window.btoa?.(
|
|
36
|
+
encodeURIComponent(str)
|
|
37
|
+
.replace(/%([0-9A-F]{2})/g,
|
|
38
|
+
(match, p: number | string): string => String.fromCharCode(Number(`0x${p}`)))
|
|
39
|
+
);
|
|
43
40
|
|
|
44
41
|
/**
|
|
45
42
|
* Convert svg node to data url
|
|
@@ -128,12 +125,22 @@ function getGlyph(svg: SVGElement): TTextGlyph[] {
|
|
|
128
125
|
.filter(filterFn)
|
|
129
126
|
.forEach((t: SVGTextElement) => { // eslint-disable-line
|
|
130
127
|
const getStyleFn = (ts: SVGTextElement): TTextGlyph => {
|
|
131
|
-
const {fill, fontFamily, fontSize, textAnchor, transform} = window.getComputedStyle(
|
|
128
|
+
const {fill, fontFamily, fontSize, textAnchor, transform} = window.getComputedStyle(
|
|
129
|
+
ts
|
|
130
|
+
);
|
|
132
131
|
const {x, y, width, height} = getCoords(ts, {left, top});
|
|
133
132
|
|
|
134
133
|
return {
|
|
135
134
|
[ts.textContent as string]: {
|
|
136
|
-
x,
|
|
135
|
+
x,
|
|
136
|
+
y,
|
|
137
|
+
width,
|
|
138
|
+
height,
|
|
139
|
+
fill,
|
|
140
|
+
fontFamily,
|
|
141
|
+
fontSize,
|
|
142
|
+
textAnchor,
|
|
143
|
+
transform
|
|
137
144
|
}
|
|
138
145
|
};
|
|
139
146
|
};
|
package/src/Chart/api/flow.ts
CHANGED
|
@@ -205,9 +205,11 @@ export default {
|
|
|
205
205
|
flow: {
|
|
206
206
|
index: baseValue.index,
|
|
207
207
|
length: length,
|
|
208
|
-
duration: isValue(args.duration) ?
|
|
208
|
+
duration: isValue(args.duration) ?
|
|
209
|
+
args.duration :
|
|
210
|
+
$$.config.transition_duration,
|
|
209
211
|
done: args.done,
|
|
210
|
-
orgDataCount: orgDataCount
|
|
212
|
+
orgDataCount: orgDataCount
|
|
211
213
|
},
|
|
212
214
|
withLegend: true,
|
|
213
215
|
withTransition: orgDataCount > 1,
|
package/src/Chart/api/grid.ts
CHANGED
package/src/Chart/api/load.ts
CHANGED
|
@@ -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 {requestIdleCallback} from "../../module/browser";
|
|
6
|
-
import {isString, isArray, isEmpty} from "../../module/util";
|
|
7
5
|
import {callDone} from "../../ChartInternal/data/load";
|
|
6
|
+
import {requestIdleCallback} from "../../module/browser";
|
|
7
|
+
import {isArray, isEmpty, isString} from "../../module/util";
|
|
8
8
|
|
|
9
9
|
export default {
|
|
10
10
|
/**
|
package/src/Chart/api/regions.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* billboard.js project is licensed under the MIT license
|
|
4
4
|
*/
|
|
5
5
|
import {$REGION} from "../../config/classes";
|
|
6
|
-
import {
|
|
6
|
+
import {extend, getOption, isTabVisible} from "../../module/util";
|
|
7
7
|
|
|
8
8
|
type RegionsParam = {axis?: "add" | "update", class?: string, start?: number, end?: number}[];
|
|
9
9
|
|
|
@@ -42,7 +42,16 @@ function regionsFn(regions: RegionsParam, isAdd = false): RegionsParam {
|
|
|
42
42
|
* // Show 2 regions
|
|
43
43
|
* chart.regions([
|
|
44
44
|
* {axis: "x", start: 5, class: "regionX"},
|
|
45
|
-
* {
|
|
45
|
+
* {
|
|
46
|
+
* axis: "y", end: 50, class: "regionY",
|
|
47
|
+
* label: {
|
|
48
|
+
* text: "Region Text",
|
|
49
|
+
* x: 5, // position relative of the initial x coordinate
|
|
50
|
+
* y: 5, // position relative of the initial y coordinate
|
|
51
|
+
* color: "red", // color string
|
|
52
|
+
* rotated: true // make text to show in vertical or horizontal
|
|
53
|
+
* }
|
|
54
|
+
* }
|
|
46
55
|
* ]);
|
|
47
56
|
*/
|
|
48
57
|
const regions = function(regions: RegionsParam): RegionsParam {
|
|
@@ -61,14 +70,29 @@ extend(regions, {
|
|
|
61
70
|
* @example
|
|
62
71
|
* // Add a new region
|
|
63
72
|
* chart.regions.add(
|
|
64
|
-
* {
|
|
73
|
+
* {
|
|
74
|
+
* axis: "x", start: 5, class: "regionX",
|
|
75
|
+
* label: {
|
|
76
|
+
* text: "Region Text",
|
|
77
|
+
* color: "red" // color string
|
|
78
|
+
* }
|
|
79
|
+
* }
|
|
65
80
|
* );
|
|
66
81
|
*
|
|
67
82
|
* // Add new regions
|
|
68
83
|
* chart.regions.add([
|
|
69
84
|
* {axis: "x", start: 5, class: "regionX"},
|
|
70
|
-
* {
|
|
71
|
-
*
|
|
85
|
+
* {
|
|
86
|
+
* axis: "y", end: 50, class: "regionY",
|
|
87
|
+
* label: {
|
|
88
|
+
* text: "Region Text",
|
|
89
|
+
* x: 5, // position relative of the initial x coordinate
|
|
90
|
+
* y: 5, // position relative of the initial y coordinate
|
|
91
|
+
* color: "red", // color string
|
|
92
|
+
* rotated: true // make text to show in vertical or horizontal
|
|
93
|
+
* }
|
|
94
|
+
* }
|
|
95
|
+
* ]);
|
|
72
96
|
*/
|
|
73
97
|
add: function(regions: RegionsParam): RegionsParam {
|
|
74
98
|
return regionsFn.bind(this)(regions, true);
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* billboard.js project is licensed under the MIT license
|
|
4
4
|
*/
|
|
5
5
|
import {select as d3Select} from "d3-selection";
|
|
6
|
-
import {isDefined} from "../../module/util";
|
|
7
|
-
import {$AREA, $LINE, $SELECT, $SHAPE} from "../../config/classes";
|
|
8
6
|
import type {DataItem} from "../../../types/types";
|
|
7
|
+
import {$AREA, $LINE, $SELECT, $SHAPE} from "../../config/classes";
|
|
8
|
+
import {isDefined} from "../../module/util";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Toggler function to select or unselect
|
package/src/Chart/api/show.ts
CHANGED
|
@@ -119,9 +119,9 @@ export default {
|
|
|
119
119
|
* // toggle 'data1' and 'data3'
|
|
120
120
|
* chart.toggle(["data1", "data3"]);
|
|
121
121
|
*/
|
|
122
|
-
toggle(targetIds: string|string[], options = {}): void {
|
|
122
|
+
toggle(targetIds: string | string[], options = {}): void {
|
|
123
123
|
const $$ = this.internal;
|
|
124
|
-
const targets = {show: <string[]>
|
|
124
|
+
const targets = {show: <string[]>[], hide: <string[]>[]};
|
|
125
125
|
|
|
126
126
|
// sort show & hide target ids
|
|
127
127
|
$$.mapToTargetIds(targetIds)
|
|
@@ -133,4 +133,3 @@ export default {
|
|
|
133
133
|
targets.hide.length && setTimeout(() => this.hide(targets.hide, options), 0);
|
|
134
134
|
}
|
|
135
135
|
};
|
|
136
|
-
|
|
@@ -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 {extend, parseDate} from "../../module/util";
|
|
6
|
-
import {$COMMON} from "../../config/classes";
|
|
7
5
|
import type {TDomain} from "../../ChartInternal/data/IData";
|
|
6
|
+
import {$COMMON} from "../../config/classes";
|
|
7
|
+
import {extend, parseDate} from "../../module/util";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Select subchart by giving x domain range.
|
package/src/Chart/api/tooltip.ts
CHANGED
|
@@ -2,6 +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 {$SHAPE} from "../../config/classes";
|
|
5
6
|
import {isDefined} from "../../module/util";
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -72,7 +73,7 @@ const tooltip = {
|
|
|
72
73
|
*/
|
|
73
74
|
show: function(args): void {
|
|
74
75
|
const $$ = this.internal;
|
|
75
|
-
const {$el, config, state: {eventReceiver, hasTreemap, inputType}} = $$;
|
|
76
|
+
const {$el, config, state: {eventReceiver, hasFunnel, hasTreemap, inputType}} = $$;
|
|
76
77
|
let index;
|
|
77
78
|
let mouse;
|
|
78
79
|
|
|
@@ -86,8 +87,10 @@ const tooltip = {
|
|
|
86
87
|
const {data} = args;
|
|
87
88
|
const y = $$.getYScaleById(data.id)?.(data.value);
|
|
88
89
|
|
|
89
|
-
if (hasTreemap && data.id) {
|
|
90
|
-
|
|
90
|
+
if ((hasFunnel || hasTreemap) && data.id) {
|
|
91
|
+
const selector = $$.selectorTarget(data.id, undefined, `.${$SHAPE.shape}`);
|
|
92
|
+
|
|
93
|
+
eventReceiver.rect = $el.main.select(selector);
|
|
91
94
|
} else if ($$.isMultipleX()) {
|
|
92
95
|
// if multiple xs, target point will be determined by mouse
|
|
93
96
|
mouse = [$$.xx(data), y];
|
|
@@ -108,9 +111,7 @@ const tooltip = {
|
|
|
108
111
|
index = args.index;
|
|
109
112
|
}
|
|
110
113
|
|
|
111
|
-
(inputType === "mouse" ?
|
|
112
|
-
["mouseover", "mousemove"] : ["touchstart"]
|
|
113
|
-
).forEach(eventName => {
|
|
114
|
+
(inputType === "mouse" ? ["mouseover", "mousemove"] : ["touchstart"]).forEach(eventName => {
|
|
114
115
|
$$.dispatchEvent(eventName, index, mouse);
|
|
115
116
|
});
|
|
116
117
|
},
|
|
@@ -130,9 +131,7 @@ const tooltip = {
|
|
|
130
131
|
const {index} = JSON.parse(data.current)[0];
|
|
131
132
|
|
|
132
133
|
// make to finalize, possible pending event flow set from '.tooltip.show()' call
|
|
133
|
-
(inputType === "mouse" ?
|
|
134
|
-
["mouseout"] : ["touchend"]
|
|
135
|
-
).forEach(eventName => {
|
|
134
|
+
(inputType === "mouse" ? ["mouseout"] : ["touchend"]).forEach(eventName => {
|
|
136
135
|
$$.dispatchEvent(eventName, index);
|
|
137
136
|
});
|
|
138
137
|
}
|
package/src/Chart/api/x.ts
CHANGED
|
@@ -19,7 +19,7 @@ export default {
|
|
|
19
19
|
* // Update x values for all targets
|
|
20
20
|
* chart.x([100, 200, 300, 400, ...]);
|
|
21
21
|
*/
|
|
22
|
-
x(x?: number[]): {
|
|
22
|
+
x(x?: number[]): {[key: string]: number[]} {
|
|
23
23
|
const $$ = this.internal;
|
|
24
24
|
const {axis, data} = $$;
|
|
25
25
|
const isCategorized = axis.isCustomX() && axis.isCategorized();
|
|
@@ -57,7 +57,7 @@ export default {
|
|
|
57
57
|
* data2: [100, 200, 300, 400, ...]
|
|
58
58
|
* });
|
|
59
59
|
*/
|
|
60
|
-
xs(xs?: {
|
|
60
|
+
xs(xs?: {[key: string]: number[]}): {[key: string]: number[]} {
|
|
61
61
|
const $$ = this.internal;
|
|
62
62
|
|
|
63
63
|
if (isObject(xs)) {
|
package/src/Chart/api/zoom.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* billboard.js project is licensed under the MIT license
|
|
4
4
|
*/
|
|
5
5
|
import {zoomIdentity as d3ZoomIdentity, zoomTransform as d3ZoomTransform} from "d3-zoom";
|
|
6
|
-
import {extend, getMinMax, isDefined, isObject, parseDate} from "../../module/util";
|
|
7
6
|
import type {TDomainRange} from "../../ChartInternal/data/IData";
|
|
7
|
+
import {extend, getMinMax, isDefined, isObject, parseDate} from "../../module/util";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Zoom by giving x domain range.
|
|
@@ -183,7 +183,7 @@ extend(zoom, {
|
|
|
183
183
|
* max: 100
|
|
184
184
|
* });
|
|
185
185
|
*/
|
|
186
|
-
range(range): {min: (number|undefined)[], max: (number|undefined)[]} {
|
|
186
|
+
range(range): {min: (number | undefined)[], max: (number | undefined)[]} {
|
|
187
187
|
const zoom = this.zoom;
|
|
188
188
|
|
|
189
189
|
if (isObject(range)) {
|