billboard.js 3.7.2 → 3.7.4
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 +19 -14
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +19 -14
- 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 +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +2 -2
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist-esm/billboard.js +23 -18
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +11 -11
- package/src/ChartInternal/data/data.ts +8 -5
- package/src/ChartInternal/internals/redraw.ts +7 -7
- package/src/ChartInternal/shape/arc.ts +4 -2
- package/src/ChartInternal/shape/bar.ts +5 -2
- package/types/chart.d.ts +3 -13
- package/types/options.d.ts +1 -1
package/dist-esm/billboard.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.7.
|
|
8
|
+
* @version 3.7.4
|
|
9
9
|
*/
|
|
10
10
|
import { timeParse, utcParse, timeFormat, utcFormat } from 'd3-time-format';
|
|
11
11
|
import { pointer, select, namespaces, selectAll } from 'd3-selection';
|
|
@@ -3945,9 +3945,9 @@ var data$1 = {
|
|
|
3945
3945
|
var total = $$.cache.get(cacheKey);
|
|
3946
3946
|
if (!isNumber(total)) {
|
|
3947
3947
|
var sum = mergeArray($$.data.targets.map(function (t) { return t.values; }))
|
|
3948
|
-
.map(function (v) { return v.value; })
|
|
3949
|
-
|
|
3950
|
-
$$.cache.add(cacheKey, total
|
|
3948
|
+
.map(function (v) { return v.value; });
|
|
3949
|
+
total = sum.length ? sum.reduce(function (p, c) { return p + c; }) : 0;
|
|
3950
|
+
$$.cache.add(cacheKey, total);
|
|
3951
3951
|
}
|
|
3952
3952
|
if (subtractHidden) {
|
|
3953
3953
|
total -= $$.getHiddenTotalDataSum();
|
|
@@ -4437,8 +4437,9 @@ var data$1 = {
|
|
|
4437
4437
|
total = total.map(function (v, i) { return v - hiddenSum_1[i]; });
|
|
4438
4438
|
}
|
|
4439
4439
|
}
|
|
4440
|
-
|
|
4441
|
-
|
|
4440
|
+
var divisor = total[d.index];
|
|
4441
|
+
d.ratio = isNumber(d.value) && total && divisor ?
|
|
4442
|
+
d.value / divisor : 0;
|
|
4442
4443
|
ratio = d.ratio;
|
|
4443
4444
|
}
|
|
4444
4445
|
else if (type === "radar") {
|
|
@@ -6349,16 +6350,16 @@ var redraw = {
|
|
|
6349
6350
|
if (!treemap && (!$$.hasArcType() || state.hasRadar)) {
|
|
6350
6351
|
$$.updateCircleY && ($$.circleY = $$.updateCircleY());
|
|
6351
6352
|
}
|
|
6353
|
+
// Data empty label positioning and text.
|
|
6354
|
+
config.data_empty_label_text && main.select("text.".concat($TEXT.text, ".").concat($COMMON.empty))
|
|
6355
|
+
.attr("x", state.width / 2)
|
|
6356
|
+
.attr("y", state.height / 2)
|
|
6357
|
+
.text(config.data_empty_label_text)
|
|
6358
|
+
.style("display", targetsToShow.length ? "none" : null);
|
|
6352
6359
|
// update axis
|
|
6353
6360
|
if (state.hasAxis) {
|
|
6354
6361
|
// @TODO: Make 'init' state to be accessible everywhere not passing as argument.
|
|
6355
6362
|
$$.axis.redrawAxis(targetsToShow, wth, transitions, flow, initializing);
|
|
6356
|
-
// Data empty label positioning and text.
|
|
6357
|
-
config.data_empty_label_text && main.select("text.".concat($TEXT.text, ".").concat($COMMON.empty))
|
|
6358
|
-
.attr("x", state.width / 2)
|
|
6359
|
-
.attr("y", state.height / 2)
|
|
6360
|
-
.text(config.data_empty_label_text)
|
|
6361
|
-
.style("display", targetsToShow.length ? "none" : null);
|
|
6362
6363
|
// grid
|
|
6363
6364
|
$$.hasGrid() && $$.updateGrid();
|
|
6364
6365
|
// rect for regions
|
|
@@ -17003,6 +17004,8 @@ var shapeArc = {
|
|
|
17003
17004
|
var config = $$.config, state = $$.state;
|
|
17004
17005
|
var hasMultiArcGauge = $$.hasMultiArcGauge();
|
|
17005
17006
|
var isFullCircle = config.gauge_fullCircle;
|
|
17007
|
+
var showEmptyTextLabel = $$.filterTargetsToShow($$.data.targets).length === 0 &&
|
|
17008
|
+
!!config.data_empty_label_text;
|
|
17006
17009
|
var startAngle = $$.getStartAngle();
|
|
17007
17010
|
var endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1;
|
|
17008
17011
|
var backgroundArc = $$.$el.arcs.select("".concat(hasMultiArcGauge ? "g" : "", ".").concat($ARC.chartArcsBackground));
|
|
@@ -17018,7 +17021,7 @@ var shapeArc = {
|
|
|
17018
17021
|
.style("fill", (config.gauge_background) || null)
|
|
17019
17022
|
.attr("d", function (_a) {
|
|
17020
17023
|
var id = _a.id;
|
|
17021
|
-
if (state.hiddenTargetIds.indexOf(id) >= 0) {
|
|
17024
|
+
if (showEmptyTextLabel || state.hiddenTargetIds.indexOf(id) >= 0) {
|
|
17022
17025
|
return "M 0 0";
|
|
17023
17026
|
}
|
|
17024
17027
|
var d = {
|
|
@@ -17032,7 +17035,7 @@ var shapeArc = {
|
|
|
17032
17035
|
backgroundArc.exit().remove();
|
|
17033
17036
|
}
|
|
17034
17037
|
else {
|
|
17035
|
-
backgroundArc.attr("d", function () {
|
|
17038
|
+
backgroundArc.attr("d", showEmptyTextLabel ? "M 0 0" : function () {
|
|
17036
17039
|
var d = {
|
|
17037
17040
|
data: [{ value: config.gauge_max }],
|
|
17038
17041
|
startAngle: startAngle,
|
|
@@ -17464,7 +17467,9 @@ var shapeBar = {
|
|
|
17464
17467
|
// switch points if axis is rotated, not applicable for sub chart
|
|
17465
17468
|
var indexX = +isRotated;
|
|
17466
17469
|
var indexY = +!indexX;
|
|
17467
|
-
var
|
|
17470
|
+
var isUnderZero = d.value < 0;
|
|
17471
|
+
var isInverted = config["axis_".concat($$.axis.getId(d.id), "_inverted")];
|
|
17472
|
+
var isNegative = (!isInverted && isUnderZero) || (isInverted && !isUnderZero);
|
|
17468
17473
|
var pathRadius = ["", ""];
|
|
17469
17474
|
var radius = 0;
|
|
17470
17475
|
var isGrouped = $$.isGrouped(d.id);
|
|
@@ -17482,7 +17487,7 @@ var shapeBar = {
|
|
|
17482
17487
|
// path string data shouldn't be containing new line chars
|
|
17483
17488
|
// https://github.com/naver/billboard.js/issues/530
|
|
17484
17489
|
var path = isRotated ?
|
|
17485
|
-
"H".concat(points[1][indexX]
|
|
17490
|
+
"H".concat(points[1][indexX] + (isNegative ? radius : -radius), " ").concat(pathRadius[0], "V").concat(points[2][indexY] - radius, " ").concat(pathRadius[1], "H").concat(points[3][indexX]) :
|
|
17486
17491
|
"V".concat(points[1][indexY] + (isNegative ? -radius : radius), " ").concat(pathRadius[0], "H").concat(points[2][indexX] - radius, " ").concat(pathRadius[1], "V").concat(points[3][indexY]);
|
|
17487
17492
|
return "M".concat(points[0][indexX], ",").concat(points[0][indexY]).concat(path, "z");
|
|
17488
17493
|
};
|
|
@@ -22111,7 +22116,7 @@ var zoomModule = function () {
|
|
|
22111
22116
|
var defaults = {};
|
|
22112
22117
|
/**
|
|
22113
22118
|
* @namespace bb
|
|
22114
|
-
* @version 3.7.
|
|
22119
|
+
* @version 3.7.4
|
|
22115
22120
|
*/
|
|
22116
22121
|
var bb = {
|
|
22117
22122
|
/**
|
|
@@ -22121,7 +22126,7 @@ var bb = {
|
|
|
22121
22126
|
* bb.version; // "1.0.0"
|
|
22122
22127
|
* @memberof bb
|
|
22123
22128
|
*/
|
|
22124
|
-
version: "3.7.
|
|
22129
|
+
version: "3.7.4",
|
|
22125
22130
|
/**
|
|
22126
22131
|
* Generate chart
|
|
22127
22132
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.7.
|
|
8
|
+
* @version 3.7.4
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -104,7 +104,7 @@ var Plugin = /** @class */ (function () {
|
|
|
104
104
|
delete _this[key];
|
|
105
105
|
});
|
|
106
106
|
};
|
|
107
|
-
Plugin.version = "3.7.
|
|
107
|
+
Plugin.version = "3.7.4";
|
|
108
108
|
return Plugin;
|
|
109
109
|
}());
|
|
110
110
|
var Plugin$1 = Plugin;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.7.
|
|
8
|
+
* @version 3.7.4
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -278,7 +278,7 @@ var Plugin = /** @class */ (function () {
|
|
|
278
278
|
delete _this[key];
|
|
279
279
|
});
|
|
280
280
|
};
|
|
281
|
-
Plugin.version = "3.7.
|
|
281
|
+
Plugin.version = "3.7.4";
|
|
282
282
|
return Plugin;
|
|
283
283
|
}());
|
|
284
284
|
var Plugin$1 = Plugin;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.7.
|
|
8
|
+
* @version 3.7.4
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -486,7 +486,7 @@ var Plugin = /** @class */ (function () {
|
|
|
486
486
|
delete _this[key];
|
|
487
487
|
});
|
|
488
488
|
};
|
|
489
|
-
Plugin.version = "3.7.
|
|
489
|
+
Plugin.version = "3.7.4";
|
|
490
490
|
return Plugin;
|
|
491
491
|
}());
|
|
492
492
|
var Plugin$1 = Plugin;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.7.
|
|
8
|
+
* @version 3.7.4
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -121,7 +121,7 @@ var Plugin = /** @class */ (function () {
|
|
|
121
121
|
delete _this[key];
|
|
122
122
|
});
|
|
123
123
|
};
|
|
124
|
-
Plugin.version = "3.7.
|
|
124
|
+
Plugin.version = "3.7.4";
|
|
125
125
|
return Plugin;
|
|
126
126
|
}());
|
|
127
127
|
var Plugin$1 = Plugin;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.7.
|
|
8
|
+
* @version 3.7.4
|
|
9
9
|
* @requires billboard.js
|
|
10
10
|
* @summary billboard.js plugin
|
|
11
11
|
*/
|
|
@@ -263,7 +263,7 @@ var Plugin = /** @class */ (function () {
|
|
|
263
263
|
delete _this[key];
|
|
264
264
|
});
|
|
265
265
|
};
|
|
266
|
-
Plugin.version = "3.7.
|
|
266
|
+
Plugin.version = "3.7.4";
|
|
267
267
|
return Plugin;
|
|
268
268
|
}());
|
|
269
269
|
var Plugin$1 = Plugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "billboard.js",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.4",
|
|
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",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"@babel/plugin-transform-runtime": "^7.19.1",
|
|
109
109
|
"@babel/preset-env": "^7.20.2",
|
|
110
110
|
"@babel/preset-typescript": "^7.18.6",
|
|
111
|
-
"@babel/runtime": "^7.20.
|
|
111
|
+
"@babel/runtime": "^7.20.13",
|
|
112
112
|
"@commitlint/cli": "17.4.2",
|
|
113
113
|
"@commitlint/config-conventional": "^17.4.2",
|
|
114
114
|
"@rollup/plugin-babel": "^6.0.3",
|
|
@@ -125,8 +125,8 @@
|
|
|
125
125
|
"@types/d3": "^7.4.0",
|
|
126
126
|
"@types/mocha": "^10.0.1",
|
|
127
127
|
"@types/sinon": "^10.0.13",
|
|
128
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
129
|
-
"@typescript-eslint/parser": "^5.
|
|
128
|
+
"@typescript-eslint/eslint-plugin": "^5.49.0",
|
|
129
|
+
"@typescript-eslint/parser": "^5.49.0",
|
|
130
130
|
"babel-helper-modules": "^6.0.0",
|
|
131
131
|
"babel-loader": "^9.1.2",
|
|
132
132
|
"babel-plugin-add-module-exports": "^1.0.4",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"chai": "^4.3.7",
|
|
143
143
|
"clean-webpack-plugin": "^4.0.0",
|
|
144
144
|
"cloc": "^2.11.0",
|
|
145
|
-
"core-js": "^3.27.
|
|
145
|
+
"core-js": "^3.27.2",
|
|
146
146
|
"coveralls": "^3.1.1",
|
|
147
147
|
"cross-env": "^7.0.3",
|
|
148
148
|
"css-loader": "^6.7.3",
|
|
@@ -153,10 +153,10 @@
|
|
|
153
153
|
"d3-polygon": "^3.0.1",
|
|
154
154
|
"docdash": "^2.0.1",
|
|
155
155
|
"dtslint": "^4.2.1",
|
|
156
|
-
"eslint": "^8.
|
|
156
|
+
"eslint": "^8.33.0",
|
|
157
157
|
"eslint-config-naver": "^2.1.0",
|
|
158
158
|
"eslint-plugin-import": "^2.27.5",
|
|
159
|
-
"eslint-plugin-jsdoc": "^39.
|
|
159
|
+
"eslint-plugin-jsdoc": "^39.7.4",
|
|
160
160
|
"eslint-webpack-plugin": "^3.2.0",
|
|
161
161
|
"exports-loader": "^4.0.0",
|
|
162
162
|
"hammer-simulator": "0.0.1",
|
|
@@ -180,18 +180,18 @@
|
|
|
180
180
|
"mocha": "^10.2.0",
|
|
181
181
|
"node-sass": "^8.0.0",
|
|
182
182
|
"regenerator-runtime": "^0.13.11",
|
|
183
|
-
"rollup": "^3.
|
|
183
|
+
"rollup": "^3.12.0",
|
|
184
184
|
"rollup-plugin-delete": "^2.0.0",
|
|
185
185
|
"sass-loader": "^13.2.0",
|
|
186
|
-
"semantic-release": "^20.0
|
|
186
|
+
"semantic-release": "^20.1.0",
|
|
187
187
|
"simulant": "^0.2.2",
|
|
188
188
|
"sinon": "^15.0.1",
|
|
189
189
|
"string-replace-loader": "^3.1.0",
|
|
190
190
|
"style-loader": "^3.3.1",
|
|
191
191
|
"taffydb": "^2.7.3",
|
|
192
192
|
"terser-webpack-plugin": "^5.3.6",
|
|
193
|
-
"tslib": "^2.
|
|
194
|
-
"typescript": "4.9.
|
|
193
|
+
"tslib": "^2.5.0",
|
|
194
|
+
"typescript": "4.9.5",
|
|
195
195
|
"webpack": "^5.75.0",
|
|
196
196
|
"webpack-bundle-analyzer": "^4.7.0",
|
|
197
197
|
"webpack-clean": "^1.2.5",
|
|
@@ -343,10 +343,11 @@ export default {
|
|
|
343
343
|
|
|
344
344
|
if (!isNumber(total)) {
|
|
345
345
|
const sum = mergeArray($$.data.targets.map(t => t.values))
|
|
346
|
-
.map(v => v.value)
|
|
347
|
-
|
|
346
|
+
.map(v => v.value);
|
|
347
|
+
|
|
348
|
+
total = sum.length ? sum.reduce((p, c) => p + c) : 0;
|
|
348
349
|
|
|
349
|
-
$$.cache.add(cacheKey, total
|
|
350
|
+
$$.cache.add(cacheKey, total);
|
|
350
351
|
}
|
|
351
352
|
|
|
352
353
|
if (subtractHidden) {
|
|
@@ -946,8 +947,10 @@ export default {
|
|
|
946
947
|
}
|
|
947
948
|
}
|
|
948
949
|
|
|
949
|
-
|
|
950
|
-
|
|
950
|
+
const divisor = total[d.index];
|
|
951
|
+
|
|
952
|
+
d.ratio = isNumber(d.value) && total && divisor ?
|
|
953
|
+
d.value / divisor : 0;
|
|
951
954
|
|
|
952
955
|
ratio = d.ratio;
|
|
953
956
|
} else if (type === "radar") {
|
|
@@ -40,18 +40,18 @@ export default {
|
|
|
40
40
|
$$.updateCircleY && ($$.circleY = $$.updateCircleY());
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
+
// Data empty label positioning and text.
|
|
44
|
+
config.data_empty_label_text && main.select(`text.${$TEXT.text}.${$COMMON.empty}`)
|
|
45
|
+
.attr("x", state.width / 2)
|
|
46
|
+
.attr("y", state.height / 2)
|
|
47
|
+
.text(config.data_empty_label_text)
|
|
48
|
+
.style("display", targetsToShow.length ? "none" : null);
|
|
49
|
+
|
|
43
50
|
// update axis
|
|
44
51
|
if (state.hasAxis) {
|
|
45
52
|
// @TODO: Make 'init' state to be accessible everywhere not passing as argument.
|
|
46
53
|
$$.axis.redrawAxis(targetsToShow, wth, transitions, flow, initializing);
|
|
47
54
|
|
|
48
|
-
// Data empty label positioning and text.
|
|
49
|
-
config.data_empty_label_text && main.select(`text.${$TEXT.text}.${$COMMON.empty}`)
|
|
50
|
-
.attr("x", state.width / 2)
|
|
51
|
-
.attr("y", state.height / 2)
|
|
52
|
-
.text(config.data_empty_label_text)
|
|
53
|
-
.style("display", targetsToShow.length ? "none" : null);
|
|
54
|
-
|
|
55
55
|
// grid
|
|
56
56
|
$$.hasGrid() && $$.updateGrid();
|
|
57
57
|
|
|
@@ -758,6 +758,8 @@ export default {
|
|
|
758
758
|
const {config, state} = $$;
|
|
759
759
|
const hasMultiArcGauge = $$.hasMultiArcGauge();
|
|
760
760
|
const isFullCircle = config.gauge_fullCircle;
|
|
761
|
+
const showEmptyTextLabel = $$.filterTargetsToShow($$.data.targets).length === 0 &&
|
|
762
|
+
!!config.data_empty_label_text;
|
|
761
763
|
|
|
762
764
|
const startAngle = $$.getStartAngle();
|
|
763
765
|
const endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1;
|
|
@@ -779,7 +781,7 @@ export default {
|
|
|
779
781
|
.merge(backgroundArc)
|
|
780
782
|
.style("fill", (config.gauge_background) || null)
|
|
781
783
|
.attr("d", ({id}) => {
|
|
782
|
-
if (state.hiddenTargetIds.indexOf(id) >= 0) {
|
|
784
|
+
if (showEmptyTextLabel || state.hiddenTargetIds.indexOf(id) >= 0) {
|
|
783
785
|
return "M 0 0";
|
|
784
786
|
}
|
|
785
787
|
|
|
@@ -795,7 +797,7 @@ export default {
|
|
|
795
797
|
|
|
796
798
|
backgroundArc.exit().remove();
|
|
797
799
|
} else {
|
|
798
|
-
backgroundArc.attr("d", () => {
|
|
800
|
+
backgroundArc.attr("d", showEmptyTextLabel ? "M 0 0" : () => {
|
|
799
801
|
const d = {
|
|
800
802
|
data: [{value: config.gauge_max}],
|
|
801
803
|
startAngle,
|
|
@@ -172,7 +172,10 @@ export default {
|
|
|
172
172
|
const indexX = +isRotated;
|
|
173
173
|
const indexY = +!indexX;
|
|
174
174
|
|
|
175
|
-
const
|
|
175
|
+
const isUnderZero = d.value as number < 0;
|
|
176
|
+
const isInverted = config[`axis_${$$.axis.getId(d.id)}_inverted`];
|
|
177
|
+
const isNegative = (!isInverted && isUnderZero) || (isInverted && !isUnderZero);
|
|
178
|
+
|
|
176
179
|
const pathRadius = ["", ""];
|
|
177
180
|
let radius = 0;
|
|
178
181
|
|
|
@@ -197,7 +200,7 @@ export default {
|
|
|
197
200
|
// path string data shouldn't be containing new line chars
|
|
198
201
|
// https://github.com/naver/billboard.js/issues/530
|
|
199
202
|
const path = isRotated ?
|
|
200
|
-
`H${points[1][indexX]
|
|
203
|
+
`H${points[1][indexX] + (isNegative ? radius : -radius)} ${pathRadius[0]}V${points[2][indexY] - radius} ${pathRadius[1]}H${points[3][indexX]}` :
|
|
201
204
|
`V${points[1][indexY] + (isNegative ? -radius : radius)} ${pathRadius[0]}H${points[2][indexX] - radius} ${pathRadius[1]}V${points[3][indexY]}`;
|
|
202
205
|
|
|
203
206
|
return `M${points[0][indexX]},${points[0][indexY]}${path}z`;
|
package/types/chart.d.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 {Data} from "./options";
|
|
5
|
+
import {Data, RegionOptions} from "./options";
|
|
6
6
|
import {ArrayOrString, d3Selection, DataArray, DataItem, PrimitiveArray, TargetIds} from "./types";
|
|
7
7
|
|
|
8
8
|
export interface Chart {
|
|
@@ -102,23 +102,13 @@ export interface Chart {
|
|
|
102
102
|
* Update regions.
|
|
103
103
|
* @param regions Regions will be replaced with this argument. The format of this argument is the same as regions.
|
|
104
104
|
*/
|
|
105
|
-
(regions:
|
|
106
|
-
axis: "x" | "y" | "y2",
|
|
107
|
-
start?: number | Date,
|
|
108
|
-
end?: number | Date,
|
|
109
|
-
class?: string
|
|
110
|
-
}>): void;
|
|
105
|
+
(regions: RegionOptions[]): void;
|
|
111
106
|
|
|
112
107
|
/**
|
|
113
108
|
* Add new region. This API adds new region instead of replacing like regions.
|
|
114
109
|
* @param grids New region will be added. The format of this argument is the same as regions and it's possible to give an Object if only one region will be added.
|
|
115
110
|
*/
|
|
116
|
-
add
|
|
117
|
-
axis: "x" | "y" | "y2",
|
|
118
|
-
start?: number | Date,
|
|
119
|
-
end?: number | Date,
|
|
120
|
-
class?: string
|
|
121
|
-
}>(regions: T | T[]): void;
|
|
111
|
+
add(regions: RegionOptions | RegionOptions[]): void;
|
|
122
112
|
|
|
123
113
|
/**
|
|
124
114
|
* Remove regions. This API removes regions.
|