billboard.js 3.3.1 → 3.4.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.
- package/dist/billboard.css +19 -14
- package/dist/billboard.js +397 -74
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +865 -414
- 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 +46 -16
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +46 -16
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +41 -13
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +41 -13
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +470 -342
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +515 -357
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +516 -358
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +512 -356
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +513 -357
- 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 +356 -72
- 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 +30 -30
- package/src/Chart/api/chart.ts +1 -1
- package/src/Chart/api/focus.ts +3 -2
- package/src/Chart/api/subchart.ts +8 -8
- package/src/ChartInternal/Axis/Axis.ts +10 -7
- package/src/ChartInternal/ChartInternal.ts +25 -14
- package/src/ChartInternal/data/data.ts +1 -1
- package/src/ChartInternal/internals/color.ts +4 -3
- package/src/ChartInternal/internals/format.ts +13 -4
- package/src/ChartInternal/internals/redraw.ts +6 -2
- 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/tooltip.ts +10 -1
- 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/util.ts +30 -10
- 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/options.d.ts +72 -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.1
|
|
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.1#";
|
|
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.1
|
|
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.1#";
|
|
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.1
|
|
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.1#";
|
|
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.1
|
|
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.1#";
|
|
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.1
|
|
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.1#";
|
|
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.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",
|
|
@@ -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.7",
|
|
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.7",
|
|
106
106
|
"@commitlint/cli": "^15.0.0",
|
|
107
|
-
"@commitlint/config-conventional": "^16.
|
|
108
|
-
"@rollup/plugin-babel": "^5.3.
|
|
107
|
+
"@commitlint/config-conventional": "^16.2.1",
|
|
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
|
-
"@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.15.0",
|
|
123
|
+
"@typescript-eslint/parser": "^5.15.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",
|
|
@@ -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.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.4",
|
|
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,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.
|
|
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
|
-
"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
|
-
"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",
|
|
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
|
@@ -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($$)));
|
|
@@ -48,13 +48,13 @@ export default {
|
|
|
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
|
|
|
@@ -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";
|
|
@@ -255,7 +255,7 @@ export default class ChartInternal {
|
|
|
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));
|
|
@@ -387,7 +388,7 @@ export default class ChartInternal {
|
|
|
387
388
|
// Define defs
|
|
388
389
|
const hasColorPatterns = (isFunction(config.color_tiles) && $$.patterns);
|
|
389
390
|
|
|
390
|
-
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors) {
|
|
391
|
+
if (hasAxis || hasColorPatterns || config.data_labels_backgroundColors || hasPolar) {
|
|
391
392
|
$el.defs = $el.svg.append("defs");
|
|
392
393
|
|
|
393
394
|
if (hasAxis) {
|
|
@@ -396,7 +397,7 @@ export default class ChartInternal {
|
|
|
396
397
|
});
|
|
397
398
|
}
|
|
398
399
|
|
|
399
|
-
// Append data
|
|
400
|
+
// Append data background color filter definition
|
|
400
401
|
$$.generateDataLabelBackgroundColorFilter();
|
|
401
402
|
|
|
402
403
|
// set color patterns
|
|
@@ -512,6 +513,8 @@ export default class ChartInternal {
|
|
|
512
513
|
}
|
|
513
514
|
});
|
|
514
515
|
} else {
|
|
516
|
+
const hasPolar = $$.hasType("polar");
|
|
517
|
+
|
|
515
518
|
if (!hasRadar) {
|
|
516
519
|
types.push("Arc", "Pie");
|
|
517
520
|
}
|
|
@@ -520,6 +523,8 @@ export default class ChartInternal {
|
|
|
520
523
|
types.push("Gauge");
|
|
521
524
|
} else if (hasRadar) {
|
|
522
525
|
types.push("Radar");
|
|
526
|
+
} else if (hasPolar) {
|
|
527
|
+
types.push("Polar");
|
|
523
528
|
}
|
|
524
529
|
}
|
|
525
530
|
|
|
@@ -600,6 +605,9 @@ export default class ChartInternal {
|
|
|
600
605
|
updateTargets(targets): void {
|
|
601
606
|
const $$ = <any> this;
|
|
602
607
|
const {hasAxis, hasRadar} = $$.state;
|
|
608
|
+
const helper = type => $$[`updateTargetsFor${type}`](
|
|
609
|
+
targets.filter($$[`is${type}Type`].bind($$))
|
|
610
|
+
);
|
|
603
611
|
|
|
604
612
|
// Text
|
|
605
613
|
$$.updateTargetsForText(targets);
|
|
@@ -609,22 +617,25 @@ export default class ChartInternal {
|
|
|
609
617
|
const name = capitalize(v);
|
|
610
618
|
|
|
611
619
|
if ((v === "line" && $$.hasTypeOf(name)) || $$.hasType(v)) {
|
|
612
|
-
|
|
613
|
-
targets.filter($$[`is${name}Type`].bind($$))
|
|
614
|
-
);
|
|
620
|
+
helper(name);
|
|
615
621
|
}
|
|
616
622
|
});
|
|
617
623
|
|
|
618
624
|
// Sub Chart
|
|
619
625
|
$$.updateTargetsForSubchart &&
|
|
620
626
|
$$.updateTargetsForSubchart(targets);
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
627
|
+
|
|
628
|
+
// Arc, Polar, Radar
|
|
629
|
+
} else if ($$.hasArcType(targets)) {
|
|
630
|
+
let type = "Arc";
|
|
631
|
+
|
|
632
|
+
if (hasRadar) {
|
|
633
|
+
type = "Radar";
|
|
634
|
+
} else if ($$.hasType("polar")) {
|
|
635
|
+
type = "Polar";
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
helper(type);
|
|
628
639
|
}
|
|
629
640
|
|
|
630
641
|
// 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);
|
|
@@ -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")
|
|
@@ -38,11 +38,16 @@ export default {
|
|
|
38
38
|
*/
|
|
39
39
|
getDefaultValueFormat(): Function {
|
|
40
40
|
const $$ = this;
|
|
41
|
-
const
|
|
41
|
+
const {defaultArcValueFormat, yFormat, y2Format} = $$;
|
|
42
|
+
const hasArc = $$.hasArcType(null, ["gauge", "polar", "radar"]);
|
|
42
43
|
|
|
43
|
-
return
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
return function(v, ratio, id) {
|
|
45
|
+
const format = hasArc ? defaultArcValueFormat : (
|
|
46
|
+
$$.axis && $$.axis.getId(id) === "y2" ? y2Format : yFormat
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
return format.call($$, v, ratio);
|
|
50
|
+
};
|
|
46
51
|
},
|
|
47
52
|
|
|
48
53
|
defaultValueFormat(v): number|string {
|
|
@@ -53,6 +58,10 @@ export default {
|
|
|
53
58
|
return `${(ratio * 100).toFixed(1)}%`;
|
|
54
59
|
},
|
|
55
60
|
|
|
61
|
+
defaultPolarValueFormat(v): string {
|
|
62
|
+
return `${v}`;
|
|
63
|
+
},
|
|
64
|
+
|
|
56
65
|
dataLabelFormat(targetId: string): Function {
|
|
57
66
|
const $$ = this;
|
|
58
67
|
const dataLabels = $$.config.data_labels;
|
|
@@ -85,6 +85,9 @@ export default {
|
|
|
85
85
|
|
|
86
86
|
// radar
|
|
87
87
|
$el.radar && $$.redrawRadar();
|
|
88
|
+
|
|
89
|
+
// polar
|
|
90
|
+
$el.polar && $$.redrawPolar();
|
|
88
91
|
}
|
|
89
92
|
|
|
90
93
|
// @TODO: Axis & Radar type
|
|
@@ -246,10 +249,11 @@ export default {
|
|
|
246
249
|
redrawWithoutRescale() {
|
|
247
250
|
this.redraw({
|
|
248
251
|
withY: false,
|
|
249
|
-
|
|
252
|
+
withDimension: false,
|
|
253
|
+
withLegend: false,
|
|
250
254
|
withSubchart: false,
|
|
251
255
|
withEventRect: false,
|
|
252
|
-
withTransitionForAxis: false
|
|
256
|
+
withTransitionForAxis: false,
|
|
253
257
|
});
|
|
254
258
|
}
|
|
255
259
|
};
|
|
@@ -501,7 +501,7 @@ export default {
|
|
|
501
501
|
* @returns {boolean}
|
|
502
502
|
* @private
|
|
503
503
|
*/
|
|
504
|
-
meetsLabelThreshold(ratio: number = 0, type: "bar" | "donut" | "gauge" | "pie"): boolean {
|
|
504
|
+
meetsLabelThreshold(ratio: number = 0, type: "bar" | "donut" | "gauge" | "pie" | "polar"): boolean {
|
|
505
505
|
const $$ = this;
|
|
506
506
|
const {config} = $$;
|
|
507
507
|
const threshold = config[`${type}_label_threshold`] || 0;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import {$ARC, $AXIS} from "../../config/classes";
|
|
6
6
|
import {asHalfPixel} from "../../module/util";
|
|
7
7
|
|
|
8
|
-
type TranslateParam = "main" | "context" | "legend" | "x" | "y" | "y2" | "subX" | "arc" | "radar";
|
|
8
|
+
type TranslateParam = "main" | "context" | "legend" | "x" | "y" | "y2" | "subX" | "arc" | "radar" | "polar";
|
|
9
9
|
|
|
10
10
|
export default {
|
|
11
11
|
getTranslate(target: TranslateParam, index = 0): string {
|
|
@@ -44,6 +44,9 @@ export default {
|
|
|
44
44
|
} else if (target === "arc") {
|
|
45
45
|
x = state.arcWidth / 2;
|
|
46
46
|
y = state.arcHeight / 2;
|
|
47
|
+
} else if (target === "polar") {
|
|
48
|
+
x = state.arcWidth / 2;
|
|
49
|
+
y = state.arcHeight / 2;
|
|
47
50
|
} else if (target === "radar") {
|
|
48
51
|
const [width] = $$.getRadarSize();
|
|
49
52
|
|
|
@@ -187,6 +187,10 @@ export default {
|
|
|
187
187
|
return this.isTypeOf(d, "donut");
|
|
188
188
|
},
|
|
189
189
|
|
|
190
|
+
isPolarType(d): boolean {
|
|
191
|
+
return this.isTypeOf(d, "polar");
|
|
192
|
+
},
|
|
193
|
+
|
|
190
194
|
isRadarType(d): boolean {
|
|
191
195
|
return this.isTypeOf(d, "radar");
|
|
192
196
|
},
|
|
@@ -195,6 +199,7 @@ export default {
|
|
|
195
199
|
return this.isPieType(d) ||
|
|
196
200
|
this.isDonutType(d) ||
|
|
197
201
|
this.isGaugeType(d) ||
|
|
202
|
+
this.isPolarType(d) ||
|
|
198
203
|
this.isRadarType(d);
|
|
199
204
|
},
|
|
200
205
|
|