billboard.js 3.3.2 → 3.4.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/dist/billboard.css +19 -14
- package/dist/billboard.js +474 -100
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +478 -104
- 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 +39 -17
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +39 -17
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +34 -14
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +34 -14
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +6 -6
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +43 -21
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +43 -21
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +38 -18
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +38 -18
- package/dist/theme/datalab.css +24 -20
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +24 -20
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +24 -20
- package/dist/theme/insight.min.css +2 -2
- package/dist-esm/billboard.js +419 -88
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -5
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +3 -5
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +22 -22
- package/src/Chart/api/axis.ts +90 -25
- package/src/Chart/api/focus.ts +3 -2
- package/src/ChartInternal/Axis/Axis.ts +10 -7
- package/src/ChartInternal/ChartInternal.ts +31 -17
- package/src/ChartInternal/data/data.ts +1 -1
- package/src/ChartInternal/interactions/flow.ts +1 -1
- package/src/ChartInternal/internals/color.ts +4 -3
- package/src/ChartInternal/internals/format.ts +5 -1
- package/src/ChartInternal/internals/redraw.ts +3 -0
- package/src/ChartInternal/internals/text.ts +1 -1
- package/src/ChartInternal/internals/transform.ts +4 -1
- package/src/ChartInternal/internals/type.ts +5 -0
- package/src/ChartInternal/shape/arc.ts +41 -17
- package/src/ChartInternal/shape/polar.ts +132 -0
- package/src/ChartInternal/shape/radar.ts +4 -4
- package/src/config/Options/common/main.ts +19 -2
- package/src/config/Options/data/data.ts +3 -0
- package/src/config/Options/shape/polar.ts +81 -0
- package/src/config/classes.ts +6 -3
- package/src/config/const.ts +3 -0
- package/src/config/resolver/shape.ts +4 -0
- package/src/core.ts +1 -0
- package/src/index.esm.ts +1 -0
- package/src/module/generator.ts +12 -4
- package/src/module/util.ts +22 -9
- package/src/scss/billboard.scss +13 -0
- package/src/scss/theme/datalab.scss +13 -0
- package/src/scss/theme/graph.scss +13 -0
- package/src/scss/theme/insight.scss +13 -0
- package/types/bb.d.ts +1 -0
- package/types/chart.d.ts +8 -8
- package/types/options.d.ts +79 -2
- package/types/types.d.ts +2 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.4.0-next.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -142,7 +142,7 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
142
142
|
return Plugin;
|
|
143
143
|
}();
|
|
144
144
|
|
|
145
|
-
Plugin.version = "#3.
|
|
145
|
+
Plugin.version = "#3.4.0-next.2#";
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
* Bubble compare diagram plugin.<br>
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.4.0-next.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -190,9 +190,7 @@ var $GRID = {
|
|
|
190
190
|
};
|
|
191
191
|
var $RADAR = {
|
|
192
192
|
chartRadar: "bb-chart-radar",
|
|
193
|
-
chartRadars: "bb-chart-radars"
|
|
194
|
-
level: "bb-level",
|
|
195
|
-
levels: "bb-levels"
|
|
193
|
+
chartRadars: "bb-chart-radars"
|
|
196
194
|
};
|
|
197
195
|
var $REGION = {
|
|
198
196
|
region: "bb-region",
|
|
@@ -319,7 +317,7 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
319
317
|
return Plugin;
|
|
320
318
|
}();
|
|
321
319
|
|
|
322
|
-
Plugin.version = "#3.
|
|
320
|
+
Plugin.version = "#3.4.0-next.2#";
|
|
323
321
|
|
|
324
322
|
/**
|
|
325
323
|
* Copyright (c) 2021 ~ present NAVER Corp.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.4.0-next.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -196,9 +196,7 @@ var $GRID = {
|
|
|
196
196
|
};
|
|
197
197
|
var $RADAR = {
|
|
198
198
|
chartRadar: "bb-chart-radar",
|
|
199
|
-
chartRadars: "bb-chart-radars"
|
|
200
|
-
level: "bb-level",
|
|
201
|
-
levels: "bb-levels"
|
|
199
|
+
chartRadars: "bb-chart-radars"
|
|
202
200
|
};
|
|
203
201
|
var $REGION = {
|
|
204
202
|
region: "bb-region",
|
|
@@ -519,7 +517,7 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
519
517
|
return Plugin;
|
|
520
518
|
}();
|
|
521
519
|
|
|
522
|
-
Plugin.version = "#3.
|
|
520
|
+
Plugin.version = "#3.4.0-next.2#";
|
|
523
521
|
|
|
524
522
|
/**
|
|
525
523
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.4.0-next.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -165,7 +165,7 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
165
165
|
return Plugin;
|
|
166
166
|
}();
|
|
167
167
|
|
|
168
|
-
Plugin.version = "#3.
|
|
168
|
+
Plugin.version = "#3.4.0-next.2#";
|
|
169
169
|
|
|
170
170
|
/**
|
|
171
171
|
* Copyright (c) 2021 ~ present NAVER Corp.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.4.0-next.2
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -296,7 +296,7 @@ var Plugin = /*#__PURE__*/function () {
|
|
|
296
296
|
return Plugin;
|
|
297
297
|
}();
|
|
298
298
|
|
|
299
|
-
Plugin.version = "#3.
|
|
299
|
+
Plugin.version = "#3.4.0-next.2#";
|
|
300
300
|
|
|
301
301
|
/**
|
|
302
302
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "billboard.js",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.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",
|
|
@@ -95,32 +95,32 @@
|
|
|
95
95
|
"d3-zoom": "^3.0.0"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
|
-
"@babel/core": "^7.17.
|
|
98
|
+
"@babel/core": "^7.17.8",
|
|
99
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.
|
|
101
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.17.3",
|
|
102
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.17.
|
|
105
|
+
"@babel/runtime": "^7.17.8",
|
|
106
106
|
"@commitlint/cli": "^15.0.0",
|
|
107
107
|
"@commitlint/config-conventional": "^16.2.1",
|
|
108
|
-
"@rollup/plugin-babel": "^5.3.
|
|
108
|
+
"@rollup/plugin-babel": "^5.3.1",
|
|
109
109
|
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
110
|
-
"@rollup/plugin-replace": "^
|
|
111
|
-
"@rollup/plugin-typescript": "^8.3.
|
|
110
|
+
"@rollup/plugin-replace": "^4.0.0",
|
|
111
|
+
"@rollup/plugin-typescript": "^8.3.1",
|
|
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": "^9.0.
|
|
116
|
+
"@semantic-release/npm": "^9.0.1",
|
|
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
121
|
"@types/sinon": "^10.0.11",
|
|
122
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
123
|
-
"@typescript-eslint/parser": "^5.
|
|
122
|
+
"@typescript-eslint/eslint-plugin": "^5.16.0",
|
|
123
|
+
"@typescript-eslint/parser": "^5.16.0",
|
|
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",
|
|
@@ -136,10 +136,10 @@
|
|
|
136
136
|
"chai": "^4.3.4",
|
|
137
137
|
"clean-webpack-plugin": "^4.0.0",
|
|
138
138
|
"cloc": "^2.9.0",
|
|
139
|
-
"core-js": "^3.21.
|
|
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.7.1",
|
|
143
143
|
"css-minimizer-webpack-plugin": "^3.3.1",
|
|
144
144
|
"d3-color": "^3.0.1",
|
|
145
145
|
"d3-delaunay": "^6.0.2",
|
|
@@ -147,10 +147,10 @@
|
|
|
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.11.0",
|
|
151
151
|
"eslint-config-naver": "^2.1.0",
|
|
152
152
|
"eslint-plugin-import": "^2.25.4",
|
|
153
|
-
"eslint-plugin-jsdoc": "^
|
|
153
|
+
"eslint-plugin-jsdoc": "^38.0.6",
|
|
154
154
|
"eslint-webpack-plugin": "^3.1.1",
|
|
155
155
|
"exports-loader": "^3.1.0",
|
|
156
156
|
"hammer-simulator": "0.0.1",
|
|
@@ -158,9 +158,9 @@
|
|
|
158
158
|
"istanbul-instrumenter-loader": "^3.0.1",
|
|
159
159
|
"istanbul-lib-instrument": "^5.1.0",
|
|
160
160
|
"jsdoc": "^3.6.10",
|
|
161
|
-
"karma": "^6.3.
|
|
161
|
+
"karma": "^6.3.17",
|
|
162
162
|
"karma-chai": "^0.1.0",
|
|
163
|
-
"karma-chrome-launcher": "^3.1.
|
|
163
|
+
"karma-chrome-launcher": "^3.1.1",
|
|
164
164
|
"karma-coverage-istanbul-reporter": "^3.0.3",
|
|
165
165
|
"karma-mocha": "^2.0.1",
|
|
166
166
|
"karma-mocha-reporter": "^2.2.3",
|
|
@@ -169,13 +169,13 @@
|
|
|
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.
|
|
172
|
+
"mini-css-extract-plugin": "^2.6.0",
|
|
173
|
+
"mocha": "^9.2.2",
|
|
174
174
|
"node-sass": "^7.0.1",
|
|
175
175
|
"regenerator-runtime": "^0.13.7",
|
|
176
|
-
"rollup": "^2.
|
|
176
|
+
"rollup": "^2.70.1",
|
|
177
177
|
"rollup-plugin-delete": "^2.0.0",
|
|
178
|
-
"sass-loader": "^12.
|
|
178
|
+
"sass-loader": "^12.6.0",
|
|
179
179
|
"semantic-release": "^19.0.2",
|
|
180
180
|
"simulant": "^0.2.2",
|
|
181
181
|
"sinon": "^13.0.1",
|
|
@@ -183,8 +183,8 @@
|
|
|
183
183
|
"style-loader": "^3.3.1",
|
|
184
184
|
"terser-webpack-plugin": "^5.3.1",
|
|
185
185
|
"tslib": "^2.3.1",
|
|
186
|
-
"typescript": "^4.
|
|
187
|
-
"webpack": "^5.
|
|
186
|
+
"typescript": "^4.6.2",
|
|
187
|
+
"webpack": "^5.70.0",
|
|
188
188
|
"webpack-bundle-analyzer": "^4.5.0",
|
|
189
189
|
"webpack-clean": "^1.2.5",
|
|
190
190
|
"webpack-cli": "^4.9.1",
|
package/src/Chart/api/axis.ts
CHANGED
|
@@ -2,7 +2,18 @@
|
|
|
2
2
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
3
3
|
* billboard.js project is licensed under the MIT license
|
|
4
4
|
*/
|
|
5
|
-
import {isValue, isDefined, isObjectType} from "../../module/util";
|
|
5
|
+
import {isValue, isDefined, isObjectType, isNumber} from "../../module/util";
|
|
6
|
+
|
|
7
|
+
type AxisOption = {
|
|
8
|
+
x?: number | false;
|
|
9
|
+
y?: number | false;
|
|
10
|
+
y2?: number | false;
|
|
11
|
+
} | number | false;
|
|
12
|
+
|
|
13
|
+
type RangeAxisOption = {
|
|
14
|
+
min? : AxisOption;
|
|
15
|
+
max?: AxisOption;
|
|
16
|
+
};
|
|
6
17
|
|
|
7
18
|
/**
|
|
8
19
|
* Set the min/max value
|
|
@@ -11,20 +22,28 @@ import {isValue, isDefined, isObjectType} from "../../module/util";
|
|
|
11
22
|
* @param {object} value Value to be set
|
|
12
23
|
* @private
|
|
13
24
|
*/
|
|
14
|
-
function setMinMax($$, type: "min" | "max", value): void {
|
|
25
|
+
function setMinMax($$, type: "min" | "max", value: AxisOption): void {
|
|
15
26
|
const {config} = $$;
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
27
|
+
const helper = (key, value) => {
|
|
28
|
+
const v = isNumber(value) ? value : (
|
|
29
|
+
value === false ? undefined : null
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
if (v !== null) {
|
|
33
|
+
config[`axis_${key}_${type}`] = v;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
19
36
|
|
|
20
37
|
if (isDefined(value)) {
|
|
21
38
|
if (isObjectType(value)) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
} else {
|
|
26
|
-
|
|
27
|
-
|
|
39
|
+
Object.keys(value).forEach(key => {
|
|
40
|
+
helper(key, value[key]);
|
|
41
|
+
});
|
|
42
|
+
} else if (isNumber(value) || value === false) {
|
|
43
|
+
// shorthand values affects only y and y2.
|
|
44
|
+
["y", "y2"].forEach(key => {
|
|
45
|
+
helper(key, value);
|
|
46
|
+
});
|
|
28
47
|
}
|
|
29
48
|
|
|
30
49
|
$$.redraw({
|
|
@@ -111,8 +130,9 @@ const axis = {
|
|
|
111
130
|
* @instance
|
|
112
131
|
* @memberof Chart
|
|
113
132
|
* @param {object} min If min is given, specified axis' min value will be updated.<br>
|
|
114
|
-
*
|
|
115
|
-
*
|
|
133
|
+
* If no argument is given, the min values set on generating option for each axis will be returned.
|
|
134
|
+
* If not set any min values on generation, it will return `undefined`.<br>
|
|
135
|
+
* To unset specific axis max, set `false` to each of them.
|
|
116
136
|
* @returns {object|undefined}
|
|
117
137
|
* @example
|
|
118
138
|
* // Update axis' min
|
|
@@ -121,12 +141,23 @@ const axis = {
|
|
|
121
141
|
* y: 1000,
|
|
122
142
|
* y2: 100
|
|
123
143
|
* });
|
|
144
|
+
*
|
|
145
|
+
* // To unset specific axis min, set false to each of them.
|
|
146
|
+
* chart.axis.min({
|
|
147
|
+
* x: false,
|
|
148
|
+
* y: false,
|
|
149
|
+
* y2: false
|
|
150
|
+
* });
|
|
151
|
+
*
|
|
152
|
+
* // shorthand (only affects y and y2 axis)
|
|
153
|
+
* chart.axis.min(-50);
|
|
154
|
+
* chart.axis.min(false);
|
|
124
155
|
*/
|
|
125
|
-
min: function(min?:
|
|
156
|
+
min: function(min?: AxisOption): object|void {
|
|
126
157
|
const $$ = this.internal;
|
|
127
158
|
|
|
128
|
-
return isValue(min) ?
|
|
129
|
-
setMinMax($$, "min", min) :
|
|
159
|
+
return isValue(min) || min === false ?
|
|
160
|
+
setMinMax($$, "min", min as AxisOption) :
|
|
130
161
|
getMinMax($$, "min");
|
|
131
162
|
},
|
|
132
163
|
|
|
@@ -136,8 +167,9 @@ const axis = {
|
|
|
136
167
|
* @instance
|
|
137
168
|
* @memberof Chart
|
|
138
169
|
* @param {object} max If max is given, specified axis' max value will be updated.<br>
|
|
139
|
-
*
|
|
140
|
-
*
|
|
170
|
+
* If no argument is given, the max values set on generating option for each axis will be returned.
|
|
171
|
+
* If not set any max values on generation, it will return `undefined`.<br>
|
|
172
|
+
* To unset specific axis max, set `false` to each of them.
|
|
141
173
|
* @returns {object|undefined}
|
|
142
174
|
* @example
|
|
143
175
|
* // Update axis' label
|
|
@@ -146,12 +178,23 @@ const axis = {
|
|
|
146
178
|
* y: 1000,
|
|
147
179
|
* y2: 10000
|
|
148
180
|
* });
|
|
181
|
+
*
|
|
182
|
+
* // To unset specific axis max, set false to each of them.
|
|
183
|
+
* chart.axis.max({
|
|
184
|
+
* x: false,
|
|
185
|
+
* y: false,
|
|
186
|
+
* y2: false
|
|
187
|
+
* });
|
|
188
|
+
*
|
|
189
|
+
* // shorthand (only affects y and y2 axis)
|
|
190
|
+
* chart.axis.max(10);
|
|
191
|
+
* chart.axis.max(false);
|
|
149
192
|
*/
|
|
150
|
-
max: function(max?:
|
|
193
|
+
max: function(max?: AxisOption): object|void {
|
|
151
194
|
const $$ = this.internal;
|
|
152
195
|
|
|
153
|
-
return
|
|
154
|
-
setMinMax($$, "max", max) :
|
|
196
|
+
return isValue(max) || max === false ?
|
|
197
|
+
setMinMax($$, "max", max as AxisOption) :
|
|
155
198
|
getMinMax($$, "max");
|
|
156
199
|
},
|
|
157
200
|
|
|
@@ -160,7 +203,9 @@ const axis = {
|
|
|
160
203
|
* @function axis․range
|
|
161
204
|
* @instance
|
|
162
205
|
* @memberof Chart
|
|
163
|
-
* @param {object} range If range is given, specified axis' min and max value will be updated.
|
|
206
|
+
* @param {object} range If range is given, specified axis' min and max value will be updated.
|
|
207
|
+
* If no argument is given, the current min and max values for each axis will be returned.<br>
|
|
208
|
+
* To unset specific axis max, set `false` to each of them.
|
|
164
209
|
* @returns {object|undefined}
|
|
165
210
|
* @example
|
|
166
211
|
* // Update axis' label
|
|
@@ -176,13 +221,33 @@ const axis = {
|
|
|
176
221
|
* y2: 10000
|
|
177
222
|
* },
|
|
178
223
|
* });
|
|
224
|
+
*
|
|
225
|
+
* // To unset specific axis max, set false to each of them.
|
|
226
|
+
* chart.axis.range({
|
|
227
|
+
* min: {
|
|
228
|
+
* x: false,
|
|
229
|
+
* y: false,
|
|
230
|
+
* y2: false
|
|
231
|
+
* },
|
|
232
|
+
* max: {
|
|
233
|
+
* x: false,
|
|
234
|
+
* y: false,
|
|
235
|
+
* y2: false
|
|
236
|
+
* },
|
|
237
|
+
* });
|
|
238
|
+
*
|
|
239
|
+
* // shorthand (only affects y and y2 axis)
|
|
240
|
+
* chart.axis.range({ min: -50, max: 1000 });
|
|
241
|
+
* chart.axis.range({ min: false, max: false });
|
|
179
242
|
*/
|
|
180
|
-
range: function(range): object|void {
|
|
243
|
+
range: function(range: RangeAxisOption): object|void {
|
|
181
244
|
const {axis} = this;
|
|
182
245
|
|
|
183
246
|
if (arguments.length) {
|
|
184
|
-
|
|
185
|
-
|
|
247
|
+
const {min, max} = range;
|
|
248
|
+
|
|
249
|
+
isDefined(max) && axis.max(max);
|
|
250
|
+
isDefined(min) && axis.min(min);
|
|
186
251
|
} else {
|
|
187
252
|
return {
|
|
188
253
|
max: axis.max(),
|
package/src/Chart/api/focus.ts
CHANGED
|
@@ -78,7 +78,7 @@ export default {
|
|
|
78
78
|
|
|
79
79
|
candidates.classed($FOCUS.focused, false).classed($FOCUS.defocused, true);
|
|
80
80
|
|
|
81
|
-
if ($$.hasArcType()) {
|
|
81
|
+
if ($$.hasArcType(null, ["polar"])) {
|
|
82
82
|
$$.unexpandArc(targetIds);
|
|
83
83
|
|
|
84
84
|
$$.hasType("gauge") &&
|
|
@@ -115,7 +115,8 @@ export default {
|
|
|
115
115
|
const candidates = $el.svg.selectAll($$.selectorTargets(targetIds)); // should be for all targets
|
|
116
116
|
|
|
117
117
|
candidates.classed($FOCUS.focused, false).classed($FOCUS.defocused, false);
|
|
118
|
-
|
|
118
|
+
|
|
119
|
+
$$.hasArcType(null, ["polar"]) && $$.unexpandArc(targetIds);
|
|
119
120
|
|
|
120
121
|
if (config.legend_show) {
|
|
121
122
|
$$.showLegend(targetIds.filter($$.isLegendToShow.bind($$)));
|
|
@@ -894,7 +894,7 @@ class Axis {
|
|
|
894
894
|
const prefix = `axis_${key}_`;
|
|
895
895
|
const axisScale = scale[key];
|
|
896
896
|
|
|
897
|
-
if (
|
|
897
|
+
if (axisScale) {
|
|
898
898
|
const tickValues = config[`${prefix}tick_values`];
|
|
899
899
|
const tickCount = config[`${prefix}tick_count`];
|
|
900
900
|
|
|
@@ -941,6 +941,7 @@ class Axis {
|
|
|
941
941
|
const $$ = this.owner;
|
|
942
942
|
const {config, state: {clip, current}, $el} = $$;
|
|
943
943
|
|
|
944
|
+
|
|
944
945
|
["subX", "x", "y", "y2"].forEach(type => {
|
|
945
946
|
const axis = $el.axis[type];
|
|
946
947
|
|
|
@@ -966,12 +967,14 @@ class Axis {
|
|
|
966
967
|
}
|
|
967
968
|
}
|
|
968
969
|
|
|
969
|
-
tickNodes
|
|
970
|
-
|
|
971
|
-
(lines ? this.querySelector("text") : this)
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
970
|
+
tickNodes
|
|
971
|
+
.each(function(d) {
|
|
972
|
+
const node = (lines ? this.querySelector("text") : this);
|
|
973
|
+
|
|
974
|
+
if (node) {
|
|
975
|
+
node.style.display = tickValues.indexOf(d) % intervalForCulling ? "none" : null;
|
|
976
|
+
}
|
|
977
|
+
});
|
|
975
978
|
} else {
|
|
976
979
|
tickNodes.style("display", null);
|
|
977
980
|
}
|
|
@@ -18,7 +18,7 @@ import Options from "../config/Options/Options";
|
|
|
18
18
|
import {document, window} from "../module/browser";
|
|
19
19
|
import Cache from "../module/Cache";
|
|
20
20
|
import {generateResize} from "../module/generator";
|
|
21
|
-
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";
|
|
22
22
|
|
|
23
23
|
// data
|
|
24
24
|
import dataConvert from "./data/convert";
|
|
@@ -251,11 +251,11 @@ export default class ChartInternal {
|
|
|
251
251
|
|
|
252
252
|
initParams(): void {
|
|
253
253
|
const $$ = <any> this;
|
|
254
|
-
const {config, format, state} =
|
|
254
|
+
const {config, format, state} = $$;
|
|
255
255
|
const isRotated = config.axis_rotated;
|
|
256
256
|
|
|
257
257
|
// datetime to be used for uniqueness
|
|
258
|
-
state.datetimeId = `bb-${+new Date()}`;
|
|
258
|
+
state.datetimeId = `bb-${+new Date() * (getRandom() as number)}`;
|
|
259
259
|
|
|
260
260
|
$$.color = $$.generateColor();
|
|
261
261
|
$$.levelColor = $$.generateLevelColor();
|
|
@@ -313,6 +313,7 @@ export default class ChartInternal {
|
|
|
313
313
|
const {config, scale, state, $el, org} = $$;
|
|
314
314
|
const {hasAxis} = state;
|
|
315
315
|
const hasInteraction = config.interaction_enabled;
|
|
316
|
+
const hasPolar = $$.hasType("polar");
|
|
316
317
|
|
|
317
318
|
// for arc type, set axes to not be shown
|
|
318
319
|
// $$.hasArcType() && ["x", "y", "y2"].forEach(id => (config[`axis_${id}_show`] = false));
|
|
@@ -377,9 +378,12 @@ export default class ChartInternal {
|
|
|
377
378
|
|
|
378
379
|
if (hasInteraction && state.inputType) {
|
|
379
380
|
const isTouch = state.inputType === "touch";
|
|
381
|
+
const {onclick, onover, onout} = config;
|
|
380
382
|
|
|
381
|
-
$el.svg
|
|
382
|
-
.on(
|
|
383
|
+
$el.svg
|
|
384
|
+
.on("click", onclick?.bind($$.api) || null)
|
|
385
|
+
.on(isTouch ? "touchstart" : "mouseenter", onover?.bind($$.api) || null)
|
|
386
|
+
.on(isTouch ? "touchend" : "mouseleave", onout?.bind($$.api) || null);
|
|
383
387
|
}
|
|
384
388
|
|
|
385
389
|
config.svg_classname && $el.svg.attr("class", config.svg_classname);
|
|
@@ -387,7 +391,7 @@ export default class ChartInternal {
|
|
|
387
391
|
// Define defs
|
|
388
392
|
const hasColorPatterns = (isFunction(config.color_tiles) && $$.patterns);
|
|
389
393
|
|
|
390
|
-
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors) {
|
|
394
|
+
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors || hasPolar) {
|
|
391
395
|
$el.defs = $el.svg.append("defs");
|
|
392
396
|
|
|
393
397
|
if (hasAxis) {
|
|
@@ -396,7 +400,7 @@ export default class ChartInternal {
|
|
|
396
400
|
});
|
|
397
401
|
}
|
|
398
402
|
|
|
399
|
-
// Append data
|
|
403
|
+
// Append data background color filter definition
|
|
400
404
|
$$.generateDataLabelBackgroundColorFilter();
|
|
401
405
|
|
|
402
406
|
// set color patterns
|
|
@@ -512,6 +516,8 @@ export default class ChartInternal {
|
|
|
512
516
|
}
|
|
513
517
|
});
|
|
514
518
|
} else {
|
|
519
|
+
const hasPolar = $$.hasType("polar");
|
|
520
|
+
|
|
515
521
|
if (!hasRadar) {
|
|
516
522
|
types.push("Arc", "Pie");
|
|
517
523
|
}
|
|
@@ -520,6 +526,8 @@ export default class ChartInternal {
|
|
|
520
526
|
types.push("Gauge");
|
|
521
527
|
} else if (hasRadar) {
|
|
522
528
|
types.push("Radar");
|
|
529
|
+
} else if (hasPolar) {
|
|
530
|
+
types.push("Polar");
|
|
523
531
|
}
|
|
524
532
|
}
|
|
525
533
|
|
|
@@ -600,6 +608,9 @@ export default class ChartInternal {
|
|
|
600
608
|
updateTargets(targets): void {
|
|
601
609
|
const $$ = <any> this;
|
|
602
610
|
const {hasAxis, hasRadar} = $$.state;
|
|
611
|
+
const helper = type => $$[`updateTargetsFor${type}`](
|
|
612
|
+
targets.filter($$[`is${type}Type`].bind($$))
|
|
613
|
+
);
|
|
603
614
|
|
|
604
615
|
// Text
|
|
605
616
|
$$.updateTargetsForText(targets);
|
|
@@ -609,22 +620,25 @@ export default class ChartInternal {
|
|
|
609
620
|
const name = capitalize(v);
|
|
610
621
|
|
|
611
622
|
if ((v === "line" && $$.hasTypeOf(name)) || $$.hasType(v)) {
|
|
612
|
-
|
|
613
|
-
targets.filter($$[`is${name}Type`].bind($$))
|
|
614
|
-
);
|
|
623
|
+
helper(name);
|
|
615
624
|
}
|
|
616
625
|
});
|
|
617
626
|
|
|
618
627
|
// Sub Chart
|
|
619
628
|
$$.updateTargetsForSubchart &&
|
|
620
629
|
$$.updateTargetsForSubchart(targets);
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
630
|
+
|
|
631
|
+
// Arc, Polar, Radar
|
|
632
|
+
} else if ($$.hasArcType(targets)) {
|
|
633
|
+
let type = "Arc";
|
|
634
|
+
|
|
635
|
+
if (hasRadar) {
|
|
636
|
+
type = "Radar";
|
|
637
|
+
} else if ($$.hasType("polar")) {
|
|
638
|
+
type = "Polar";
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
helper(type);
|
|
628
642
|
}
|
|
629
643
|
|
|
630
644
|
// circle
|
|
@@ -271,7 +271,7 @@ export default {
|
|
|
271
271
|
* @private
|
|
272
272
|
* @returns {{min: Array, max: Array}}
|
|
273
273
|
*/
|
|
274
|
-
getMinMaxData() {
|
|
274
|
+
getMinMaxData(): {min: IDataRow[], max: IDataRow[]} {
|
|
275
275
|
const $$ = this;
|
|
276
276
|
const cacheKey = KEY.dataMinMax;
|
|
277
277
|
let minMaxData = $$.cache.get(cacheKey);
|
|
@@ -230,7 +230,7 @@ export default {
|
|
|
230
230
|
} else {
|
|
231
231
|
translateX = $$.axis.isTimeSeries() ?
|
|
232
232
|
x(orgDomain[0]) - x(domain[0]) :
|
|
233
|
-
x(flowStart
|
|
233
|
+
x(flowStart?.x || 0) - x(flowEnd.x);
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
const scaleX = (diffDomain(orgDomain) / diffDomain(domain));
|
|
@@ -160,12 +160,13 @@ export default {
|
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
162
|
* Append data backgound color filter definition
|
|
163
|
+
* @param {string} color Color string
|
|
163
164
|
* @private
|
|
164
165
|
*/
|
|
165
|
-
generateDataLabelBackgroundColorFilter(): void {
|
|
166
|
+
generateDataLabelBackgroundColorFilter(color?: string): void {
|
|
166
167
|
const $$ = this;
|
|
167
168
|
const {$el, config, state} = $$;
|
|
168
|
-
const backgroundColors = config.data_labels_backgroundColors;
|
|
169
|
+
const backgroundColors = color || config.data_labels_backgroundColors;
|
|
169
170
|
|
|
170
171
|
if (backgroundColors) {
|
|
171
172
|
let ids: string[] = [];
|
|
@@ -177,7 +178,7 @@ export default {
|
|
|
177
178
|
}
|
|
178
179
|
|
|
179
180
|
ids.forEach(v => {
|
|
180
|
-
const id = `${state.datetimeId}-labels-bg${$$.getTargetSelectorSuffix(v)}`;
|
|
181
|
+
const id = `${state.datetimeId}-labels-bg${$$.getTargetSelectorSuffix(v)}${color ? $$.getTargetSelectorSuffix(color) : ""}`;
|
|
181
182
|
|
|
182
183
|
$el.defs.append("filter")
|
|
183
184
|
.attr("x", "0")
|
|
@@ -39,7 +39,7 @@ export default {
|
|
|
39
39
|
getDefaultValueFormat(): Function {
|
|
40
40
|
const $$ = this;
|
|
41
41
|
const {defaultArcValueFormat, yFormat, y2Format} = $$;
|
|
42
|
-
const hasArc = $$.hasArcType(null, ["gauge", "radar"]);
|
|
42
|
+
const hasArc = $$.hasArcType(null, ["gauge", "polar", "radar"]);
|
|
43
43
|
|
|
44
44
|
return function(v, ratio, id) {
|
|
45
45
|
const format = hasArc ? defaultArcValueFormat : (
|
|
@@ -58,6 +58,10 @@ export default {
|
|
|
58
58
|
return `${(ratio * 100).toFixed(1)}%`;
|
|
59
59
|
},
|
|
60
60
|
|
|
61
|
+
defaultPolarValueFormat(v): string {
|
|
62
|
+
return `${v}`;
|
|
63
|
+
},
|
|
64
|
+
|
|
61
65
|
dataLabelFormat(targetId: string): Function {
|
|
62
66
|
const $$ = this;
|
|
63
67
|
const dataLabels = $$.config.data_labels;
|