billboard.js 3.3.0 → 3.3.3
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/dist/billboard.css +1 -1
- package/dist/billboard.js +489 -399
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +2491 -2239
- package/dist/billboard.pkgd.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +166 -103
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +166 -103
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +32 -130
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +32 -130
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2004 -1842
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2168 -1943
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2170 -1945
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2036 -1972
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +2037 -1973
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +2 -2
- package/dist-esm/billboard.js +481 -412
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -4
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +129 -77
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +135 -80
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +4 -8
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +4 -7
- package/package.json +28 -28
- package/src/Chart/api/chart.ts +1 -1
- package/src/Chart/api/focus.ts +8 -8
- package/src/Chart/api/regions.ts +3 -3
- package/src/Chart/api/selection.ts +15 -15
- package/src/Chart/api/subchart.ts +10 -10
- package/src/ChartInternal/Axis/Axis.ts +16 -14
- package/src/ChartInternal/ChartInternal.ts +7 -8
- package/src/ChartInternal/data/data.ts +3 -3
- package/src/ChartInternal/data/load.ts +2 -2
- package/src/ChartInternal/interactions/drag.ts +15 -15
- package/src/ChartInternal/interactions/eventrect.ts +18 -18
- package/src/ChartInternal/interactions/interaction.ts +10 -10
- package/src/ChartInternal/interactions/zoom.ts +4 -4
- package/src/ChartInternal/internals/color.ts +4 -4
- package/src/ChartInternal/internals/domain.ts +1 -1
- package/src/ChartInternal/internals/format.ts +9 -4
- package/src/ChartInternal/internals/grid.ts +32 -32
- package/src/ChartInternal/internals/legend.ts +27 -27
- package/src/ChartInternal/internals/redraw.ts +6 -5
- package/src/ChartInternal/internals/region.ts +3 -3
- package/src/ChartInternal/internals/selection.ts +16 -15
- package/src/ChartInternal/internals/size.ts +3 -3
- package/src/ChartInternal/internals/text.ts +8 -8
- package/src/ChartInternal/internals/title.ts +4 -4
- package/src/ChartInternal/internals/tooltip.ts +5 -5
- package/src/ChartInternal/internals/transform.ts +5 -5
- package/src/ChartInternal/shape/arc.ts +22 -22
- package/src/ChartInternal/shape/area.ts +4 -4
- package/src/ChartInternal/shape/bar.ts +7 -7
- package/src/ChartInternal/shape/candlestick.ts +8 -8
- package/src/ChartInternal/shape/gauge.ts +8 -8
- package/src/ChartInternal/shape/line.ts +7 -7
- package/src/ChartInternal/shape/point.ts +18 -18
- package/src/ChartInternal/shape/radar.ts +10 -10
- package/src/ChartInternal/shape/shape.ts +4 -2
- package/src/Plugin/sparkline/index.ts +2 -2
- package/src/Plugin/stanford/index.ts +3 -3
- package/src/Plugin/stanford/util.ts +0 -1
- package/src/config/Options/common/tooltip.ts +10 -1
- package/src/config/classes.ts +154 -66
- package/src/module/util.ts +21 -13
|
@@ -5,13 +5,10 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.3.
|
|
8
|
+
* @version 3.3.3
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
12
|
-
import 'd3-selection';
|
|
13
|
-
import 'd3-brush';
|
|
14
|
-
|
|
15
12
|
/*! *****************************************************************************
|
|
16
13
|
Copyright (c) Microsoft Corporation.
|
|
17
14
|
|
|
@@ -118,8 +115,6 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
118
115
|
if (options === void 0) {
|
|
119
116
|
options = {};
|
|
120
117
|
}
|
|
121
|
-
|
|
122
|
-
this.$$;
|
|
123
118
|
this.options = options;
|
|
124
119
|
}
|
|
125
120
|
/**
|
|
@@ -170,7 +165,7 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
170
165
|
return Plugin;
|
|
171
166
|
}();
|
|
172
167
|
|
|
173
|
-
Plugin.version = "#3.3.
|
|
168
|
+
Plugin.version = "#3.3.3#";
|
|
174
169
|
|
|
175
170
|
/**
|
|
176
171
|
* Copyright (c) 2021 ~ present NAVER Corp.
|
|
@@ -273,6 +268,7 @@ var Options = /** @class */ (function () {
|
|
|
273
268
|
}
|
|
274
269
|
return Options;
|
|
275
270
|
}());
|
|
271
|
+
var Options$1 = Options;
|
|
276
272
|
|
|
277
273
|
/**
|
|
278
274
|
* Copyright (c) 2021 ~ present NAVER Corp.
|
|
@@ -497,7 +493,7 @@ var TableView = /** @class */ (function (_super) {
|
|
|
497
493
|
__extends(TableView, _super);
|
|
498
494
|
function TableView(options) {
|
|
499
495
|
var _this = _super.call(this, options) || this;
|
|
500
|
-
_this.config = new Options();
|
|
496
|
+
_this.config = new Options$1();
|
|
501
497
|
return _this;
|
|
502
498
|
}
|
|
503
499
|
TableView.prototype.$beforeInit = function () {
|
|
@@ -5,14 +5,12 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.3.
|
|
8
|
+
* @version 3.3.3
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
12
12
|
import { Delaunay } from 'd3-delaunay';
|
|
13
13
|
import { polygonCentroid, polygonArea } from 'd3-polygon';
|
|
14
|
-
import 'd3-selection';
|
|
15
|
-
import 'd3-brush';
|
|
16
14
|
|
|
17
15
|
/*! *****************************************************************************
|
|
18
16
|
Copyright (c) Microsoft Corporation.
|
|
@@ -248,8 +246,6 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
248
246
|
if (options === void 0) {
|
|
249
247
|
options = {};
|
|
250
248
|
}
|
|
251
|
-
|
|
252
|
-
this.$$;
|
|
253
249
|
this.options = options;
|
|
254
250
|
}
|
|
255
251
|
/**
|
|
@@ -300,7 +296,7 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
300
296
|
return Plugin;
|
|
301
297
|
}();
|
|
302
298
|
|
|
303
|
-
Plugin.version = "#3.3.
|
|
299
|
+
Plugin.version = "#3.3.3#";
|
|
304
300
|
|
|
305
301
|
/**
|
|
306
302
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -353,6 +349,7 @@ var Options = /** @class */ (function () {
|
|
|
353
349
|
}
|
|
354
350
|
return Options;
|
|
355
351
|
}());
|
|
352
|
+
var Options$1 = Options;
|
|
356
353
|
|
|
357
354
|
/**
|
|
358
355
|
* TextOverlap plugin<br>
|
|
@@ -401,7 +398,7 @@ var TextOverlap = /** @class */ (function (_super) {
|
|
|
401
398
|
__extends(TextOverlap, _super);
|
|
402
399
|
function TextOverlap(options) {
|
|
403
400
|
var _this = _super.call(this, options) || this;
|
|
404
|
-
_this.config = new Options();
|
|
401
|
+
_this.config = new Options$1();
|
|
405
402
|
return _this;
|
|
406
403
|
}
|
|
407
404
|
TextOverlap.prototype.$init = function () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "billboard.js",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.3",
|
|
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",
|
|
@@ -95,32 +95,32 @@
|
|
|
95
95
|
"d3-zoom": "^3.0.0"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@babel/core": "^7.
|
|
99
|
-
"@babel/eslint-parser": "^7.
|
|
98
|
+
"@babel/core": "^7.17.5",
|
|
99
|
+
"@babel/eslint-parser": "^7.17.0",
|
|
100
100
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
101
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.
|
|
102
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
101
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.17.3",
|
|
102
|
+
"@babel/plugin-transform-runtime": "^7.17.0",
|
|
103
103
|
"@babel/preset-env": "^7.16.8",
|
|
104
104
|
"@babel/preset-typescript": "^7.16.7",
|
|
105
|
-
"@babel/runtime": "^7.
|
|
105
|
+
"@babel/runtime": "^7.17.2",
|
|
106
106
|
"@commitlint/cli": "^15.0.0",
|
|
107
|
-
"@commitlint/config-conventional": "^16.
|
|
107
|
+
"@commitlint/config-conventional": "^16.2.1",
|
|
108
108
|
"@rollup/plugin-babel": "^5.3.0",
|
|
109
109
|
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
110
|
-
"@rollup/plugin-replace": "^3.0
|
|
110
|
+
"@rollup/plugin-replace": "^3.1.0",
|
|
111
111
|
"@rollup/plugin-typescript": "^8.3.0",
|
|
112
112
|
"@semantic-release/changelog": "^6.0.1",
|
|
113
113
|
"@semantic-release/commit-analyzer": "^9.0.2",
|
|
114
114
|
"@semantic-release/exec": "^6.0.3",
|
|
115
115
|
"@semantic-release/git": "^10.0.1",
|
|
116
|
-
"@semantic-release/npm": "^
|
|
116
|
+
"@semantic-release/npm": "^9.0.0",
|
|
117
117
|
"@semantic-release/release-notes-generator": "^10.0.3",
|
|
118
118
|
"@types/chai": "^4.3.0",
|
|
119
119
|
"@types/d3": "^7.1.0",
|
|
120
120
|
"@types/mocha": "^9.0.0",
|
|
121
|
-
"@types/sinon": "^10.0.
|
|
122
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
123
|
-
"@typescript-eslint/parser": "^5.
|
|
121
|
+
"@types/sinon": "^10.0.11",
|
|
122
|
+
"@typescript-eslint/eslint-plugin": "^5.12.1",
|
|
123
|
+
"@typescript-eslint/parser": "^5.12.1",
|
|
124
124
|
"babel-helper-modules": "^6.0.0",
|
|
125
125
|
"babel-loader": "^8.2.3",
|
|
126
126
|
"babel-plugin-add-module-exports": "^1.0.4",
|
|
@@ -132,14 +132,14 @@
|
|
|
132
132
|
"babel-plugin-transform-inline-consecutive-adds": "^0.4.3",
|
|
133
133
|
"babel-plugin-transform-merge-sibling-variables": "^6.9.4",
|
|
134
134
|
"babel-plugin-transform-minify-booleans": "^6.9.4",
|
|
135
|
-
"better-docs": "^2.
|
|
135
|
+
"better-docs": "^2.7.2",
|
|
136
136
|
"chai": "^4.3.4",
|
|
137
137
|
"clean-webpack-plugin": "^4.0.0",
|
|
138
138
|
"cloc": "^2.9.0",
|
|
139
|
-
"core-js": "^3.
|
|
139
|
+
"core-js": "^3.21.1",
|
|
140
140
|
"coveralls": "^3.1.1",
|
|
141
141
|
"cross-env": "^7.0.3",
|
|
142
|
-
"css-loader": "^6.
|
|
142
|
+
"css-loader": "^6.6.0",
|
|
143
143
|
"css-minimizer-webpack-plugin": "^3.3.1",
|
|
144
144
|
"d3-color": "^3.0.1",
|
|
145
145
|
"d3-delaunay": "^6.0.2",
|
|
@@ -147,18 +147,18 @@
|
|
|
147
147
|
"d3-polygon": "^3.0.1",
|
|
148
148
|
"docdash": "^1.2.0",
|
|
149
149
|
"dtslint": "^4.2.1",
|
|
150
|
-
"eslint": "^8.
|
|
150
|
+
"eslint": "^8.9.0",
|
|
151
151
|
"eslint-config-naver": "^2.1.0",
|
|
152
152
|
"eslint-plugin-import": "^2.25.4",
|
|
153
|
-
"eslint-plugin-jsdoc": "^37.
|
|
153
|
+
"eslint-plugin-jsdoc": "^37.9.4",
|
|
154
154
|
"eslint-webpack-plugin": "^3.1.1",
|
|
155
155
|
"exports-loader": "^3.1.0",
|
|
156
156
|
"hammer-simulator": "0.0.1",
|
|
157
157
|
"husky": "^7.0.4",
|
|
158
158
|
"istanbul-instrumenter-loader": "^3.0.1",
|
|
159
159
|
"istanbul-lib-instrument": "^5.1.0",
|
|
160
|
-
"jsdoc": "^3.6.
|
|
161
|
-
"karma": "^6.3.
|
|
160
|
+
"jsdoc": "^3.6.10",
|
|
161
|
+
"karma": "^6.3.16",
|
|
162
162
|
"karma-chai": "^0.1.0",
|
|
163
163
|
"karma-chrome-launcher": "^3.1.0",
|
|
164
164
|
"karma-coverage-istanbul-reporter": "^3.0.3",
|
|
@@ -169,27 +169,27 @@
|
|
|
169
169
|
"karma-sourcemap-loader": "^0.3.8",
|
|
170
170
|
"karma-webpack": "^5.0.0",
|
|
171
171
|
"lite-fixture": "^1.0.2",
|
|
172
|
-
"mini-css-extract-plugin": "^2.
|
|
173
|
-
"mocha": "^9.1
|
|
172
|
+
"mini-css-extract-plugin": "^2.5.2",
|
|
173
|
+
"mocha": "^9.2.1",
|
|
174
174
|
"node-sass": "^7.0.1",
|
|
175
175
|
"regenerator-runtime": "^0.13.7",
|
|
176
|
-
"rollup": "^2.
|
|
176
|
+
"rollup": "^2.67.3",
|
|
177
177
|
"rollup-plugin-delete": "^2.0.0",
|
|
178
|
-
"sass-loader": "^12.
|
|
179
|
-
"semantic-release": "^
|
|
178
|
+
"sass-loader": "^12.6.0",
|
|
179
|
+
"semantic-release": "^19.0.2",
|
|
180
180
|
"simulant": "^0.2.2",
|
|
181
|
-
"sinon": "^
|
|
181
|
+
"sinon": "^13.0.1",
|
|
182
182
|
"string-replace-loader": "^3.1.0",
|
|
183
183
|
"style-loader": "^3.3.1",
|
|
184
|
-
"terser-webpack-plugin": "^5.3.
|
|
184
|
+
"terser-webpack-plugin": "^5.3.1",
|
|
185
185
|
"tslib": "^2.3.1",
|
|
186
186
|
"typescript": "^4.5.4",
|
|
187
|
-
"webpack": "^5.
|
|
187
|
+
"webpack": "^5.69.1",
|
|
188
188
|
"webpack-bundle-analyzer": "^4.5.0",
|
|
189
189
|
"webpack-clean": "^1.2.5",
|
|
190
190
|
"webpack-cli": "^4.9.1",
|
|
191
191
|
"webpack-common-shake": "^2.1.0",
|
|
192
|
-
"webpack-dev-server": "^4.7.
|
|
192
|
+
"webpack-dev-server": "^4.7.4",
|
|
193
193
|
"webpack-merge": "^5.8.0",
|
|
194
194
|
"webpackbar": "^5.0.2",
|
|
195
195
|
"write-file-webpack-plugin": "^4.5.1"
|
package/src/Chart/api/chart.ts
CHANGED
package/src/Chart/api/focus.ts
CHANGED
|
@@ -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
|
|
6
|
+
import {$FOCUS, $GAUGE} from "../../config/classes";
|
|
7
7
|
|
|
8
8
|
type FocusParam = string | string[];
|
|
9
9
|
|
|
@@ -36,13 +36,13 @@ export default {
|
|
|
36
36
|
this.revert();
|
|
37
37
|
this.defocus();
|
|
38
38
|
|
|
39
|
-
candidates.classed(
|
|
39
|
+
candidates.classed($FOCUS.focused, true).classed($FOCUS.defocused, false);
|
|
40
40
|
|
|
41
41
|
if ($$.hasArcType() && !state.hasRadar) {
|
|
42
42
|
$$.expandArc(targetIds);
|
|
43
43
|
|
|
44
44
|
$$.hasType("gauge") &&
|
|
45
|
-
$$.markOverlapped(targetIdsValue, $$, `.${
|
|
45
|
+
$$.markOverlapped(targetIdsValue, $$, `.${$GAUGE.gaugeValue}`);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
$$.toggleFocusLegend(targetIds, true);
|
|
@@ -76,13 +76,13 @@ export default {
|
|
|
76
76
|
$$.selectorTargets(targetIds.filter($$.isTargetToShow, $$))
|
|
77
77
|
);
|
|
78
78
|
|
|
79
|
-
candidates.classed(
|
|
79
|
+
candidates.classed($FOCUS.focused, false).classed($FOCUS.defocused, true);
|
|
80
80
|
|
|
81
81
|
if ($$.hasArcType()) {
|
|
82
82
|
$$.unexpandArc(targetIds);
|
|
83
83
|
|
|
84
84
|
$$.hasType("gauge") &&
|
|
85
|
-
$$.undoMarkOverlapped($$, `.${
|
|
85
|
+
$$.undoMarkOverlapped($$, `.${$GAUGE.gaugeValue}`);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
$$.toggleFocusLegend(targetIds, false);
|
|
@@ -114,16 +114,16 @@ export default {
|
|
|
114
114
|
const targetIds = $$.mapToTargetIds(targetIdsValue);
|
|
115
115
|
const candidates = $el.svg.selectAll($$.selectorTargets(targetIds)); // should be for all targets
|
|
116
116
|
|
|
117
|
-
candidates.classed(
|
|
117
|
+
candidates.classed($FOCUS.focused, false).classed($FOCUS.defocused, false);
|
|
118
118
|
$$.hasArcType() && $$.unexpandArc(targetIds);
|
|
119
119
|
|
|
120
120
|
if (config.legend_show) {
|
|
121
121
|
$$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));
|
|
122
122
|
$el.legend.selectAll($$.selectorLegends(targetIds))
|
|
123
123
|
.filter(function() {
|
|
124
|
-
return d3Select(this).classed(
|
|
124
|
+
return d3Select(this).classed($FOCUS.legendItemFocused);
|
|
125
125
|
})
|
|
126
|
-
.classed(
|
|
126
|
+
.classed($FOCUS.legendItemFocused, false);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
state.focusedTargetIds = [];
|
package/src/Chart/api/regions.ts
CHANGED
|
@@ -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
|
|
5
|
+
import {$REGION} from "../../config/classes";
|
|
6
6
|
import {getOption, extend} from "../../module/util";
|
|
7
7
|
|
|
8
8
|
type RegionsParam = {axis?: string, class?: string, start?: number, end?: number}[];
|
|
@@ -94,8 +94,8 @@ extend(regions, {
|
|
|
94
94
|
const {config, $T} = $$;
|
|
95
95
|
|
|
96
96
|
const options = optionsValue || {};
|
|
97
|
-
const classes = getOption(options, "classes", [
|
|
98
|
-
let regions = $$.$el.main.select(`.${
|
|
97
|
+
const classes = getOption(options, "classes", [$REGION.region]);
|
|
98
|
+
let regions = $$.$el.main.select(`.${$REGION.regions}`)
|
|
99
99
|
.selectAll(classes.map(c => `.${c}`));
|
|
100
100
|
|
|
101
101
|
$T(regions)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import {select as d3Select} from "d3-selection";
|
|
6
6
|
import {isDefined} from "../../module/util";
|
|
7
|
-
import
|
|
7
|
+
import {$AREA, $LINE, $SELECT, $SHAPE} from "../../config/classes";
|
|
8
8
|
import {DataItem} from "../../../types/types";
|
|
9
9
|
|
|
10
10
|
export default {
|
|
@@ -28,10 +28,10 @@ export default {
|
|
|
28
28
|
const $$ = this.internal;
|
|
29
29
|
const dataPoint: DataItem[] = [];
|
|
30
30
|
|
|
31
|
-
$$.$el.main.selectAll(`.${
|
|
32
|
-
.selectAll(`.${
|
|
31
|
+
$$.$el.main.selectAll(`.${$SHAPE.shapes + $$.getTargetSelectorSuffix(targetId)}`)
|
|
32
|
+
.selectAll(`.${$SHAPE.shape}`)
|
|
33
33
|
.filter(function() {
|
|
34
|
-
return d3Select(this).classed(
|
|
34
|
+
return d3Select(this).classed($SELECT.SELECTED);
|
|
35
35
|
})
|
|
36
36
|
.each(d => dataPoint.push(d));
|
|
37
37
|
|
|
@@ -70,27 +70,27 @@ export default {
|
|
|
70
70
|
return;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
$el.main.selectAll(`.${
|
|
74
|
-
.selectAll(`.${
|
|
73
|
+
$el.main.selectAll(`.${$SHAPE.shapes}`)
|
|
74
|
+
.selectAll(`.${$SHAPE.shape}`)
|
|
75
75
|
.each(function(d, i) {
|
|
76
76
|
const shape = d3Select(this);
|
|
77
77
|
const id = d.data ? d.data.id : d.id;
|
|
78
78
|
const toggle = $$.getToggle(this, d).bind($$);
|
|
79
79
|
const isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0;
|
|
80
80
|
const isTargetIndex = !indices || indices.indexOf(i) >= 0;
|
|
81
|
-
const isSelected = shape.classed(
|
|
81
|
+
const isSelected = shape.classed($SELECT.SELECTED);
|
|
82
82
|
|
|
83
83
|
// line/area selection not supported yet
|
|
84
|
-
if (shape.classed(
|
|
84
|
+
if (shape.classed($LINE.line) || shape.classed($AREA.area)) {
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
if (isTargetId && isTargetIndex) {
|
|
89
89
|
if (config.data_selection_isselectable.bind($$.api)(d) && !isSelected) {
|
|
90
|
-
toggle(true, shape.classed(
|
|
90
|
+
toggle(true, shape.classed($SELECT.SELECTED, true), d, i);
|
|
91
91
|
}
|
|
92
92
|
} else if (isDefined(resetOther) && resetOther && isSelected) {
|
|
93
|
-
toggle(false, shape.classed(
|
|
93
|
+
toggle(false, shape.classed($SELECT.SELECTED, false), d, i);
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
96
|
},
|
|
@@ -120,18 +120,18 @@ export default {
|
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
$el.main.selectAll(`.${
|
|
124
|
-
.selectAll(`.${
|
|
123
|
+
$el.main.selectAll(`.${$SHAPE.shapes}`)
|
|
124
|
+
.selectAll(`.${$SHAPE.shape}`)
|
|
125
125
|
.each(function(d, i) {
|
|
126
126
|
const shape = d3Select(this);
|
|
127
127
|
const id = d.data ? d.data.id : d.id;
|
|
128
128
|
const toggle = $$.getToggle(this, d).bind($$);
|
|
129
129
|
const isTargetId = config.data_selection_grouped || !ids || ids.indexOf(id) >= 0;
|
|
130
130
|
const isTargetIndex = !indices || indices.indexOf(i) >= 0;
|
|
131
|
-
const isSelected = shape.classed(
|
|
131
|
+
const isSelected = shape.classed($SELECT.SELECTED);
|
|
132
132
|
|
|
133
133
|
// line/area selection not supported yet
|
|
134
|
-
if (shape.classed(
|
|
134
|
+
if (shape.classed($LINE.line) || shape.classed($AREA.area)) {
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
137
|
|
|
@@ -140,7 +140,7 @@ export default {
|
|
|
140
140
|
config.data_selection_isselectable.bind($$.api)(d) &&
|
|
141
141
|
isSelected
|
|
142
142
|
) {
|
|
143
|
-
toggle(false, shape.classed(
|
|
143
|
+
toggle(false, shape.classed($SELECT.SELECTED, false), d, i);
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
146
|
}
|
|
@@ -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
|
|
5
|
+
import {$COMMON} from "../../config/classes";
|
|
6
6
|
|
|
7
7
|
export default {
|
|
8
8
|
subchart: {
|
|
@@ -41,20 +41,20 @@ export default {
|
|
|
41
41
|
config.subchart_show = !show;
|
|
42
42
|
!subchart.main && $$.initSubchart();
|
|
43
43
|
|
|
44
|
-
let $target = subchart.main.selectAll(`.${
|
|
44
|
+
let $target = subchart.main.selectAll(`.${$COMMON.target}`);
|
|
45
45
|
|
|
46
46
|
// need to cover when new data has been loaded
|
|
47
47
|
if ($$.data.targets.length !== $target.size()) {
|
|
48
48
|
$$.updateSizes();
|
|
49
49
|
$$.updateTargetsForSubchart($$.data.targets);
|
|
50
50
|
|
|
51
|
-
$target = subchart.main
|
|
51
|
+
$target = subchart.main?.selectAll(`.${$COMMON.target}`);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
$target
|
|
55
|
-
subchart.main
|
|
54
|
+
$target?.style("opacity", null);
|
|
55
|
+
subchart.main?.style("display", null);
|
|
56
56
|
|
|
57
|
-
this.
|
|
57
|
+
this.resize();
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
|
|
@@ -69,13 +69,13 @@ export default {
|
|
|
69
69
|
*/
|
|
70
70
|
hide(): void {
|
|
71
71
|
const $$ = this.internal;
|
|
72
|
-
const {$el: {subchart}, config} = $$;
|
|
72
|
+
const {$el: {subchart: {main}}, config} = $$;
|
|
73
73
|
|
|
74
|
-
if (config.subchart_show &&
|
|
74
|
+
if (config.subchart_show && main?.style("display") !== "none") {
|
|
75
75
|
config.subchart_show = false;
|
|
76
|
-
|
|
76
|
+
main.style("display", "none");
|
|
77
77
|
|
|
78
|
-
this.
|
|
78
|
+
this.resize();
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
81
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "d3-axis";
|
|
11
11
|
import AxisRenderer from "./AxisRenderer";
|
|
12
12
|
import {getScale} from "../internals/scale";
|
|
13
|
-
import
|
|
13
|
+
import {$AXIS} from "../../config/classes";
|
|
14
14
|
import {capitalize, isArray, isFunction, isString, isValue, isEmpty, isNumber, isObjectType, mergeObj, notEmpty, parseDate, sortValue} from "../../module/util";
|
|
15
15
|
|
|
16
16
|
export default {
|
|
@@ -45,7 +45,7 @@ class Axis {
|
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
private getAxisClassName(id) {
|
|
48
|
-
return `${
|
|
48
|
+
return `${$AXIS.axis} ${$AXIS[`axis${capitalize(id)}`]}`;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
private isHorizontal($$, forHorizontal) {
|
|
@@ -100,7 +100,7 @@ class Axis {
|
|
|
100
100
|
|
|
101
101
|
target.forEach(v => {
|
|
102
102
|
const classAxis = this.getAxisClassName(v);
|
|
103
|
-
const classLabel =
|
|
103
|
+
const classLabel = $AXIS[`axis${v.toUpperCase()}Label`];
|
|
104
104
|
|
|
105
105
|
axis[v] = main.append("g")
|
|
106
106
|
.attr("class", classAxis)
|
|
@@ -197,7 +197,7 @@ class Axis {
|
|
|
197
197
|
*/
|
|
198
198
|
updateAxes() {
|
|
199
199
|
const $$ = this.owner;
|
|
200
|
-
const {config, $el: {main}} = $$;
|
|
200
|
+
const {config, $el: {main}, $T} = $$;
|
|
201
201
|
|
|
202
202
|
Object.keys(this.axesList).forEach(id => {
|
|
203
203
|
const axesConfig = config[`axis_${id}_axes`];
|
|
@@ -224,7 +224,7 @@ class Axis {
|
|
|
224
224
|
} else {
|
|
225
225
|
axesConfig[i].domain && scale.domain(axesConfig[i].domain);
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
$T(g).call(v.scale(scale));
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
g.attr("transform", $$.getTranslate(id, i + 1));
|
|
@@ -739,9 +739,9 @@ class Axis {
|
|
|
739
739
|
const {$el: {main}, $T} = $$;
|
|
740
740
|
|
|
741
741
|
const labels = {
|
|
742
|
-
x: main.select(`.${
|
|
743
|
-
y: main.select(`.${
|
|
744
|
-
y2: main.select(`.${
|
|
742
|
+
x: main.select(`.${$AXIS.axisX} .${$AXIS.axisXLabel}`),
|
|
743
|
+
y: main.select(`.${$AXIS.axisY} .${$AXIS.axisYLabel}`),
|
|
744
|
+
y2: main.select(`.${$AXIS.axisY2} .${$AXIS.axisY2Label}`)
|
|
745
745
|
};
|
|
746
746
|
|
|
747
747
|
Object.keys(labels).filter(id => !labels[id].empty())
|
|
@@ -891,11 +891,12 @@ class Axis {
|
|
|
891
891
|
}
|
|
892
892
|
|
|
893
893
|
["y", "y2"].forEach(key => {
|
|
894
|
+
const prefix = `axis_${key}_`;
|
|
894
895
|
const axisScale = scale[key];
|
|
895
896
|
|
|
896
|
-
if (axisScale) {
|
|
897
|
-
const tickValues = config[
|
|
898
|
-
const tickCount = config[
|
|
897
|
+
if (config[`${prefix}show`] && axisScale) {
|
|
898
|
+
const tickValues = config[`${prefix}tick_values`];
|
|
899
|
+
const tickCount = config[`${prefix}tick_count`];
|
|
899
900
|
|
|
900
901
|
axisScale.domain($$.getYDomain(targetsToShow, key, xDomainForZoom));
|
|
901
902
|
|
|
@@ -967,8 +968,9 @@ class Axis {
|
|
|
967
968
|
|
|
968
969
|
tickNodes.each(function(d) {
|
|
969
970
|
if (tickValues.indexOf(d) % intervalForCulling) {
|
|
970
|
-
(lines ? this.querySelector("text") : this)
|
|
971
|
-
|
|
971
|
+
const node = (lines ? this.querySelector("text") : this);
|
|
972
|
+
|
|
973
|
+
node && (node.style.display = "none");
|
|
972
974
|
}
|
|
973
975
|
});
|
|
974
976
|
} else {
|
|
@@ -979,7 +981,7 @@ class Axis {
|
|
|
979
981
|
if (type === "x") {
|
|
980
982
|
const clipPath = current.maxTickWidths.x.clipPath ? clip.pathXAxisTickTexts : null;
|
|
981
983
|
|
|
982
|
-
$el.svg.selectAll(`.${
|
|
984
|
+
$el.svg.selectAll(`.${$AXIS.axisX} .tick text`)
|
|
983
985
|
.attr("clip-path", clipPath);
|
|
984
986
|
}
|
|
985
987
|
}
|
|
@@ -12,14 +12,13 @@ import {
|
|
|
12
12
|
import {select as d3Select} from "d3-selection";
|
|
13
13
|
import {d3Selection} from "../../types/types";
|
|
14
14
|
import {checkModuleImport} from "../module/error";
|
|
15
|
-
|
|
16
|
-
import CLASS from "../config/classes";
|
|
15
|
+
import {$COMMON, $TEXT} from "../config/classes";
|
|
17
16
|
import Store from "../config/Store/Store";
|
|
18
17
|
import Options from "../config/Options/Options";
|
|
19
18
|
import {document, window} from "../module/browser";
|
|
20
19
|
import Cache from "../module/Cache";
|
|
21
20
|
import {generateResize} from "../module/generator";
|
|
22
|
-
import {capitalize, extend, notEmpty, convertInputType, getOption, isFunction, isObject, isString, callFn, sortValue} from "../module/util";
|
|
21
|
+
import {capitalize, extend, notEmpty, convertInputType, getOption, getRandom, isFunction, isObject, isString, callFn, sortValue} from "../module/util";
|
|
23
22
|
|
|
24
23
|
// data
|
|
25
24
|
import dataConvert from "./data/convert";
|
|
@@ -256,7 +255,7 @@ export default class ChartInternal {
|
|
|
256
255
|
const isRotated = config.axis_rotated;
|
|
257
256
|
|
|
258
257
|
// datetime to be used for uniqueness
|
|
259
|
-
state.datetimeId = `bb-${+new Date()}`;
|
|
258
|
+
state.datetimeId = `bb-${+new Date() * (getRandom() as number)}`;
|
|
260
259
|
|
|
261
260
|
$$.color = $$.generateColor();
|
|
262
261
|
$$.levelColor = $$.generateLevelColor();
|
|
@@ -413,7 +412,7 @@ export default class ChartInternal {
|
|
|
413
412
|
|
|
414
413
|
// Define regions
|
|
415
414
|
const main = $el.svg.append("g")
|
|
416
|
-
.classed(
|
|
415
|
+
.classed($COMMON.main, true)
|
|
417
416
|
.attr("transform", $$.getTranslate("main"));
|
|
418
417
|
|
|
419
418
|
$el.main = main;
|
|
@@ -430,7 +429,7 @@ export default class ChartInternal {
|
|
|
430
429
|
// text when empty
|
|
431
430
|
if (config.data_empty_label_text) {
|
|
432
431
|
main.append("text")
|
|
433
|
-
.attr("class", `${
|
|
432
|
+
.attr("class", `${$TEXT.text} ${$COMMON.empty}`)
|
|
434
433
|
.attr("text-anchor", "middle") // horizontal centering of text at x position in all browsers.
|
|
435
434
|
.attr("dominant-baseline", "middle"); // vertical centering of text at y position in all browsers, except IE.
|
|
436
435
|
}
|
|
@@ -444,7 +443,7 @@ export default class ChartInternal {
|
|
|
444
443
|
}
|
|
445
444
|
|
|
446
445
|
// Define g for chart area
|
|
447
|
-
main.append("g").attr("class",
|
|
446
|
+
main.append("g").attr("class", $COMMON.chart)
|
|
448
447
|
.attr("clip-path", state.clip.path);
|
|
449
448
|
|
|
450
449
|
$$.callPluginHook("$init");
|
|
@@ -645,7 +644,7 @@ export default class ChartInternal {
|
|
|
645
644
|
const $$ = <any> this;
|
|
646
645
|
const {$el: {svg}, $T} = $$;
|
|
647
646
|
|
|
648
|
-
$T(svg.selectAll(`.${
|
|
647
|
+
$T(svg.selectAll(`.${$COMMON.target}`)
|
|
649
648
|
.filter(d => $$.isTargetToShow(d.id))
|
|
650
649
|
).style("opacity", null);
|
|
651
650
|
}
|
|
@@ -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
|
|
5
|
+
import {$BAR, $CANDLESTICK, $COMMON} from "../../config/classes";
|
|
6
6
|
import {KEY} from "../../module/Cache";
|
|
7
7
|
import {IData, IDataRow} from "./IData";
|
|
8
8
|
import {
|
|
@@ -750,8 +750,8 @@ export default {
|
|
|
750
750
|
.filter(v => $$.isBarType(v.id) || $$.isCandlestickType(v.id))
|
|
751
751
|
.forEach(v => {
|
|
752
752
|
const selector = $$.isBarType(v.id) ?
|
|
753
|
-
`.${
|
|
754
|
-
`.${
|
|
753
|
+
`.${$BAR.chartBar}.${$COMMON.target}${$$.getTargetSelectorSuffix(v.id)} .${$BAR.bar}-${v.index}` :
|
|
754
|
+
`.${$CANDLESTICK.chartCandlestick}.${$COMMON.target}${$$.getTargetSelectorSuffix(v.id)} .${$CANDLESTICK.candlestick}-${v.index} path`;
|
|
755
755
|
|
|
756
756
|
if (!closest && $$.isWithinBar(main.select(selector).node())) {
|
|
757
757
|
closest = v;
|
|
@@ -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
|
|
5
|
+
import {$LEGEND} from "../../config/classes";
|
|
6
6
|
import {endall} from "../../module/util";
|
|
7
7
|
|
|
8
8
|
export default {
|
|
@@ -111,7 +111,7 @@ export default {
|
|
|
111
111
|
|
|
112
112
|
// Remove target's elements
|
|
113
113
|
if ($el.legend) {
|
|
114
|
-
$el.legend.selectAll(`.${
|
|
114
|
+
$el.legend.selectAll(`.${$LEGEND.legendItem}${$$.getTargetSelectorSuffix(id)}`).remove();
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
// Remove target
|