billboard.js 3.17.4 → 3.18.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) 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 +1146 -463
  5. package/dist/billboard.min.css +2 -2
  6. package/dist/billboard.min.js +10 -10
  7. package/dist/billboard.pkgd.js +1147 -464
  8. package/dist/billboard.pkgd.min.js +21 -21
  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 +117 -26
  12. package/dist/plugin/billboardjs-plugin-sparkline.min.js +4 -4
  13. package/dist/plugin/billboardjs-plugin-stanford.js +119 -28
  14. package/dist/plugin/billboardjs-plugin-stanford.min.js +10 -10
  15. package/dist/plugin/billboardjs-plugin-tableview.js +117 -27
  16. package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
  17. package/dist/plugin/billboardjs-plugin-textoverlap.js +116 -26
  18. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +3 -3
  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 +117 -26
  22. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +120 -29
  24. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +14 -14
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +117 -27
  26. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +12 -12
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +116 -26
  28. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +10 -10
  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 +1467 -536
  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 +94 -16
  44. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  45. package/package.json +38 -37
  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 +9 -8
  61. package/src/ChartInternal/data/data.ts +135 -17
  62. package/src/ChartInternal/data/load.ts +8 -8
  63. package/src/ChartInternal/interactions/drag.ts +53 -42
  64. package/src/ChartInternal/interactions/eventrect.ts +15 -5
  65. package/src/ChartInternal/interactions/flow.ts +1 -1
  66. package/src/ChartInternal/interactions/interaction.ts +1 -1
  67. package/src/ChartInternal/interactions/zoom.ts +24 -20
  68. package/src/ChartInternal/internals/color.ts +27 -10
  69. package/src/ChartInternal/internals/domain.ts +22 -5
  70. package/src/ChartInternal/internals/format.ts +4 -4
  71. package/src/ChartInternal/internals/grid.ts +11 -11
  72. package/src/ChartInternal/internals/legend.ts +80 -19
  73. package/src/ChartInternal/internals/scale.ts +6 -6
  74. package/src/ChartInternal/internals/selection.ts +1 -1
  75. package/src/ChartInternal/internals/style.ts +3 -3
  76. package/src/ChartInternal/internals/text.arc.ts +304 -0
  77. package/src/ChartInternal/internals/text.ts +44 -14
  78. package/src/ChartInternal/internals/text.util.ts +19 -0
  79. package/src/ChartInternal/internals/title.ts +3 -3
  80. package/src/ChartInternal/internals/tooltip.ts +23 -15
  81. package/src/ChartInternal/shape/arc.ts +174 -71
  82. package/src/ChartInternal/shape/area.ts +2 -2
  83. package/src/ChartInternal/shape/bar.ts +7 -6
  84. package/src/ChartInternal/shape/candlestick.ts +3 -3
  85. package/src/ChartInternal/shape/funnel.ts +18 -18
  86. package/src/ChartInternal/shape/line.ts +9 -10
  87. package/src/ChartInternal/shape/point.common.ts +24 -6
  88. package/src/ChartInternal/shape/radar.ts +4 -4
  89. package/src/ChartInternal/shape/shape.ts +24 -6
  90. package/src/ChartInternal/shape/treemap.ts +19 -5
  91. package/src/Plugin/stanford/Options.ts +2 -2
  92. package/src/Plugin/tableview/Options.ts +1 -1
  93. package/src/config/Options/axis/axis.ts +7 -7
  94. package/src/config/Options/axis/x.ts +6 -6
  95. package/src/config/Options/axis/y.ts +4 -4
  96. package/src/config/Options/axis/y2.ts +16 -3
  97. package/src/config/Options/common/color.ts +2 -2
  98. package/src/config/Options/common/legend.ts +6 -5
  99. package/src/config/Options/common/main.ts +23 -23
  100. package/src/config/Options/common/point.ts +4 -3
  101. package/src/config/Options/common/tooltip.ts +14 -13
  102. package/src/config/Options/data/axis.ts +31 -6
  103. package/src/config/Options/data/data.ts +44 -44
  104. package/src/config/Options/data/selection.ts +4 -4
  105. package/src/config/Options/interaction/interaction.ts +2 -1
  106. package/src/config/Options/interaction/subchart.ts +2 -2
  107. package/src/config/Options/interaction/zoom.ts +4 -4
  108. package/src/config/Options/shape/arc.ts +4 -4
  109. package/src/config/Options/shape/area.ts +1 -1
  110. package/src/config/Options/shape/bar.ts +4 -4
  111. package/src/config/Options/shape/bubble.ts +2 -2
  112. package/src/config/Options/shape/candlestick.ts +1 -1
  113. package/src/config/Options/shape/donut.ts +34 -3
  114. package/src/config/Options/shape/gauge.ts +36 -4
  115. package/src/config/Options/shape/line.ts +1 -1
  116. package/src/config/Options/shape/pie.ts +34 -3
  117. package/src/config/Options/shape/polar.ts +35 -4
  118. package/src/config/Options/shape/radar.ts +1 -1
  119. package/src/config/Options/shape/scatter.ts +1 -1
  120. package/src/config/Options/shape/treemap.ts +31 -5
  121. package/src/config/Store/State.ts +11 -1
  122. package/src/config/classes.ts +1 -0
  123. package/src/core.ts +1 -1
  124. package/src/module/Cache.ts +29 -4
  125. package/src/module/generator.ts +1 -1
  126. package/src/module/util.ts +308 -117
  127. package/src/module/worker.ts +3 -3
  128. package/src/scss/billboard.scss +15 -0
  129. package/src/scss/theme/dark.scss +15 -0
  130. package/src/scss/theme/datalab.scss +15 -0
  131. package/src/scss/theme/graph.scss +15 -0
  132. package/src/scss/theme/insight.scss +15 -0
  133. package/src/scss/theme/modern.scss +15 -0
  134. package/types/axis.d.ts +3 -3
  135. package/types/chart.d.ts +4 -4
  136. package/types/options.d.ts +22 -9
  137. 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.2
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
@@ -24616,6 +24617,7 @@ const $ZOOM = {
24616
24617
  * - title {string}: data's id value
24617
24618
  * - color {string}: color string
24618
24619
  * - data {Array}: data array
24620
+ * - **NOTE:** While basic XSS sanitization is applied, if you're allowing user-provided chart options in a service exposed to other users, you should implement additional security measures to prevent sophisticated XSS attacks.
24619
24621
  * @property {string} [legend.position=bottom] Change the position of legend.<br>
24620
24622
  * Available values are: `bottom`, `right` and `inset` are supported.
24621
24623
  * @property {object} [legend.inset={anchor: 'top-left',x: 10,y: 0,step: undefined}] Change inset legend attributes.<br>
@@ -24642,13 +24644,13 @@ const $ZOOM = {
24642
24644
  * - To return initial state(which all dataseries are showing), double click current focused legend item again.
24643
24645
  * - for single click case, `click + altKey(Win)/optionKey(Mac OS)` to have same effect.
24644
24646
  * - In this case, default `click` interaction will be disabled.
24645
- * @property {Function} [legend.item.onclick=undefined] Set click event handler to the legend item.
24647
+ * @property {function} [legend.item.onclick=undefined] Set click event handler to the legend item.
24646
24648
  * - **NOTE:**
24647
24649
  * - When set, default `click` interaction will be disabled.
24648
24650
  * - 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.
24651
+ * @property {function} [legend.item.onover=undefined] Set mouse/touch over event handler to the legend item.
24650
24652
  * - **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.
24653
+ * @property {function} [legend.item.onout=undefined] Set mouse/touch out event handler to the legend item.
24652
24654
  * - **NOTE:** When set, default `mouseout` interaction will be disabled.
24653
24655
  * @property {number} [legend.item.tile.width=10] Set width for 'rectangle' legend item tile element.
24654
24656
  * @property {number} [legend.item.tile.height=10] Set height for 'rectangle' legend item tile element.
@@ -24725,7 +24727,7 @@ const $ZOOM = {
24725
24727
  * width: 15,
24726
24728
  * height: 15
24727
24729
  *
24728
- * // radis is only applicable for 'circle' legend type
24730
+ * // radius is only applicable for 'circle' legend type
24729
24731
  * r: 10
24730
24732
  * }
24731
24733
  * },
@@ -24771,14 +24773,14 @@ const $ZOOM = {
24771
24773
  /* harmony default export */ var main = ({
24772
24774
  /**
24773
24775
  * 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.
24776
+ * If another chart is already set, it will be replaced with the new one (only one chart can be set in one element).
24777
+ * - **NOTE:** In case the element doesn't exist or not specified, will add a `<div>` element to the body.
24776
24778
  * @name bindto
24777
24779
  * @memberof Options
24778
24780
  * @property {string|HTMLElement|d3.selection|object} [bindto="#chart"] Specify the element where chart will be drawn.
24779
24781
  * @property {string|HTMLElement|d3.selection} bindto.element="#chart" Specify the element where chart will be drawn.
24780
24782
  * @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.
24783
+ * **NOTE:** When the class name isn't `bb`, then you also need to update the default CSS to be rendered correctly.
24782
24784
  * @default #chart
24783
24785
  * @example
24784
24786
  * bindto: "#myContainer"
@@ -24819,8 +24821,8 @@ const $ZOOM = {
24819
24821
  /**
24820
24822
  * Set 'clip-path' attribute for chart element
24821
24823
  * - **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.
24824
+ * > When false, chart node element is positioned after the axis node in DOM tree hierarchy.
24825
+ * > This is to make the chart element positioned over axis element.
24824
24826
  * @name clipPath
24825
24827
  * @memberof Options
24826
24828
  * @type {boolean}
@@ -24846,7 +24848,7 @@ const $ZOOM = {
24846
24848
  svg_classname: void 0,
24847
24849
  /**
24848
24850
  * 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.
24851
+ * 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
24852
  * @name size
24851
24853
  * @memberof Options
24852
24854
  * @type {object}
@@ -24864,13 +24866,13 @@ const $ZOOM = {
24864
24866
  size_height: void 0,
24865
24867
  /**
24866
24868
  * 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.
24869
+ * - **NOTE:** for more information, see the "[`Understanding padding`](https://github.com/naver/billboard.js/wiki/Understanding-padding)" wiki documentation.
24868
24870
  * @name padding
24869
24871
  * @memberof Options
24870
24872
  * @type {object}
24871
24873
  * @property {object|boolean} [padding=true] Set padding of chart, and accepts object or boolean type.
24872
24874
  * - `Object`: Specify each side's padding.
24873
- * - `false`: Remove padding completely and make shape to fully occupy the container element.
24875
+ * - `false`: Remove padding completely and make the shape fully occupy the container element.
24874
24876
  * - In this case, axes and subchart will be hidden.
24875
24877
  * - To adjust some padding from this state, use `axis.[x|y].padding` option.
24876
24878
  * @property {string} [padding.mode] padding mode
@@ -24957,7 +24959,7 @@ const $ZOOM = {
24957
24959
  * Set a callback to execute when the chart is clicked.
24958
24960
  * @name onclick
24959
24961
  * @memberof Options
24960
- * @type {Function}
24962
+ * @type {function}
24961
24963
  * @default undefined
24962
24964
  * @example
24963
24965
  * onclick: function(event) {
@@ -24971,7 +24973,7 @@ const $ZOOM = {
24971
24973
  * Set a callback to execute when mouse/touch enters the chart.
24972
24974
  * @name onover
24973
24975
  * @memberof Options
24974
- * @type {Function}
24976
+ * @type {function}
24975
24977
  * @default undefined
24976
24978
  * @example
24977
24979
  * onover: function(event) {
@@ -24985,7 +24987,7 @@ const $ZOOM = {
24985
24987
  * Set a callback to execute when mouse/touch leaves the chart.
24986
24988
  * @name onout
24987
24989
  * @memberof Options
24988
- * @type {Function}
24990
+ * @type {function}
24989
24991
  * @default undefined
24990
24992
  * @example
24991
24993
  * onout: function(event) {
@@ -24999,7 +25001,7 @@ const $ZOOM = {
24999
25001
  * Set a callback to execute when user resizes the screen.
25000
25002
  * @name onresize
25001
25003
  * @memberof Options
25002
- * @type {Function}
25004
+ * @type {function}
25003
25005
  * @default undefined
25004
25006
  * @example
25005
25007
  * onresize: function() {
@@ -25012,7 +25014,7 @@ const $ZOOM = {
25012
25014
  * Set a callback to execute when screen resize finished.
25013
25015
  * @name onresized
25014
25016
  * @memberof Options
25015
- * @type {Function}
25017
+ * @type {function}
25016
25018
  * @default undefined
25017
25019
  * @example
25018
25020
  * onresized: function() {
@@ -25025,7 +25027,7 @@ const $ZOOM = {
25025
25027
  * Set a callback to execute before the chart is initialized
25026
25028
  * @name onbeforeinit
25027
25029
  * @memberof Options
25028
- * @type {Function}
25030
+ * @type {function}
25029
25031
  * @default undefined
25030
25032
  * @example
25031
25033
  * onbeforeinit: function() {
@@ -25038,7 +25040,7 @@ const $ZOOM = {
25038
25040
  * Set a callback to execute when the chart is initialized.
25039
25041
  * @name oninit
25040
25042
  * @memberof Options
25041
- * @type {Function}
25043
+ * @type {function}
25042
25044
  * @default undefined
25043
25045
  * @example
25044
25046
  * oninit: function() {
@@ -25051,7 +25053,7 @@ const $ZOOM = {
25051
25053
  * Set a callback to execute after the chart is initialized
25052
25054
  * @name onafterinit
25053
25055
  * @memberof Options
25054
- * @type {Function}
25056
+ * @type {function}
25055
25057
  * @default undefined
25056
25058
  * @example
25057
25059
  * onafterinit: function() {
@@ -25061,10 +25063,10 @@ const $ZOOM = {
25061
25063
  */
25062
25064
  onafterinit: void 0,
25063
25065
  /**
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.
25066
+ * 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
25067
  * @name onrendered
25066
25068
  * @memberof Options
25067
- * @type {Function}
25069
+ * @type {function}
25068
25070
  * @default undefined
25069
25071
  * @example
25070
25072
  * onrendered: function() {
@@ -25075,7 +25077,7 @@ const $ZOOM = {
25075
25077
  onrendered: void 0,
25076
25078
  /**
25077
25079
  * 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.
25080
+ * - **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
25081
  * @name transition
25080
25082
  * @memberof Options
25081
25083
  * @type {object}
@@ -25106,11 +25108,11 @@ const $ZOOM = {
25106
25108
  * @memberof Options
25107
25109
  * @type {object}
25108
25110
  * @property {object} [render] render object
25109
- * @property {boolean} [render.lazy=true] Make to not render at initialization.
25111
+ * @property {boolean} [render.lazy=true] Make it not render at initialization.
25110
25112
  * - **NOTE**:
25111
25113
  * - Enabled by default when bind element's visibility is hidden.
25112
25114
  * - 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.
25115
+ * @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
25116
  * @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.LazyRender)
25115
25117
  * @example
25116
25118
  * render: {
@@ -25132,7 +25134,7 @@ const $ZOOM = {
25132
25134
  * document.getElementById('chart').style.display = 'block'; // (b)
25133
25135
  *
25134
25136
  * @example
25135
- * // chart won't be rendered and not observing bind element's visiblity changes
25137
+ * // chart won't be rendered and not observing bind element's visibility changes
25136
25138
  * var chart = bb.generate({
25137
25139
  * render: {
25138
25140
  * lazy: true,
@@ -25158,7 +25160,7 @@ const $ZOOM = {
25158
25160
  * - `[start] {number|Date|string}`: Start position of the region. If not set, the start will be the edge of the chart.
25159
25161
  * - `[end] {number|Date|string}`: End position of the region. If not set, the end will be the edge of the chart.
25160
25162
  * - `[class] {string}`: Class value to apply to the region.
25161
- * - `[label] {object}` Lable text option.
25163
+ * - `[label] {object}` Label text option.
25162
25164
  * - `text {string}`: Text value.
25163
25165
  * - `x {number}`: x Position.
25164
25166
  * - `y {number}`: y Position.
@@ -25248,17 +25250,17 @@ const $ZOOM = {
25248
25250
  * - **NOTE:** The overlapped data points will be displayed as grouped even if set false.
25249
25251
  * @property {boolean} [tooltip.linked=false] Set if tooltips on all visible charts with like x points are shown together when one is shown.
25250
25252
  * @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>
25253
+ * @property {function} [tooltip.format.title] Set format for the title of tooltip.<br>
25252
25254
  * 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>
25255
+ * @property {function} [tooltip.format.name] Set format for the name of each data in tooltip.<br>
25254
25256
  * 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.
25257
+ * @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
25258
  * - Will pass following arguments to the given function:
25257
25259
  * - `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
25260
  * - `ratio {number}`: Ratio of the data point in the `pie/donut/gauge` and `area/bar` when contains grouped data. Otherwise is `undefined`.
25259
25261
  * - `id {string}`: id of the data point
25260
25262
  * - `index {number}`: Index of the data point
25261
- * @property {Function} [tooltip.position] Set custom position function for the tooltip.<br>
25263
+ * @property {function} [tooltip.position] Set custom position function for the tooltip.<br>
25262
25264
  * This option can be used to modify the tooltip position by returning object that has top and left.
25263
25265
  * - Will pass following arguments to the given function:
25264
25266
  * - `data {Array}`: Current selected data array object.
@@ -25266,7 +25268,7 @@ const $ZOOM = {
25266
25268
  * - `height {number}`: Height of tooltip.
25267
25269
  * - `element {SVGElement}`: Tooltip event bound element
25268
25270
  * - `pos {object}`: Current position of the tooltip.
25269
- * @property {Function|object} [tooltip.contents] Set custom HTML for the tooltip.<br>
25271
+ * @property {function|object} [tooltip.contents] Set custom HTML for the tooltip.<br>
25270
25272
  * If tooltip.grouped is true, data includes multiple data points.<br><br>
25271
25273
  * Specified function receives `data` array and `defaultTitleFormat`, `defaultValueFormat` and `color` functions of the data point to show.
25272
25274
  * - **Note:**
@@ -25288,6 +25290,7 @@ const $ZOOM = {
25288
25290
  * - **{=COLOR}**: data color.
25289
25291
  * - **{=NAME}**: data id value.
25290
25292
  * - **{=VALUE}**: data value.
25293
+ * - **NOTE:** While basic XSS sanitization is applied, if you're allowing user-provided chart options in a service exposed to other users, you should implement additional security measures to prevent sophisticated XSS attacks.
25291
25294
  * @property {object} [tooltip.contents.text=undefined] Set additional text content within data loop, using template syntax.
25292
25295
  * - **NOTE:** It should contain `{ key: Array, ... }` value
25293
25296
  * - 'key' name is used as substitution within template as '{=KEY}'
@@ -25295,11 +25298,11 @@ const $ZOOM = {
25295
25298
  * @property {boolean} [tooltip.init.show=false] Show tooltip at the initialization.
25296
25299
  * @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
25300
  * @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>
25301
+ * @property {function} [tooltip.onshow] Set a callback that will be invoked before the tooltip is shown.
25302
+ * @property {function} [tooltip.onhide] Set a callback that will be invoked before the tooltip is hidden.
25303
+ * @property {function} [tooltip.onshown] Set a callback that will be invoked after the tooltip is shown
25304
+ * @property {function} [tooltip.onhidden] Set a callback that will be invoked after the tooltip is hidden.
25305
+ * @property {string|function|null} [tooltip.order=null] Set tooltip data display order.<br><br>
25303
25306
  * **Available Values:**
25304
25307
  * - `desc`: In descending data value order
25305
25308
  * - `asc`: In ascending data value order
@@ -25338,7 +25341,7 @@ const $ZOOM = {
25338
25341
  * // yAxis: Current y Axis position value or function(the value is given for axis based chart type only)
25339
25342
  * // }
25340
25343
  *
25341
- * // yAxis will work differently per data lenghts
25344
+ * // yAxis will work differently per data lengths
25342
25345
  * // - a) Single data: `yAxis` will return `number` value
25343
25346
  * // - b) Multiple data: `yAxis` will return a function with property value
25344
25347
  *
@@ -25349,8 +25352,8 @@ const $ZOOM = {
25349
25352
  * // b) Multiple data:
25350
25353
  * // Get y coordinate of value 500, where 'data1' scales(y or y2).
25351
25354
  * // 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.
25355
+ * // - when "data.axes={data1: 'y'}", will return y value from y axis scale.
25356
+ * // - when "data.axes={data1: 'y2'}", will return y value from y2 axis scale.
25354
25357
  * pos.yAxis(500, "data1"); // will return y coordinate value of data1
25355
25358
  *
25356
25359
  * pos.yAxis(500); // get y coordinate with value of 500, using y axis scale
@@ -25486,7 +25489,7 @@ const $ZOOM = {
25486
25489
  /* harmony default export */ var data_data = ({
25487
25490
  /**
25488
25491
  * 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.
25492
+ * 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
25493
  * @name data․x
25491
25494
  * @memberof Options
25492
25495
  * @type {string}
@@ -25501,7 +25504,7 @@ const $ZOOM = {
25501
25504
  * Converts data id value
25502
25505
  * @name data․idConverter
25503
25506
  * @memberof Options
25504
- * @type {Function}
25507
+ * @type {function}
25505
25508
  * @default function(id) { return id; }
25506
25509
  * @example
25507
25510
  * data: {
@@ -25670,8 +25673,8 @@ const $ZOOM = {
25670
25673
  data_types: {},
25671
25674
  /**
25672
25675
  * 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>
25676
+ * - If `null` specified, it will be the order in which the data is loaded.
25677
+ * - 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
25678
  *
25676
25679
  * **Available Values:**
25677
25680
  * - `desc`: In descending order
@@ -25679,10 +25682,10 @@ const $ZOOM = {
25679
25682
  * - `null`: It keeps the data load order
25680
25683
  * - `function(data1, data2) { ... }`: Array.sort compareFunction
25681
25684
  *
25682
- * **NOTE**: order function, only works for Axis based types & Arc types, except `Radar` type.
25685
+ * **NOTE**: order function only works for Axis based types & Arc types, except `Radar` type.
25683
25686
  * @name data․order
25684
25687
  * @memberof Options
25685
- * @type {string|Function|null}
25688
+ * @type {string|function|null}
25686
25689
  * @default desc
25687
25690
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataOrder)
25688
25691
  * @example
@@ -25737,7 +25740,7 @@ const $ZOOM = {
25737
25740
  /**
25738
25741
  * Set how zero value will be treated on groups.<br>
25739
25742
  * Possible values:
25740
- * - `zero`: 0 will be positioned at absolute axis zero point.
25743
+ * - `zero`: 0 will be positioned at the absolute axis zero point.
25741
25744
  * - `positive`: 0 will be positioned at the top of a stack.
25742
25745
  * - `negative`: 0 will be positioned at the bottom of a stack.
25743
25746
  * @name data․groupsZeroAs
@@ -25753,10 +25756,10 @@ const $ZOOM = {
25753
25756
  data_groupsZeroAs: "positive",
25754
25757
  /**
25755
25758
  * 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').
25759
+ * 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
25760
  * @name data․color
25758
25761
  * @memberof Options
25759
- * @type {Function}
25762
+ * @type {function}
25760
25763
  * @default undefined
25761
25764
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataColor)
25762
25765
  * @example
@@ -25789,41 +25792,41 @@ const $ZOOM = {
25789
25792
  * @memberof Options
25790
25793
  * @type {object}
25791
25794
  * @property {object} data Data object
25792
- * @property {boolean} [data.labels=false] Show or hide labels on each data points
25795
+ * @property {boolean} [data.labels=false] Show or hide labels on each data point
25793
25796
  * @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>
25797
+ * @property {function} [data.labels.format] Set formatter function for data labels.<br>
25795
25798
  * 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
25799
  * The arguments are:<br>
25797
25800
  * - `v` is the value of the data point where the label is shown.
25798
25801
  * - `id` is the id of the data where the label is shown.
25799
25802
  * - `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>
25803
+ * - `texts` is an array of whole corresponding data series' text labels.<br><br>
25801
25804
  * 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.
25805
+ * @property {string|object|function} [data.labels.backgroundColors] Set label text background colors.<br><br>
25806
+ * - **NOTE**: When a function is set, background colors can be specified one color per dataset.
25804
25807
  * - Within the function, the last returned color for dataset will be used.
25805
25808
  * - 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>
25809
+ * @property {string|object|function} [data.labels.colors] Set label text colors.
25810
+ * @property {object|function} [data.labels.position] Set each dataset position, relative to the original.<br><br>
25811
+ * 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
25812
  * The arguments are:<br>
25810
25813
  * - `type` coordinate type string, which will be 'x' or 'y'.
25811
25814
  * - `v` is the value of the data point where the label is shown.
25812
25815
  * - `id` is the id of the data where the label is shown.
25813
25816
  * - `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.
25817
+ * - `texts` is an array of whole corresponding data series' text labels.<br><br>
25818
+ * @property {number} [data.labels.position.x=0] x coordinate position, relative to the original.
25819
+ * @property {number} [data.labels.position.y=0] y coordinate position, relative to the original.
25817
25820
  * @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.
25821
+ * - **NOTE:** Depending on the rotate value, the text position needs to be adjusted manually(using `data.labels.position` option) to be shown nicely.
25822
+ * @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
25823
  * @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
25824
  * @property {number} [data.labels.border.radius=10] Border radius value.
25822
25825
  * @property {number} [data.labels.border.strokeWidth=1] Border stroke width.
25823
25826
  * @property {string} [data.labels.border.stroke="#000"] Border stroke color.
25824
25827
  * @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>
25828
+ * @property {object|function} [data.labels.image] Set image to be displayed next to the label text.<br><br>
25829
+ * 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
25830
  * The arguments are:<br>
25828
25831
  * - `v` is the value of the data point where the label is shown.
25829
25832
  * - `id` is the id of the data where the label is shown.
@@ -25832,8 +25835,8 @@ const $ZOOM = {
25832
25835
  * @property {number} data.labels.image.width Image width in pixels.
25833
25836
  * @property {number} data.labels.image.height Image height in pixels.
25834
25837
  * @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.
25838
+ * @property {number} [data.labels.image.pos.x=0] x coordinate position, relative to the original.
25839
+ * @property {number} [data.labels.image.pos.y=0] y coordinate position, relative to the original.
25837
25840
  * @memberof Options
25838
25841
  * @type {object}
25839
25842
  * @default {}
@@ -25867,10 +25870,10 @@ const $ZOOM = {
25867
25870
  * // align text to center of the 'bar' shape (works only for 'bar' type)
25868
25871
  * centered: true,
25869
25872
  *
25870
- * // apply backgound color for label texts
25873
+ * // apply background color for label texts
25871
25874
  * backgroundColors: "red",
25872
25875
  *
25873
- * // set differenct backround colors per dataset
25876
+ * // set different background colors per dataset
25874
25877
  * backgroundColors: {
25875
25878
  * data1: "green",
25876
25879
  * data2: "yellow"
@@ -25981,7 +25984,7 @@ const $ZOOM = {
25981
25984
  * pos: { x: 0, y: 0 }
25982
25985
  * };
25983
25986
  * } else if(v < 5) {
25984
- * // Return falsy value in case of don't want to show image
25987
+ * // Return falsy value in case you don't want to show image
25985
25988
  * return null;
25986
25989
  * } else {
25987
25990
  * return {
@@ -26002,7 +26005,7 @@ const $ZOOM = {
26002
26005
  data_labels_imgUrl: void 0,
26003
26006
  /**
26004
26007
  * 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.
26008
+ * If true is specified, all of data will be hidden. If multiple ids are specified as an array, those will be hidden.
26006
26009
  * @name data․hide
26007
26010
  * @memberof Options
26008
26011
  * @type {boolean|Array}
@@ -26023,7 +26026,7 @@ const $ZOOM = {
26023
26026
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
26024
26027
  * @name data․filter
26025
26028
  * @memberof Options
26026
- * @type {Function}
26029
+ * @type {function}
26027
26030
  * @default undefined
26028
26031
  * @example
26029
26032
  * data: {
@@ -26038,13 +26041,13 @@ const $ZOOM = {
26038
26041
  data_filter: void 0,
26039
26042
  /**
26040
26043
  * 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.
26044
+ * This callback will be called when each data point is clicked and will receive `d` and element as the arguments.
26042
26045
  * - `d` is the data clicked and element is the element clicked.
26043
26046
  * - `element` is the current interacting svg element.
26044
26047
  * - In this callback, `this` will be the Chart object.
26045
26048
  * @name data․onclick
26046
26049
  * @memberof Options
26047
- * @type {Function}
26050
+ * @type {function}
26048
26051
  * @default function() {}
26049
26052
  * @example
26050
26053
  * data: {
@@ -26059,13 +26062,13 @@ const $ZOOM = {
26059
26062
  },
26060
26063
  /**
26061
26064
  * 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.
26065
+ * 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
26066
  * - `d` is the data where mouse cursor moves onto.
26064
26067
  * - `element` is the current interacting svg element.
26065
26068
  * - In this callback, `this` will be the Chart object.
26066
26069
  * @name data․onover
26067
26070
  * @memberof Options
26068
- * @type {Function}
26071
+ * @type {function}
26069
26072
  * @default function() {}
26070
26073
  * @example
26071
26074
  * data: {
@@ -26080,13 +26083,13 @@ const $ZOOM = {
26080
26083
  },
26081
26084
  /**
26082
26085
  * 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.
26086
+ * This callback will be called when the mouse cursor or touch moves out each data point and will receive `d` as the argument.
26084
26087
  * - `d` is the data where mouse cursor moves out.
26085
26088
  * - `element` is the current interacting svg element.
26086
26089
  * - In this callback, `this` will be the Chart object.
26087
26090
  * @name data․onout
26088
26091
  * @memberof Options
26089
- * @type {Function}
26092
+ * @type {function}
26090
26093
  * @default function() {}
26091
26094
  * @example
26092
26095
  * data: {
@@ -26104,7 +26107,7 @@ const $ZOOM = {
26104
26107
  * The callback will receive shown data ids in array.
26105
26108
  * @name data․onshown
26106
26109
  * @memberof Options
26107
- * @type {Function}
26110
+ * @type {function}
26108
26111
  * @default undefined
26109
26112
  * @example
26110
26113
  * data: {
@@ -26120,7 +26123,7 @@ const $ZOOM = {
26120
26123
  * The callback will receive hidden data ids in array.
26121
26124
  * @name data․onhidden
26122
26125
  * @memberof Options
26123
- * @type {Function}
26126
+ * @type {function}
26124
26127
  * @default undefined
26125
26128
  * @example
26126
26129
  * data: {
@@ -26136,7 +26139,7 @@ const $ZOOM = {
26136
26139
  * - **NOTE:** For 'area-line-range', 'area-step-range' and 'area-spline-range', `mid` data will be taken for the comparison
26137
26140
  * @name data․onmin
26138
26141
  * @memberof Options
26139
- * @type {Function}
26142
+ * @type {function}
26140
26143
  * @default undefined
26141
26144
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.OnMinMaxCallback)
26142
26145
  * @example
@@ -26151,7 +26154,7 @@ const $ZOOM = {
26151
26154
  * - **NOTE:** For 'area-line-range', 'area-step-range' and 'area-spline-range', `mid` data will be taken for the comparison
26152
26155
  * @name data․onmax
26153
26156
  * @memberof Options
26154
- * @type {Function}
26157
+ * @type {function}
26155
26158
  * @default undefined
26156
26159
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.OnMinMaxCallback)
26157
26160
  * @example
@@ -26162,7 +26165,7 @@ const $ZOOM = {
26162
26165
  */
26163
26166
  data_onmax: void 0,
26164
26167
  /**
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.
26168
+ * 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
26169
  * @name data․url
26167
26170
  * @memberof Options
26168
26171
  * @type {string}
@@ -26290,7 +26293,7 @@ const $ZOOM = {
26290
26293
  * }
26291
26294
  * }
26292
26295
  *
26293
- * // for 'canlestick' type, data should contain:
26296
+ * // for 'candlestick' type, data should contain:
26294
26297
  * // - an array of [open, high, low, close, volume(optional)] data following the order
26295
26298
  * // - or an object with 'open', 'high', 'low', 'close' and 'value'(optional) key value
26296
26299
  * data: {
@@ -26365,7 +26368,7 @@ const $ZOOM = {
26365
26368
  * type: "bubble"
26366
26369
  * }
26367
26370
  *
26368
- * // for 'canlestick' type, data should contain:
26371
+ * // for 'candlestick' type, data should contain:
26369
26372
  * // - an array of [open, high, low, close, volume(optional)] data following the order
26370
26373
  * // - or an object with 'open', 'high', 'low', 'close' and 'value'(optional) key value
26371
26374
  * data: {
@@ -26453,7 +26456,8 @@ const $ZOOM = {
26453
26456
  * @property {boolean} [interaction.brighten=true] Make brighter for the selected area (ex. 'pie' type data selected area)
26454
26457
  * @property {boolean} [interaction.inputType.mouse=true] enable or disable mouse interaction
26455
26458
  * @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.
26459
+ * @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>
26460
+ * - **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
26461
  * @property {boolean} [interaction.onout=true] Enable or disable "onout" event.<br>
26458
26462
  * When is disabled, defocus(hiding tooltip, focused gridline, etc.) event won't work.
26459
26463
  * @see [Demo: touch.preventDefault](https://naver.github.io/billboard.js/demo/#Interaction.PreventScrollOnTouch)
@@ -28716,7 +28720,83 @@ var util_spreadValues = (a, b) => {
28716
28720
 
28717
28721
 
28718
28722
 
28719
-
28723
+ function _getRect(relativeViewport, node, forceEval = false) {
28724
+ const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
28725
+ if (forceEval) {
28726
+ return _(node);
28727
+ } else {
28728
+ const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +(node.getAttribute("width") || 0);
28729
+ return needEvaluate ? node.rect = _(node) : node.rect;
28730
+ }
28731
+ }
28732
+ function _forEachValidItem(items, callback) {
28733
+ for (let i = 0; i < items.length; i++) {
28734
+ const item = items[i];
28735
+ if (item) {
28736
+ callback(item, i);
28737
+ }
28738
+ }
28739
+ }
28740
+ const _sanitize = (() => {
28741
+ const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
28742
+ const ENTITY_MAP = {
28743
+ quot: 34,
28744
+ amp: 38,
28745
+ apos: 39,
28746
+ lt: 60,
28747
+ gt: 62,
28748
+ nbsp: 160,
28749
+ iexcl: 161,
28750
+ cent: 162,
28751
+ pound: 163,
28752
+ curren: 164,
28753
+ yen: 165
28754
+ };
28755
+ const LT_CODE = 60;
28756
+ const GT_CODE = 62;
28757
+ const MAX_ITERATIONS = 10;
28758
+ const rx = {
28759
+ tags: new RegExp(
28760
+ `<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
28761
+ "gi"
28762
+ ),
28763
+ htmlEntity: /&#x([0-9a-f]+);?|&#([0-9]+);?|&([a-z]+);/gi,
28764
+ // eslint-disable-next-line no-control-regex
28765
+ controlChar: /[\x00-\x1F\x7F]/g,
28766
+ eventHandler: /\s+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)|on\w+\s*=\s*(?:"[^"]*"|'[^']*'|`[^`]*`|[^\s>]*)/gi,
28767
+ dangerousUri: /(href|src|action|xlink:href)\s*=\s*(['"`]?)([^'"`>\s]*)\2/gi,
28768
+ dangerousProtocol: /^(javascript|data|vbscript):/
28769
+ };
28770
+ return {
28771
+ ENTITY_MAP,
28772
+ LT_CODE,
28773
+ GT_CODE,
28774
+ MAX_ITERATIONS,
28775
+ rx,
28776
+ /**
28777
+ * Decode HTML entities to prevent bypass attacks
28778
+ * @param {string} str String with potential HTML entities
28779
+ * @returns {string} Decoded string
28780
+ */
28781
+ decodeEntities(str) {
28782
+ return str.replace(rx.htmlEntity, (match, hex, dec, named) => {
28783
+ const code = hex ? parseInt(hex, 16) : dec ? parseInt(dec, 10) : named ? ENTITY_MAP[named.toLowerCase()] || 0 : 0;
28784
+ return code && code !== LT_CODE && code !== GT_CODE ? String.fromCharCode(code) : match;
28785
+ });
28786
+ },
28787
+ /**
28788
+ * Remove dangerous URI protocols from attribute values
28789
+ * @param {string} str String to sanitize
28790
+ * @returns {string} Sanitized string
28791
+ */
28792
+ removeDangerousUris(str) {
28793
+ return str.replace(rx.dangerousUri, (match, attr, quote, value) => {
28794
+ const normalized = value.toLowerCase().replace(/\s/g, "");
28795
+ return rx.dangerousProtocol.test(normalized) ? `${attr}=${quote}${quote}` : match;
28796
+ });
28797
+ }
28798
+ };
28799
+ })();
28720
28800
  const isValue = (v) => v || v === 0;
28721
28801
  const isFunction = (v) => typeof v === "function";
28722
28802
  const isString = (v) => typeof v === "string";
@@ -28763,26 +28843,20 @@ function endall(transition, cb) {
28763
28843
  transition.call(end);
28764
28844
  }
28765
28845
  }
28766
- const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
28767
- const sanitizeRx = {
28768
- tags: new RegExp(
28769
- `<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
28770
- "gi"
28771
- ),
28772
- // Handles: whitespace, slash, quotes before event handlers (e.g., <img/onerror=...>, <img src="x"onerror=...>)
28773
- eventHandlers: /[\s/"']+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,
28774
- // Handles: javascript/data/vbscript URIs with optional whitespace/newlines between protocol and colon
28775
- dangerousURIs: /(href|src|action|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript)\s*:/gi
28776
- };
28777
28846
  function sanitize(str) {
28778
28847
  if (!isString(str) || !str || str.indexOf("<") === -1) {
28779
28848
  return str;
28780
28849
  }
28781
28850
  let result = str;
28782
28851
  let prev;
28852
+ let iterations = 0;
28783
28853
  do {
28784
28854
  prev = result;
28785
- result = result.replace(sanitizeRx.tags, "").replace(sanitizeRx.eventHandlers, "").replace(sanitizeRx.dangerousURIs, '$1=""');
28855
+ result = _sanitize.decodeEntities(result).replace(_sanitize.rx.controlChar, "").replace(_sanitize.rx.tags, "").replace(_sanitize.rx.eventHandler, "");
28856
+ result = _sanitize.removeDangerousUris(result);
28857
+ if (++iterations >= _sanitize.MAX_ITERATIONS) {
28858
+ break;
28859
+ }
28786
28860
  } while (result !== prev);
28787
28861
  return result;
28788
28862
  }
@@ -28850,20 +28924,11 @@ function getBrushSelection(ctx) {
28850
28924
  }
28851
28925
  return selection;
28852
28926
  }
28853
- function getRect(relativeViewport, node, forceEval = false) {
28854
- const _ = (n) => n[relativeViewport ? "getBoundingClientRect" : "getBBox"]();
28855
- if (forceEval) {
28856
- return _(node);
28857
- } else {
28858
- const needEvaluate = !("rect" in node) || "rect" in node && node.hasAttribute("width") && node.rect.width !== +(node.getAttribute("width") || 0);
28859
- return needEvaluate ? node.rect = _(node) : node.rect;
28860
- }
28861
- }
28862
28927
  function getBoundingRect(node, forceEval = false) {
28863
- return getRect(true, node, forceEval);
28928
+ return _getRect(true, node, forceEval);
28864
28929
  }
28865
28930
  function getBBox(node, forceEval = false) {
28866
- return getRect(false, node, forceEval);
28931
+ return _getRect(false, node, forceEval);
28867
28932
  }
28868
28933
  function getRandom(asStr = true, min = 0, max = 1e4) {
28869
28934
  const crpt = win.crypto || win.msCrypto;
@@ -29175,6 +29240,35 @@ function parseShorthand(value) {
29175
29240
  const [a, b = a, c = a, d = b] = values;
29176
29241
  return { top: a, right: b, bottom: c, left: d };
29177
29242
  }
29243
+ function scheduleRAFUpdate(rafState, callback) {
29244
+ if (rafState.pendingRaf !== null) {
29245
+ win.cancelAnimationFrame(rafState.pendingRaf);
29246
+ rafState.pendingRaf = win.requestAnimationFrame(() => {
29247
+ rafState.pendingRaf = null;
29248
+ callback();
29249
+ });
29250
+ } else {
29251
+ rafState.pendingRaf = win.requestAnimationFrame(() => {
29252
+ rafState.pendingRaf = null;
29253
+ });
29254
+ callback();
29255
+ }
29256
+ }
29257
+ function toSet(items, keyFn = ((item) => item)) {
29258
+ const set = /* @__PURE__ */ new Set();
29259
+ _forEachValidItem(items, (item, i) => {
29260
+ set.add(keyFn(item, i));
29261
+ });
29262
+ return set;
29263
+ }
29264
+ function toMap(items, keyFn, valueFn = ((item) => item)) {
29265
+ const map = /* @__PURE__ */ new Map();
29266
+ _forEachValidItem(items, (item, i) => {
29267
+ map.set(keyFn(item, i), valueFn(item, i));
29268
+ });
29269
+ return map;
29270
+ }
29271
+
29178
29272
 
29179
29273
  ;// ./src/config/Options/Options.ts
29180
29274
  var Options_defProp = Object.defineProperty;
@@ -29337,6 +29431,10 @@ class State {
29337
29431
  hasTreemap: false,
29338
29432
  // for data CSS rule index (used when boost.useCssRule is true)
29339
29433
  cssRule: {},
29434
+ // Data loading state (used in scale calculation)
29435
+ loading: void 0,
29436
+ // Zoom/subchart domain (different from current.domain which is for rendering)
29437
+ domain: void 0,
29340
29438
  current: {
29341
29439
  // current domain value. Assigned when is zoom is called
29342
29440
  domain: void 0,
@@ -29450,7 +29548,10 @@ class State {
29450
29548
  x2: null,
29451
29549
  y1: null,
29452
29550
  y2: null
29453
- }
29551
+ },
29552
+ // RAF batching for zoom/drag interactions
29553
+ pendingRaf: null,
29554
+ rafBatchQueue: []
29454
29555
  };
29455
29556
  }
29456
29557
  }
@@ -29484,12 +29585,18 @@ const KEY = {
29484
29585
  dataMinMax: "$dataMinMax",
29485
29586
  dataTotalSum: "$dataTotalSum",
29486
29587
  dataTotalPerIndex: "$totalPerIndex",
29588
+ domainMinMax: "$domainMinMax",
29589
+ filteredTargets: "$filteredTargets",
29590
+ filteredNullish: "$filteredNullish",
29591
+ visibilityChecksum: "visibilityChecksum",
29487
29592
  legendItemTextBox: "legendItemTextBox",
29593
+ legendItemMap: "$legendItemMap",
29488
29594
  radarPoints: "$radarPoints",
29489
29595
  radarTextWidth: "$radarTextWidth",
29490
29596
  setOverOut: "setOverOut",
29491
29597
  callOverOutForTouch: "callOverOutForTouch",
29492
- textRect: "textRect"
29598
+ textRect: "textRect",
29599
+ shapeOffset: "$shapeOffset"
29493
29600
  };
29494
29601
  class Cache {
29495
29602
  constructor() {
@@ -29498,9 +29605,9 @@ class Cache {
29498
29605
  /**
29499
29606
  * Add cache
29500
29607
  * @param {string} key Cache key
29501
- * @param {*} value Value to be stored
29608
+ * @param {string|number|boolean|object|Array|function|null|undefined} value Value to be stored
29502
29609
  * @param {boolean} isDataType Weather the cache is data typed '{id:'data', id_org: 'data', values: [{x:0, index:0,...}, ...]}'
29503
- * @returns {*} Added data value
29610
+ * @returns {string|number|boolean|object|Array|function|null|undefined} Added data value
29504
29611
  * @private
29505
29612
  */
29506
29613
  add(key, value, isDataType = false) {
@@ -29519,7 +29626,7 @@ class Cache {
29519
29626
  * Get cahce
29520
29627
  * @param {string|Array} key Cache key
29521
29628
  * @param {boolean} isDataType Weather the cache is data typed '{id:'data', id_org: 'data', values: [{x:0, index:0,...}, ...]}'
29522
- * @returns {*}
29629
+ * @returns {string|number|boolean|object|Array|function|null} Cached value
29523
29630
  * @private
29524
29631
  */
29525
29632
  get(key, isDataType = false) {
@@ -29536,6 +29643,23 @@ class Cache {
29536
29643
  return isValue(value) ? value : null;
29537
29644
  }
29538
29645
  }
29646
+ /**
29647
+ * Check if cache key exists
29648
+ * @param {string} key Cache key
29649
+ * @returns {boolean} True if key exists in cache
29650
+ * @private
29651
+ */
29652
+ has(key) {
29653
+ return key in this.cache && this.cache[key] !== null;
29654
+ }
29655
+ /**
29656
+ * Get all cache keys
29657
+ * @returns {string[]} Array of cache keys
29658
+ * @private
29659
+ */
29660
+ getKeys() {
29661
+ return Object.keys(this.cache);
29662
+ }
29539
29663
  /**
29540
29664
  * Reset cached data
29541
29665
  * @param {boolean} all true: reset all data, false: reset only '$' prefixed key data
@@ -30079,14 +30203,14 @@ function convert_helper_tsv(tsv2) {
30079
30203
 
30080
30204
 
30081
30205
 
30082
- function getDataKeyForJson(keysParam, config) {
30206
+ function _getDataKeyForJson(keysParam, config) {
30083
30207
  const keys = keysParam || (config == null ? void 0 : config.data_keys);
30084
30208
  if (keys == null ? void 0 : keys.x) {
30085
30209
  config.data_x = keys.x;
30086
30210
  }
30087
30211
  return keys;
30088
30212
  }
30089
- function setXS(ids, data, params) {
30213
+ function _setXS(ids, data, params) {
30090
30214
  const $$ = this;
30091
30215
  const { config } = $$;
30092
30216
  let xsData;
@@ -30119,7 +30243,7 @@ function setXS(ids, data, params) {
30119
30243
  /**
30120
30244
  * Convert data according its type
30121
30245
  * @param {object} args data object
30122
- * @param {Function} [callback] callback for url(XHR) type loading
30246
+ * @param {function} [callback] callback for url(XHR) type loading
30123
30247
  * @private
30124
30248
  */
30125
30249
  convertData(args, callback) {
@@ -30140,13 +30264,13 @@ function setXS(ids, data, params) {
30140
30264
  data.url,
30141
30265
  data.mimeType,
30142
30266
  data.headers,
30143
- getDataKeyForJson(data.keys, config),
30267
+ _getDataKeyForJson(data.keys, config),
30144
30268
  callback
30145
30269
  );
30146
30270
  } else if (data.json) {
30147
30271
  runWorker(useWorker(data.json), json, callback, [columns, rows])(
30148
30272
  data.json,
30149
- getDataKeyForJson(data.keys, config)
30273
+ _getDataKeyForJson(data.keys, config)
30150
30274
  );
30151
30275
  } else if (data.rows) {
30152
30276
  runWorker(useWorker(data.rows), rows, callback)(data.rows);
@@ -30184,13 +30308,13 @@ function setXS(ids, data, params) {
30184
30308
  timeSeries: axis == null ? void 0 : axis.isTimeSeries(),
30185
30309
  customX: axis == null ? void 0 : axis.isCustomX()
30186
30310
  };
30187
- setXS.bind($$)(ids, data, params);
30311
+ _setXS.bind($$)(ids, data, params);
30188
30312
  const targets = ids.map((id, index) => {
30189
30313
  const convertedId = config.data_idConverter.bind($$.api)(id);
30190
30314
  const xKey = $$.getXKey(id);
30191
30315
  const isCategory = params.customX && params.categorized;
30192
30316
  const hasCategory = isCategory && (() => {
30193
- const categorySet = new Set(config.axis_x_categories);
30317
+ const categorySet = toSet(config.axis_x_categories);
30194
30318
  return data.every((v) => categorySet.has(v.x));
30195
30319
  })();
30196
30320
  const isDataAppend = data.__append__;
@@ -30270,7 +30394,17 @@ function setXS(ids, data, params) {
30270
30394
  },
30271
30395
  isStackNormalized() {
30272
30396
  const { config } = this;
30273
- return !!(config.data_stack_normalize && config.data_groups.length);
30397
+ return !!((config.data_stack_normalize === true || isObjectType(config.data_stack_normalize)) && config.data_groups.length);
30398
+ },
30399
+ /**
30400
+ * Check if stack normalization should be applied per group
30401
+ * @returns {boolean}
30402
+ * @private
30403
+ */
30404
+ isStackNormalizedPerGroup() {
30405
+ var _a;
30406
+ const { config } = this;
30407
+ return !!(isObjectType(config.data_stack_normalize) && ((_a = config.data_stack_normalize) == null ? void 0 : _a.perGroup) && config.data_groups.length);
30274
30408
  },
30275
30409
  /**
30276
30410
  * Check if given id is grouped data or has grouped data
@@ -30282,6 +30416,19 @@ function setXS(ids, data, params) {
30282
30416
  const groups = this.config.data_groups;
30283
30417
  return id ? groups.some((v) => v.indexOf(id) >= 0 && v.length > 1) : groups.length > 0;
30284
30418
  },
30419
+ /**
30420
+ * Check if the given axis has any grouped data
30421
+ * @param {string} axisId Axis ID (e.g., "y", "y2")
30422
+ * @returns {boolean} true if axis has grouped data
30423
+ * @private
30424
+ */
30425
+ hasAxisGroupedData(axisId) {
30426
+ const $$ = this;
30427
+ const { axis } = $$;
30428
+ const targets = $$.data.targets;
30429
+ const axisDataIds = targets.filter((t) => axis.getId(t.id) === axisId).map((t) => t.id);
30430
+ return axisDataIds.some((id) => $$.isGrouped(id));
30431
+ },
30285
30432
  getXKey(id) {
30286
30433
  const $$ = this;
30287
30434
  const { config } = $$;
@@ -30473,16 +30620,27 @@ function setXS(ids, data, params) {
30473
30620
  },
30474
30621
  /**
30475
30622
  * Get sum of data per index
30623
+ * @param {string} targetId Target ID to get total for (only for normalized stack per group)
30476
30624
  * @private
30477
30625
  * @returns {Array}
30478
30626
  */
30479
- getTotalPerIndex() {
30627
+ getTotalPerIndex(targetId) {
30480
30628
  const $$ = this;
30481
- const cacheKey = KEY.dataTotalPerIndex;
30629
+ const { config } = $$;
30630
+ const cacheKey = targetId ? `${KEY.dataTotalPerIndex}-${targetId}` : KEY.dataTotalPerIndex;
30482
30631
  let sum = $$.cache.get(cacheKey);
30483
30632
  if (($$.config.data_groups.length || $$.isStackNormalized()) && !sum) {
30484
30633
  sum = [];
30485
- $$.data.targets.forEach((row) => {
30634
+ let { targets } = $$.data;
30635
+ if ($$.isStackNormalizedPerGroup() && targetId) {
30636
+ const group = config.data_groups.find((g) => g.indexOf(targetId) >= 0);
30637
+ if (group) {
30638
+ targets = targets.filter((t) => group.indexOf(t.id) >= 0);
30639
+ } else {
30640
+ return null;
30641
+ }
30642
+ }
30643
+ targets.forEach((row) => {
30486
30644
  row.values.forEach((v, i) => {
30487
30645
  if (!sum[i]) {
30488
30646
  sum[i] = 0;
@@ -30490,6 +30648,7 @@ function setXS(ids, data, params) {
30490
30648
  sum[i] += ~~v.value;
30491
30649
  });
30492
30650
  });
30651
+ $$.cache.add(cacheKey, sum);
30493
30652
  }
30494
30653
  return sum;
30495
30654
  },
@@ -30505,7 +30664,10 @@ function setXS(ids, data, params) {
30505
30664
  let total = $$.cache.get(cacheKey);
30506
30665
  if (!isNumber(total)) {
30507
30666
  total = $$.data.targets.reduce((acc, t) => {
30508
- return acc + t.values.reduce((sum, v) => sum + ~~v.value, 0);
30667
+ return acc + t.values.reduce((sum, v) => {
30668
+ var _a;
30669
+ return sum + ((_a = v.value) != null ? _a : 0);
30670
+ }, 0);
30509
30671
  }, 0);
30510
30672
  $$.cache.add(cacheKey, total);
30511
30673
  }
@@ -30585,7 +30747,23 @@ function setXS(ids, data, params) {
30585
30747
  },
30586
30748
  filterTargetsToShow(targets) {
30587
30749
  const $$ = this;
30588
- return (targets || $$.data.targets).filter((t) => $$.isTargetToShow(t.id));
30750
+ if (!targets) {
30751
+ const { cache, data, state } = $$;
30752
+ const cacheKey = KEY.filteredTargets;
30753
+ const visibilityChecksum = state.hiddenTargetIds.join(",");
30754
+ const storedChecksum = cache.get(KEY.visibilityChecksum);
30755
+ if (visibilityChecksum !== storedChecksum) {
30756
+ cache.remove(cacheKey);
30757
+ cache.add(KEY.visibilityChecksum, visibilityChecksum);
30758
+ }
30759
+ if (cache.has(cacheKey)) {
30760
+ return cache.get(cacheKey);
30761
+ }
30762
+ const filtered = data.targets.filter((t) => $$.isTargetToShow(t.id));
30763
+ cache.add(cacheKey, filtered);
30764
+ return filtered;
30765
+ }
30766
+ return targets.filter((t) => $$.isTargetToShow(t.id));
30589
30767
  },
30590
30768
  mapTargetsToUniqueXs(targets) {
30591
30769
  const $$ = this;
@@ -30600,7 +30778,7 @@ function setXS(ids, data, params) {
30600
30778
  return sortValue(xs);
30601
30779
  },
30602
30780
  /**
30603
- * Add to the state target Ids
30781
+ * Add to thetarget Ids
30604
30782
  * @param {string} type State's prop name
30605
30783
  * @param {Array|string} targetIds Target ids array
30606
30784
  * @private
@@ -30644,6 +30822,7 @@ function setXS(ids, data, params) {
30644
30822
  const ys = {};
30645
30823
  const isMultipleX = $$.isMultipleX();
30646
30824
  const xs = isMultipleX ? $$.mapTargetsToUniqueXs(targets).map((v) => isString(v) ? v : +v) : null;
30825
+ const xIndexMap = xs ? new Map(xs.map((x, i) => [x, i])) : null;
30647
30826
  targets.forEach((t) => {
30648
30827
  const data = [];
30649
30828
  t.values.filter(({ value }) => isValue(value) || value === null).forEach((v) => {
@@ -30658,8 +30837,12 @@ function setXS(ids, data, params) {
30658
30837
  } else if ($$.isBubbleZType(v)) {
30659
30838
  data.push(hasAxis && $$.getBubbleZData(value, "y"));
30660
30839
  } else {
30661
- if (isMultipleX) {
30662
- data[$$.getIndexByX(v.x, xs)] = value;
30840
+ if (isMultipleX && xIndexMap) {
30841
+ const xKey = isString(v.x) ? v.x : +v.x;
30842
+ const index = xIndexMap.get(xKey);
30843
+ if (index !== void 0) {
30844
+ data[index] = value;
30845
+ }
30663
30846
  } else {
30664
30847
  data.push(value);
30665
30848
  }
@@ -30698,7 +30881,7 @@ function setXS(ids, data, params) {
30698
30881
  /**
30699
30882
  * Get data.order compare function
30700
30883
  * @param {boolean} isReversed for Arc & Treemap type sort order needs to be reversed
30701
- * @returns {Function} compare function
30884
+ * @returns {function} compare function
30702
30885
  * @private
30703
30886
  */
30704
30887
  getSortCompareFn(isReversed = false) {
@@ -30980,12 +31163,27 @@ function setXS(ids, data, params) {
30980
31163
  }
30981
31164
  } else if (type === "index") {
30982
31165
  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]);
31166
+ const { hiddenTargetIds } = state;
31167
+ let total = this.getTotalPerIndex(
31168
+ $$.isStackNormalizedPerGroup() ? d.id : void 0
31169
+ );
31170
+ if (total === null) {
31171
+ return ratio;
31172
+ }
31173
+ if (hiddenTargetIds.length) {
31174
+ let hiddenIds = hiddenTargetIds;
31175
+ if ($$.isStackNormalizedPerGroup() && d.id) {
31176
+ const group = config.data_groups.find((g) => g.indexOf(d.id) >= 0);
31177
+ if (group) {
31178
+ hiddenIds = hiddenIds.filter((id) => group.indexOf(id) >= 0);
31179
+ }
31180
+ }
31181
+ if (hiddenIds.length) {
31182
+ let hiddenSum = dataValues(hiddenIds, false);
31183
+ if (hiddenSum.length) {
31184
+ hiddenSum = hiddenSum.reduce((acc, curr) => acc.map((v, i) => ~~v + curr[i]));
31185
+ total = total.map((v, i) => v - hiddenSum[i]);
31186
+ }
30989
31187
  }
30990
31188
  }
30991
31189
  const divisor = total[d.index];
@@ -31163,8 +31361,6 @@ function callDone(fn, resizeAfter = false) {
31163
31361
  done();
31164
31362
  return;
31165
31363
  }
31166
- const targets = $el.svg.selectAll(targetIds.map((id) => $$.selectorTarget(id)));
31167
- $T(targets).style("opacity", "0").remove().call(endall, done);
31168
31364
  targetIds.forEach((id) => {
31169
31365
  var _a2;
31170
31366
  const suffixId = $$.getTargetSelectorSuffix(id);
@@ -31178,6 +31374,8 @@ function callDone(fn, resizeAfter = false) {
31178
31374
  state.hasFunnel && $$.updateFunnel($$.data.targets);
31179
31375
  state.hasTreemap && $$.updateTargetsForTreemap($$.data.targets);
31180
31376
  $$.updateTypesElements();
31377
+ const targets = $el.svg.selectAll(targetIds.map((id) => $$.selectorTarget(id)));
31378
+ $T(targets).style("opacity", "0").remove().call(endall, done);
31181
31379
  }
31182
31380
  });
31183
31381
 
@@ -31466,7 +31664,7 @@ function drag_defaultTouchable() {
31466
31664
  },
31467
31665
  /**
31468
31666
  * Return draggable selection function
31469
- * @returns {Function}
31667
+ * @returns {function}
31470
31668
  * @private
31471
31669
  */
31472
31670
  getDraggableSelection() {
@@ -31833,7 +32031,7 @@ function ordinal() {
31833
32031
 
31834
32032
 
31835
32033
 
31836
- const colorizePattern = (pattern, color, id) => {
32034
+ const _colorizePattern = (pattern, color, id) => {
31837
32035
  const node = src_select(pattern.cloneNode(true));
31838
32036
  node.attr("id", id).insert("rect", ":first-child").attr("width", node.attr("width")).attr("height", node.attr("height")).style("fill", color);
31839
32037
  return {
@@ -31841,7 +32039,7 @@ const colorizePattern = (pattern, color, id) => {
31841
32039
  node: node.node()
31842
32040
  };
31843
32041
  };
31844
- function getColorFromCss(element) {
32042
+ function _getColorFromCss(element) {
31845
32043
  const cacheKey = KEY.colorPattern;
31846
32044
  const { body } = browser_doc;
31847
32045
  let pattern = body[cacheKey];
@@ -31873,14 +32071,15 @@ const schemeCategory10 = [
31873
32071
  const $$ = this;
31874
32072
  const { $el, config } = $$;
31875
32073
  const ids = [];
31876
- let pattern = notEmpty(config.color_pattern) ? config.color_pattern : ordinal(getColorFromCss($el.chart) || schemeCategory10).range();
32074
+ const hasGradient = config.area_linearGradient || config.bar_linearGradient || config.point_radialGradient;
32075
+ let pattern = notEmpty(config.color_pattern) ? config.color_pattern : ordinal(_getColorFromCss($el.chart) || schemeCategory10).range();
31877
32076
  const originalColorPattern = pattern;
31878
32077
  if (isFunction(config.color_tiles)) {
31879
32078
  const tiles = config.color_tiles.bind($$.api)();
31880
32079
  const colorizedPatterns = pattern.map((p, index) => {
31881
32080
  const color = p.replace(/[#\(\)\s,]/g, "");
31882
32081
  const id = `${$$.state.datetimeId}-pattern-${color}-${index}`;
31883
- return colorizePattern(tiles[index % tiles.length], p, id);
32082
+ return _colorizePattern(tiles[index % tiles.length], p, id);
31884
32083
  });
31885
32084
  pattern = colorizedPatterns.map((p) => `url(#${p.id})`);
31886
32085
  $$.patterns = colorizedPatterns;
@@ -31903,7 +32102,18 @@ const schemeCategory10 = [
31903
32102
  color = isLine ? originalColorPattern[ids.indexOf(id) % originalColorPattern.length] : pattern[ids.indexOf(id) % pattern.length];
31904
32103
  colors[id] = color;
31905
32104
  }
31906
- return isFunction(callback) ? callback.bind($$.api)(color, d) : color;
32105
+ color = isFunction(callback) ? callback.call($$.api, color, d) : color;
32106
+ if (hasGradient) {
32107
+ const stop = $$.$el.defs.selectAll(
32108
+ `[id$='-gradient${$$.getTargetSelectorSuffix(id)}'] stop`
32109
+ );
32110
+ let hasSameColor;
32111
+ stop.each(function(d2, i) {
32112
+ hasSameColor = i === 0 ? this.style.stopColor : this.style.stopColor === hasSameColor;
32113
+ });
32114
+ hasSameColor === true && stop.attr("stop-color", color);
32115
+ }
32116
+ return color;
31907
32117
  };
31908
32118
  },
31909
32119
  generateLevelColor() {
@@ -31928,7 +32138,7 @@ const schemeCategory10 = [
31928
32138
  },
31929
32139
  /**
31930
32140
  * Append data backgound color filter definition
31931
- * @param {string|object|Function} color Color string, object, or function
32141
+ * @param {string|object|function} color Color string, object, or function
31932
32142
  * @param {object} attr filter attribute
31933
32143
  * @private
31934
32144
  */
@@ -32052,20 +32262,22 @@ const schemeCategory10 = [
32052
32262
  const isMin = type === "min";
32053
32263
  const dataGroups = config.data_groups;
32054
32264
  const ids = $$.mapToIds(targets);
32265
+ const idsSet = toSet(ids);
32055
32266
  const ys = $$.getValuesAsIdKeyed(targets);
32056
32267
  if (dataGroups.length > 0) {
32057
32268
  const hasValue = $$[`has${isMin ? "Negative" : "Positive"}ValueInTargets`](targets);
32269
+ const axisIdMap = new Map(ids.map((id) => [id, axis.getId(id)]));
32058
32270
  dataGroups.forEach((groupIds) => {
32059
- const idsInGroup = groupIds.filter((v) => ids.indexOf(v) >= 0);
32271
+ const idsInGroup = groupIds.filter((v) => idsSet.has(v));
32060
32272
  if (idsInGroup.length) {
32061
32273
  const baseId = idsInGroup[0];
32062
- const baseAxisId = axis.getId(baseId);
32274
+ const baseAxisId = axisIdMap.get(baseId);
32063
32275
  if (hasValue && ys[baseId]) {
32064
32276
  ys[baseId] = ys[baseId].map((v) => (isMin ? v < 0 : v > 0) ? v : 0);
32065
32277
  }
32066
32278
  idsInGroup.filter((v, i) => i > 0).forEach((id) => {
32067
32279
  if (ys[id]) {
32068
- const axisId = axis.getId(id);
32280
+ const axisId = axisIdMap.get(id);
32069
32281
  ys[id].forEach((v, i) => {
32070
32282
  const val = +v;
32071
32283
  const meetCondition = isMin ? val > 0 : val < 0;
@@ -32095,7 +32307,11 @@ const schemeCategory10 = [
32095
32307
  const { axis, config, scale } = $$;
32096
32308
  const pfx = `axis_${axisId}`;
32097
32309
  if ($$.isStackNormalized()) {
32098
- return [0, 100];
32310
+ const axisDataIds = targets.filter((t) => axis.getId(t.id) === axisId).map((t) => t.id);
32311
+ const hasGroupedData = axisDataIds.some((id) => $$.isGrouped(id));
32312
+ if (hasGroupedData) {
32313
+ return [0, 100];
32314
+ }
32099
32315
  }
32100
32316
  const isLog = (scale == null ? void 0 : scale[axisId]) && scale[axisId].type === "log";
32101
32317
  const targetsByAxisId = targets.filter((t) => axis.getId(t.id) === axisId);
@@ -32398,7 +32614,7 @@ const schemeCategory10 = [
32398
32614
 
32399
32615
  ;// ./src/ChartInternal/internals/format.ts
32400
32616
 
32401
- function getFormat($$, typeValue, v) {
32617
+ function _getFormat($$, typeValue, v) {
32402
32618
  const { config } = $$;
32403
32619
  const type = `axis_${typeValue}_tick_format`;
32404
32620
  const format = config[type] ? config[type] : $$.defaultValueFormat;
@@ -32406,14 +32622,14 @@ function getFormat($$, typeValue, v) {
32406
32622
  }
32407
32623
  /* harmony default export */ var format = ({
32408
32624
  yFormat(v) {
32409
- return getFormat(this, "y", v);
32625
+ return _getFormat(this, "y", v);
32410
32626
  },
32411
32627
  y2Format(v) {
32412
- return getFormat(this, "y2", v);
32628
+ return _getFormat(this, "y2", v);
32413
32629
  },
32414
32630
  /**
32415
32631
  * Get default value format function
32416
- * @returns {Function} formatter function
32632
+ * @returns {function} formatter function
32417
32633
  * @private
32418
32634
  */
32419
32635
  getDefaultValueFormat() {
@@ -32467,13 +32683,13 @@ function getFormat($$, typeValue, v) {
32467
32683
 
32468
32684
 
32469
32685
 
32470
- function getLegendColor(id) {
32686
+ function _getLegendColor(id) {
32471
32687
  const $$ = this;
32472
32688
  const data = $$.getDataById(id);
32473
32689
  const color = $$.levelColor ? $$.levelColor(data.values[0].value) : $$.color(data);
32474
32690
  return color;
32475
32691
  }
32476
- function getFormattedText(id, formatted = true) {
32692
+ function _getFormattedText(id, formatted = true) {
32477
32693
  var _a;
32478
32694
  const { config } = this;
32479
32695
  let text = (_a = config.data_names[id]) != null ? _a : id;
@@ -32482,6 +32698,21 @@ function getFormattedText(id, formatted = true) {
32482
32698
  }
32483
32699
  return text;
32484
32700
  }
32701
+ function _buildLegendItemMap($$, legendItems) {
32702
+ if (!legendItems || legendItems.empty()) {
32703
+ return;
32704
+ }
32705
+ const items = [];
32706
+ legendItems.each(function(id) {
32707
+ items.push({ id, node: this });
32708
+ });
32709
+ const itemMap = toMap(
32710
+ items,
32711
+ (item) => item.id,
32712
+ (item) => item.node
32713
+ );
32714
+ $$.cache.add(KEY.legendItemMap, itemMap);
32715
+ }
32485
32716
  /* harmony default export */ var internals_legend = ({
32486
32717
  /**
32487
32718
  * Initialize the legend.
@@ -32640,9 +32871,13 @@ function getFormattedText(id, formatted = true) {
32640
32871
  * @private
32641
32872
  */
32642
32873
  updateLegendItemColor(id, color) {
32643
- const { legend } = this.$el;
32874
+ const $$ = this;
32875
+ const { legend } = $$.$el;
32644
32876
  if (legend) {
32645
- legend.select(`.${$LEGEND.legendItem}-${id} line`).style("stroke", color);
32877
+ const legendItem = $$.getLegendItemById(id);
32878
+ if (legendItem) {
32879
+ src_select(legendItem).select("line").style("stroke", color);
32880
+ }
32646
32881
  }
32647
32882
  },
32648
32883
  /**
@@ -32843,6 +33078,24 @@ function getFormattedText(id, formatted = true) {
32843
33078
  } : null);
32844
33079
  !item.empty() && item.on("click mouseout mouseover") && item.style("cursor", $$.getStylePropValue("pointer"));
32845
33080
  }
33081
+ _buildLegendItemMap($$, item);
33082
+ },
33083
+ /**
33084
+ * Get legend item node by ID using cached Map for O(1) lookup
33085
+ * Falls back to D3 selection if map is not available
33086
+ * @param {string} id Data ID
33087
+ * @returns {HTMLElement | null} Legend item node
33088
+ * @private
33089
+ */
33090
+ getLegendItemById(id) {
33091
+ var _a;
33092
+ const $$ = this;
33093
+ const itemMap = $$.cache.get(KEY.legendItemMap);
33094
+ if (itemMap && itemMap instanceof Map) {
33095
+ return itemMap.get(id) || null;
33096
+ }
33097
+ const item = (_a = $$.$el.legend) == null ? void 0 : _a.selectAll(`.${$LEGEND.legendItem}`).filter((d) => d === id);
33098
+ return (item == null ? void 0 : item.node()) || null;
32846
33099
  },
32847
33100
  /**
32848
33101
  * Update the legend
@@ -32916,9 +33169,9 @@ function getFormattedText(id, formatted = true) {
32916
33169
  background = legend.insert("g", `.${$LEGEND.legendItem}`).attr("class", $LEGEND.legendBackground).append("rect");
32917
33170
  }
32918
33171
  if (config.legend_tooltip) {
32919
- legend.selectAll("title").data(targetIdz).text((id) => getFormattedText.bind($$)(id, false));
33172
+ legend.selectAll("title").data(targetIdz).text((id) => _getFormattedText.bind($$)(id, false));
32920
33173
  }
32921
- const texts = legend.selectAll("text").data(targetIdz).text((id) => getFormattedText.bind($$)(id)).each(function(id, i) {
33174
+ const texts = legend.selectAll("text").data(targetIdz).text((id) => _getFormattedText.bind($$)(id)).each(function(id, i) {
32922
33175
  updatePositions(this, id, i);
32923
33176
  });
32924
33177
  $T(texts, withTransition).attr("x", posFn.xText).attr("y", posFn.yText);
@@ -32937,7 +33190,7 @@ function getFormattedText(id, formatted = true) {
32937
33190
  * @param {Array} targetIdz Data ids
32938
33191
  * @param {object} dimension Dimension object
32939
33192
  * @param {object} sizes Size object
32940
- * @returns {Function} Update position function
33193
+ * @returns {function} Update position function
32941
33194
  * @private
32942
33195
  */
32943
33196
  getUpdateLegendPositions(targetIdz, dimension, sizes) {
@@ -33011,7 +33264,7 @@ function getFormattedText(id, formatted = true) {
33011
33264
  * Generate legend item elements
33012
33265
  * @param {Array} targetIdz Data ids
33013
33266
  * @param {object} itemTileSize Item tile size {width, height}
33014
- * @param {Function} updatePositions Update position function
33267
+ * @param {function} updatePositions Update position function
33015
33268
  * @param {object} posFn Position functions
33016
33269
  * @private
33017
33270
  */
@@ -33029,14 +33282,14 @@ function getFormattedText(id, formatted = true) {
33029
33282
  if (config.legend_tooltip) {
33030
33283
  l.append("title").text((id) => id);
33031
33284
  }
33032
- l.append("text").text((id) => getFormattedText.bind($$)(id)).each(function(id, i) {
33285
+ l.append("text").text((id) => _getFormattedText.bind($$)(id)).each(function(id, i) {
33033
33286
  updatePositions(this, id, i);
33034
33287
  }).style("pointer-events", $$.getStylePropValue("none")).attr("x", isLegendRightOrInset ? posFn.xText : pos).attr("y", isLegendRightOrInset ? pos : posFn.yText);
33035
33288
  l.append("rect").attr("class", $LEGEND.legendItemEvent).style("fill-opacity", $$.getStylePropValue("0")).attr("x", isLegendRightOrInset ? posFn.xRect : pos).attr("y", isLegendRightOrInset ? pos : posFn.yRect);
33036
33289
  if (usePoint) {
33037
33290
  const ids = [];
33291
+ const pattern = $$.getValidPointPattern();
33038
33292
  l.append((d) => {
33039
- const pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type];
33040
33293
  ids.indexOf(d) === -1 && ids.push(d);
33041
33294
  let point = pattern[ids.indexOf(d) % pattern.length];
33042
33295
  if (point === "rectangle") {
@@ -33046,16 +33299,16 @@ function getFormattedText(id, formatted = true) {
33046
33299
  namespaces.svg,
33047
33300
  "hasValidPointType" in $$ && $$.hasValidPointType(point) ? point : "use"
33048
33301
  );
33049
- }).attr("class", $LEGEND.legendItemPoint).style("fill", getLegendColor.bind($$)).style("pointer-events", $$.getStylePropValue("none")).attr("href", (data, idx, selection) => {
33302
+ }).attr("class", $LEGEND.legendItemPoint).style("fill", _getLegendColor.bind($$)).style("pointer-events", $$.getStylePropValue("none")).attr("href", (data, idx, selection) => {
33050
33303
  const node = selection[idx];
33051
33304
  const nodeName = node.nodeName.toLowerCase();
33052
33305
  const id = $$.getTargetSelectorSuffix(data);
33053
33306
  return nodeName === "use" ? `#${state.datetimeId}-point${id}` : void 0;
33054
33307
  });
33055
33308
  } else {
33056
- l.append(isRectangle ? "line" : legendType).attr("class", $LEGEND.legendItemTile).style("stroke", getLegendColor.bind($$)).style("pointer-events", $$.getStylePropValue("none")).call((selection) => {
33309
+ l.append(isRectangle ? "line" : legendType).attr("class", $LEGEND.legendItemTile).style("stroke", _getLegendColor.bind($$)).style("pointer-events", $$.getStylePropValue("none")).call((selection) => {
33057
33310
  if (legendType === "circle") {
33058
- selection.attr("r", legendItemR).style("fill", getLegendColor.bind($$)).attr("cx", isLegendRightOrInset ? posFn.x2Tile : pos).attr("cy", isLegendRightOrInset ? pos : posFn.yTile);
33311
+ selection.attr("r", legendItemR).style("fill", _getLegendColor.bind($$)).attr("cx", isLegendRightOrInset ? posFn.x2Tile : pos).attr("cy", isLegendRightOrInset ? pos : posFn.yTile);
33059
33312
  } else if (isRectangle) {
33060
33313
  selection.attr("stroke-width", itemTileSize.height).attr("x1", isLegendRightOrInset ? posFn.x1Tile : pos).attr("y1", isLegendRightOrInset ? pos : posFn.yTile).attr("x2", isLegendRightOrInset ? posFn.x2Tile : pos).attr("y2", isLegendRightOrInset ? pos : posFn.yTile);
33061
33314
  }
@@ -33104,7 +33357,7 @@ function getFormattedText(id, formatted = true) {
33104
33357
  });
33105
33358
  } else {
33106
33359
  const tiles = legend.selectAll(`.${$LEGEND.legendItemTile}`).data(targetIdz);
33107
- $T(tiles, withTransition).style("stroke", getLegendColor.bind($$)).call((selection) => {
33360
+ $T(tiles, withTransition).style("stroke", _getLegendColor.bind($$)).call((selection) => {
33108
33361
  if (legendType === "circle") {
33109
33362
  selection.attr("cx", (d) => {
33110
33363
  const x2 = posFn.x2Tile(d);
@@ -33691,7 +33944,7 @@ var map = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "\xB5",
33691
33944
  if (type === "n") comma = true, type = "g";
33692
33945
  else if (!formatTypes[type]) precision === void 0 && (precision = 12), trim = true, type = "g";
33693
33946
  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 : "");
33947
+ 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
33948
  var formatType = formatTypes[type], maybeSuffix = /[defgprs%]/.test(type);
33696
33949
  precision = precision === void 0 ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));
33697
33950
  function format(value) {
@@ -34269,8 +34522,8 @@ function getScale(type = "linear", min, max) {
34269
34522
  * @param {number} min Min range value
34270
34523
  * @param {number} max Max range value
34271
34524
  * @param {Array} domain Domain value
34272
- * @param {Function} offset The offset getter to be sum
34273
- * @returns {Function} scale
34525
+ * @param {function} offset The offset getter to be sum
34526
+ * @returns {function} scale
34274
34527
  * @private
34275
34528
  */
34276
34529
  getXScale(min, max, domain, offset) {
@@ -34287,7 +34540,7 @@ function getScale(type = "linear", min, max) {
34287
34540
  * @param {number} min Min value
34288
34541
  * @param {number} max Max value
34289
34542
  * @param {Array} domain Domain value
34290
- * @returns {Function} Scale function
34543
+ * @returns {function} Scale function
34291
34544
  * @private
34292
34545
  */
34293
34546
  getYScale(id, min, max, domain) {
@@ -34300,7 +34553,7 @@ function getScale(type = "linear", min, max) {
34300
34553
  * Get y Axis scale
34301
34554
  * @param {string} id Axis id
34302
34555
  * @param {boolean} isSub Weather is sub Axis
34303
- * @returns {Function} Scale function
34556
+ * @returns {function} Scale function
34304
34557
  * @private
34305
34558
  */
34306
34559
  getYScaleById(id, isSub = false) {
@@ -34312,8 +34565,8 @@ function getScale(type = "linear", min, max) {
34312
34565
  /**
34313
34566
  * Get customized x axis scale
34314
34567
  * @param {d3.scaleLinear|d3.scaleTime} scaleValue Scale function
34315
- * @param {Function} offsetValue Offset getter to be sum
34316
- * @returns {Function} Scale function
34568
+ * @param {function} offsetValue Offset getter to be sum
34569
+ * @returns {function} Scale function
34317
34570
  * @private
34318
34571
  */
34319
34572
  getCustomizedXScale(scaleValue, offsetValue) {
@@ -34763,8 +35016,8 @@ function getScale(type = "linear", min, max) {
34763
35016
  * @param {boolean} withShape Set shpes' prefix class
34764
35017
  * @param {string} selector CSS selector
34765
35018
  * @param {Array} props CSS props list
34766
- * @param {Function} propsFn Function to retrieve value or determine for props
34767
- * @returns {Function}
35019
+ * @param {function} propsFn Function to retrieve value or determine for props
35020
+ * @returns {function}
34768
35021
  * @private
34769
35022
  */
34770
35023
  setCssRule(withShape, selector, props, propsFn) {
@@ -34786,7 +35039,7 @@ function getScale(type = "linear", min, max) {
34786
35039
  },
34787
35040
  /**
34788
35041
  * Get style prop value
34789
- * @param {Function|string} v Value
35042
+ * @param {function|string} v Value
34790
35043
  * @returns {string|null}
34791
35044
  * @private
34792
35045
  */
@@ -34979,6 +35232,13 @@ function updateTextImagePos(textNode, pos) {
34979
35232
  $$.$T(image).style("opacity", isShown(textNode) ? null : "0").attr("x", x).attr("y", y);
34980
35233
  }
34981
35234
  }
35235
+ function batchGetBBox(elements) {
35236
+ return toMap(
35237
+ elements,
35238
+ (element) => element,
35239
+ (element) => getBBox(element)
35240
+ );
35241
+ }
34982
35242
 
34983
35243
 
34984
35244
  ;// ./src/ChartInternal/internals/text.ts
@@ -35057,7 +35317,7 @@ function updateTextImagePos(textNode, pos) {
35057
35317
  if (isNumber(value)) {
35058
35318
  this.textContent = value;
35059
35319
  } else {
35060
- setTextValue(node, value);
35320
+ setTextValue(node, value, void 0, true);
35061
35321
  }
35062
35322
  });
35063
35323
  updateTextImage.call($$);
@@ -35088,7 +35348,7 @@ function updateTextImagePos(textNode, pos) {
35088
35348
  /**
35089
35349
  * Update data label text background color
35090
35350
  * @param {object} d Data object
35091
- * @param {object|string|Function} option option object
35351
+ * @param {object|string|function} option option object
35092
35352
  * @returns {string|null}
35093
35353
  * @private
35094
35354
  */
@@ -35117,8 +35377,8 @@ function updateTextImagePos(textNode, pos) {
35117
35377
  },
35118
35378
  /**
35119
35379
  * Redraw chartText
35120
- * @param {Function} getX Positioning function for x
35121
- * @param {Function} getY Positioning function for y
35380
+ * @param {function} getX Positioning function for x
35381
+ * @param {function} getY Positioning function for y
35122
35382
  * @param {boolean} forFlow Weather is flow
35123
35383
  * @param {boolean} withTransition transition is enabled
35124
35384
  * @returns {Array}
@@ -35132,10 +35392,23 @@ function updateTextImagePos(textNode, pos) {
35132
35392
  const angle = config.data_labels.rotate;
35133
35393
  const anchorString = getRotateAnchor(angle);
35134
35394
  const rotateString = angle ? `rotate(${angle})` : "";
35395
+ let bboxCache = /* @__PURE__ */ new Map();
35396
+ if (config.data_labels.centered) {
35397
+ const elementsToMeasure = [];
35398
+ $$.$el.text.each(function(d) {
35399
+ if ($$.isBarType(d) || $$.isTreemapType(d)) {
35400
+ elementsToMeasure.push(this);
35401
+ }
35402
+ });
35403
+ if (elementsToMeasure.length > 0) {
35404
+ bboxCache = batchGetBBox(elementsToMeasure);
35405
+ }
35406
+ }
35135
35407
  $$.$el.text.style("fill", $$.getStylePropValue($$.updateTextColor)).attr(
35136
35408
  "filter",
35137
35409
  (d) => $$.updateTextBGColor.bind($$)(d, config.data_labels_backgroundColors)
35138
35410
  ).style("fill-opacity", forFlow ? 0 : $$.opacityForText.bind($$)).each(function(d, i) {
35411
+ const cachedBbox = bboxCache.get(this);
35139
35412
  const node = $T(
35140
35413
  hasTreemap && this.childElementCount ? this.parentNode : this,
35141
35414
  !!(withTransition && (this.getAttribute("x") || this.getAttribute("transform"))),
@@ -35143,8 +35416,8 @@ function updateTextImagePos(textNode, pos) {
35143
35416
  );
35144
35417
  const isInverted = config[`axis_${axis == null ? void 0 : axis.getId(d.id)}_inverted`];
35145
35418
  let pos = {
35146
- x: getX.bind(this)(d, i),
35147
- y: getY.bind(this)(d, i)
35419
+ x: getX.bind(this)(d, i, cachedBbox),
35420
+ y: getY.bind(this)(d, i, cachedBbox)
35148
35421
  };
35149
35422
  if (angle) {
35150
35423
  pos = setRotatePos.bind($$)(d, pos, anchorString, isRotated, isInverted);
@@ -35222,17 +35495,18 @@ function updateTextImagePos(textNode, pos) {
35222
35495
  * @param {Array} points Data points position
35223
35496
  * @param {HTMLElement} textElement Data label text element
35224
35497
  * @param {string} type 'x' or 'y'
35498
+ * @param {DOMRect} cachedBbox Optional cached bounding box (from getBBox batching)
35225
35499
  * @returns {number} Position value
35226
35500
  * @private
35227
35501
  */
35228
- getCenteredTextPos(d, points, textElement, type) {
35502
+ getCenteredTextPos(d, points, textElement, type, cachedBbox) {
35229
35503
  const $$ = this;
35230
35504
  const { config } = $$;
35231
35505
  const isRotated = config.axis_rotated;
35232
35506
  const isBarType = $$.isBarType(d);
35233
35507
  const isTreemapType = $$.isTreemapType(d);
35234
35508
  if (config.data_labels.centered && (isBarType || isTreemapType)) {
35235
- const rect = getBoundingRect(textElement);
35509
+ const rect = cachedBbox || getBBox(textElement);
35236
35510
  if (isBarType) {
35237
35511
  const isPositive = $$.getRangedData(d, null, "bar") >= 0;
35238
35512
  if (isRotated) {
@@ -35243,7 +35517,10 @@ function updateTextImagePos(textNode, pos) {
35243
35517
  return isPositive ? h : -h - 2;
35244
35518
  }
35245
35519
  } else if (isTreemapType) {
35246
- return type === "x" ? (points[1][0] - points[0][0]) / 2 : (points[1][1] - points[0][1]) / 2 + rect.height / 2;
35520
+ return type === "x" ? (points[1][0] - points[0][0]) / 2 : (
35521
+ // X: Move to horizontal center of rect
35522
+ (points[1][1] - points[0][1]) / 2 - rect.y - rect.height / 2
35523
+ );
35247
35524
  }
35248
35525
  }
35249
35526
  return 0;
@@ -35253,10 +35530,11 @@ function updateTextImagePos(textNode, pos) {
35253
35530
  * @param {object} points Data points position
35254
35531
  * @param {object} d Data object
35255
35532
  * @param {HTMLElement} textElement Data label text element
35533
+ * @param {DOMRect} cachedBbox Optional cached bounding box (from getBBox batching)
35256
35534
  * @returns {number} x coordinate
35257
35535
  * @private
35258
35536
  */
35259
- getXForText(points, d, textElement) {
35537
+ getXForText(points, d, textElement, cachedBbox) {
35260
35538
  var _a;
35261
35539
  const $$ = this;
35262
35540
  const { config } = $$;
@@ -35290,7 +35568,7 @@ function updateTextImagePos(textNode, pos) {
35290
35568
  }
35291
35569
  }
35292
35570
  if (isRotated || isTreemapType) {
35293
- xPos += $$.getCenteredTextPos(d, points, textElement, "x");
35571
+ xPos += $$.getCenteredTextPos(d, points, textElement, "x", cachedBbox);
35294
35572
  }
35295
35573
  return xPos + getTextPos.call(this, d, "x");
35296
35574
  },
@@ -35299,10 +35577,11 @@ function updateTextImagePos(textNode, pos) {
35299
35577
  * @param {object} points Data points position
35300
35578
  * @param {object} d Data object
35301
35579
  * @param {HTMLElement} textElement Data label text element
35580
+ * @param {DOMRect} cachedBbox Optional cached bounding box (from getBBox batching)
35302
35581
  * @returns {number} y coordinate
35303
35582
  * @private
35304
35583
  */
35305
- getYForText(points, d, textElement) {
35584
+ getYForText(points, d, textElement, cachedBbox) {
35306
35585
  const $$ = this;
35307
35586
  const { axis, config, state } = $$;
35308
35587
  const isRotated = config.axis_rotated;
@@ -35355,7 +35634,7 @@ function updateTextImagePos(textNode, pos) {
35355
35634
  }
35356
35635
  }
35357
35636
  if (!isRotated || isTreemapType) {
35358
- yPos += $$.getCenteredTextPos(d, points, textElement, "y");
35637
+ yPos += $$.getCenteredTextPos(d, points, textElement, "y", cachedBbox);
35359
35638
  }
35360
35639
  return yPos + getTextPos.call(this, d, "y");
35361
35640
  },
@@ -35399,7 +35678,7 @@ function updateTextImagePos(textNode, pos) {
35399
35678
  ;// ./src/ChartInternal/internals/title.ts
35400
35679
 
35401
35680
 
35402
- function getTextXPos(pos = "left", width) {
35681
+ function _getTextXPos(pos = "left", width) {
35403
35682
  const isNum = isNumber(width);
35404
35683
  let position;
35405
35684
  if (pos.indexOf("center") > -1) {
@@ -35421,7 +35700,7 @@ function getTextXPos(pos = "left", width) {
35421
35700
  const { config, $el } = $$;
35422
35701
  if (config.title_text) {
35423
35702
  $el.title = $el.svg.append("g");
35424
- const text = $el.title.append("text").style("text-anchor", getTextXPos(config.title_position)).attr("class", $TEXT.title);
35703
+ const text = $el.title.append("text").style("text-anchor", _getTextXPos(config.title_position)).attr("class", $TEXT.title);
35425
35704
  setTextValue(text, config.title_text, [0.3, 1.5]);
35426
35705
  }
35427
35706
  },
@@ -35433,7 +35712,7 @@ function getTextXPos(pos = "left", width) {
35433
35712
  const $$ = this;
35434
35713
  const { config, state: { current }, $el: { title } } = $$;
35435
35714
  if (title) {
35436
- const x = getTextXPos(config.title_position, current.width);
35715
+ const x = _getTextXPos(config.title_position, current.width);
35437
35716
  const y = (config.title_padding.top || 0) + $$.getTextRect($$.$el.title, $TEXT.title).height;
35438
35717
  title.attr("transform", `translate(${x}, ${y})`);
35439
35718
  }
@@ -35509,9 +35788,9 @@ function getTextXPos(pos = "left", width) {
35509
35788
  /**
35510
35789
  * Returns the tooltip content(HTML string)
35511
35790
  * @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
35791
+ * @param {function} defaultTitleFormat Default title format
35792
+ * @param {function} defaultValueFormat Default format for each data value in the tooltip.
35793
+ * @param {function} color Color function
35515
35794
  * @returns {string} html
35516
35795
  * @private
35517
35796
  */
@@ -35525,9 +35804,16 @@ function getTextXPos(pos = "left", width) {
35525
35804
  });
35526
35805
  const titleFormat = (...arg) => sanitize((titleFn || defaultTitleFormat)(...arg));
35527
35806
  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));
35807
+ const valueFormat = (v, ratio, id, index) => {
35808
+ let fn = valueFn;
35809
+ if (!fn) {
35810
+ if (state.hasTreemap || $$.isStackNormalized() && (!$$.isStackNormalizedPerGroup() || $$.isGrouped(id))) {
35811
+ fn = (v2, ratio2) => `${(ratio2 * 100).toFixed(2)}%`;
35812
+ } else {
35813
+ fn = defaultValueFormat;
35814
+ }
35815
+ }
35816
+ return sanitize(fn(v, ratio, id, index));
35531
35817
  };
35532
35818
  const order = config.tooltip_order;
35533
35819
  const getRowValue = (row2) => $$.axis && $$.isBubbleZType(row2) ? $$.getBubbleZData(row2.value, "z") : $$.getBaseValue(row2);
@@ -35866,7 +36152,7 @@ function getTextXPos(pos = "left", width) {
35866
36152
  if (tooltip && tooltip.style("display") !== "none" && (!config.tooltip_doNotHide || force)) {
35867
36153
  const selectedData = JSON.parse((_a = tooltip.datum().current) != null ? _a : {});
35868
36154
  callFn(config.tooltip_onhide, api, selectedData);
35869
- tooltip.style("display", "none").style("visibility", "hidden").datum(null);
36155
+ tooltip.style("display", "none").datum(null);
35870
36156
  callFn(config.tooltip_onhidden, api, selectedData);
35871
36157
  }
35872
36158
  },
@@ -37164,7 +37450,8 @@ function stepAfter(context) {
37164
37450
 
37165
37451
 
37166
37452
 
37167
- function getGroupedDataPointsFn(d) {
37453
+
37454
+ function _getGroupedDataPointsFn(d) {
37168
37455
  const $$ = this;
37169
37456
  let fn;
37170
37457
  if ($$.isLineType(d)) {
@@ -37222,7 +37509,7 @@ function getGroupedDataPointsFn(d) {
37222
37509
  * data2 data4 data2 data4
37223
37510
  * -------------------------
37224
37511
  * 0 1
37225
- * @param {Function} typeFilter Chart type filter function
37512
+ * @param {function} typeFilter Chart type filter function
37226
37513
  * @returns {object} Indices object with its position
37227
37514
  */
37228
37515
  getShapeIndices(typeFilter) {
@@ -37367,7 +37654,7 @@ function getGroupedDataPointsFn(d) {
37367
37654
  },
37368
37655
  /**
37369
37656
  * Get Shape's offset data
37370
- * @param {Function} typeFilter Type filter function
37657
+ * @param {function} typeFilter Type filter function
37371
37658
  * @returns {object}
37372
37659
  * @private
37373
37660
  */
@@ -37376,6 +37663,12 @@ function getGroupedDataPointsFn(d) {
37376
37663
  const targets = $$.orderTargets(
37377
37664
  $$.filterTargetsToShow($$.data.targets.filter(typeFilter, $$))
37378
37665
  );
37666
+ const targetIds = targets.map((t) => t.id).join("_");
37667
+ const cacheKey = `${KEY.shapeOffset}_${targetIds}`;
37668
+ const cachedData = $$.cache.get(cacheKey);
37669
+ if (cachedData) {
37670
+ return cachedData;
37671
+ }
37379
37672
  const isStackNormalized = $$.isStackNormalized();
37380
37673
  const shapeOffsetTargets = targets.map((target) => {
37381
37674
  let rowValues = target.values;
@@ -37400,7 +37693,9 @@ function getGroupedDataPointsFn(d) {
37400
37693
  out[id] = index;
37401
37694
  return out;
37402
37695
  }, {});
37403
- return { indexMapByTargetId, shapeOffsetTargets };
37696
+ const result = { indexMapByTargetId, shapeOffsetTargets };
37697
+ $$.cache.add(cacheKey, result);
37698
+ return result;
37404
37699
  },
37405
37700
  getShapeOffset(typeFilter, indices, isSub) {
37406
37701
  const $$ = this;
@@ -37454,7 +37749,7 @@ function getGroupedDataPointsFn(d) {
37454
37749
  const id = d.id;
37455
37750
  let points;
37456
37751
  if ($$.isGrouped(id)) {
37457
- points = getGroupedDataPointsFn.bind($$)(d);
37752
+ points = _getGroupedDataPointsFn.bind($$)(d);
37458
37753
  }
37459
37754
  return points ? points(d, i)[0][1] : $$.getYScaleById(id)($$.getBaseValue(d));
37460
37755
  },
@@ -37868,14 +38163,18 @@ class ChartInternal {
37868
38163
  if (hasInteraction && state.inputType) {
37869
38164
  const isTouch = state.inputType === "touch";
37870
38165
  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);
38166
+ $el.svg.on("click", (onclick == null ? void 0 : onclick.bind($$.api)) || null).on(
38167
+ isTouch ? "touchstart" : "mouseenter",
38168
+ (onover == null ? void 0 : onover.bind($$.api)) || null,
38169
+ isTouch ? { passive: true } : void 0
38170
+ ).on(isTouch ? "touchend" : "mouseleave", (onout == null ? void 0 : onout.bind($$.api)) || null);
37872
38171
  }
37873
38172
  config.svg_classname && $el.svg.attr("class", config.svg_classname);
37874
38173
  const hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
37875
38174
  if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_a = $$.hasLegendDefsPoint) == null ? void 0 : _a.call($$))) {
37876
38175
  $el.defs = $el.svg.append("defs");
37877
38176
  if (hasAxis) {
37878
- ["id", "idXAxis", "idYAxis", "idGrid"].forEach((v) => {
38177
+ ["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach((v) => {
37879
38178
  $$.appendClip($el.defs, state.clip[v]);
37880
38179
  });
37881
38180
  }
@@ -38245,7 +38544,7 @@ function loadConfig(config) {
38245
38544
  },
38246
38545
  /**
38247
38546
  * Force to redraw.
38248
- * - **NOTE:** When zoom/subchart is used, the zoomed state will be resetted.
38547
+ * - **NOTE:** When zoom/subchart is used, the zoomed state will be reset.
38249
38548
  * @function flush
38250
38549
  * @instance
38251
38550
  * @memberof Chart
@@ -38334,15 +38633,15 @@ function loadConfig(config) {
38334
38633
  * Get or set config option value.
38335
38634
  * - **NOTE**
38336
38635
  * - 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)
38636
+ * - 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
38637
  * @function config
38339
38638
  * @instance
38340
38639
  * @memberof Chart
38341
38640
  * @param {string} name The option key name.
38342
- * @param {*} [value] The value accepted for indicated option.
38641
+ * @param {string|number|boolean|object|Array} [value] The value accepted for indicated option.
38343
38642
  * @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 {*}
38643
+ * - **NOTE:** Doesn't guarantee to work in all circumstances. It can be applied for limited options only.
38644
+ * @returns {string|number|boolean|object|Array} The option value or all options object
38346
38645
  * @example
38347
38646
  *
38348
38647
  * // Getter
@@ -38439,7 +38738,7 @@ util_extend(api_data_data, {
38439
38738
  * @function data․values
38440
38739
  * @instance
38441
38740
  * @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
38741
+ * @param {string|Array|null} targetIds This API returns the values of specified target. If this argument is not given, null will be returned
38443
38742
  * @param {boolean} [flat=true] Get flatten values
38444
38743
  * @returns {Array} Data values
38445
38744
  * @example
@@ -38485,6 +38784,7 @@ util_extend(api_data_data, {
38485
38784
  },
38486
38785
  /**
38487
38786
  * Get and set colors of the data loaded in the chart.
38787
+ * - **NOTE:** If gradient option is set, the color update will affect only gradient stops have the same color.
38488
38788
  * @function data․colors
38489
38789
  * @instance
38490
38790
  * @memberof Chart
@@ -38690,7 +38990,7 @@ function renderText(ctx, glyph) {
38690
38990
  * - Text element's position(especially "transformed") can't be preserved correctly according the page's layout condition.
38691
38991
  * - If need to preserve accurate text position, embed the web font data within to the page and set `preserveFontStyle=false`.
38692
38992
  * - 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.
38993
+ * @param {function(string): void} [callback] The callback to be invoked when export is ready.
38694
38994
  * @returns {string} dataURI
38695
38995
  * @example
38696
38996
  * chart.export();
@@ -38944,7 +39244,7 @@ const legend_legend = {
38944
39244
  * | categories | Array | The categories specified by axis.x.categories or data.x will be updated. categories must be Array. |
38945
39245
  * | classes | Object | The classes specified by data.classes will be updated. classes must be Object that has target id as keys. |
38946
39246
  * | 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. |
39247
+ * | data | Object | Data objects to be loaded. Checkout the example. |
38948
39248
  * | done | Function | The specified function will be called after data loaded.|
38949
39249
  * | headers | string | Set request header if loading via `data.url`.<br>@see [data․headers](Options.html#.data%25E2%2580%25A4headers) |
38950
39250
  * | 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 +39303,7 @@ const legend_legend = {
39003
39303
  *
39004
39304
  * chart.load({
39005
39305
  * columns: [
39006
- * // when existing chart has `x` value, should provide correponding 'x' value.
39306
+ * // when existing chart has `x` value, should provide corresponding 'x' value.
39007
39307
  * // with 'append' option, the 'data1' will have `[36,30,24,37]`.
39008
39308
  * ["x", "2021-02-01T08:00:00"],
39009
39309
  * ["data1", 37]
@@ -39093,7 +39393,7 @@ const legend_legend = {
39093
39393
  * | key | Type | Description |
39094
39394
  * | --- | --- | --- |
39095
39395
  * | 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. |
39396
+ * | done | Function | Callback after data is unloaded. |
39097
39397
  * | 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
39398
  * @example
39099
39399
  * // Unload data2 and data3
@@ -39250,7 +39550,7 @@ const tooltip_tooltip = {
39250
39550
  *
39251
39551
  * @example
39252
39552
  * // show the 2nd x Axis coordinate tooltip
39253
- * // for Arc(gauge, donut & pie) and radar type, approch showing tooltip by using "index" number.
39553
+ * // for Arc(gauge, donut & pie) and radar type, approach showing tooltip by using "index" number.
39254
39554
  * chart.tooltip.show({
39255
39555
  * index: 1
39256
39556
  * });
@@ -39614,7 +39914,7 @@ util_extend(subchart, {
39614
39914
  }
39615
39915
  },
39616
39916
  /**
39617
- * Toggle the visiblity of subchart
39917
+ * Toggle the visibility of subchart
39618
39918
  * - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`.
39619
39919
  * @function subchart․toggle
39620
39920
  * @instance
@@ -40584,9 +40884,6 @@ util_extend(zoom, {
40584
40884
  transform_identity.translate(tX, tY).scale(transform.k)
40585
40885
  );
40586
40886
  }
40587
- if (!$$.state.xTickOffset) {
40588
- $$.state.xTickOffset = $$.axis.x.tickOffset();
40589
- }
40590
40887
  scale.zoom = $$.getCustomizedXScale(newScale);
40591
40888
  $$.axis.x.scale(scale.zoom);
40592
40889
  if (rescale) {
@@ -40627,7 +40924,6 @@ util_extend(zoom, {
40627
40924
  * @private
40628
40925
  */
40629
40926
  onZoom(event) {
40630
- var _a;
40631
40927
  const $$ = this;
40632
40928
  const { config, scale, state, org } = $$;
40633
40929
  const { sourceEvent } = event;
@@ -40647,19 +40943,24 @@ util_extend(zoom, {
40647
40943
  }
40648
40944
  $$.zoom.updateTransformScale(transform, config.zoom_type === "wheel" && sourceEvent);
40649
40945
  const doTransition = config.transition_duration > 0 && !config.subchart_show && (state.dragging || isUnZoom || !event.sourceEvent);
40650
- $$.redraw({
40651
- withTransition: doTransition,
40652
- withY: config.zoom_rescale,
40653
- withSubchart: false,
40654
- withEventRect: false,
40655
- withDimension: false
40656
- });
40657
- $$.state.cancelClick = isMousemove;
40658
- !isUnZoom && callFn(
40659
- config.zoom_onzoom,
40660
- $$.api,
40661
- (_a = $$.state.domain) != null ? _a : $$.zoom.getDomain()
40662
- );
40946
+ const useRAF = sourceEvent && isMousemove && config.zoom_type !== "wheel";
40947
+ const executeRedraw = () => {
40948
+ var _a;
40949
+ $$.redraw({
40950
+ withTransition: doTransition,
40951
+ withY: config.zoom_rescale,
40952
+ withSubchart: false,
40953
+ withEventRect: false,
40954
+ withDimension: false
40955
+ });
40956
+ $$.state.cancelClick = isMousemove;
40957
+ !isUnZoom && callFn(
40958
+ config.zoom_onzoom,
40959
+ $$.api,
40960
+ (_a = $$.state.domain) != null ? _a : $$.zoom.getDomain()
40961
+ );
40962
+ };
40963
+ useRAF ? scheduleRAFUpdate($$.state, executeRedraw) : executeRedraw();
40663
40964
  },
40664
40965
  /**
40665
40966
  * 'end' event listener
@@ -40711,7 +41012,7 @@ util_extend(zoom, {
40711
41012
  },
40712
41013
  /**
40713
41014
  * Set zoom transform to event rect
40714
- * @param {Function} x x Axis scale function
41015
+ * @param {function} x x Axis scale function
40715
41016
  * @param {Array} domain Domain value to be set
40716
41017
  * @private
40717
41018
  */
@@ -40852,31 +41153,37 @@ util_extend(zoom, {
40852
41153
  const maxX = Math.max(sx, mx);
40853
41154
  const minY = isSelectionGrouped ? state.margin.top : Math.min(sy, my);
40854
41155
  const maxY = isSelectionGrouped ? state.height : Math.max(sy, my);
40855
- main.select(`.${$DRAG.dragarea}`).attr("x", minX).attr("y", minY).attr("width", maxX - minX).attr("height", maxY - minY);
40856
- main.selectAll(`.${$SHAPE.shapes}`).selectAll(`.${$SHAPE.shape}`).filter((d) => isSelectable == null ? void 0 : isSelectable.bind($$.api)(d)).each(function(d, i) {
40857
- const shape = src_select(this);
40858
- const isSelected = shape.classed($SELECT.SELECTED);
40859
- const isIncluded = shape.classed($DRAG.INCLUDED);
40860
- let isWithin = false;
40861
- let toggle;
40862
- if (shape.classed($CIRCLE.circle)) {
40863
- const x = +shape.attr("cx") * 1;
40864
- const y = +shape.attr("cy") * 1;
40865
- toggle = $$.togglePoint;
40866
- isWithin = minX < x && x < maxX && minY < y && y < maxY;
40867
- } else if (shape.classed($BAR.bar)) {
40868
- const { x, y, width, height } = getPathBox(this);
40869
- toggle = $$.togglePath;
40870
- isWithin = !(maxX < x || x + width < minX) && !(maxY < y || y + height < minY);
40871
- } else {
41156
+ const executeDrag = () => {
41157
+ if (!$$ || !$$.$el || !$$.$el.main) {
40872
41158
  return;
40873
41159
  }
40874
- if (isWithin ^ isIncluded) {
40875
- shape.classed($DRAG.INCLUDED, !isIncluded);
40876
- shape.classed($SELECT.SELECTED, !isSelected);
40877
- toggle.call($$, !isSelected, shape, d, i);
40878
- }
40879
- });
41160
+ main.select(`.${$DRAG.dragarea}`).attr("x", minX).attr("y", minY).attr("width", maxX - minX).attr("height", maxY - minY);
41161
+ main.selectAll(`.${$SHAPE.shapes}`).selectAll(`.${$SHAPE.shape}`).filter((d) => isSelectable == null ? void 0 : isSelectable.bind($$.api)(d)).each(function(d, i) {
41162
+ const shape = src_select(this);
41163
+ const isSelected = shape.classed($SELECT.SELECTED);
41164
+ const isIncluded = shape.classed($DRAG.INCLUDED);
41165
+ let isWithin = false;
41166
+ let toggle;
41167
+ if (shape.classed($CIRCLE.circle)) {
41168
+ const x = +shape.attr("cx") * 1;
41169
+ const y = +shape.attr("cy") * 1;
41170
+ toggle = $$.togglePoint;
41171
+ isWithin = minX < x && x < maxX && minY < y && y < maxY;
41172
+ } else if (shape.classed($BAR.bar)) {
41173
+ const { x, y, width, height } = getPathBox(this);
41174
+ toggle = $$.togglePath;
41175
+ isWithin = !(maxX < x || x + width < minX) && !(maxY < y || y + height < minY);
41176
+ } else {
41177
+ return;
41178
+ }
41179
+ if (isWithin ^ isIncluded) {
41180
+ shape.classed($DRAG.INCLUDED, !isIncluded);
41181
+ shape.classed($SELECT.SELECTED, !isSelected);
41182
+ toggle.call($$, !isSelected, shape, d, i);
41183
+ }
41184
+ });
41185
+ };
41186
+ scheduleRAFUpdate($$.state, executeDrag);
40880
41187
  },
40881
41188
  /**
40882
41189
  * Called when the drag starts.
@@ -41021,7 +41328,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41021
41328
  * Returns the toggle method of the target
41022
41329
  * @param {object} that shape
41023
41330
  * @param {object} d Data object
41024
- * @returns {Function} toggle method
41331
+ * @returns {function} toggle method
41025
41332
  * @private
41026
41333
  */
41027
41334
  getToggle(that, d) {
@@ -41120,7 +41427,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41120
41427
  * The callback will receive d as an argument and it has some parameters like id, value, index. This callback should return boolean.
41121
41428
  * @name data․selection․isselectable
41122
41429
  * @memberof Options
41123
- * @type {Function}
41430
+ * @type {function}
41124
41431
  * @default function() { return true; }
41125
41432
  * @example
41126
41433
  * data: {
@@ -41132,7 +41439,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41132
41439
  data_selection_isselectable: () => true,
41133
41440
  /**
41134
41441
  * 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.
41442
+ * 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
41443
  * @name data․selection․multiple
41137
41444
  * @memberof Options
41138
41445
  * @type {boolean}
@@ -41165,7 +41472,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41165
41472
  * Set a callback for on data selection.
41166
41473
  * @name data․onselected
41167
41474
  * @memberof Options
41168
- * @type {Function}
41475
+ * @type {function}
41169
41476
  * @default function() {}
41170
41477
  * @example
41171
41478
  * data: {
@@ -41182,7 +41489,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41182
41489
  * Set a callback for on data un-selection.
41183
41490
  * @name data․onunselected
41184
41491
  * @memberof Options
41185
- * @type {Function}
41492
+ * @type {function}
41186
41493
  * @default function() {}
41187
41494
  * @example
41188
41495
  * data: {
@@ -41212,11 +41519,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41212
41519
  * @property {boolean} [subchart.showHandle=false] Show sub chart's handle.
41213
41520
  * @property {boolean} [subchart.axis.x.show=true] Show or hide x axis.
41214
41521
  * @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.
41522
+ * @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
41523
  * @property {boolean} [subchart.axis.x.tick.text.show=true] Show or hide x axis tick text.
41217
41524
  * @property {Array} [subchart.init.range] Set initial selection domain range.
41218
41525
  * @property {number} [subchart.size.height] Change the height of the subchart.
41219
- * @property {Function} [subchart.onbrush] Set callback for brush event.<br>
41526
+ * @property {function} [subchart.onbrush] Set callback for brush event.<br>
41220
41527
  * Specified function receives the current zoomed x domain.
41221
41528
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Interaction.SubChart)
41222
41529
  * @example
@@ -41285,14 +41592,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
41285
41592
  * @property {Array} [zoom.extent=[1, 10]] Change zoom extent.
41286
41593
  * @property {number|Date} [zoom.x.min] Set x Axis minimum zoom range
41287
41594
  * @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>
41595
+ * @property {function} [zoom.onzoomstart=undefined] Set callback that is called when zooming starts.<br>
41289
41596
  * Specified function receives the zoom event.
41290
- * @property {Function} [zoom.onzoom=undefined] Set callback that is called when the chart is zooming.<br>
41597
+ * @property {function} [zoom.onzoom=undefined] Set callback that is called when the chart is zooming.<br>
41291
41598
  * Specified function receives the zoomed domain.
41292
- * @property {Function} [zoom.onzoomend=undefined] Set callback that is called when zooming ends.<br>
41599
+ * @property {function} [zoom.onzoomend=undefined] Set callback that is called when zooming ends.<br>
41293
41600
  * Specified function receives the zoomed domain.
41294
41601
  * @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.
41602
+ * @property {function} [zoom.resetButton.onclick] Set callback when clicks the reset button. The callback will receive reset button element reference as argument.
41296
41603
  * @property {string} [zoom.resetButton.text='Reset Zoom'] Text value for zoom reset button.
41297
41604
  * @see [Demo:zoom](https://naver.github.io/billboard.js/demo/#Interaction.Zoom)
41298
41605
  * @see [Demo:drag zoom](https://naver.github.io/billboard.js/demo/#Interaction.DragZoom)
@@ -41663,7 +41970,7 @@ const axis = {
41663
41970
  * - If json specified, keys is required as well as data.json.
41664
41971
  * - If tab isn't visible(by evaluating `document.hidden`), will not be executed to prevent unnecessary work.
41665
41972
  * @example
41666
- * // 2 data points will be apprended to the tail and popped from the head.
41973
+ * // 2 data points will be appended to the tail and popped from the head.
41667
41974
  * // After that, 4 data points will be appended and no data points will be poppoed.
41668
41975
  * chart.flow({
41669
41976
  * columns: [
@@ -42297,7 +42604,7 @@ class AxisRendererHelper {
42297
42604
  /**
42298
42605
  * Get tick transform setter function
42299
42606
  * @param {string} id Axis id
42300
- * @returns {Function} transfrom setter function
42607
+ * @returns {(selection: d3Selection, scale) => void} transfrom setter function
42301
42608
  * @private
42302
42609
  */
42303
42610
  getTickTransformSetter(id) {
@@ -43018,7 +43325,7 @@ class Axis_Axis {
43018
43325
  }
43019
43326
  tickValues && axis.tickValues(tickValues);
43020
43327
  axis.tickFormat(
43021
- tickFormat || !isX && ($$.isStackNormalized() && ((x) => `${x}%`))
43328
+ tickFormat || !isX && ($$.isStackNormalized() && $$.hasAxisGroupedData(id) && ((x) => `${x}%`))
43022
43329
  );
43023
43330
  if (isCategory) {
43024
43331
  axis.tickCentered(config.axis_x_tick_centered);
@@ -43646,6 +43953,7 @@ class Axis_Axis {
43646
43953
  const isPrevented = isBoolean(preventDefault) && preventDefault || false;
43647
43954
  const preventThreshold = !isNaN(preventDefault) && preventDefault || null;
43648
43955
  let startPx;
43956
+ const passiveOption = !isPrevented && preventThreshold === null;
43649
43957
  const preventEvent = (event) => {
43650
43958
  const eventType = event.type;
43651
43959
  const touch = event.changedTouches[0];
@@ -43666,7 +43974,7 @@ class Axis_Axis {
43666
43974
  eventRect.on("touchstart", (event) => {
43667
43975
  state.event = event;
43668
43976
  $$.updateEventRect();
43669
- }).on("touchstart.eventRect touchmove.eventRect", (event) => {
43977
+ }, { passive: passiveOption }).on("touchstart.eventRect touchmove.eventRect", (event) => {
43670
43978
  state.event = event;
43671
43979
  if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
43672
43980
  if (state.dragging || state.flowing || $$.hasArcType() || event.touches.length > 1) {
@@ -43677,21 +43985,21 @@ class Axis_Axis {
43677
43985
  } else {
43678
43986
  unselectRect();
43679
43987
  }
43680
- }, true).on("touchend.eventRect", (event) => {
43988
+ }, { passive: passiveOption }).on("touchend.eventRect", (event) => {
43681
43989
  state.event = event;
43682
43990
  if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
43683
43991
  if ($$.hasArcType() || !$$.toggleShape || state.cancelClick) {
43684
43992
  state.cancelClick && (state.cancelClick = false);
43685
43993
  }
43686
43994
  }
43687
- }, true);
43995
+ }, { passive: passiveOption });
43688
43996
  svg.on("touchstart", (event) => {
43689
43997
  state.event = event;
43690
43998
  const { target } = event;
43691
43999
  if (target && target !== eventRect.node()) {
43692
44000
  unselectRect();
43693
44001
  }
43694
- });
44002
+ }, { passive: passiveOption });
43695
44003
  },
43696
44004
  /**
43697
44005
  * Update event rect size
@@ -43893,7 +44201,7 @@ class Axis_Axis {
43893
44201
  const dist = $$.dist(closest, mouse);
43894
44202
  if ($$.isBarType(closest.id) || dist < $$.getPointSensitivity(closest)) {
43895
44203
  $$.$el.svg.select(`.${$EVENT.eventRect}`).style("cursor", "pointer");
43896
- if (triggerEvent && !state.mouseover) {
44204
+ if (triggerEvent && (!state.mouseover || state.mouseover.x !== closest.x || state.mouseover.id !== closest.id)) {
43897
44205
  config.data_onover.call($$.api, closest);
43898
44206
  state.mouseover = closest;
43899
44207
  }
@@ -44066,7 +44374,7 @@ const src_linear_linear = (t) => +t;
44066
44374
  /**
44067
44375
  * Generate flow
44068
44376
  * @param {object} args option object
44069
- * @returns {Function}
44377
+ * @returns {function}
44070
44378
  * @private
44071
44379
  */
44072
44380
  generateFlow(args) {
@@ -44336,9 +44644,9 @@ const src_linear_linear = (t) => +t;
44336
44644
 
44337
44645
 
44338
44646
 
44339
- const getGridTextAnchor = (d) => isValue(d.position) || "end";
44340
- const getGridTextDx = (d) => d.position === "start" ? 4 : d.position === "middle" ? 0 : -4;
44341
- function getGridTextX(isX, width, height) {
44647
+ const _getGridTextAnchor = (d) => isValue(d.position) || "end";
44648
+ const _getGridTextDx = (d) => d.position === "start" ? 4 : d.position === "middle" ? 0 : -4;
44649
+ function _getGridTextX(isX, width, height) {
44342
44650
  return (d) => {
44343
44651
  let x = isX ? 0 : width;
44344
44652
  if (d.position === "start") {
@@ -44349,7 +44657,7 @@ function getGridTextX(isX, width, height) {
44349
44657
  return x;
44350
44658
  };
44351
44659
  }
44352
- function smoothLines(el, type) {
44660
+ function _smoothLines(el, type) {
44353
44661
  if (type === "grid") {
44354
44662
  el.each(function() {
44355
44663
  const g = src_select(this);
@@ -44420,7 +44728,7 @@ function smoothLines(el, type) {
44420
44728
  grid.y.exit().remove();
44421
44729
  grid.y = grid.y.enter().append("line").attr("class", $GRID.ygrid).merge(grid.y);
44422
44730
  grid.y.attr("x1", isRotated ? pos : 0).attr("x2", isRotated ? pos : state.width).attr("y1", isRotated ? 0 : pos).attr("y2", isRotated ? state.height : pos);
44423
- smoothLines(grid.y, "grid");
44731
+ _smoothLines(grid.y, "grid");
44424
44732
  },
44425
44733
  updateGrid() {
44426
44734
  const $$ = this;
@@ -44453,10 +44761,10 @@ function smoothLines(el, type) {
44453
44761
  g.append("text").style("opacity", "0");
44454
44762
  }
44455
44763
  });
44456
- $T(lines.attr("class", (d) => `${$GRID[`${type}gridLine`]} ${d.class || ""}`.trim()).select("text").attr("text-anchor", getGridTextAnchor).attr(
44764
+ $T(lines.attr("class", (d) => `${$GRID[`${type}gridLine`]} ${d.class || ""}`.trim()).select("text").attr("text-anchor", _getGridTextAnchor).attr(
44457
44765
  "transform",
44458
44766
  () => isX ? isRotated ? null : "rotate(-90)" : isRotated ? "rotate(-90)" : null
44459
- ).attr("dx", getGridTextDx).attr("dy", -5)).text(function(d) {
44767
+ ).attr("dx", _getGridTextDx).attr("dy", -5)).text(function(d) {
44460
44768
  var _a;
44461
44769
  return (_a = d.text) != null ? _a : this.remove();
44462
44770
  });
@@ -44477,9 +44785,9 @@ function smoothLines(el, type) {
44477
44785
  let yLines = gridLines.y.select("line");
44478
44786
  let yTexts = gridLines.y.select("text");
44479
44787
  xLines = $T(xLines, withTransition).attr("x1", isRotated ? 0 : xv).attr("x2", isRotated ? width : xv).attr("y1", isRotated ? xv : 0).attr("y2", isRotated ? xv : height);
44480
- xTexts = $T(xTexts, withTransition).attr("x", getGridTextX(!isRotated, width, height)).attr("y", xv);
44788
+ xTexts = $T(xTexts, withTransition).attr("x", _getGridTextX(!isRotated, width, height)).attr("y", xv);
44481
44789
  yLines = $T(yLines, withTransition).attr("x1", isRotated ? yv : 0).attr("x2", isRotated ? yv : width).attr("y1", isRotated ? 0 : yv).attr("y2", isRotated ? height : yv);
44482
- yTexts = $T(yTexts, withTransition).attr("x", getGridTextX(isRotated, width, height)).attr("y", yv);
44790
+ yTexts = $T(yTexts, withTransition).attr("x", _getGridTextX(isRotated, width, height)).attr("y", yv);
44483
44791
  return [
44484
44792
  xLines.style("opacity", null),
44485
44793
  xTexts.style("opacity", null),
@@ -44606,7 +44914,7 @@ function smoothLines(el, type) {
44606
44914
  }
44607
44915
  ["x1", "y1", "x2", "y2"].forEach((v, i) => el.attr(v, xy[i]));
44608
44916
  });
44609
- smoothLines(focusEl, "grid");
44917
+ _smoothLines(focusEl, "grid");
44610
44918
  (_a = $$.showCircleFocus) == null ? void 0 : _a.call($$, data);
44611
44919
  },
44612
44920
  hideGridFocus() {
@@ -45046,7 +45354,7 @@ function smoothLines(el, type) {
45046
45354
  * A function to format tick value. Format string is also available for timeseries data.
45047
45355
  * @name axis․x․tick․format
45048
45356
  * @memberof Options
45049
- * @type {Function|string}
45357
+ * @type {function|string}
45050
45358
  * @default undefined
45051
45359
  * @see [D3's time specifier](https://d3js.org/d3-time-format#locale_format)
45052
45360
  * @example
@@ -45075,7 +45383,7 @@ function smoothLines(el, type) {
45075
45383
  * - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
45076
45384
  * This option does not hide the tick lines by default, if want to hide tick lines, set `axis.x.tick.culling.lines=false`.
45077
45385
  * - `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`.
45386
+ * The number of ticks to be shown can be changed by `axis.x.tick.culling.max`.
45079
45387
  * @name axis․x․tick․culling
45080
45388
  * @memberof Options
45081
45389
  * @type {boolean}
@@ -45286,10 +45594,10 @@ function smoothLines(el, type) {
45286
45594
  /**
45287
45595
  * Set the x values of ticks manually.<br><br>
45288
45596
  * 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.
45597
+ * 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
45598
  * @name axis․x․tick․values
45291
45599
  * @memberof Options
45292
- * @type {Array|Function}
45600
+ * @type {Array|function}
45293
45601
  * @default null
45294
45602
  * @example
45295
45603
  * axis: {
@@ -45510,7 +45818,7 @@ function smoothLines(el, type) {
45510
45818
  * - **timeseries:** Numeric time value
45511
45819
  * 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
45820
  * - 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.
45821
+ * - The pixel value will be converted based on the scale values. Hence can not reflect accurate padding result.
45514
45822
  * @name axis․x․padding
45515
45823
  * @memberof Options
45516
45824
  * @type {object|number}
@@ -45561,7 +45869,7 @@ function smoothLines(el, type) {
45561
45869
  * - **NOTE:** Specifying value, will limit the zoom scope selection within.
45562
45870
  * @name axis․x․extent
45563
45871
  * @memberof Options
45564
- * @type {Array|Function}
45872
+ * @type {Array|function}
45565
45873
  * @default undefined
45566
45874
  * @example
45567
45875
  * axis: {
@@ -45827,7 +46135,7 @@ function smoothLines(el, type) {
45827
46135
  * This option accepts d3.format object as well as a function you define.
45828
46136
  * @name axis․y․tick․format
45829
46137
  * @memberof Options
45830
- * @type {Function}
46138
+ * @type {function}
45831
46139
  * @default undefined
45832
46140
  * @example
45833
46141
  * axis: {
@@ -45846,7 +46154,7 @@ function smoothLines(el, type) {
45846
46154
  * - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
45847
46155
  * This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y.tick.culling.lines=false`.
45848
46156
  * - `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`.
46157
+ * The number of ticks to be shown can be changed by `axis.y.tick.culling.max`.
45850
46158
  * @name axis․y․tick․culling
45851
46159
  * @memberof Options
45852
46160
  * @type {boolean}
@@ -45952,7 +46260,7 @@ function smoothLines(el, type) {
45952
46260
  * Set y axis tick values manually.
45953
46261
  * @name axis․y․tick․values
45954
46262
  * @memberof Options
45955
- * @type {Array|Function}
46263
+ * @type {Array|function}
45956
46264
  * @default null
45957
46265
  * @example
45958
46266
  * axis: {
@@ -46088,7 +46396,7 @@ function smoothLines(el, type) {
46088
46396
  * @private
46089
46397
  * @type {object}
46090
46398
  * @property {object} time time object
46091
- * @property {Function} [time.value] D3's time interval function (https://github.com/d3/d3-time#intervals)
46399
+ * @property {function} [time.value] D3's time interval function (https://github.com/d3/d3-time#intervals)
46092
46400
  * @example
46093
46401
  * axis: {
46094
46402
  * y: {
@@ -46187,6 +46495,18 @@ function smoothLines(el, type) {
46187
46495
 
46188
46496
  ;// ./src/config/Options/axis/y2.ts
46189
46497
  /* harmony default export */ var y2 = ({
46498
+ /**
46499
+ * Set clip-path attribute for y2 axis element
46500
+ * - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
46501
+ * @name axis․y2․clipPath
46502
+ * @memberof Options
46503
+ * @type {boolean}
46504
+ * @default true
46505
+ * @example
46506
+ * // don't set 'clip-path' attribute
46507
+ * clipPath: false
46508
+ */
46509
+ axis_y2_clipPath: true,
46190
46510
  /**
46191
46511
  * Show or hide y2 axis.
46192
46512
  * - **NOTE**:
@@ -46332,7 +46652,7 @@ function smoothLines(el, type) {
46332
46652
  * This option works in the same way as axis.y.format.
46333
46653
  * @name axis․y2․tick․format
46334
46654
  * @memberof Options
46335
- * @type {Function}
46655
+ * @type {function}
46336
46656
  * @default undefined
46337
46657
  * @example
46338
46658
  * axis: {
@@ -46350,7 +46670,7 @@ function smoothLines(el, type) {
46350
46670
  * - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
46351
46671
  * This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y2.tick.culling.lines=false`.
46352
46672
  * - `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`.
46673
+ * The number of ticks to be shown can be changed by `axis.y2.tick.culling.max`.
46354
46674
  * @name axis․y2․tick․culling
46355
46675
  * @memberof Options
46356
46676
  * @type {boolean}
@@ -46457,7 +46777,7 @@ function smoothLines(el, type) {
46457
46777
  * Set y2 axis tick values manually.
46458
46778
  * @name axis․y2․tick․values
46459
46779
  * @memberof Options
46460
- * @type {Array|Function}
46780
+ * @type {Array|function}
46461
46781
  * @default null
46462
46782
  * @example
46463
46783
  * axis: {
@@ -46689,16 +47009,16 @@ var axis_spreadValues = (a, b) => {
46689
47009
  /**
46690
47010
  * Setup the way to evaluate tick text size.
46691
47011
  * - **NOTE:**
46692
- * - Setting `false` or custom evaluator, highly recommended to memoize evaluated text dimension value to not degrade performance.
47012
+ * - When setting `false` or a custom evaluator, it is highly recommended to memoize evaluated text dimension value to not degrade performance.
46693
47013
  * @name axis․evalTextSize
46694
47014
  * @memberof Options
46695
- * @type {boolean|Function}
47015
+ * @type {boolean|function}
46696
47016
  * @default true
46697
47017
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.AxisEvalTextSize)
46698
47018
  * @example
46699
47019
  * axis: {
46700
47020
  * // will evaluate getting text size every time.
46701
- * evalTextSize: false.
47021
+ * evalTextSize: false,
46702
47022
  *
46703
47023
  * // set a custom evaluator
46704
47024
  * evalTextSize: function(textElement, axisId) {
@@ -46742,8 +47062,8 @@ var axis_spreadValues = (a, b) => {
46742
47062
  * Set axis tooltip.
46743
47063
  * - **NOTE:**
46744
47064
  * - 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.
47065
+ * - For `timeseries` x Axis, tooltip will be formatted using x Axis' tick format.
47066
+ * - For `category` x Axis, tooltip will be displaying scales' value text.
46747
47067
  * @name axis․tooltip
46748
47068
  * @memberof Options
46749
47069
  * @type {boolean}
@@ -46756,11 +47076,11 @@ var axis_spreadValues = (a, b) => {
46756
47076
  * axis: {
46757
47077
  * tooltip: true, // default background color is
46758
47078
  *
46759
- * // set backgound color for axis tooltip texts
47079
+ * // set background color for axis tooltip texts
46760
47080
  * tooltip: {
46761
47081
  * backgroundColor: "red",
46762
47082
  *
46763
- * // set differenct backround colors per axes
47083
+ * // set different background colors per axes
46764
47084
  * // NOTE: In this case, only specified axes tooltip will appear.
46765
47085
  * backgroundColor: {
46766
47086
  * x: "green",
@@ -46865,7 +47185,7 @@ var axis_spreadValues = (a, b) => {
46865
47185
  */
46866
47186
  data_xs: {},
46867
47187
  /**
46868
- * Set a format specifier to parse string specifed as x.
47188
+ * Set a format specifier to parse string specified as x.
46869
47189
  * @name data․xFormat
46870
47190
  * @memberof Options
46871
47191
  * @type {string}
@@ -46914,7 +47234,7 @@ var axis_spreadValues = (a, b) => {
46914
47234
  * x: "x",
46915
47235
  * columns: [
46916
47236
  * // 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
47237
+ * // Below data, will start drawing x=1: 200, x=2: 300, x=3: 100
46918
47238
  * ["x", 3, 1, 2],
46919
47239
  * ["data1", 100, 200, 300]
46920
47240
  * ]
@@ -46975,16 +47295,41 @@ var axis_spreadValues = (a, b) => {
46975
47295
  * - **NOTE:**
46976
47296
  * - For stacking, '[data.groups](#.data%25E2%2580%25A4groups)' option should be set
46977
47297
  * - y Axis will be set in percentage value (0 ~ 100%)
46978
- * - Must have postive values
47298
+ * - Must have positive values
47299
+ * - Data not in any group will not be normalized when using perGroup option
46979
47300
  * @name data․stack․normalize
46980
47301
  * @memberof Options
46981
- * @type {boolean}
47302
+ * @type {boolean|object}
46982
47303
  * @default false
46983
- * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataStackNormalized)
47304
+ * @see [Demo: Data Stack Normalized](https://naver.github.io/billboard.js/demo/#Data.DataStackNormalized)
47305
+ * @see [Demo: Data Stack Normalized per Group](https://naver.github.io/billboard.js/demo/#Data.DataStackNormalizedGroup)
46984
47306
  * @example
46985
47307
  * data: {
46986
47308
  * stack: {
47309
+ * // Normalize all grouped data together (all groups combined to 0-100%)
46987
47310
  * normalize: true
47311
+ *
47312
+ * // Normalize per group (each group independently becomes 0-100%)
47313
+ * // Data not in any group will display with their original values.
47314
+ * // If non-grouped data shares the same axis (e.g., y), it will be
47315
+ * // displayed on the 0-100 absolute scale. To display original values,
47316
+ * // assign them to a separate axis (e.g., y2).
47317
+ * normalize: {
47318
+ * perGroup: true
47319
+ * }
47320
+ * },
47321
+ * groups: [
47322
+ * ["data1", "data2"] // This group will be normalized to 0-100%
47323
+ * ],
47324
+ * // data3 is not in any group, so it displays original values
47325
+ * // Assign it to y2 axis to use a separate scale
47326
+ * axes: {
47327
+ * data3: "y2"
47328
+ * }
47329
+ * },
47330
+ * axis: {
47331
+ * y2: {
47332
+ * show: true
46988
47333
  * }
46989
47334
  * }
46990
47335
  */
@@ -47355,6 +47700,155 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
47355
47700
  return arc;
47356
47701
  }
47357
47702
 
47703
+ ;// ./src/ChartInternal/internals/text.arc.ts
47704
+
47705
+
47706
+
47707
+
47708
+ const BREAK_POINT_OFFSET = 15;
47709
+ const DEFAULT_LINE_DISTANCE = 20;
47710
+ const TEXT_VERTICAL_OFFSET = 0.35;
47711
+ function getArcType(excludeMultiGauge = false) {
47712
+ const $$ = this;
47713
+ return ["donut", "pie", "polar", "gauge"].find(
47714
+ (type) => $$.hasType(type) && !(type === "gauge" && excludeMultiGauge && $$.hasMultiArcGauge())
47715
+ );
47716
+ }
47717
+ function getConfig() {
47718
+ const $$ = this;
47719
+ const { config } = $$;
47720
+ const chartType = getArcType.call($$, true);
47721
+ const lineConfig = chartType && config[`${chartType}_label_line`];
47722
+ const isValidConfig = isObjectType(lineConfig);
47723
+ const defaultFormatter = (value, ratio, id) => id;
47724
+ const line = {
47725
+ show: lineConfig === true || isValidConfig && (lineConfig == null ? void 0 : lineConfig.show) !== false,
47726
+ distance: isValidConfig && (lineConfig == null ? void 0 : lineConfig.distance) || DEFAULT_LINE_DISTANCE
47727
+ };
47728
+ if (lineConfig === true) {
47729
+ return {
47730
+ chartType,
47731
+ line,
47732
+ text: { formatter: defaultFormatter }
47733
+ };
47734
+ }
47735
+ if (!isValidConfig) {
47736
+ return {
47737
+ chartType,
47738
+ line: { show: false, distance: DEFAULT_LINE_DISTANCE },
47739
+ text: { formatter: null }
47740
+ };
47741
+ }
47742
+ let formatter = defaultFormatter;
47743
+ if (isFunction(lineConfig.text)) {
47744
+ formatter = lineConfig.text;
47745
+ } else if (lineConfig.text === false) {
47746
+ formatter = null;
47747
+ }
47748
+ return {
47749
+ chartType,
47750
+ line,
47751
+ text: { formatter }
47752
+ };
47753
+ }
47754
+ function getLinePosition(d, lineDistance) {
47755
+ const $$ = this;
47756
+ const { state } = $$;
47757
+ const updated = $$.updateAngle(d);
47758
+ if (!updated) {
47759
+ return null;
47760
+ }
47761
+ let { outerRadius } = $$.getRadius(d);
47762
+ let arcOuterRadius = outerRadius;
47763
+ if ($$.hasType("polar")) {
47764
+ arcOuterRadius = $$.getPolarOuterRadius(d, outerRadius);
47765
+ outerRadius = state.radius;
47766
+ }
47767
+ let midAngle = (updated.startAngle + updated.endAngle) / 2;
47768
+ const isFullCircleArc = Math.abs(updated.endAngle - updated.startAngle - 2 * Math.PI) < 0.01;
47769
+ if (isFullCircleArc) {
47770
+ midAngle = Math.PI / 2;
47771
+ }
47772
+ const sinAngle = Math.sin(midAngle);
47773
+ const cosAngle = -Math.cos(midAngle);
47774
+ const startPoint = {
47775
+ x: sinAngle * arcOuterRadius,
47776
+ y: cosAngle * arcOuterRadius
47777
+ };
47778
+ const breakRadius = outerRadius + BREAK_POINT_OFFSET;
47779
+ const breakPoint = {
47780
+ x: sinAngle * breakRadius,
47781
+ y: cosAngle * breakRadius
47782
+ };
47783
+ const isRight = sinAngle >= 0;
47784
+ const endPoint = {
47785
+ x: breakPoint.x + lineDistance * (isRight ? 1 : -1),
47786
+ y: breakPoint.y
47787
+ };
47788
+ return { startPoint, breakPoint, endPoint, isRight, midAngle };
47789
+ }
47790
+ function isLabelWithLine() {
47791
+ return getConfig.call(this).line.show;
47792
+ }
47793
+ function redrawArcLabelLines(duration) {
47794
+ const $$ = this;
47795
+ const { $el: { arcs }, $T } = $$;
47796
+ const { line: lineConfig, text: textConfig } = getConfig.call($$);
47797
+ const lineDistance = lineConfig.distance;
47798
+ let cachedFontSize = null;
47799
+ arcs.selectAll(`.${$ARC.chartArc}`).each(function(d) {
47800
+ var _a, _b, _c;
47801
+ const g = src_select(this);
47802
+ const linePos = getLinePosition.call($$, d, lineDistance);
47803
+ const { ratio, meetsThreshold, updated } = (_a = d._cache) != null ? _a : {};
47804
+ if (!updated || !linePos) {
47805
+ return;
47806
+ }
47807
+ const isVisible = $$.isTargetToShow(d.data.id) && meetsThreshold;
47808
+ const { startPoint, breakPoint, endPoint, isRight } = linePos;
47809
+ const points = `${startPoint.x},${startPoint.y} ${breakPoint.x},${breakPoint.y} ${endPoint.x},${endPoint.y}`;
47810
+ if (lineConfig.show) {
47811
+ let line = g.select(`.${$ARC.arcLabelLine}`);
47812
+ if (line.empty()) {
47813
+ line = g.append("polyline").attr("class", $ARC.arcLabelLine);
47814
+ }
47815
+ $T(line, duration).attr("points", points).style("stroke", $$.color(d.data)).style("opacity", isVisible ? null : "0");
47816
+ }
47817
+ let labelLineText = g.select(`.${$ARC.arcLabelLineText}`);
47818
+ if (labelLineText.empty()) {
47819
+ labelLineText = g.append("text").attr("class", $ARC.arcLabelLineText).style("pointer-events", "none");
47820
+ }
47821
+ if (isVisible) {
47822
+ const { value } = updated;
47823
+ const { id } = d.data;
47824
+ const text = ((_c = (_b = textConfig.formatter) != null ? _b : $$.getArcLabelConfig("format")) != null ? _c : $$.defaultArcValueFormat)(value, ratio, id).toString();
47825
+ setTextValue(labelLineText, text, [-1, 1], false);
47826
+ const pos = {
47827
+ x: endPoint.x + 5 * (isRight ? 1 : -1),
47828
+ // 5: label offset from endpoint
47829
+ y: endPoint.y
47830
+ };
47831
+ labelLineText.style("text-anchor", isRight ? "start" : "end");
47832
+ const textNode = labelLineText.node();
47833
+ const tspanNodes = textNode == null ? void 0 : textNode.querySelectorAll("tspan");
47834
+ if (cachedFontSize === null) {
47835
+ cachedFontSize = parseFloat(win.getComputedStyle(textNode).fontSize) || 12;
47836
+ }
47837
+ if (tspanNodes && tspanNodes.length > 1) {
47838
+ const lineCount = tspanNodes.length;
47839
+ const centerOffset = (lineCount - 3) / 2;
47840
+ pos.y += (-centerOffset + TEXT_VERTICAL_OFFSET) * cachedFontSize;
47841
+ } else {
47842
+ pos.y += TEXT_VERTICAL_OFFSET * cachedFontSize;
47843
+ }
47844
+ $T(labelLineText, duration).attr("transform", `translate(${pos.x},${pos.y})`).style("opacity", null).style("fill", $$.updateTextColor.bind($$)(d));
47845
+ } else {
47846
+ $T(labelLineText, duration).style("opacity", "0");
47847
+ }
47848
+ });
47849
+ }
47850
+
47851
+
47358
47852
  ;// ./src/ChartInternal/shape/arc.ts
47359
47853
  var arc_defProp = Object.defineProperty;
47360
47854
  var arc_defProps = Object.defineProperties;
@@ -47382,7 +47876,63 @@ var arc_spreadProps = (a, b) => arc_defProps(a, arc_getOwnPropDescs(b));
47382
47876
 
47383
47877
 
47384
47878
 
47385
- function getRadiusFn(expandRate = 0) {
47879
+
47880
+ function _getArcType($$) {
47881
+ return ["donut", "pie", "polar", "gauge"].find((type) => $$.hasType(type));
47882
+ }
47883
+ function _calculateRangeOrGaugePosition($$, d, updated, forRange) {
47884
+ var _a, _b;
47885
+ const { config, state: { radiusExpanded } } = $$;
47886
+ const angle = updated.endAngle - Math.PI / 2;
47887
+ const sinAngle = Math.sin(angle);
47888
+ const pos = {
47889
+ x: Math.cos(angle) * (radiusExpanded + (forRange ? 5 : 25)),
47890
+ // 5: range offset, 25: gauge offset
47891
+ y: sinAngle * (radiusExpanded + 15 - Math.abs(sinAngle * 10)) + 3
47892
+ // 10: y factor, 3: y offset
47893
+ };
47894
+ if (forRange) {
47895
+ const rangeTextPosition = config.arc_rangeText_position;
47896
+ if (rangeTextPosition) {
47897
+ const rangeValues = config.arc_rangeText_values;
47898
+ const position = isFunction(rangeTextPosition) ? rangeTextPosition(rangeValues[d.index]) : rangeTextPosition;
47899
+ pos.x += (_a = position == null ? void 0 : position.x) != null ? _a : 0;
47900
+ pos.y += (_b = position == null ? void 0 : position.y) != null ? _b : 0;
47901
+ }
47902
+ }
47903
+ return pos;
47904
+ }
47905
+ function _calculateLabelRatio($$, d, outerRadius, distance) {
47906
+ const { config } = $$;
47907
+ const chartType = _getArcType($$);
47908
+ let ratio = chartType ? config[`${chartType}_label_ratio`] : void 0;
47909
+ if (ratio) {
47910
+ ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, distance) : ratio;
47911
+ } else {
47912
+ const LABEL_MIN_SIZE = 36;
47913
+ const LABEL_RATIO_THRESHOLD = 0.375;
47914
+ const LABEL_RATIO_BASE = 1.175;
47915
+ const LABEL_RATIO_LARGE = 0.8;
47916
+ const labelSpaceRatio = LABEL_MIN_SIZE / outerRadius;
47917
+ const isSmallChart = labelSpaceRatio > LABEL_RATIO_THRESHOLD;
47918
+ ratio = outerRadius && distance ? (isSmallChart ? LABEL_RATIO_BASE - labelSpaceRatio : LABEL_RATIO_LARGE) * outerRadius / distance : 0;
47919
+ }
47920
+ return ratio;
47921
+ }
47922
+ function _calculateStandardArcPosition($$, d, updated) {
47923
+ let { outerRadius } = $$.getRadius(d);
47924
+ if ($$.hasType("polar")) {
47925
+ outerRadius = $$.getPolarOuterRadius(d, outerRadius);
47926
+ }
47927
+ const [x, y] = $$.svgArc.centroid(updated).map((v) => isNaN(v) ? 0 : v);
47928
+ const distance = Math.sqrt(x * x + y * y);
47929
+ const ratio = _calculateLabelRatio($$, d, outerRadius, distance);
47930
+ return {
47931
+ pos: { x, y },
47932
+ ratio
47933
+ };
47934
+ }
47935
+ function _getRadiusFn(expandRate = 0) {
47386
47936
  const $$ = this;
47387
47937
  const { config, state } = $$;
47388
47938
  const hasMultiArcGauge = $$.hasMultiArcGauge();
@@ -47450,7 +48000,7 @@ function getRadiusFn(expandRate = 0) {
47450
48000
  }
47451
48001
  };
47452
48002
  }
47453
- function getAttrTweenFn(fn) {
48003
+ function _getAttrTweenFn(fn) {
47454
48004
  return function(d) {
47455
48005
  const getAngleKeyValue = ({ startAngle = 0, endAngle = 0, padAngle = 0 }) => ({
47456
48006
  startAngle,
@@ -47489,7 +48039,9 @@ function getAttrTweenFn(fn) {
47489
48039
  const padding = config[`${dataType}_padding`];
47490
48040
  const w = config.gauge_width || config.donut_width;
47491
48041
  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);
48042
+ const LABEL_RADIUS_RATIO = 0.85;
48043
+ const labelWithLineRatio = isLabelWithLine.call($$) ? LABEL_RADIUS_RATIO : 1;
48044
+ state.radiusExpanded = Math.min(state.arcWidth, state.arcHeight) / 2 * ($$.hasMultiArcGauge() && config.gauge_label_show ? LABEL_RADIUS_RATIO : labelWithLineRatio);
47493
48045
  state.radius = state.radiusExpanded * 0.95;
47494
48046
  state.innerRadiusRatio = w ? (state.radius - w) / state.radius : 0.6;
47495
48047
  state.gaugeArcWidth = w || (gaugeArcWidth <= state.radius - state.innerRadius ? state.radius - state.innerRadius : gaugeArcWidth <= state.radius ? gaugeArcWidth : state.radius);
@@ -47607,7 +48159,7 @@ function getAttrTweenFn(fn) {
47607
48159
  },
47608
48160
  getSvgArc() {
47609
48161
  const $$ = this;
47610
- const { inner, outer, corner } = getRadiusFn.call($$);
48162
+ const { inner, outer, corner } = _getRadiusFn.call($$);
47611
48163
  const arc = src_arc().innerRadius(inner).outerRadius(outer);
47612
48164
  const newArc = function(d, withoutUpdate) {
47613
48165
  var _a;
@@ -47628,12 +48180,12 @@ function getAttrTweenFn(fn) {
47628
48180
  /**
47629
48181
  * Get expanded arc path function
47630
48182
  * @param {number} rate Expand rate
47631
- * @returns {Function} Expanded arc path getter function
48183
+ * @returns {function} Expanded arc path getter function
47632
48184
  * @private
47633
48185
  */
47634
48186
  getSvgArcExpanded(rate = 1) {
47635
48187
  const $$ = this;
47636
- const { inner, outer, corner } = getRadiusFn.call($$, rate);
48188
+ const { inner, outer, corner } = _getRadiusFn.call($$, rate);
47637
48189
  const arc = src_arc().innerRadius(inner).outerRadius(outer);
47638
48190
  return (d) => {
47639
48191
  const updated = $$.updateAngle(d);
@@ -47691,46 +48243,24 @@ function getAttrTweenFn(fn) {
47691
48243
  * @private
47692
48244
  */
47693
48245
  transformForArcLabel(textNode, d, forRange = false) {
47694
- var _a, _b, _c;
47695
48246
  const $$ = this;
47696
- const { config, state: { radiusExpanded } } = $$;
47697
48247
  const updated = $$.updateAngle(d, forRange);
47698
- const pos = { x: 0, y: 0 };
47699
- let translate = "";
48248
+ if (!updated) {
48249
+ return "";
48250
+ }
48251
+ let pos;
47700
48252
  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})`;
48253
+ if (forRange || $$.hasMultiArcGauge()) {
48254
+ pos = _calculateRangeOrGaugePosition($$, d, updated, forRange);
48255
+ } else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
48256
+ const result = _calculateStandardArcPosition($$, d, updated);
48257
+ pos = result.pos;
48258
+ ratio = result.ratio;
48259
+ } else {
48260
+ return "";
47732
48261
  }
47733
- return translate;
48262
+ updateTextImagePos.call($$, textNode, pos);
48263
+ return `translate(${pos.x * ratio},${pos.y * ratio})`;
47734
48264
  },
47735
48265
  convertToArcData(d) {
47736
48266
  return this.addName({
@@ -47741,20 +48271,18 @@ function getAttrTweenFn(fn) {
47741
48271
  });
47742
48272
  },
47743
48273
  textForArcLabel(selection) {
48274
+ var _a;
47744
48275
  const $$ = this;
47745
48276
  const hasGauge = $$.hasType("gauge");
48277
+ const chartType = (_a = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _a[0];
47746
48278
  if ($$.shouldShowArcLabel()) {
47747
48279
  selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", (d) => $$.updateTextBGColor.bind($$)(d, $$.config.data_labels_backgroundColors)).each(function(d) {
47748
- var _a;
47749
48280
  const node = src_select(this);
47750
48281
  const updated = $$.updateAngle(d);
47751
48282
  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) {
48283
+ const meetsThreshold = meetsLabelThreshold.call($$, ratio, chartType);
48284
+ d._cache = { updated, ratio, meetsThreshold };
48285
+ if (meetsThreshold) {
47758
48286
  const { value } = updated || d;
47759
48287
  const text = ($$.getArcLabelConfig("format") || $$.defaultArcValueFormat)(value, ratio, d.data.id).toString();
47760
48288
  setTextValue(node, text, [-1, 1], hasGauge);
@@ -47785,7 +48313,7 @@ function getAttrTweenFn(fn) {
47785
48313
  const svgArcExpandedSub = $$.getSvgArcExpanded(
47786
48314
  $$.getExpandConfig(d.data.id, "rate")
47787
48315
  );
47788
- src_select(this).selectAll("path").transition().duration(expandDuration).attrTween("d", getAttrTweenFn($$.svgArcExpanded.bind($$))).transition().duration(expandDuration * 2).attrTween("d", getAttrTweenFn(svgArcExpandedSub.bind($$)));
48316
+ src_select(this).selectAll("path").transition().duration(expandDuration).attrTween("d", _getAttrTweenFn($$.svgArcExpanded.bind($$))).transition().duration(expandDuration * 2).attrTween("d", _getAttrTweenFn(svgArcExpandedSub.bind($$)));
47789
48317
  });
47790
48318
  },
47791
48319
  unexpandArc(targetIds) {
@@ -47795,7 +48323,7 @@ function getAttrTweenFn(fn) {
47795
48323
  return;
47796
48324
  }
47797
48325
  const newTargetIds = $$.mapToTargetIds(targetIds);
47798
- svg.selectAll($$.selectorTargets(newTargetIds, `.${$ARC.chartArc}`)).selectAll("path").transition().duration((d) => $$.getExpandConfig(d.data.id, "duration")).attrTween("d", getAttrTweenFn($$.svgArc.bind($$)));
48326
+ svg.selectAll($$.selectorTargets(newTargetIds, `.${$ARC.chartArc}`)).selectAll("path").transition().duration((d) => $$.getExpandConfig(d.data.id, "duration")).attrTween("d", _getAttrTweenFn($$.svgArc.bind($$)));
47799
48327
  svg.selectAll(`${$ARC.arc}`).style("opacity", null);
47800
48328
  },
47801
48329
  /**
@@ -47861,7 +48389,7 @@ function getAttrTweenFn(fn) {
47861
48389
  ])
47862
48390
  );
47863
48391
  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"));
48392
+ mainPieEnter.append("text").attr("dy", hasGauge && !$$.hasMultiTargets() ? "-.1em" : null).style("opacity", "0").style("text-anchor", $$.getStylePropValue("middle")).style("pointer-events", $$.getStylePropValue("none"));
47865
48393
  $el.text = chartArcs.selectAll(`.${$COMMON.target} text`);
47866
48394
  },
47867
48395
  initArc() {
@@ -48171,7 +48699,7 @@ function getAttrTweenFn(fn) {
48171
48699
  const id = (arcData == null ? void 0 : arcData.id) || void 0;
48172
48700
  $$.callOverOutForTouch(arcData);
48173
48701
  isUndefined(id) ? unselectArc() : selectArc(this, arcData, id);
48174
- });
48702
+ }, { passive: true });
48175
48703
  }
48176
48704
  },
48177
48705
  redrawArcText(duration) {
@@ -48201,6 +48729,7 @@ function getAttrTweenFn(fn) {
48201
48729
  !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
48730
  }
48203
48731
  }
48732
+ isLabelWithLine.call($$) && redrawArcLabelLines.call($$, duration);
48204
48733
  },
48205
48734
  /**
48206
48735
  * Get Arc element by id or index
@@ -48387,7 +48916,7 @@ function point_y(p) {
48387
48916
  },
48388
48917
  /**
48389
48918
  * Redraw function
48390
- * @param {Function} drawFn Retuned functino from .generateDrawCandlestick()
48919
+ * @param {function} drawFn Retuned functino from .generateDrawCandlestick()
48391
48920
  * @param {boolean} withTransition With or without transition
48392
48921
  * @param {boolean} isSub Subchart draw
48393
48922
  * @returns {Array}
@@ -48407,7 +48936,7 @@ function point_y(p) {
48407
48936
  * Generate area path data
48408
48937
  * @param {object} areaIndices Indices
48409
48938
  * @param {boolean} isSub Weather is sub axis
48410
- * @returns {Function}
48939
+ * @returns {function}
48411
48940
  * @private
48412
48941
  */
48413
48942
  generateDrawArea(areaIndices, isSub) {
@@ -48481,7 +49010,7 @@ function point_y(p) {
48481
49010
 
48482
49011
 
48483
49012
 
48484
- function getConnectLineType(id) {
49013
+ function _getConnectLineType(id) {
48485
49014
  const connectLine = this.config.bar_connectLine;
48486
49015
  const type = (connectLine == null ? void 0 : connectLine[id]) || connectLine;
48487
49016
  return /^(start|end)\-(start|end)$/.test(type) ? type : null;
@@ -48514,7 +49043,7 @@ function getConnectLineType(id) {
48514
49043
  }).call((selection) => {
48515
49044
  $$.setCssRule(true, ` .${$BAR.bar}`, ["fill"], $$.color)(selection);
48516
49045
  selection.each(function(d) {
48517
- if (getConnectLineType.call($$, d.id)) {
49046
+ if (_getConnectLineType.call($$, d.id)) {
48518
49047
  src_select(this).append("path").attr("class", $BAR.barConnectLine);
48519
49048
  }
48520
49049
  });
@@ -48551,7 +49080,7 @@ function getConnectLineType(id) {
48551
49080
  },
48552
49081
  /**
48553
49082
  * Redraw function
48554
- * @param {Function} drawFn Retuned function from .getDrawShape() => .generateDrawBar()
49083
+ * @param {function} drawFn Retuned function from .getDrawShape() => .generateDrawBar()
48555
49084
  * @param {boolean} withTransition With or without transition
48556
49085
  * @param {boolean} isSub Subchart draw
48557
49086
  * @returns {Array}
@@ -48564,7 +49093,7 @@ function getConnectLineType(id) {
48564
49093
  return [
48565
49094
  $$.$T(bar, withTransition, getRandom()).attr("d", function(d, i, arr) {
48566
49095
  const path = (isNumber(d.value) || $$.isBarRangeType(d)) && drawFn(d, i);
48567
- const connectLineType = getConnectLineType.call($$, d.id);
49096
+ const connectLineType = _getConnectLineType.call($$, d.id);
48568
49097
  if (path.length > 1) {
48569
49098
  barPath.push(path[1]);
48570
49099
  if (i === arr.length - 1) {
@@ -48598,7 +49127,7 @@ function getConnectLineType(id) {
48598
49127
  * -------------------------
48599
49128
  * 0 1
48600
49129
  * @param {boolean} isSub If is for subchart
48601
- * @returns {Function}
49130
+ * @returns {function}
48602
49131
  * @private
48603
49132
  */
48604
49133
  generateDrawBar(barIndices, isSub) {
@@ -48656,7 +49185,7 @@ function getConnectLineType(id) {
48656
49185
  }
48657
49186
  const path = isRotated ? `H${pos} ${pathRadius[0]}V${points[2][indexY] - radius} ${pathRadius[1]}H${points[3][indexX]}` : `V${pos} ${pathRadius[0]}H${points[2][indexX] - radius} ${pathRadius[1]}V${points[3][indexY]}`;
48658
49187
  const coords = [`M${points[0][indexX]},${points[0][indexY]}${path}z`];
48659
- if (getConnectLineType.call($$, d.id)) {
49188
+ if (_getConnectLineType.call($$, d.id)) {
48660
49189
  coords.push(isRotated ? {
48661
49190
  x: points[0][indexX],
48662
49191
  y: points[0][indexY],
@@ -48893,7 +49422,7 @@ var candlestick_spreadValues = (a, b) => {
48893
49422
  * Get draw function
48894
49423
  * @param {object} indices Indice data
48895
49424
  * @param {boolean} isSub Subchart draw
48896
- * @returns {Function}
49425
+ * @returns {function}
48897
49426
  * @private
48898
49427
  */
48899
49428
  generateDrawCandlestick(indices, isSub) {
@@ -48937,7 +49466,7 @@ var candlestick_spreadValues = (a, b) => {
48937
49466
  * Generate shape drawing points
48938
49467
  * @param {object} indices Indice data
48939
49468
  * @param {boolean} isSub Subchart draw
48940
- * @returns {Function}
49469
+ * @returns {function}
48941
49470
  */
48942
49471
  generateGetCandlestickPoints(indices, isSub = false) {
48943
49472
  const $$ = this;
@@ -48983,7 +49512,7 @@ var candlestick_spreadValues = (a, b) => {
48983
49512
  },
48984
49513
  /**
48985
49514
  * Redraw function
48986
- * @param {Function} drawFn Retuned functino from .generateDrawCandlestick()
49515
+ * @param {function} drawFn Retuned functino from .generateDrawCandlestick()
48987
49516
  * @param {boolean} withTransition With or without transition
48988
49517
  * @param {boolean} isSub Subchart draw
48989
49518
  * @returns {Array}
@@ -49045,7 +49574,7 @@ var funnel_spreadValues = (a, b) => {
49045
49574
 
49046
49575
 
49047
49576
 
49048
- function getSize(checkNeck = false) {
49577
+ function _getSize(checkNeck = false) {
49049
49578
  const $$ = this;
49050
49579
  const { config, state: { current: { width, height } } } = $$;
49051
49580
  const padding = $$.getCurrentPadding();
@@ -49054,7 +49583,7 @@ function getSize(checkNeck = false) {
49054
49583
  height: height - (config.legend_show ? $$.getLegendHeight() + 10 : 0) - (padding.top + padding.bottom)
49055
49584
  }, padding);
49056
49585
  if (checkNeck) {
49057
- const { width: neckWidth, height: neckHeight } = getNecklSize.call($$, {
49586
+ const { width: neckWidth, height: neckHeight } = _getNeckSize.call($$, {
49058
49587
  width: size.width,
49059
49588
  height: size.height
49060
49589
  });
@@ -49067,7 +49596,7 @@ function getSize(checkNeck = false) {
49067
49596
  }
49068
49597
  return size;
49069
49598
  }
49070
- function getNecklSize(current) {
49599
+ function _getNeckSize(current) {
49071
49600
  const $$ = this;
49072
49601
  const { config } = $$;
49073
49602
  let width = config.funnel_neck_width;
@@ -49084,9 +49613,9 @@ function getNecklSize(current) {
49084
49613
  height
49085
49614
  };
49086
49615
  }
49087
- function getCoord(d) {
49616
+ function _getCoord(d) {
49088
49617
  const $$ = this;
49089
- const { top, left, width } = getSize.call($$, true);
49618
+ const { top, left, width } = _getSize.call($$, true);
49090
49619
  const coords = [];
49091
49620
  d.forEach((d2, i) => {
49092
49621
  const { ratio } = d2;
@@ -49106,10 +49635,10 @@ function getCoord(d) {
49106
49635
  });
49107
49636
  return coords;
49108
49637
  }
49109
- function getClipPath(forBackground = false) {
49638
+ function _getClipPath(forBackground = false) {
49110
49639
  const $$ = this;
49111
- const { width, height, top, left } = getSize.call($$, true);
49112
- const neck = getNecklSize.call($$, { width, height });
49640
+ const { width, height, top, left } = _getSize.call($$, true);
49641
+ const neck = _getNeckSize.call($$, { width, height });
49113
49642
  const leftX = (width - neck.width) / 2;
49114
49643
  const rightX = (width + neck.width) / 2;
49115
49644
  const bodyHeigth = height - neck.height;
@@ -49137,7 +49666,7 @@ function getClipPath(forBackground = false) {
49137
49666
  }
49138
49667
  return `M${coords.join("L")}z`;
49139
49668
  }
49140
- function getFunnelData(d) {
49669
+ function _getFunnelData(d) {
49141
49670
  const $$ = this;
49142
49671
  const { config } = $$;
49143
49672
  const data = d.map((d2) => ({
@@ -49147,11 +49676,11 @@ function getFunnelData(d) {
49147
49676
  if (config.data_order) {
49148
49677
  data.sort($$.getSortCompareFn.bind($$)(true));
49149
49678
  }
49150
- return updateRatio.call($$, data);
49679
+ return _updateRatio.call($$, data);
49151
49680
  }
49152
- function updateRatio(data) {
49681
+ function _updateRatio(data) {
49153
49682
  const $$ = this;
49154
- const { height } = getSize.call($$);
49683
+ const { height } = _getSize.call($$);
49155
49684
  const total = $$.getTotalDataSum(true);
49156
49685
  data.forEach((d) => {
49157
49686
  d.ratio = d.value / total * height;
@@ -49195,7 +49724,7 @@ function updateRatio(data) {
49195
49724
  $$.showTooltip([data], event.target);
49196
49725
  /^(touchstart|mouseover)$/.test(event.type) && $$.setOverOut(true, data);
49197
49726
  }
49198
- }).on(isTouch ? "touchend" : "mouseout", (event) => {
49727
+ }, isTouch ? { passive: true } : void 0).on(isTouch ? "touchend" : "mouseout", (event) => {
49199
49728
  const data = getTarget(event);
49200
49729
  if (config.interaction_onout) {
49201
49730
  $$.hideTooltip();
@@ -49217,7 +49746,7 @@ function updateRatio(data) {
49217
49746
  if (!funnel) {
49218
49747
  $$.initFunnel();
49219
49748
  }
49220
- const targets = getFunnelData.call($$, t.filter($$.isFunnelType.bind($$)));
49749
+ const targets = _getFunnelData.call($$, t.filter($$.isFunnelType.bind($$)));
49221
49750
  const mainFunnelUpdate = funnel.selectAll(`.${$FUNNEL.chartFunnel}`).data($$.filterNullish(targets));
49222
49751
  mainFunnelUpdate.exit().remove();
49223
49752
  const mainFunnelEnter = mainFunnelUpdate.enter().insert("g", `.${$FUNNEL.funnelBackground}`);
@@ -49244,7 +49773,7 @@ function updateRatio(data) {
49244
49773
  const $$ = this;
49245
49774
  const { $el: { funnel } } = $$;
49246
49775
  const targets = $$.filterTargetsToShow(funnel.path);
49247
- const { top, left, right } = getSize.call($$);
49776
+ const { top, left, right } = _getSize.call($$);
49248
49777
  const center = (left - right) / 2;
49249
49778
  const points = {};
49250
49779
  let accumulatedHeight = top != null ? top : 0;
@@ -49265,9 +49794,9 @@ function updateRatio(data) {
49265
49794
  const $$ = this;
49266
49795
  const { $T, $el: { funnel } } = $$;
49267
49796
  const targets = $$.filterTargetsToShow(funnel.path);
49268
- const coords = getCoord.call($$, updateRatio.call($$, targets.data()));
49269
- funnel.attr("clip-path", `path('${getClipPath.bind($$)()}')`);
49270
- funnel.background.attr("d", getClipPath.call($$, true));
49797
+ const coords = _getCoord.call($$, _updateRatio.call($$, targets.data()));
49798
+ funnel.attr("clip-path", `path('${_getClipPath.bind($$)()}')`);
49799
+ funnel.background.attr("d", _getClipPath.call($$, true));
49271
49800
  $T(targets).attr("d", (d, i) => `M${coords[i].join("L")}z`).style("opacity", "1");
49272
49801
  funnel.selectAll("g").style("opacity", null);
49273
49802
  }
@@ -49375,7 +49904,7 @@ var line_spreadProps = (a, b) => line_defProps(a, line_getOwnPropDescs(b));
49375
49904
 
49376
49905
 
49377
49906
 
49378
- function getStrokeDashArray(start, end, pattern, isLastX = false) {
49907
+ function _getStrokeDashArray(start, end, pattern, isLastX = false) {
49379
49908
  const dash = start ? [start, 0] : pattern;
49380
49909
  for (let i = start ? start : pattern.reduce((a, c) => a + c); i <= end; ) {
49381
49910
  pattern.forEach((v) => {
@@ -49391,7 +49920,7 @@ function getStrokeDashArray(start, end, pattern, isLastX = false) {
49391
49920
  length: dash.reduce((a, b) => a + b, 0)
49392
49921
  };
49393
49922
  }
49394
- function getRegions(d, _regions, isTimeSeries) {
49923
+ function _getRegions(d, _regions, isTimeSeries) {
49395
49924
  const $$ = this;
49396
49925
  const regions = [];
49397
49926
  const dasharray = "2 2";
@@ -49446,7 +49975,7 @@ function getRegions(d, _regions, isTimeSeries) {
49446
49975
  },
49447
49976
  /**
49448
49977
  * Redraw function
49449
- * @param {Function} drawFn Retuned functino from .generateDrawCandlestick()
49978
+ * @param {function} drawFn Retuned functino from .generateDrawCandlestick()
49450
49979
  * @param {boolean} withTransition With or without transition
49451
49980
  * @param {boolean} isSub Subchart draw
49452
49981
  * @returns {Array}
@@ -49463,7 +49992,7 @@ function getRegions(d, _regions, isTimeSeries) {
49463
49992
  /**
49464
49993
  * Get the curve interpolate
49465
49994
  * @param {Array} d Data object
49466
- * @returns {Function}
49995
+ * @returns {function}
49467
49996
  * @private
49468
49997
  */
49469
49998
  getCurve(d) {
@@ -49533,8 +50062,8 @@ function getRegions(d, _regions, isTimeSeries) {
49533
50062
  /**
49534
50063
  * Set regions dasharray and get path
49535
50064
  * @param {Array} d Data object
49536
- * @param {Function} x x scale function
49537
- * @param {Function} y y scale function
50065
+ * @param {function} x x scale function
50066
+ * @param {function} y y scale function
49538
50067
  * @param {object} _regions regions to be set
49539
50068
  * @returns {stirng} Path string
49540
50069
  * @private
@@ -49545,7 +50074,7 @@ function getRegions(d, _regions, isTimeSeries) {
49545
50074
  const isRotated = config.axis_rotated;
49546
50075
  const isTimeSeries = $$.axis.isTimeSeries();
49547
50076
  const dasharray = "2 2";
49548
- const regions = getRegions.bind($$)(d, _regions, isTimeSeries);
50077
+ const regions = _getRegions.bind($$)(d, _regions, isTimeSeries);
49549
50078
  const hasNullDataValue = $$.hasNullDataValue(d);
49550
50079
  let xp;
49551
50080
  let yp;
@@ -49641,7 +50170,7 @@ function getRegions(d, _regions, isTimeSeries) {
49641
50170
  isRotated && points.forEach((v) => v.reverse());
49642
50171
  const startLength = getLength(tempNode, path);
49643
50172
  const endLength = getLength(tempNode, path += `L${points[1].join(",")}`);
49644
- const strokeDashArray = getStrokeDashArray(
50173
+ const strokeDashArray = _getStrokeDashArray(
49645
50174
  startLength - dashArray.lastLength,
49646
50175
  endLength - dashArray.lastLength,
49647
50176
  style,
@@ -50073,10 +50602,10 @@ const getTransitionName = () => getRandom();
50073
50602
 
50074
50603
 
50075
50604
 
50076
- function hasValidPointDrawMethods(point) {
50605
+ function _hasValidPointDrawMethods(point) {
50077
50606
  return isObjectType(point) && isFunction(point.create) && isFunction(point.update);
50078
50607
  }
50079
- function insertPointInfoDefs(point, id) {
50608
+ function _insertPointInfoDefs(point, id) {
50080
50609
  var _a;
50081
50610
  const $$ = this;
50082
50611
  const copyAttr = (from, target) => {
@@ -50129,16 +50658,26 @@ function insertPointInfoDefs(point, id) {
50129
50658
  const { state: { datetimeId } } = this;
50130
50659
  return `${datetimeId}-point${id}`;
50131
50660
  },
50661
+ /**
50662
+ * Get validated point pattern array
50663
+ * @returns {Array} Array of point types
50664
+ * @private
50665
+ */
50666
+ getValidPointPattern() {
50667
+ const { config } = this;
50668
+ const validPointType = /^(circle|rect(angle)?)$/i.test(config.point_type) ? config.point_type : "circle";
50669
+ return notEmpty(config.point_pattern) ? config.point_pattern : [validPointType];
50670
+ },
50132
50671
  /**
50133
50672
  * Get generate point function
50134
- * @returns {Function}
50673
+ * @returns {function}
50135
50674
  * @private
50136
50675
  */
50137
50676
  generatePoint() {
50138
50677
  const $$ = this;
50139
50678
  const { $el, config } = $$;
50140
50679
  const ids = [];
50141
- const pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type];
50680
+ const pattern = $$.getValidPointPattern();
50142
50681
  return function(method, context, ...args) {
50143
50682
  return function(d) {
50144
50683
  var _a, _b, _c, _d;
@@ -50148,11 +50687,11 @@ function insertPointInfoDefs(point, id) {
50148
50687
  let point = pattern[ids.indexOf(id) % pattern.length];
50149
50688
  if ($$.hasValidPointType(point)) {
50150
50689
  point = $$[point];
50151
- } else if (!hasValidPointDrawMethods(point || config.point_type)) {
50690
+ } else if (!_hasValidPointDrawMethods(point || config.point_type)) {
50152
50691
  const pointId = $$.getDefsPointId(id);
50153
50692
  const defsPoint = $el.defs.select(`#${pointId}`);
50154
50693
  if (defsPoint.size() < 1) {
50155
- insertPointInfoDefs.call($$, point, pointId);
50694
+ _insertPointInfoDefs.call($$, point, pointId);
50156
50695
  }
50157
50696
  if (method === "create") {
50158
50697
  return (_b = $$.custom) == null ? void 0 : _b.create.bind(context)(element, pointId, ...args);
@@ -50254,7 +50793,7 @@ function getDataMax($$) {
50254
50793
 
50255
50794
 
50256
50795
 
50257
- function getPosition(isClockwise, type, edge, pos, range, ratio) {
50796
+ function _getPosition(isClockwise, type, edge, pos, range, ratio) {
50258
50797
  const index = isClockwise && pos > 0 ? edge - pos : pos;
50259
50798
  const r = 2 * Math.PI;
50260
50799
  const func = type === "x" ? Math.sin : Math.cos;
@@ -50303,7 +50842,7 @@ const cacheKeyTextWidth = KEY.radarTextWidth;
50303
50842
  const edge = config.axis_x_categories.length;
50304
50843
  const isClockwise = config.radar_direction_clockwise;
50305
50844
  const pos = toArray(type).map(
50306
- (v) => getPosition(
50845
+ (v) => _getPosition(
50307
50846
  isClockwise,
50308
50847
  v,
50309
50848
  edge,
@@ -50480,9 +51019,9 @@ const cacheKeyTextWidth = KEY.radarTextWidth;
50480
51019
  const index = $$.getDataIndexFromEvent(event);
50481
51020
  $$.selectRectForSingle(svg.node(), index);
50482
51021
  isMouse ? $$.setOverOut(true, index) : $$.callOverOutForTouch(index);
50483
- }).on("mouseout", isMouse ? hide : null);
51022
+ }, isMouse ? void 0 : { passive: true }).on("mouseout", isMouse ? hide : null);
50484
51023
  if (!isMouse) {
50485
- svg.on("touchstart", hide);
51024
+ svg.on("touchstart", hide, { passive: true });
50486
51025
  }
50487
51026
  },
50488
51027
  updateRadarShape() {
@@ -51050,7 +51589,7 @@ function getHierachyData(data) {
51050
51589
  $$.showTooltip([data], event.currentTarget);
51051
51590
  /^(touchstart|mouseover)$/.test(event.type) && $$.setOverOut(true, data);
51052
51591
  }
51053
- }).on(isTouch ? "touchend" : "mouseout", (event) => {
51592
+ }, isTouch ? { passive: true } : void 0).on(isTouch ? "touchend" : "mouseout", (event) => {
51054
51593
  const data = getTarget(event);
51055
51594
  if (config.interaction_onout) {
51056
51595
  $$.hideTooltip();
@@ -51061,7 +51600,7 @@ function getHierachyData(data) {
51061
51600
  },
51062
51601
  /**
51063
51602
  * Get tiling function
51064
- * @returns {Function}
51603
+ * @returns {function}
51065
51604
  * @private
51066
51605
  */
51067
51606
  getTreemapTile() {
@@ -51162,20 +51701,28 @@ function getHierachyData(data) {
51162
51701
  /**
51163
51702
  * Get treemap data label format function
51164
51703
  * @param {object} d Data object
51165
- * @returns {Function}
51704
+ * @returns {function} Label formatter function
51166
51705
  * @private
51167
51706
  */
51168
51707
  treemapDataLabelFormat(d) {
51169
51708
  const $$ = this;
51170
- const { config } = $$;
51709
+ const { $el: { treemap }, config, scale: { x, y } } = $$;
51171
51710
  const { id, value } = d;
51172
51711
  const format = config.treemap_label_format;
51173
51712
  const ratio = $$.getRatio("treemap", d);
51174
51713
  const percentValue = (ratio * 100).toFixed(2);
51175
51714
  const meetLabelThreshold = config.treemap_label_show && meetsLabelThreshold.call($$, ratio, "treemap") ? null : "0";
51715
+ const treemapNode = treemap.selectAll("g").filter((node) => node.data.id === id).datum();
51716
+ let width = 0;
51717
+ let height = 0;
51718
+ if (treemapNode) {
51719
+ const { x0, x1, y0, y1 } = treemapNode;
51720
+ width = x(x1) - x(x0);
51721
+ height = y(y1) - y(y0);
51722
+ }
51176
51723
  return function(node) {
51177
51724
  node.style("opacity", meetLabelThreshold);
51178
- return isFunction(format) ? format.bind($$.api)(value, ratio, id) : `${id}
51725
+ return isFunction(format) ? format.bind($$.api)(value, ratio, id, { width, height }) : `${id}
51179
51726
  ${percentValue}%`;
51180
51727
  };
51181
51728
  }
@@ -51190,7 +51737,7 @@ ${percentValue}%`;
51190
51737
  * @type {object}
51191
51738
  * @property {object} point Point object
51192
51739
  * @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.
51740
+ * @property {number|function} [point.r=2.5] The radius size of each point.
51194
51741
  * - **NOTE:** Disabled for 'bubble' type
51195
51742
  * @property {boolean|object} [point.radialGradient=false] Set the radial gradient on point.<br><br>
51196
51743
  * Or customize by giving below object value:
@@ -51207,7 +51754,7 @@ ${percentValue}%`;
51207
51754
  * - **NOTE:**
51208
51755
  * - `null` will make to not set inline 'opacity' css prop.
51209
51756
  * - 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.
51757
+ * @property {number|string|function} [point.sensitivity=10] The sensitivity value for interaction boundary.
51211
51758
  * - **Available Values:**
51212
51759
  * - {number}: Absolute sensitivity value which is the distance from the data point in pixel.
51213
51760
  * - "radius": sensitivity based on point's radius
@@ -51234,6 +51781,7 @@ ${percentValue}%`;
51234
51781
  * - This is an `experimental` feature and can have some unexpected behaviors.
51235
51782
  * - If chart has 'bubble' type, only circle can be used.
51236
51783
  * - For IE, non circle point expansions are not supported due to lack of transform support.
51784
+ * - While basic XSS sanitization is applied, if you're allowing user-provided chart options in a service exposed to other users, you should implement additional security measures to prevent sophisticated XSS attacks.
51237
51785
  * - **Available Values:**
51238
51786
  * - circle
51239
51787
  * - rectangle
@@ -51254,7 +51802,7 @@ ${percentValue}%`;
51254
51802
  * return r;
51255
51803
  * },
51256
51804
  *
51257
- * // will generate follwing radialGradient:
51805
+ * // will generate following radialGradient:
51258
51806
  * // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/radialGradient
51259
51807
  * // <radualGradient cx="0.3" cy="0.3" r="0.7">
51260
51808
  * // <stop offset="0.1" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
@@ -51370,7 +51918,7 @@ ${percentValue}%`;
51370
51918
  * // <g class='bb-areas'> will be positioned behind the line <g class='bb-lines'> in stacking order
51371
51919
  * front: false,
51372
51920
  *
51373
- * // will generate follwing linearGradient:
51921
+ * // will generate following linearGradient:
51374
51922
  * // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient
51375
51923
  * // <linearGradient x1="0" x2="0" y1="0" y2="1">
51376
51924
  * // <stop offset="0" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
@@ -51424,8 +51972,8 @@ ${percentValue}%`;
51424
51972
  * @property {number} [bar.padding=0] The padding pixel value between each bar.
51425
51973
  * @property {number} [bar.radius] Set the radius of bar edge in pixel.
51426
51974
  * @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.
51975
+ * @property {number} [bar.sensitivity=2] The sensitivity offset value for interaction boundary.
51976
+ * @property {number|function|object} [bar.width] Change the width of bar chart.
51429
51977
  * @property {number} [bar.width.ratio=0.6] Change the width of bar chart by ratio.
51430
51978
  * - **NOTE:** Criteria for ratio.
51431
51979
  * - When x ticks count is same with the data count, the baseline for ratio is the minimum interval value of x ticks.
@@ -51452,12 +52000,12 @@ ${percentValue}%`;
51452
52000
  * // make bar shape to be positioned over the other shape elements
51453
52001
  * front: true,
51454
52002
  *
51455
- * // remove nullish data on bar indices postions
52003
+ * // remove nullish data on bar indices positions
51456
52004
  * indices: {
51457
52005
  * removeNull: true
51458
52006
  * },
51459
52007
  *
51460
- * // will generate follwing linearGradient:
52008
+ * // will generate following linearGradient:
51461
52009
  * // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient
51462
52010
  * // <linearGradient x1="0" x2="0" y1="0" y2="1">
51463
52011
  * // <stop offset="0" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
@@ -51555,12 +52103,12 @@ ${percentValue}%`;
51555
52103
  * @memberof Options
51556
52104
  * @type {object}
51557
52105
  * @property {object} bubble bubble object
51558
- * @property {number|Function} [bubble.maxR=35] Set the max bubble radius value
52106
+ * @property {number|function} [bubble.maxR=35] Set the max bubble radius value
51559
52107
  * @property {boolean} [bubble.zerobased=false] Set if min or max value will be 0 on bubble chart.
51560
52108
  * @example
51561
52109
  * bubble: {
51562
52110
  * // 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.
52111
+ * // And the lesser will have radius relatively from the max value.
51564
52112
  * maxR: 50,
51565
52113
  *
51566
52114
  * // or set radius callback
@@ -51614,7 +52162,7 @@ ${percentValue}%`;
51614
52162
  * }
51615
52163
  * },
51616
52164
  * color: {
51617
- * // spcify bearish color
52165
+ * // specify bearish color
51618
52166
  * down: "red",
51619
52167
  *
51620
52168
  * // or specify color per dataset
@@ -51667,7 +52215,7 @@ ${percentValue}%`;
51667
52215
  * // hide all data points ('point.show=false' also has similar effect)
51668
52216
  * point: false,
51669
52217
  *
51670
- * // show data points for only indicated datas
52218
+ * // show data points for only indicated data
51671
52219
  * point: [
51672
52220
  * "data1", "data3"
51673
52221
  * ],
@@ -51702,7 +52250,7 @@ ${percentValue}%`;
51702
52250
  * // hide all data points ('point.show=false' also has similar effect)
51703
52251
  * point: false,
51704
52252
  *
51705
- * // show data points for only indicated datas
52253
+ * // show data points for only indicated data
51706
52254
  * point: [
51707
52255
  * "data1", "data3"
51708
52256
  * ],
@@ -51761,14 +52309,14 @@ ${percentValue}%`;
51761
52309
  * @memberof Options
51762
52310
  * @type {object}
51763
52311
  * @property {object} arc Arc object
51764
- * @property {number|Function} [arc.cornerRadius=0] Set corner radius of Arc(donut/gauge/pie/polar) shape.
52312
+ * @property {number|function} [arc.cornerRadius=0] Set corner radius of Arc(donut/gauge/pie/polar) shape.
51765
52313
  * - **NOTE:**
51766
52314
  * - Corner radius can't surpass the `(outerRadius - innerRadius) /2` of indicated shape.
51767
52315
  * @property {number} [arc.cornerRadius.ratio=0] Set ratio relative of outer radius.
51768
52316
  * @property {object} [arc.needle] Set needle options.
51769
52317
  * @property {boolean} [arc.needle.show=false] Show or hide needle.
51770
52318
  * @property {string} [arc.needle.color] Set needle filled color.
51771
- * @property {Function} [arc.needle.path] Set custom needle path function.
52319
+ * @property {function} [arc.needle.path] Set custom needle path function.
51772
52320
  * - **NOTE:**
51773
52321
  * - The path should be starting from 0,0 (which is center) to top center coordinate.
51774
52322
  * - The function will receive, `length`{number} parameter which indicating the needle length in pixel relative to radius.
@@ -51792,8 +52340,8 @@ ${percentValue}%`;
51792
52340
  * @property {string} [arc.rangeText.unit="absolute"] Specify the range text unit.
51793
52341
  * - "absolute": Show absolute value
51794
52342
  * - "%": 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.
52343
+ * @property {boolean} [arc.rangeText.fixed=false] Set if range text shown will be fixed w/o data toggle update. Only available for gauge chart.
52344
+ * @property {function} [arc.rangeText.format] Set format function for the range text.
51797
52345
  * @property {number} [arc.rangeText.position] Set position function or object for the range text.
51798
52346
  * @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutCornerRadius)
51799
52347
  * @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#PieChartOptions.CornerRadius)
@@ -51906,10 +52454,21 @@ ${percentValue}%`;
51906
52454
  * @type {object}
51907
52455
  * @property {object} donut Donut object
51908
52456
  * @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.
52457
+ * @property {function} [donut.label.format] Set formatter for the label on each donut piece.
51910
52458
  * @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>
52459
+ * @property {number|function} [donut.label.ratio=undefined] Set ratio of labels position.
52460
+ * @property {boolean|object} [donut.label.line=false] Enable label with lines (displayed outside with connector lines).
52461
+ * - `true`: Enable label with lines with default settings
52462
+ * - `false`: Labels are displayed inside the donut slices (default behavior).
52463
+ * - `{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.
52464
+ * @property {boolean} [donut.label.line.show=true] Show or hide connector lines.
52465
+ * @property {number} [donut.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
52466
+ * @property {boolean|function} [donut.label.line.text=true] Show text at the end of the connector line (outside the shape).
52467
+ * - `true`: show data "id" text
52468
+ * - `false`: use default formatter(label.format) to show text
52469
+ * - `function(value, ratio, id)`: Custom formatter function for the text.
52470
+ * - **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.
52471
+ * @property {object|function} [donut.label.image] Set image to be displayed next to the label text.<br><br>
51913
52472
  * 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
52473
  * The arguments are:<br>
51915
52474
  * - `v` is the value of the data point where the label is shown.
@@ -51934,6 +52493,7 @@ ${percentValue}%`;
51934
52493
  * @see [Demo: Needle](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutNeedle)
51935
52494
  * @see [Demo: Range Text](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutRangeText)
51936
52495
  * @see [Demo: Label Image](https://naver.github.io/billboard.js/demo/#DonutChartOptions.LabelImage)
52496
+ * @see [Demo: Label Line](https://naver.github.io/billboard.js/demo/#DonutChartOptions.LabelLine)
51937
52497
  * @see [Demo: Label Ratio](https://naver.github.io/billboard.js/demo/#DonutChartOptions.LabelRatio)
51938
52498
  * @see [Demo: Multiline Label](https://naver.github.io/billboard.js/demo/#DonutChartOptions.MultilineLabel)
51939
52499
  * @see [Demo: Multiline Title](https://naver.github.io/billboard.js/demo/#DonutChartOptions.MultilineTitle)
@@ -51963,6 +52523,20 @@ ${percentValue}%`;
51963
52523
  * // or set ratio number
51964
52524
  * ratio: 0.5,
51965
52525
  *
52526
+ * // Enable label with lines (displayed outside with connector lines)
52527
+ * line: false, // default - labels inside
52528
+ * line: true, // enable label with lines with default settings
52529
+ * line: { // enable label with lines with custom settings
52530
+ * show: true,
52531
+ * distance: 20, // horizontal line distance in pixels
52532
+ *
52533
+ * // show text at the end of connector line (outside the shape)
52534
+ * text: true, // use default formatter
52535
+ * text: function(value, ratio, id) { // custom formatter
52536
+ * return d3.format(".1%")(ratio);
52537
+ * }
52538
+ * },
52539
+ *
51966
52540
  * // set image to be displayed next to the label text
51967
52541
  * image: {
51968
52542
  * url: "./sample.svg",
@@ -52034,6 +52608,7 @@ ${percentValue}%`;
52034
52608
  donut_label_show: true,
52035
52609
  donut_label_format: void 0,
52036
52610
  donut_label_threshold: 0.05,
52611
+ donut_label_line: false,
52037
52612
  donut_label_image: void 0,
52038
52613
  donut_label_ratio: void 0,
52039
52614
  donut_width: void 0,
@@ -52089,15 +52664,27 @@ ${percentValue}%`;
52089
52664
  * @property {boolean} [gauge.background=""] Set background color. (The `.bb-chart-arcs-background` element)
52090
52665
  * @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
52666
  * @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>
52667
+ * @property {function} [gauge.label.extents] Set customized min/max label text.
52668
+ * @property {function} [gauge.label.format] Set formatter for the label on gauge. Label text can be multilined with `\n` character.<br>
52094
52669
  * Will pass following arguments to the given function:
52095
52670
  * - value {number}: absolute value
52096
52671
  * - ratio {number}: value's ratio
52097
52672
  * - id {string}: data's id value
52098
- * @property {number|Function} [gauge.label.ratio=undefined] Set ratio of labels position.
52673
+ * @property {number|function} [gauge.label.ratio=undefined] Set ratio of labels position.
52099
52674
  * @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>
52675
+ * @property {boolean|object} [gauge.label.line=false] Enable label with lines (displayed outside with connector lines).
52676
+ * - **NOTE:** Only applicable for single gauge (not for `gauge.type="multi"`).
52677
+ * - `true`: Enable label with lines with default settings
52678
+ * - `false`: Labels are displayed inside the gauge (default behavior).
52679
+ * - `{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.
52680
+ * @property {boolean} [gauge.label.line.show=true] Show or hide connector lines.
52681
+ * @property {number} [gauge.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
52682
+ * @property {boolean|function} [gauge.label.line.text=true] Show text at the end of the connector line (outside the shape).
52683
+ * - `true`: show data "id" text
52684
+ * - `false`: use default formatter(label.format) to show text
52685
+ * - `function(value, ratio, id)`: Custom formatter function for the text.
52686
+ * - **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.
52687
+ * @property {object|function} [gauge.label.image] Set image to be displayed next to the label text.<br><br>
52101
52688
  * 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
52689
  * The arguments are:<br>
52103
52690
  * - `v` is the value of the data point where the label is shown.
@@ -52150,6 +52737,7 @@ ${percentValue}%`;
52150
52737
  * @see [Demo: archLength](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeArcLength)
52151
52738
  * @see [Demo: startingAngle](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeStartingAngle)
52152
52739
  * @see [Demo: label image](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeLabelImage)
52740
+ * @see [Demo: label line](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeLabelLine)
52153
52741
  * @see [Demo: label ratio](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeLabelRatio)
52154
52742
  * @example
52155
52743
  * gauge: {
@@ -52172,6 +52760,20 @@ ${percentValue}%`;
52172
52760
  * // if data value is below than 0.1, text label will be hidden.
52173
52761
  * threshold: 0.1,
52174
52762
  *
52763
+ * // Enable label with lines (displayed outside with connector lines)
52764
+ * // NOTE: Only works with single gauge (not gauge.type="multi")
52765
+ * line: true, // enable label with lines with default settings
52766
+ * line: { // enable label with lines with custom settings
52767
+ * show: true, // enable lines (default: true when line is enabled)
52768
+ * distance: 30, // distance of horizontal line in pixels (default: 20)
52769
+ *
52770
+ * // show text at the end of connector line (outside the shape)
52771
+ * text: true, // use default formatter
52772
+ * text: function(value, ratio, id) { // custom formatter
52773
+ * return d3.format(".1%")(ratio);
52774
+ * }
52775
+ * },
52776
+ *
52175
52777
  * // set ratio callback. Should return ratio value
52176
52778
  * ratio: function(d, radius, h) {
52177
52779
  * ...
@@ -52265,6 +52867,7 @@ ${percentValue}%`;
52265
52867
  gauge_label_format: void 0,
52266
52868
  gauge_label_ratio: void 0,
52267
52869
  gauge_label_threshold: 0,
52870
+ gauge_label_line: false,
52268
52871
  gauge_label_image: void 0,
52269
52872
  gauge_enforceMinMax: false,
52270
52873
  gauge_min: 0,
@@ -52290,10 +52893,21 @@ ${percentValue}%`;
52290
52893
  * @type {object}
52291
52894
  * @property {object} pie Pie object
52292
52895
  * @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.
52896
+ * @property {function} [pie.label.format] Set formatter for the label on each pie piece.
52897
+ * @property {number|function} [pie.label.ratio=undefined] Set ratio of labels position.
52295
52898
  * @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>
52899
+ * @property {boolean|object} [pie.label.line=false] Enable label with lines (displayed outside with connector lines).
52900
+ * - `true`: Enable label with lines with default settings
52901
+ * - `false`: Labels are displayed inside the pie slices (default behavior).
52902
+ * - `{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.
52903
+ * @property {boolean} [pie.label.line.show=true] Show or hide connector lines.
52904
+ * @property {number} [pie.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
52905
+ * @property {boolean|function} [pie.label.line.text=true] Show text at the end of the connector line (outside the shape).
52906
+ * - `true`: show data "id" text
52907
+ * - `false`: use default formatter(label.format) to show text
52908
+ * - `function(value, ratio, id)`: Custom formatter function for the text.
52909
+ * - **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.
52910
+ * @property {object|function} [pie.label.image] Set image to be displayed next to the label text.<br><br>
52297
52911
  * 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
52912
  * The arguments are:<br>
52299
52913
  * - `v` is the value of the data point where the label is shown.
@@ -52318,6 +52932,7 @@ ${percentValue}%`;
52318
52932
  * @see [Demo: outerRadius](https://naver.github.io/billboard.js/demo/#PieChartOptions.OuterRadius)
52319
52933
  * @see [Demo: startingAngle](https://naver.github.io/billboard.js/demo/#PieChartOptions.StartingAngle)
52320
52934
  * @see [Demo: label image](https://naver.github.io/billboard.js/demo/#PieChartOptions.LabelImage)
52935
+ * @see [Demo: label line](https://naver.github.io/billboard.js/demo/#PieChartOptions.LabelLine)
52321
52936
  * @example
52322
52937
  * pie: {
52323
52938
  * label: {
@@ -52341,6 +52956,20 @@ ${percentValue}%`;
52341
52956
  * // or set ratio number
52342
52957
  * ratio: 0.5,
52343
52958
  *
52959
+ * // Enable label with lines (displayed outside with connector lines)
52960
+ * line: false, // default - labels inside
52961
+ * line: true, // enable label with lines with default settings
52962
+ * line: { // enable label with lines with custom settings
52963
+ * show: true,
52964
+ * distance: 20, // horizontal line distance in pixels
52965
+ *
52966
+ * // show text at the end of connector line (outside the shape)
52967
+ * text: true, // use default formatter
52968
+ * text: function(value, ratio, id) { // custom formatter
52969
+ * return d3.format(".1%")(ratio);
52970
+ * }
52971
+ * },
52972
+ *
52344
52973
  * // set image to be displayed next to the label text
52345
52974
  * image: {
52346
52975
  * url: "./sample.svg",
@@ -52422,6 +53051,7 @@ ${percentValue}%`;
52422
53051
  pie_label_format: void 0,
52423
53052
  pie_label_ratio: void 0,
52424
53053
  pie_label_threshold: 0.05,
53054
+ pie_label_line: false,
52425
53055
  pie_label_image: void 0,
52426
53056
  pie_expand: {},
52427
53057
  pie_expand_rate: 0.98,
@@ -52442,10 +53072,21 @@ ${percentValue}%`;
52442
53072
  * @type {object}
52443
53073
  * @property {object} polar Polar object
52444
53074
  * @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.
53075
+ * @property {function} [polar.label.format] Set formatter for the label on each polar piece.
52446
53076
  * @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>
53077
+ * @property {number|function} [polar.label.ratio=undefined] Set ratio of labels position.
53078
+ * @property {boolean|object} [polar.label.line=false] Enable label with lines (displayed outside with connector lines).
53079
+ * - `true`: Enable label with lines with default settings
53080
+ * - `false`: Labels are displayed inside the polar slices (default behavior).
53081
+ * - `{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.
53082
+ * @property {boolean} [polar.label.line.show=true] Show or hide connector lines.
53083
+ * @property {number} [polar.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
53084
+ * @property {boolean|function} [polar.label.line.text=true] Show text at the end of the connector line (outside the shape).
53085
+ * - `true`: show data "id" text
53086
+ * - `false`: use default formatter(label.format) to show text
53087
+ * - `function(value, ratio, id)`: Custom formatter function for the text.
53088
+ * - **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.
53089
+ * @property {object|function} [polar.label.image] Set image to be displayed next to the label text.<br><br>
52449
53090
  * 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
53091
  * The arguments are:<br>
52451
53092
  * - `v` is the value of the data point where the label is shown.
@@ -52460,13 +53101,14 @@ ${percentValue}%`;
52460
53101
  * @property {number} [polar.level.depth=3] Set the level depth.
52461
53102
  * @property {boolean} [polar.level.show=true] Show or hide level.
52462
53103
  * @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)`
53104
+ * @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
53105
  * @property {boolean} [polar.level.text.show=true] Show or hide level text.
52465
53106
  * @property {number} [polar.padAngle=0] Set padding between data.
52466
53107
  * @property {number} [polar.padding=0] Sets the gap between pie arcs.
52467
53108
  * @property {number} [polar.startingAngle=0] Set starting angle where data draws.
52468
53109
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.PolarChart)
52469
53110
  * @see [Demo: label image](https://naver.github.io/billboard.js/demo/#PolarChartOptions.LabelImage)
53111
+ * @see [Demo: label line](https://naver.github.io/billboard.js/demo/#PolarChartOptions.LabelLine)
52470
53112
  * @example
52471
53113
  * polar: {
52472
53114
  * label: {
@@ -52490,6 +53132,20 @@ ${percentValue}%`;
52490
53132
  * // or set ratio number
52491
53133
  * ratio: 0.5,
52492
53134
  *
53135
+ * // Enable label with lines (displayed outside with connector lines)
53136
+ * line: false, // default - labels inside
53137
+ * line: true, // enable label with lines with default settings
53138
+ * line: { // enable label with lines with custom settings
53139
+ * show: true,
53140
+ * distance: 20, // horizontal line distance in pixels
53141
+ *
53142
+ * // show text at the end of connector line (outside the shape)
53143
+ * text: true, // use default formatter
53144
+ * text: function(value, ratio, id) { // custom formatter
53145
+ * return d3.format(".1%")(ratio);
53146
+ * }
53147
+ * },
53148
+ *
52493
53149
  * // set image to be displayed next to the label text
52494
53150
  * image: {
52495
53151
  * url: "./sample.svg",
@@ -52554,6 +53210,7 @@ ${percentValue}%`;
52554
53210
  polar_label_show: true,
52555
53211
  polar_label_format: void 0,
52556
53212
  polar_label_threshold: 0.05,
53213
+ polar_label_line: false,
52557
53214
  polar_label_image: void 0,
52558
53215
  polar_label_ratio: void 0,
52559
53216
  polar_level_depth: 3,
@@ -52585,7 +53242,7 @@ ${percentValue}%`;
52585
53242
  * @property {boolean} [radar.direction.clockwise=false] Set the direction to be drawn.
52586
53243
  * @property {number} [radar.level.depth=3] Set the level depth.
52587
53244
  * @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)`
53245
+ * @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
53246
  * @property {boolean} [radar.level.text.show=true] Show or hide level text.
52590
53247
  * @property {number} [radar.size.ratio=0.87] Set size ratio.
52591
53248
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.RadarChart)
@@ -52653,7 +53310,12 @@ ${percentValue}%`;
52653
53310
  * - sliceDice ([d3.treemapSliceDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSliceDice))
52654
53311
  * - squrify ([d3.treemapSquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSquarify))
52655
53312
  * - 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.
53313
+ * @property {function} [treemap.label.format] Set formatter for the label text.<br>
53314
+ * - **Arguments:**
53315
+ * - `value {number}`: Data value
53316
+ * - `ratio {number}`: The `ratio` of how much space this tile occupies relative to the total area (0~1)
53317
+ * - `id {string}`: Data id
53318
+ * - `size {object}`: Tile size `{width, height}` in pixels
52657
53319
  * @property {number} [treemap.label.threshold=0.05] Set threshold ratio to show/hide labels text.
52658
53320
  * @property {number} [treemap.label.show=true] Show or hide label text.
52659
53321
  * @see [Demo: treemap](https://naver.github.io/billboard.js/demo/#Chart.TreemapChart)
@@ -52666,12 +53328,33 @@ ${percentValue}%`;
52666
53328
  * // show or hide label text
52667
53329
  * show: false,
52668
53330
  *
52669
- * // set label text formatter
52670
- * format: function(value, ratio, id) {
53331
+ * // Example 1: Format with currency
53332
+ * format: function(value, ratio, id, size) {
53333
+ * // size: {width, height} - tile size in pixels
52671
53334
  * return d3.format("$")(value);
53335
+ * },
52672
53336
  *
52673
- * // to multiline, return with '\n' character
52674
- * // return value +"%\nLine1\n2Line2";
53337
+ * // Example 2: Show different content based on tile size
53338
+ * format: function(value, ratio, id, size) {
53339
+ * if (size.width > 100 && size.height > 50) {
53340
+ * return `${id}\n${d3.format("$")(value)}\n(${(ratio * 100).toFixed(1)}%)`;
53341
+ * } else if (size.width > 50) {
53342
+ * return `${id}\n${d3.format("$")(value)}`;
53343
+ * } else {
53344
+ * return d3.format("$")(value);
53345
+ * }
53346
+ * },
53347
+ *
53348
+ * // Example 3: Include tile dimensions in label
53349
+ * format: function(value, ratio, id, size) {
53350
+ * return `${id}\n${value}\n${size.width.toFixed(0)}x${size.height.toFixed(0)}px`;
53351
+ * },
53352
+ *
53353
+ * // Example 4: Conditional formatting based on ratio
53354
+ * format: function(value, ratio, id, size) {
53355
+ * return ratio > 0.1 ?
53356
+ * `${id}\n${value} (${(ratio * 100).toFixed(1)}%)` :
53357
+ * value;
52675
53358
  * },
52676
53359
  *
52677
53360
  * // set ratio number
@@ -52780,10 +53463,10 @@ const bb = {
52780
53463
  * bb.version; // "1.0.0"
52781
53464
  * @memberof bb
52782
53465
  */
52783
- version: "3.17.4",
53466
+ version: "3.18.0-next.2",
52784
53467
  /**
52785
53468
  * Generate chart
52786
- * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
53469
+ * - **NOTE:** Bear in mind for the possibility of ***throwing an error***, during the generation when:
52787
53470
  * - Unused option value is given.
52788
53471
  * - ex) For `data.type="pie"` option, setting 'axis' option can cause unexpected generation error.
52789
53472
  * - Insufficient value is given for certain option used.