billboard.js 3.11.0-next.1 → 3.11.0
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 +5 -4
- package/dist/billboard.js +267 -113
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +1301 -1040
- 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 +6 -4
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +6 -4
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +5 -4
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +5 -4
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1036 -929
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +1041 -932
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +1042 -933
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +1042 -934
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +1049 -943
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
- package/dist/theme/dark.css +7 -7
- package/dist/theme/dark.min.css +2 -2
- package/dist/theme/datalab.css +7 -7
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +7 -7
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +7 -7
- package/dist/theme/insight.min.css +2 -2
- package/dist/theme/modern.css +7 -7
- package/dist/theme/modern.min.css +2 -2
- package/dist-esm/billboard.js +200 -72
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +3 -2
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +25 -25
- package/src/ChartInternal/ChartInternal.ts +1 -1
- package/src/ChartInternal/data/data.ts +6 -3
- package/src/ChartInternal/internals/size.axis.ts +1 -1
- package/src/ChartInternal/internals/size.ts +11 -0
- package/src/ChartInternal/internals/transform.ts +4 -0
- package/src/ChartInternal/shape/arc.ts +110 -34
- package/src/ChartInternal/shape/gauge.ts +8 -4
- package/src/config/Options/axis/y2.ts +0 -13
- package/src/config/Options/common/tooltip.ts +1 -0
- package/src/config/Options/shape/arc.ts +40 -3
- package/src/config/Options/shape/gauge.ts +23 -2
- package/src/config/Options/shape/pie.ts +2 -2
- package/src/config/classes.ts +1 -0
- package/src/module/util.ts +2 -2
- package/src/scss/billboard.scss +2 -1
- package/src/scss/theme/dark.scss +2 -1
- package/src/scss/theme/datalab.scss +2 -1
- package/src/scss/theme/graph.scss +2 -1
- package/src/scss/theme/insight.scss +2 -1
- package/src/scss/theme/modern.scss +2 -1
- package/types/options.shape.d.ts +44 -0
package/dist/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.11.0
|
|
8
|
+
* @version 3.11.0
|
|
9
9
|
*/
|
|
10
10
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -886,13 +886,14 @@ const toArray = function (v) {
|
|
|
886
886
|
*/
|
|
887
887
|
function addCssRules(style, selector, prop) {
|
|
888
888
|
var _this9 = this;
|
|
889
|
-
const
|
|
889
|
+
const _style$rootSelector = style.rootSelector,
|
|
890
|
+
rootSelector = _style$rootSelector === void 0 ? "" : _style$rootSelector,
|
|
890
891
|
sheet = style.sheet,
|
|
891
892
|
getSelector = function (s) {
|
|
892
893
|
_newArrowCheck(this, _this9);
|
|
893
894
|
return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
|
|
894
895
|
}.bind(this),
|
|
895
|
-
rule =
|
|
896
|
+
rule = rootSelector + " " + getSelector(selector) + " {" + prop.join(";") + "}";
|
|
896
897
|
return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
|
|
897
898
|
}
|
|
898
899
|
|
|
@@ -1347,6 +1348,7 @@ const $COMMON = {
|
|
|
1347
1348
|
const $ARC = {
|
|
1348
1349
|
arc: "bb-arc",
|
|
1349
1350
|
arcLabelLine: "bb-arc-label-line",
|
|
1351
|
+
arcRange: "bb-arc-range",
|
|
1350
1352
|
arcs: "bb-arcs",
|
|
1351
1353
|
chartArc: "bb-chart-arc",
|
|
1352
1354
|
chartArcs: "bb-chart-arcs",
|
|
@@ -3482,6 +3484,7 @@ var tooltip_this = undefined;
|
|
|
3482
3484
|
* - **{=CLASS_TOOLTIP_NAME}**: default tooltip data class name (ex. `bb-tooltip-name-data1`)
|
|
3483
3485
|
* - **{=TITLE}**: title value.
|
|
3484
3486
|
* - **{=COLOR}**: data color.
|
|
3487
|
+
* - **{=NAME}**: data id value.
|
|
3485
3488
|
* - **{=VALUE}**: data value.
|
|
3486
3489
|
* @property {object} [tooltip.contents.text=undefined] Set additional text content within data loop, using template syntax.
|
|
3487
3490
|
* - **NOTE:** It should contain `{ key: Array, ... }` value
|
|
@@ -5090,13 +5093,17 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5090
5093
|
let fn;
|
|
5091
5094
|
if (orderAsc || orderDesc) {
|
|
5092
5095
|
const reducer = function (p, c) {
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
+
_newArrowCheck(this, _this29);
|
|
5097
|
+
return p + Math.abs(c.value);
|
|
5098
|
+
}.bind(this),
|
|
5099
|
+
sum = function (v) {
|
|
5100
|
+
_newArrowCheck(this, _this29);
|
|
5101
|
+
return isNumber(v) ? v : "values" in v ? v.values.reduce(reducer, 0) : v.value;
|
|
5102
|
+
}.bind(this);
|
|
5096
5103
|
fn = function (t1, t2) {
|
|
5097
5104
|
_newArrowCheck(this, _this29);
|
|
5098
|
-
const t1Sum =
|
|
5099
|
-
t2Sum =
|
|
5105
|
+
const t1Sum = sum(t1),
|
|
5106
|
+
t2Sum = sum(t2);
|
|
5100
5107
|
return isReversed ? orderAsc ? t1Sum - t2Sum : t2Sum - t1Sum : orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum;
|
|
5101
5108
|
}.bind(this);
|
|
5102
5109
|
} else if (isFunction(order)) {
|
|
@@ -5440,7 +5447,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5440
5447
|
|
|
5441
5448
|
// otherwise, based on the rendered angle value
|
|
5442
5449
|
} else {
|
|
5443
|
-
const gaugeArcLength = config.gauge_fullCircle ? $$.getArcLength() : $$.
|
|
5450
|
+
const gaugeArcLength = config.gauge_fullCircle ? $$.getArcLength() : $$.getStartingAngle() * -2,
|
|
5444
5451
|
arcLength = $$.hasType("gauge") ? gaugeArcLength : Math.PI * 2;
|
|
5445
5452
|
ratio = (d.endAngle - d.startAngle) / arcLength;
|
|
5446
5453
|
}
|
|
@@ -9050,12 +9057,22 @@ function getGroupedDataPointsFn(d) {
|
|
|
9050
9057
|
|
|
9051
9058
|
// for arc
|
|
9052
9059
|
if ($$.hasArcType()) {
|
|
9053
|
-
var _ref;
|
|
9060
|
+
var _ref, _config$arc_rangeText;
|
|
9054
9061
|
const hasGauge = $$.hasType("gauge"),
|
|
9055
9062
|
isLegendRight = config.legend_show && state.isLegendRight,
|
|
9056
9063
|
textWidth = (_ref = state.hasRadar && $$.cache.get(KEY.radarTextWidth)) != null ? _ref : 0;
|
|
9057
9064
|
state.arcWidth = state.width - (isLegendRight ? currLegend.width + 10 : 0) - textWidth;
|
|
9058
9065
|
state.arcHeight = state.height - (isLegendRight && !hasGauge ? 0 : 10);
|
|
9066
|
+
if ((_config$arc_rangeText = config.arc_rangeText_values) != null && _config$arc_rangeText.length) {
|
|
9067
|
+
if (hasGauge) {
|
|
9068
|
+
state.arcWidth -= 25;
|
|
9069
|
+
state.arcHeight -= 10;
|
|
9070
|
+
state.margin.left += 10;
|
|
9071
|
+
} else {
|
|
9072
|
+
state.arcHeight -= 20;
|
|
9073
|
+
state.margin.top += 10;
|
|
9074
|
+
}
|
|
9075
|
+
}
|
|
9059
9076
|
if (hasGauge && !config.gauge_fullCircle) {
|
|
9060
9077
|
state.arcHeight += state.height - $$.getPaddingBottomForGauge();
|
|
9061
9078
|
}
|
|
@@ -10339,8 +10356,12 @@ function getTextXPos(pos, width) {
|
|
|
10339
10356
|
x = 0;
|
|
10340
10357
|
y = isRotated ? 0 : state.height2;
|
|
10341
10358
|
} else if (target === "arc") {
|
|
10359
|
+
var _config$arc_rangeText;
|
|
10342
10360
|
x = state.arcWidth / 2;
|
|
10343
10361
|
y = state.arcHeight / 2;
|
|
10362
|
+
if ((_config$arc_rangeText = config.arc_rangeText_values) != null && _config$arc_rangeText.length) {
|
|
10363
|
+
y += 5 + ($$.hasType("gauge") && config.title_text ? 10 : 0);
|
|
10364
|
+
}
|
|
10344
10365
|
} else if (target === "polar") {
|
|
10345
10366
|
x = state.arcWidth / 2;
|
|
10346
10367
|
y = state.arcHeight / 2;
|
|
@@ -10988,7 +11009,7 @@ let ChartInternal = /*#__PURE__*/function () {
|
|
|
10988
11009
|
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || config.data_labels_backgroundColors) {
|
|
10989
11010
|
$el.defs = $el.svg.append("defs");
|
|
10990
11011
|
if (hasAxis) {
|
|
10991
|
-
["id", "idXAxis", "idYAxis", "
|
|
11012
|
+
["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
|
|
10992
11013
|
_newArrowCheck(this, _this3);
|
|
10993
11014
|
$$.appendClip($el.defs, state.clip[v]);
|
|
10994
11015
|
}.bind(this));
|
|
@@ -16990,7 +17011,7 @@ function smoothLines(el, type) {
|
|
|
16990
17011
|
return isFitPadding ? 0 : rotatedPadding.top;
|
|
16991
17012
|
}
|
|
16992
17013
|
const maxtickSize = $$.axis.getMaxTickSize(id),
|
|
16993
|
-
isXAxisTickRotated = config.axis_x_tick_rotate > 0 && (!config.axis_x_tick_autorotate || $$.needToRotateXAxisTickTexts());
|
|
17014
|
+
isXAxisTickRotated = Math.abs(config.axis_x_tick_rotate) > 0 && (!config.axis_x_tick_autorotate || $$.needToRotateXAxisTickTexts());
|
|
16994
17015
|
if ((config.axis_x_tick_multiline || isXAxisTickRotated) && maxtickSize.height > 13) {
|
|
16995
17016
|
h += maxtickSize.height - 13;
|
|
16996
17017
|
}
|
|
@@ -18409,18 +18430,6 @@ function smoothLines(el, type) {
|
|
|
18409
18430
|
* y2 Axis config options
|
|
18410
18431
|
*/
|
|
18411
18432
|
/* harmony default export */ var y2 = ({
|
|
18412
|
-
/**
|
|
18413
|
-
* Set clip-path attribute for y2 axis element
|
|
18414
|
-
* - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
|
|
18415
|
-
* @name axis․y2․clipPath
|
|
18416
|
-
* @memberof Options
|
|
18417
|
-
* @type {boolean}
|
|
18418
|
-
* @default true
|
|
18419
|
-
* @example
|
|
18420
|
-
* // don't set 'clip-path' attribute
|
|
18421
|
-
* clipPath: false
|
|
18422
|
-
*/
|
|
18423
|
-
axis_y2_clipPath: !0,
|
|
18424
18433
|
/**
|
|
18425
18434
|
* Show or hide y2 axis.
|
|
18426
18435
|
* - **NOTE**:
|
|
@@ -19155,12 +19164,14 @@ function getAttrTweenFn(fn) {
|
|
|
19155
19164
|
startingAngle = config[dataType + "_startingAngle"] || 0,
|
|
19156
19165
|
padAngle = (padding ? padding * .01 : config[dataType + "_padAngle"]) || 0;
|
|
19157
19166
|
$$.pie = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.pie)().startAngle(startingAngle).endAngle(startingAngle + 2 * Math.PI).padAngle(padAngle).value(function (d) {
|
|
19158
|
-
var
|
|
19167
|
+
var _d$values$reduce,
|
|
19168
|
+
_d$values,
|
|
19169
|
+
_this4 = this;
|
|
19159
19170
|
_newArrowCheck(this, _this3);
|
|
19160
|
-
return d.values.reduce(function (a, b) {
|
|
19171
|
+
return (_d$values$reduce = (_d$values = d.values) == null ? void 0 : _d$values.reduce(function (a, b) {
|
|
19161
19172
|
_newArrowCheck(this, _this4);
|
|
19162
19173
|
return a + b.value;
|
|
19163
|
-
}.bind(this), 0);
|
|
19174
|
+
}.bind(this), 0)) != null ? _d$values$reduce : d;
|
|
19164
19175
|
}.bind(this)).sort($$.getSortCompareFn.bind($$)(!0));
|
|
19165
19176
|
},
|
|
19166
19177
|
updateRadius: function updateRadius() {
|
|
@@ -19225,13 +19236,14 @@ function getAttrTweenFn(fn) {
|
|
|
19225
19236
|
}
|
|
19226
19237
|
return len * Math.PI;
|
|
19227
19238
|
},
|
|
19228
|
-
|
|
19239
|
+
getStartingAngle: function getStartingAngle() {
|
|
19229
19240
|
const $$ = this,
|
|
19230
19241
|
config = $$.config,
|
|
19231
|
-
|
|
19242
|
+
dataType = config.data_type,
|
|
19243
|
+
isFullCircle = $$.hasType("gauge") ? config.gauge_fullCircle : !1,
|
|
19232
19244
|
defaultStartAngle = -1 * Math.PI / 2,
|
|
19233
19245
|
defaultEndAngle = Math.PI / 2;
|
|
19234
|
-
let startAngle = config
|
|
19246
|
+
let startAngle = config[dataType + "_startingAngle"] || 0;
|
|
19235
19247
|
if (!isFullCircle && startAngle <= defaultStartAngle) {
|
|
19236
19248
|
startAngle = defaultStartAngle;
|
|
19237
19249
|
} else if (!isFullCircle && startAngle >= defaultEndAngle) {
|
|
@@ -19241,49 +19253,67 @@ function getAttrTweenFn(fn) {
|
|
|
19241
19253
|
}
|
|
19242
19254
|
return startAngle;
|
|
19243
19255
|
},
|
|
19244
|
-
|
|
19256
|
+
/**
|
|
19257
|
+
* Update angle data
|
|
19258
|
+
* @param {object} dValue Data object
|
|
19259
|
+
* @param {boolean} forRange Weather is for ranged text option(arc.rangeText.values)
|
|
19260
|
+
* @returns {object|null} Updated angle data
|
|
19261
|
+
* @private
|
|
19262
|
+
*/
|
|
19263
|
+
updateAngle: function updateAngle(dValue, forRange) {
|
|
19245
19264
|
var _this5 = this;
|
|
19265
|
+
if (forRange === void 0) {
|
|
19266
|
+
forRange = !1;
|
|
19267
|
+
}
|
|
19246
19268
|
const $$ = this,
|
|
19247
19269
|
config = $$.config,
|
|
19248
|
-
state = $$.state
|
|
19270
|
+
state = $$.state,
|
|
19271
|
+
hasGauge = forRange && $$.hasType("gauge");
|
|
19272
|
+
// to prevent excluding total data sum during the init(when data.hide option is used), use $$.rendered state value
|
|
19273
|
+
// const totalSum = $$.getTotalDataSum(state.rendered);
|
|
19249
19274
|
let pie = $$.pie,
|
|
19250
19275
|
d = dValue,
|
|
19251
19276
|
found = !1;
|
|
19252
19277
|
if (!config) {
|
|
19253
19278
|
return null;
|
|
19254
19279
|
}
|
|
19255
|
-
const gStart = $$.
|
|
19256
|
-
radius = config.gauge_fullCircle ? $$.getArcLength() : gStart * -2;
|
|
19280
|
+
const gStart = $$.getStartingAngle(),
|
|
19281
|
+
radius = config.gauge_fullCircle || forRange && !hasGauge ? $$.getArcLength() : gStart * -2;
|
|
19257
19282
|
if (d.data && $$.isGaugeType(d.data) && !$$.hasMultiArcGauge()) {
|
|
19258
|
-
const
|
|
19259
|
-
|
|
19283
|
+
const gMin = config.gauge_min,
|
|
19284
|
+
gMax = config.gauge_max,
|
|
19260
19285
|
totalSum = $$.getTotalDataSum(state.rendered); // to prevent excluding total data sum during the init(when data.hide option is used), use $$.rendered state value
|
|
19261
19286
|
// https://github.com/naver/billboard.js/issues/2123
|
|
19262
|
-
pie = pie.startAngle(gStart).endAngle(radius * ((totalSum -
|
|
19287
|
+
pie = pie.startAngle(gStart).endAngle(radius * ((totalSum - gMin) / (gMax - gMin)) + gStart);
|
|
19288
|
+
}
|
|
19289
|
+
if (forRange === !1) {
|
|
19290
|
+
pie($$.filterTargetsToShow()).forEach(function (t, i) {
|
|
19291
|
+
var _d$data;
|
|
19292
|
+
_newArrowCheck(this, _this5);
|
|
19293
|
+
if (!found && t.data.id === ((_d$data = d.data) == null ? void 0 : _d$data.id)) {
|
|
19294
|
+
found = !0;
|
|
19295
|
+
d = t;
|
|
19296
|
+
d.index = i;
|
|
19297
|
+
}
|
|
19298
|
+
}.bind(this));
|
|
19263
19299
|
}
|
|
19264
|
-
pie($$.filterTargetsToShow()).forEach(function (t, i) {
|
|
19265
|
-
var _d$data;
|
|
19266
|
-
_newArrowCheck(this, _this5);
|
|
19267
|
-
if (!found && t.data.id === ((_d$data = d.data) == null ? void 0 : _d$data.id)) {
|
|
19268
|
-
found = !0;
|
|
19269
|
-
d = t;
|
|
19270
|
-
d.index = i;
|
|
19271
|
-
}
|
|
19272
|
-
}.bind(this));
|
|
19273
19300
|
if (isNaN(d.startAngle)) {
|
|
19274
19301
|
d.startAngle = 0;
|
|
19275
19302
|
}
|
|
19276
19303
|
if (isNaN(d.endAngle)) {
|
|
19277
19304
|
d.endAngle = d.startAngle;
|
|
19278
19305
|
}
|
|
19279
|
-
if (d.data && $$.hasMultiArcGauge()) {
|
|
19306
|
+
if (forRange || d.data && (config.gauge_enforceMinMax || $$.hasMultiArcGauge())) {
|
|
19307
|
+
var _d$value;
|
|
19280
19308
|
const gMin = config.gauge_min,
|
|
19281
19309
|
gMax = config.gauge_max,
|
|
19282
|
-
|
|
19310
|
+
max = forRange && !hasGauge ? $$.getTotalDataSum(state.rendered) : gMax,
|
|
19311
|
+
value = (_d$value = d.value) != null ? _d$value : 0,
|
|
19312
|
+
gValue = value < gMin ? 0 : value < max ? value - gMin : max - gMin;
|
|
19283
19313
|
d.startAngle = gStart;
|
|
19284
|
-
d.endAngle = gStart + radius / (
|
|
19314
|
+
d.endAngle = gStart + radius / (max - gMin) * gValue;
|
|
19285
19315
|
}
|
|
19286
|
-
return found ? d : null;
|
|
19316
|
+
return found || forRange ? d : null;
|
|
19287
19317
|
},
|
|
19288
19318
|
getSvgArc: function getSvgArc() {
|
|
19289
19319
|
const $$ = this,
|
|
@@ -19338,24 +19368,83 @@ function getAttrTweenFn(fn) {
|
|
|
19338
19368
|
getArc: function getArc(d, withoutUpdate, force) {
|
|
19339
19369
|
return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
|
|
19340
19370
|
},
|
|
19371
|
+
/**
|
|
19372
|
+
* Render range value text
|
|
19373
|
+
* @private
|
|
19374
|
+
*/
|
|
19375
|
+
redrawArcRangeText: function redrawArcRangeText() {
|
|
19376
|
+
var _values,
|
|
19377
|
+
_this7 = this;
|
|
19378
|
+
const $$ = this,
|
|
19379
|
+
config = $$.config,
|
|
19380
|
+
arcs = $$.$el.arcs,
|
|
19381
|
+
state = $$.state,
|
|
19382
|
+
$T = $$.$T,
|
|
19383
|
+
format = config.arc_rangeText_format,
|
|
19384
|
+
fixed = $$.hasType("gauge") && config.arc_rangeText_fixed;
|
|
19385
|
+
let values = config.arc_rangeText_values;
|
|
19386
|
+
if ((_values = values) != null && _values.length) {
|
|
19387
|
+
const isPercent = config.arc_rangeText_unit === "%",
|
|
19388
|
+
totalSum = $$.getTotalDataSum(state.rendered);
|
|
19389
|
+
if (isPercent) {
|
|
19390
|
+
values = values.map(function (v) {
|
|
19391
|
+
_newArrowCheck(this, _this7);
|
|
19392
|
+
return totalSum / 100 * v;
|
|
19393
|
+
}.bind(this));
|
|
19394
|
+
}
|
|
19395
|
+
const pieData = $$.pie(values).map(function (d, i) {
|
|
19396
|
+
_newArrowCheck(this, _this7);
|
|
19397
|
+
return d.index = i, d;
|
|
19398
|
+
}.bind(this));
|
|
19399
|
+
let rangeText = arcs.selectAll("." + $ARC.arcRange).data(values);
|
|
19400
|
+
rangeText.exit();
|
|
19401
|
+
rangeText = $T(rangeText.enter().append("text").attr("class", $ARC.arcRange).style("text-anchor", "middle").style("pointer-events", "none").style("opacity", "0").text(function (v) {
|
|
19402
|
+
_newArrowCheck(this, _this7);
|
|
19403
|
+
const range = isPercent ? v / totalSum * 100 : v;
|
|
19404
|
+
return isFunction(format) ? format(range) : "" + range + (isPercent ? "%" : "");
|
|
19405
|
+
}.bind(this)).merge(rangeText));
|
|
19406
|
+
if ((!state.rendered || state.rendered && !fixed) && totalSum > 0) {
|
|
19407
|
+
rangeText.attr("transform", function (d, i) {
|
|
19408
|
+
_newArrowCheck(this, _this7);
|
|
19409
|
+
return $$.transformForArcLabel(pieData[i], !0);
|
|
19410
|
+
}.bind(this));
|
|
19411
|
+
}
|
|
19412
|
+
rangeText.style("opacity", function (d) {
|
|
19413
|
+
_newArrowCheck(this, _this7);
|
|
19414
|
+
return !fixed && (d > totalSum || totalSum === 0) ? "0" : null;
|
|
19415
|
+
}.bind(this));
|
|
19416
|
+
}
|
|
19417
|
+
},
|
|
19341
19418
|
/**
|
|
19342
19419
|
* Set transform attributes to arc label text
|
|
19343
19420
|
* @param {object} d Data object
|
|
19421
|
+
* @param {boolean} forRange Weather is for ranged text option(arc.rangeText.values)
|
|
19344
19422
|
* @returns {string} Translate attribute string
|
|
19345
19423
|
* @private
|
|
19346
19424
|
*/
|
|
19347
|
-
transformForArcLabel: function transformForArcLabel(d) {
|
|
19348
|
-
var
|
|
19425
|
+
transformForArcLabel: function transformForArcLabel(d, forRange) {
|
|
19426
|
+
var _this8 = this;
|
|
19427
|
+
if (forRange === void 0) {
|
|
19428
|
+
forRange = !1;
|
|
19429
|
+
}
|
|
19349
19430
|
const $$ = this,
|
|
19350
19431
|
config = $$.config,
|
|
19351
19432
|
radiusExpanded = $$.state.radiusExpanded,
|
|
19352
|
-
updated = $$.updateAngle(d);
|
|
19433
|
+
updated = $$.updateAngle(d, forRange);
|
|
19353
19434
|
let translate = "";
|
|
19354
19435
|
if (updated) {
|
|
19355
|
-
if ($$.hasMultiArcGauge()) {
|
|
19436
|
+
if (forRange || $$.hasMultiArcGauge()) {
|
|
19356
19437
|
const y1 = Math.sin(updated.endAngle - Math.PI / 2),
|
|
19357
|
-
|
|
19438
|
+
rangeTextPosition = config.arc_rangeText_position;
|
|
19439
|
+
let x = Math.cos(updated.endAngle - Math.PI / 2) * (radiusExpanded + (forRange ? 5 : 25)),
|
|
19358
19440
|
y = y1 * (radiusExpanded + 15 - Math.abs(y1 * 10)) + 3;
|
|
19441
|
+
if (forRange && rangeTextPosition) {
|
|
19442
|
+
var _pos$x, _pos, _pos$y, _pos2;
|
|
19443
|
+
const rangeValues = config.arc_rangeText_values,
|
|
19444
|
+
pos = isFunction(rangeTextPosition) ? rangeTextPosition(rangeValues[d.index]) : rangeTextPosition;
|
|
19445
|
+
x += (_pos$x = (_pos = pos) == null ? void 0 : _pos.x) != null ? _pos$x : 0;
|
|
19446
|
+
y += (_pos$y = (_pos2 = pos) == null ? void 0 : _pos2.y) != null ? _pos$y : 0;
|
|
19447
|
+
}
|
|
19359
19448
|
translate = "translate(" + x + "," + y + ")";
|
|
19360
19449
|
} else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
|
19361
19450
|
var _filter$map;
|
|
@@ -19366,14 +19455,14 @@ function getAttrTweenFn(fn) {
|
|
|
19366
19455
|
}
|
|
19367
19456
|
const c = this.svgArc.centroid(updated),
|
|
19368
19457
|
_c$map = c.map(function (v) {
|
|
19369
|
-
_newArrowCheck(this,
|
|
19458
|
+
_newArrowCheck(this, _this8);
|
|
19370
19459
|
return isNaN(v) ? 0 : v;
|
|
19371
19460
|
}.bind(this)),
|
|
19372
19461
|
x = _c$map[0],
|
|
19373
19462
|
y = _c$map[1],
|
|
19374
19463
|
h = Math.sqrt(x * x + y * y);
|
|
19375
|
-
let ratio = (_filter$map = ["donut", "pie", "polar"].filter($$.hasType.bind($$)).map(function (v) {
|
|
19376
|
-
_newArrowCheck(this,
|
|
19464
|
+
let ratio = (_filter$map = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).map(function (v) {
|
|
19465
|
+
_newArrowCheck(this, _this8);
|
|
19377
19466
|
return config[v + "_label_ratio"];
|
|
19378
19467
|
}.bind(this))) == null ? void 0 : _filter$map[0];
|
|
19379
19468
|
if (ratio) {
|
|
@@ -19415,14 +19504,14 @@ function getAttrTweenFn(fn) {
|
|
|
19415
19504
|
}
|
|
19416
19505
|
},
|
|
19417
19506
|
expandArc: function expandArc(targetIds) {
|
|
19418
|
-
var
|
|
19507
|
+
var _this9 = this;
|
|
19419
19508
|
const $$ = this,
|
|
19420
19509
|
transiting = $$.state.transiting,
|
|
19421
19510
|
$el = $$.$el;
|
|
19422
19511
|
// MEMO: avoid to cancel transition
|
|
19423
19512
|
if (transiting) {
|
|
19424
19513
|
const interval = setInterval(function () {
|
|
19425
|
-
_newArrowCheck(this,
|
|
19514
|
+
_newArrowCheck(this, _this9);
|
|
19426
19515
|
if (!transiting) {
|
|
19427
19516
|
clearInterval(interval);
|
|
19428
19517
|
$el.legend.selectAll("." + $FOCUS.legendItemFocused).size() > 0 && $$.expandArc(targetIds);
|
|
@@ -19441,7 +19530,7 @@ function getAttrTweenFn(fn) {
|
|
|
19441
19530
|
});
|
|
19442
19531
|
},
|
|
19443
19532
|
unexpandArc: function unexpandArc(targetIds) {
|
|
19444
|
-
var
|
|
19533
|
+
var _this10 = this;
|
|
19445
19534
|
const $$ = this,
|
|
19446
19535
|
transiting = $$.state.transiting,
|
|
19447
19536
|
svg = $$.$el.svg;
|
|
@@ -19450,7 +19539,7 @@ function getAttrTweenFn(fn) {
|
|
|
19450
19539
|
}
|
|
19451
19540
|
const newTargetIds = $$.mapToTargetIds(targetIds);
|
|
19452
19541
|
svg.selectAll($$.selectorTargets(newTargetIds, "." + $ARC.chartArc)).selectAll("path").transition().duration(function (d) {
|
|
19453
|
-
_newArrowCheck(this,
|
|
19542
|
+
_newArrowCheck(this, _this10);
|
|
19454
19543
|
return $$.getExpandConfig(d.data.id, "duration");
|
|
19455
19544
|
}.bind(this)).attrTween("d", getAttrTweenFn($$.svgArc.bind($$)));
|
|
19456
19545
|
svg.selectAll("" + $ARC.arc).style("opacity", null);
|
|
@@ -19484,30 +19573,30 @@ function getAttrTweenFn(fn) {
|
|
|
19484
19573
|
return $$.isDonutType(id) && config.donut_expand || $$.isGaugeType(id) && config.gauge_expand || $$.isPieType(id) && config.pie_expand;
|
|
19485
19574
|
},
|
|
19486
19575
|
shouldShowArcLabel: function shouldShowArcLabel() {
|
|
19487
|
-
var
|
|
19576
|
+
var _this11 = this;
|
|
19488
19577
|
const $$ = this,
|
|
19489
19578
|
config = $$.config;
|
|
19490
19579
|
return ["donut", "gauge", "pie", "polar"].some(function (v) {
|
|
19491
|
-
_newArrowCheck(this,
|
|
19580
|
+
_newArrowCheck(this, _this11);
|
|
19492
19581
|
return $$.hasType(v) && config[v + "_label_show"];
|
|
19493
19582
|
}.bind(this));
|
|
19494
19583
|
},
|
|
19495
19584
|
getArcLabelFormat: function getArcLabelFormat() {
|
|
19496
|
-
var
|
|
19585
|
+
var _this12 = this;
|
|
19497
19586
|
const $$ = this,
|
|
19498
19587
|
config = $$.config;
|
|
19499
19588
|
let format = function (v) {
|
|
19500
|
-
_newArrowCheck(this,
|
|
19589
|
+
_newArrowCheck(this, _this12);
|
|
19501
19590
|
return v;
|
|
19502
19591
|
}.bind(this);
|
|
19503
19592
|
["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).forEach(function (v) {
|
|
19504
|
-
_newArrowCheck(this,
|
|
19593
|
+
_newArrowCheck(this, _this12);
|
|
19505
19594
|
format = config[v + "_label_format"];
|
|
19506
19595
|
}.bind(this));
|
|
19507
19596
|
return isFunction(format) ? format.bind($$.api) : format;
|
|
19508
19597
|
},
|
|
19509
19598
|
updateTargetsForArc: function updateTargetsForArc(targets) {
|
|
19510
|
-
var
|
|
19599
|
+
var _this13 = this;
|
|
19511
19600
|
const $$ = this,
|
|
19512
19601
|
$el = $$.$el,
|
|
19513
19602
|
hasGauge = $$.hasType("gauge"),
|
|
@@ -19516,7 +19605,7 @@ function getAttrTweenFn(fn) {
|
|
|
19516
19605
|
classFocus = $$.classFocus.bind($$),
|
|
19517
19606
|
chartArcs = $el.main.select("." + $ARC.chartArcs),
|
|
19518
19607
|
mainPieUpdate = chartArcs.selectAll("." + $ARC.chartArc).data($$.pie(targets)).attr("class", function (d) {
|
|
19519
|
-
_newArrowCheck(this,
|
|
19608
|
+
_newArrowCheck(this, _this13);
|
|
19520
19609
|
return classChartArc(d) + classFocus(d.data);
|
|
19521
19610
|
}.bind(this)),
|
|
19522
19611
|
mainPieEnter = mainPieUpdate.enter().append("g").attr("class", classChartArc).call(this.setCssRule(!1, "." + $ARC.chartArcs + " text", ["pointer-events:none", "text-anchor:middle"]));
|
|
@@ -19583,7 +19672,7 @@ function getAttrTweenFn(fn) {
|
|
|
19583
19672
|
return !1;
|
|
19584
19673
|
},
|
|
19585
19674
|
redrawArc: function redrawArc(duration, durationForExit, withTransform) {
|
|
19586
|
-
var
|
|
19675
|
+
var _this14 = this;
|
|
19587
19676
|
const $$ = this,
|
|
19588
19677
|
config = $$.config,
|
|
19589
19678
|
state = $$.state,
|
|
@@ -19593,10 +19682,10 @@ function getAttrTweenFn(fn) {
|
|
|
19593
19682
|
let mainArc = main.selectAll("." + $ARC.arcs).selectAll("." + $ARC.arc).data($$.arcData.bind($$));
|
|
19594
19683
|
mainArc.exit().transition().duration(durationForExit).style("opacity", "0").remove();
|
|
19595
19684
|
mainArc = mainArc.enter().append("path").attr("class", $$.getClass("arc", !0)).style("fill", function (d) {
|
|
19596
|
-
_newArrowCheck(this,
|
|
19685
|
+
_newArrowCheck(this, _this14);
|
|
19597
19686
|
return $$.color(d.data);
|
|
19598
19687
|
}.bind(this)).style("cursor", function (d) {
|
|
19599
|
-
_newArrowCheck(this,
|
|
19688
|
+
_newArrowCheck(this, _this14);
|
|
19600
19689
|
return isSelectable != null && isSelectable.bind != null && isSelectable.bind($$.api)(d) ? "pointer" : null;
|
|
19601
19690
|
}.bind(this)).style("opacity", "0").each(function (d) {
|
|
19602
19691
|
if ($$.isGaugeType(d.data)) {
|
|
@@ -19607,22 +19696,22 @@ function getAttrTweenFn(fn) {
|
|
|
19607
19696
|
}).merge(mainArc);
|
|
19608
19697
|
if ($$.hasType("gauge")) {
|
|
19609
19698
|
$$.updateGaugeMax();
|
|
19610
|
-
$$.hasMultiArcGauge() && $$.
|
|
19699
|
+
$$.hasMultiArcGauge() && $$.redrawArcGaugeLine();
|
|
19611
19700
|
}
|
|
19612
19701
|
mainArc.attr("transform", function (d) {
|
|
19613
|
-
_newArrowCheck(this,
|
|
19702
|
+
_newArrowCheck(this, _this14);
|
|
19614
19703
|
return !$$.isGaugeType(d.data) && withTransform ? "scale(0)" : "";
|
|
19615
19704
|
}.bind(this)).style("opacity", function (d) {
|
|
19616
19705
|
return d === this._current ? "0" : null;
|
|
19617
19706
|
}).each(function () {
|
|
19618
|
-
_newArrowCheck(this,
|
|
19707
|
+
_newArrowCheck(this, _this14);
|
|
19619
19708
|
state.transiting = !0;
|
|
19620
19709
|
}.bind(this)).transition().duration(duration).attrTween("d", function (d) {
|
|
19621
|
-
var
|
|
19710
|
+
var _this15 = this;
|
|
19622
19711
|
const updated = $$.updateAngle(d);
|
|
19623
19712
|
if (!updated) {
|
|
19624
19713
|
return function () {
|
|
19625
|
-
_newArrowCheck(this,
|
|
19714
|
+
_newArrowCheck(this, _this15);
|
|
19626
19715
|
return "M 0 0";
|
|
19627
19716
|
}.bind(this);
|
|
19628
19717
|
}
|
|
@@ -19641,7 +19730,7 @@ function getAttrTweenFn(fn) {
|
|
|
19641
19730
|
return $$.getArc(interpolated, !0);
|
|
19642
19731
|
};
|
|
19643
19732
|
}).attr("transform", withTransform ? "scale(1)" : "").style("fill", function (d) {
|
|
19644
|
-
_newArrowCheck(this,
|
|
19733
|
+
_newArrowCheck(this, _this14);
|
|
19645
19734
|
let color;
|
|
19646
19735
|
if ($$.levelColor) {
|
|
19647
19736
|
color = $$.levelColor(d.data.values[0].value);
|
|
@@ -19670,13 +19759,14 @@ function getAttrTweenFn(fn) {
|
|
|
19670
19759
|
$$.hasType("gauge") && $$.redrawBackgroundArcs();
|
|
19671
19760
|
config.arc_needle_show && $$.redrawNeedle();
|
|
19672
19761
|
$$.redrawArcText(duration);
|
|
19762
|
+
$$.redrawArcRangeText();
|
|
19673
19763
|
},
|
|
19674
19764
|
/**
|
|
19675
19765
|
* Update needle element
|
|
19676
19766
|
* @private
|
|
19677
19767
|
*/
|
|
19678
19768
|
redrawNeedle: function redrawNeedle() {
|
|
19679
|
-
var
|
|
19769
|
+
var _this16 = this;
|
|
19680
19770
|
const $$ = this,
|
|
19681
19771
|
$el = $$.$el,
|
|
19682
19772
|
config = $$.config,
|
|
@@ -19698,7 +19788,7 @@ function getAttrTweenFn(fn) {
|
|
|
19698
19788
|
bottomRy = config.arc_needle_bottom_ry,
|
|
19699
19789
|
needleAngle = $$.getNeedleAngle(),
|
|
19700
19790
|
updateNeedleValue = function () {
|
|
19701
|
-
_newArrowCheck(this,
|
|
19791
|
+
_newArrowCheck(this, _this16);
|
|
19702
19792
|
const title = $$.getArcTitleWithNeedleValue();
|
|
19703
19793
|
title && $$.setArcTitle(title);
|
|
19704
19794
|
}.bind(this);
|
|
@@ -19714,14 +19804,14 @@ function getAttrTweenFn(fn) {
|
|
|
19714
19804
|
* @private
|
|
19715
19805
|
*/
|
|
19716
19806
|
$el.needle.updateHelper = function (v, updateConfig) {
|
|
19717
|
-
var
|
|
19807
|
+
var _this17 = this;
|
|
19718
19808
|
if (updateConfig === void 0) {
|
|
19719
19809
|
updateConfig = !1;
|
|
19720
19810
|
}
|
|
19721
|
-
_newArrowCheck(this,
|
|
19811
|
+
_newArrowCheck(this, _this16);
|
|
19722
19812
|
if ($el.needle.style("display") !== "none") {
|
|
19723
19813
|
$$.$T($el.needle).style("transform", "rotate(" + $$.getNeedleAngle(v) + "deg)").call(endall, function () {
|
|
19724
|
-
_newArrowCheck(this,
|
|
19814
|
+
_newArrowCheck(this, _this17);
|
|
19725
19815
|
updateConfig && (config.arc_needle_value = v);
|
|
19726
19816
|
updateNeedleValue();
|
|
19727
19817
|
}.bind(this));
|
|
@@ -19756,7 +19846,7 @@ function getAttrTweenFn(fn) {
|
|
|
19756
19846
|
}
|
|
19757
19847
|
state.current.needle = value;
|
|
19758
19848
|
if (hasGauge) {
|
|
19759
|
-
startingAngle = $$.
|
|
19849
|
+
startingAngle = $$.getStartingAngle();
|
|
19760
19850
|
const radius = config.gauge_fullCircle ? arcLength : startingAngle * -2,
|
|
19761
19851
|
min = config.gauge_min,
|
|
19762
19852
|
max = config.gauge_max;
|
|
@@ -19767,25 +19857,25 @@ function getAttrTweenFn(fn) {
|
|
|
19767
19857
|
return (startingAngle + radian) * (180 / Math.PI);
|
|
19768
19858
|
},
|
|
19769
19859
|
redrawBackgroundArcs: function redrawBackgroundArcs() {
|
|
19770
|
-
var
|
|
19860
|
+
var _this18 = this;
|
|
19771
19861
|
const $$ = this,
|
|
19772
19862
|
config = $$.config,
|
|
19773
19863
|
state = $$.state,
|
|
19774
19864
|
hasMultiArcGauge = $$.hasMultiArcGauge(),
|
|
19775
19865
|
isFullCircle = config.gauge_fullCircle,
|
|
19776
19866
|
showEmptyTextLabel = $$.filterTargetsToShow($$.data.targets).length === 0 && !!config.data_empty_label_text,
|
|
19777
|
-
startAngle = $$.
|
|
19867
|
+
startAngle = $$.getStartingAngle(),
|
|
19778
19868
|
endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1;
|
|
19779
19869
|
let backgroundArc = $$.$el.arcs.select((hasMultiArcGauge ? "g" : "") + "." + $ARC.chartArcsBackground);
|
|
19780
19870
|
if (hasMultiArcGauge) {
|
|
19781
19871
|
let index = 0;
|
|
19782
19872
|
backgroundArc = backgroundArc.selectAll("path." + $ARC.chartArcsBackground).data($$.data.targets);
|
|
19783
19873
|
backgroundArc.enter().append("path").attr("class", function (d, i) {
|
|
19784
|
-
_newArrowCheck(this,
|
|
19874
|
+
_newArrowCheck(this, _this18);
|
|
19785
19875
|
return $ARC.chartArcsBackground + " " + $ARC.chartArcsBackground + "-" + i;
|
|
19786
19876
|
}.bind(this)).merge(backgroundArc).style("fill", config.gauge_background || null).attr("d", function (_ref3) {
|
|
19787
19877
|
let id = _ref3.id;
|
|
19788
|
-
_newArrowCheck(this,
|
|
19878
|
+
_newArrowCheck(this, _this18);
|
|
19789
19879
|
if (showEmptyTextLabel || state.hiddenTargetIds.indexOf(id) >= 0) {
|
|
19790
19880
|
return "M 0 0";
|
|
19791
19881
|
}
|
|
@@ -19802,7 +19892,7 @@ function getAttrTweenFn(fn) {
|
|
|
19802
19892
|
backgroundArc.exit().remove();
|
|
19803
19893
|
} else {
|
|
19804
19894
|
backgroundArc.attr("d", showEmptyTextLabel ? "M 0 0" : function () {
|
|
19805
|
-
_newArrowCheck(this,
|
|
19895
|
+
_newArrowCheck(this, _this18);
|
|
19806
19896
|
const d = {
|
|
19807
19897
|
data: [{
|
|
19808
19898
|
value: config.gauge_max
|
|
@@ -19815,7 +19905,7 @@ function getAttrTweenFn(fn) {
|
|
|
19815
19905
|
}
|
|
19816
19906
|
},
|
|
19817
19907
|
bindArcEvent: function bindArcEvent(arc) {
|
|
19818
|
-
var
|
|
19908
|
+
var _this19 = this;
|
|
19819
19909
|
const $$ = this,
|
|
19820
19910
|
config = $$.config,
|
|
19821
19911
|
state = $$.state,
|
|
@@ -19863,7 +19953,7 @@ function getAttrTweenFn(fn) {
|
|
|
19863
19953
|
selectArc(this, arcData, id);
|
|
19864
19954
|
$$.setOverOut(!0, arcData);
|
|
19865
19955
|
}).on("mouseout", function (event, d) {
|
|
19866
|
-
_newArrowCheck(this,
|
|
19956
|
+
_newArrowCheck(this, _this19);
|
|
19867
19957
|
if (state.transiting) {
|
|
19868
19958
|
// skip while transiting
|
|
19869
19959
|
return;
|
|
@@ -19885,7 +19975,7 @@ function getAttrTweenFn(fn) {
|
|
|
19885
19975
|
if (isTouch && $$.hasArcType() && !$$.radars) {
|
|
19886
19976
|
const getEventArc = function (event) {
|
|
19887
19977
|
var _event$changedTouches, _event$changedTouches2;
|
|
19888
|
-
_newArrowCheck(this,
|
|
19978
|
+
_newArrowCheck(this, _this19);
|
|
19889
19979
|
const _ref4 = (_event$changedTouches = (_event$changedTouches2 = event.changedTouches) == null ? void 0 : _event$changedTouches2[0]) != null ? _event$changedTouches : {
|
|
19890
19980
|
clientX: 0,
|
|
19891
19981
|
clientY: 0
|
|
@@ -19913,7 +20003,7 @@ function getAttrTweenFn(fn) {
|
|
|
19913
20003
|
}
|
|
19914
20004
|
},
|
|
19915
20005
|
redrawArcText: function redrawArcText(duration) {
|
|
19916
|
-
var
|
|
20006
|
+
var _this20 = this;
|
|
19917
20007
|
const $$ = this,
|
|
19918
20008
|
config = $$.config,
|
|
19919
20009
|
state = $$.state,
|
|
@@ -19927,13 +20017,16 @@ function getAttrTweenFn(fn) {
|
|
|
19927
20017
|
// for gauge type, update text when has no title & multi data
|
|
19928
20018
|
if (!(hasGauge && $$.data.targets.length === 1 && config.gauge_title)) {
|
|
19929
20019
|
text = main.selectAll("." + $ARC.chartArc).select("text").style("opacity", "0").attr("class", function (d) {
|
|
19930
|
-
_newArrowCheck(this,
|
|
20020
|
+
_newArrowCheck(this, _this20);
|
|
19931
20021
|
return $$.isGaugeType(d.data) ? $GAUGE.gaugeValue : null;
|
|
19932
|
-
}.bind(this)).call($$.textForArcLabel.bind($$)).attr("transform",
|
|
19933
|
-
_newArrowCheck(this,
|
|
20022
|
+
}.bind(this)).call($$.textForArcLabel.bind($$)).attr("transform", function (d) {
|
|
20023
|
+
_newArrowCheck(this, _this20);
|
|
20024
|
+
return $$.transformForArcLabel.bind($$)(d);
|
|
20025
|
+
}.bind(this)).style("font-size", function (d) {
|
|
20026
|
+
_newArrowCheck(this, _this20);
|
|
19934
20027
|
return $$.isGaugeType(d.data) && $$.data.targets.length === 1 && !hasMultiArcGauge ? Math.round(state.radius / 5) + "px" : null;
|
|
19935
20028
|
}.bind(this)).transition().duration(duration).style("opacity", function (d) {
|
|
19936
|
-
_newArrowCheck(this,
|
|
20029
|
+
_newArrowCheck(this, _this20);
|
|
19937
20030
|
return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? null : "0";
|
|
19938
20031
|
}.bind(this));
|
|
19939
20032
|
hasMultiArcGauge && text.attr("dy", "-.1em");
|
|
@@ -19959,14 +20052,14 @@ function getAttrTweenFn(fn) {
|
|
|
19959
20052
|
* @private
|
|
19960
20053
|
*/
|
|
19961
20054
|
getArcElementByIdOrIndex: function getArcElementByIdOrIndex(value) {
|
|
19962
|
-
var
|
|
20055
|
+
var _this21 = this;
|
|
19963
20056
|
const $$ = this,
|
|
19964
20057
|
arcs = $$.$el.arcs,
|
|
19965
20058
|
filterFn = isNumber(value) ? function (d) {
|
|
19966
|
-
_newArrowCheck(this,
|
|
20059
|
+
_newArrowCheck(this, _this21);
|
|
19967
20060
|
return d.index === value;
|
|
19968
20061
|
}.bind(this) : function (d) {
|
|
19969
|
-
_newArrowCheck(this,
|
|
20062
|
+
_newArrowCheck(this, _this21);
|
|
19970
20063
|
return d.data.id === value;
|
|
19971
20064
|
}.bind(this);
|
|
19972
20065
|
return arcs == null ? void 0 : arcs.selectAll("." + $COMMON.target + " path").filter(filterFn);
|
|
@@ -20639,14 +20732,22 @@ function candlestick_objectSpread(e) { for (var r = 1, t; r < arguments.length;
|
|
|
20639
20732
|
const $$ = this,
|
|
20640
20733
|
config = $$.config,
|
|
20641
20734
|
arcs = $$.$el.arcs,
|
|
20642
|
-
appendText = function (className) {
|
|
20735
|
+
appendText = function (className, value) {
|
|
20736
|
+
if (className === void 0) {
|
|
20737
|
+
className = null;
|
|
20738
|
+
}
|
|
20739
|
+
if (value === void 0) {
|
|
20740
|
+
value = "";
|
|
20741
|
+
}
|
|
20643
20742
|
_newArrowCheck(this, _this);
|
|
20644
|
-
arcs.append("text").attr("class", className).style("text-anchor", "middle").style("pointer-events", "none");
|
|
20743
|
+
arcs.append("text").attr("class", className).style("text-anchor", "middle").style("pointer-events", "none").text(value);
|
|
20645
20744
|
}.bind(this);
|
|
20646
20745
|
if ($$.hasType("gauge")) {
|
|
20647
20746
|
const hasMulti = $$.hasMultiArcGauge();
|
|
20648
20747
|
arcs.append(hasMulti ? "g" : "path").attr("class", $ARC.chartArcsBackground).style("fill", !hasMulti && config.gauge_background || null);
|
|
20649
20748
|
config.gauge_units && appendText($GAUGE.chartArcsGaugeUnit);
|
|
20749
|
+
|
|
20750
|
+
// append min/max value text
|
|
20650
20751
|
if (config.gauge_label_show) {
|
|
20651
20752
|
appendText($GAUGE.chartArcsGaugeMin);
|
|
20652
20753
|
config.gauge_fullCircle || appendText($GAUGE.chartArcsGaugeMax);
|
|
@@ -20663,11 +20764,11 @@ function candlestick_objectSpread(e) { for (var r = 1, t; r < arguments.length;
|
|
|
20663
20764
|
// to prevent excluding total data sum during the init(when data.hide option is used), use $$.rendered state value
|
|
20664
20765
|
|
|
20665
20766
|
// if gauge_max less than max, make max to max value
|
|
20666
|
-
if (max + config.gauge_min * (config.gauge_min > 0 ? -1 : 1) > config.gauge_max) {
|
|
20767
|
+
if (!config.gauge_enforceMinMax && max + config.gauge_min * (config.gauge_min > 0 ? -1 : 1) > config.gauge_max) {
|
|
20667
20768
|
config.gauge_max = max - config.gauge_min;
|
|
20668
20769
|
}
|
|
20669
20770
|
},
|
|
20670
|
-
|
|
20771
|
+
redrawArcGaugeLine: function redrawArcGaugeLine() {
|
|
20671
20772
|
var _this2 = this;
|
|
20672
20773
|
const $$ = this,
|
|
20673
20774
|
config = $$.config,
|
|
@@ -23035,11 +23136,23 @@ function convertDataToTreemapData(data) {
|
|
|
23035
23136
|
* @property {number} [arc.needle.bottom.ry=1] Set needle bottom [ry radius value](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve).
|
|
23036
23137
|
* @property {number} [arc.needle.bottom.width=15] Set needle bottom width in pixel.
|
|
23037
23138
|
* @property {number} [arc.needle.bottom.len=0] Set needle bottom length in pixel. Setting this value, will make bottom larger starting from center.
|
|
23139
|
+
* @property {object} [arc.rangeText] Set rangeText options.
|
|
23140
|
+
* @property {Array} [arc.rangeText.values] Set range text values to be shown around Arc.
|
|
23141
|
+
* - When `unit: 'absolute'`: Given values are treated as absolute values.
|
|
23142
|
+
* - When `unit: '%'`: Given values are treated as percentages.
|
|
23143
|
+
* @property {string} [arc.rangeText.unit="absolute"] Specify the range text unit.
|
|
23144
|
+
* - "absolute": Show absolute value
|
|
23145
|
+
* - "%": Show percentage value
|
|
23146
|
+
* @property {boolean} [arc.rangeText.fiexed=false] Set if range text shown will be fixed w/o data toggle update. Only available for gauge chart.
|
|
23147
|
+
* @property {Function} [arc.rangeText.format] Set format function for the range text.
|
|
23148
|
+
* @property {number} [arc.rangeText.position] Set position function or object for the range text.
|
|
23038
23149
|
* @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutCornerRadius)
|
|
23039
|
-
* @see [Demo: Gauge corner radius](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeCornerRadius)
|
|
23040
23150
|
* @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#PieChartOptions.CornerRadius)
|
|
23041
23151
|
* @see [Demo: Donut needle](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutNeedle)
|
|
23042
|
-
* @see [Demo:
|
|
23152
|
+
* @see [Demo: Donut RangeText](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutRangeText)
|
|
23153
|
+
* @see [Demo: Gauge corner radius](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeCornerRadius)
|
|
23154
|
+
* @see [Demo: Gauge needle](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeNeedle)
|
|
23155
|
+
* @see [Demo: Gauge RangeText](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeRangeText)
|
|
23043
23156
|
* @example
|
|
23044
23157
|
* arc: {
|
|
23045
23158
|
* cornerRadius: 12,
|
|
@@ -23096,6 +23209,21 @@ function convertDataToTreemapData(data) {
|
|
|
23096
23209
|
* width: 10
|
|
23097
23210
|
* len: 10
|
|
23098
23211
|
* }
|
|
23212
|
+
* },
|
|
23213
|
+
*
|
|
23214
|
+
* rangeText: {
|
|
23215
|
+
* values: [15, 30, 50, 75, 95],
|
|
23216
|
+
* unit: "%",
|
|
23217
|
+
* fixed: false, // only available for gauge chart
|
|
23218
|
+
* format: function(v) {
|
|
23219
|
+
* return v === 15 ? "Fifteen" : v;
|
|
23220
|
+
* },
|
|
23221
|
+
*
|
|
23222
|
+
* position: function(v) {
|
|
23223
|
+
* return v === 15 ? {x: 20, y: 10} : null; // can return one props value also.
|
|
23224
|
+
* },
|
|
23225
|
+
* position: {x: 10, y: 15},
|
|
23226
|
+
* position: {x: 10}
|
|
23099
23227
|
* }
|
|
23100
23228
|
* }
|
|
23101
23229
|
*/
|
|
@@ -23112,7 +23240,12 @@ function convertDataToTreemapData(data) {
|
|
|
23112
23240
|
arc_needle_bottom_rx: 1,
|
|
23113
23241
|
arc_needle_bottom_ry: 1,
|
|
23114
23242
|
arc_needle_bottom_width: 15,
|
|
23115
|
-
arc_needle_bottom_len: 0
|
|
23243
|
+
arc_needle_bottom_len: 0,
|
|
23244
|
+
arc_rangeText_values: undefined,
|
|
23245
|
+
arc_rangeText_unit: "absolute",
|
|
23246
|
+
arc_rangeText_fixed: !1,
|
|
23247
|
+
arc_rangeText_format: undefined,
|
|
23248
|
+
arc_rangeText_position: undefined
|
|
23116
23249
|
});
|
|
23117
23250
|
;// CONCATENATED MODULE: ./src/config/Options/shape/donut.ts
|
|
23118
23251
|
/**
|
|
@@ -23219,16 +23352,20 @@ function convertDataToTreemapData(data) {
|
|
|
23219
23352
|
* @property {boolean} [gauge.background=""] Set background color. (The `.bb-chart-arcs-background` element)
|
|
23220
23353
|
* @property {boolean} [gauge.fullCircle=false] Show full circle as donut. When set to 'true', the max label will not be showed due to start and end points are same location.
|
|
23221
23354
|
* @property {boolean} [gauge.label.show=true] Show or hide label on gauge.
|
|
23355
|
+
* @property {Function} [gauge.label.extents] Set customized min/max label text.
|
|
23222
23356
|
* @property {Function} [gauge.label.format] Set formatter for the label on gauge. Label text can be multilined with `\n` character.<br>
|
|
23223
23357
|
* Will pass following arguments to the given function:
|
|
23224
23358
|
* - value {number}: absolute value
|
|
23225
23359
|
* - ratio {number}: value's ratio
|
|
23226
23360
|
* - id {string}: data's id value
|
|
23227
|
-
* @property {Function} [gauge.label.
|
|
23361
|
+
* @property {number|Function} [gauge.label.ratio=undefined] Set ratio of labels position.
|
|
23228
23362
|
* @property {number} [gauge.label.threshold=0] Set threshold ratio to show/hide labels.
|
|
23229
23363
|
* @property {boolean} [gauge.expand=true] Enable or disable expanding gauge.
|
|
23230
23364
|
* @property {number} [gauge.expand.rate=0.98] Set expand rate.
|
|
23231
23365
|
* @property {number} [gauge.expand.duration=50] Set the expand transition time in milliseconds.
|
|
23366
|
+
* @property {boolean} [gauge.enforceMinMax=false] Enforce to given min/max value.
|
|
23367
|
+
* - When `gauge.min=50` and given value is `30`, gauge will render as empty value.
|
|
23368
|
+
* - When `gauge.max=100` and given value is `120`, gauge will render till 100, not surpassing max value.
|
|
23232
23369
|
* @property {number} [gauge.min=0] Set min value of the gauge.
|
|
23233
23370
|
* @property {number} [gauge.max=100] Set max value of the gauge.
|
|
23234
23371
|
* @property {number} [gauge.startingAngle=-1 * Math.PI / 2] Set starting angle where data draws.
|
|
@@ -23259,8 +23396,10 @@ function convertDataToTreemapData(data) {
|
|
|
23259
23396
|
* - single
|
|
23260
23397
|
* - multi
|
|
23261
23398
|
* @property {number} [gauge.arcs.minWidth=5] Set minimal width of gauge arcs until the innerRadius disappears.
|
|
23399
|
+
* @see [Demo: enforceMinMax, min/max](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeMinMax)
|
|
23262
23400
|
* @see [Demo: archLength](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeArcLength)
|
|
23263
23401
|
* @see [Demo: startingAngle](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeStartingAngle)
|
|
23402
|
+
* @see [Demo: labelRatio](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeLabelRatio)
|
|
23264
23403
|
* @example
|
|
23265
23404
|
* gauge: {
|
|
23266
23405
|
* background: "#eee", // will set 'fill' css prop for '.bb-chart-arcs-background' classed element.
|
|
@@ -23281,6 +23420,14 @@ function convertDataToTreemapData(data) {
|
|
|
23281
23420
|
* // 0.1(10%) ratio value means, the minimum ratio to show text label relative to the total value.
|
|
23282
23421
|
* // if data value is below than 0.1, text label will be hidden.
|
|
23283
23422
|
* threshold: 0.1,
|
|
23423
|
+
*
|
|
23424
|
+
* // set ratio callback. Should return ratio value
|
|
23425
|
+
* ratio: function(d, radius, h) {
|
|
23426
|
+
* ...
|
|
23427
|
+
* return ratio;
|
|
23428
|
+
* },
|
|
23429
|
+
* // or set ratio number
|
|
23430
|
+
* ratio: 0.5
|
|
23284
23431
|
* },
|
|
23285
23432
|
*
|
|
23286
23433
|
* // disable expand transition for interaction
|
|
@@ -23294,6 +23441,11 @@ function convertDataToTreemapData(data) {
|
|
|
23294
23441
|
* rate: 1
|
|
23295
23442
|
* },
|
|
23296
23443
|
*
|
|
23444
|
+
* // enforce min/max value.
|
|
23445
|
+
* // when given value < min, will render as empty value.
|
|
23446
|
+
* // when value > max, will render to given max value not surpassing it.
|
|
23447
|
+
* enforceMinMax: true,
|
|
23448
|
+
*
|
|
23297
23449
|
* min: -100,
|
|
23298
23450
|
* max: 200,
|
|
23299
23451
|
* type: "single" // or 'multi'
|
|
@@ -23314,9 +23466,11 @@ function convertDataToTreemapData(data) {
|
|
|
23314
23466
|
gauge_background: "",
|
|
23315
23467
|
gauge_fullCircle: !1,
|
|
23316
23468
|
gauge_label_show: !0,
|
|
23317
|
-
gauge_label_format: undefined,
|
|
23318
23469
|
gauge_label_extents: undefined,
|
|
23470
|
+
gauge_label_format: undefined,
|
|
23471
|
+
gauge_label_ratio: undefined,
|
|
23319
23472
|
gauge_label_threshold: 0,
|
|
23473
|
+
gauge_enforceMinMax: !1,
|
|
23320
23474
|
gauge_min: 0,
|
|
23321
23475
|
gauge_max: 100,
|
|
23322
23476
|
gauge_type: "single",
|
|
@@ -23347,8 +23501,8 @@ function convertDataToTreemapData(data) {
|
|
|
23347
23501
|
* @property {object} pie Pie object
|
|
23348
23502
|
* @property {boolean} [pie.label.show=true] Show or hide label on each pie piece.
|
|
23349
23503
|
* @property {Function} [pie.label.format] Set formatter for the label on each pie piece.
|
|
23350
|
-
* @property {number} [pie.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
23351
23504
|
* @property {number|Function} [pie.label.ratio=undefined] Set ratio of labels position.
|
|
23505
|
+
* @property {number} [pie.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
23352
23506
|
* @property {boolean|object} [pie.expand=true] Enable or disable expanding pie pieces.
|
|
23353
23507
|
* @property {number} [pie.expand.rate=0.98] Set expand rate.
|
|
23354
23508
|
* @property {number} [pie.expand.duration=50] Set expand transition time in ms.
|
|
@@ -23419,8 +23573,8 @@ function convertDataToTreemapData(data) {
|
|
|
23419
23573
|
*/
|
|
23420
23574
|
pie_label_show: !0,
|
|
23421
23575
|
pie_label_format: undefined,
|
|
23422
|
-
pie_label_threshold: .05,
|
|
23423
23576
|
pie_label_ratio: undefined,
|
|
23577
|
+
pie_label_threshold: .05,
|
|
23424
23578
|
pie_expand: {},
|
|
23425
23579
|
pie_expand_rate: .98,
|
|
23426
23580
|
pie_expand_duration: 50,
|
|
@@ -25772,7 +25926,7 @@ let _defaults = {};
|
|
|
25772
25926
|
|
|
25773
25927
|
/**
|
|
25774
25928
|
* @namespace bb
|
|
25775
|
-
* @version 3.11.0
|
|
25929
|
+
* @version 3.11.0
|
|
25776
25930
|
*/
|
|
25777
25931
|
const bb = {
|
|
25778
25932
|
/**
|
|
@@ -25782,7 +25936,7 @@ const bb = {
|
|
|
25782
25936
|
* bb.version; // "1.0.0"
|
|
25783
25937
|
* @memberof bb
|
|
25784
25938
|
*/
|
|
25785
|
-
version: "3.11.0
|
|
25939
|
+
version: "3.11.0",
|
|
25786
25940
|
/**
|
|
25787
25941
|
* Generate chart
|
|
25788
25942
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|