billboard.js 3.8.2 → 3.9.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 +7 -7
- package/dist/billboard.js +324 -59
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +806 -349
- 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 +4 -3
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +4 -3
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +4 -4
- 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 +484 -292
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +487 -294
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +488 -295
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +489 -297
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +501 -320
- package/dist/theme/dark.css +298 -0
- package/dist/theme/dark.min.css +9 -0
- package/dist/theme/datalab.css +9 -2
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +7 -5
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +7 -5
- package/dist/theme/insight.min.css +2 -2
- package/dist-esm/billboard.js +307 -44
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +4 -3
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +4 -3
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +34 -33
- package/src/Chart/Chart.ts +30 -1
- package/src/ChartInternal/ChartInternal.ts +3 -1
- package/src/ChartInternal/data/data.ts +2 -1
- package/src/ChartInternal/internals/size.ts +5 -1
- package/src/ChartInternal/internals/text.ts +20 -15
- package/src/ChartInternal/internals/tooltip.ts +4 -3
- package/src/ChartInternal/shape/arc.ts +161 -18
- package/src/config/Options/common/legend.ts +1 -1
- package/src/config/Options/data/data.ts +22 -6
- package/src/config/Options/shape/arc.ts +73 -1
- package/src/config/Options/shape/donut.ts +5 -0
- package/src/config/Options/shape/gauge.ts +6 -0
- package/src/config/Store/State.ts +2 -1
- package/src/config/classes.ts +2 -1
- package/src/scss/billboard.scss +8 -5
- package/src/scss/theme/dark.scss +423 -0
- package/src/scss/theme/datalab.scss +11 -0
- package/src/scss/theme/graph.scss +9 -4
- package/src/scss/theme/insight.scss +9 -4
- package/types/options.d.ts +29 -12
- package/types/options.shape.d.ts +72 -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.
|
|
8
|
+
* @version 3.9.0-next.1
|
|
9
9
|
*/
|
|
10
10
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -1315,7 +1315,8 @@ var $ARC = {
|
|
|
1315
1315
|
chartArc: "bb-chart-arc",
|
|
1316
1316
|
chartArcs: "bb-chart-arcs",
|
|
1317
1317
|
chartArcsBackground: "bb-chart-arcs-background",
|
|
1318
|
-
chartArcsTitle: "bb-chart-arcs-title"
|
|
1318
|
+
chartArcsTitle: "bb-chart-arcs-title",
|
|
1319
|
+
needle: "bb-needle"
|
|
1319
1320
|
};
|
|
1320
1321
|
var $AREA = {
|
|
1321
1322
|
area: "bb-area",
|
|
@@ -1595,8 +1596,10 @@ var State = function () {
|
|
|
1595
1596
|
}
|
|
1596
1597
|
},
|
|
1597
1598
|
// current used chart type list
|
|
1598
|
-
types: []
|
|
1599
|
+
types: [],
|
|
1600
|
+
needle: undefined // arc needle current value
|
|
1599
1601
|
},
|
|
1602
|
+
|
|
1600
1603
|
// legend
|
|
1601
1604
|
isLegendRight: !1,
|
|
1602
1605
|
isLegendInset: !1,
|
|
@@ -1648,7 +1651,7 @@ var State = function () {
|
|
|
1648
1651
|
pathXAxisTickTexts: "",
|
|
1649
1652
|
pathGrid: ""
|
|
1650
1653
|
},
|
|
1651
|
-
//
|
|
1654
|
+
// state
|
|
1652
1655
|
event: null,
|
|
1653
1656
|
// event object
|
|
1654
1657
|
dragStart: null,
|
|
@@ -2469,7 +2472,7 @@ var data_this = undefined;
|
|
|
2469
2472
|
* @property {boolean} [data.labels=false] Show or hide labels on each data points
|
|
2470
2473
|
* @property {boolean} [data.labels.centered=false] Centerize labels on `bar` shape. (**NOTE:** works only for 'bar' type)
|
|
2471
2474
|
* @property {Function} [data.labels.format] Set formatter function for data labels.<br>
|
|
2472
|
-
* The formatter function receives 4 arguments such as v, id, i,
|
|
2475
|
+
* The formatter function receives 4 arguments such as `v, id, i, texts` and it **must return a string** (`\n` character will be used as line break) that will be shown as the label.<br><br>
|
|
2473
2476
|
* The arguments are:<br>
|
|
2474
2477
|
* - `v` is the value of the data point where the label is shown.
|
|
2475
2478
|
* - `id` is the id of the data where the label is shown.
|
|
@@ -2478,7 +2481,14 @@ var data_this = undefined;
|
|
|
2478
2481
|
* Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (ex. d3.format('$'))
|
|
2479
2482
|
* @property {string|object} [data.labels.backgroundColors] Set label text background colors.
|
|
2480
2483
|
* @property {string|object|Function} [data.labels.colors] Set label text colors.
|
|
2481
|
-
* @property {object} [data.labels.position] Set each dataset position, relative the original
|
|
2484
|
+
* @property {object|Function} [data.labels.position] Set each dataset position, relative the original.<br><br>
|
|
2485
|
+
* When function is specified, will receives 5 arguments such as `type, v, id, i, texts` and it must return a position number.<br><br>
|
|
2486
|
+
* The arguments are:<br>
|
|
2487
|
+
* - `type` coordinate type string, which will be 'x' or 'y'.
|
|
2488
|
+
* - `v` is the value of the data point where the label is shown.
|
|
2489
|
+
* - `id` is the id of the data where the label is shown.
|
|
2490
|
+
* - `i` is the index of the data series point where the label is shown.
|
|
2491
|
+
* - `texts` is the array of whole corresponding data series' text labels.<br><br>
|
|
2482
2492
|
* @property {number} [data.labels.position.x=0] x coordinate position, relative the original.
|
|
2483
2493
|
* @property {number} [data.labels.position.y=0] y coordinate position, relative the original.
|
|
2484
2494
|
* @property {object} [data.labels.rotate] Rotate label text. Specify degree value in a range of `0 ~ 360`.
|
|
@@ -2499,7 +2509,7 @@ var data_this = undefined;
|
|
|
2499
2509
|
*
|
|
2500
2510
|
* // or set specific options
|
|
2501
2511
|
* labels: {
|
|
2502
|
-
* format: function(v, id, i,
|
|
2512
|
+
* format: function(v, id, i, texts) {
|
|
2503
2513
|
* ...
|
|
2504
2514
|
* // to multiline, return with '\n' character
|
|
2505
2515
|
* return "Line1\nLine2";
|
|
@@ -2541,6 +2551,13 @@ var data_this = undefined;
|
|
|
2541
2551
|
* return d.value > 200 ? "cyan" : color;
|
|
2542
2552
|
* },
|
|
2543
2553
|
*
|
|
2554
|
+
* // return x, y coordinate position
|
|
2555
|
+
* // apt to handle each text position manually
|
|
2556
|
+
* position: function(type, v, id, i, texts) {
|
|
2557
|
+
* ...
|
|
2558
|
+
* return type == "x" ? 10 : 20;
|
|
2559
|
+
* },
|
|
2560
|
+
*
|
|
2544
2561
|
* // set x, y coordinate position
|
|
2545
2562
|
* position: {
|
|
2546
2563
|
* x: -10,
|
|
@@ -3172,7 +3189,7 @@ var data_this = undefined;
|
|
|
3172
3189
|
* - **step**:
|
|
3173
3190
|
* - defines the max step the legend has (e.g. If 2 set and legend has 3 legend item, the legend 2 columns).
|
|
3174
3191
|
* @property {boolean} [legend.equally=false] Set to all items have same width size.
|
|
3175
|
-
* @property {
|
|
3192
|
+
* @property {number} [legend.padding=0] Set padding value
|
|
3176
3193
|
* @property {Function} [legend.item.onclick=undefined] Set click event handler to the legend item.
|
|
3177
3194
|
* @property {Function} [legend.item.onover=undefined] Set mouse/touch over event handler to the legend item.
|
|
3178
3195
|
* @property {Function} [legend.item.onout=undefined] Set mouse/touch out event handler to the legend item.
|
|
@@ -5272,7 +5289,7 @@ function getDataKeyForJson(keysParam, config) {
|
|
|
5272
5289
|
|
|
5273
5290
|
// otherwise, based on the rendered angle value
|
|
5274
5291
|
} else {
|
|
5275
|
-
var gaugeArcLength = config.gauge_fullCircle ? $$.getArcLength() : $$.
|
|
5292
|
+
var gaugeArcLength = config.gauge_fullCircle ? $$.getArcLength() : $$.getGaugeStartAngle() * -2,
|
|
5276
5293
|
arcLength = $$.hasType("gauge") ? gaugeArcLength : Math.PI * 2;
|
|
5277
5294
|
ratio = (d.endAngle - d.startAngle) / arcLength;
|
|
5278
5295
|
}
|
|
@@ -8644,7 +8661,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8644
8661
|
xAxisHeight = isRotated || isNonAxis ? 0 : $$.getHorizontalAxisHeight("x"),
|
|
8645
8662
|
subchartXAxisHeight = config.subchart_axis_x_show && config.subchart_axis_x_tick_text_show ? xAxisHeight : 30,
|
|
8646
8663
|
subchartHeight = config.subchart_show && !isNonAxis ? config.subchart_size_height + subchartXAxisHeight : 0,
|
|
8647
|
-
|
|
8664
|
+
gaugeHeight = $$.hasType("gauge") && config.arc_needle_show && !config.gauge_fullCircle && !config.gauge_label_show ? 10 : 0,
|
|
8665
|
+
padding = $$.getCurrentPadding(); // when needle is shown with legend, it need some bottom space to not overlap with legend text
|
|
8648
8666
|
// for main
|
|
8649
8667
|
state.margin = !isNonAxis && isRotated ? {
|
|
8650
8668
|
top: $$.getHorizontalAxisHeight("y2") + padding.top,
|
|
@@ -8655,7 +8673,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8655
8673
|
top: (isFitPadding ? 0 : 4) + padding.top,
|
|
8656
8674
|
// for top tick text
|
|
8657
8675
|
right: isNonAxis ? 0 : $$.getCurrentPaddingRight(!0),
|
|
8658
|
-
bottom: xAxisHeight + subchartHeight + legendHeightForBottom + padding.bottom,
|
|
8676
|
+
bottom: gaugeHeight + xAxisHeight + subchartHeight + legendHeightForBottom + padding.bottom,
|
|
8659
8677
|
left: isNonAxis ? 0 : padding.left
|
|
8660
8678
|
};
|
|
8661
8679
|
state.margin = $$.getResettedPadding(state.margin);
|
|
@@ -8845,6 +8863,22 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8845
8863
|
y: y
|
|
8846
8864
|
};
|
|
8847
8865
|
}
|
|
8866
|
+
|
|
8867
|
+
/**
|
|
8868
|
+
* Get data.labels.position value
|
|
8869
|
+
* @param {object} d Data object
|
|
8870
|
+
* @param {string} type x | y
|
|
8871
|
+
* @returns {number} Position value
|
|
8872
|
+
* @private
|
|
8873
|
+
*/
|
|
8874
|
+
function getTextPos(d, type) {
|
|
8875
|
+
var _ref,
|
|
8876
|
+
position = this.config.data_labels_position,
|
|
8877
|
+
id = d.id,
|
|
8878
|
+
index = d.index,
|
|
8879
|
+
value = d.value;
|
|
8880
|
+
return (_ref = isFunction(position) ? position.bind(this.api)(type, value, id, index, this.$el.text) : (id in position ? position[id] : position)[type]) != null ? _ref : 0;
|
|
8881
|
+
}
|
|
8848
8882
|
/* harmony default export */ var internals_text = ({
|
|
8849
8883
|
opacityForText: function opacityForText(d) {
|
|
8850
8884
|
var $$ = this;
|
|
@@ -8932,8 +8966,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
8932
8966
|
if (isString(labelColors)) {
|
|
8933
8967
|
color = labelColors;
|
|
8934
8968
|
} else if (isObject(labelColors)) {
|
|
8935
|
-
var
|
|
8936
|
-
id =
|
|
8969
|
+
var _ref2 = d.data || d,
|
|
8970
|
+
id = _ref2.id;
|
|
8937
8971
|
color = labelColors[id];
|
|
8938
8972
|
} else if (isFunction(labelColors)) {
|
|
8939
8973
|
color = labelColors.bind($$.api)(defaultColor, d);
|
|
@@ -9100,17 +9134,6 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
9100
9134
|
}
|
|
9101
9135
|
return 0;
|
|
9102
9136
|
},
|
|
9103
|
-
/**
|
|
9104
|
-
* Get data.labels.position value
|
|
9105
|
-
* @param {string} id Data id value
|
|
9106
|
-
* @param {string} type x | y
|
|
9107
|
-
* @returns {number} Position value
|
|
9108
|
-
* @private
|
|
9109
|
-
*/
|
|
9110
|
-
getTextPos: function getTextPos(id, type) {
|
|
9111
|
-
var pos = this.config.data_labels_position;
|
|
9112
|
-
return (id in pos ? pos[id] : pos)[type] || 0;
|
|
9113
|
-
},
|
|
9114
9137
|
/**
|
|
9115
9138
|
* Gets the x coordinate of the text
|
|
9116
9139
|
* @param {object} points Data points position
|
|
@@ -9164,7 +9187,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
9164
9187
|
if (isRotated || isTreemapType) {
|
|
9165
9188
|
xPos += $$.getCenteredTextPos(d, points, textElement, "x");
|
|
9166
9189
|
}
|
|
9167
|
-
return xPos +
|
|
9190
|
+
return xPos + getTextPos.call(this, d, "x");
|
|
9168
9191
|
},
|
|
9169
9192
|
/**
|
|
9170
9193
|
* Gets the y coordinate of the text
|
|
@@ -9238,7 +9261,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
9238
9261
|
if (!isRotated || isTreemapType) {
|
|
9239
9262
|
yPos += $$.getCenteredTextPos(d, points, textElement, "y");
|
|
9240
9263
|
}
|
|
9241
|
-
return yPos +
|
|
9264
|
+
return yPos + getTextPos.call(this, d, "y");
|
|
9242
9265
|
},
|
|
9243
9266
|
/**
|
|
9244
9267
|
* Calculate if two or more text nodes are overlapping
|
|
@@ -9319,7 +9342,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
|
|
|
9319
9342
|
* @returns {string|number} text-anchor value or position in pixel
|
|
9320
9343
|
* @private
|
|
9321
9344
|
*/
|
|
9322
|
-
function
|
|
9345
|
+
function title_getTextPos(pos, width) {
|
|
9323
9346
|
if (pos === void 0) {
|
|
9324
9347
|
pos = "left";
|
|
9325
9348
|
}
|
|
@@ -9345,7 +9368,7 @@ function getTextPos(pos, width) {
|
|
|
9345
9368
|
$el = $$.$el;
|
|
9346
9369
|
if (config.title_text) {
|
|
9347
9370
|
$el.title = $el.svg.append("g");
|
|
9348
|
-
var text = $el.title.append("text").style("text-anchor",
|
|
9371
|
+
var text = $el.title.append("text").style("text-anchor", title_getTextPos(config.title_position)).attr("class", $TEXT.title);
|
|
9349
9372
|
setTextValue(text, config.title_text, [.3, 1.5]);
|
|
9350
9373
|
}
|
|
9351
9374
|
},
|
|
@@ -9361,7 +9384,7 @@ function getTextPos(pos, width) {
|
|
|
9361
9384
|
if (title) {
|
|
9362
9385
|
var y = $$.yForTitle.call($$);
|
|
9363
9386
|
if (/g/i.test(title.node().tagName)) {
|
|
9364
|
-
title.attr("transform", "translate(" +
|
|
9387
|
+
title.attr("transform", "translate(" + title_getTextPos(config.title_position, current.width) + ", " + y + ")");
|
|
9365
9388
|
} else {
|
|
9366
9389
|
title.attr("x", $$.xForTitle.call($$)).attr("y", y);
|
|
9367
9390
|
}
|
|
@@ -9669,6 +9692,7 @@ function getTextPos(pos, width) {
|
|
|
9669
9692
|
event = _state.event,
|
|
9670
9693
|
hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle,
|
|
9671
9694
|
hasTreemap = state.hasTreemap,
|
|
9695
|
+
isRotated = config.axis_rotated,
|
|
9672
9696
|
svgLeft = $$.getSvgLeft(!0),
|
|
9673
9697
|
chartRight = svgLeft + current.width - $$.getCurrentPaddingRight(),
|
|
9674
9698
|
chartLeft = $$.getCurrentPaddingLeft(!0),
|
|
@@ -9684,9 +9708,9 @@ function getTextPos(pos, width) {
|
|
|
9684
9708
|
}
|
|
9685
9709
|
} else if (!hasTreemap) {
|
|
9686
9710
|
var dataScale = scale.x(dataToShow[0].x);
|
|
9687
|
-
if (
|
|
9711
|
+
if (isRotated) {
|
|
9688
9712
|
y = dataScale + 20;
|
|
9689
|
-
x += svgLeft
|
|
9713
|
+
x += svgLeft;
|
|
9690
9714
|
chartRight -= svgLeft;
|
|
9691
9715
|
} else {
|
|
9692
9716
|
y -= 5;
|
|
@@ -9696,7 +9720,7 @@ function getTextPos(pos, width) {
|
|
|
9696
9720
|
|
|
9697
9721
|
// when tooltip left + tWidth > chart's width
|
|
9698
9722
|
if (x + tWidth + 15 > chartRight) {
|
|
9699
|
-
x -= tWidth + (hasTreemap ? 0 : chartLeft);
|
|
9723
|
+
x -= isRotated ? tWidth - chartLeft : tWidth + (hasTreemap ? 0 : chartLeft);
|
|
9700
9724
|
}
|
|
9701
9725
|
if (y + tHeight > current.height) {
|
|
9702
9726
|
var gap = hasTreemap ? 0 : 30;
|
|
@@ -10732,6 +10756,7 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10732
10756
|
legend = _$$$$el.legend,
|
|
10733
10757
|
title = _$$$$el.title,
|
|
10734
10758
|
grid = _$$$$el.grid,
|
|
10759
|
+
needle = _$$$$el.needle,
|
|
10735
10760
|
arc = _$$$$el.arcs,
|
|
10736
10761
|
circles = _$$$$el.circle,
|
|
10737
10762
|
bars = _$$$$el.bar,
|
|
@@ -10739,6 +10764,7 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10739
10764
|
lines = _$$$$el.line,
|
|
10740
10765
|
areas = _$$$$el.area,
|
|
10741
10766
|
texts = _$$$$el.text;
|
|
10767
|
+
// public
|
|
10742
10768
|
$$.api.$ = {
|
|
10743
10769
|
chart: chart,
|
|
10744
10770
|
svg: svg,
|
|
@@ -10758,6 +10784,7 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
10758
10784
|
lines: lines,
|
|
10759
10785
|
areas: areas
|
|
10760
10786
|
},
|
|
10787
|
+
needle: needle,
|
|
10761
10788
|
text: {
|
|
10762
10789
|
texts: texts
|
|
10763
10790
|
}
|
|
@@ -12486,6 +12513,10 @@ var tooltip_tooltip = {
|
|
|
12486
12513
|
* @property {d3.selection} $.svg Main svg element
|
|
12487
12514
|
* @property {d3.selection} $.defs Definition element
|
|
12488
12515
|
* @property {d3.selection} $.main Main grouping element
|
|
12516
|
+
* @property {d3.selection} $.needle Needle element
|
|
12517
|
+
* - **NOTE:**
|
|
12518
|
+
* - The element will have `bb-needle` as class name.
|
|
12519
|
+
* - Will provide speical helper `.updateHelper(value: number, updateConfig: boolean)` method to facilitate needle position update.
|
|
12489
12520
|
* @property {d3.selection} $.tooltip Tooltip element
|
|
12490
12521
|
* @property {d3.selection} $.legend Legend element
|
|
12491
12522
|
* @property {d3.selection} $.title Title element
|
|
@@ -12502,10 +12533,35 @@ var tooltip_tooltip = {
|
|
|
12502
12533
|
* @property {d3.selection} $.text.texts Data label text elements
|
|
12503
12534
|
* @memberof Chart
|
|
12504
12535
|
* @example
|
|
12505
|
-
*
|
|
12536
|
+
* const chart = bb.generate({ ... });
|
|
12506
12537
|
*
|
|
12507
12538
|
* chart.$.chart; // wrapper element
|
|
12508
12539
|
* chart.$.line.circles; // all data point circle elements
|
|
12540
|
+
* @example
|
|
12541
|
+
* // Update arc needle position
|
|
12542
|
+
* const chart = bb.generate({
|
|
12543
|
+
* data: {
|
|
12544
|
+
* type: "donut"
|
|
12545
|
+
* },
|
|
12546
|
+
* arc: {
|
|
12547
|
+
* needle: {
|
|
12548
|
+
* show: true,
|
|
12549
|
+
* ...
|
|
12550
|
+
* }
|
|
12551
|
+
* }
|
|
12552
|
+
* });
|
|
12553
|
+
*
|
|
12554
|
+
* chart.$.needle.updateHelper(70); // update needle position to point value 70.
|
|
12555
|
+
*
|
|
12556
|
+
* // update needle position to point value 70 and the config value.
|
|
12557
|
+
* // NOTE: updating config value, will update needle pointer initial value too.
|
|
12558
|
+
* chart.$.needle.updateHelper(70, true);
|
|
12559
|
+
*
|
|
12560
|
+
* // update needle point position every 1 second
|
|
12561
|
+
* let i = 0;
|
|
12562
|
+
* setInterval(() => {
|
|
12563
|
+
* chart.$.needle.updateHelper(i += 10);
|
|
12564
|
+
* }, 1000)
|
|
12509
12565
|
*/
|
|
12510
12566
|
/**
|
|
12511
12567
|
* Plugin instance array
|
|
@@ -18603,7 +18659,7 @@ function getAttrTweenFn(fn) {
|
|
|
18603
18659
|
}
|
|
18604
18660
|
return len * Math.PI;
|
|
18605
18661
|
},
|
|
18606
|
-
|
|
18662
|
+
getGaugeStartAngle: function getGaugeStartAngle() {
|
|
18607
18663
|
var $$ = this,
|
|
18608
18664
|
config = $$.config,
|
|
18609
18665
|
isFullCircle = config.gauge_fullCircle,
|
|
@@ -18630,7 +18686,7 @@ function getAttrTweenFn(fn) {
|
|
|
18630
18686
|
if (!config) {
|
|
18631
18687
|
return null;
|
|
18632
18688
|
}
|
|
18633
|
-
var gStart = $$.
|
|
18689
|
+
var gStart = $$.getGaugeStartAngle(),
|
|
18634
18690
|
radius = config.gauge_fullCircle ? $$.getArcLength() : gStart * -2;
|
|
18635
18691
|
if (d.data && $$.isGaugeType(d.data) && !$$.hasMultiArcGauge()) {
|
|
18636
18692
|
var min = config.gauge_min,
|
|
@@ -18640,8 +18696,9 @@ function getAttrTweenFn(fn) {
|
|
|
18640
18696
|
pie = pie.startAngle(gStart).endAngle(radius * ((totalSum - min) / (max - min)) + gStart);
|
|
18641
18697
|
}
|
|
18642
18698
|
pie($$.filterTargetsToShow()).forEach(function (t, i) {
|
|
18699
|
+
var _d$data;
|
|
18643
18700
|
_newArrowCheck(this, _this4);
|
|
18644
|
-
if (!found && t.data.id === d.data.id) {
|
|
18701
|
+
if (!found && t.data.id === ((_d$data = d.data) == null ? void 0 : _d$data.id)) {
|
|
18645
18702
|
found = !0;
|
|
18646
18703
|
d = t;
|
|
18647
18704
|
d.index = i;
|
|
@@ -18883,11 +18940,6 @@ function getAttrTweenFn(fn) {
|
|
|
18883
18940
|
}.bind(this));
|
|
18884
18941
|
return isFunction(format) ? format.bind($$.api) : format;
|
|
18885
18942
|
},
|
|
18886
|
-
getArcTitle: function getArcTitle() {
|
|
18887
|
-
var $$ = this,
|
|
18888
|
-
type = $$.hasType("donut") && "donut" || $$.hasType("gauge") && "gauge";
|
|
18889
|
-
return type ? $$.config[type + "_title"] : "";
|
|
18890
|
-
},
|
|
18891
18943
|
updateTargetsForArc: function updateTargetsForArc(targets) {
|
|
18892
18944
|
var _this11 = this,
|
|
18893
18945
|
$$ = this,
|
|
@@ -18916,18 +18968,54 @@ function getAttrTweenFn(fn) {
|
|
|
18916
18968
|
},
|
|
18917
18969
|
/**
|
|
18918
18970
|
* Set arc title text
|
|
18971
|
+
* @param {string} str Title text
|
|
18919
18972
|
* @private
|
|
18920
18973
|
*/
|
|
18921
|
-
setArcTitle: function setArcTitle() {
|
|
18974
|
+
setArcTitle: function setArcTitle(str) {
|
|
18922
18975
|
var $$ = this,
|
|
18923
|
-
title = $$.getArcTitle(),
|
|
18976
|
+
title = str || $$.getArcTitle(),
|
|
18924
18977
|
hasGauge = $$.hasType("gauge");
|
|
18925
18978
|
if (title) {
|
|
18926
|
-
var
|
|
18979
|
+
var className = hasGauge ? $GAUGE.chartArcsGaugeTitle : $ARC.chartArcsTitle;
|
|
18980
|
+
var text = $$.$el.arcs.select("." + className);
|
|
18981
|
+
if (text.empty()) {
|
|
18982
|
+
text = $$.$el.arcs.append("text").attr("class", className).style("text-anchor", "middle");
|
|
18983
|
+
}
|
|
18927
18984
|
hasGauge && text.attr("dy", "-0.3em");
|
|
18928
18985
|
setTextValue(text, title, hasGauge ? undefined : [-.6, 1.35], !0);
|
|
18929
18986
|
}
|
|
18930
18987
|
},
|
|
18988
|
+
/**
|
|
18989
|
+
* Return arc title text
|
|
18990
|
+
* @returns {string} Arc title text
|
|
18991
|
+
* @private
|
|
18992
|
+
*/
|
|
18993
|
+
getArcTitle: function getArcTitle() {
|
|
18994
|
+
var $$ = this,
|
|
18995
|
+
type = $$.hasType("donut") && "donut" || $$.hasType("gauge") && "gauge";
|
|
18996
|
+
return type ? $$.config[type + "_title"] : "";
|
|
18997
|
+
},
|
|
18998
|
+
/**
|
|
18999
|
+
* Get arc title text with needle value
|
|
19000
|
+
* @returns {string|boolean} When title contains needle template string will return processed string, otherwise false
|
|
19001
|
+
* @private
|
|
19002
|
+
*/
|
|
19003
|
+
getArcTitleWithNeedleValue: function getArcTitleWithNeedleValue() {
|
|
19004
|
+
var $$ = this,
|
|
19005
|
+
config = $$.config,
|
|
19006
|
+
state = $$.state,
|
|
19007
|
+
title = $$.getArcTitle();
|
|
19008
|
+
if (title && $$.config.arc_needle_show && /{=[A-Z_]+}/.test(title)) {
|
|
19009
|
+
var value = state.current.needle;
|
|
19010
|
+
if (!isNumber(value)) {
|
|
19011
|
+
value = config.arc_needle_value;
|
|
19012
|
+
}
|
|
19013
|
+
return tplProcess(title, {
|
|
19014
|
+
NEEDLE_VALUE: isNumber(value) ? value : 0
|
|
19015
|
+
});
|
|
19016
|
+
}
|
|
19017
|
+
return !1;
|
|
19018
|
+
},
|
|
18931
19019
|
redrawArc: function redrawArc(duration, durationForExit, withTransform) {
|
|
18932
19020
|
var _this12 = this,
|
|
18933
19021
|
$$ = this,
|
|
@@ -19014,28 +19102,122 @@ function getAttrTweenFn(fn) {
|
|
|
19014
19102
|
hasInteraction && $$.bindArcEvent(mainArc);
|
|
19015
19103
|
$$.hasType("polar") && $$.redrawPolar();
|
|
19016
19104
|
$$.hasType("gauge") && $$.redrawBackgroundArcs();
|
|
19105
|
+
config.arc_needle_show && $$.redrawNeedle();
|
|
19017
19106
|
$$.redrawArcText(duration);
|
|
19018
19107
|
},
|
|
19019
|
-
|
|
19108
|
+
/**
|
|
19109
|
+
* Update needle element
|
|
19110
|
+
* @private
|
|
19111
|
+
*/
|
|
19112
|
+
redrawNeedle: function redrawNeedle() {
|
|
19020
19113
|
var _this14 = this,
|
|
19114
|
+
$$ = this,
|
|
19115
|
+
$el = $$.$el,
|
|
19116
|
+
config = $$.config,
|
|
19117
|
+
_$$$state2 = $$.state,
|
|
19118
|
+
hiddenTargetIds = _$$$state2.hiddenTargetIds,
|
|
19119
|
+
radius = _$$$state2.radius,
|
|
19120
|
+
length = (radius - 1) / 100 * config.arc_needle_length,
|
|
19121
|
+
hasDataToShow = hiddenTargetIds.length !== $$.data.targets.length,
|
|
19122
|
+
needle = $$.$el.arcs.select("." + $ARC.needle),
|
|
19123
|
+
pathFn = config.arc_needle_path,
|
|
19124
|
+
baseWidth = config.arc_needle_bottom_width / 2,
|
|
19125
|
+
topWidth = config.arc_needle_top_width / 2,
|
|
19126
|
+
topRx = config.arc_needle_top_rx,
|
|
19127
|
+
topRy = config.arc_needle_top_ry,
|
|
19128
|
+
bottomLen = config.arc_needle_bottom_len,
|
|
19129
|
+
bottomRx = config.arc_needle_bottom_rx,
|
|
19130
|
+
bottomRy = config.arc_needle_bottom_ry,
|
|
19131
|
+
needleAngle = $$.getNeedleAngle(),
|
|
19132
|
+
updateNeedleValue = function () {
|
|
19133
|
+
_newArrowCheck(this, _this14);
|
|
19134
|
+
var title = $$.getArcTitleWithNeedleValue();
|
|
19135
|
+
title && $$.setArcTitle(title);
|
|
19136
|
+
}.bind(this); // needle options
|
|
19137
|
+
updateNeedleValue();
|
|
19138
|
+
if (needle.empty()) {
|
|
19139
|
+
needle = $el.arcs.append("path").classed($ARC.needle, !0);
|
|
19140
|
+
$el.needle = needle;
|
|
19141
|
+
|
|
19142
|
+
/**
|
|
19143
|
+
* Function to be exposed as public to facilitate updating needle
|
|
19144
|
+
* @param {number} v Value to be updated
|
|
19145
|
+
* @param {boolean} updateConfig Weather update config's value
|
|
19146
|
+
* @private
|
|
19147
|
+
*/
|
|
19148
|
+
$el.needle.updateHelper = function (v, updateConfig) {
|
|
19149
|
+
var _this15 = this;
|
|
19150
|
+
if (updateConfig === void 0) {
|
|
19151
|
+
updateConfig = !1;
|
|
19152
|
+
}
|
|
19153
|
+
_newArrowCheck(this, _this14);
|
|
19154
|
+
if ($el.needle.style("display") !== "none") {
|
|
19155
|
+
$$.$T($el.needle).style("transform", "rotate(" + $$.getNeedleAngle(v) + "deg)").call(endall, function () {
|
|
19156
|
+
_newArrowCheck(this, _this15);
|
|
19157
|
+
updateConfig && (config.arc_needle_value = v);
|
|
19158
|
+
updateNeedleValue();
|
|
19159
|
+
}.bind(this));
|
|
19160
|
+
}
|
|
19161
|
+
}.bind(this);
|
|
19162
|
+
}
|
|
19163
|
+
if (hasDataToShow) {
|
|
19164
|
+
var path = isFunction(pathFn) ? pathFn.call($$, length) : "M-" + baseWidth + " " + bottomLen + " A" + bottomRx + " " + bottomRy + " 0 0 0 " + baseWidth + " " + bottomLen + " L" + topWidth + " -" + length + " A" + topRx + " " + topRy + " 0 0 0 -" + topWidth + " -" + length + " L-" + baseWidth + " " + bottomLen + " Z";
|
|
19165
|
+
$$.$T(needle).attr("d", path).style("fill", config.arc_needle_color).style("display", null).style("transform", "rotate(" + needleAngle + "deg)");
|
|
19166
|
+
} else {
|
|
19167
|
+
needle.style("display", "none");
|
|
19168
|
+
}
|
|
19169
|
+
},
|
|
19170
|
+
/**
|
|
19171
|
+
* Get needle angle value relative given value
|
|
19172
|
+
* @param {number} v Value to be calculated angle
|
|
19173
|
+
* @returns {number} angle value
|
|
19174
|
+
* @private
|
|
19175
|
+
*/
|
|
19176
|
+
getNeedleAngle: function getNeedleAngle(v) {
|
|
19177
|
+
var $$ = this,
|
|
19178
|
+
config = $$.config,
|
|
19179
|
+
state = $$.state,
|
|
19180
|
+
arcLength = $$.getArcLength(),
|
|
19181
|
+
hasGauge = $$.hasType("gauge"),
|
|
19182
|
+
total = $$.getTotalDataSum(!0);
|
|
19183
|
+
var value = isDefined(v) ? v : config.arc_needle_value,
|
|
19184
|
+
startingAngle = config[config.data_type + "_startingAngle"] || 0,
|
|
19185
|
+
radian = 0;
|
|
19186
|
+
if (!isNumber(value)) {
|
|
19187
|
+
value = hasGauge && $$.data.targets.length === 1 ? total : 0;
|
|
19188
|
+
}
|
|
19189
|
+
state.current.needle = value;
|
|
19190
|
+
if (hasGauge) {
|
|
19191
|
+
startingAngle = $$.getGaugeStartAngle();
|
|
19192
|
+
var _radius = config.gauge_fullCircle ? arcLength : startingAngle * -2,
|
|
19193
|
+
min = config.gauge_min,
|
|
19194
|
+
max = config.gauge_max;
|
|
19195
|
+
radian = _radius * ((value - min) / (max - min));
|
|
19196
|
+
} else {
|
|
19197
|
+
radian = arcLength * (value / total);
|
|
19198
|
+
}
|
|
19199
|
+
return (startingAngle + radian) * (180 / Math.PI);
|
|
19200
|
+
},
|
|
19201
|
+
redrawBackgroundArcs: function redrawBackgroundArcs() {
|
|
19202
|
+
var _this16 = this,
|
|
19021
19203
|
$$ = this,
|
|
19022
19204
|
config = $$.config,
|
|
19023
19205
|
state = $$.state,
|
|
19024
19206
|
hasMultiArcGauge = $$.hasMultiArcGauge(),
|
|
19025
19207
|
isFullCircle = config.gauge_fullCircle,
|
|
19026
19208
|
showEmptyTextLabel = $$.filterTargetsToShow($$.data.targets).length === 0 && !!config.data_empty_label_text,
|
|
19027
|
-
startAngle = $$.
|
|
19209
|
+
startAngle = $$.getGaugeStartAngle(),
|
|
19028
19210
|
endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1,
|
|
19029
19211
|
backgroundArc = $$.$el.arcs.select((hasMultiArcGauge ? "g" : "") + "." + $ARC.chartArcsBackground);
|
|
19030
19212
|
if (hasMultiArcGauge) {
|
|
19031
19213
|
var index = 0;
|
|
19032
19214
|
backgroundArc = backgroundArc.selectAll("path." + $ARC.chartArcsBackground).data($$.data.targets);
|
|
19033
19215
|
backgroundArc.enter().append("path").attr("class", function (d, i) {
|
|
19034
|
-
_newArrowCheck(this,
|
|
19216
|
+
_newArrowCheck(this, _this16);
|
|
19035
19217
|
return $ARC.chartArcsBackground + " " + $ARC.chartArcsBackground + "-" + i;
|
|
19036
19218
|
}.bind(this)).merge(backgroundArc).style("fill", config.gauge_background || null).attr("d", function (_ref2) {
|
|
19037
19219
|
var id = _ref2.id;
|
|
19038
|
-
_newArrowCheck(this,
|
|
19220
|
+
_newArrowCheck(this, _this16);
|
|
19039
19221
|
if (showEmptyTextLabel || state.hiddenTargetIds.indexOf(id) >= 0) {
|
|
19040
19222
|
return "M 0 0";
|
|
19041
19223
|
}
|
|
@@ -19052,7 +19234,7 @@ function getAttrTweenFn(fn) {
|
|
|
19052
19234
|
backgroundArc.exit().remove();
|
|
19053
19235
|
} else {
|
|
19054
19236
|
backgroundArc.attr("d", showEmptyTextLabel ? "M 0 0" : function () {
|
|
19055
|
-
_newArrowCheck(this,
|
|
19237
|
+
_newArrowCheck(this, _this16);
|
|
19056
19238
|
var d = {
|
|
19057
19239
|
data: [{
|
|
19058
19240
|
value: config.gauge_max
|
|
@@ -19065,7 +19247,7 @@ function getAttrTweenFn(fn) {
|
|
|
19065
19247
|
}
|
|
19066
19248
|
},
|
|
19067
19249
|
bindArcEvent: function bindArcEvent(arc) {
|
|
19068
|
-
var
|
|
19250
|
+
var _this17 = this,
|
|
19069
19251
|
$$ = this,
|
|
19070
19252
|
config = $$.config,
|
|
19071
19253
|
state = $$.state,
|
|
@@ -19113,7 +19295,7 @@ function getAttrTweenFn(fn) {
|
|
|
19113
19295
|
selectArc(this, arcData, id);
|
|
19114
19296
|
$$.setOverOut(!0, arcData);
|
|
19115
19297
|
}).on("mouseout", function (event, d) {
|
|
19116
|
-
_newArrowCheck(this,
|
|
19298
|
+
_newArrowCheck(this, _this17);
|
|
19117
19299
|
if (state.transiting) {
|
|
19118
19300
|
// skip while transiting
|
|
19119
19301
|
return;
|
|
@@ -19134,7 +19316,7 @@ function getAttrTweenFn(fn) {
|
|
|
19134
19316
|
// touch events
|
|
19135
19317
|
if (isTouch && $$.hasArcType() && !$$.radars) {
|
|
19136
19318
|
var getEventArc = function (event) {
|
|
19137
|
-
_newArrowCheck(this,
|
|
19319
|
+
_newArrowCheck(this, _this17);
|
|
19138
19320
|
var touch = event.changedTouches[0],
|
|
19139
19321
|
eventArc = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(browser_doc.elementFromPoint(touch.clientX, touch.clientY));
|
|
19140
19322
|
return eventArc;
|
|
@@ -19157,7 +19339,7 @@ function getAttrTweenFn(fn) {
|
|
|
19157
19339
|
}
|
|
19158
19340
|
},
|
|
19159
19341
|
redrawArcText: function redrawArcText(duration) {
|
|
19160
|
-
var
|
|
19342
|
+
var _this18 = this,
|
|
19161
19343
|
$$ = this,
|
|
19162
19344
|
config = $$.config,
|
|
19163
19345
|
state = $$.state,
|
|
@@ -19170,13 +19352,13 @@ function getAttrTweenFn(fn) {
|
|
|
19170
19352
|
// for gauge type, update text when has no title & multi data
|
|
19171
19353
|
if (!(hasGauge && $$.data.targets.length === 1 && config.gauge_title)) {
|
|
19172
19354
|
text = main.selectAll("." + $ARC.chartArc).select("text").style("opacity", "0").attr("class", function (d) {
|
|
19173
|
-
_newArrowCheck(this,
|
|
19355
|
+
_newArrowCheck(this, _this18);
|
|
19174
19356
|
return $$.isGaugeType(d.data) ? $GAUGE.gaugeValue : null;
|
|
19175
19357
|
}.bind(this)).call($$.textForArcLabel.bind($$)).attr("transform", $$.transformForArcLabel.bind($$)).style("font-size", function (d) {
|
|
19176
|
-
_newArrowCheck(this,
|
|
19358
|
+
_newArrowCheck(this, _this18);
|
|
19177
19359
|
return $$.isGaugeType(d.data) && $$.data.targets.length === 1 && !hasMultiArcGauge ? Math.round(state.radius / 5) + "px" : null;
|
|
19178
19360
|
}.bind(this)).transition().duration(duration).style("opacity", function (d) {
|
|
19179
|
-
_newArrowCheck(this,
|
|
19361
|
+
_newArrowCheck(this, _this18);
|
|
19180
19362
|
return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? null : "0";
|
|
19181
19363
|
}.bind(this));
|
|
19182
19364
|
hasMultiArcGauge && text.attr("dy", "-.1em");
|
|
@@ -22134,9 +22316,31 @@ function convertDataToTreemapData(data) {
|
|
|
22134
22316
|
* - **NOTE:**
|
|
22135
22317
|
* - Corner radius can't surpass the `(outerRadius - innerRadius) /2` of indicated shape.
|
|
22136
22318
|
* @property {number} [arc.cornerRadius.ratio=0] Set ratio relative of outer radius.
|
|
22319
|
+
* @property {object} [arc.needle] Set needle options.
|
|
22320
|
+
* @property {boolean} [arc.needle.show=false] Show or hide needle.
|
|
22321
|
+
* @property {string} [arc.needle.color] Set needle filled color.
|
|
22322
|
+
* @property {Function} [arc.needle.path] Set custom needle path function.
|
|
22323
|
+
* - **NOTE:**
|
|
22324
|
+
* - The path should be starting from 0,0 (which is center) to top center coordinate.
|
|
22325
|
+
* - The function will receive, `length`{number} parameter which indicating the needle length in pixel relative to radius.
|
|
22326
|
+
* @property {number} [arc.needle.value] Set needle value.
|
|
22327
|
+
* - **NOTE:**
|
|
22328
|
+
* - For single gauge chart, needle will point the data value by default, otherwise will point 0(zero).
|
|
22329
|
+
* @property {number} [arc.needle.length=100] Set needle length in percentages relative to radius.
|
|
22330
|
+
* @property {object} [arc.needle.top] Set needle top options.
|
|
22331
|
+
* @property {number} [arc.needle.top.rx=0] Set needle top [rx radius value](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve).
|
|
22332
|
+
* @property {number} [arc.needle.top.ry=0] Set needle top [ry radius value](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve).
|
|
22333
|
+
* @property {number} [arc.needle.top.width=0] Set needle top width in pixel.
|
|
22334
|
+
* @property {object} [arc.needle.bottom] Set needle bottom options.
|
|
22335
|
+
* @property {number} [arc.needle.bottom.rx=1] Set needle bottom [rx radius value](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve).
|
|
22336
|
+
* @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).
|
|
22337
|
+
* @property {number} [arc.needle.bottom.width=15] Set needle bottom width in pixel.
|
|
22338
|
+
* @property {number} [arc.needle.bottom.len=0] Set needle bottom length in pixel. Setting this value, will make bottom larger starting from center.
|
|
22137
22339
|
* @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutCornerRadius)
|
|
22138
22340
|
* @see [Demo: Gauge corner radius](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeCornerRadius)
|
|
22139
22341
|
* @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#PieChartOptions.CornerRadius)
|
|
22342
|
+
* @see [Demo: Donut needle](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutNeedle)
|
|
22343
|
+
* @see [Demo: Gauge needle](https://naver.github.io/billboard.js/demo/##GaugeChartOptions.GaugeNeedle)
|
|
22140
22344
|
* @example
|
|
22141
22345
|
* arc: {
|
|
22142
22346
|
* cornerRadius: 12,
|
|
@@ -22155,11 +22359,61 @@ function convertDataToTreemapData(data) {
|
|
|
22155
22359
|
* // set ratio relative of outer radius
|
|
22156
22360
|
* cornerRadius: {
|
|
22157
22361
|
* ratio: 0.5
|
|
22362
|
+
* },
|
|
22363
|
+
*
|
|
22364
|
+
* needle: {
|
|
22365
|
+
* show: true,
|
|
22366
|
+
* color: "red", // any valid CSS color
|
|
22367
|
+
* path: function(length) {
|
|
22368
|
+
* const len = length - 20;
|
|
22369
|
+
*
|
|
22370
|
+
* // will return upper arrow shape path
|
|
22371
|
+
* // Note: The path should begun from '0,0' coordinate to top center.
|
|
22372
|
+
* const path = `M 0 -${len + 20}
|
|
22373
|
+
* L -12 -${len}
|
|
22374
|
+
* L -5 -${len}
|
|
22375
|
+
* L -5 0
|
|
22376
|
+
* A 1 1 0 0 0 5 0
|
|
22377
|
+
* L 5 -${len}
|
|
22378
|
+
* L 12 -${len} Z`;
|
|
22379
|
+
*
|
|
22380
|
+
* return path;
|
|
22381
|
+
* },
|
|
22382
|
+
* value: 40, // will make needle to point value 40.
|
|
22383
|
+
* length: 80, // needle length in percentages relative to radius.
|
|
22384
|
+
*
|
|
22385
|
+
* top: {
|
|
22386
|
+
* // rx and ry are the two radii of the ellipse;
|
|
22387
|
+
* // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve
|
|
22388
|
+
* rx: 1,
|
|
22389
|
+
* ry: 1,
|
|
22390
|
+
* width: 5
|
|
22391
|
+
* },
|
|
22392
|
+
* bottom: {
|
|
22393
|
+
* // rx and ry are the two radii of the ellipse;
|
|
22394
|
+
* // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve
|
|
22395
|
+
* rx: 1,
|
|
22396
|
+
* ry: 1,
|
|
22397
|
+
* width: 10
|
|
22398
|
+
* len: 10
|
|
22399
|
+
* }
|
|
22158
22400
|
* }
|
|
22159
22401
|
* }
|
|
22160
22402
|
*/
|
|
22161
22403
|
arc_cornerRadius: 0,
|
|
22162
|
-
arc_cornerRadius_ratio: 0
|
|
22404
|
+
arc_cornerRadius_ratio: 0,
|
|
22405
|
+
arc_needle_show: !1,
|
|
22406
|
+
arc_needle_color: undefined,
|
|
22407
|
+
arc_needle_value: undefined,
|
|
22408
|
+
arc_needle_path: undefined,
|
|
22409
|
+
arc_needle_length: 100,
|
|
22410
|
+
arc_needle_top_rx: 0,
|
|
22411
|
+
arc_needle_top_ry: 0,
|
|
22412
|
+
arc_needle_top_width: 0,
|
|
22413
|
+
arc_needle_bottom_rx: 1,
|
|
22414
|
+
arc_needle_bottom_ry: 1,
|
|
22415
|
+
arc_needle_bottom_width: 15,
|
|
22416
|
+
arc_needle_bottom_len: 0
|
|
22163
22417
|
});
|
|
22164
22418
|
;// CONCATENATED MODULE: ./src/config/Options/shape/donut.ts
|
|
22165
22419
|
/**
|
|
@@ -22185,6 +22439,8 @@ function convertDataToTreemapData(data) {
|
|
|
22185
22439
|
* @property {number} [donut.expand.duration=50] Set expand transition time in ms.
|
|
22186
22440
|
* @property {number} [donut.width] Set width of donut chart.
|
|
22187
22441
|
* @property {string} [donut.title=""] Set title of donut chart. Use `\n` character for line break.
|
|
22442
|
+
* - **NOTE:**
|
|
22443
|
+
* - When `arc.needle.show=true` is set, special template `{=NEEDLE_VALUE}` can be used inside the title text to show current needle value.
|
|
22188
22444
|
* @property {number} [donut.padAngle=0] Set padding between data.
|
|
22189
22445
|
* @property {number} [donut.startingAngle=0] Set starting angle where data draws.
|
|
22190
22446
|
* @example
|
|
@@ -22227,6 +22483,9 @@ function convertDataToTreemapData(data) {
|
|
|
22227
22483
|
* startingAngle: 1,
|
|
22228
22484
|
* title: "Donut Title"
|
|
22229
22485
|
*
|
|
22486
|
+
* // when 'arc.needle.show=true' is set, can show current needle value.
|
|
22487
|
+
* title: "Needle value:\n{=NEEDLE_VALUE}",
|
|
22488
|
+
*
|
|
22230
22489
|
* // title with line break
|
|
22231
22490
|
* title: "Title1\nTitle2"
|
|
22232
22491
|
* }
|
|
@@ -22292,6 +22551,8 @@ function convertDataToTreemapData(data) {
|
|
|
22292
22551
|
* - 'arcLength < -100' defaults to -100
|
|
22293
22552
|
* - 'arcLength > 100' defaults to 100
|
|
22294
22553
|
* @property {string} [gauge.title=""] Set title of gauge chart. Use `\n` character for line break.
|
|
22554
|
+
* - **NOTE:**
|
|
22555
|
+
* - When `arc.needle.show=true` is set, special template `{=NEEDLE_VALUE}` can be used inside the title text to show current needle value.
|
|
22295
22556
|
* @property {string} [gauge.units] Set units of the gauge.
|
|
22296
22557
|
* @property {number} [gauge.width] Set width of gauge chart.
|
|
22297
22558
|
* @property {string} [gauge.type="single"] Set type of gauge to be displayed.<br><br>
|
|
@@ -22338,6 +22599,10 @@ function convertDataToTreemapData(data) {
|
|
|
22338
22599
|
* max: 200,
|
|
22339
22600
|
* type: "single" // or 'multi'
|
|
22340
22601
|
* title: "Title Text",
|
|
22602
|
+
*
|
|
22603
|
+
* // when 'arc.needle.show=true' is set, can show current needle value.
|
|
22604
|
+
* title: "Needle value:\n{=NEEDLE_VALUE}",
|
|
22605
|
+
*
|
|
22341
22606
|
* units: "%",
|
|
22342
22607
|
* width: 10,
|
|
22343
22608
|
* startingAngle: -1 * Math.PI / 2,
|
|
@@ -24728,7 +24993,7 @@ var _defaults = {};
|
|
|
24728
24993
|
|
|
24729
24994
|
/**
|
|
24730
24995
|
* @namespace bb
|
|
24731
|
-
* @version 3.
|
|
24996
|
+
* @version 3.9.0-next.1
|
|
24732
24997
|
*/
|
|
24733
24998
|
var bb = {
|
|
24734
24999
|
/**
|
|
@@ -24738,7 +25003,7 @@ var bb = {
|
|
|
24738
25003
|
* bb.version; // "1.0.0"
|
|
24739
25004
|
* @memberof bb
|
|
24740
25005
|
*/
|
|
24741
|
-
version: "3.
|
|
25006
|
+
version: "3.9.0-next.1",
|
|
24742
25007
|
/**
|
|
24743
25008
|
* Generate chart
|
|
24744
25009
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|