billboard.js 3.8.2 → 3.9.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/billboard.css +7 -7
  2. package/dist/billboard.js +386 -71
  3. package/dist/billboard.min.css +2 -2
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +868 -361
  6. package/dist/billboard.pkgd.min.js +2 -2
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-sparkline.js +4 -3
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +4 -3
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +4 -4
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +484 -292
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +487 -294
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +488 -295
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +489 -297
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +501 -320
  22. package/dist/theme/dark.css +298 -0
  23. package/dist/theme/dark.min.css +9 -0
  24. package/dist/theme/datalab.css +9 -2
  25. package/dist/theme/datalab.min.css +2 -2
  26. package/dist/theme/graph.css +7 -5
  27. package/dist/theme/graph.min.css +2 -2
  28. package/dist/theme/insight.css +7 -5
  29. package/dist/theme/insight.min.css +2 -2
  30. package/dist-esm/billboard.js +367 -59
  31. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  32. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +4 -3
  33. package/dist-esm/plugin/billboardjs-plugin-stanford.js +4 -3
  34. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  35. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  36. package/package.json +35 -34
  37. package/src/Chart/Chart.ts +30 -1
  38. package/src/ChartInternal/ChartInternal.ts +12 -4
  39. package/src/ChartInternal/data/IData.ts +5 -0
  40. package/src/ChartInternal/data/data.ts +23 -9
  41. package/src/ChartInternal/internals/size.ts +5 -1
  42. package/src/ChartInternal/internals/text.ts +20 -15
  43. package/src/ChartInternal/internals/tooltip.ts +4 -3
  44. package/src/ChartInternal/shape/arc.ts +161 -18
  45. package/src/ChartInternal/shape/bar.ts +7 -3
  46. package/src/ChartInternal/shape/bubble.ts +0 -1
  47. package/src/ChartInternal/shape/point.ts +2 -0
  48. package/src/config/Options/common/legend.ts +1 -1
  49. package/src/config/Options/common/point.ts +30 -2
  50. package/src/config/Options/data/data.ts +22 -6
  51. package/src/config/Options/shape/arc.ts +73 -1
  52. package/src/config/Options/shape/bar.ts +7 -1
  53. package/src/config/Options/shape/donut.ts +5 -0
  54. package/src/config/Options/shape/gauge.ts +6 -0
  55. package/src/config/Store/State.ts +2 -1
  56. package/src/config/classes.ts +2 -1
  57. package/src/scss/billboard.scss +8 -5
  58. package/src/scss/theme/dark.scss +423 -0
  59. package/src/scss/theme/datalab.scss +11 -0
  60. package/src/scss/theme/graph.scss +9 -4
  61. package/src/scss/theme/insight.scss +9 -4
  62. package/types/options.d.ts +36 -14
  63. package/types/options.shape.d.ts +81 -4
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.2
8
+ * @version 3.9.0-next.2
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
- // status
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, j and it **must return a string**(`\n` character will be used as line break) that will be shown as the label.<br><br>
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, j) {
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 {boolean} [legend.padding=0] Set padding value
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.
@@ -5071,7 +5088,17 @@ function getDataKeyForJson(keysParam, config) {
5071
5088
  _newArrowCheck(this, _this36);
5072
5089
  return v && isValue(v.value);
5073
5090
  }.bind(this)),
5074
- minDist = config.point_sensitivity,
5091
+ getSensitivity = function (d) {
5092
+ _newArrowCheck(this, _this36);
5093
+ var sensitivity = config.point_sensitivity;
5094
+ if (isFunction(sensitivity)) {
5095
+ sensitivity = sensitivity.call($$.api, d);
5096
+ } else if (sensitivity === "radius") {
5097
+ sensitivity = d.r;
5098
+ }
5099
+ return sensitivity;
5100
+ }.bind(this),
5101
+ minDist,
5075
5102
  closest;
5076
5103
  // find mouseovering bar/candlestick
5077
5104
  // https://github.com/naver/billboard.js/issues/2434
@@ -5093,6 +5120,7 @@ function getDataKeyForJson(keysParam, config) {
5093
5120
  }.bind(this)).forEach(function (v) {
5094
5121
  _newArrowCheck(this, _this36);
5095
5122
  var d = $$.dist(v, pos);
5123
+ minDist = getSensitivity(v);
5096
5124
  if (d < minDist) {
5097
5125
  minDist = d;
5098
5126
  closest = v;
@@ -5104,11 +5132,13 @@ function getDataKeyForJson(keysParam, config) {
5104
5132
  var $$ = this,
5105
5133
  isRotated = $$.config.axis_rotated,
5106
5134
  scale = $$.scale,
5107
- xIndex = isRotated ? 1 : 0,
5108
- yIndex = isRotated ? 0 : 1,
5109
5135
  y = $$.circleY(data, data.index),
5110
5136
  x = (scale.zoom || scale.x)(data.x);
5111
- return Math.sqrt(Math.pow(x - pos[xIndex], 2) + Math.pow(y - pos[yIndex], 2));
5137
+
5138
+ // true: 1, false: 0
5139
+ // true: 0, false: 1
5140
+
5141
+ return Math.sqrt(Math.pow(x - pos[+isRotated], 2) + Math.pow(y - pos[+!isRotated], 2));
5112
5142
  },
5113
5143
  /**
5114
5144
  * Convert data for step type
@@ -5272,7 +5302,7 @@ function getDataKeyForJson(keysParam, config) {
5272
5302
 
5273
5303
  // otherwise, based on the rendered angle value
5274
5304
  } else {
5275
- var gaugeArcLength = config.gauge_fullCircle ? $$.getArcLength() : $$.getStartAngle() * -2,
5305
+ var gaugeArcLength = config.gauge_fullCircle ? $$.getArcLength() : $$.getGaugeStartAngle() * -2,
5276
5306
  arcLength = $$.hasType("gauge") ? gaugeArcLength : Math.PI * 2;
5277
5307
  ratio = (d.endAngle - d.startAngle) / arcLength;
5278
5308
  }
@@ -8644,7 +8674,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
8644
8674
  xAxisHeight = isRotated || isNonAxis ? 0 : $$.getHorizontalAxisHeight("x"),
8645
8675
  subchartXAxisHeight = config.subchart_axis_x_show && config.subchart_axis_x_tick_text_show ? xAxisHeight : 30,
8646
8676
  subchartHeight = config.subchart_show && !isNonAxis ? config.subchart_size_height + subchartXAxisHeight : 0,
8647
- padding = $$.getCurrentPadding();
8677
+ gaugeHeight = $$.hasType("gauge") && config.arc_needle_show && !config.gauge_fullCircle && !config.gauge_label_show ? 10 : 0,
8678
+ padding = $$.getCurrentPadding(); // when needle is shown with legend, it need some bottom space to not overlap with legend text
8648
8679
  // for main
8649
8680
  state.margin = !isNonAxis && isRotated ? {
8650
8681
  top: $$.getHorizontalAxisHeight("y2") + padding.top,
@@ -8655,7 +8686,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
8655
8686
  top: (isFitPadding ? 0 : 4) + padding.top,
8656
8687
  // for top tick text
8657
8688
  right: isNonAxis ? 0 : $$.getCurrentPaddingRight(!0),
8658
- bottom: xAxisHeight + subchartHeight + legendHeightForBottom + padding.bottom,
8689
+ bottom: gaugeHeight + xAxisHeight + subchartHeight + legendHeightForBottom + padding.bottom,
8659
8690
  left: isNonAxis ? 0 : padding.left
8660
8691
  };
8661
8692
  state.margin = $$.getResettedPadding(state.margin);
@@ -8845,6 +8876,22 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
8845
8876
  y: y
8846
8877
  };
8847
8878
  }
8879
+
8880
+ /**
8881
+ * Get data.labels.position value
8882
+ * @param {object} d Data object
8883
+ * @param {string} type x | y
8884
+ * @returns {number} Position value
8885
+ * @private
8886
+ */
8887
+ function getTextPos(d, type) {
8888
+ var _ref,
8889
+ position = this.config.data_labels_position,
8890
+ id = d.id,
8891
+ index = d.index,
8892
+ value = d.value;
8893
+ 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;
8894
+ }
8848
8895
  /* harmony default export */ var internals_text = ({
8849
8896
  opacityForText: function opacityForText(d) {
8850
8897
  var $$ = this;
@@ -8932,8 +8979,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
8932
8979
  if (isString(labelColors)) {
8933
8980
  color = labelColors;
8934
8981
  } else if (isObject(labelColors)) {
8935
- var _ref = d.data || d,
8936
- id = _ref.id;
8982
+ var _ref2 = d.data || d,
8983
+ id = _ref2.id;
8937
8984
  color = labelColors[id];
8938
8985
  } else if (isFunction(labelColors)) {
8939
8986
  color = labelColors.bind($$.api)(defaultColor, d);
@@ -9100,17 +9147,6 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
9100
9147
  }
9101
9148
  return 0;
9102
9149
  },
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
9150
  /**
9115
9151
  * Gets the x coordinate of the text
9116
9152
  * @param {object} points Data points position
@@ -9164,7 +9200,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
9164
9200
  if (isRotated || isTreemapType) {
9165
9201
  xPos += $$.getCenteredTextPos(d, points, textElement, "x");
9166
9202
  }
9167
- return xPos + $$.getTextPos(d.id, "x");
9203
+ return xPos + getTextPos.call(this, d, "x");
9168
9204
  },
9169
9205
  /**
9170
9206
  * Gets the y coordinate of the text
@@ -9238,7 +9274,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
9238
9274
  if (!isRotated || isTreemapType) {
9239
9275
  yPos += $$.getCenteredTextPos(d, points, textElement, "y");
9240
9276
  }
9241
- return yPos + $$.getTextPos(d.id, "y");
9277
+ return yPos + getTextPos.call(this, d, "y");
9242
9278
  },
9243
9279
  /**
9244
9280
  * Calculate if two or more text nodes are overlapping
@@ -9319,7 +9355,7 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
9319
9355
  * @returns {string|number} text-anchor value or position in pixel
9320
9356
  * @private
9321
9357
  */
9322
- function getTextPos(pos, width) {
9358
+ function title_getTextPos(pos, width) {
9323
9359
  if (pos === void 0) {
9324
9360
  pos = "left";
9325
9361
  }
@@ -9345,7 +9381,7 @@ function getTextPos(pos, width) {
9345
9381
  $el = $$.$el;
9346
9382
  if (config.title_text) {
9347
9383
  $el.title = $el.svg.append("g");
9348
- var text = $el.title.append("text").style("text-anchor", getTextPos(config.title_position)).attr("class", $TEXT.title);
9384
+ var text = $el.title.append("text").style("text-anchor", title_getTextPos(config.title_position)).attr("class", $TEXT.title);
9349
9385
  setTextValue(text, config.title_text, [.3, 1.5]);
9350
9386
  }
9351
9387
  },
@@ -9361,7 +9397,7 @@ function getTextPos(pos, width) {
9361
9397
  if (title) {
9362
9398
  var y = $$.yForTitle.call($$);
9363
9399
  if (/g/i.test(title.node().tagName)) {
9364
- title.attr("transform", "translate(" + getTextPos(config.title_position, current.width) + ", " + y + ")");
9400
+ title.attr("transform", "translate(" + title_getTextPos(config.title_position, current.width) + ", " + y + ")");
9365
9401
  } else {
9366
9402
  title.attr("x", $$.xForTitle.call($$)).attr("y", y);
9367
9403
  }
@@ -9669,6 +9705,7 @@ function getTextPos(pos, width) {
9669
9705
  event = _state.event,
9670
9706
  hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle,
9671
9707
  hasTreemap = state.hasTreemap,
9708
+ isRotated = config.axis_rotated,
9672
9709
  svgLeft = $$.getSvgLeft(!0),
9673
9710
  chartRight = svgLeft + current.width - $$.getCurrentPaddingRight(),
9674
9711
  chartLeft = $$.getCurrentPaddingLeft(!0),
@@ -9684,9 +9721,9 @@ function getTextPos(pos, width) {
9684
9721
  }
9685
9722
  } else if (!hasTreemap) {
9686
9723
  var dataScale = scale.x(dataToShow[0].x);
9687
- if (config.axis_rotated) {
9724
+ if (isRotated) {
9688
9725
  y = dataScale + 20;
9689
- x += svgLeft + 100;
9726
+ x += svgLeft;
9690
9727
  chartRight -= svgLeft;
9691
9728
  } else {
9692
9729
  y -= 5;
@@ -9696,7 +9733,7 @@ function getTextPos(pos, width) {
9696
9733
 
9697
9734
  // when tooltip left + tWidth > chart's width
9698
9735
  if (x + tWidth + 15 > chartRight) {
9699
- x -= tWidth + (hasTreemap ? 0 : chartLeft);
9736
+ x -= isRotated ? tWidth - chartLeft : tWidth + (hasTreemap ? 0 : chartLeft);
9700
9737
  }
9701
9738
  if (y + tHeight > current.height) {
9702
9739
  var gap = hasTreemap ? 0 : 30;
@@ -10632,6 +10669,7 @@ var ChartInternal = /*#__PURE__*/function () {
10632
10669
  // Define g for chart area
10633
10670
  main.append("g").classed($COMMON.chart, !0).attr("clip-path", hasAxis ? state.clip.path : null);
10634
10671
  $$.callPluginHook("$init");
10672
+ $$.initChartElements();
10635
10673
  if (hasAxis) {
10636
10674
  var _$$$axis;
10637
10675
  // Cover whole with rects for events
@@ -10643,7 +10681,6 @@ var ChartInternal = /*#__PURE__*/function () {
10643
10681
  // Add Axis here, when clipPath is 'true'
10644
10682
  config.clipPath && ((_$$$axis = $$.axis) == null ? void 0 : _$$$axis.init());
10645
10683
  }
10646
- $$.initChartElements();
10647
10684
 
10648
10685
  // Set targets
10649
10686
  $$.updateTargets($$.data.targets);
@@ -10688,7 +10725,11 @@ var ChartInternal = /*#__PURE__*/function () {
10688
10725
  hasTreemap = _$$$state.hasTreemap,
10689
10726
  types = [];
10690
10727
  if (hasAxis) {
10691
- ["bar", "bubble", "candlestick", "line"].forEach(function (v) {
10728
+ var shapes = ["bar", "bubble", "candlestick", "line"];
10729
+ if ($$.config.bar_front) {
10730
+ shapes.push(shapes.shift());
10731
+ }
10732
+ shapes.forEach(function (v) {
10692
10733
  _newArrowCheck(this, _this5);
10693
10734
  var name = capitalize(v);
10694
10735
  if (v === "line" && $$.hasTypeOf(name) || $$.hasType(v)) {
@@ -10732,6 +10773,7 @@ var ChartInternal = /*#__PURE__*/function () {
10732
10773
  legend = _$$$$el.legend,
10733
10774
  title = _$$$$el.title,
10734
10775
  grid = _$$$$el.grid,
10776
+ needle = _$$$$el.needle,
10735
10777
  arc = _$$$$el.arcs,
10736
10778
  circles = _$$$$el.circle,
10737
10779
  bars = _$$$$el.bar,
@@ -10739,6 +10781,7 @@ var ChartInternal = /*#__PURE__*/function () {
10739
10781
  lines = _$$$$el.line,
10740
10782
  areas = _$$$$el.area,
10741
10783
  texts = _$$$$el.text;
10784
+ // public
10742
10785
  $$.api.$ = {
10743
10786
  chart: chart,
10744
10787
  svg: svg,
@@ -10758,6 +10801,7 @@ var ChartInternal = /*#__PURE__*/function () {
10758
10801
  lines: lines,
10759
10802
  areas: areas
10760
10803
  },
10804
+ needle: needle,
10761
10805
  text: {
10762
10806
  texts: texts
10763
10807
  }
@@ -12486,6 +12530,10 @@ var tooltip_tooltip = {
12486
12530
  * @property {d3.selection} $.svg Main svg element
12487
12531
  * @property {d3.selection} $.defs Definition element
12488
12532
  * @property {d3.selection} $.main Main grouping element
12533
+ * @property {d3.selection} $.needle Needle element
12534
+ * - **NOTE:**
12535
+ * - The element will have `bb-needle` as class name.
12536
+ * - Will provide speical helper `.updateHelper(value: number, updateConfig: boolean)` method to facilitate needle position update.
12489
12537
  * @property {d3.selection} $.tooltip Tooltip element
12490
12538
  * @property {d3.selection} $.legend Legend element
12491
12539
  * @property {d3.selection} $.title Title element
@@ -12502,10 +12550,35 @@ var tooltip_tooltip = {
12502
12550
  * @property {d3.selection} $.text.texts Data label text elements
12503
12551
  * @memberof Chart
12504
12552
  * @example
12505
- * var chart = bb.generate({ ... });
12553
+ * const chart = bb.generate({ ... });
12506
12554
  *
12507
12555
  * chart.$.chart; // wrapper element
12508
12556
  * chart.$.line.circles; // all data point circle elements
12557
+ * @example
12558
+ * // Update arc needle position
12559
+ * const chart = bb.generate({
12560
+ * data: {
12561
+ * type: "donut"
12562
+ * },
12563
+ * arc: {
12564
+ * needle: {
12565
+ * show: true,
12566
+ * ...
12567
+ * }
12568
+ * }
12569
+ * });
12570
+ *
12571
+ * chart.$.needle.updateHelper(70); // update needle position to point value 70.
12572
+ *
12573
+ * // update needle position to point value 70 and the config value.
12574
+ * // NOTE: updating config value, will update needle pointer initial value too.
12575
+ * chart.$.needle.updateHelper(70, true);
12576
+ *
12577
+ * // update needle point position every 1 second
12578
+ * let i = 0;
12579
+ * setInterval(() => {
12580
+ * chart.$.needle.updateHelper(i += 10);
12581
+ * }, 1000)
12509
12582
  */
12510
12583
  /**
12511
12584
  * Plugin instance array
@@ -18603,7 +18676,7 @@ function getAttrTweenFn(fn) {
18603
18676
  }
18604
18677
  return len * Math.PI;
18605
18678
  },
18606
- getStartAngle: function getStartAngle() {
18679
+ getGaugeStartAngle: function getGaugeStartAngle() {
18607
18680
  var $$ = this,
18608
18681
  config = $$.config,
18609
18682
  isFullCircle = config.gauge_fullCircle,
@@ -18630,7 +18703,7 @@ function getAttrTweenFn(fn) {
18630
18703
  if (!config) {
18631
18704
  return null;
18632
18705
  }
18633
- var gStart = $$.getStartAngle(),
18706
+ var gStart = $$.getGaugeStartAngle(),
18634
18707
  radius = config.gauge_fullCircle ? $$.getArcLength() : gStart * -2;
18635
18708
  if (d.data && $$.isGaugeType(d.data) && !$$.hasMultiArcGauge()) {
18636
18709
  var min = config.gauge_min,
@@ -18640,8 +18713,9 @@ function getAttrTweenFn(fn) {
18640
18713
  pie = pie.startAngle(gStart).endAngle(radius * ((totalSum - min) / (max - min)) + gStart);
18641
18714
  }
18642
18715
  pie($$.filterTargetsToShow()).forEach(function (t, i) {
18716
+ var _d$data;
18643
18717
  _newArrowCheck(this, _this4);
18644
- if (!found && t.data.id === d.data.id) {
18718
+ if (!found && t.data.id === ((_d$data = d.data) == null ? void 0 : _d$data.id)) {
18645
18719
  found = !0;
18646
18720
  d = t;
18647
18721
  d.index = i;
@@ -18883,11 +18957,6 @@ function getAttrTweenFn(fn) {
18883
18957
  }.bind(this));
18884
18958
  return isFunction(format) ? format.bind($$.api) : format;
18885
18959
  },
18886
- getArcTitle: function getArcTitle() {
18887
- var $$ = this,
18888
- type = $$.hasType("donut") && "donut" || $$.hasType("gauge") && "gauge";
18889
- return type ? $$.config[type + "_title"] : "";
18890
- },
18891
18960
  updateTargetsForArc: function updateTargetsForArc(targets) {
18892
18961
  var _this11 = this,
18893
18962
  $$ = this,
@@ -18916,18 +18985,54 @@ function getAttrTweenFn(fn) {
18916
18985
  },
18917
18986
  /**
18918
18987
  * Set arc title text
18988
+ * @param {string} str Title text
18919
18989
  * @private
18920
18990
  */
18921
- setArcTitle: function setArcTitle() {
18991
+ setArcTitle: function setArcTitle(str) {
18922
18992
  var $$ = this,
18923
- title = $$.getArcTitle(),
18993
+ title = str || $$.getArcTitle(),
18924
18994
  hasGauge = $$.hasType("gauge");
18925
18995
  if (title) {
18926
- var text = $$.$el.arcs.append("text").attr("class", hasGauge ? $GAUGE.chartArcsGaugeTitle : $ARC.chartArcsTitle).style("text-anchor", "middle");
18996
+ var className = hasGauge ? $GAUGE.chartArcsGaugeTitle : $ARC.chartArcsTitle;
18997
+ var text = $$.$el.arcs.select("." + className);
18998
+ if (text.empty()) {
18999
+ text = $$.$el.arcs.append("text").attr("class", className).style("text-anchor", "middle");
19000
+ }
18927
19001
  hasGauge && text.attr("dy", "-0.3em");
18928
19002
  setTextValue(text, title, hasGauge ? undefined : [-.6, 1.35], !0);
18929
19003
  }
18930
19004
  },
19005
+ /**
19006
+ * Return arc title text
19007
+ * @returns {string} Arc title text
19008
+ * @private
19009
+ */
19010
+ getArcTitle: function getArcTitle() {
19011
+ var $$ = this,
19012
+ type = $$.hasType("donut") && "donut" || $$.hasType("gauge") && "gauge";
19013
+ return type ? $$.config[type + "_title"] : "";
19014
+ },
19015
+ /**
19016
+ * Get arc title text with needle value
19017
+ * @returns {string|boolean} When title contains needle template string will return processed string, otherwise false
19018
+ * @private
19019
+ */
19020
+ getArcTitleWithNeedleValue: function getArcTitleWithNeedleValue() {
19021
+ var $$ = this,
19022
+ config = $$.config,
19023
+ state = $$.state,
19024
+ title = $$.getArcTitle();
19025
+ if (title && $$.config.arc_needle_show && /{=[A-Z_]+}/.test(title)) {
19026
+ var value = state.current.needle;
19027
+ if (!isNumber(value)) {
19028
+ value = config.arc_needle_value;
19029
+ }
19030
+ return tplProcess(title, {
19031
+ NEEDLE_VALUE: isNumber(value) ? value : 0
19032
+ });
19033
+ }
19034
+ return !1;
19035
+ },
18931
19036
  redrawArc: function redrawArc(duration, durationForExit, withTransform) {
18932
19037
  var _this12 = this,
18933
19038
  $$ = this,
@@ -19014,28 +19119,122 @@ function getAttrTweenFn(fn) {
19014
19119
  hasInteraction && $$.bindArcEvent(mainArc);
19015
19120
  $$.hasType("polar") && $$.redrawPolar();
19016
19121
  $$.hasType("gauge") && $$.redrawBackgroundArcs();
19122
+ config.arc_needle_show && $$.redrawNeedle();
19017
19123
  $$.redrawArcText(duration);
19018
19124
  },
19019
- redrawBackgroundArcs: function redrawBackgroundArcs() {
19125
+ /**
19126
+ * Update needle element
19127
+ * @private
19128
+ */
19129
+ redrawNeedle: function redrawNeedle() {
19020
19130
  var _this14 = this,
19131
+ $$ = this,
19132
+ $el = $$.$el,
19133
+ config = $$.config,
19134
+ _$$$state2 = $$.state,
19135
+ hiddenTargetIds = _$$$state2.hiddenTargetIds,
19136
+ radius = _$$$state2.radius,
19137
+ length = (radius - 1) / 100 * config.arc_needle_length,
19138
+ hasDataToShow = hiddenTargetIds.length !== $$.data.targets.length,
19139
+ needle = $$.$el.arcs.select("." + $ARC.needle),
19140
+ pathFn = config.arc_needle_path,
19141
+ baseWidth = config.arc_needle_bottom_width / 2,
19142
+ topWidth = config.arc_needle_top_width / 2,
19143
+ topRx = config.arc_needle_top_rx,
19144
+ topRy = config.arc_needle_top_ry,
19145
+ bottomLen = config.arc_needle_bottom_len,
19146
+ bottomRx = config.arc_needle_bottom_rx,
19147
+ bottomRy = config.arc_needle_bottom_ry,
19148
+ needleAngle = $$.getNeedleAngle(),
19149
+ updateNeedleValue = function () {
19150
+ _newArrowCheck(this, _this14);
19151
+ var title = $$.getArcTitleWithNeedleValue();
19152
+ title && $$.setArcTitle(title);
19153
+ }.bind(this); // needle options
19154
+ updateNeedleValue();
19155
+ if (needle.empty()) {
19156
+ needle = $el.arcs.append("path").classed($ARC.needle, !0);
19157
+ $el.needle = needle;
19158
+
19159
+ /**
19160
+ * Function to be exposed as public to facilitate updating needle
19161
+ * @param {number} v Value to be updated
19162
+ * @param {boolean} updateConfig Weather update config's value
19163
+ * @private
19164
+ */
19165
+ $el.needle.updateHelper = function (v, updateConfig) {
19166
+ var _this15 = this;
19167
+ if (updateConfig === void 0) {
19168
+ updateConfig = !1;
19169
+ }
19170
+ _newArrowCheck(this, _this14);
19171
+ if ($el.needle.style("display") !== "none") {
19172
+ $$.$T($el.needle).style("transform", "rotate(" + $$.getNeedleAngle(v) + "deg)").call(endall, function () {
19173
+ _newArrowCheck(this, _this15);
19174
+ updateConfig && (config.arc_needle_value = v);
19175
+ updateNeedleValue();
19176
+ }.bind(this));
19177
+ }
19178
+ }.bind(this);
19179
+ }
19180
+ if (hasDataToShow) {
19181
+ 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";
19182
+ $$.$T(needle).attr("d", path).style("fill", config.arc_needle_color).style("display", null).style("transform", "rotate(" + needleAngle + "deg)");
19183
+ } else {
19184
+ needle.style("display", "none");
19185
+ }
19186
+ },
19187
+ /**
19188
+ * Get needle angle value relative given value
19189
+ * @param {number} v Value to be calculated angle
19190
+ * @returns {number} angle value
19191
+ * @private
19192
+ */
19193
+ getNeedleAngle: function getNeedleAngle(v) {
19194
+ var $$ = this,
19195
+ config = $$.config,
19196
+ state = $$.state,
19197
+ arcLength = $$.getArcLength(),
19198
+ hasGauge = $$.hasType("gauge"),
19199
+ total = $$.getTotalDataSum(!0);
19200
+ var value = isDefined(v) ? v : config.arc_needle_value,
19201
+ startingAngle = config[config.data_type + "_startingAngle"] || 0,
19202
+ radian = 0;
19203
+ if (!isNumber(value)) {
19204
+ value = hasGauge && $$.data.targets.length === 1 ? total : 0;
19205
+ }
19206
+ state.current.needle = value;
19207
+ if (hasGauge) {
19208
+ startingAngle = $$.getGaugeStartAngle();
19209
+ var _radius = config.gauge_fullCircle ? arcLength : startingAngle * -2,
19210
+ min = config.gauge_min,
19211
+ max = config.gauge_max;
19212
+ radian = _radius * ((value - min) / (max - min));
19213
+ } else {
19214
+ radian = arcLength * (value / total);
19215
+ }
19216
+ return (startingAngle + radian) * (180 / Math.PI);
19217
+ },
19218
+ redrawBackgroundArcs: function redrawBackgroundArcs() {
19219
+ var _this16 = this,
19021
19220
  $$ = this,
19022
19221
  config = $$.config,
19023
19222
  state = $$.state,
19024
19223
  hasMultiArcGauge = $$.hasMultiArcGauge(),
19025
19224
  isFullCircle = config.gauge_fullCircle,
19026
19225
  showEmptyTextLabel = $$.filterTargetsToShow($$.data.targets).length === 0 && !!config.data_empty_label_text,
19027
- startAngle = $$.getStartAngle(),
19226
+ startAngle = $$.getGaugeStartAngle(),
19028
19227
  endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1,
19029
19228
  backgroundArc = $$.$el.arcs.select((hasMultiArcGauge ? "g" : "") + "." + $ARC.chartArcsBackground);
19030
19229
  if (hasMultiArcGauge) {
19031
19230
  var index = 0;
19032
19231
  backgroundArc = backgroundArc.selectAll("path." + $ARC.chartArcsBackground).data($$.data.targets);
19033
19232
  backgroundArc.enter().append("path").attr("class", function (d, i) {
19034
- _newArrowCheck(this, _this14);
19233
+ _newArrowCheck(this, _this16);
19035
19234
  return $ARC.chartArcsBackground + " " + $ARC.chartArcsBackground + "-" + i;
19036
19235
  }.bind(this)).merge(backgroundArc).style("fill", config.gauge_background || null).attr("d", function (_ref2) {
19037
19236
  var id = _ref2.id;
19038
- _newArrowCheck(this, _this14);
19237
+ _newArrowCheck(this, _this16);
19039
19238
  if (showEmptyTextLabel || state.hiddenTargetIds.indexOf(id) >= 0) {
19040
19239
  return "M 0 0";
19041
19240
  }
@@ -19052,7 +19251,7 @@ function getAttrTweenFn(fn) {
19052
19251
  backgroundArc.exit().remove();
19053
19252
  } else {
19054
19253
  backgroundArc.attr("d", showEmptyTextLabel ? "M 0 0" : function () {
19055
- _newArrowCheck(this, _this14);
19254
+ _newArrowCheck(this, _this16);
19056
19255
  var d = {
19057
19256
  data: [{
19058
19257
  value: config.gauge_max
@@ -19065,7 +19264,7 @@ function getAttrTweenFn(fn) {
19065
19264
  }
19066
19265
  },
19067
19266
  bindArcEvent: function bindArcEvent(arc) {
19068
- var _this15 = this,
19267
+ var _this17 = this,
19069
19268
  $$ = this,
19070
19269
  config = $$.config,
19071
19270
  state = $$.state,
@@ -19113,7 +19312,7 @@ function getAttrTweenFn(fn) {
19113
19312
  selectArc(this, arcData, id);
19114
19313
  $$.setOverOut(!0, arcData);
19115
19314
  }).on("mouseout", function (event, d) {
19116
- _newArrowCheck(this, _this15);
19315
+ _newArrowCheck(this, _this17);
19117
19316
  if (state.transiting) {
19118
19317
  // skip while transiting
19119
19318
  return;
@@ -19134,7 +19333,7 @@ function getAttrTweenFn(fn) {
19134
19333
  // touch events
19135
19334
  if (isTouch && $$.hasArcType() && !$$.radars) {
19136
19335
  var getEventArc = function (event) {
19137
- _newArrowCheck(this, _this15);
19336
+ _newArrowCheck(this, _this17);
19138
19337
  var touch = event.changedTouches[0],
19139
19338
  eventArc = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(browser_doc.elementFromPoint(touch.clientX, touch.clientY));
19140
19339
  return eventArc;
@@ -19157,7 +19356,7 @@ function getAttrTweenFn(fn) {
19157
19356
  }
19158
19357
  },
19159
19358
  redrawArcText: function redrawArcText(duration) {
19160
- var _this16 = this,
19359
+ var _this18 = this,
19161
19360
  $$ = this,
19162
19361
  config = $$.config,
19163
19362
  state = $$.state,
@@ -19170,13 +19369,13 @@ function getAttrTweenFn(fn) {
19170
19369
  // for gauge type, update text when has no title & multi data
19171
19370
  if (!(hasGauge && $$.data.targets.length === 1 && config.gauge_title)) {
19172
19371
  text = main.selectAll("." + $ARC.chartArc).select("text").style("opacity", "0").attr("class", function (d) {
19173
- _newArrowCheck(this, _this16);
19372
+ _newArrowCheck(this, _this18);
19174
19373
  return $$.isGaugeType(d.data) ? $GAUGE.gaugeValue : null;
19175
19374
  }.bind(this)).call($$.textForArcLabel.bind($$)).attr("transform", $$.transformForArcLabel.bind($$)).style("font-size", function (d) {
19176
- _newArrowCheck(this, _this16);
19375
+ _newArrowCheck(this, _this18);
19177
19376
  return $$.isGaugeType(d.data) && $$.data.targets.length === 1 && !hasMultiArcGauge ? Math.round(state.radius / 5) + "px" : null;
19178
19377
  }.bind(this)).transition().duration(duration).style("opacity", function (d) {
19179
- _newArrowCheck(this, _this16);
19378
+ _newArrowCheck(this, _this18);
19180
19379
  return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? null : "0";
19181
19380
  }.bind(this));
19182
19381
  hasMultiArcGauge && text.attr("dy", "-.1em");
@@ -19370,9 +19569,9 @@ function getAttrTweenFn(fn) {
19370
19569
  var $el = this.$el,
19371
19570
  config = this.config,
19372
19571
  clip = this.state.clip;
19373
- $el.bar = $el.main.select("." + $COMMON.chart)
19374
- // should positioned at the beginning of the shape node to not overlap others
19375
- .insert("g", ":first-child").attr("class", $BAR.chartBars).call(this.setCssRule(!1, "." + $BAR.chartBars, ["pointer-events:none"]));
19572
+ $el.bar = $el.main.select("." + $COMMON.chart);
19573
+ $el.bar = config.bar_front ? $el.bar.append("g") : $el.bar.insert("g", ":first-child");
19574
+ $el.bar.attr("class", $BAR.chartBars).call(this.setCssRule(!1, "." + $BAR.chartBars, ["pointer-events:none"]));
19376
19575
 
19377
19576
  // set clip-path attribute when condition meet
19378
19577
  // https://github.com/naver/billboard.js/issues/2421
@@ -19971,7 +20170,6 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
19971
20170
  if ($$.hasType("bubble")) {
19972
20171
  config.point_show = !0;
19973
20172
  config.point_type = "circle";
19974
- config.point_sensitivity = 25;
19975
20173
  }
19976
20174
  },
19977
20175
  /**
@@ -20596,6 +20794,7 @@ var getTransitionName = function () {
20596
20794
  } else if (isFunction(pointR)) {
20597
20795
  r = pointR.bind($$.api)(d);
20598
20796
  }
20797
+ d.r = r;
20599
20798
  return r;
20600
20799
  },
20601
20800
  pointExpandedR: function pointExpandedR(d) {
@@ -21585,6 +21784,7 @@ function convertDataToTreemapData(data) {
21585
21784
  * Copyright (c) 2017 ~ present NAVER Corp.
21586
21785
  * billboard.js project is licensed under the MIT license
21587
21786
  */
21787
+
21588
21788
  /**
21589
21789
  * point config options
21590
21790
  */
@@ -21606,7 +21806,20 @@ function convertDataToTreemapData(data) {
21606
21806
  * - **NOTE:**
21607
21807
  * - `null` will make to not set inline 'opacity' css prop.
21608
21808
  * - when no value(or undefined) is set, it defaults to set opacity value according its chart types.
21609
- * @property {number} [point.sensitivity=10] The senstivity value for interaction boundary.
21809
+ * @property {number|string|Function} [point.sensitivity=10] The senstivity value for interaction boundary.
21810
+ * - **Available Values:**
21811
+ * - {number}: Absolute sensitivity value which is the distance from the data point in pixel.
21812
+ * - "radius": sensitivity based on point's radius
21813
+ * - Function: callback for each point to determine the sensitivity<br>
21814
+ * ```js
21815
+ * sensitivity: function(d) {
21816
+ * // ex. of argument d:
21817
+ * // ==> {x: 2, value: 55, id: 'data3', index: 2, r: 19.820624179302296}
21818
+ *
21819
+ * // returning d.r, will make sensitivity same as point's radius value.
21820
+ * return d.r;
21821
+ * }
21822
+ * ```
21610
21823
  * @property {number} [point.select.r=point.r*4] The radius size of each point on selected.
21611
21824
  * @property {string} [point.type="circle"] The type of point to be drawn
21612
21825
  * - **NOTE:**
@@ -21627,6 +21840,7 @@ function convertDataToTreemapData(data) {
21627
21840
  * (ex. `<polygon points='2.5 0 0 5 5 5'></polygon>`)
21628
21841
  * @see [Demo: point type](https://naver.github.io/billboard.js/demo/#Point.RectanglePoints)
21629
21842
  * @see [Demo: point focus only](https://naver.github.io/billboard.js/demo/#Point.FocusOnly)
21843
+ * @see [Demo: point sensitivity](https://naver.github.io/billboard.js/demo/#Point.PointSensitivity)
21630
21844
  * @example
21631
21845
  * point: {
21632
21846
  * show: false,
@@ -21659,6 +21873,18 @@ function convertDataToTreemapData(data) {
21659
21873
  * // having lower value, means how closer to be for interaction
21660
21874
  * sensitivity: 3,
21661
21875
  *
21876
+ * // sensitivity based on point's radius
21877
+ * sensitivity: "radius",
21878
+ *
21879
+ * // callback for each point to determine the sensitivity
21880
+ * sensitivity: function(d) {
21881
+ * // ex. of argument d:
21882
+ * // ==> {x: 2, value: 55, id: 'data3', index: 2, r: 19.820624179302296}
21883
+ *
21884
+ * // returning d.r, will make sensitivity same as point's radius value.
21885
+ * return d.r;
21886
+ * }
21887
+ *
21662
21888
  * // valid values are "circle" or "rectangle"
21663
21889
  * type: "rectangle",
21664
21890
  *
@@ -21766,6 +21992,7 @@ function convertDataToTreemapData(data) {
21766
21992
  * @memberof Options
21767
21993
  * @type {object}
21768
21994
  * @property {object} bar Bar object
21995
+ * @property {boolean} [bar.front=false] Set 'bar' to be positioned over(on the top) other shapes elements.
21769
21996
  * @property {number} [bar.indices.removeNull=false] Remove nullish data on bar indices positions.
21770
21997
  * @property {number} [bar.label.threshold=0] Set threshold ratio to show/hide labels.
21771
21998
  * @property {boolean|object} [bar.linearGradient=false] Set the linear gradient on bar.<br><br>
@@ -21788,6 +22015,7 @@ function convertDataToTreemapData(data) {
21788
22015
  * @property {number} [bar.width.dataname.ratio=0.6] Change the width of bar chart by ratio.
21789
22016
  * @property {number} [bar.width.dataname.max] The maximum width value for ratio.
21790
22017
  * @property {boolean} [bar.zerobased=true] Set if min or max value will be 0 on bar chart.
22018
+ * @see [Demo: bar front](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarFront)
21791
22019
  * @see [Demo: bar indices](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarIndices)
21792
22020
  * @see [Demo: bar overlap](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarOverlap)
21793
22021
  * @see [Demo: bar padding](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarPadding)
@@ -21796,6 +22024,9 @@ function convertDataToTreemapData(data) {
21796
22024
  * @see [Demo: bar width variant](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarWidthVariant)
21797
22025
  * @example
21798
22026
  * bar: {
22027
+ * // make bar shape to be positioned over the other shape elements
22028
+ * front: true,
22029
+ *
21799
22030
  * // remove nullish data on bar indices postions
21800
22031
  * indices: {
21801
22032
  * removeNull: true
@@ -21866,9 +22097,10 @@ function convertDataToTreemapData(data) {
21866
22097
  * zerobased: false
21867
22098
  * }
21868
22099
  */
22100
+ bar_front: !1,
22101
+ bar_indices_removeNull: !1,
21869
22102
  bar_label_threshold: 0,
21870
22103
  bar_linearGradient: !1,
21871
- bar_indices_removeNull: !1,
21872
22104
  bar_overlap: !1,
21873
22105
  bar_padding: 0,
21874
22106
  bar_radius: undefined,
@@ -22134,9 +22366,31 @@ function convertDataToTreemapData(data) {
22134
22366
  * - **NOTE:**
22135
22367
  * - Corner radius can't surpass the `(outerRadius - innerRadius) /2` of indicated shape.
22136
22368
  * @property {number} [arc.cornerRadius.ratio=0] Set ratio relative of outer radius.
22369
+ * @property {object} [arc.needle] Set needle options.
22370
+ * @property {boolean} [arc.needle.show=false] Show or hide needle.
22371
+ * @property {string} [arc.needle.color] Set needle filled color.
22372
+ * @property {Function} [arc.needle.path] Set custom needle path function.
22373
+ * - **NOTE:**
22374
+ * - The path should be starting from 0,0 (which is center) to top center coordinate.
22375
+ * - The function will receive, `length`{number} parameter which indicating the needle length in pixel relative to radius.
22376
+ * @property {number} [arc.needle.value] Set needle value.
22377
+ * - **NOTE:**
22378
+ * - For single gauge chart, needle will point the data value by default, otherwise will point 0(zero).
22379
+ * @property {number} [arc.needle.length=100] Set needle length in percentages relative to radius.
22380
+ * @property {object} [arc.needle.top] Set needle top options.
22381
+ * @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).
22382
+ * @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).
22383
+ * @property {number} [arc.needle.top.width=0] Set needle top width in pixel.
22384
+ * @property {object} [arc.needle.bottom] Set needle bottom options.
22385
+ * @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).
22386
+ * @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).
22387
+ * @property {number} [arc.needle.bottom.width=15] Set needle bottom width in pixel.
22388
+ * @property {number} [arc.needle.bottom.len=0] Set needle bottom length in pixel. Setting this value, will make bottom larger starting from center.
22137
22389
  * @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutCornerRadius)
22138
22390
  * @see [Demo: Gauge corner radius](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeCornerRadius)
22139
22391
  * @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#PieChartOptions.CornerRadius)
22392
+ * @see [Demo: Donut needle](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutNeedle)
22393
+ * @see [Demo: Gauge needle](https://naver.github.io/billboard.js/demo/##GaugeChartOptions.GaugeNeedle)
22140
22394
  * @example
22141
22395
  * arc: {
22142
22396
  * cornerRadius: 12,
@@ -22155,11 +22409,61 @@ function convertDataToTreemapData(data) {
22155
22409
  * // set ratio relative of outer radius
22156
22410
  * cornerRadius: {
22157
22411
  * ratio: 0.5
22412
+ * },
22413
+ *
22414
+ * needle: {
22415
+ * show: true,
22416
+ * color: "red", // any valid CSS color
22417
+ * path: function(length) {
22418
+ * const len = length - 20;
22419
+ *
22420
+ * // will return upper arrow shape path
22421
+ * // Note: The path should begun from '0,0' coordinate to top center.
22422
+ * const path = `M 0 -${len + 20}
22423
+ * L -12 -${len}
22424
+ * L -5 -${len}
22425
+ * L -5 0
22426
+ * A 1 1 0 0 0 5 0
22427
+ * L 5 -${len}
22428
+ * L 12 -${len} Z`;
22429
+ *
22430
+ * return path;
22431
+ * },
22432
+ * value: 40, // will make needle to point value 40.
22433
+ * length: 80, // needle length in percentages relative to radius.
22434
+ *
22435
+ * top: {
22436
+ * // rx and ry are the two radii of the ellipse;
22437
+ * // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve
22438
+ * rx: 1,
22439
+ * ry: 1,
22440
+ * width: 5
22441
+ * },
22442
+ * bottom: {
22443
+ * // rx and ry are the two radii of the ellipse;
22444
+ * // https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve
22445
+ * rx: 1,
22446
+ * ry: 1,
22447
+ * width: 10
22448
+ * len: 10
22449
+ * }
22158
22450
  * }
22159
22451
  * }
22160
22452
  */
22161
22453
  arc_cornerRadius: 0,
22162
- arc_cornerRadius_ratio: 0
22454
+ arc_cornerRadius_ratio: 0,
22455
+ arc_needle_show: !1,
22456
+ arc_needle_color: undefined,
22457
+ arc_needle_value: undefined,
22458
+ arc_needle_path: undefined,
22459
+ arc_needle_length: 100,
22460
+ arc_needle_top_rx: 0,
22461
+ arc_needle_top_ry: 0,
22462
+ arc_needle_top_width: 0,
22463
+ arc_needle_bottom_rx: 1,
22464
+ arc_needle_bottom_ry: 1,
22465
+ arc_needle_bottom_width: 15,
22466
+ arc_needle_bottom_len: 0
22163
22467
  });
22164
22468
  ;// CONCATENATED MODULE: ./src/config/Options/shape/donut.ts
22165
22469
  /**
@@ -22185,6 +22489,8 @@ function convertDataToTreemapData(data) {
22185
22489
  * @property {number} [donut.expand.duration=50] Set expand transition time in ms.
22186
22490
  * @property {number} [donut.width] Set width of donut chart.
22187
22491
  * @property {string} [donut.title=""] Set title of donut chart. Use `\n` character for line break.
22492
+ * - **NOTE:**
22493
+ * - When `arc.needle.show=true` is set, special template `{=NEEDLE_VALUE}` can be used inside the title text to show current needle value.
22188
22494
  * @property {number} [donut.padAngle=0] Set padding between data.
22189
22495
  * @property {number} [donut.startingAngle=0] Set starting angle where data draws.
22190
22496
  * @example
@@ -22227,6 +22533,9 @@ function convertDataToTreemapData(data) {
22227
22533
  * startingAngle: 1,
22228
22534
  * title: "Donut Title"
22229
22535
  *
22536
+ * // when 'arc.needle.show=true' is set, can show current needle value.
22537
+ * title: "Needle value:\n{=NEEDLE_VALUE}",
22538
+ *
22230
22539
  * // title with line break
22231
22540
  * title: "Title1\nTitle2"
22232
22541
  * }
@@ -22292,6 +22601,8 @@ function convertDataToTreemapData(data) {
22292
22601
  * - 'arcLength < -100' defaults to -100
22293
22602
  * - 'arcLength > 100' defaults to 100
22294
22603
  * @property {string} [gauge.title=""] Set title of gauge chart. Use `\n` character for line break.
22604
+ * - **NOTE:**
22605
+ * - When `arc.needle.show=true` is set, special template `{=NEEDLE_VALUE}` can be used inside the title text to show current needle value.
22295
22606
  * @property {string} [gauge.units] Set units of the gauge.
22296
22607
  * @property {number} [gauge.width] Set width of gauge chart.
22297
22608
  * @property {string} [gauge.type="single"] Set type of gauge to be displayed.<br><br>
@@ -22338,6 +22649,10 @@ function convertDataToTreemapData(data) {
22338
22649
  * max: 200,
22339
22650
  * type: "single" // or 'multi'
22340
22651
  * title: "Title Text",
22652
+ *
22653
+ * // when 'arc.needle.show=true' is set, can show current needle value.
22654
+ * title: "Needle value:\n{=NEEDLE_VALUE}",
22655
+ *
22341
22656
  * units: "%",
22342
22657
  * width: 10,
22343
22658
  * startingAngle: -1 * Math.PI / 2,
@@ -24728,7 +25043,7 @@ var _defaults = {};
24728
25043
 
24729
25044
  /**
24730
25045
  * @namespace bb
24731
- * @version 3.8.2
25046
+ * @version 3.9.0-next.2
24732
25047
  */
24733
25048
  var bb = {
24734
25049
  /**
@@ -24738,7 +25053,7 @@ var bb = {
24738
25053
  * bb.version; // "1.0.0"
24739
25054
  * @memberof bb
24740
25055
  */
24741
- version: "3.8.2",
25056
+ version: "3.9.0-next.2",
24742
25057
  /**
24743
25058
  * Generate chart
24744
25059
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when: