billboard.js 3.17.4 → 3.18.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.
Files changed (133) hide show
  1. package/CONTRIBUTING.md +12 -12
  2. package/README.md +12 -12
  3. package/dist/billboard.css +15 -1
  4. package/dist/billboard.js +756 -305
  5. package/dist/billboard.min.css +2 -2
  6. package/dist/billboard.min.js +10 -10
  7. package/dist/billboard.pkgd.js +757 -306
  8. package/dist/billboard.pkgd.min.js +22 -22
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-sparkline.js +3 -2
  12. package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
  13. package/dist/plugin/billboardjs-plugin-stanford.js +5 -4
  14. package/dist/plugin/billboardjs-plugin-stanford.min.js +3 -3
  15. package/dist/plugin/billboardjs-plugin-tableview.js +3 -3
  16. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  17. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
  18. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  19. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +3 -2
  22. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +6 -5
  24. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +3 -3
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +3 -3
  26. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2 -2
  28. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
  29. package/dist/theme/dark.css +15 -1
  30. package/dist/theme/dark.min.css +2 -2
  31. package/dist/theme/datalab.css +15 -1
  32. package/dist/theme/datalab.min.css +2 -2
  33. package/dist/theme/graph.css +15 -1
  34. package/dist/theme/graph.min.css +2 -2
  35. package/dist/theme/insight.css +15 -1
  36. package/dist/theme/insight.min.css +2 -2
  37. package/dist/theme/modern.css +15 -1
  38. package/dist/theme/modern.min.css +2 -2
  39. package/dist-esm/billboard.js +938 -348
  40. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  41. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -2
  42. package/dist-esm/plugin/billboardjs-plugin-stanford.js +5 -4
  43. package/dist-esm/plugin/billboardjs-plugin-tableview.js +3 -3
  44. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  45. package/package.json +35 -34
  46. package/src/Chart/Chart.ts +1 -1
  47. package/src/Chart/api/chart.ts +5 -5
  48. package/src/Chart/api/data.ts +2 -1
  49. package/src/Chart/api/export.ts +1 -1
  50. package/src/Chart/api/flow.ts +1 -1
  51. package/src/Chart/api/load.ts +3 -3
  52. package/src/Chart/api/subchart.ts +3 -3
  53. package/src/Chart/api/tooltip.ts +1 -1
  54. package/src/Chart/api/zoom.ts +1 -1
  55. package/src/ChartInternal/Axis/Axis.ts +1 -1
  56. package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -1
  57. package/src/ChartInternal/ChartInternal.ts +3 -2
  58. package/src/ChartInternal/data/IData.ts +3 -0
  59. package/src/ChartInternal/data/convert.helper.ts +1 -1
  60. package/src/ChartInternal/data/convert.ts +1 -1
  61. package/src/ChartInternal/data/data.ts +97 -14
  62. package/src/ChartInternal/data/load.ts +8 -8
  63. package/src/ChartInternal/interactions/eventrect.ts +15 -5
  64. package/src/ChartInternal/interactions/flow.ts +1 -1
  65. package/src/ChartInternal/interactions/interaction.ts +1 -1
  66. package/src/ChartInternal/interactions/zoom.ts +1 -1
  67. package/src/ChartInternal/internals/color.ts +23 -6
  68. package/src/ChartInternal/internals/domain.ts +13 -1
  69. package/src/ChartInternal/internals/format.ts +1 -1
  70. package/src/ChartInternal/internals/grid.ts +1 -1
  71. package/src/ChartInternal/internals/legend.ts +2 -2
  72. package/src/ChartInternal/internals/scale.ts +6 -6
  73. package/src/ChartInternal/internals/selection.ts +1 -1
  74. package/src/ChartInternal/internals/style.ts +3 -3
  75. package/src/ChartInternal/internals/text.arc.ts +304 -0
  76. package/src/ChartInternal/internals/text.ts +8 -7
  77. package/src/ChartInternal/internals/tooltip.ts +23 -15
  78. package/src/ChartInternal/shape/arc.ts +167 -64
  79. package/src/ChartInternal/shape/area.ts +2 -2
  80. package/src/ChartInternal/shape/bar.ts +2 -2
  81. package/src/ChartInternal/shape/candlestick.ts +3 -3
  82. package/src/ChartInternal/shape/funnel.ts +1 -1
  83. package/src/ChartInternal/shape/line.ts +4 -4
  84. package/src/ChartInternal/shape/point.common.ts +1 -1
  85. package/src/ChartInternal/shape/radar.ts +2 -2
  86. package/src/ChartInternal/shape/shape.ts +3 -3
  87. package/src/ChartInternal/shape/treemap.ts +19 -5
  88. package/src/Plugin/stanford/Options.ts +2 -2
  89. package/src/Plugin/tableview/Options.ts +1 -1
  90. package/src/config/Options/axis/axis.ts +7 -7
  91. package/src/config/Options/axis/x.ts +6 -6
  92. package/src/config/Options/axis/y.ts +4 -4
  93. package/src/config/Options/axis/y2.ts +16 -3
  94. package/src/config/Options/common/color.ts +2 -2
  95. package/src/config/Options/common/legend.ts +5 -5
  96. package/src/config/Options/common/main.ts +23 -23
  97. package/src/config/Options/common/point.ts +3 -3
  98. package/src/config/Options/common/tooltip.ts +13 -13
  99. package/src/config/Options/data/axis.ts +31 -6
  100. package/src/config/Options/data/data.ts +44 -44
  101. package/src/config/Options/data/selection.ts +4 -4
  102. package/src/config/Options/interaction/interaction.ts +2 -1
  103. package/src/config/Options/interaction/subchart.ts +2 -2
  104. package/src/config/Options/interaction/zoom.ts +4 -4
  105. package/src/config/Options/shape/arc.ts +4 -4
  106. package/src/config/Options/shape/area.ts +1 -1
  107. package/src/config/Options/shape/bar.ts +4 -4
  108. package/src/config/Options/shape/bubble.ts +2 -2
  109. package/src/config/Options/shape/candlestick.ts +1 -1
  110. package/src/config/Options/shape/donut.ts +34 -3
  111. package/src/config/Options/shape/gauge.ts +36 -4
  112. package/src/config/Options/shape/line.ts +1 -1
  113. package/src/config/Options/shape/pie.ts +34 -3
  114. package/src/config/Options/shape/polar.ts +35 -4
  115. package/src/config/Options/shape/radar.ts +1 -1
  116. package/src/config/Options/shape/scatter.ts +1 -1
  117. package/src/config/Options/shape/treemap.ts +31 -5
  118. package/src/config/classes.ts +1 -0
  119. package/src/core.ts +1 -1
  120. package/src/module/Cache.ts +3 -3
  121. package/src/module/generator.ts +1 -1
  122. package/src/module/util.ts +9 -9
  123. package/src/module/worker.ts +3 -3
  124. package/src/scss/billboard.scss +15 -0
  125. package/src/scss/theme/dark.scss +15 -0
  126. package/src/scss/theme/datalab.scss +15 -0
  127. package/src/scss/theme/graph.scss +15 -0
  128. package/src/scss/theme/insight.scss +15 -0
  129. package/src/scss/theme/modern.scss +15 -0
  130. package/types/axis.d.ts +3 -3
  131. package/types/chart.d.ts +4 -4
  132. package/types/options.d.ts +22 -9
  133. package/types/options.shape.d.ts +59 -2
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.17.4
8
+ * @version 3.18.0-next.1
9
9
  *
10
10
  * All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
11
11
  * - @types/d3-selection ^3.0.11
@@ -24328,6 +24328,7 @@ const $COMMON = {
24328
24328
  const $ARC = {
24329
24329
  arc: "bb-arc",
24330
24330
  arcLabelLine: "bb-arc-label-line",
24331
+ arcLabelLineText: "bb-arc-label-line-text",
24331
24332
  arcRange: "bb-arc-range",
24332
24333
  arcs: "bb-arcs",
24333
24334
  chartArc: "bb-chart-arc",
@@ -24521,9 +24522,9 @@ const $ZOOM = {
24521
24522
  * @memberof Options
24522
24523
  * @type {object}
24523
24524
  * @property {object} color color object
24524
- * @property {string|object|Function} [color.onover] Set the color value for each data point when mouse/touch onover event occurs.
24525
+ * @property {string|object|((this: Chart, d: DataItem) => string)} [color.onover] Set the color value for each data point when mouse/touch onover event occurs.
24525
24526
  * @property {Array|null} [color.pattern=[]] Set custom color pattern. Passing `null` will not set a color for these elements, which requires the usage of custom CSS-based theming to work.
24526
- * @property {Function} [color.tiles] if defined, allows use svg's patterns to fill data area. It should return an array of [SVGPatternElement](https://developer.mozilla.org/en-US/docs/Web/API/SVGPatternElement).
24527
+ * @property {(this: Chart) => SVGPathElement[]} [color.tiles] if defined, allows use svg's patterns to fill data area. It should return an array of [SVGPatternElement](https://developer.mozilla.org/en-US/docs/Web/API/SVGPatternElement).
24527
24528
  * - **NOTE:** The pattern element's id will be defined as `bb-colorize-pattern-$COLOR-VALUE`.<br>
24528
24529
  * ex. When color pattern value is `['red', '#fff']` and defined 2 patterns,then ids for pattern elements are:<br>
24529
24530
  * - `bb-colorize-pattern-red`
@@ -24608,7 +24609,7 @@ const $ZOOM = {
24608
24609
  * If true given, all legend will be hidden. If string or array given, only the legend that has the id will be hidden.
24609
24610
  * @property {string|HTMLElement} [legend.contents.bindto=undefined] Set CSS selector or element reference to bind legend items.
24610
24611
  * - **NOTE:** Should be used along with `legend.contents.template`.
24611
- * @property {string|Function} [legend.contents.template="<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>"] Set item's template.<br>
24612
+ * @property {string|function} [legend.contents.template="<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>"] Set item's template.<br>
24612
24613
  * - If set `string` value, within template the 'color' and 'title' can be replaced using template-like syntax string:
24613
24614
  * - {=COLOR}: data color value
24614
24615
  * - {=TITLE}: data title value
@@ -24642,13 +24643,13 @@ const $ZOOM = {
24642
24643
  * - To return initial state(which all dataseries are showing), double click current focused legend item again.
24643
24644
  * - for single click case, `click + altKey(Win)/optionKey(Mac OS)` to have same effect.
24644
24645
  * - In this case, default `click` interaction will be disabled.
24645
- * @property {Function} [legend.item.onclick=undefined] Set click event handler to the legend item.
24646
+ * @property {function} [legend.item.onclick=undefined] Set click event handler to the legend item.
24646
24647
  * - **NOTE:**
24647
24648
  * - When set, default `click` interaction will be disabled.
24648
24649
  * - When `interaction.dblclick=true` is set, will be called on double click.
24649
- * @property {Function} [legend.item.onover=undefined] Set mouse/touch over event handler to the legend item.
24650
+ * @property {function} [legend.item.onover=undefined] Set mouse/touch over event handler to the legend item.
24650
24651
  * - **NOTE:** When set, default `mouseover` interaction will be disabled.
24651
- * @property {Function} [legend.item.onout=undefined] Set mouse/touch out event handler to the legend item.
24652
+ * @property {function} [legend.item.onout=undefined] Set mouse/touch out event handler to the legend item.
24652
24653
  * - **NOTE:** When set, default `mouseout` interaction will be disabled.
24653
24654
  * @property {number} [legend.item.tile.width=10] Set width for 'rectangle' legend item tile element.
24654
24655
  * @property {number} [legend.item.tile.height=10] Set height for 'rectangle' legend item tile element.
@@ -24725,7 +24726,7 @@ const $ZOOM = {
24725
24726
  * width: 15,
24726
24727
  * height: 15
24727
24728
  *
24728
- * // radis is only applicable for 'circle' legend type
24729
+ * // radius is only applicable for 'circle' legend type
24729
24730
  * r: 10
24730
24731
  * }
24731
24732
  * },
@@ -24771,14 +24772,14 @@ const $ZOOM = {
24771
24772
  /* harmony default export */ var main = ({
24772
24773
  /**
24773
24774
  * Specify the CSS selector or the element which the chart will be set to. D3 selection object can be specified also.<br>
24774
- * If other chart is set already, it will be replaced with the new one (only one chart can be set in one element).
24775
- * - **NOTE:** In case of element doesn't exist or not specified, will add a `<div>` element to the body.
24775
+ * If another chart is already set, it will be replaced with the new one (only one chart can be set in one element).
24776
+ * - **NOTE:** In case the element doesn't exist or not specified, will add a `<div>` element to the body.
24776
24777
  * @name bindto
24777
24778
  * @memberof Options
24778
24779
  * @property {string|HTMLElement|d3.selection|object} [bindto="#chart"] Specify the element where chart will be drawn.
24779
24780
  * @property {string|HTMLElement|d3.selection} bindto.element="#chart" Specify the element where chart will be drawn.
24780
24781
  * @property {string} [bindto.classname=bb] Specify the class name of bind element.<br>
24781
- * **NOTE:** When class name isn't `bb`, then you also need to update the default CSS to be rendered correctly.
24782
+ * **NOTE:** When the class name isn't `bb`, then you also need to update the default CSS to be rendered correctly.
24782
24783
  * @default #chart
24783
24784
  * @example
24784
24785
  * bindto: "#myContainer"
@@ -24819,8 +24820,8 @@ const $ZOOM = {
24819
24820
  /**
24820
24821
  * Set 'clip-path' attribute for chart element
24821
24822
  * - **NOTE:**
24822
- * > When is false, chart node element is positioned after the axis node in DOM tree hierarchy.
24823
- * > Is to make chart element positioned over axis element.
24823
+ * > When false, chart node element is positioned after the axis node in DOM tree hierarchy.
24824
+ * > This is to make the chart element positioned over axis element.
24824
24825
  * @name clipPath
24825
24826
  * @memberof Options
24826
24827
  * @type {boolean}
@@ -24846,7 +24847,7 @@ const $ZOOM = {
24846
24847
  svg_classname: void 0,
24847
24848
  /**
24848
24849
  * The desired size of the chart element.
24849
- * If value is not specified, the width of the chart will be calculated by the size of the parent element it's appended to.
24850
+ * If the value is not specified, the width of the chart will be calculated by the size of the parent element it's appended to.
24850
24851
  * @name size
24851
24852
  * @memberof Options
24852
24853
  * @type {object}
@@ -24864,13 +24865,13 @@ const $ZOOM = {
24864
24865
  size_height: void 0,
24865
24866
  /**
24866
24867
  * The padding of the chart element.
24867
- * - **NOTE:** for more information, see the "[`Understanding padding`](https://github.com/naver/billboard.js/wiki/Understanding-padding)"" wiki documentaion.
24868
+ * - **NOTE:** for more information, see the "[`Understanding padding`](https://github.com/naver/billboard.js/wiki/Understanding-padding)" wiki documentation.
24868
24869
  * @name padding
24869
24870
  * @memberof Options
24870
24871
  * @type {object}
24871
24872
  * @property {object|boolean} [padding=true] Set padding of chart, and accepts object or boolean type.
24872
24873
  * - `Object`: Specify each side's padding.
24873
- * - `false`: Remove padding completely and make shape to fully occupy the container element.
24874
+ * - `false`: Remove padding completely and make the shape fully occupy the container element.
24874
24875
  * - In this case, axes and subchart will be hidden.
24875
24876
  * - To adjust some padding from this state, use `axis.[x|y].padding` option.
24876
24877
  * @property {string} [padding.mode] padding mode
@@ -24957,7 +24958,7 @@ const $ZOOM = {
24957
24958
  * Set a callback to execute when the chart is clicked.
24958
24959
  * @name onclick
24959
24960
  * @memberof Options
24960
- * @type {Function}
24961
+ * @type {function}
24961
24962
  * @default undefined
24962
24963
  * @example
24963
24964
  * onclick: function(event) {
@@ -24971,7 +24972,7 @@ const $ZOOM = {
24971
24972
  * Set a callback to execute when mouse/touch enters the chart.
24972
24973
  * @name onover
24973
24974
  * @memberof Options
24974
- * @type {Function}
24975
+ * @type {function}
24975
24976
  * @default undefined
24976
24977
  * @example
24977
24978
  * onover: function(event) {
@@ -24985,7 +24986,7 @@ const $ZOOM = {
24985
24986
  * Set a callback to execute when mouse/touch leaves the chart.
24986
24987
  * @name onout
24987
24988
  * @memberof Options
24988
- * @type {Function}
24989
+ * @type {function}
24989
24990
  * @default undefined
24990
24991
  * @example
24991
24992
  * onout: function(event) {
@@ -24999,7 +25000,7 @@ const $ZOOM = {
24999
25000
  * Set a callback to execute when user resizes the screen.
25000
25001
  * @name onresize
25001
25002
  * @memberof Options
25002
- * @type {Function}
25003
+ * @type {function}
25003
25004
  * @default undefined
25004
25005
  * @example
25005
25006
  * onresize: function() {
@@ -25012,7 +25013,7 @@ const $ZOOM = {
25012
25013
  * Set a callback to execute when screen resize finished.
25013
25014
  * @name onresized
25014
25015
  * @memberof Options
25015
- * @type {Function}
25016
+ * @type {function}
25016
25017
  * @default undefined
25017
25018
  * @example
25018
25019
  * onresized: function() {
@@ -25025,7 +25026,7 @@ const $ZOOM = {
25025
25026
  * Set a callback to execute before the chart is initialized
25026
25027
  * @name onbeforeinit
25027
25028
  * @memberof Options
25028
- * @type {Function}
25029
+ * @type {function}
25029
25030
  * @default undefined
25030
25031
  * @example
25031
25032
  * onbeforeinit: function() {
@@ -25038,7 +25039,7 @@ const $ZOOM = {
25038
25039
  * Set a callback to execute when the chart is initialized.
25039
25040
  * @name oninit
25040
25041
  * @memberof Options
25041
- * @type {Function}
25042
+ * @type {function}
25042
25043
  * @default undefined
25043
25044
  * @example
25044
25045
  * oninit: function() {
@@ -25051,7 +25052,7 @@ const $ZOOM = {
25051
25052
  * Set a callback to execute after the chart is initialized
25052
25053
  * @name onafterinit
25053
25054
  * @memberof Options
25054
- * @type {Function}
25055
+ * @type {function}
25055
25056
  * @default undefined
25056
25057
  * @example
25057
25058
  * onafterinit: function() {
@@ -25061,10 +25062,10 @@ const $ZOOM = {
25061
25062
  */
25062
25063
  onafterinit: void 0,
25063
25064
  /**
25064
- * Set a callback which is executed when the chart is rendered. Basically, this callback will be called in each time when the chart is redrawed.
25065
+ * Set a callback which is executed when the chart is rendered. Basically, this callback will be called in each time when the chart is redrawn.
25065
25066
  * @name onrendered
25066
25067
  * @memberof Options
25067
- * @type {Function}
25068
+ * @type {function}
25068
25069
  * @default undefined
25069
25070
  * @example
25070
25071
  * onrendered: function() {
@@ -25075,7 +25076,7 @@ const $ZOOM = {
25075
25076
  onrendered: void 0,
25076
25077
  /**
25077
25078
  * Set duration of transition (in milliseconds) for chart animation.<br><br>
25078
- * - **NOTE:** If `0 `or `null` set, transition will be skipped. So, this makes initial rendering faster especially in case you have a lot of data.
25079
+ * - **NOTE:** If `0` or `null` is set, transition will be skipped. So, this makes initial rendering faster especially in case you have a lot of data.
25079
25080
  * @name transition
25080
25081
  * @memberof Options
25081
25082
  * @type {object}
@@ -25106,11 +25107,11 @@ const $ZOOM = {
25106
25107
  * @memberof Options
25107
25108
  * @type {object}
25108
25109
  * @property {object} [render] render object
25109
- * @property {boolean} [render.lazy=true] Make to not render at initialization.
25110
+ * @property {boolean} [render.lazy=true] Make it not render at initialization.
25110
25111
  * - **NOTE**:
25111
25112
  * - Enabled by default when bind element's visibility is hidden.
25112
25113
  * - When set to `false`, will initialize the chart regardless the bind element's visibility state, but in this case chart can't be guaranteed to be rendered properly.
25113
- * @property {boolean} [render.observe=true] Observe bind element's visibility(`display` or `visiblity` inline css property or class value) & render when is visible automatically (for IEs, only works IE11+). When set to **false**, call [`.flush()`](./Chart.html#flush) to render.
25114
+ * @property {boolean} [render.observe=true] Observe bind element's visibility(`display` or `visibility` inline css property or class value) & render when it is visible automatically (for IEs, only works IE11+). When set to **false**, call [`.flush()`](./Chart.html#flush) to render.
25114
25115
  * @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.LazyRender)
25115
25116
  * @example
25116
25117
  * render: {
@@ -25132,7 +25133,7 @@ const $ZOOM = {
25132
25133
  * document.getElementById('chart').style.display = 'block'; // (b)
25133
25134
  *
25134
25135
  * @example
25135
- * // chart won't be rendered and not observing bind element's visiblity changes
25136
+ * // chart won't be rendered and not observing bind element's visibility changes
25136
25137
  * var chart = bb.generate({
25137
25138
  * render: {
25138
25139
  * lazy: true,
@@ -25158,7 +25159,7 @@ const $ZOOM = {
25158
25159
  * - `[start] {number|Date|string}`: Start position of the region. If not set, the start will be the edge of the chart.
25159
25160
  * - `[end] {number|Date|string}`: End position of the region. If not set, the end will be the edge of the chart.
25160
25161
  * - `[class] {string}`: Class value to apply to the region.
25161
- * - `[label] {object}` Lable text option.
25162
+ * - `[label] {object}` Label text option.
25162
25163
  * - `text {string}`: Text value.
25163
25164
  * - `x {number}`: x Position.
25164
25165
  * - `y {number}`: y Position.
@@ -25248,17 +25249,17 @@ const $ZOOM = {
25248
25249
  * - **NOTE:** The overlapped data points will be displayed as grouped even if set false.
25249
25250
  * @property {boolean} [tooltip.linked=false] Set if tooltips on all visible charts with like x points are shown together when one is shown.
25250
25251
  * @property {string} [tooltip.linked.name=""] Groping name for linked tooltip.<br>If specified, linked tooltip will be groped interacting to be worked only with the same name.
25251
- * @property {Function} [tooltip.format.title] Set format for the title of tooltip.<br>
25252
+ * @property {function} [tooltip.format.title] Set format for the title of tooltip.<br>
25252
25253
  * Specified function receives x of the data point to show.
25253
- * @property {Function} [tooltip.format.name] Set format for the name of each data in tooltip.<br>
25254
+ * @property {function} [tooltip.format.name] Set format for the name of each data in tooltip.<br>
25254
25255
  * Specified function receives name, ratio, id and index of the data point to show. ratio will be undefined if the chart is not donut/pie/gauge.
25255
- * @property {Function} [tooltip.format.value] Set format for the value of each data value in tooltip. If undefined returned, the row of that value will be skipped to be called.
25256
+ * @property {function} [tooltip.format.value] Set format for the value of each data value in tooltip. If undefined returned, the row of that value will be skipped to be called.
25256
25257
  * - Will pass following arguments to the given function:
25257
25258
  * - `value {string}`: Value of the data point. If data row contains multiple or ranged(ex. candlestick, area range, etc.) value, formatter will be called as value length.
25258
25259
  * - `ratio {number}`: Ratio of the data point in the `pie/donut/gauge` and `area/bar` when contains grouped data. Otherwise is `undefined`.
25259
25260
  * - `id {string}`: id of the data point
25260
25261
  * - `index {number}`: Index of the data point
25261
- * @property {Function} [tooltip.position] Set custom position function for the tooltip.<br>
25262
+ * @property {function} [tooltip.position] Set custom position function for the tooltip.<br>
25262
25263
  * This option can be used to modify the tooltip position by returning object that has top and left.
25263
25264
  * - Will pass following arguments to the given function:
25264
25265
  * - `data {Array}`: Current selected data array object.
@@ -25266,7 +25267,7 @@ const $ZOOM = {
25266
25267
  * - `height {number}`: Height of tooltip.
25267
25268
  * - `element {SVGElement}`: Tooltip event bound element
25268
25269
  * - `pos {object}`: Current position of the tooltip.
25269
- * @property {Function|object} [tooltip.contents] Set custom HTML for the tooltip.<br>
25270
+ * @property {function|object} [tooltip.contents] Set custom HTML for the tooltip.<br>
25270
25271
  * If tooltip.grouped is true, data includes multiple data points.<br><br>
25271
25272
  * Specified function receives `data` array and `defaultTitleFormat`, `defaultValueFormat` and `color` functions of the data point to show.
25272
25273
  * - **Note:**
@@ -25295,11 +25296,11 @@ const $ZOOM = {
25295
25296
  * @property {boolean} [tooltip.init.show=false] Show tooltip at the initialization.
25296
25297
  * @property {number} [tooltip.init.x=0] Set x Axis index(or index for Arc(donut, gauge, pie) types) to be shown at the initialization.
25297
25298
  * @property {object} [tooltip.init.position] Set the position of tooltip at the initialization.
25298
- * @property {Function} [tooltip.onshow] Set a callback that will be invoked before the tooltip is shown.
25299
- * @property {Function} [tooltip.onhide] Set a callback that will be invoked before the tooltip is hidden.
25300
- * @property {Function} [tooltip.onshown] Set a callback that will be invoked after the tooltip is shown
25301
- * @property {Function} [tooltip.onhidden] Set a callback that will be invoked after the tooltip is hidden.
25302
- * @property {string|Function|null} [tooltip.order=null] Set tooltip data display order.<br><br>
25299
+ * @property {function} [tooltip.onshow] Set a callback that will be invoked before the tooltip is shown.
25300
+ * @property {function} [tooltip.onhide] Set a callback that will be invoked before the tooltip is hidden.
25301
+ * @property {function} [tooltip.onshown] Set a callback that will be invoked after the tooltip is shown
25302
+ * @property {function} [tooltip.onhidden] Set a callback that will be invoked after the tooltip is hidden.
25303
+ * @property {string|function|null} [tooltip.order=null] Set tooltip data display order.<br><br>
25303
25304
  * **Available Values:**
25304
25305
  * - `desc`: In descending data value order
25305
25306
  * - `asc`: In ascending data value order
@@ -25338,7 +25339,7 @@ const $ZOOM = {
25338
25339
  * // yAxis: Current y Axis position value or function(the value is given for axis based chart type only)
25339
25340
  * // }
25340
25341
  *
25341
- * // yAxis will work differently per data lenghts
25342
+ * // yAxis will work differently per data lengths
25342
25343
  * // - a) Single data: `yAxis` will return `number` value
25343
25344
  * // - b) Multiple data: `yAxis` will return a function with property value
25344
25345
  *
@@ -25349,8 +25350,8 @@ const $ZOOM = {
25349
25350
  * // b) Multiple data:
25350
25351
  * // Get y coordinate of value 500, where 'data1' scales(y or y2).
25351
25352
  * // When 'data.axes' option is used, data can bound to different axes.
25352
- * // - when "data.axes={data1: 'y'}", wil return y value from y axis scale.
25353
- * // - when "data.axes={data1: 'y2'}", wil return y value from y2 axis scale.
25353
+ * // - when "data.axes={data1: 'y'}", will return y value from y axis scale.
25354
+ * // - when "data.axes={data1: 'y2'}", will return y value from y2 axis scale.
25354
25355
  * pos.yAxis(500, "data1"); // will return y coordinate value of data1
25355
25356
  *
25356
25357
  * pos.yAxis(500); // get y coordinate with value of 500, using y axis scale
@@ -25486,7 +25487,7 @@ const $ZOOM = {
25486
25487
  /* harmony default export */ var data_data = ({
25487
25488
  /**
25488
25489
  * Specify the key of x values in the data.<br><br>
25489
- * We can show the data with non-index x values by this option. This option is required when the type of x axis is timeseries. If this option is set on category axis, the values of the data on the key will be used for category names.
25490
+ * We can show the data with non-index x values by this option. This option is required when the type of x axis is timeseries. If this option is set on a category axis, the values of the data on the key will be used for category names.
25490
25491
  * @name data․x
25491
25492
  * @memberof Options
25492
25493
  * @type {string}
@@ -25501,7 +25502,7 @@ const $ZOOM = {
25501
25502
  * Converts data id value
25502
25503
  * @name data․idConverter
25503
25504
  * @memberof Options
25504
- * @type {Function}
25505
+ * @type {function}
25505
25506
  * @default function(id) { return id; }
25506
25507
  * @example
25507
25508
  * data: {
@@ -25670,8 +25671,8 @@ const $ZOOM = {
25670
25671
  data_types: {},
25671
25672
  /**
25672
25673
  * This option changes the order of stacking data and pieces of pie/donut.
25673
- * - If `null` specified, it will be the order the data loaded.
25674
- * - If function specified, it will be used as [Array.sort compareFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters)<br><br>
25674
+ * - If `null` specified, it will be the order in which the data is loaded.
25675
+ * - If a function is specified, it will be used as [Array.sort compareFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters)<br><br>
25675
25676
  *
25676
25677
  * **Available Values:**
25677
25678
  * - `desc`: In descending order
@@ -25679,10 +25680,10 @@ const $ZOOM = {
25679
25680
  * - `null`: It keeps the data load order
25680
25681
  * - `function(data1, data2) { ... }`: Array.sort compareFunction
25681
25682
  *
25682
- * **NOTE**: order function, only works for Axis based types & Arc types, except `Radar` type.
25683
+ * **NOTE**: order function only works for Axis based types & Arc types, except `Radar` type.
25683
25684
  * @name data․order
25684
25685
  * @memberof Options
25685
- * @type {string|Function|null}
25686
+ * @type {string|function|null}
25686
25687
  * @default desc
25687
25688
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataOrder)
25688
25689
  * @example
@@ -25737,7 +25738,7 @@ const $ZOOM = {
25737
25738
  /**
25738
25739
  * Set how zero value will be treated on groups.<br>
25739
25740
  * Possible values:
25740
- * - `zero`: 0 will be positioned at absolute axis zero point.
25741
+ * - `zero`: 0 will be positioned at the absolute axis zero point.
25741
25742
  * - `positive`: 0 will be positioned at the top of a stack.
25742
25743
  * - `negative`: 0 will be positioned at the bottom of a stack.
25743
25744
  * @name data․groupsZeroAs
@@ -25753,10 +25754,10 @@ const $ZOOM = {
25753
25754
  data_groupsZeroAs: "positive",
25754
25755
  /**
25755
25756
  * Set color converter function.<br><br>
25756
- * This option should a function and the specified function receives color (e.g. '#ff0000') and d that has data parameters like id, value, index, etc. And it must return a string that represents color (e.g. '#00ff00').
25757
+ * This option should be a function and the specified function receives color (e.g. '#ff0000') and d that has data parameters like id, value, index, etc. And it must return a string that represents color (e.g. '#00ff00').
25757
25758
  * @name data․color
25758
25759
  * @memberof Options
25759
- * @type {Function}
25760
+ * @type {function}
25760
25761
  * @default undefined
25761
25762
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataColor)
25762
25763
  * @example
@@ -25789,41 +25790,41 @@ const $ZOOM = {
25789
25790
  * @memberof Options
25790
25791
  * @type {object}
25791
25792
  * @property {object} data Data object
25792
- * @property {boolean} [data.labels=false] Show or hide labels on each data points
25793
+ * @property {boolean} [data.labels=false] Show or hide labels on each data point
25793
25794
  * @property {boolean} [data.labels.centered=false] Centerize labels on `bar` shape. (**NOTE:** works only for 'bar' type)
25794
- * @property {Function} [data.labels.format] Set formatter function for data labels.<br>
25795
+ * @property {function} [data.labels.format] Set formatter function for data labels.<br>
25795
25796
  * 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>
25796
25797
  * The arguments are:<br>
25797
25798
  * - `v` is the value of the data point where the label is shown.
25798
25799
  * - `id` is the id of the data where the label is shown.
25799
25800
  * - `i` is the index of the data series point where the label is shown.
25800
- * - `texts` is the array of whole corresponding data series' text labels.<br><br>
25801
+ * - `texts` is an array of whole corresponding data series' text labels.<br><br>
25801
25802
  * Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (ex. d3.format('$'))
25802
- * @property {string|object|Function} [data.labels.backgroundColors] Set label text background colors.<br><br>
25803
- * - **NOTE**: When function is set, background colors can be specified one color per dataset.
25803
+ * @property {string|object|function} [data.labels.backgroundColors] Set label text background colors.<br><br>
25804
+ * - **NOTE**: When a function is set, background colors can be specified one color per dataset.
25804
25805
  * - Within the function, the last returned color for dataset will be used.
25805
25806
  * - Only can control set or unset background color for each values.
25806
- * @property {string|object|Function} [data.labels.colors] Set label text colors.
25807
- * @property {object|Function} [data.labels.position] Set each dataset position, relative the original.<br><br>
25808
- * When function is specified, will receives 5 arguments such as `type, v, id, i, texts` and it must return a position number.<br><br>
25807
+ * @property {string|object|function} [data.labels.colors] Set label text colors.
25808
+ * @property {object|function} [data.labels.position] Set each dataset position, relative to the original.<br><br>
25809
+ * When a function is specified, it will receive 5 arguments such as `type, v, id, i, texts` and it must return a position number.<br><br>
25809
25810
  * The arguments are:<br>
25810
25811
  * - `type` coordinate type string, which will be 'x' or 'y'.
25811
25812
  * - `v` is the value of the data point where the label is shown.
25812
25813
  * - `id` is the id of the data where the label is shown.
25813
25814
  * - `i` is the index of the data series point where the label is shown.
25814
- * - `texts` is the array of whole corresponding data series' text labels.<br><br>
25815
- * @property {number} [data.labels.position.x=0] x coordinate position, relative the original.
25816
- * @property {number} [data.labels.position.y=0] y coordinate position, relative the original.
25815
+ * - `texts` is an array of whole corresponding data series' text labels.<br><br>
25816
+ * @property {number} [data.labels.position.x=0] x coordinate position, relative to the original.
25817
+ * @property {number} [data.labels.position.y=0] y coordinate position, relative to the original.
25817
25818
  * @property {object} [data.labels.rotate] Rotate label text. Specify degree value in a range of `0 ~ 360`.
25818
- * - **NOTE:** Depend on rotate value, text position need to be adjusted manually(using `data.labels.position` option) to be shown nicely.
25819
- * @property {boolean|object} [data.labels.border=false] Add border to data label text. NOTE: When set as `true`, styling aren't applied. Hence, need to set using `.bb-text-border` class.
25819
+ * - **NOTE:** Depending on the rotate value, the text position needs to be adjusted manually(using `data.labels.position` option) to be shown nicely.
25820
+ * @property {boolean|object} [data.labels.border=false] Add border to data label text. NOTE: When set as `true`, styling isn't applied. Hence, you need to set it using `.bb-text-border` class.
25820
25821
  * @property {number|string|object} [data.labels.border.padding="3 5"] Border padding. Can be a single number, string or object with top, bottom, left, right properties.
25821
25822
  * @property {number} [data.labels.border.radius=10] Border radius value.
25822
25823
  * @property {number} [data.labels.border.strokeWidth=1] Border stroke width.
25823
25824
  * @property {string} [data.labels.border.stroke="#000"] Border stroke color.
25824
25825
  * @property {string} [data.labels.border.fill="none"] Border fill color.
25825
- * @property {object|Function} [data.labels.image] Set image to be displayed next to the label text.<br><br>
25826
- * When function is specified, will receives 3 arguments such as `v, id, i` and it must return an image object with `url`, `width`, `height`, and optional `pos` properties.<br><br>
25826
+ * @property {object|function} [data.labels.image] Set image to be displayed next to the label text.<br><br>
25827
+ * When a function is specified, it will receive 3 arguments such as `v, id, i` and it must return an image object with `url`, `width`, `height`, and optional `pos` properties.<br><br>
25827
25828
  * The arguments are:<br>
25828
25829
  * - `v` is the value of the data point where the label is shown.
25829
25830
  * - `id` is the id of the data where the label is shown.
@@ -25832,8 +25833,8 @@ const $ZOOM = {
25832
25833
  * @property {number} data.labels.image.width Image width in pixels.
25833
25834
  * @property {number} data.labels.image.height Image height in pixels.
25834
25835
  * @property {object} [data.labels.image.pos] Image position relative to the label text.
25835
- * @property {number} [data.labels.image.pos.x=0] x coordinate position, relative the original.
25836
- * @property {number} [data.labels.image.pos.y=0] y coordinate position, relative the original.
25836
+ * @property {number} [data.labels.image.pos.x=0] x coordinate position, relative to the original.
25837
+ * @property {number} [data.labels.image.pos.y=0] y coordinate position, relative to the original.
25837
25838
  * @memberof Options
25838
25839
  * @type {object}
25839
25840
  * @default {}
@@ -25867,10 +25868,10 @@ const $ZOOM = {
25867
25868
  * // align text to center of the 'bar' shape (works only for 'bar' type)
25868
25869
  * centered: true,
25869
25870
  *
25870
- * // apply backgound color for label texts
25871
+ * // apply background color for label texts
25871
25872
  * backgroundColors: "red",
25872
25873
  *
25873
- * // set differenct backround colors per dataset
25874
+ * // set different background colors per dataset
25874
25875
  * backgroundColors: {
25875
25876
  * data1: "green",
25876
25877
  * data2: "yellow"
@@ -25981,7 +25982,7 @@ const $ZOOM = {
25981
25982
  * pos: { x: 0, y: 0 }
25982
25983
  * };
25983
25984
  * } else if(v < 5) {
25984
- * // Return falsy value in case of don't want to show image
25985
+ * // Return falsy value in case you don't want to show image
25985
25986
  * return null;
25986
25987
  * } else {
25987
25988
  * return {
@@ -26002,7 +26003,7 @@ const $ZOOM = {
26002
26003
  data_labels_imgUrl: void 0,
26003
26004
  /**
26004
26005
  * Hide each data when the chart appears.<br><br>
26005
- * If true specified, all of data will be hidden. If multiple ids specified as an array, those will be hidden.
26006
+ * If true is specified, all of data will be hidden. If multiple ids are specified as an array, those will be hidden.
26006
26007
  * @name data․hide
26007
26008
  * @memberof Options
26008
26009
  * @type {boolean|Array}
@@ -26023,7 +26024,7 @@ const $ZOOM = {
26023
26024
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
26024
26025
  * @name data․filter
26025
26026
  * @memberof Options
26026
- * @type {Function}
26027
+ * @type {function}
26027
26028
  * @default undefined
26028
26029
  * @example
26029
26030
  * data: {
@@ -26038,13 +26039,13 @@ const $ZOOM = {
26038
26039
  data_filter: void 0,
26039
26040
  /**
26040
26041
  * Set a callback for click event on each data point.<br><br>
26041
- * This callback will be called when each data point clicked and will receive `d` and element as the arguments.
26042
+ * This callback will be called when each data point is clicked and will receive `d` and element as the arguments.
26042
26043
  * - `d` is the data clicked and element is the element clicked.
26043
26044
  * - `element` is the current interacting svg element.
26044
26045
  * - In this callback, `this` will be the Chart object.
26045
26046
  * @name data․onclick
26046
26047
  * @memberof Options
26047
- * @type {Function}
26048
+ * @type {function}
26048
26049
  * @default function() {}
26049
26050
  * @example
26050
26051
  * data: {
@@ -26059,13 +26060,13 @@ const $ZOOM = {
26059
26060
  },
26060
26061
  /**
26061
26062
  * Set a callback for mouse/touch over event on each data point.<br><br>
26062
- * This callback will be called when mouse cursor or via touch moves onto each data point and will receive `d` and `element` as the argument.
26063
+ * This callback will be called when the mouse cursor or touch moves onto each data point and will receive `d` and `element` as the argument.
26063
26064
  * - `d` is the data where mouse cursor moves onto.
26064
26065
  * - `element` is the current interacting svg element.
26065
26066
  * - In this callback, `this` will be the Chart object.
26066
26067
  * @name data․onover
26067
26068
  * @memberof Options
26068
- * @type {Function}
26069
+ * @type {function}
26069
26070
  * @default function() {}
26070
26071
  * @example
26071
26072
  * data: {
@@ -26080,13 +26081,13 @@ const $ZOOM = {
26080
26081
  },
26081
26082
  /**
26082
26083
  * Set a callback for mouse/touch out event on each data point.<br><br>
26083
- * This callback will be called when mouse cursor or via touch moves out each data point and will receive `d` as the argument.
26084
+ * This callback will be called when the mouse cursor or touch moves out each data point and will receive `d` as the argument.
26084
26085
  * - `d` is the data where mouse cursor moves out.
26085
26086
  * - `element` is the current interacting svg element.
26086
26087
  * - In this callback, `this` will be the Chart object.
26087
26088
  * @name data․onout
26088
26089
  * @memberof Options
26089
- * @type {Function}
26090
+ * @type {function}
26090
26091
  * @default function() {}
26091
26092
  * @example
26092
26093
  * data: {
@@ -26104,7 +26105,7 @@ const $ZOOM = {
26104
26105
  * The callback will receive shown data ids in array.
26105
26106
  * @name data․onshown
26106
26107
  * @memberof Options
26107
- * @type {Function}
26108
+ * @type {function}
26108
26109
  * @default undefined
26109
26110
  * @example
26110
26111
  * data: {
@@ -26120,7 +26121,7 @@ const $ZOOM = {
26120
26121
  * The callback will receive hidden data ids in array.
26121
26122
  * @name data․onhidden
26122
26123
  * @memberof Options
26123
- * @type {Function}
26124
+ * @type {function}
26124
26125
  * @default undefined
26125
26126
  * @example
26126
26127
  * data: {
@@ -26136,7 +26137,7 @@ const $ZOOM = {
26136
26137
  * - **NOTE:** For 'area-line-range', 'area-step-range' and 'area-spline-range', `mid` data will be taken for the comparison
26137
26138
  * @name data․onmin
26138
26139
  * @memberof Options
26139
- * @type {Function}
26140
+ * @type {function}
26140
26141
  * @default undefined
26141
26142
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.OnMinMaxCallback)
26142
26143
  * @example
@@ -26151,7 +26152,7 @@ const $ZOOM = {
26151
26152
  * - **NOTE:** For 'area-line-range', 'area-step-range' and 'area-spline-range', `mid` data will be taken for the comparison
26152
26153
  * @name data․onmax
26153
26154
  * @memberof Options
26154
- * @type {Function}
26155
+ * @type {function}
26155
26156
  * @default undefined
26156
26157
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.OnMinMaxCallback)
26157
26158
  * @example
@@ -26162,7 +26163,7 @@ const $ZOOM = {
26162
26163
  */
26163
26164
  data_onmax: void 0,
26164
26165
  /**
26165
- * Load a CSV or JSON file from a URL. NOTE that this will not work if loading via the "file://" protocol as the most browsers will block XMLHTTPRequests.
26166
+ * Load a CSV or JSON file from a URL. NOTE that this will not work if loading via the "file://" protocol as most browsers will block XMLHTTPRequests.
26166
26167
  * @name data․url
26167
26168
  * @memberof Options
26168
26169
  * @type {string}
@@ -26290,7 +26291,7 @@ const $ZOOM = {
26290
26291
  * }
26291
26292
  * }
26292
26293
  *
26293
- * // for 'canlestick' type, data should contain:
26294
+ * // for 'candlestick' type, data should contain:
26294
26295
  * // - an array of [open, high, low, close, volume(optional)] data following the order
26295
26296
  * // - or an object with 'open', 'high', 'low', 'close' and 'value'(optional) key value
26296
26297
  * data: {
@@ -26365,7 +26366,7 @@ const $ZOOM = {
26365
26366
  * type: "bubble"
26366
26367
  * }
26367
26368
  *
26368
- * // for 'canlestick' type, data should contain:
26369
+ * // for 'candlestick' type, data should contain:
26369
26370
  * // - an array of [open, high, low, close, volume(optional)] data following the order
26370
26371
  * // - or an object with 'open', 'high', 'low', 'close' and 'value'(optional) key value
26371
26372
  * data: {
@@ -26453,7 +26454,8 @@ const $ZOOM = {
26453
26454
  * @property {boolean} [interaction.brighten=true] Make brighter for the selected area (ex. 'pie' type data selected area)
26454
26455
  * @property {boolean} [interaction.inputType.mouse=true] enable or disable mouse interaction
26455
26456
  * @property {boolean} [interaction.inputType.touch=true] enable or disable touch interaction
26456
- * @property {boolean|number} [interaction.inputType.touch.preventDefault=false] enable or disable to call event.preventDefault on touchstart & touchmove event. It's usually used to prevent document scrolling.
26457
+ * @property {boolean|number} [interaction.inputType.touch.preventDefault=false] enable or disable to call event.preventDefault on touchstart & touchmove event. It's usually used to prevent document scrolling.<br>
26458
+ * - **NOTE**: When `true` is set, touch events are bound with [`{passive: false}`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#using_passive_listeners) option.
26457
26459
  * @property {boolean} [interaction.onout=true] Enable or disable "onout" event.<br>
26458
26460
  * When is disabled, defocus(hiding tooltip, focused gridline, etc.) event won't work.
26459
26461
  * @see [Demo: touch.preventDefault](https://naver.github.io/billboard.js/demo/#Interaction.PreventScrollOnTouch)
@@ -29498,9 +29500,9 @@ class Cache {
29498
29500
  /**
29499
29501
  * Add cache
29500
29502
  * @param {string} key Cache key
29501
- * @param {*} value Value to be stored
29503
+ * @param {string|number|boolean|object|Array|function|null|undefined} value Value to be stored
29502
29504
  * @param {boolean} isDataType Weather the cache is data typed '{id:'data', id_org: 'data', values: [{x:0, index:0,...}, ...]}'
29503
- * @returns {*} Added data value
29505
+ * @returns {string|number|boolean|object|Array|function|null|undefined} Added data value
29504
29506
  * @private
29505
29507
  */
29506
29508
  add(key, value, isDataType = false) {
@@ -29519,7 +29521,7 @@ class Cache {
29519
29521
  * Get cahce
29520
29522
  * @param {string|Array} key Cache key
29521
29523
  * @param {boolean} isDataType Weather the cache is data typed '{id:'data', id_org: 'data', values: [{x:0, index:0,...}, ...]}'
29522
- * @returns {*}
29524
+ * @returns {string|number|boolean|object|Array|function|null} Cached value
29523
29525
  * @private
29524
29526
  */
29525
29527
  get(key, isDataType = false) {
@@ -30119,7 +30121,7 @@ function setXS(ids, data, params) {
30119
30121
  /**
30120
30122
  * Convert data according its type
30121
30123
  * @param {object} args data object
30122
- * @param {Function} [callback] callback for url(XHR) type loading
30124
+ * @param {function} [callback] callback for url(XHR) type loading
30123
30125
  * @private
30124
30126
  */
30125
30127
  convertData(args, callback) {
@@ -30270,7 +30272,17 @@ function setXS(ids, data, params) {
30270
30272
  },
30271
30273
  isStackNormalized() {
30272
30274
  const { config } = this;
30273
- return !!(config.data_stack_normalize && config.data_groups.length);
30275
+ return !!((config.data_stack_normalize === true || isObjectType(config.data_stack_normalize)) && config.data_groups.length);
30276
+ },
30277
+ /**
30278
+ * Check if stack normalization should be applied per group
30279
+ * @returns {boolean}
30280
+ * @private
30281
+ */
30282
+ isStackNormalizedPerGroup() {
30283
+ var _a;
30284
+ const { config } = this;
30285
+ return !!(isObjectType(config.data_stack_normalize) && ((_a = config.data_stack_normalize) == null ? void 0 : _a.perGroup) && config.data_groups.length);
30274
30286
  },
30275
30287
  /**
30276
30288
  * Check if given id is grouped data or has grouped data
@@ -30282,6 +30294,19 @@ function setXS(ids, data, params) {
30282
30294
  const groups = this.config.data_groups;
30283
30295
  return id ? groups.some((v) => v.indexOf(id) >= 0 && v.length > 1) : groups.length > 0;
30284
30296
  },
30297
+ /**
30298
+ * Check if the given axis has any grouped data
30299
+ * @param {string} axisId Axis ID (e.g., "y", "y2")
30300
+ * @returns {boolean} true if axis has grouped data
30301
+ * @private
30302
+ */
30303
+ hasAxisGroupedData(axisId) {
30304
+ const $$ = this;
30305
+ const { axis } = $$;
30306
+ const targets = $$.data.targets;
30307
+ const axisDataIds = targets.filter((t) => axis.getId(t.id) === axisId).map((t) => t.id);
30308
+ return axisDataIds.some((id) => $$.isGrouped(id));
30309
+ },
30285
30310
  getXKey(id) {
30286
30311
  const $$ = this;
30287
30312
  const { config } = $$;
@@ -30473,16 +30498,27 @@ function setXS(ids, data, params) {
30473
30498
  },
30474
30499
  /**
30475
30500
  * Get sum of data per index
30501
+ * @param {string} targetId Target ID to get total for (only for normalized stack per group)
30476
30502
  * @private
30477
30503
  * @returns {Array}
30478
30504
  */
30479
- getTotalPerIndex() {
30505
+ getTotalPerIndex(targetId) {
30480
30506
  const $$ = this;
30481
- const cacheKey = KEY.dataTotalPerIndex;
30507
+ const { config } = $$;
30508
+ const cacheKey = targetId ? `${KEY.dataTotalPerIndex}-${targetId}` : KEY.dataTotalPerIndex;
30482
30509
  let sum = $$.cache.get(cacheKey);
30483
30510
  if (($$.config.data_groups.length || $$.isStackNormalized()) && !sum) {
30484
30511
  sum = [];
30485
- $$.data.targets.forEach((row) => {
30512
+ let { targets } = $$.data;
30513
+ if ($$.isStackNormalizedPerGroup() && targetId) {
30514
+ const group = config.data_groups.find((g) => g.indexOf(targetId) >= 0);
30515
+ if (group) {
30516
+ targets = targets.filter((t) => group.indexOf(t.id) >= 0);
30517
+ } else {
30518
+ return null;
30519
+ }
30520
+ }
30521
+ targets.forEach((row) => {
30486
30522
  row.values.forEach((v, i) => {
30487
30523
  if (!sum[i]) {
30488
30524
  sum[i] = 0;
@@ -30490,6 +30526,7 @@ function setXS(ids, data, params) {
30490
30526
  sum[i] += ~~v.value;
30491
30527
  });
30492
30528
  });
30529
+ $$.cache.add(cacheKey, sum);
30493
30530
  }
30494
30531
  return sum;
30495
30532
  },
@@ -30505,7 +30542,10 @@ function setXS(ids, data, params) {
30505
30542
  let total = $$.cache.get(cacheKey);
30506
30543
  if (!isNumber(total)) {
30507
30544
  total = $$.data.targets.reduce((acc, t) => {
30508
- return acc + t.values.reduce((sum, v) => sum + ~~v.value, 0);
30545
+ return acc + t.values.reduce((sum, v) => {
30546
+ var _a;
30547
+ return sum + ((_a = v.value) != null ? _a : 0);
30548
+ }, 0);
30509
30549
  }, 0);
30510
30550
  $$.cache.add(cacheKey, total);
30511
30551
  }
@@ -30600,7 +30640,7 @@ function setXS(ids, data, params) {
30600
30640
  return sortValue(xs);
30601
30641
  },
30602
30642
  /**
30603
- * Add to the state target Ids
30643
+ * Add to thetarget Ids
30604
30644
  * @param {string} type State's prop name
30605
30645
  * @param {Array|string} targetIds Target ids array
30606
30646
  * @private
@@ -30698,7 +30738,7 @@ function setXS(ids, data, params) {
30698
30738
  /**
30699
30739
  * Get data.order compare function
30700
30740
  * @param {boolean} isReversed for Arc & Treemap type sort order needs to be reversed
30701
- * @returns {Function} compare function
30741
+ * @returns {function} compare function
30702
30742
  * @private
30703
30743
  */
30704
30744
  getSortCompareFn(isReversed = false) {
@@ -30980,12 +31020,27 @@ function setXS(ids, data, params) {
30980
31020
  }
30981
31021
  } else if (type === "index") {
30982
31022
  const dataValues = api.data.values.bind(api);
30983
- let total = this.getTotalPerIndex();
30984
- if (state.hiddenTargetIds.length) {
30985
- let hiddenSum = dataValues(state.hiddenTargetIds, false);
30986
- if (hiddenSum.length) {
30987
- hiddenSum = hiddenSum.reduce((acc, curr) => acc.map((v, i) => ~~v + curr[i]));
30988
- total = total.map((v, i) => v - hiddenSum[i]);
31023
+ const { hiddenTargetIds } = state;
31024
+ let total = this.getTotalPerIndex(
31025
+ $$.isStackNormalizedPerGroup() ? d.id : void 0
31026
+ );
31027
+ if (total === null) {
31028
+ return ratio;
31029
+ }
31030
+ if (hiddenTargetIds.length) {
31031
+ let hiddenIds = hiddenTargetIds;
31032
+ if ($$.isStackNormalizedPerGroup() && d.id) {
31033
+ const group = config.data_groups.find((g) => g.indexOf(d.id) >= 0);
31034
+ if (group) {
31035
+ hiddenIds = hiddenIds.filter((id) => group.indexOf(id) >= 0);
31036
+ }
31037
+ }
31038
+ if (hiddenIds.length) {
31039
+ let hiddenSum = dataValues(hiddenIds, false);
31040
+ if (hiddenSum.length) {
31041
+ hiddenSum = hiddenSum.reduce((acc, curr) => acc.map((v, i) => ~~v + curr[i]));
31042
+ total = total.map((v, i) => v - hiddenSum[i]);
31043
+ }
30989
31044
  }
30990
31045
  }
30991
31046
  const divisor = total[d.index];
@@ -31163,8 +31218,6 @@ function callDone(fn, resizeAfter = false) {
31163
31218
  done();
31164
31219
  return;
31165
31220
  }
31166
- const targets = $el.svg.selectAll(targetIds.map((id) => $$.selectorTarget(id)));
31167
- $T(targets).style("opacity", "0").remove().call(endall, done);
31168
31221
  targetIds.forEach((id) => {
31169
31222
  var _a2;
31170
31223
  const suffixId = $$.getTargetSelectorSuffix(id);
@@ -31178,6 +31231,8 @@ function callDone(fn, resizeAfter = false) {
31178
31231
  state.hasFunnel && $$.updateFunnel($$.data.targets);
31179
31232
  state.hasTreemap && $$.updateTargetsForTreemap($$.data.targets);
31180
31233
  $$.updateTypesElements();
31234
+ const targets = $el.svg.selectAll(targetIds.map((id) => $$.selectorTarget(id)));
31235
+ $T(targets).style("opacity", "0").remove().call(endall, done);
31181
31236
  }
31182
31237
  });
31183
31238
 
@@ -31466,7 +31521,7 @@ function drag_defaultTouchable() {
31466
31521
  },
31467
31522
  /**
31468
31523
  * Return draggable selection function
31469
- * @returns {Function}
31524
+ * @returns {function}
31470
31525
  * @private
31471
31526
  */
31472
31527
  getDraggableSelection() {
@@ -31873,6 +31928,7 @@ const schemeCategory10 = [
31873
31928
  const $$ = this;
31874
31929
  const { $el, config } = $$;
31875
31930
  const ids = [];
31931
+ const hasGradient = config.area_linearGradient || config.bar_linearGradient || config.point_radialGradient;
31876
31932
  let pattern = notEmpty(config.color_pattern) ? config.color_pattern : ordinal(getColorFromCss($el.chart) || schemeCategory10).range();
31877
31933
  const originalColorPattern = pattern;
31878
31934
  if (isFunction(config.color_tiles)) {
@@ -31903,7 +31959,18 @@ const schemeCategory10 = [
31903
31959
  color = isLine ? originalColorPattern[ids.indexOf(id) % originalColorPattern.length] : pattern[ids.indexOf(id) % pattern.length];
31904
31960
  colors[id] = color;
31905
31961
  }
31906
- return isFunction(callback) ? callback.bind($$.api)(color, d) : color;
31962
+ color = isFunction(callback) ? callback.call($$.api, color, d) : color;
31963
+ if (hasGradient) {
31964
+ const stop = $$.$el.defs.selectAll(
31965
+ `[id$='-gradient${$$.getTargetSelectorSuffix(id)}'] stop`
31966
+ );
31967
+ let hasSameColor;
31968
+ stop.each(function(d2, i) {
31969
+ hasSameColor = i === 0 ? this.style.stopColor : this.style.stopColor === hasSameColor;
31970
+ });
31971
+ hasSameColor === true && stop.attr("stop-color", color);
31972
+ }
31973
+ return color;
31907
31974
  };
31908
31975
  },
31909
31976
  generateLevelColor() {
@@ -31928,7 +31995,7 @@ const schemeCategory10 = [
31928
31995
  },
31929
31996
  /**
31930
31997
  * Append data backgound color filter definition
31931
- * @param {string|object|Function} color Color string, object, or function
31998
+ * @param {string|object|function} color Color string, object, or function
31932
31999
  * @param {object} attr filter attribute
31933
32000
  * @private
31934
32001
  */
@@ -32095,7 +32162,11 @@ const schemeCategory10 = [
32095
32162
  const { axis, config, scale } = $$;
32096
32163
  const pfx = `axis_${axisId}`;
32097
32164
  if ($$.isStackNormalized()) {
32098
- return [0, 100];
32165
+ const axisDataIds = targets.filter((t) => axis.getId(t.id) === axisId).map((t) => t.id);
32166
+ const hasGroupedData = axisDataIds.some((id) => $$.isGrouped(id));
32167
+ if (hasGroupedData) {
32168
+ return [0, 100];
32169
+ }
32099
32170
  }
32100
32171
  const isLog = (scale == null ? void 0 : scale[axisId]) && scale[axisId].type === "log";
32101
32172
  const targetsByAxisId = targets.filter((t) => axis.getId(t.id) === axisId);
@@ -32413,7 +32484,7 @@ function getFormat($$, typeValue, v) {
32413
32484
  },
32414
32485
  /**
32415
32486
  * Get default value format function
32416
- * @returns {Function} formatter function
32487
+ * @returns {function} formatter function
32417
32488
  * @private
32418
32489
  */
32419
32490
  getDefaultValueFormat() {
@@ -32937,7 +33008,7 @@ function getFormattedText(id, formatted = true) {
32937
33008
  * @param {Array} targetIdz Data ids
32938
33009
  * @param {object} dimension Dimension object
32939
33010
  * @param {object} sizes Size object
32940
- * @returns {Function} Update position function
33011
+ * @returns {function} Update position function
32941
33012
  * @private
32942
33013
  */
32943
33014
  getUpdateLegendPositions(targetIdz, dimension, sizes) {
@@ -33011,7 +33082,7 @@ function getFormattedText(id, formatted = true) {
33011
33082
  * Generate legend item elements
33012
33083
  * @param {Array} targetIdz Data ids
33013
33084
  * @param {object} itemTileSize Item tile size {width, height}
33014
- * @param {Function} updatePositions Update position function
33085
+ * @param {function} updatePositions Update position function
33015
33086
  * @param {object} posFn Position functions
33016
33087
  * @private
33017
33088
  */
@@ -33691,7 +33762,7 @@ var map = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "\xB5",
33691
33762
  if (type === "n") comma = true, type = "g";
33692
33763
  else if (!formatTypes[type]) precision === void 0 && (precision = 12), trim = true, type = "g";
33693
33764
  if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "=";
33694
- var prefix = ((options == null ? void 0 : options.prefix) !== void 0 ? options.prefix : "") + (symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : ""), suffix = (symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "") + ((options == null ? void 0 : options.suffix) !== void 0 ? options.suffix : "");
33765
+ var prefix = (options && options.prefix !== void 0 ? options.prefix : "") + (symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : ""), suffix = (symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "") + (options && options.suffix !== void 0 ? options.suffix : "");
33695
33766
  var formatType = formatTypes[type], maybeSuffix = /[defgprs%]/.test(type);
33696
33767
  precision = precision === void 0 ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));
33697
33768
  function format(value) {
@@ -34269,8 +34340,8 @@ function getScale(type = "linear", min, max) {
34269
34340
  * @param {number} min Min range value
34270
34341
  * @param {number} max Max range value
34271
34342
  * @param {Array} domain Domain value
34272
- * @param {Function} offset The offset getter to be sum
34273
- * @returns {Function} scale
34343
+ * @param {function} offset The offset getter to be sum
34344
+ * @returns {function} scale
34274
34345
  * @private
34275
34346
  */
34276
34347
  getXScale(min, max, domain, offset) {
@@ -34287,7 +34358,7 @@ function getScale(type = "linear", min, max) {
34287
34358
  * @param {number} min Min value
34288
34359
  * @param {number} max Max value
34289
34360
  * @param {Array} domain Domain value
34290
- * @returns {Function} Scale function
34361
+ * @returns {function} Scale function
34291
34362
  * @private
34292
34363
  */
34293
34364
  getYScale(id, min, max, domain) {
@@ -34300,7 +34371,7 @@ function getScale(type = "linear", min, max) {
34300
34371
  * Get y Axis scale
34301
34372
  * @param {string} id Axis id
34302
34373
  * @param {boolean} isSub Weather is sub Axis
34303
- * @returns {Function} Scale function
34374
+ * @returns {function} Scale function
34304
34375
  * @private
34305
34376
  */
34306
34377
  getYScaleById(id, isSub = false) {
@@ -34312,8 +34383,8 @@ function getScale(type = "linear", min, max) {
34312
34383
  /**
34313
34384
  * Get customized x axis scale
34314
34385
  * @param {d3.scaleLinear|d3.scaleTime} scaleValue Scale function
34315
- * @param {Function} offsetValue Offset getter to be sum
34316
- * @returns {Function} Scale function
34386
+ * @param {function} offsetValue Offset getter to be sum
34387
+ * @returns {function} Scale function
34317
34388
  * @private
34318
34389
  */
34319
34390
  getCustomizedXScale(scaleValue, offsetValue) {
@@ -34763,8 +34834,8 @@ function getScale(type = "linear", min, max) {
34763
34834
  * @param {boolean} withShape Set shpes' prefix class
34764
34835
  * @param {string} selector CSS selector
34765
34836
  * @param {Array} props CSS props list
34766
- * @param {Function} propsFn Function to retrieve value or determine for props
34767
- * @returns {Function}
34837
+ * @param {function} propsFn Function to retrieve value or determine for props
34838
+ * @returns {function}
34768
34839
  * @private
34769
34840
  */
34770
34841
  setCssRule(withShape, selector, props, propsFn) {
@@ -34786,7 +34857,7 @@ function getScale(type = "linear", min, max) {
34786
34857
  },
34787
34858
  /**
34788
34859
  * Get style prop value
34789
- * @param {Function|string} v Value
34860
+ * @param {function|string} v Value
34790
34861
  * @returns {string|null}
34791
34862
  * @private
34792
34863
  */
@@ -35057,7 +35128,7 @@ function updateTextImagePos(textNode, pos) {
35057
35128
  if (isNumber(value)) {
35058
35129
  this.textContent = value;
35059
35130
  } else {
35060
- setTextValue(node, value);
35131
+ setTextValue(node, value, void 0, true);
35061
35132
  }
35062
35133
  });
35063
35134
  updateTextImage.call($$);
@@ -35088,7 +35159,7 @@ function updateTextImagePos(textNode, pos) {
35088
35159
  /**
35089
35160
  * Update data label text background color
35090
35161
  * @param {object} d Data object
35091
- * @param {object|string|Function} option option object
35162
+ * @param {object|string|function} option option object
35092
35163
  * @returns {string|null}
35093
35164
  * @private
35094
35165
  */
@@ -35117,8 +35188,8 @@ function updateTextImagePos(textNode, pos) {
35117
35188
  },
35118
35189
  /**
35119
35190
  * Redraw chartText
35120
- * @param {Function} getX Positioning function for x
35121
- * @param {Function} getY Positioning function for y
35191
+ * @param {function} getX Positioning function for x
35192
+ * @param {function} getY Positioning function for y
35122
35193
  * @param {boolean} forFlow Weather is flow
35123
35194
  * @param {boolean} withTransition transition is enabled
35124
35195
  * @returns {Array}
@@ -35232,7 +35303,7 @@ function updateTextImagePos(textNode, pos) {
35232
35303
  const isBarType = $$.isBarType(d);
35233
35304
  const isTreemapType = $$.isTreemapType(d);
35234
35305
  if (config.data_labels.centered && (isBarType || isTreemapType)) {
35235
- const rect = getBoundingRect(textElement);
35306
+ const rect = getBBox(textElement);
35236
35307
  if (isBarType) {
35237
35308
  const isPositive = $$.getRangedData(d, null, "bar") >= 0;
35238
35309
  if (isRotated) {
@@ -35243,7 +35314,10 @@ function updateTextImagePos(textNode, pos) {
35243
35314
  return isPositive ? h : -h - 2;
35244
35315
  }
35245
35316
  } else if (isTreemapType) {
35246
- return type === "x" ? (points[1][0] - points[0][0]) / 2 : (points[1][1] - points[0][1]) / 2 + rect.height / 2;
35317
+ return type === "x" ? (points[1][0] - points[0][0]) / 2 : (
35318
+ // X: Move to horizontal center of rect
35319
+ (points[1][1] - points[0][1]) / 2 - rect.y - rect.height / 2
35320
+ );
35247
35321
  }
35248
35322
  }
35249
35323
  return 0;
@@ -35509,9 +35583,9 @@ function getTextXPos(pos = "left", width) {
35509
35583
  /**
35510
35584
  * Returns the tooltip content(HTML string)
35511
35585
  * @param {object} d data
35512
- * @param {Function} defaultTitleFormat Default title format
35513
- * @param {Function} defaultValueFormat Default format for each data value in the tooltip.
35514
- * @param {Function} color Color function
35586
+ * @param {function} defaultTitleFormat Default title format
35587
+ * @param {function} defaultValueFormat Default format for each data value in the tooltip.
35588
+ * @param {function} color Color function
35515
35589
  * @returns {string} html
35516
35590
  * @private
35517
35591
  */
@@ -35525,9 +35599,16 @@ function getTextXPos(pos = "left", width) {
35525
35599
  });
35526
35600
  const titleFormat = (...arg) => sanitize((titleFn || defaultTitleFormat)(...arg));
35527
35601
  const nameFormat = (...arg) => sanitize((nameFn || ((name) => name))(...arg));
35528
- const valueFormat = (...arg) => {
35529
- const fn = valueFn || (state.hasTreemap || $$.isStackNormalized() ? (v, ratio) => `${(ratio * 100).toFixed(2)}%` : defaultValueFormat);
35530
- return sanitize(fn(...arg));
35602
+ const valueFormat = (v, ratio, id, index) => {
35603
+ let fn = valueFn;
35604
+ if (!fn) {
35605
+ if (state.hasTreemap || $$.isStackNormalized() && (!$$.isStackNormalizedPerGroup() || $$.isGrouped(id))) {
35606
+ fn = (v2, ratio2) => `${(ratio2 * 100).toFixed(2)}%`;
35607
+ } else {
35608
+ fn = defaultValueFormat;
35609
+ }
35610
+ }
35611
+ return sanitize(fn(v, ratio, id, index));
35531
35612
  };
35532
35613
  const order = config.tooltip_order;
35533
35614
  const getRowValue = (row2) => $$.axis && $$.isBubbleZType(row2) ? $$.getBubbleZData(row2.value, "z") : $$.getBaseValue(row2);
@@ -35866,7 +35947,7 @@ function getTextXPos(pos = "left", width) {
35866
35947
  if (tooltip && tooltip.style("display") !== "none" && (!config.tooltip_doNotHide || force)) {
35867
35948
  const selectedData = JSON.parse((_a = tooltip.datum().current) != null ? _a : {});
35868
35949
  callFn(config.tooltip_onhide, api, selectedData);
35869
- tooltip.style("display", "none").style("visibility", "hidden").datum(null);
35950
+ tooltip.style("display", "none").datum(null);
35870
35951
  callFn(config.tooltip_onhidden, api, selectedData);
35871
35952
  }
35872
35953
  },
@@ -37222,7 +37303,7 @@ function getGroupedDataPointsFn(d) {
37222
37303
  * data2 data4 data2 data4
37223
37304
  * -------------------------
37224
37305
  * 0 1
37225
- * @param {Function} typeFilter Chart type filter function
37306
+ * @param {function} typeFilter Chart type filter function
37226
37307
  * @returns {object} Indices object with its position
37227
37308
  */
37228
37309
  getShapeIndices(typeFilter) {
@@ -37367,7 +37448,7 @@ function getGroupedDataPointsFn(d) {
37367
37448
  },
37368
37449
  /**
37369
37450
  * Get Shape's offset data
37370
- * @param {Function} typeFilter Type filter function
37451
+ * @param {function} typeFilter Type filter function
37371
37452
  * @returns {object}
37372
37453
  * @private
37373
37454
  */
@@ -37868,14 +37949,18 @@ class ChartInternal {
37868
37949
  if (hasInteraction && state.inputType) {
37869
37950
  const isTouch = state.inputType === "touch";
37870
37951
  const { onclick, onover, onout } = config;
37871
- $el.svg.on("click", (onclick == null ? void 0 : onclick.bind($$.api)) || null).on(isTouch ? "touchstart" : "mouseenter", (onover == null ? void 0 : onover.bind($$.api)) || null).on(isTouch ? "touchend" : "mouseleave", (onout == null ? void 0 : onout.bind($$.api)) || null);
37952
+ $el.svg.on("click", (onclick == null ? void 0 : onclick.bind($$.api)) || null).on(
37953
+ isTouch ? "touchstart" : "mouseenter",
37954
+ (onover == null ? void 0 : onover.bind($$.api)) || null,
37955
+ isTouch ? { passive: true } : void 0
37956
+ ).on(isTouch ? "touchend" : "mouseleave", (onout == null ? void 0 : onout.bind($$.api)) || null);
37872
37957
  }
37873
37958
  config.svg_classname && $el.svg.attr("class", config.svg_classname);
37874
37959
  const hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
37875
37960
  if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_a = $$.hasLegendDefsPoint) == null ? void 0 : _a.call($$))) {
37876
37961
  $el.defs = $el.svg.append("defs");
37877
37962
  if (hasAxis) {
37878
- ["id", "idXAxis", "idYAxis", "idGrid"].forEach((v) => {
37963
+ ["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach((v) => {
37879
37964
  $$.appendClip($el.defs, state.clip[v]);
37880
37965
  });
37881
37966
  }
@@ -38245,7 +38330,7 @@ function loadConfig(config) {
38245
38330
  },
38246
38331
  /**
38247
38332
  * Force to redraw.
38248
- * - **NOTE:** When zoom/subchart is used, the zoomed state will be resetted.
38333
+ * - **NOTE:** When zoom/subchart is used, the zoomed state will be reset.
38249
38334
  * @function flush
38250
38335
  * @instance
38251
38336
  * @memberof Chart
@@ -38334,15 +38419,15 @@ function loadConfig(config) {
38334
38419
  * Get or set config option value.
38335
38420
  * - **NOTE**
38336
38421
  * - The option key name must be specified as the last level.
38337
- * - when no argument is given, will return all specified generation options object only. (will exclude any other options not specified at the initialization)
38422
+ * - When no argument is given, it will return all specified generation options object only. (will exclude any other options not specified at the initialization)
38338
38423
  * @function config
38339
38424
  * @instance
38340
38425
  * @memberof Chart
38341
38426
  * @param {string} name The option key name.
38342
- * @param {*} [value] The value accepted for indicated option.
38427
+ * @param {string|number|boolean|object|Array} [value] The value accepted for indicated option.
38343
38428
  * @param {boolean} [redraw] Set to redraw with the new option changes.
38344
- * - **NOTE:** Doesn't guarantee work in all circumstances. It can be applied for limited options only.
38345
- * @returns {*}
38429
+ * - **NOTE:** Doesn't guarantee to work in all circumstances. It can be applied for limited options only.
38430
+ * @returns {string|number|boolean|object|Array} The option value or all options object
38346
38431
  * @example
38347
38432
  *
38348
38433
  * // Getter
@@ -38439,7 +38524,7 @@ util_extend(api_data_data, {
38439
38524
  * @function data․values
38440
38525
  * @instance
38441
38526
  * @memberof Chart
38442
- * @param {string|Array|null} targetIds This API returns the values of specified target. If this argument is not given, null will be retruned
38527
+ * @param {string|Array|null} targetIds This API returns the values of specified target. If this argument is not given, null will be returned
38443
38528
  * @param {boolean} [flat=true] Get flatten values
38444
38529
  * @returns {Array} Data values
38445
38530
  * @example
@@ -38485,6 +38570,7 @@ util_extend(api_data_data, {
38485
38570
  },
38486
38571
  /**
38487
38572
  * Get and set colors of the data loaded in the chart.
38573
+ * - **NOTE:** If gradient option is set, the color update will affect only gradient stops have the same color.
38488
38574
  * @function data․colors
38489
38575
  * @instance
38490
38576
  * @memberof Chart
@@ -38690,7 +38776,7 @@ function renderText(ctx, glyph) {
38690
38776
  * - Text element's position(especially "transformed") can't be preserved correctly according the page's layout condition.
38691
38777
  * - If need to preserve accurate text position, embed the web font data within to the page and set `preserveFontStyle=false`.
38692
38778
  * - Checkout the embed example: <a href="https://stackblitz.com/edit/zfbya9-8nf9nn?file=index.html">https://stackblitz.com/edit/zfbya9-8nf9nn?file=index.html</a>
38693
- * @param {Function} [callback] The callback to be invoked when export is ready.
38779
+ * @param {function(string): void} [callback] The callback to be invoked when export is ready.
38694
38780
  * @returns {string} dataURI
38695
38781
  * @example
38696
38782
  * chart.export();
@@ -38944,7 +39030,7 @@ const legend_legend = {
38944
39030
  * | categories | Array | The categories specified by axis.x.categories or data.x will be updated. categories must be Array. |
38945
39031
  * | classes | Object | The classes specified by data.classes will be updated. classes must be Object that has target id as keys. |
38946
39032
  * | colors | Object | The colors specified by data.colors will be updated. colors must be Object that has target id as keys. |
38947
- * | data | Obejct | Data objects to be loaded. Checkout the example. |
39033
+ * | data | Object | Data objects to be loaded. Checkout the example. |
38948
39034
  * | done | Function | The specified function will be called after data loaded.|
38949
39035
  * | headers | string | Set request header if loading via `data.url`.<br>@see [data․headers](Options.html#.data%25E2%2580%25A4headers) |
38950
39036
  * | keys | Object | Choose which JSON objects keys correspond to desired data.<br>**NOTE:** Only for JSON object given as array.<br>@see [data․keys](Options.html#.data%25E2%2580%25A4keys) |
@@ -39003,7 +39089,7 @@ const legend_legend = {
39003
39089
  *
39004
39090
  * chart.load({
39005
39091
  * columns: [
39006
- * // when existing chart has `x` value, should provide correponding 'x' value.
39092
+ * // when existing chart has `x` value, should provide corresponding 'x' value.
39007
39093
  * // with 'append' option, the 'data1' will have `[36,30,24,37]`.
39008
39094
  * ["x", "2021-02-01T08:00:00"],
39009
39095
  * ["data1", 37]
@@ -39093,7 +39179,7 @@ const legend_legend = {
39093
39179
  * | key | Type | Description |
39094
39180
  * | --- | --- | --- |
39095
39181
  * | ids | String &vert; Array | Target id data to be unloaded. If not given, all data will be unloaded. |
39096
- * | done | Fuction | Callback after data is unloaded. |
39182
+ * | done | Function | Callback after data is unloaded. |
39097
39183
  * | resizeAfter | boolean | Resize after the unload. Default value is `false`.<br>- This option won't call `onresize` neither `onresized`.<br>- When set to 'true', will call `.flush(true)` at the end of unload. |
39098
39184
  * @example
39099
39185
  * // Unload data2 and data3
@@ -39250,7 +39336,7 @@ const tooltip_tooltip = {
39250
39336
  *
39251
39337
  * @example
39252
39338
  * // show the 2nd x Axis coordinate tooltip
39253
- * // for Arc(gauge, donut & pie) and radar type, approch showing tooltip by using "index" number.
39339
+ * // for Arc(gauge, donut & pie) and radar type, approach showing tooltip by using "index" number.
39254
39340
  * chart.tooltip.show({
39255
39341
  * index: 1
39256
39342
  * });
@@ -39614,7 +39700,7 @@ util_extend(subchart, {
39614
39700
  }
39615
39701
  },
39616
39702
  /**
39617
- * Toggle the visiblity of subchart
39703
+ * Toggle the visibility of subchart
39618
39704
  * - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`.
39619
39705
  * @function subchart․toggle
39620
39706
  * @instance
@@ -40711,7 +40797,7 @@ util_extend(zoom, {
40711
40797
  },
40712
40798
  /**
40713
40799
  * Set zoom transform to event rect
40714
- * @param {Function} x x Axis scale function
40800
+ * @param {function} x x Axis scale function
40715
40801
  * @param {Array} domain Domain value to be set
40716
40802
  * @private
40717
40803
  */
@@ -41021,7 +41107,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41021
41107
  * Returns the toggle method of the target
41022
41108
  * @param {object} that shape
41023
41109
  * @param {object} d Data object
41024
- * @returns {Function} toggle method
41110
+ * @returns {function} toggle method
41025
41111
  * @private
41026
41112
  */
41027
41113
  getToggle(that, d) {
@@ -41120,7 +41206,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41120
41206
  * The callback will receive d as an argument and it has some parameters like id, value, index. This callback should return boolean.
41121
41207
  * @name data․selection․isselectable
41122
41208
  * @memberof Options
41123
- * @type {Function}
41209
+ * @type {function}
41124
41210
  * @default function() { return true; }
41125
41211
  * @example
41126
41212
  * data: {
@@ -41132,7 +41218,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41132
41218
  data_selection_isselectable: () => true,
41133
41219
  /**
41134
41220
  * Set multiple data points selection enabled.<br><br>
41135
- * If this option set true, multile data points can have the selected state at the same time. If false set, only one data point can have the selected state and the others will be unselected when the new data point is selected.
41221
+ * If this option set true, multiple data points can have the selected state at the same time. If false set, only one data point can have the selected state and the others will be unselected when the new data point is selected.
41136
41222
  * @name data․selection․multiple
41137
41223
  * @memberof Options
41138
41224
  * @type {boolean}
@@ -41165,7 +41251,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41165
41251
  * Set a callback for on data selection.
41166
41252
  * @name data․onselected
41167
41253
  * @memberof Options
41168
- * @type {Function}
41254
+ * @type {function}
41169
41255
  * @default function() {}
41170
41256
  * @example
41171
41257
  * data: {
@@ -41182,7 +41268,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41182
41268
  * Set a callback for on data un-selection.
41183
41269
  * @name data․onunselected
41184
41270
  * @memberof Options
41185
- * @type {Function}
41271
+ * @type {function}
41186
41272
  * @default function() {}
41187
41273
  * @example
41188
41274
  * data: {
@@ -41212,11 +41298,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41212
41298
  * @property {boolean} [subchart.showHandle=false] Show sub chart's handle.
41213
41299
  * @property {boolean} [subchart.axis.x.show=true] Show or hide x axis.
41214
41300
  * @property {boolean} [subchart.axis.x.tick.show=true] Show or hide x axis tick line.
41215
- * @property {Function|string} [subchart.axis.x.tick.format] Use custom format for x axis ticks - see [axis.x.tick.format](#.axis․x․tick․format) for details.
41301
+ * @property {function|string} [subchart.axis.x.tick.format] Use custom format for x axis ticks - see [axis.x.tick.format](#.axis․x․tick․format) for details.
41216
41302
  * @property {boolean} [subchart.axis.x.tick.text.show=true] Show or hide x axis tick text.
41217
41303
  * @property {Array} [subchart.init.range] Set initial selection domain range.
41218
41304
  * @property {number} [subchart.size.height] Change the height of the subchart.
41219
- * @property {Function} [subchart.onbrush] Set callback for brush event.<br>
41305
+ * @property {function} [subchart.onbrush] Set callback for brush event.<br>
41220
41306
  * Specified function receives the current zoomed x domain.
41221
41307
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Interaction.SubChart)
41222
41308
  * @example
@@ -41285,14 +41371,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41285
41371
  * @property {Array} [zoom.extent=[1, 10]] Change zoom extent.
41286
41372
  * @property {number|Date} [zoom.x.min] Set x Axis minimum zoom range
41287
41373
  * @property {number|Date} [zoom.x.max] Set x Axis maximum zoom range
41288
- * @property {Function} [zoom.onzoomstart=undefined] Set callback that is called when zooming starts.<br>
41374
+ * @property {function} [zoom.onzoomstart=undefined] Set callback that is called when zooming starts.<br>
41289
41375
  * Specified function receives the zoom event.
41290
- * @property {Function} [zoom.onzoom=undefined] Set callback that is called when the chart is zooming.<br>
41376
+ * @property {function} [zoom.onzoom=undefined] Set callback that is called when the chart is zooming.<br>
41291
41377
  * Specified function receives the zoomed domain.
41292
- * @property {Function} [zoom.onzoomend=undefined] Set callback that is called when zooming ends.<br>
41378
+ * @property {function} [zoom.onzoomend=undefined] Set callback that is called when zooming ends.<br>
41293
41379
  * Specified function receives the zoomed domain.
41294
41380
  * @property {boolean|object} [zoom.resetButton=true] Set to display zoom reset button for 'drag' type zoom
41295
- * @property {Function} [zoom.resetButton.onclick] Set callback when clicks the reset button. The callback will receive reset button element reference as argument.
41381
+ * @property {function} [zoom.resetButton.onclick] Set callback when clicks the reset button. The callback will receive reset button element reference as argument.
41296
41382
  * @property {string} [zoom.resetButton.text='Reset Zoom'] Text value for zoom reset button.
41297
41383
  * @see [Demo:zoom](https://naver.github.io/billboard.js/demo/#Interaction.Zoom)
41298
41384
  * @see [Demo:drag zoom](https://naver.github.io/billboard.js/demo/#Interaction.DragZoom)
@@ -41663,7 +41749,7 @@ const axis = {
41663
41749
  * - If json specified, keys is required as well as data.json.
41664
41750
  * - If tab isn't visible(by evaluating `document.hidden`), will not be executed to prevent unnecessary work.
41665
41751
  * @example
41666
- * // 2 data points will be apprended to the tail and popped from the head.
41752
+ * // 2 data points will be appended to the tail and popped from the head.
41667
41753
  * // After that, 4 data points will be appended and no data points will be poppoed.
41668
41754
  * chart.flow({
41669
41755
  * columns: [
@@ -42297,7 +42383,7 @@ class AxisRendererHelper {
42297
42383
  /**
42298
42384
  * Get tick transform setter function
42299
42385
  * @param {string} id Axis id
42300
- * @returns {Function} transfrom setter function
42386
+ * @returns {(selection: d3Selection, scale) => void} transfrom setter function
42301
42387
  * @private
42302
42388
  */
42303
42389
  getTickTransformSetter(id) {
@@ -43018,7 +43104,7 @@ class Axis_Axis {
43018
43104
  }
43019
43105
  tickValues && axis.tickValues(tickValues);
43020
43106
  axis.tickFormat(
43021
- tickFormat || !isX && ($$.isStackNormalized() && ((x) => `${x}%`))
43107
+ tickFormat || !isX && ($$.isStackNormalized() && $$.hasAxisGroupedData(id) && ((x) => `${x}%`))
43022
43108
  );
43023
43109
  if (isCategory) {
43024
43110
  axis.tickCentered(config.axis_x_tick_centered);
@@ -43646,6 +43732,7 @@ class Axis_Axis {
43646
43732
  const isPrevented = isBoolean(preventDefault) && preventDefault || false;
43647
43733
  const preventThreshold = !isNaN(preventDefault) && preventDefault || null;
43648
43734
  let startPx;
43735
+ const passiveOption = !isPrevented && preventThreshold === null;
43649
43736
  const preventEvent = (event) => {
43650
43737
  const eventType = event.type;
43651
43738
  const touch = event.changedTouches[0];
@@ -43666,7 +43753,7 @@ class Axis_Axis {
43666
43753
  eventRect.on("touchstart", (event) => {
43667
43754
  state.event = event;
43668
43755
  $$.updateEventRect();
43669
- }).on("touchstart.eventRect touchmove.eventRect", (event) => {
43756
+ }, { passive: passiveOption }).on("touchstart.eventRect touchmove.eventRect", (event) => {
43670
43757
  state.event = event;
43671
43758
  if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
43672
43759
  if (state.dragging || state.flowing || $$.hasArcType() || event.touches.length > 1) {
@@ -43677,21 +43764,21 @@ class Axis_Axis {
43677
43764
  } else {
43678
43765
  unselectRect();
43679
43766
  }
43680
- }, true).on("touchend.eventRect", (event) => {
43767
+ }, { passive: passiveOption }).on("touchend.eventRect", (event) => {
43681
43768
  state.event = event;
43682
43769
  if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
43683
43770
  if ($$.hasArcType() || !$$.toggleShape || state.cancelClick) {
43684
43771
  state.cancelClick && (state.cancelClick = false);
43685
43772
  }
43686
43773
  }
43687
- }, true);
43774
+ }, { passive: passiveOption });
43688
43775
  svg.on("touchstart", (event) => {
43689
43776
  state.event = event;
43690
43777
  const { target } = event;
43691
43778
  if (target && target !== eventRect.node()) {
43692
43779
  unselectRect();
43693
43780
  }
43694
- });
43781
+ }, { passive: passiveOption });
43695
43782
  },
43696
43783
  /**
43697
43784
  * Update event rect size
@@ -43893,7 +43980,7 @@ class Axis_Axis {
43893
43980
  const dist = $$.dist(closest, mouse);
43894
43981
  if ($$.isBarType(closest.id) || dist < $$.getPointSensitivity(closest)) {
43895
43982
  $$.$el.svg.select(`.${$EVENT.eventRect}`).style("cursor", "pointer");
43896
- if (triggerEvent && !state.mouseover) {
43983
+ if (triggerEvent && (!state.mouseover || state.mouseover.x !== closest.x || state.mouseover.id !== closest.id)) {
43897
43984
  config.data_onover.call($$.api, closest);
43898
43985
  state.mouseover = closest;
43899
43986
  }
@@ -44066,7 +44153,7 @@ const src_linear_linear = (t) => +t;
44066
44153
  /**
44067
44154
  * Generate flow
44068
44155
  * @param {object} args option object
44069
- * @returns {Function}
44156
+ * @returns {function}
44070
44157
  * @private
44071
44158
  */
44072
44159
  generateFlow(args) {
@@ -45046,7 +45133,7 @@ function smoothLines(el, type) {
45046
45133
  * A function to format tick value. Format string is also available for timeseries data.
45047
45134
  * @name axis․x․tick․format
45048
45135
  * @memberof Options
45049
- * @type {Function|string}
45136
+ * @type {function|string}
45050
45137
  * @default undefined
45051
45138
  * @see [D3's time specifier](https://d3js.org/d3-time-format#locale_format)
45052
45139
  * @example
@@ -45075,7 +45162,7 @@ function smoothLines(el, type) {
45075
45162
  * - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
45076
45163
  * This option does not hide the tick lines by default, if want to hide tick lines, set `axis.x.tick.culling.lines=false`.
45077
45164
  * - `false`: all of ticks will be shown.<br><br>
45078
- * The number of ticks to be shown can be chaned by `axis.x.tick.culling.max`.
45165
+ * The number of ticks to be shown can be changed by `axis.x.tick.culling.max`.
45079
45166
  * @name axis․x․tick․culling
45080
45167
  * @memberof Options
45081
45168
  * @type {boolean}
@@ -45286,10 +45373,10 @@ function smoothLines(el, type) {
45286
45373
  /**
45287
45374
  * Set the x values of ticks manually.<br><br>
45288
45375
  * If this option is provided, the position of the ticks will be determined based on those values.<br>
45289
- * This option works with `timeseries` data and the x values will be parsed accoding to the type of the value and data.xFormat option.
45376
+ * This option works with `timeseries` data and the x values will be parsed according to the type of the value and data.xFormat option.
45290
45377
  * @name axis․x․tick․values
45291
45378
  * @memberof Options
45292
- * @type {Array|Function}
45379
+ * @type {Array|function}
45293
45380
  * @default null
45294
45381
  * @example
45295
45382
  * axis: {
@@ -45510,7 +45597,7 @@ function smoothLines(el, type) {
45510
45597
  * - **timeseries:** Numeric time value
45511
45598
  * ex. the given value `1000*60*60*24`, which is numeric time equivalent of a day, is same as the width of 1 tick width
45512
45599
  * - If want values to be treated as pixels, specify `unit:"px"`.
45513
- * - The pixel value will be convered based on the scale values. Hence can not reflect accurate padding result.
45600
+ * - The pixel value will be converted based on the scale values. Hence can not reflect accurate padding result.
45514
45601
  * @name axis․x․padding
45515
45602
  * @memberof Options
45516
45603
  * @type {object|number}
@@ -45561,7 +45648,7 @@ function smoothLines(el, type) {
45561
45648
  * - **NOTE:** Specifying value, will limit the zoom scope selection within.
45562
45649
  * @name axis․x․extent
45563
45650
  * @memberof Options
45564
- * @type {Array|Function}
45651
+ * @type {Array|function}
45565
45652
  * @default undefined
45566
45653
  * @example
45567
45654
  * axis: {
@@ -45827,7 +45914,7 @@ function smoothLines(el, type) {
45827
45914
  * This option accepts d3.format object as well as a function you define.
45828
45915
  * @name axis․y․tick․format
45829
45916
  * @memberof Options
45830
- * @type {Function}
45917
+ * @type {function}
45831
45918
  * @default undefined
45832
45919
  * @example
45833
45920
  * axis: {
@@ -45846,7 +45933,7 @@ function smoothLines(el, type) {
45846
45933
  * - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
45847
45934
  * This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y.tick.culling.lines=false`.
45848
45935
  * - `false`: all of ticks will be shown.<br><br>
45849
- * The number of ticks to be shown can be chaned by `axis.y.tick.culling.max`.
45936
+ * The number of ticks to be shown can be changed by `axis.y.tick.culling.max`.
45850
45937
  * @name axis․y․tick․culling
45851
45938
  * @memberof Options
45852
45939
  * @type {boolean}
@@ -45952,7 +46039,7 @@ function smoothLines(el, type) {
45952
46039
  * Set y axis tick values manually.
45953
46040
  * @name axis․y․tick․values
45954
46041
  * @memberof Options
45955
- * @type {Array|Function}
46042
+ * @type {Array|function}
45956
46043
  * @default null
45957
46044
  * @example
45958
46045
  * axis: {
@@ -46088,7 +46175,7 @@ function smoothLines(el, type) {
46088
46175
  * @private
46089
46176
  * @type {object}
46090
46177
  * @property {object} time time object
46091
- * @property {Function} [time.value] D3's time interval function (https://github.com/d3/d3-time#intervals)
46178
+ * @property {function} [time.value] D3's time interval function (https://github.com/d3/d3-time#intervals)
46092
46179
  * @example
46093
46180
  * axis: {
46094
46181
  * y: {
@@ -46187,6 +46274,18 @@ function smoothLines(el, type) {
46187
46274
 
46188
46275
  ;// ./src/config/Options/axis/y2.ts
46189
46276
  /* harmony default export */ var y2 = ({
46277
+ /**
46278
+ * Set clip-path attribute for y2 axis element
46279
+ * - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
46280
+ * @name axis․y2․clipPath
46281
+ * @memberof Options
46282
+ * @type {boolean}
46283
+ * @default true
46284
+ * @example
46285
+ * // don't set 'clip-path' attribute
46286
+ * clipPath: false
46287
+ */
46288
+ axis_y2_clipPath: true,
46190
46289
  /**
46191
46290
  * Show or hide y2 axis.
46192
46291
  * - **NOTE**:
@@ -46332,7 +46431,7 @@ function smoothLines(el, type) {
46332
46431
  * This option works in the same way as axis.y.format.
46333
46432
  * @name axis․y2․tick․format
46334
46433
  * @memberof Options
46335
- * @type {Function}
46434
+ * @type {function}
46336
46435
  * @default undefined
46337
46436
  * @example
46338
46437
  * axis: {
@@ -46350,7 +46449,7 @@ function smoothLines(el, type) {
46350
46449
  * - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
46351
46450
  * This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y2.tick.culling.lines=false`.
46352
46451
  * - `false`: all of ticks will be shown.<br><br>
46353
- * The number of ticks to be shown can be chaned by `axis.y2.tick.culling.max`.
46452
+ * The number of ticks to be shown can be changed by `axis.y2.tick.culling.max`.
46354
46453
  * @name axis․y2․tick․culling
46355
46454
  * @memberof Options
46356
46455
  * @type {boolean}
@@ -46457,7 +46556,7 @@ function smoothLines(el, type) {
46457
46556
  * Set y2 axis tick values manually.
46458
46557
  * @name axis․y2․tick․values
46459
46558
  * @memberof Options
46460
- * @type {Array|Function}
46559
+ * @type {Array|function}
46461
46560
  * @default null
46462
46561
  * @example
46463
46562
  * axis: {
@@ -46689,16 +46788,16 @@ var axis_spreadValues = (a, b) => {
46689
46788
  /**
46690
46789
  * Setup the way to evaluate tick text size.
46691
46790
  * - **NOTE:**
46692
- * - Setting `false` or custom evaluator, highly recommended to memoize evaluated text dimension value to not degrade performance.
46791
+ * - When setting `false` or a custom evaluator, it is highly recommended to memoize evaluated text dimension value to not degrade performance.
46693
46792
  * @name axis․evalTextSize
46694
46793
  * @memberof Options
46695
- * @type {boolean|Function}
46794
+ * @type {boolean|function}
46696
46795
  * @default true
46697
46796
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.AxisEvalTextSize)
46698
46797
  * @example
46699
46798
  * axis: {
46700
46799
  * // will evaluate getting text size every time.
46701
- * evalTextSize: false.
46800
+ * evalTextSize: false,
46702
46801
  *
46703
46802
  * // set a custom evaluator
46704
46803
  * evalTextSize: function(textElement, axisId) {
@@ -46742,8 +46841,8 @@ var axis_spreadValues = (a, b) => {
46742
46841
  * Set axis tooltip.
46743
46842
  * - **NOTE:**
46744
46843
  * - When enabled, will disable default focus grid line.
46745
- * - For `timeseries` x Axis, tootlip will be formatted using x Axis' tick format.
46746
- * - For `category` x Axis, tootlip will be displaying scales' value text.
46844
+ * - For `timeseries` x Axis, tooltip will be formatted using x Axis' tick format.
46845
+ * - For `category` x Axis, tooltip will be displaying scales' value text.
46747
46846
  * @name axis․tooltip
46748
46847
  * @memberof Options
46749
46848
  * @type {boolean}
@@ -46756,11 +46855,11 @@ var axis_spreadValues = (a, b) => {
46756
46855
  * axis: {
46757
46856
  * tooltip: true, // default background color is
46758
46857
  *
46759
- * // set backgound color for axis tooltip texts
46858
+ * // set background color for axis tooltip texts
46760
46859
  * tooltip: {
46761
46860
  * backgroundColor: "red",
46762
46861
  *
46763
- * // set differenct backround colors per axes
46862
+ * // set different background colors per axes
46764
46863
  * // NOTE: In this case, only specified axes tooltip will appear.
46765
46864
  * backgroundColor: {
46766
46865
  * x: "green",
@@ -46865,7 +46964,7 @@ var axis_spreadValues = (a, b) => {
46865
46964
  */
46866
46965
  data_xs: {},
46867
46966
  /**
46868
- * Set a format specifier to parse string specifed as x.
46967
+ * Set a format specifier to parse string specified as x.
46869
46968
  * @name data․xFormat
46870
46969
  * @memberof Options
46871
46970
  * @type {string}
@@ -46914,7 +47013,7 @@ var axis_spreadValues = (a, b) => {
46914
47013
  * x: "x",
46915
47014
  * columns: [
46916
47015
  * // The line graph will start to be drawn following the x axis sequence
46917
- * // Below data, wil start drawing x=1: 200, x=2: 300, x=3: 100
47016
+ * // Below data, will start drawing x=1: 200, x=2: 300, x=3: 100
46918
47017
  * ["x", 3, 1, 2],
46919
47018
  * ["data1", 100, 200, 300]
46920
47019
  * ]
@@ -46975,16 +47074,41 @@ var axis_spreadValues = (a, b) => {
46975
47074
  * - **NOTE:**
46976
47075
  * - For stacking, '[data.groups](#.data%25E2%2580%25A4groups)' option should be set
46977
47076
  * - y Axis will be set in percentage value (0 ~ 100%)
46978
- * - Must have postive values
47077
+ * - Must have positive values
47078
+ * - Data not in any group will not be normalized when using perGroup option
46979
47079
  * @name data․stack․normalize
46980
47080
  * @memberof Options
46981
- * @type {boolean}
47081
+ * @type {boolean|object}
46982
47082
  * @default false
46983
- * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataStackNormalized)
47083
+ * @see [Demo: Data Stack Normalized](https://naver.github.io/billboard.js/demo/#Data.DataStackNormalized)
47084
+ * @see [Demo: Data Stack Normalized per Group](https://naver.github.io/billboard.js/demo/#Data.DataStackNormalizedGroup)
46984
47085
  * @example
46985
47086
  * data: {
46986
47087
  * stack: {
47088
+ * // Normalize all grouped data together (all groups combined to 0-100%)
46987
47089
  * normalize: true
47090
+ *
47091
+ * // Normalize per group (each group independently becomes 0-100%)
47092
+ * // Data not in any group will display with their original values.
47093
+ * // If non-grouped data shares the same axis (e.g., y), it will be
47094
+ * // displayed on the 0-100 absolute scale. To display original values,
47095
+ * // assign them to a separate axis (e.g., y2).
47096
+ * normalize: {
47097
+ * perGroup: true
47098
+ * }
47099
+ * },
47100
+ * groups: [
47101
+ * ["data1", "data2"] // This group will be normalized to 0-100%
47102
+ * ],
47103
+ * // data3 is not in any group, so it displays original values
47104
+ * // Assign it to y2 axis to use a separate scale
47105
+ * axes: {
47106
+ * data3: "y2"
47107
+ * }
47108
+ * },
47109
+ * axis: {
47110
+ * y2: {
47111
+ * show: true
46988
47112
  * }
46989
47113
  * }
46990
47114
  */
@@ -47355,6 +47479,155 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
47355
47479
  return arc;
47356
47480
  }
47357
47481
 
47482
+ ;// ./src/ChartInternal/internals/text.arc.ts
47483
+
47484
+
47485
+
47486
+
47487
+ const BREAK_POINT_OFFSET = 15;
47488
+ const DEFAULT_LINE_DISTANCE = 20;
47489
+ const TEXT_VERTICAL_OFFSET = 0.35;
47490
+ function getArcType(excludeMultiGauge = false) {
47491
+ const $$ = this;
47492
+ return ["donut", "pie", "polar", "gauge"].find(
47493
+ (type) => $$.hasType(type) && !(type === "gauge" && excludeMultiGauge && $$.hasMultiArcGauge())
47494
+ );
47495
+ }
47496
+ function getConfig() {
47497
+ const $$ = this;
47498
+ const { config } = $$;
47499
+ const chartType = getArcType.call($$, true);
47500
+ const lineConfig = chartType && config[`${chartType}_label_line`];
47501
+ const isValidConfig = isObjectType(lineConfig);
47502
+ const defaultFormatter = (value, ratio, id) => id;
47503
+ const line = {
47504
+ show: lineConfig === true || isValidConfig && (lineConfig == null ? void 0 : lineConfig.show) !== false,
47505
+ distance: isValidConfig && (lineConfig == null ? void 0 : lineConfig.distance) || DEFAULT_LINE_DISTANCE
47506
+ };
47507
+ if (lineConfig === true) {
47508
+ return {
47509
+ chartType,
47510
+ line,
47511
+ text: { formatter: defaultFormatter }
47512
+ };
47513
+ }
47514
+ if (!isValidConfig) {
47515
+ return {
47516
+ chartType,
47517
+ line: { show: false, distance: DEFAULT_LINE_DISTANCE },
47518
+ text: { formatter: null }
47519
+ };
47520
+ }
47521
+ let formatter = defaultFormatter;
47522
+ if (isFunction(lineConfig.text)) {
47523
+ formatter = lineConfig.text;
47524
+ } else if (lineConfig.text === false) {
47525
+ formatter = null;
47526
+ }
47527
+ return {
47528
+ chartType,
47529
+ line,
47530
+ text: { formatter }
47531
+ };
47532
+ }
47533
+ function getLinePosition(d, lineDistance) {
47534
+ const $$ = this;
47535
+ const { state } = $$;
47536
+ const updated = $$.updateAngle(d);
47537
+ if (!updated) {
47538
+ return null;
47539
+ }
47540
+ let { outerRadius } = $$.getRadius(d);
47541
+ let arcOuterRadius = outerRadius;
47542
+ if ($$.hasType("polar")) {
47543
+ arcOuterRadius = $$.getPolarOuterRadius(d, outerRadius);
47544
+ outerRadius = state.radius;
47545
+ }
47546
+ let midAngle = (updated.startAngle + updated.endAngle) / 2;
47547
+ const isFullCircleArc = Math.abs(updated.endAngle - updated.startAngle - 2 * Math.PI) < 0.01;
47548
+ if (isFullCircleArc) {
47549
+ midAngle = Math.PI / 2;
47550
+ }
47551
+ const sinAngle = Math.sin(midAngle);
47552
+ const cosAngle = -Math.cos(midAngle);
47553
+ const startPoint = {
47554
+ x: sinAngle * arcOuterRadius,
47555
+ y: cosAngle * arcOuterRadius
47556
+ };
47557
+ const breakRadius = outerRadius + BREAK_POINT_OFFSET;
47558
+ const breakPoint = {
47559
+ x: sinAngle * breakRadius,
47560
+ y: cosAngle * breakRadius
47561
+ };
47562
+ const isRight = sinAngle >= 0;
47563
+ const endPoint = {
47564
+ x: breakPoint.x + lineDistance * (isRight ? 1 : -1),
47565
+ y: breakPoint.y
47566
+ };
47567
+ return { startPoint, breakPoint, endPoint, isRight, midAngle };
47568
+ }
47569
+ function isLabelWithLine() {
47570
+ return getConfig.call(this).line.show;
47571
+ }
47572
+ function redrawArcLabelLines(duration) {
47573
+ const $$ = this;
47574
+ const { $el: { arcs }, $T } = $$;
47575
+ const { line: lineConfig, text: textConfig } = getConfig.call($$);
47576
+ const lineDistance = lineConfig.distance;
47577
+ let cachedFontSize = null;
47578
+ arcs.selectAll(`.${$ARC.chartArc}`).each(function(d) {
47579
+ var _a, _b, _c;
47580
+ const g = src_select(this);
47581
+ const linePos = getLinePosition.call($$, d, lineDistance);
47582
+ const { ratio, meetsThreshold, updated } = (_a = d._cache) != null ? _a : {};
47583
+ if (!updated || !linePos) {
47584
+ return;
47585
+ }
47586
+ const isVisible = $$.isTargetToShow(d.data.id) && meetsThreshold;
47587
+ const { startPoint, breakPoint, endPoint, isRight } = linePos;
47588
+ const points = `${startPoint.x},${startPoint.y} ${breakPoint.x},${breakPoint.y} ${endPoint.x},${endPoint.y}`;
47589
+ if (lineConfig.show) {
47590
+ let line = g.select(`.${$ARC.arcLabelLine}`);
47591
+ if (line.empty()) {
47592
+ line = g.append("polyline").attr("class", $ARC.arcLabelLine);
47593
+ }
47594
+ $T(line, duration).attr("points", points).style("stroke", $$.color(d.data)).style("opacity", isVisible ? null : "0");
47595
+ }
47596
+ let labelLineText = g.select(`.${$ARC.arcLabelLineText}`);
47597
+ if (labelLineText.empty()) {
47598
+ labelLineText = g.append("text").attr("class", $ARC.arcLabelLineText).style("pointer-events", "none");
47599
+ }
47600
+ if (isVisible) {
47601
+ const { value } = updated;
47602
+ const { id } = d.data;
47603
+ const text = ((_c = (_b = textConfig.formatter) != null ? _b : $$.getArcLabelConfig("format")) != null ? _c : $$.defaultArcValueFormat)(value, ratio, id).toString();
47604
+ setTextValue(labelLineText, text, [-1, 1], false);
47605
+ const pos = {
47606
+ x: endPoint.x + 5 * (isRight ? 1 : -1),
47607
+ // 5: label offset from endpoint
47608
+ y: endPoint.y
47609
+ };
47610
+ labelLineText.style("text-anchor", isRight ? "start" : "end");
47611
+ const textNode = labelLineText.node();
47612
+ const tspanNodes = textNode == null ? void 0 : textNode.querySelectorAll("tspan");
47613
+ if (cachedFontSize === null) {
47614
+ cachedFontSize = parseFloat(win.getComputedStyle(textNode).fontSize) || 12;
47615
+ }
47616
+ if (tspanNodes && tspanNodes.length > 1) {
47617
+ const lineCount = tspanNodes.length;
47618
+ const centerOffset = (lineCount - 3) / 2;
47619
+ pos.y += (-centerOffset + TEXT_VERTICAL_OFFSET) * cachedFontSize;
47620
+ } else {
47621
+ pos.y += TEXT_VERTICAL_OFFSET * cachedFontSize;
47622
+ }
47623
+ $T(labelLineText, duration).attr("transform", `translate(${pos.x},${pos.y})`).style("opacity", null).style("fill", $$.updateTextColor.bind($$)(d));
47624
+ } else {
47625
+ $T(labelLineText, duration).style("opacity", "0");
47626
+ }
47627
+ });
47628
+ }
47629
+
47630
+
47358
47631
  ;// ./src/ChartInternal/shape/arc.ts
47359
47632
  var arc_defProp = Object.defineProperty;
47360
47633
  var arc_defProps = Object.defineProperties;
@@ -47382,6 +47655,62 @@ var arc_spreadProps = (a, b) => arc_defProps(a, arc_getOwnPropDescs(b));
47382
47655
 
47383
47656
 
47384
47657
 
47658
+
47659
+ function arc_getArcType($$) {
47660
+ return ["donut", "pie", "polar", "gauge"].find((type) => $$.hasType(type));
47661
+ }
47662
+ function calculateRangeOrGaugePosition($$, d, updated, forRange) {
47663
+ var _a, _b;
47664
+ const { config, state: { radiusExpanded } } = $$;
47665
+ const angle = updated.endAngle - Math.PI / 2;
47666
+ const sinAngle = Math.sin(angle);
47667
+ const pos = {
47668
+ x: Math.cos(angle) * (radiusExpanded + (forRange ? 5 : 25)),
47669
+ // 5: range offset, 25: gauge offset
47670
+ y: sinAngle * (radiusExpanded + 15 - Math.abs(sinAngle * 10)) + 3
47671
+ // 10: y factor, 3: y offset
47672
+ };
47673
+ if (forRange) {
47674
+ const rangeTextPosition = config.arc_rangeText_position;
47675
+ if (rangeTextPosition) {
47676
+ const rangeValues = config.arc_rangeText_values;
47677
+ const position = isFunction(rangeTextPosition) ? rangeTextPosition(rangeValues[d.index]) : rangeTextPosition;
47678
+ pos.x += (_a = position == null ? void 0 : position.x) != null ? _a : 0;
47679
+ pos.y += (_b = position == null ? void 0 : position.y) != null ? _b : 0;
47680
+ }
47681
+ }
47682
+ return pos;
47683
+ }
47684
+ function calculateLabelRatio($$, d, outerRadius, distance) {
47685
+ const { config } = $$;
47686
+ const chartType = arc_getArcType($$);
47687
+ let ratio = chartType ? config[`${chartType}_label_ratio`] : void 0;
47688
+ if (ratio) {
47689
+ ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, distance) : ratio;
47690
+ } else {
47691
+ const LABEL_MIN_SIZE = 36;
47692
+ const LABEL_RATIO_THRESHOLD = 0.375;
47693
+ const LABEL_RATIO_BASE = 1.175;
47694
+ const LABEL_RATIO_LARGE = 0.8;
47695
+ const labelSpaceRatio = LABEL_MIN_SIZE / outerRadius;
47696
+ const isSmallChart = labelSpaceRatio > LABEL_RATIO_THRESHOLD;
47697
+ ratio = outerRadius && distance ? (isSmallChart ? LABEL_RATIO_BASE - labelSpaceRatio : LABEL_RATIO_LARGE) * outerRadius / distance : 0;
47698
+ }
47699
+ return ratio;
47700
+ }
47701
+ function calculateStandardArcPosition($$, d, updated) {
47702
+ let { outerRadius } = $$.getRadius(d);
47703
+ if ($$.hasType("polar")) {
47704
+ outerRadius = $$.getPolarOuterRadius(d, outerRadius);
47705
+ }
47706
+ const [x, y] = $$.svgArc.centroid(updated).map((v) => isNaN(v) ? 0 : v);
47707
+ const distance = Math.sqrt(x * x + y * y);
47708
+ const ratio = calculateLabelRatio($$, d, outerRadius, distance);
47709
+ return {
47710
+ pos: { x, y },
47711
+ ratio
47712
+ };
47713
+ }
47385
47714
  function getRadiusFn(expandRate = 0) {
47386
47715
  const $$ = this;
47387
47716
  const { config, state } = $$;
@@ -47489,7 +47818,9 @@ function getAttrTweenFn(fn) {
47489
47818
  const padding = config[`${dataType}_padding`];
47490
47819
  const w = config.gauge_width || config.donut_width;
47491
47820
  const gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length * config.gauge_arcs_minWidth;
47492
- state.radiusExpanded = Math.min(state.arcWidth, state.arcHeight) / 2 * ($$.hasMultiArcGauge() && config.gauge_label_show ? 0.85 : 1);
47821
+ const LABEL_RADIUS_RATIO = 0.85;
47822
+ const labelWithLineRatio = isLabelWithLine.call($$) ? LABEL_RADIUS_RATIO : 1;
47823
+ state.radiusExpanded = Math.min(state.arcWidth, state.arcHeight) / 2 * ($$.hasMultiArcGauge() && config.gauge_label_show ? LABEL_RADIUS_RATIO : labelWithLineRatio);
47493
47824
  state.radius = state.radiusExpanded * 0.95;
47494
47825
  state.innerRadiusRatio = w ? (state.radius - w) / state.radius : 0.6;
47495
47826
  state.gaugeArcWidth = w || (gaugeArcWidth <= state.radius - state.innerRadius ? state.radius - state.innerRadius : gaugeArcWidth <= state.radius ? gaugeArcWidth : state.radius);
@@ -47628,7 +47959,7 @@ function getAttrTweenFn(fn) {
47628
47959
  /**
47629
47960
  * Get expanded arc path function
47630
47961
  * @param {number} rate Expand rate
47631
- * @returns {Function} Expanded arc path getter function
47962
+ * @returns {function} Expanded arc path getter function
47632
47963
  * @private
47633
47964
  */
47634
47965
  getSvgArcExpanded(rate = 1) {
@@ -47691,46 +48022,24 @@ function getAttrTweenFn(fn) {
47691
48022
  * @private
47692
48023
  */
47693
48024
  transformForArcLabel(textNode, d, forRange = false) {
47694
- var _a, _b, _c;
47695
48025
  const $$ = this;
47696
- const { config, state: { radiusExpanded } } = $$;
47697
48026
  const updated = $$.updateAngle(d, forRange);
47698
- const pos = { x: 0, y: 0 };
47699
- let translate = "";
48027
+ if (!updated) {
48028
+ return "";
48029
+ }
48030
+ let pos;
47700
48031
  let ratio = 1;
47701
- if (updated) {
47702
- if (forRange || $$.hasMultiArcGauge()) {
47703
- const y1 = Math.sin(updated.endAngle - Math.PI / 2);
47704
- const rangeTextPosition = config.arc_rangeText_position;
47705
- pos.x = Math.cos(updated.endAngle - Math.PI / 2) * (radiusExpanded + (forRange ? 5 : 25));
47706
- pos.y = y1 * (radiusExpanded + 15 - Math.abs(y1 * 10)) + 3;
47707
- if (forRange && rangeTextPosition) {
47708
- const rangeValues = config.arc_rangeText_values;
47709
- const position = isFunction(rangeTextPosition) ? rangeTextPosition(rangeValues[d.index]) : rangeTextPosition;
47710
- pos.x += (_a = position == null ? void 0 : position.x) != null ? _a : 0;
47711
- pos.y += (_b = position == null ? void 0 : position.y) != null ? _b : 0;
47712
- }
47713
- } else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
47714
- let { outerRadius } = $$.getRadius(d);
47715
- if ($$.hasType("polar")) {
47716
- outerRadius = $$.getPolarOuterRadius(d, outerRadius);
47717
- }
47718
- const c = this.svgArc.centroid(updated);
47719
- const [x, y] = c.map((v) => isNaN(v) ? 0 : v);
47720
- const h = Math.sqrt(x * x + y * y);
47721
- pos.x = x;
47722
- pos.y = y;
47723
- ratio = (_c = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).map((v) => config[`${v}_label_ratio`])) == null ? void 0 : _c[0];
47724
- if (ratio) {
47725
- ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
47726
- } else {
47727
- ratio = outerRadius && (h ? (36 / outerRadius > 0.375 ? 1.175 - 36 / outerRadius : 0.8) * outerRadius / h : 0);
47728
- }
47729
- }
47730
- updateTextImagePos.call($$, textNode, pos);
47731
- translate = `translate(${pos.x * ratio},${pos.y * ratio})`;
48032
+ if (forRange || $$.hasMultiArcGauge()) {
48033
+ pos = calculateRangeOrGaugePosition($$, d, updated, forRange);
48034
+ } else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
48035
+ const result = calculateStandardArcPosition($$, d, updated);
48036
+ pos = result.pos;
48037
+ ratio = result.ratio;
48038
+ } else {
48039
+ return "";
47732
48040
  }
47733
- return translate;
48041
+ updateTextImagePos.call($$, textNode, pos);
48042
+ return `translate(${pos.x * ratio},${pos.y * ratio})`;
47734
48043
  },
47735
48044
  convertToArcData(d) {
47736
48045
  return this.addName({
@@ -47741,20 +48050,18 @@ function getAttrTweenFn(fn) {
47741
48050
  });
47742
48051
  },
47743
48052
  textForArcLabel(selection) {
48053
+ var _a;
47744
48054
  const $$ = this;
47745
48055
  const hasGauge = $$.hasType("gauge");
48056
+ const chartType = (_a = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _a[0];
47746
48057
  if ($$.shouldShowArcLabel()) {
47747
48058
  selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", (d) => $$.updateTextBGColor.bind($$)(d, $$.config.data_labels_backgroundColors)).each(function(d) {
47748
- var _a;
47749
48059
  const node = src_select(this);
47750
48060
  const updated = $$.updateAngle(d);
47751
48061
  const ratio = $$.getRatio("arc", updated);
47752
- const isUnderThreshold = meetsLabelThreshold.call(
47753
- $$,
47754
- ratio,
47755
- (_a = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _a[0]
47756
- );
47757
- if (isUnderThreshold) {
48062
+ const meetsThreshold = meetsLabelThreshold.call($$, ratio, chartType);
48063
+ d._cache = { updated, ratio, meetsThreshold };
48064
+ if (meetsThreshold) {
47758
48065
  const { value } = updated || d;
47759
48066
  const text = ($$.getArcLabelConfig("format") || $$.defaultArcValueFormat)(value, ratio, d.data.id).toString();
47760
48067
  setTextValue(node, text, [-1, 1], hasGauge);
@@ -47861,7 +48168,7 @@ function getAttrTweenFn(fn) {
47861
48168
  ])
47862
48169
  );
47863
48170
  mainPieEnter.append("g").attr("class", classArcs).merge(mainPieUpdate);
47864
- mainPieEnter.append("text").attr("dy", hasGauge && !$$.hasMultiTargets() ? "-.1em" : ".35em").style("opacity", "0").style("text-anchor", $$.getStylePropValue("middle")).style("pointer-events", $$.getStylePropValue("none"));
48171
+ mainPieEnter.append("text").attr("dy", hasGauge && !$$.hasMultiTargets() ? "-.1em" : null).style("opacity", "0").style("text-anchor", $$.getStylePropValue("middle")).style("pointer-events", $$.getStylePropValue("none"));
47865
48172
  $el.text = chartArcs.selectAll(`.${$COMMON.target} text`);
47866
48173
  },
47867
48174
  initArc() {
@@ -48171,7 +48478,7 @@ function getAttrTweenFn(fn) {
48171
48478
  const id = (arcData == null ? void 0 : arcData.id) || void 0;
48172
48479
  $$.callOverOutForTouch(arcData);
48173
48480
  isUndefined(id) ? unselectArc() : selectArc(this, arcData, id);
48174
- });
48481
+ }, { passive: true });
48175
48482
  }
48176
48483
  },
48177
48484
  redrawArcText(duration) {
@@ -48201,6 +48508,7 @@ function getAttrTweenFn(fn) {
48201
48508
  !isFullCircle && arcs.select(`.${$GAUGE.chartArcsGaugeMax}`).attr("dx", `${state.innerRadius + (state.radius - state.innerRadius) / 2}px`).attr("dy", "1.2em").text($$.textForGaugeMinMax(config.gauge_max, true));
48202
48509
  }
48203
48510
  }
48511
+ isLabelWithLine.call($$) && redrawArcLabelLines.call($$, duration);
48204
48512
  },
48205
48513
  /**
48206
48514
  * Get Arc element by id or index
@@ -48387,7 +48695,7 @@ function point_y(p) {
48387
48695
  },
48388
48696
  /**
48389
48697
  * Redraw function
48390
- * @param {Function} drawFn Retuned functino from .generateDrawCandlestick()
48698
+ * @param {function} drawFn Retuned functino from .generateDrawCandlestick()
48391
48699
  * @param {boolean} withTransition With or without transition
48392
48700
  * @param {boolean} isSub Subchart draw
48393
48701
  * @returns {Array}
@@ -48407,7 +48715,7 @@ function point_y(p) {
48407
48715
  * Generate area path data
48408
48716
  * @param {object} areaIndices Indices
48409
48717
  * @param {boolean} isSub Weather is sub axis
48410
- * @returns {Function}
48718
+ * @returns {function}
48411
48719
  * @private
48412
48720
  */
48413
48721
  generateDrawArea(areaIndices, isSub) {
@@ -48551,7 +48859,7 @@ function getConnectLineType(id) {
48551
48859
  },
48552
48860
  /**
48553
48861
  * Redraw function
48554
- * @param {Function} drawFn Retuned function from .getDrawShape() => .generateDrawBar()
48862
+ * @param {function} drawFn Retuned function from .getDrawShape() => .generateDrawBar()
48555
48863
  * @param {boolean} withTransition With or without transition
48556
48864
  * @param {boolean} isSub Subchart draw
48557
48865
  * @returns {Array}
@@ -48598,7 +48906,7 @@ function getConnectLineType(id) {
48598
48906
  * -------------------------
48599
48907
  * 0 1
48600
48908
  * @param {boolean} isSub If is for subchart
48601
- * @returns {Function}
48909
+ * @returns {function}
48602
48910
  * @private
48603
48911
  */
48604
48912
  generateDrawBar(barIndices, isSub) {
@@ -48893,7 +49201,7 @@ var candlestick_spreadValues = (a, b) => {
48893
49201
  * Get draw function
48894
49202
  * @param {object} indices Indice data
48895
49203
  * @param {boolean} isSub Subchart draw
48896
- * @returns {Function}
49204
+ * @returns {function}
48897
49205
  * @private
48898
49206
  */
48899
49207
  generateDrawCandlestick(indices, isSub) {
@@ -48937,7 +49245,7 @@ var candlestick_spreadValues = (a, b) => {
48937
49245
  * Generate shape drawing points
48938
49246
  * @param {object} indices Indice data
48939
49247
  * @param {boolean} isSub Subchart draw
48940
- * @returns {Function}
49248
+ * @returns {function}
48941
49249
  */
48942
49250
  generateGetCandlestickPoints(indices, isSub = false) {
48943
49251
  const $$ = this;
@@ -48983,7 +49291,7 @@ var candlestick_spreadValues = (a, b) => {
48983
49291
  },
48984
49292
  /**
48985
49293
  * Redraw function
48986
- * @param {Function} drawFn Retuned functino from .generateDrawCandlestick()
49294
+ * @param {function} drawFn Retuned functino from .generateDrawCandlestick()
48987
49295
  * @param {boolean} withTransition With or without transition
48988
49296
  * @param {boolean} isSub Subchart draw
48989
49297
  * @returns {Array}
@@ -49195,7 +49503,7 @@ function updateRatio(data) {
49195
49503
  $$.showTooltip([data], event.target);
49196
49504
  /^(touchstart|mouseover)$/.test(event.type) && $$.setOverOut(true, data);
49197
49505
  }
49198
- }).on(isTouch ? "touchend" : "mouseout", (event) => {
49506
+ }, isTouch ? { passive: true } : void 0).on(isTouch ? "touchend" : "mouseout", (event) => {
49199
49507
  const data = getTarget(event);
49200
49508
  if (config.interaction_onout) {
49201
49509
  $$.hideTooltip();
@@ -49446,7 +49754,7 @@ function getRegions(d, _regions, isTimeSeries) {
49446
49754
  },
49447
49755
  /**
49448
49756
  * Redraw function
49449
- * @param {Function} drawFn Retuned functino from .generateDrawCandlestick()
49757
+ * @param {function} drawFn Retuned functino from .generateDrawCandlestick()
49450
49758
  * @param {boolean} withTransition With or without transition
49451
49759
  * @param {boolean} isSub Subchart draw
49452
49760
  * @returns {Array}
@@ -49463,7 +49771,7 @@ function getRegions(d, _regions, isTimeSeries) {
49463
49771
  /**
49464
49772
  * Get the curve interpolate
49465
49773
  * @param {Array} d Data object
49466
- * @returns {Function}
49774
+ * @returns {function}
49467
49775
  * @private
49468
49776
  */
49469
49777
  getCurve(d) {
@@ -49533,8 +49841,8 @@ function getRegions(d, _regions, isTimeSeries) {
49533
49841
  /**
49534
49842
  * Set regions dasharray and get path
49535
49843
  * @param {Array} d Data object
49536
- * @param {Function} x x scale function
49537
- * @param {Function} y y scale function
49844
+ * @param {function} x x scale function
49845
+ * @param {function} y y scale function
49538
49846
  * @param {object} _regions regions to be set
49539
49847
  * @returns {stirng} Path string
49540
49848
  * @private
@@ -50131,7 +50439,7 @@ function insertPointInfoDefs(point, id) {
50131
50439
  },
50132
50440
  /**
50133
50441
  * Get generate point function
50134
- * @returns {Function}
50442
+ * @returns {function}
50135
50443
  * @private
50136
50444
  */
50137
50445
  generatePoint() {
@@ -50480,9 +50788,9 @@ const cacheKeyTextWidth = KEY.radarTextWidth;
50480
50788
  const index = $$.getDataIndexFromEvent(event);
50481
50789
  $$.selectRectForSingle(svg.node(), index);
50482
50790
  isMouse ? $$.setOverOut(true, index) : $$.callOverOutForTouch(index);
50483
- }).on("mouseout", isMouse ? hide : null);
50791
+ }, isMouse ? void 0 : { passive: true }).on("mouseout", isMouse ? hide : null);
50484
50792
  if (!isMouse) {
50485
- svg.on("touchstart", hide);
50793
+ svg.on("touchstart", hide, { passive: true });
50486
50794
  }
50487
50795
  },
50488
50796
  updateRadarShape() {
@@ -51050,7 +51358,7 @@ function getHierachyData(data) {
51050
51358
  $$.showTooltip([data], event.currentTarget);
51051
51359
  /^(touchstart|mouseover)$/.test(event.type) && $$.setOverOut(true, data);
51052
51360
  }
51053
- }).on(isTouch ? "touchend" : "mouseout", (event) => {
51361
+ }, isTouch ? { passive: true } : void 0).on(isTouch ? "touchend" : "mouseout", (event) => {
51054
51362
  const data = getTarget(event);
51055
51363
  if (config.interaction_onout) {
51056
51364
  $$.hideTooltip();
@@ -51061,7 +51369,7 @@ function getHierachyData(data) {
51061
51369
  },
51062
51370
  /**
51063
51371
  * Get tiling function
51064
- * @returns {Function}
51372
+ * @returns {function}
51065
51373
  * @private
51066
51374
  */
51067
51375
  getTreemapTile() {
@@ -51162,20 +51470,28 @@ function getHierachyData(data) {
51162
51470
  /**
51163
51471
  * Get treemap data label format function
51164
51472
  * @param {object} d Data object
51165
- * @returns {Function}
51473
+ * @returns {function} Label formatter function
51166
51474
  * @private
51167
51475
  */
51168
51476
  treemapDataLabelFormat(d) {
51169
51477
  const $$ = this;
51170
- const { config } = $$;
51478
+ const { $el: { treemap }, config, scale: { x, y } } = $$;
51171
51479
  const { id, value } = d;
51172
51480
  const format = config.treemap_label_format;
51173
51481
  const ratio = $$.getRatio("treemap", d);
51174
51482
  const percentValue = (ratio * 100).toFixed(2);
51175
51483
  const meetLabelThreshold = config.treemap_label_show && meetsLabelThreshold.call($$, ratio, "treemap") ? null : "0";
51484
+ const treemapNode = treemap.selectAll("g").filter((node) => node.data.id === id).datum();
51485
+ let width = 0;
51486
+ let height = 0;
51487
+ if (treemapNode) {
51488
+ const { x0, x1, y0, y1 } = treemapNode;
51489
+ width = x(x1) - x(x0);
51490
+ height = y(y1) - y(y0);
51491
+ }
51176
51492
  return function(node) {
51177
51493
  node.style("opacity", meetLabelThreshold);
51178
- return isFunction(format) ? format.bind($$.api)(value, ratio, id) : `${id}
51494
+ return isFunction(format) ? format.bind($$.api)(value, ratio, id, { width, height }) : `${id}
51179
51495
  ${percentValue}%`;
51180
51496
  };
51181
51497
  }
@@ -51190,7 +51506,7 @@ ${percentValue}%`;
51190
51506
  * @type {object}
51191
51507
  * @property {object} point Point object
51192
51508
  * @property {boolean} [point.show=true] Whether to show each point in line.
51193
- * @property {number|Function} [point.r=2.5] The radius size of each point.
51509
+ * @property {number|function} [point.r=2.5] The radius size of each point.
51194
51510
  * - **NOTE:** Disabled for 'bubble' type
51195
51511
  * @property {boolean|object} [point.radialGradient=false] Set the radial gradient on point.<br><br>
51196
51512
  * Or customize by giving below object value:
@@ -51207,7 +51523,7 @@ ${percentValue}%`;
51207
51523
  * - **NOTE:**
51208
51524
  * - `null` will make to not set inline 'opacity' css prop.
51209
51525
  * - when no value(or undefined) is set, it defaults to set opacity value according its chart types.
51210
- * @property {number|string|Function} [point.sensitivity=10] The senstivity value for interaction boundary.
51526
+ * @property {number|string|function} [point.sensitivity=10] The sensitivity value for interaction boundary.
51211
51527
  * - **Available Values:**
51212
51528
  * - {number}: Absolute sensitivity value which is the distance from the data point in pixel.
51213
51529
  * - "radius": sensitivity based on point's radius
@@ -51254,7 +51570,7 @@ ${percentValue}%`;
51254
51570
  * return r;
51255
51571
  * },
51256
51572
  *
51257
- * // will generate follwing radialGradient:
51573
+ * // will generate following radialGradient:
51258
51574
  * // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/radialGradient
51259
51575
  * // <radualGradient cx="0.3" cy="0.3" r="0.7">
51260
51576
  * // <stop offset="0.1" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
@@ -51370,7 +51686,7 @@ ${percentValue}%`;
51370
51686
  * // <g class='bb-areas'> will be positioned behind the line <g class='bb-lines'> in stacking order
51371
51687
  * front: false,
51372
51688
  *
51373
- * // will generate follwing linearGradient:
51689
+ * // will generate following linearGradient:
51374
51690
  * // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient
51375
51691
  * // <linearGradient x1="0" x2="0" y1="0" y2="1">
51376
51692
  * // <stop offset="0" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
@@ -51424,8 +51740,8 @@ ${percentValue}%`;
51424
51740
  * @property {number} [bar.padding=0] The padding pixel value between each bar.
51425
51741
  * @property {number} [bar.radius] Set the radius of bar edge in pixel.
51426
51742
  * @property {number} [bar.radius.ratio] Set the radius ratio of bar edge in relative the bar's width.
51427
- * @property {number} [bar.sensitivity=2] The senstivity offset value for interaction boundary.
51428
- * @property {number|Function|object} [bar.width] Change the width of bar chart.
51743
+ * @property {number} [bar.sensitivity=2] The sensitivity offset value for interaction boundary.
51744
+ * @property {number|function|object} [bar.width] Change the width of bar chart.
51429
51745
  * @property {number} [bar.width.ratio=0.6] Change the width of bar chart by ratio.
51430
51746
  * - **NOTE:** Criteria for ratio.
51431
51747
  * - When x ticks count is same with the data count, the baseline for ratio is the minimum interval value of x ticks.
@@ -51452,12 +51768,12 @@ ${percentValue}%`;
51452
51768
  * // make bar shape to be positioned over the other shape elements
51453
51769
  * front: true,
51454
51770
  *
51455
- * // remove nullish data on bar indices postions
51771
+ * // remove nullish data on bar indices positions
51456
51772
  * indices: {
51457
51773
  * removeNull: true
51458
51774
  * },
51459
51775
  *
51460
- * // will generate follwing linearGradient:
51776
+ * // will generate following linearGradient:
51461
51777
  * // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient
51462
51778
  * // <linearGradient x1="0" x2="0" y1="0" y2="1">
51463
51779
  * // <stop offset="0" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
@@ -51555,12 +51871,12 @@ ${percentValue}%`;
51555
51871
  * @memberof Options
51556
51872
  * @type {object}
51557
51873
  * @property {object} bubble bubble object
51558
- * @property {number|Function} [bubble.maxR=35] Set the max bubble radius value
51874
+ * @property {number|function} [bubble.maxR=35] Set the max bubble radius value
51559
51875
  * @property {boolean} [bubble.zerobased=false] Set if min or max value will be 0 on bubble chart.
51560
51876
  * @example
51561
51877
  * bubble: {
51562
51878
  * // ex) If 100 is the highest value among data bound, the representation bubble of 100 will have radius of 50.
51563
- * // And the lesser will have radius relatively from tha max value.
51879
+ * // And the lesser will have radius relatively from the max value.
51564
51880
  * maxR: 50,
51565
51881
  *
51566
51882
  * // or set radius callback
@@ -51614,7 +51930,7 @@ ${percentValue}%`;
51614
51930
  * }
51615
51931
  * },
51616
51932
  * color: {
51617
- * // spcify bearish color
51933
+ * // specify bearish color
51618
51934
  * down: "red",
51619
51935
  *
51620
51936
  * // or specify color per dataset
@@ -51667,7 +51983,7 @@ ${percentValue}%`;
51667
51983
  * // hide all data points ('point.show=false' also has similar effect)
51668
51984
  * point: false,
51669
51985
  *
51670
- * // show data points for only indicated datas
51986
+ * // show data points for only indicated data
51671
51987
  * point: [
51672
51988
  * "data1", "data3"
51673
51989
  * ],
@@ -51702,7 +52018,7 @@ ${percentValue}%`;
51702
52018
  * // hide all data points ('point.show=false' also has similar effect)
51703
52019
  * point: false,
51704
52020
  *
51705
- * // show data points for only indicated datas
52021
+ * // show data points for only indicated data
51706
52022
  * point: [
51707
52023
  * "data1", "data3"
51708
52024
  * ],
@@ -51761,14 +52077,14 @@ ${percentValue}%`;
51761
52077
  * @memberof Options
51762
52078
  * @type {object}
51763
52079
  * @property {object} arc Arc object
51764
- * @property {number|Function} [arc.cornerRadius=0] Set corner radius of Arc(donut/gauge/pie/polar) shape.
52080
+ * @property {number|function} [arc.cornerRadius=0] Set corner radius of Arc(donut/gauge/pie/polar) shape.
51765
52081
  * - **NOTE:**
51766
52082
  * - Corner radius can't surpass the `(outerRadius - innerRadius) /2` of indicated shape.
51767
52083
  * @property {number} [arc.cornerRadius.ratio=0] Set ratio relative of outer radius.
51768
52084
  * @property {object} [arc.needle] Set needle options.
51769
52085
  * @property {boolean} [arc.needle.show=false] Show or hide needle.
51770
52086
  * @property {string} [arc.needle.color] Set needle filled color.
51771
- * @property {Function} [arc.needle.path] Set custom needle path function.
52087
+ * @property {function} [arc.needle.path] Set custom needle path function.
51772
52088
  * - **NOTE:**
51773
52089
  * - The path should be starting from 0,0 (which is center) to top center coordinate.
51774
52090
  * - The function will receive, `length`{number} parameter which indicating the needle length in pixel relative to radius.
@@ -51792,8 +52108,8 @@ ${percentValue}%`;
51792
52108
  * @property {string} [arc.rangeText.unit="absolute"] Specify the range text unit.
51793
52109
  * - "absolute": Show absolute value
51794
52110
  * - "%": Show percentage value
51795
- * @property {boolean} [arc.rangeText.fiexed=false] Set if range text shown will be fixed w/o data toggle update. Only available for gauge chart.
51796
- * @property {Function} [arc.rangeText.format] Set format function for the range text.
52111
+ * @property {boolean} [arc.rangeText.fixed=false] Set if range text shown will be fixed w/o data toggle update. Only available for gauge chart.
52112
+ * @property {function} [arc.rangeText.format] Set format function for the range text.
51797
52113
  * @property {number} [arc.rangeText.position] Set position function or object for the range text.
51798
52114
  * @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutCornerRadius)
51799
52115
  * @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#PieChartOptions.CornerRadius)
@@ -51906,10 +52222,21 @@ ${percentValue}%`;
51906
52222
  * @type {object}
51907
52223
  * @property {object} donut Donut object
51908
52224
  * @property {boolean} [donut.label.show=true] Show or hide label on each donut piece.
51909
- * @property {Function} [donut.label.format] Set formatter for the label on each donut piece.
52225
+ * @property {function} [donut.label.format] Set formatter for the label on each donut piece.
51910
52226
  * @property {number} [donut.label.threshold=0.05] Set threshold ratio to show/hide labels.
51911
- * @property {number|Function} [donut.label.ratio=undefined] Set ratio of labels position.
51912
- * @property {object|Function} [donut.label.image] Set image to be displayed next to the label text.<br><br>
52227
+ * @property {number|function} [donut.label.ratio=undefined] Set ratio of labels position.
52228
+ * @property {boolean|object} [donut.label.line=false] Enable label with lines (displayed outside with connector lines).
52229
+ * - `true`: Enable label with lines with default settings
52230
+ * - `false`: Labels are displayed inside the donut slices (default behavior).
52231
+ * - `{show: boolean, distance: number, text: boolean}`: Enable label with lines with custom settings. When object member is not provided, it will be set to default values.
52232
+ * @property {boolean} [donut.label.line.show=true] Show or hide connector lines.
52233
+ * @property {number} [donut.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
52234
+ * @property {boolean|function} [donut.label.line.text=true] Show text at the end of the connector line (outside the shape).
52235
+ * - `true`: show data "id" text
52236
+ * - `false`: use default formatter(label.format) to show text
52237
+ * - `function(value, ratio, id)`: Custom formatter function for the text.
52238
+ * - **NOTE:** When the viewport size decreases, the size is adjusted based on the shape, so text may appear clipped. In this case, consider setting `overflow: visible` on the SVG node.
52239
+ * @property {object|function} [donut.label.image] Set image to be displayed next to the label text.<br><br>
51913
52240
  * When function is specified, will receives 3 arguments such as `v, id, i` and it must return an image object with `url`, `width`, `height`, and optional `pos` properties.<br><br>
51914
52241
  * The arguments are:<br>
51915
52242
  * - `v` is the value of the data point where the label is shown.
@@ -51934,6 +52261,7 @@ ${percentValue}%`;
51934
52261
  * @see [Demo: Needle](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutNeedle)
51935
52262
  * @see [Demo: Range Text](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutRangeText)
51936
52263
  * @see [Demo: Label Image](https://naver.github.io/billboard.js/demo/#DonutChartOptions.LabelImage)
52264
+ * @see [Demo: Label Line](https://naver.github.io/billboard.js/demo/#DonutChartOptions.LabelLine)
51937
52265
  * @see [Demo: Label Ratio](https://naver.github.io/billboard.js/demo/#DonutChartOptions.LabelRatio)
51938
52266
  * @see [Demo: Multiline Label](https://naver.github.io/billboard.js/demo/#DonutChartOptions.MultilineLabel)
51939
52267
  * @see [Demo: Multiline Title](https://naver.github.io/billboard.js/demo/#DonutChartOptions.MultilineTitle)
@@ -51963,6 +52291,20 @@ ${percentValue}%`;
51963
52291
  * // or set ratio number
51964
52292
  * ratio: 0.5,
51965
52293
  *
52294
+ * // Enable label with lines (displayed outside with connector lines)
52295
+ * line: false, // default - labels inside
52296
+ * line: true, // enable label with lines with default settings
52297
+ * line: { // enable label with lines with custom settings
52298
+ * show: true,
52299
+ * distance: 20, // horizontal line distance in pixels
52300
+ *
52301
+ * // show text at the end of connector line (outside the shape)
52302
+ * text: true, // use default formatter
52303
+ * text: function(value, ratio, id) { // custom formatter
52304
+ * return d3.format(".1%")(ratio);
52305
+ * }
52306
+ * },
52307
+ *
51966
52308
  * // set image to be displayed next to the label text
51967
52309
  * image: {
51968
52310
  * url: "./sample.svg",
@@ -52034,6 +52376,7 @@ ${percentValue}%`;
52034
52376
  donut_label_show: true,
52035
52377
  donut_label_format: void 0,
52036
52378
  donut_label_threshold: 0.05,
52379
+ donut_label_line: false,
52037
52380
  donut_label_image: void 0,
52038
52381
  donut_label_ratio: void 0,
52039
52382
  donut_width: void 0,
@@ -52089,15 +52432,27 @@ ${percentValue}%`;
52089
52432
  * @property {boolean} [gauge.background=""] Set background color. (The `.bb-chart-arcs-background` element)
52090
52433
  * @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.
52091
52434
  * @property {boolean} [gauge.label.show=true] Show or hide label on gauge.
52092
- * @property {Function} [gauge.label.extents] Set customized min/max label text.
52093
- * @property {Function} [gauge.label.format] Set formatter for the label on gauge. Label text can be multilined with `\n` character.<br>
52435
+ * @property {function} [gauge.label.extents] Set customized min/max label text.
52436
+ * @property {function} [gauge.label.format] Set formatter for the label on gauge. Label text can be multilined with `\n` character.<br>
52094
52437
  * Will pass following arguments to the given function:
52095
52438
  * - value {number}: absolute value
52096
52439
  * - ratio {number}: value's ratio
52097
52440
  * - id {string}: data's id value
52098
- * @property {number|Function} [gauge.label.ratio=undefined] Set ratio of labels position.
52441
+ * @property {number|function} [gauge.label.ratio=undefined] Set ratio of labels position.
52099
52442
  * @property {number} [gauge.label.threshold=0] Set threshold ratio to show/hide labels.
52100
- * @property {object|Function} [gauge.label.image] Set image to be displayed next to the label text.<br><br>
52443
+ * @property {boolean|object} [gauge.label.line=false] Enable label with lines (displayed outside with connector lines).
52444
+ * - **NOTE:** Only applicable for single gauge (not for `gauge.type="multi"`).
52445
+ * - `true`: Enable label with lines with default settings
52446
+ * - `false`: Labels are displayed inside the gauge (default behavior).
52447
+ * - `{show: boolean, distance: number, text: boolean}`: Enable label with lines with custom settings. When object member is not provided, it will be set to default values.
52448
+ * @property {boolean} [gauge.label.line.show=true] Show or hide connector lines.
52449
+ * @property {number} [gauge.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
52450
+ * @property {boolean|function} [gauge.label.line.text=true] Show text at the end of the connector line (outside the shape).
52451
+ * - `true`: show data "id" text
52452
+ * - `false`: use default formatter(label.format) to show text
52453
+ * - `function(value, ratio, id)`: Custom formatter function for the text.
52454
+ * - **NOTE:** When the viewport size decreases, the size is adjusted based on the shape, so text may appear clipped. In this case, consider setting `overflow: visible` on the SVG node.
52455
+ * @property {object|function} [gauge.label.image] Set image to be displayed next to the label text.<br><br>
52101
52456
  * When function is specified, will receives 3 arguments such as `v, id, i` and it must return an image object with `url`, `width`, `height`, and optional `pos` properties.<br><br>
52102
52457
  * The arguments are:<br>
52103
52458
  * - `v` is the value of the data point where the label is shown.
@@ -52150,6 +52505,7 @@ ${percentValue}%`;
52150
52505
  * @see [Demo: archLength](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeArcLength)
52151
52506
  * @see [Demo: startingAngle](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeStartingAngle)
52152
52507
  * @see [Demo: label image](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeLabelImage)
52508
+ * @see [Demo: label line](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeLabelLine)
52153
52509
  * @see [Demo: label ratio](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeLabelRatio)
52154
52510
  * @example
52155
52511
  * gauge: {
@@ -52172,6 +52528,20 @@ ${percentValue}%`;
52172
52528
  * // if data value is below than 0.1, text label will be hidden.
52173
52529
  * threshold: 0.1,
52174
52530
  *
52531
+ * // Enable label with lines (displayed outside with connector lines)
52532
+ * // NOTE: Only works with single gauge (not gauge.type="multi")
52533
+ * line: true, // enable label with lines with default settings
52534
+ * line: { // enable label with lines with custom settings
52535
+ * show: true, // enable lines (default: true when line is enabled)
52536
+ * distance: 30, // distance of horizontal line in pixels (default: 20)
52537
+ *
52538
+ * // show text at the end of connector line (outside the shape)
52539
+ * text: true, // use default formatter
52540
+ * text: function(value, ratio, id) { // custom formatter
52541
+ * return d3.format(".1%")(ratio);
52542
+ * }
52543
+ * },
52544
+ *
52175
52545
  * // set ratio callback. Should return ratio value
52176
52546
  * ratio: function(d, radius, h) {
52177
52547
  * ...
@@ -52265,6 +52635,7 @@ ${percentValue}%`;
52265
52635
  gauge_label_format: void 0,
52266
52636
  gauge_label_ratio: void 0,
52267
52637
  gauge_label_threshold: 0,
52638
+ gauge_label_line: false,
52268
52639
  gauge_label_image: void 0,
52269
52640
  gauge_enforceMinMax: false,
52270
52641
  gauge_min: 0,
@@ -52290,10 +52661,21 @@ ${percentValue}%`;
52290
52661
  * @type {object}
52291
52662
  * @property {object} pie Pie object
52292
52663
  * @property {boolean} [pie.label.show=true] Show or hide label on each pie piece.
52293
- * @property {Function} [pie.label.format] Set formatter for the label on each pie piece.
52294
- * @property {number|Function} [pie.label.ratio=undefined] Set ratio of labels position.
52664
+ * @property {function} [pie.label.format] Set formatter for the label on each pie piece.
52665
+ * @property {number|function} [pie.label.ratio=undefined] Set ratio of labels position.
52295
52666
  * @property {number} [pie.label.threshold=0.05] Set threshold ratio to show/hide labels.
52296
- * @property {object|Function} [pie.label.image] Set image to be displayed next to the label text.<br><br>
52667
+ * @property {boolean|object} [pie.label.line=false] Enable label with lines (displayed outside with connector lines).
52668
+ * - `true`: Enable label with lines with default settings
52669
+ * - `false`: Labels are displayed inside the pie slices (default behavior).
52670
+ * - `{show: boolean, distance: number, text: boolean}`: Enable label with lines with custom settings. When object member is not provided, it will be set to default values.
52671
+ * @property {boolean} [pie.label.line.show=true] Show or hide connector lines.
52672
+ * @property {number} [pie.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
52673
+ * @property {boolean|function} [pie.label.line.text=true] Show text at the end of the connector line (outside the shape).
52674
+ * - `true`: show data "id" text
52675
+ * - `false`: use default formatter(label.format) to show text
52676
+ * - `function(value, ratio, id)`: Custom formatter function for the text.
52677
+ * - **NOTE:** When the viewport size decreases, the size is adjusted based on the shape, so text may appear clipped. In this case, consider setting `overflow: visible` on the SVG node.
52678
+ * @property {object|function} [pie.label.image] Set image to be displayed next to the label text.<br><br>
52297
52679
  * When function is specified, will receives 3 arguments such as `v, id, i` and it must return an image object with `url`, `width`, `height`, and optional `pos` properties.<br><br>
52298
52680
  * The arguments are:<br>
52299
52681
  * - `v` is the value of the data point where the label is shown.
@@ -52318,6 +52700,7 @@ ${percentValue}%`;
52318
52700
  * @see [Demo: outerRadius](https://naver.github.io/billboard.js/demo/#PieChartOptions.OuterRadius)
52319
52701
  * @see [Demo: startingAngle](https://naver.github.io/billboard.js/demo/#PieChartOptions.StartingAngle)
52320
52702
  * @see [Demo: label image](https://naver.github.io/billboard.js/demo/#PieChartOptions.LabelImage)
52703
+ * @see [Demo: label line](https://naver.github.io/billboard.js/demo/#PieChartOptions.LabelLine)
52321
52704
  * @example
52322
52705
  * pie: {
52323
52706
  * label: {
@@ -52341,6 +52724,20 @@ ${percentValue}%`;
52341
52724
  * // or set ratio number
52342
52725
  * ratio: 0.5,
52343
52726
  *
52727
+ * // Enable label with lines (displayed outside with connector lines)
52728
+ * line: false, // default - labels inside
52729
+ * line: true, // enable label with lines with default settings
52730
+ * line: { // enable label with lines with custom settings
52731
+ * show: true,
52732
+ * distance: 20, // horizontal line distance in pixels
52733
+ *
52734
+ * // show text at the end of connector line (outside the shape)
52735
+ * text: true, // use default formatter
52736
+ * text: function(value, ratio, id) { // custom formatter
52737
+ * return d3.format(".1%")(ratio);
52738
+ * }
52739
+ * },
52740
+ *
52344
52741
  * // set image to be displayed next to the label text
52345
52742
  * image: {
52346
52743
  * url: "./sample.svg",
@@ -52422,6 +52819,7 @@ ${percentValue}%`;
52422
52819
  pie_label_format: void 0,
52423
52820
  pie_label_ratio: void 0,
52424
52821
  pie_label_threshold: 0.05,
52822
+ pie_label_line: false,
52425
52823
  pie_label_image: void 0,
52426
52824
  pie_expand: {},
52427
52825
  pie_expand_rate: 0.98,
@@ -52442,10 +52840,21 @@ ${percentValue}%`;
52442
52840
  * @type {object}
52443
52841
  * @property {object} polar Polar object
52444
52842
  * @property {boolean} [polar.label.show=true] Show or hide label on each polar piece.
52445
- * @property {Function} [polar.label.format] Set formatter for the label on each polar piece.
52843
+ * @property {function} [polar.label.format] Set formatter for the label on each polar piece.
52446
52844
  * @property {number} [polar.label.threshold=0.05] Set threshold ratio to show/hide labels.
52447
- * @property {number|Function} [polar.label.ratio=undefined] Set ratio of labels position.
52448
- * @property {object|Function} [polar.label.image] Set image to be displayed next to the label text.<br><br>
52845
+ * @property {number|function} [polar.label.ratio=undefined] Set ratio of labels position.
52846
+ * @property {boolean|object} [polar.label.line=false] Enable label with lines (displayed outside with connector lines).
52847
+ * - `true`: Enable label with lines with default settings
52848
+ * - `false`: Labels are displayed inside the polar slices (default behavior).
52849
+ * - `{show: boolean, distance: number, text: boolean}`: Enable label with lines with custom settings. When object member is not provided, it will be set to default values.
52850
+ * @property {boolean} [polar.label.line.show=true] Show or hide connector lines.
52851
+ * @property {number} [polar.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
52852
+ * @property {boolean|function} [polar.label.line.text=true] Show text at the end of the connector line (outside the shape).
52853
+ * - `true`: show data "id" text
52854
+ * - `false`: use default formatter(label.format) to show text
52855
+ * - `function(value, ratio, id)`: Custom formatter function for the text.
52856
+ * - **NOTE:** When the viewport size decreases, the size is adjusted based on the shape, so text may appear clipped. In this case, consider setting `overflow: visible` on the SVG node.
52857
+ * @property {object|function} [polar.label.image] Set image to be displayed next to the label text.<br><br>
52449
52858
  * When function is specified, will receives 3 arguments such as `v, id, i` and it must return an image object with `url`, `width`, `height`, and optional `pos` properties.<br><br>
52450
52859
  * The arguments are:<br>
52451
52860
  * - `v` is the value of the data point where the label is shown.
@@ -52460,13 +52869,14 @@ ${percentValue}%`;
52460
52869
  * @property {number} [polar.level.depth=3] Set the level depth.
52461
52870
  * @property {boolean} [polar.level.show=true] Show or hide level.
52462
52871
  * @property {string} [polar.level.text.backgroundColor="#fff"] Set label text's background color.
52463
- * @property {Function} [polar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
52872
+ * @property {function} [polar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
52464
52873
  * @property {boolean} [polar.level.text.show=true] Show or hide level text.
52465
52874
  * @property {number} [polar.padAngle=0] Set padding between data.
52466
52875
  * @property {number} [polar.padding=0] Sets the gap between pie arcs.
52467
52876
  * @property {number} [polar.startingAngle=0] Set starting angle where data draws.
52468
52877
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.PolarChart)
52469
52878
  * @see [Demo: label image](https://naver.github.io/billboard.js/demo/#PolarChartOptions.LabelImage)
52879
+ * @see [Demo: label line](https://naver.github.io/billboard.js/demo/#PolarChartOptions.LabelLine)
52470
52880
  * @example
52471
52881
  * polar: {
52472
52882
  * label: {
@@ -52490,6 +52900,20 @@ ${percentValue}%`;
52490
52900
  * // or set ratio number
52491
52901
  * ratio: 0.5,
52492
52902
  *
52903
+ * // Enable label with lines (displayed outside with connector lines)
52904
+ * line: false, // default - labels inside
52905
+ * line: true, // enable label with lines with default settings
52906
+ * line: { // enable label with lines with custom settings
52907
+ * show: true,
52908
+ * distance: 20, // horizontal line distance in pixels
52909
+ *
52910
+ * // show text at the end of connector line (outside the shape)
52911
+ * text: true, // use default formatter
52912
+ * text: function(value, ratio, id) { // custom formatter
52913
+ * return d3.format(".1%")(ratio);
52914
+ * }
52915
+ * },
52916
+ *
52493
52917
  * // set image to be displayed next to the label text
52494
52918
  * image: {
52495
52919
  * url: "./sample.svg",
@@ -52554,6 +52978,7 @@ ${percentValue}%`;
52554
52978
  polar_label_show: true,
52555
52979
  polar_label_format: void 0,
52556
52980
  polar_label_threshold: 0.05,
52981
+ polar_label_line: false,
52557
52982
  polar_label_image: void 0,
52558
52983
  polar_label_ratio: void 0,
52559
52984
  polar_level_depth: 3,
@@ -52585,7 +53010,7 @@ ${percentValue}%`;
52585
53010
  * @property {boolean} [radar.direction.clockwise=false] Set the direction to be drawn.
52586
53011
  * @property {number} [radar.level.depth=3] Set the level depth.
52587
53012
  * @property {boolean} [radar.level.show=true] Show or hide level.
52588
- * @property {Function} [radar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
53013
+ * @property {function} [radar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
52589
53014
  * @property {boolean} [radar.level.text.show=true] Show or hide level text.
52590
53015
  * @property {number} [radar.size.ratio=0.87] Set size ratio.
52591
53016
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.RadarChart)
@@ -52653,7 +53078,12 @@ ${percentValue}%`;
52653
53078
  * - sliceDice ([d3.treemapSliceDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSliceDice))
52654
53079
  * - squrify ([d3.treemapSquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSquarify))
52655
53080
  * - resquarify ([d3.treemapResquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapResquarify))
52656
- * @property {Function} [treemap.label.format] Set formatter for the label text.
53081
+ * @property {function} [treemap.label.format] Set formatter for the label text.<br>
53082
+ * - **Arguments:**
53083
+ * - `value {number}`: Data value
53084
+ * - `ratio {number}`: The `ratio` of how much space this tile occupies relative to the total area (0~1)
53085
+ * - `id {string}`: Data id
53086
+ * - `size {object}`: Tile size `{width, height}` in pixels
52657
53087
  * @property {number} [treemap.label.threshold=0.05] Set threshold ratio to show/hide labels text.
52658
53088
  * @property {number} [treemap.label.show=true] Show or hide label text.
52659
53089
  * @see [Demo: treemap](https://naver.github.io/billboard.js/demo/#Chart.TreemapChart)
@@ -52666,12 +53096,33 @@ ${percentValue}%`;
52666
53096
  * // show or hide label text
52667
53097
  * show: false,
52668
53098
  *
52669
- * // set label text formatter
52670
- * format: function(value, ratio, id) {
53099
+ * // Example 1: Format with currency
53100
+ * format: function(value, ratio, id, size) {
53101
+ * // size: {width, height} - tile size in pixels
52671
53102
  * return d3.format("$")(value);
53103
+ * },
52672
53104
  *
52673
- * // to multiline, return with '\n' character
52674
- * // return value +"%\nLine1\n2Line2";
53105
+ * // Example 2: Show different content based on tile size
53106
+ * format: function(value, ratio, id, size) {
53107
+ * if (size.width > 100 && size.height > 50) {
53108
+ * return `${id}\n${d3.format("$")(value)}\n(${(ratio * 100).toFixed(1)}%)`;
53109
+ * } else if (size.width > 50) {
53110
+ * return `${id}\n${d3.format("$")(value)}`;
53111
+ * } else {
53112
+ * return d3.format("$")(value);
53113
+ * }
53114
+ * },
53115
+ *
53116
+ * // Example 3: Include tile dimensions in label
53117
+ * format: function(value, ratio, id, size) {
53118
+ * return `${id}\n${value}\n${size.width.toFixed(0)}x${size.height.toFixed(0)}px`;
53119
+ * },
53120
+ *
53121
+ * // Example 4: Conditional formatting based on ratio
53122
+ * format: function(value, ratio, id, size) {
53123
+ * return ratio > 0.1 ?
53124
+ * `${id}\n${value} (${(ratio * 100).toFixed(1)}%)` :
53125
+ * value;
52675
53126
  * },
52676
53127
  *
52677
53128
  * // set ratio number
@@ -52780,10 +53231,10 @@ const bb = {
52780
53231
  * bb.version; // "1.0.0"
52781
53232
  * @memberof bb
52782
53233
  */
52783
- version: "3.17.4",
53234
+ version: "3.18.0-next.1",
52784
53235
  /**
52785
53236
  * Generate chart
52786
- * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
53237
+ * - **NOTE:** Bear in mind for the possibility of ***throwing an error***, during the generation when:
52787
53238
  * - Unused option value is given.
52788
53239
  * - ex) For `data.type="pie"` option, setting 'axis' option can cause unexpected generation error.
52789
53240
  * - Insufficient value is given for certain option used.