billboard.js 3.17.3 → 3.18.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +12 -12
- package/README.md +12 -12
- package/dist/billboard.css +15 -1
- package/dist/billboard.js +769 -310
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +10 -10
- package/dist/billboard.pkgd.js +777 -318
- package/dist/billboard.pkgd.min.js +21 -21
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +16 -7
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +18 -9
- package/dist/plugin/billboardjs-plugin-stanford.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-tableview.js +16 -8
- package/dist/plugin/billboardjs-plugin-tableview.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-textoverlap.js +15 -7
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +16 -7
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +26 -17
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +16 -8
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +15 -7
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +3 -3
- package/dist/theme/dark.css +15 -1
- package/dist/theme/dark.min.css +2 -2
- package/dist/theme/datalab.css +15 -1
- package/dist/theme/datalab.min.css +2 -2
- package/dist/theme/graph.css +15 -1
- package/dist/theme/graph.min.css +2 -2
- package/dist/theme/insight.css +15 -1
- package/dist/theme/insight.min.css +2 -2
- package/dist/theme/modern.css +15 -1
- package/dist/theme/modern.min.css +2 -2
- package/dist-esm/billboard.js +957 -357
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +5 -4
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +22 -12
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +35 -34
- package/src/Chart/Chart.ts +1 -1
- package/src/Chart/api/chart.ts +5 -5
- package/src/Chart/api/data.ts +2 -1
- package/src/Chart/api/export.ts +1 -1
- package/src/Chart/api/flow.ts +1 -1
- package/src/Chart/api/load.ts +3 -3
- package/src/Chart/api/subchart.ts +3 -3
- package/src/Chart/api/tooltip.ts +1 -1
- package/src/Chart/api/zoom.ts +1 -1
- package/src/ChartInternal/Axis/Axis.ts +1 -1
- package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -1
- package/src/ChartInternal/ChartInternal.ts +3 -2
- package/src/ChartInternal/data/IData.ts +3 -0
- package/src/ChartInternal/data/convert.helper.ts +1 -1
- package/src/ChartInternal/data/convert.ts +1 -1
- package/src/ChartInternal/data/data.ts +97 -14
- package/src/ChartInternal/data/load.ts +8 -8
- package/src/ChartInternal/interactions/eventrect.ts +15 -5
- package/src/ChartInternal/interactions/flow.ts +1 -1
- package/src/ChartInternal/interactions/interaction.ts +1 -1
- package/src/ChartInternal/interactions/zoom.ts +1 -1
- package/src/ChartInternal/internals/color.ts +23 -6
- package/src/ChartInternal/internals/domain.ts +13 -1
- package/src/ChartInternal/internals/format.ts +1 -1
- package/src/ChartInternal/internals/grid.ts +1 -1
- package/src/ChartInternal/internals/legend.ts +2 -2
- package/src/ChartInternal/internals/scale.ts +6 -6
- package/src/ChartInternal/internals/selection.ts +1 -1
- package/src/ChartInternal/internals/style.ts +3 -3
- package/src/ChartInternal/internals/text.arc.ts +304 -0
- package/src/ChartInternal/internals/text.ts +8 -7
- package/src/ChartInternal/internals/tooltip.ts +23 -15
- package/src/ChartInternal/shape/arc.ts +167 -64
- package/src/ChartInternal/shape/area.ts +2 -2
- package/src/ChartInternal/shape/bar.ts +2 -2
- package/src/ChartInternal/shape/candlestick.ts +3 -3
- package/src/ChartInternal/shape/funnel.ts +1 -1
- package/src/ChartInternal/shape/line.ts +4 -4
- package/src/ChartInternal/shape/point.common.ts +1 -1
- package/src/ChartInternal/shape/radar.ts +2 -2
- package/src/ChartInternal/shape/shape.ts +3 -3
- package/src/ChartInternal/shape/treemap.ts +19 -5
- package/src/Plugin/stanford/Options.ts +2 -2
- package/src/Plugin/tableview/Options.ts +1 -1
- package/src/config/Options/axis/axis.ts +7 -7
- package/src/config/Options/axis/x.ts +6 -6
- package/src/config/Options/axis/y.ts +4 -4
- package/src/config/Options/axis/y2.ts +16 -3
- package/src/config/Options/common/color.ts +2 -2
- package/src/config/Options/common/legend.ts +5 -5
- package/src/config/Options/common/main.ts +23 -23
- package/src/config/Options/common/point.ts +3 -3
- package/src/config/Options/common/tooltip.ts +13 -13
- package/src/config/Options/data/axis.ts +31 -6
- package/src/config/Options/data/data.ts +44 -44
- package/src/config/Options/data/selection.ts +4 -4
- package/src/config/Options/interaction/interaction.ts +2 -1
- package/src/config/Options/interaction/subchart.ts +2 -2
- package/src/config/Options/interaction/zoom.ts +4 -4
- package/src/config/Options/shape/arc.ts +4 -4
- package/src/config/Options/shape/area.ts +1 -1
- package/src/config/Options/shape/bar.ts +4 -4
- package/src/config/Options/shape/bubble.ts +2 -2
- package/src/config/Options/shape/candlestick.ts +1 -1
- package/src/config/Options/shape/donut.ts +34 -3
- package/src/config/Options/shape/gauge.ts +36 -4
- package/src/config/Options/shape/line.ts +1 -1
- package/src/config/Options/shape/pie.ts +34 -3
- package/src/config/Options/shape/polar.ts +35 -4
- package/src/config/Options/shape/radar.ts +1 -1
- package/src/config/Options/shape/scatter.ts +1 -1
- package/src/config/Options/shape/treemap.ts +31 -5
- package/src/config/classes.ts +1 -0
- package/src/core.ts +1 -1
- package/src/module/Cache.ts +3 -3
- package/src/module/generator.ts +1 -1
- package/src/module/util.ts +31 -20
- package/src/module/worker.ts +3 -3
- package/src/scss/billboard.scss +15 -0
- package/src/scss/theme/dark.scss +15 -0
- package/src/scss/theme/datalab.scss +15 -0
- package/src/scss/theme/graph.scss +15 -0
- package/src/scss/theme/insight.scss +15 -0
- package/src/scss/theme/modern.scss +15 -0
- package/types/axis.d.ts +3 -3
- package/types/chart.d.ts +4 -4
- package/types/options.d.ts +22 -9
- package/types/options.shape.d.ts +59 -2
package/dist/billboard.pkgd.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* billboard.js, JavaScript chart library
|
|
6
6
|
* https://naver.github.io/billboard.js/
|
|
7
7
|
*
|
|
8
|
-
* @version 3.
|
|
8
|
+
* @version 3.18.0-next.1
|
|
9
9
|
*
|
|
10
10
|
* All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
|
|
11
11
|
* - @types/d3-selection ^3.0.11
|
|
@@ -24328,6 +24328,7 @@ const $COMMON = {
|
|
|
24328
24328
|
const $ARC = {
|
|
24329
24329
|
arc: "bb-arc",
|
|
24330
24330
|
arcLabelLine: "bb-arc-label-line",
|
|
24331
|
+
arcLabelLineText: "bb-arc-label-line-text",
|
|
24331
24332
|
arcRange: "bb-arc-range",
|
|
24332
24333
|
arcs: "bb-arcs",
|
|
24333
24334
|
chartArc: "bb-chart-arc",
|
|
@@ -24521,9 +24522,9 @@ const $ZOOM = {
|
|
|
24521
24522
|
* @memberof Options
|
|
24522
24523
|
* @type {object}
|
|
24523
24524
|
* @property {object} color color object
|
|
24524
|
-
* @property {string|object|
|
|
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 {
|
|
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|
|
|
24612
|
+
* @property {string|function} [legend.contents.template="<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>"] Set item's template.<br>
|
|
24612
24613
|
* - If set `string` value, within template the 'color' and 'title' can be replaced using template-like syntax string:
|
|
24613
24614
|
* - {=COLOR}: data color value
|
|
24614
24615
|
* - {=TITLE}: data title value
|
|
@@ -24642,13 +24643,13 @@ const $ZOOM = {
|
|
|
24642
24643
|
* - To return initial state(which all dataseries are showing), double click current focused legend item again.
|
|
24643
24644
|
* - for single click case, `click + altKey(Win)/optionKey(Mac OS)` to have same effect.
|
|
24644
24645
|
* - In this case, default `click` interaction will be disabled.
|
|
24645
|
-
* @property {
|
|
24646
|
+
* @property {function} [legend.item.onclick=undefined] Set click event handler to the legend item.
|
|
24646
24647
|
* - **NOTE:**
|
|
24647
24648
|
* - When set, default `click` interaction will be disabled.
|
|
24648
24649
|
* - When `interaction.dblclick=true` is set, will be called on double click.
|
|
24649
|
-
* @property {
|
|
24650
|
+
* @property {function} [legend.item.onover=undefined] Set mouse/touch over event handler to the legend item.
|
|
24650
24651
|
* - **NOTE:** When set, default `mouseover` interaction will be disabled.
|
|
24651
|
-
* @property {
|
|
24652
|
+
* @property {function} [legend.item.onout=undefined] Set mouse/touch out event handler to the legend item.
|
|
24652
24653
|
* - **NOTE:** When set, default `mouseout` interaction will be disabled.
|
|
24653
24654
|
* @property {number} [legend.item.tile.width=10] Set width for 'rectangle' legend item tile element.
|
|
24654
24655
|
* @property {number} [legend.item.tile.height=10] Set height for 'rectangle' legend item tile element.
|
|
@@ -24725,7 +24726,7 @@ const $ZOOM = {
|
|
|
24725
24726
|
* width: 15,
|
|
24726
24727
|
* height: 15
|
|
24727
24728
|
*
|
|
24728
|
-
* //
|
|
24729
|
+
* // radius is only applicable for 'circle' legend type
|
|
24729
24730
|
* r: 10
|
|
24730
24731
|
* }
|
|
24731
24732
|
* },
|
|
@@ -24771,14 +24772,14 @@ const $ZOOM = {
|
|
|
24771
24772
|
/* harmony default export */ var main = ({
|
|
24772
24773
|
/**
|
|
24773
24774
|
* Specify the CSS selector or the element which the chart will be set to. D3 selection object can be specified also.<br>
|
|
24774
|
-
* If
|
|
24775
|
-
* - **NOTE:** In case
|
|
24775
|
+
* If another chart is already set, it will be replaced with the new one (only one chart can be set in one element).
|
|
24776
|
+
* - **NOTE:** In case the element doesn't exist or not specified, will add a `<div>` element to the body.
|
|
24776
24777
|
* @name bindto
|
|
24777
24778
|
* @memberof Options
|
|
24778
24779
|
* @property {string|HTMLElement|d3.selection|object} [bindto="#chart"] Specify the element where chart will be drawn.
|
|
24779
24780
|
* @property {string|HTMLElement|d3.selection} bindto.element="#chart" Specify the element where chart will be drawn.
|
|
24780
24781
|
* @property {string} [bindto.classname=bb] Specify the class name of bind element.<br>
|
|
24781
|
-
* **NOTE:** When class name isn't `bb`, then you also need to update the default CSS to be rendered correctly.
|
|
24782
|
+
* **NOTE:** When the class name isn't `bb`, then you also need to update the default CSS to be rendered correctly.
|
|
24782
24783
|
* @default #chart
|
|
24783
24784
|
* @example
|
|
24784
24785
|
* bindto: "#myContainer"
|
|
@@ -24819,8 +24820,8 @@ const $ZOOM = {
|
|
|
24819
24820
|
/**
|
|
24820
24821
|
* Set 'clip-path' attribute for chart element
|
|
24821
24822
|
* - **NOTE:**
|
|
24822
|
-
* > When
|
|
24823
|
-
* >
|
|
24823
|
+
* > When false, chart node element is positioned after the axis node in DOM tree hierarchy.
|
|
24824
|
+
* > This is to make the chart element positioned over axis element.
|
|
24824
24825
|
* @name clipPath
|
|
24825
24826
|
* @memberof Options
|
|
24826
24827
|
* @type {boolean}
|
|
@@ -24846,7 +24847,7 @@ const $ZOOM = {
|
|
|
24846
24847
|
svg_classname: void 0,
|
|
24847
24848
|
/**
|
|
24848
24849
|
* The desired size of the chart element.
|
|
24849
|
-
* If value is not specified, the width of the chart will be calculated by the size of the parent element it's appended to.
|
|
24850
|
+
* If the value is not specified, the width of the chart will be calculated by the size of the parent element it's appended to.
|
|
24850
24851
|
* @name size
|
|
24851
24852
|
* @memberof Options
|
|
24852
24853
|
* @type {object}
|
|
@@ -24864,13 +24865,13 @@ const $ZOOM = {
|
|
|
24864
24865
|
size_height: void 0,
|
|
24865
24866
|
/**
|
|
24866
24867
|
* The padding of the chart element.
|
|
24867
|
-
* - **NOTE:** for more information, see the "[`Understanding padding`](https://github.com/naver/billboard.js/wiki/Understanding-padding)"
|
|
24868
|
+
* - **NOTE:** for more information, see the "[`Understanding padding`](https://github.com/naver/billboard.js/wiki/Understanding-padding)" wiki documentation.
|
|
24868
24869
|
* @name padding
|
|
24869
24870
|
* @memberof Options
|
|
24870
24871
|
* @type {object}
|
|
24871
24872
|
* @property {object|boolean} [padding=true] Set padding of chart, and accepts object or boolean type.
|
|
24872
24873
|
* - `Object`: Specify each side's padding.
|
|
24873
|
-
* - `false`: Remove padding completely and make shape
|
|
24874
|
+
* - `false`: Remove padding completely and make the shape fully occupy the container element.
|
|
24874
24875
|
* - In this case, axes and subchart will be hidden.
|
|
24875
24876
|
* - To adjust some padding from this state, use `axis.[x|y].padding` option.
|
|
24876
24877
|
* @property {string} [padding.mode] padding mode
|
|
@@ -24957,7 +24958,7 @@ const $ZOOM = {
|
|
|
24957
24958
|
* Set a callback to execute when the chart is clicked.
|
|
24958
24959
|
* @name onclick
|
|
24959
24960
|
* @memberof Options
|
|
24960
|
-
* @type {
|
|
24961
|
+
* @type {function}
|
|
24961
24962
|
* @default undefined
|
|
24962
24963
|
* @example
|
|
24963
24964
|
* onclick: function(event) {
|
|
@@ -24971,7 +24972,7 @@ const $ZOOM = {
|
|
|
24971
24972
|
* Set a callback to execute when mouse/touch enters the chart.
|
|
24972
24973
|
* @name onover
|
|
24973
24974
|
* @memberof Options
|
|
24974
|
-
* @type {
|
|
24975
|
+
* @type {function}
|
|
24975
24976
|
* @default undefined
|
|
24976
24977
|
* @example
|
|
24977
24978
|
* onover: function(event) {
|
|
@@ -24985,7 +24986,7 @@ const $ZOOM = {
|
|
|
24985
24986
|
* Set a callback to execute when mouse/touch leaves the chart.
|
|
24986
24987
|
* @name onout
|
|
24987
24988
|
* @memberof Options
|
|
24988
|
-
* @type {
|
|
24989
|
+
* @type {function}
|
|
24989
24990
|
* @default undefined
|
|
24990
24991
|
* @example
|
|
24991
24992
|
* onout: function(event) {
|
|
@@ -24999,7 +25000,7 @@ const $ZOOM = {
|
|
|
24999
25000
|
* Set a callback to execute when user resizes the screen.
|
|
25000
25001
|
* @name onresize
|
|
25001
25002
|
* @memberof Options
|
|
25002
|
-
* @type {
|
|
25003
|
+
* @type {function}
|
|
25003
25004
|
* @default undefined
|
|
25004
25005
|
* @example
|
|
25005
25006
|
* onresize: function() {
|
|
@@ -25012,7 +25013,7 @@ const $ZOOM = {
|
|
|
25012
25013
|
* Set a callback to execute when screen resize finished.
|
|
25013
25014
|
* @name onresized
|
|
25014
25015
|
* @memberof Options
|
|
25015
|
-
* @type {
|
|
25016
|
+
* @type {function}
|
|
25016
25017
|
* @default undefined
|
|
25017
25018
|
* @example
|
|
25018
25019
|
* onresized: function() {
|
|
@@ -25025,7 +25026,7 @@ const $ZOOM = {
|
|
|
25025
25026
|
* Set a callback to execute before the chart is initialized
|
|
25026
25027
|
* @name onbeforeinit
|
|
25027
25028
|
* @memberof Options
|
|
25028
|
-
* @type {
|
|
25029
|
+
* @type {function}
|
|
25029
25030
|
* @default undefined
|
|
25030
25031
|
* @example
|
|
25031
25032
|
* onbeforeinit: function() {
|
|
@@ -25038,7 +25039,7 @@ const $ZOOM = {
|
|
|
25038
25039
|
* Set a callback to execute when the chart is initialized.
|
|
25039
25040
|
* @name oninit
|
|
25040
25041
|
* @memberof Options
|
|
25041
|
-
* @type {
|
|
25042
|
+
* @type {function}
|
|
25042
25043
|
* @default undefined
|
|
25043
25044
|
* @example
|
|
25044
25045
|
* oninit: function() {
|
|
@@ -25051,7 +25052,7 @@ const $ZOOM = {
|
|
|
25051
25052
|
* Set a callback to execute after the chart is initialized
|
|
25052
25053
|
* @name onafterinit
|
|
25053
25054
|
* @memberof Options
|
|
25054
|
-
* @type {
|
|
25055
|
+
* @type {function}
|
|
25055
25056
|
* @default undefined
|
|
25056
25057
|
* @example
|
|
25057
25058
|
* onafterinit: function() {
|
|
@@ -25061,10 +25062,10 @@ const $ZOOM = {
|
|
|
25061
25062
|
*/
|
|
25062
25063
|
onafterinit: void 0,
|
|
25063
25064
|
/**
|
|
25064
|
-
* Set a callback which is executed when the chart is rendered. Basically, this callback will be called in each time when the chart is
|
|
25065
|
+
* Set a callback which is executed when the chart is rendered. Basically, this callback will be called in each time when the chart is redrawn.
|
|
25065
25066
|
* @name onrendered
|
|
25066
25067
|
* @memberof Options
|
|
25067
|
-
* @type {
|
|
25068
|
+
* @type {function}
|
|
25068
25069
|
* @default undefined
|
|
25069
25070
|
* @example
|
|
25070
25071
|
* onrendered: function() {
|
|
@@ -25075,7 +25076,7 @@ const $ZOOM = {
|
|
|
25075
25076
|
onrendered: void 0,
|
|
25076
25077
|
/**
|
|
25077
25078
|
* Set duration of transition (in milliseconds) for chart animation.<br><br>
|
|
25078
|
-
* - **NOTE:** If `0
|
|
25079
|
+
* - **NOTE:** If `0` or `null` is set, transition will be skipped. So, this makes initial rendering faster especially in case you have a lot of data.
|
|
25079
25080
|
* @name transition
|
|
25080
25081
|
* @memberof Options
|
|
25081
25082
|
* @type {object}
|
|
@@ -25106,11 +25107,11 @@ const $ZOOM = {
|
|
|
25106
25107
|
* @memberof Options
|
|
25107
25108
|
* @type {object}
|
|
25108
25109
|
* @property {object} [render] render object
|
|
25109
|
-
* @property {boolean} [render.lazy=true] Make
|
|
25110
|
+
* @property {boolean} [render.lazy=true] Make it not render at initialization.
|
|
25110
25111
|
* - **NOTE**:
|
|
25111
25112
|
* - Enabled by default when bind element's visibility is hidden.
|
|
25112
25113
|
* - When set to `false`, will initialize the chart regardless the bind element's visibility state, but in this case chart can't be guaranteed to be rendered properly.
|
|
25113
|
-
* @property {boolean} [render.observe=true] Observe bind element's visibility(`display` or `
|
|
25114
|
+
* @property {boolean} [render.observe=true] Observe bind element's visibility(`display` or `visibility` inline css property or class value) & render when it is visible automatically (for IEs, only works IE11+). When set to **false**, call [`.flush()`](./Chart.html#flush) to render.
|
|
25114
25115
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.LazyRender)
|
|
25115
25116
|
* @example
|
|
25116
25117
|
* render: {
|
|
@@ -25132,7 +25133,7 @@ const $ZOOM = {
|
|
|
25132
25133
|
* document.getElementById('chart').style.display = 'block'; // (b)
|
|
25133
25134
|
*
|
|
25134
25135
|
* @example
|
|
25135
|
-
* // chart won't be rendered and not observing bind element's
|
|
25136
|
+
* // chart won't be rendered and not observing bind element's visibility changes
|
|
25136
25137
|
* var chart = bb.generate({
|
|
25137
25138
|
* render: {
|
|
25138
25139
|
* lazy: true,
|
|
@@ -25158,7 +25159,7 @@ const $ZOOM = {
|
|
|
25158
25159
|
* - `[start] {number|Date|string}`: Start position of the region. If not set, the start will be the edge of the chart.
|
|
25159
25160
|
* - `[end] {number|Date|string}`: End position of the region. If not set, the end will be the edge of the chart.
|
|
25160
25161
|
* - `[class] {string}`: Class value to apply to the region.
|
|
25161
|
-
* - `[label] {object}`
|
|
25162
|
+
* - `[label] {object}` Label text option.
|
|
25162
25163
|
* - `text {string}`: Text value.
|
|
25163
25164
|
* - `x {number}`: x Position.
|
|
25164
25165
|
* - `y {number}`: y Position.
|
|
@@ -25248,17 +25249,17 @@ const $ZOOM = {
|
|
|
25248
25249
|
* - **NOTE:** The overlapped data points will be displayed as grouped even if set false.
|
|
25249
25250
|
* @property {boolean} [tooltip.linked=false] Set if tooltips on all visible charts with like x points are shown together when one is shown.
|
|
25250
25251
|
* @property {string} [tooltip.linked.name=""] Groping name for linked tooltip.<br>If specified, linked tooltip will be groped interacting to be worked only with the same name.
|
|
25251
|
-
* @property {
|
|
25252
|
+
* @property {function} [tooltip.format.title] Set format for the title of tooltip.<br>
|
|
25252
25253
|
* Specified function receives x of the data point to show.
|
|
25253
|
-
* @property {
|
|
25254
|
+
* @property {function} [tooltip.format.name] Set format for the name of each data in tooltip.<br>
|
|
25254
25255
|
* Specified function receives name, ratio, id and index of the data point to show. ratio will be undefined if the chart is not donut/pie/gauge.
|
|
25255
|
-
* @property {
|
|
25256
|
+
* @property {function} [tooltip.format.value] Set format for the value of each data value in tooltip. If undefined returned, the row of that value will be skipped to be called.
|
|
25256
25257
|
* - Will pass following arguments to the given function:
|
|
25257
25258
|
* - `value {string}`: Value of the data point. If data row contains multiple or ranged(ex. candlestick, area range, etc.) value, formatter will be called as value length.
|
|
25258
25259
|
* - `ratio {number}`: Ratio of the data point in the `pie/donut/gauge` and `area/bar` when contains grouped data. Otherwise is `undefined`.
|
|
25259
25260
|
* - `id {string}`: id of the data point
|
|
25260
25261
|
* - `index {number}`: Index of the data point
|
|
25261
|
-
* @property {
|
|
25262
|
+
* @property {function} [tooltip.position] Set custom position function for the tooltip.<br>
|
|
25262
25263
|
* This option can be used to modify the tooltip position by returning object that has top and left.
|
|
25263
25264
|
* - Will pass following arguments to the given function:
|
|
25264
25265
|
* - `data {Array}`: Current selected data array object.
|
|
@@ -25266,7 +25267,7 @@ const $ZOOM = {
|
|
|
25266
25267
|
* - `height {number}`: Height of tooltip.
|
|
25267
25268
|
* - `element {SVGElement}`: Tooltip event bound element
|
|
25268
25269
|
* - `pos {object}`: Current position of the tooltip.
|
|
25269
|
-
* @property {
|
|
25270
|
+
* @property {function|object} [tooltip.contents] Set custom HTML for the tooltip.<br>
|
|
25270
25271
|
* If tooltip.grouped is true, data includes multiple data points.<br><br>
|
|
25271
25272
|
* Specified function receives `data` array and `defaultTitleFormat`, `defaultValueFormat` and `color` functions of the data point to show.
|
|
25272
25273
|
* - **Note:**
|
|
@@ -25295,11 +25296,11 @@ const $ZOOM = {
|
|
|
25295
25296
|
* @property {boolean} [tooltip.init.show=false] Show tooltip at the initialization.
|
|
25296
25297
|
* @property {number} [tooltip.init.x=0] Set x Axis index(or index for Arc(donut, gauge, pie) types) to be shown at the initialization.
|
|
25297
25298
|
* @property {object} [tooltip.init.position] Set the position of tooltip at the initialization.
|
|
25298
|
-
* @property {
|
|
25299
|
-
* @property {
|
|
25300
|
-
* @property {
|
|
25301
|
-
* @property {
|
|
25302
|
-
* @property {string|
|
|
25299
|
+
* @property {function} [tooltip.onshow] Set a callback that will be invoked before the tooltip is shown.
|
|
25300
|
+
* @property {function} [tooltip.onhide] Set a callback that will be invoked before the tooltip is hidden.
|
|
25301
|
+
* @property {function} [tooltip.onshown] Set a callback that will be invoked after the tooltip is shown
|
|
25302
|
+
* @property {function} [tooltip.onhidden] Set a callback that will be invoked after the tooltip is hidden.
|
|
25303
|
+
* @property {string|function|null} [tooltip.order=null] Set tooltip data display order.<br><br>
|
|
25303
25304
|
* **Available Values:**
|
|
25304
25305
|
* - `desc`: In descending data value order
|
|
25305
25306
|
* - `asc`: In ascending data value order
|
|
@@ -25338,7 +25339,7 @@ const $ZOOM = {
|
|
|
25338
25339
|
* // yAxis: Current y Axis position value or function(the value is given for axis based chart type only)
|
|
25339
25340
|
* // }
|
|
25340
25341
|
*
|
|
25341
|
-
* // yAxis will work differently per data
|
|
25342
|
+
* // yAxis will work differently per data lengths
|
|
25342
25343
|
* // - a) Single data: `yAxis` will return `number` value
|
|
25343
25344
|
* // - b) Multiple data: `yAxis` will return a function with property value
|
|
25344
25345
|
*
|
|
@@ -25349,8 +25350,8 @@ const $ZOOM = {
|
|
|
25349
25350
|
* // b) Multiple data:
|
|
25350
25351
|
* // Get y coordinate of value 500, where 'data1' scales(y or y2).
|
|
25351
25352
|
* // When 'data.axes' option is used, data can bound to different axes.
|
|
25352
|
-
* // - when "data.axes={data1: 'y'}",
|
|
25353
|
-
* // - when "data.axes={data1: 'y2'}",
|
|
25353
|
+
* // - when "data.axes={data1: 'y'}", will return y value from y axis scale.
|
|
25354
|
+
* // - when "data.axes={data1: 'y2'}", will return y value from y2 axis scale.
|
|
25354
25355
|
* pos.yAxis(500, "data1"); // will return y coordinate value of data1
|
|
25355
25356
|
*
|
|
25356
25357
|
* pos.yAxis(500); // get y coordinate with value of 500, using y axis scale
|
|
@@ -25486,7 +25487,7 @@ const $ZOOM = {
|
|
|
25486
25487
|
/* harmony default export */ var data_data = ({
|
|
25487
25488
|
/**
|
|
25488
25489
|
* Specify the key of x values in the data.<br><br>
|
|
25489
|
-
* We can show the data with non-index x values by this option. This option is required when the type of x axis is timeseries. If this option is set on category axis, the values of the data on the key will be used for category names.
|
|
25490
|
+
* We can show the data with non-index x values by this option. This option is required when the type of x axis is timeseries. If this option is set on a category axis, the values of the data on the key will be used for category names.
|
|
25490
25491
|
* @name data․x
|
|
25491
25492
|
* @memberof Options
|
|
25492
25493
|
* @type {string}
|
|
@@ -25501,7 +25502,7 @@ const $ZOOM = {
|
|
|
25501
25502
|
* Converts data id value
|
|
25502
25503
|
* @name data․idConverter
|
|
25503
25504
|
* @memberof Options
|
|
25504
|
-
* @type {
|
|
25505
|
+
* @type {function}
|
|
25505
25506
|
* @default function(id) { return id; }
|
|
25506
25507
|
* @example
|
|
25507
25508
|
* data: {
|
|
@@ -25670,8 +25671,8 @@ const $ZOOM = {
|
|
|
25670
25671
|
data_types: {},
|
|
25671
25672
|
/**
|
|
25672
25673
|
* This option changes the order of stacking data and pieces of pie/donut.
|
|
25673
|
-
* - If `null` specified, it will be the order the data loaded.
|
|
25674
|
-
* - If function specified, it will be used as [Array.sort compareFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters)<br><br>
|
|
25674
|
+
* - If `null` specified, it will be the order in which the data is loaded.
|
|
25675
|
+
* - If a function is specified, it will be used as [Array.sort compareFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters)<br><br>
|
|
25675
25676
|
*
|
|
25676
25677
|
* **Available Values:**
|
|
25677
25678
|
* - `desc`: In descending order
|
|
@@ -25679,10 +25680,10 @@ const $ZOOM = {
|
|
|
25679
25680
|
* - `null`: It keeps the data load order
|
|
25680
25681
|
* - `function(data1, data2) { ... }`: Array.sort compareFunction
|
|
25681
25682
|
*
|
|
25682
|
-
* **NOTE**: order function
|
|
25683
|
+
* **NOTE**: order function only works for Axis based types & Arc types, except `Radar` type.
|
|
25683
25684
|
* @name data․order
|
|
25684
25685
|
* @memberof Options
|
|
25685
|
-
* @type {string|
|
|
25686
|
+
* @type {string|function|null}
|
|
25686
25687
|
* @default desc
|
|
25687
25688
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataOrder)
|
|
25688
25689
|
* @example
|
|
@@ -25737,7 +25738,7 @@ const $ZOOM = {
|
|
|
25737
25738
|
/**
|
|
25738
25739
|
* Set how zero value will be treated on groups.<br>
|
|
25739
25740
|
* Possible values:
|
|
25740
|
-
* - `zero`: 0 will be positioned at absolute axis zero point.
|
|
25741
|
+
* - `zero`: 0 will be positioned at the absolute axis zero point.
|
|
25741
25742
|
* - `positive`: 0 will be positioned at the top of a stack.
|
|
25742
25743
|
* - `negative`: 0 will be positioned at the bottom of a stack.
|
|
25743
25744
|
* @name data․groupsZeroAs
|
|
@@ -25753,10 +25754,10 @@ const $ZOOM = {
|
|
|
25753
25754
|
data_groupsZeroAs: "positive",
|
|
25754
25755
|
/**
|
|
25755
25756
|
* Set color converter function.<br><br>
|
|
25756
|
-
* This option should a function and the specified function receives color (e.g. '#ff0000') and d that has data parameters like id, value, index, etc. And it must return a string that represents color (e.g. '#00ff00').
|
|
25757
|
+
* This option should be a function and the specified function receives color (e.g. '#ff0000') and d that has data parameters like id, value, index, etc. And it must return a string that represents color (e.g. '#00ff00').
|
|
25757
25758
|
* @name data․color
|
|
25758
25759
|
* @memberof Options
|
|
25759
|
-
* @type {
|
|
25760
|
+
* @type {function}
|
|
25760
25761
|
* @default undefined
|
|
25761
25762
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataColor)
|
|
25762
25763
|
* @example
|
|
@@ -25789,41 +25790,41 @@ const $ZOOM = {
|
|
|
25789
25790
|
* @memberof Options
|
|
25790
25791
|
* @type {object}
|
|
25791
25792
|
* @property {object} data Data object
|
|
25792
|
-
* @property {boolean} [data.labels=false] Show or hide labels on each data
|
|
25793
|
+
* @property {boolean} [data.labels=false] Show or hide labels on each data point
|
|
25793
25794
|
* @property {boolean} [data.labels.centered=false] Centerize labels on `bar` shape. (**NOTE:** works only for 'bar' type)
|
|
25794
|
-
* @property {
|
|
25795
|
+
* @property {function} [data.labels.format] Set formatter function for data labels.<br>
|
|
25795
25796
|
* The formatter function receives 4 arguments such as `v, id, i, texts` and it **must return a string** (`\n` character will be used as line break) that will be shown as the label.<br><br>
|
|
25796
25797
|
* The arguments are:<br>
|
|
25797
25798
|
* - `v` is the value of the data point where the label is shown.
|
|
25798
25799
|
* - `id` is the id of the data where the label is shown.
|
|
25799
25800
|
* - `i` is the index of the data series point where the label is shown.
|
|
25800
|
-
* - `texts` is
|
|
25801
|
+
* - `texts` is an array of whole corresponding data series' text labels.<br><br>
|
|
25801
25802
|
* Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (ex. d3.format('$'))
|
|
25802
|
-
* @property {string|object|
|
|
25803
|
-
* - **NOTE**: When function is set, background colors can be specified one color per dataset.
|
|
25803
|
+
* @property {string|object|function} [data.labels.backgroundColors] Set label text background colors.<br><br>
|
|
25804
|
+
* - **NOTE**: When a function is set, background colors can be specified one color per dataset.
|
|
25804
25805
|
* - Within the function, the last returned color for dataset will be used.
|
|
25805
25806
|
* - Only can control set or unset background color for each values.
|
|
25806
|
-
* @property {string|object|
|
|
25807
|
-
* @property {object|
|
|
25808
|
-
* When function is specified, will
|
|
25807
|
+
* @property {string|object|function} [data.labels.colors] Set label text colors.
|
|
25808
|
+
* @property {object|function} [data.labels.position] Set each dataset position, relative to the original.<br><br>
|
|
25809
|
+
* When a function is specified, it will receive 5 arguments such as `type, v, id, i, texts` and it must return a position number.<br><br>
|
|
25809
25810
|
* The arguments are:<br>
|
|
25810
25811
|
* - `type` coordinate type string, which will be 'x' or 'y'.
|
|
25811
25812
|
* - `v` is the value of the data point where the label is shown.
|
|
25812
25813
|
* - `id` is the id of the data where the label is shown.
|
|
25813
25814
|
* - `i` is the index of the data series point where the label is shown.
|
|
25814
|
-
* - `texts` is
|
|
25815
|
-
* @property {number} [data.labels.position.x=0] x coordinate position, relative the original.
|
|
25816
|
-
* @property {number} [data.labels.position.y=0] y coordinate position, relative the original.
|
|
25815
|
+
* - `texts` is an array of whole corresponding data series' text labels.<br><br>
|
|
25816
|
+
* @property {number} [data.labels.position.x=0] x coordinate position, relative to the original.
|
|
25817
|
+
* @property {number} [data.labels.position.y=0] y coordinate position, relative to the original.
|
|
25817
25818
|
* @property {object} [data.labels.rotate] Rotate label text. Specify degree value in a range of `0 ~ 360`.
|
|
25818
|
-
* - **NOTE:**
|
|
25819
|
-
* @property {boolean|object} [data.labels.border=false] Add border to data label text. NOTE: When set as `true`, styling
|
|
25819
|
+
* - **NOTE:** Depending on the rotate value, the text position needs to be adjusted manually(using `data.labels.position` option) to be shown nicely.
|
|
25820
|
+
* @property {boolean|object} [data.labels.border=false] Add border to data label text. NOTE: When set as `true`, styling isn't applied. Hence, you need to set it using `.bb-text-border` class.
|
|
25820
25821
|
* @property {number|string|object} [data.labels.border.padding="3 5"] Border padding. Can be a single number, string or object with top, bottom, left, right properties.
|
|
25821
25822
|
* @property {number} [data.labels.border.radius=10] Border radius value.
|
|
25822
25823
|
* @property {number} [data.labels.border.strokeWidth=1] Border stroke width.
|
|
25823
25824
|
* @property {string} [data.labels.border.stroke="#000"] Border stroke color.
|
|
25824
25825
|
* @property {string} [data.labels.border.fill="none"] Border fill color.
|
|
25825
|
-
* @property {object|
|
|
25826
|
-
* When function is specified, will
|
|
25826
|
+
* @property {object|function} [data.labels.image] Set image to be displayed next to the label text.<br><br>
|
|
25827
|
+
* When a function is specified, it will receive 3 arguments such as `v, id, i` and it must return an image object with `url`, `width`, `height`, and optional `pos` properties.<br><br>
|
|
25827
25828
|
* The arguments are:<br>
|
|
25828
25829
|
* - `v` is the value of the data point where the label is shown.
|
|
25829
25830
|
* - `id` is the id of the data where the label is shown.
|
|
@@ -25832,8 +25833,8 @@ const $ZOOM = {
|
|
|
25832
25833
|
* @property {number} data.labels.image.width Image width in pixels.
|
|
25833
25834
|
* @property {number} data.labels.image.height Image height in pixels.
|
|
25834
25835
|
* @property {object} [data.labels.image.pos] Image position relative to the label text.
|
|
25835
|
-
* @property {number} [data.labels.image.pos.x=0] x coordinate position, relative the original.
|
|
25836
|
-
* @property {number} [data.labels.image.pos.y=0] y coordinate position, relative the original.
|
|
25836
|
+
* @property {number} [data.labels.image.pos.x=0] x coordinate position, relative to the original.
|
|
25837
|
+
* @property {number} [data.labels.image.pos.y=0] y coordinate position, relative to the original.
|
|
25837
25838
|
* @memberof Options
|
|
25838
25839
|
* @type {object}
|
|
25839
25840
|
* @default {}
|
|
@@ -25867,10 +25868,10 @@ const $ZOOM = {
|
|
|
25867
25868
|
* // align text to center of the 'bar' shape (works only for 'bar' type)
|
|
25868
25869
|
* centered: true,
|
|
25869
25870
|
*
|
|
25870
|
-
* // apply
|
|
25871
|
+
* // apply background color for label texts
|
|
25871
25872
|
* backgroundColors: "red",
|
|
25872
25873
|
*
|
|
25873
|
-
* // set
|
|
25874
|
+
* // set different background colors per dataset
|
|
25874
25875
|
* backgroundColors: {
|
|
25875
25876
|
* data1: "green",
|
|
25876
25877
|
* data2: "yellow"
|
|
@@ -25981,7 +25982,7 @@ const $ZOOM = {
|
|
|
25981
25982
|
* pos: { x: 0, y: 0 }
|
|
25982
25983
|
* };
|
|
25983
25984
|
* } else if(v < 5) {
|
|
25984
|
-
* // Return falsy value in case
|
|
25985
|
+
* // Return falsy value in case you don't want to show image
|
|
25985
25986
|
* return null;
|
|
25986
25987
|
* } else {
|
|
25987
25988
|
* return {
|
|
@@ -26002,7 +26003,7 @@ const $ZOOM = {
|
|
|
26002
26003
|
data_labels_imgUrl: void 0,
|
|
26003
26004
|
/**
|
|
26004
26005
|
* Hide each data when the chart appears.<br><br>
|
|
26005
|
-
* If true specified, all of data will be hidden. If multiple ids specified as an array, those will be hidden.
|
|
26006
|
+
* If true is specified, all of data will be hidden. If multiple ids are specified as an array, those will be hidden.
|
|
26006
26007
|
* @name data․hide
|
|
26007
26008
|
* @memberof Options
|
|
26008
26009
|
* @type {boolean|Array}
|
|
@@ -26023,7 +26024,7 @@ const $ZOOM = {
|
|
|
26023
26024
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
|
|
26024
26025
|
* @name data․filter
|
|
26025
26026
|
* @memberof Options
|
|
26026
|
-
* @type {
|
|
26027
|
+
* @type {function}
|
|
26027
26028
|
* @default undefined
|
|
26028
26029
|
* @example
|
|
26029
26030
|
* data: {
|
|
@@ -26038,13 +26039,13 @@ const $ZOOM = {
|
|
|
26038
26039
|
data_filter: void 0,
|
|
26039
26040
|
/**
|
|
26040
26041
|
* Set a callback for click event on each data point.<br><br>
|
|
26041
|
-
* This callback will be called when each data point clicked and will receive `d` and element as the arguments.
|
|
26042
|
+
* This callback will be called when each data point is clicked and will receive `d` and element as the arguments.
|
|
26042
26043
|
* - `d` is the data clicked and element is the element clicked.
|
|
26043
26044
|
* - `element` is the current interacting svg element.
|
|
26044
26045
|
* - In this callback, `this` will be the Chart object.
|
|
26045
26046
|
* @name data․onclick
|
|
26046
26047
|
* @memberof Options
|
|
26047
|
-
* @type {
|
|
26048
|
+
* @type {function}
|
|
26048
26049
|
* @default function() {}
|
|
26049
26050
|
* @example
|
|
26050
26051
|
* data: {
|
|
@@ -26059,13 +26060,13 @@ const $ZOOM = {
|
|
|
26059
26060
|
},
|
|
26060
26061
|
/**
|
|
26061
26062
|
* Set a callback for mouse/touch over event on each data point.<br><br>
|
|
26062
|
-
* This callback will be called when mouse cursor or
|
|
26063
|
+
* This callback will be called when the mouse cursor or touch moves onto each data point and will receive `d` and `element` as the argument.
|
|
26063
26064
|
* - `d` is the data where mouse cursor moves onto.
|
|
26064
26065
|
* - `element` is the current interacting svg element.
|
|
26065
26066
|
* - In this callback, `this` will be the Chart object.
|
|
26066
26067
|
* @name data․onover
|
|
26067
26068
|
* @memberof Options
|
|
26068
|
-
* @type {
|
|
26069
|
+
* @type {function}
|
|
26069
26070
|
* @default function() {}
|
|
26070
26071
|
* @example
|
|
26071
26072
|
* data: {
|
|
@@ -26080,13 +26081,13 @@ const $ZOOM = {
|
|
|
26080
26081
|
},
|
|
26081
26082
|
/**
|
|
26082
26083
|
* Set a callback for mouse/touch out event on each data point.<br><br>
|
|
26083
|
-
* This callback will be called when mouse cursor or
|
|
26084
|
+
* This callback will be called when the mouse cursor or touch moves out each data point and will receive `d` as the argument.
|
|
26084
26085
|
* - `d` is the data where mouse cursor moves out.
|
|
26085
26086
|
* - `element` is the current interacting svg element.
|
|
26086
26087
|
* - In this callback, `this` will be the Chart object.
|
|
26087
26088
|
* @name data․onout
|
|
26088
26089
|
* @memberof Options
|
|
26089
|
-
* @type {
|
|
26090
|
+
* @type {function}
|
|
26090
26091
|
* @default function() {}
|
|
26091
26092
|
* @example
|
|
26092
26093
|
* data: {
|
|
@@ -26104,7 +26105,7 @@ const $ZOOM = {
|
|
|
26104
26105
|
* The callback will receive shown data ids in array.
|
|
26105
26106
|
* @name data․onshown
|
|
26106
26107
|
* @memberof Options
|
|
26107
|
-
* @type {
|
|
26108
|
+
* @type {function}
|
|
26108
26109
|
* @default undefined
|
|
26109
26110
|
* @example
|
|
26110
26111
|
* data: {
|
|
@@ -26120,7 +26121,7 @@ const $ZOOM = {
|
|
|
26120
26121
|
* The callback will receive hidden data ids in array.
|
|
26121
26122
|
* @name data․onhidden
|
|
26122
26123
|
* @memberof Options
|
|
26123
|
-
* @type {
|
|
26124
|
+
* @type {function}
|
|
26124
26125
|
* @default undefined
|
|
26125
26126
|
* @example
|
|
26126
26127
|
* data: {
|
|
@@ -26136,7 +26137,7 @@ const $ZOOM = {
|
|
|
26136
26137
|
* - **NOTE:** For 'area-line-range', 'area-step-range' and 'area-spline-range', `mid` data will be taken for the comparison
|
|
26137
26138
|
* @name data․onmin
|
|
26138
26139
|
* @memberof Options
|
|
26139
|
-
* @type {
|
|
26140
|
+
* @type {function}
|
|
26140
26141
|
* @default undefined
|
|
26141
26142
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Data.OnMinMaxCallback)
|
|
26142
26143
|
* @example
|
|
@@ -26151,7 +26152,7 @@ const $ZOOM = {
|
|
|
26151
26152
|
* - **NOTE:** For 'area-line-range', 'area-step-range' and 'area-spline-range', `mid` data will be taken for the comparison
|
|
26152
26153
|
* @name data․onmax
|
|
26153
26154
|
* @memberof Options
|
|
26154
|
-
* @type {
|
|
26155
|
+
* @type {function}
|
|
26155
26156
|
* @default undefined
|
|
26156
26157
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Data.OnMinMaxCallback)
|
|
26157
26158
|
* @example
|
|
@@ -26162,7 +26163,7 @@ const $ZOOM = {
|
|
|
26162
26163
|
*/
|
|
26163
26164
|
data_onmax: void 0,
|
|
26164
26165
|
/**
|
|
26165
|
-
* Load a CSV or JSON file from a URL. NOTE that this will not work if loading via the "file://" protocol as
|
|
26166
|
+
* Load a CSV or JSON file from a URL. NOTE that this will not work if loading via the "file://" protocol as most browsers will block XMLHTTPRequests.
|
|
26166
26167
|
* @name data․url
|
|
26167
26168
|
* @memberof Options
|
|
26168
26169
|
* @type {string}
|
|
@@ -26290,7 +26291,7 @@ const $ZOOM = {
|
|
|
26290
26291
|
* }
|
|
26291
26292
|
* }
|
|
26292
26293
|
*
|
|
26293
|
-
* // for '
|
|
26294
|
+
* // for 'candlestick' type, data should contain:
|
|
26294
26295
|
* // - an array of [open, high, low, close, volume(optional)] data following the order
|
|
26295
26296
|
* // - or an object with 'open', 'high', 'low', 'close' and 'value'(optional) key value
|
|
26296
26297
|
* data: {
|
|
@@ -26365,7 +26366,7 @@ const $ZOOM = {
|
|
|
26365
26366
|
* type: "bubble"
|
|
26366
26367
|
* }
|
|
26367
26368
|
*
|
|
26368
|
-
* // for '
|
|
26369
|
+
* // for 'candlestick' type, data should contain:
|
|
26369
26370
|
* // - an array of [open, high, low, close, volume(optional)] data following the order
|
|
26370
26371
|
* // - or an object with 'open', 'high', 'low', 'close' and 'value'(optional) key value
|
|
26371
26372
|
* data: {
|
|
@@ -26453,7 +26454,8 @@ const $ZOOM = {
|
|
|
26453
26454
|
* @property {boolean} [interaction.brighten=true] Make brighter for the selected area (ex. 'pie' type data selected area)
|
|
26454
26455
|
* @property {boolean} [interaction.inputType.mouse=true] enable or disable mouse interaction
|
|
26455
26456
|
* @property {boolean} [interaction.inputType.touch=true] enable or disable touch interaction
|
|
26456
|
-
* @property {boolean|number} [interaction.inputType.touch.preventDefault=false] enable or disable to call event.preventDefault on touchstart & touchmove event. It's usually used to prevent document scrolling
|
|
26457
|
+
* @property {boolean|number} [interaction.inputType.touch.preventDefault=false] enable or disable to call event.preventDefault on touchstart & touchmove event. It's usually used to prevent document scrolling.<br>
|
|
26458
|
+
* - **NOTE**: When `true` is set, touch events are bound with [`{passive: false}`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#using_passive_listeners) option.
|
|
26457
26459
|
* @property {boolean} [interaction.onout=true] Enable or disable "onout" event.<br>
|
|
26458
26460
|
* When is disabled, defocus(hiding tooltip, focused gridline, etc.) event won't work.
|
|
26459
26461
|
* @see [Demo: touch.preventDefault](https://naver.github.io/billboard.js/demo/#Interaction.PreventScrollOnTouch)
|
|
@@ -28763,20 +28765,28 @@ function endall(transition, cb) {
|
|
|
28763
28765
|
transition.call(end);
|
|
28764
28766
|
}
|
|
28765
28767
|
}
|
|
28766
|
-
const
|
|
28768
|
+
const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
|
|
28767
28769
|
const sanitizeRx = {
|
|
28768
28770
|
tags: new RegExp(
|
|
28769
|
-
`<(${
|
|
28771
|
+
`<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
|
|
28770
28772
|
"gi"
|
|
28771
28773
|
),
|
|
28772
|
-
|
|
28773
|
-
|
|
28774
|
+
// Handles: whitespace, slash, quotes before event handlers (e.g., <img/onerror=...>, <img src="x"onerror=...>)
|
|
28775
|
+
eventHandlers: /[\s/"']+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,
|
|
28776
|
+
// Handles: javascript/data/vbscript URIs with optional whitespace/newlines between protocol and colon
|
|
28777
|
+
dangerousURIs: /(href|src|action|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript)\s*:/gi
|
|
28774
28778
|
};
|
|
28775
28779
|
function sanitize(str) {
|
|
28776
28780
|
if (!isString(str) || !str || str.indexOf("<") === -1) {
|
|
28777
28781
|
return str;
|
|
28778
28782
|
}
|
|
28779
|
-
|
|
28783
|
+
let result = str;
|
|
28784
|
+
let prev;
|
|
28785
|
+
do {
|
|
28786
|
+
prev = result;
|
|
28787
|
+
result = result.replace(sanitizeRx.tags, "").replace(sanitizeRx.eventHandlers, "").replace(sanitizeRx.dangerousURIs, '$1=""');
|
|
28788
|
+
} while (result !== prev);
|
|
28789
|
+
return result;
|
|
28780
28790
|
}
|
|
28781
28791
|
function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
|
|
28782
28792
|
if (!node || !isString(text)) {
|
|
@@ -29490,9 +29500,9 @@ class Cache {
|
|
|
29490
29500
|
/**
|
|
29491
29501
|
* Add cache
|
|
29492
29502
|
* @param {string} key Cache key
|
|
29493
|
-
* @param {
|
|
29503
|
+
* @param {string|number|boolean|object|Array|function|null|undefined} value Value to be stored
|
|
29494
29504
|
* @param {boolean} isDataType Weather the cache is data typed '{id:'data', id_org: 'data', values: [{x:0, index:0,...}, ...]}'
|
|
29495
|
-
* @returns {
|
|
29505
|
+
* @returns {string|number|boolean|object|Array|function|null|undefined} Added data value
|
|
29496
29506
|
* @private
|
|
29497
29507
|
*/
|
|
29498
29508
|
add(key, value, isDataType = false) {
|
|
@@ -29511,7 +29521,7 @@ class Cache {
|
|
|
29511
29521
|
* Get cahce
|
|
29512
29522
|
* @param {string|Array} key Cache key
|
|
29513
29523
|
* @param {boolean} isDataType Weather the cache is data typed '{id:'data', id_org: 'data', values: [{x:0, index:0,...}, ...]}'
|
|
29514
|
-
* @returns {
|
|
29524
|
+
* @returns {string|number|boolean|object|Array|function|null} Cached value
|
|
29515
29525
|
* @private
|
|
29516
29526
|
*/
|
|
29517
29527
|
get(key, isDataType = false) {
|
|
@@ -30111,7 +30121,7 @@ function setXS(ids, data, params) {
|
|
|
30111
30121
|
/**
|
|
30112
30122
|
* Convert data according its type
|
|
30113
30123
|
* @param {object} args data object
|
|
30114
|
-
* @param {
|
|
30124
|
+
* @param {function} [callback] callback for url(XHR) type loading
|
|
30115
30125
|
* @private
|
|
30116
30126
|
*/
|
|
30117
30127
|
convertData(args, callback) {
|
|
@@ -30262,7 +30272,17 @@ function setXS(ids, data, params) {
|
|
|
30262
30272
|
},
|
|
30263
30273
|
isStackNormalized() {
|
|
30264
30274
|
const { config } = this;
|
|
30265
|
-
return !!(config.data_stack_normalize && config.data_groups.length);
|
|
30275
|
+
return !!((config.data_stack_normalize === true || isObjectType(config.data_stack_normalize)) && config.data_groups.length);
|
|
30276
|
+
},
|
|
30277
|
+
/**
|
|
30278
|
+
* Check if stack normalization should be applied per group
|
|
30279
|
+
* @returns {boolean}
|
|
30280
|
+
* @private
|
|
30281
|
+
*/
|
|
30282
|
+
isStackNormalizedPerGroup() {
|
|
30283
|
+
var _a;
|
|
30284
|
+
const { config } = this;
|
|
30285
|
+
return !!(isObjectType(config.data_stack_normalize) && ((_a = config.data_stack_normalize) == null ? void 0 : _a.perGroup) && config.data_groups.length);
|
|
30266
30286
|
},
|
|
30267
30287
|
/**
|
|
30268
30288
|
* Check if given id is grouped data or has grouped data
|
|
@@ -30274,6 +30294,19 @@ function setXS(ids, data, params) {
|
|
|
30274
30294
|
const groups = this.config.data_groups;
|
|
30275
30295
|
return id ? groups.some((v) => v.indexOf(id) >= 0 && v.length > 1) : groups.length > 0;
|
|
30276
30296
|
},
|
|
30297
|
+
/**
|
|
30298
|
+
* Check if the given axis has any grouped data
|
|
30299
|
+
* @param {string} axisId Axis ID (e.g., "y", "y2")
|
|
30300
|
+
* @returns {boolean} true if axis has grouped data
|
|
30301
|
+
* @private
|
|
30302
|
+
*/
|
|
30303
|
+
hasAxisGroupedData(axisId) {
|
|
30304
|
+
const $$ = this;
|
|
30305
|
+
const { axis } = $$;
|
|
30306
|
+
const targets = $$.data.targets;
|
|
30307
|
+
const axisDataIds = targets.filter((t) => axis.getId(t.id) === axisId).map((t) => t.id);
|
|
30308
|
+
return axisDataIds.some((id) => $$.isGrouped(id));
|
|
30309
|
+
},
|
|
30277
30310
|
getXKey(id) {
|
|
30278
30311
|
const $$ = this;
|
|
30279
30312
|
const { config } = $$;
|
|
@@ -30465,16 +30498,27 @@ function setXS(ids, data, params) {
|
|
|
30465
30498
|
},
|
|
30466
30499
|
/**
|
|
30467
30500
|
* Get sum of data per index
|
|
30501
|
+
* @param {string} targetId Target ID to get total for (only for normalized stack per group)
|
|
30468
30502
|
* @private
|
|
30469
30503
|
* @returns {Array}
|
|
30470
30504
|
*/
|
|
30471
|
-
getTotalPerIndex() {
|
|
30505
|
+
getTotalPerIndex(targetId) {
|
|
30472
30506
|
const $$ = this;
|
|
30473
|
-
const
|
|
30507
|
+
const { config } = $$;
|
|
30508
|
+
const cacheKey = targetId ? `${KEY.dataTotalPerIndex}-${targetId}` : KEY.dataTotalPerIndex;
|
|
30474
30509
|
let sum = $$.cache.get(cacheKey);
|
|
30475
30510
|
if (($$.config.data_groups.length || $$.isStackNormalized()) && !sum) {
|
|
30476
30511
|
sum = [];
|
|
30477
|
-
|
|
30512
|
+
let { targets } = $$.data;
|
|
30513
|
+
if ($$.isStackNormalizedPerGroup() && targetId) {
|
|
30514
|
+
const group = config.data_groups.find((g) => g.indexOf(targetId) >= 0);
|
|
30515
|
+
if (group) {
|
|
30516
|
+
targets = targets.filter((t) => group.indexOf(t.id) >= 0);
|
|
30517
|
+
} else {
|
|
30518
|
+
return null;
|
|
30519
|
+
}
|
|
30520
|
+
}
|
|
30521
|
+
targets.forEach((row) => {
|
|
30478
30522
|
row.values.forEach((v, i) => {
|
|
30479
30523
|
if (!sum[i]) {
|
|
30480
30524
|
sum[i] = 0;
|
|
@@ -30482,6 +30526,7 @@ function setXS(ids, data, params) {
|
|
|
30482
30526
|
sum[i] += ~~v.value;
|
|
30483
30527
|
});
|
|
30484
30528
|
});
|
|
30529
|
+
$$.cache.add(cacheKey, sum);
|
|
30485
30530
|
}
|
|
30486
30531
|
return sum;
|
|
30487
30532
|
},
|
|
@@ -30497,7 +30542,10 @@ function setXS(ids, data, params) {
|
|
|
30497
30542
|
let total = $$.cache.get(cacheKey);
|
|
30498
30543
|
if (!isNumber(total)) {
|
|
30499
30544
|
total = $$.data.targets.reduce((acc, t) => {
|
|
30500
|
-
return acc + t.values.reduce((sum, v) =>
|
|
30545
|
+
return acc + t.values.reduce((sum, v) => {
|
|
30546
|
+
var _a;
|
|
30547
|
+
return sum + ((_a = v.value) != null ? _a : 0);
|
|
30548
|
+
}, 0);
|
|
30501
30549
|
}, 0);
|
|
30502
30550
|
$$.cache.add(cacheKey, total);
|
|
30503
30551
|
}
|
|
@@ -30592,7 +30640,7 @@ function setXS(ids, data, params) {
|
|
|
30592
30640
|
return sortValue(xs);
|
|
30593
30641
|
},
|
|
30594
30642
|
/**
|
|
30595
|
-
* Add to
|
|
30643
|
+
* Add to thetarget Ids
|
|
30596
30644
|
* @param {string} type State's prop name
|
|
30597
30645
|
* @param {Array|string} targetIds Target ids array
|
|
30598
30646
|
* @private
|
|
@@ -30690,7 +30738,7 @@ function setXS(ids, data, params) {
|
|
|
30690
30738
|
/**
|
|
30691
30739
|
* Get data.order compare function
|
|
30692
30740
|
* @param {boolean} isReversed for Arc & Treemap type sort order needs to be reversed
|
|
30693
|
-
* @returns {
|
|
30741
|
+
* @returns {function} compare function
|
|
30694
30742
|
* @private
|
|
30695
30743
|
*/
|
|
30696
30744
|
getSortCompareFn(isReversed = false) {
|
|
@@ -30972,12 +31020,27 @@ function setXS(ids, data, params) {
|
|
|
30972
31020
|
}
|
|
30973
31021
|
} else if (type === "index") {
|
|
30974
31022
|
const dataValues = api.data.values.bind(api);
|
|
30975
|
-
|
|
30976
|
-
|
|
30977
|
-
|
|
30978
|
-
|
|
30979
|
-
|
|
30980
|
-
|
|
31023
|
+
const { hiddenTargetIds } = state;
|
|
31024
|
+
let total = this.getTotalPerIndex(
|
|
31025
|
+
$$.isStackNormalizedPerGroup() ? d.id : void 0
|
|
31026
|
+
);
|
|
31027
|
+
if (total === null) {
|
|
31028
|
+
return ratio;
|
|
31029
|
+
}
|
|
31030
|
+
if (hiddenTargetIds.length) {
|
|
31031
|
+
let hiddenIds = hiddenTargetIds;
|
|
31032
|
+
if ($$.isStackNormalizedPerGroup() && d.id) {
|
|
31033
|
+
const group = config.data_groups.find((g) => g.indexOf(d.id) >= 0);
|
|
31034
|
+
if (group) {
|
|
31035
|
+
hiddenIds = hiddenIds.filter((id) => group.indexOf(id) >= 0);
|
|
31036
|
+
}
|
|
31037
|
+
}
|
|
31038
|
+
if (hiddenIds.length) {
|
|
31039
|
+
let hiddenSum = dataValues(hiddenIds, false);
|
|
31040
|
+
if (hiddenSum.length) {
|
|
31041
|
+
hiddenSum = hiddenSum.reduce((acc, curr) => acc.map((v, i) => ~~v + curr[i]));
|
|
31042
|
+
total = total.map((v, i) => v - hiddenSum[i]);
|
|
31043
|
+
}
|
|
30981
31044
|
}
|
|
30982
31045
|
}
|
|
30983
31046
|
const divisor = total[d.index];
|
|
@@ -31155,8 +31218,6 @@ function callDone(fn, resizeAfter = false) {
|
|
|
31155
31218
|
done();
|
|
31156
31219
|
return;
|
|
31157
31220
|
}
|
|
31158
|
-
const targets = $el.svg.selectAll(targetIds.map((id) => $$.selectorTarget(id)));
|
|
31159
|
-
$T(targets).style("opacity", "0").remove().call(endall, done);
|
|
31160
31221
|
targetIds.forEach((id) => {
|
|
31161
31222
|
var _a2;
|
|
31162
31223
|
const suffixId = $$.getTargetSelectorSuffix(id);
|
|
@@ -31170,6 +31231,8 @@ function callDone(fn, resizeAfter = false) {
|
|
|
31170
31231
|
state.hasFunnel && $$.updateFunnel($$.data.targets);
|
|
31171
31232
|
state.hasTreemap && $$.updateTargetsForTreemap($$.data.targets);
|
|
31172
31233
|
$$.updateTypesElements();
|
|
31234
|
+
const targets = $el.svg.selectAll(targetIds.map((id) => $$.selectorTarget(id)));
|
|
31235
|
+
$T(targets).style("opacity", "0").remove().call(endall, done);
|
|
31173
31236
|
}
|
|
31174
31237
|
});
|
|
31175
31238
|
|
|
@@ -31458,7 +31521,7 @@ function drag_defaultTouchable() {
|
|
|
31458
31521
|
},
|
|
31459
31522
|
/**
|
|
31460
31523
|
* Return draggable selection function
|
|
31461
|
-
* @returns {
|
|
31524
|
+
* @returns {function}
|
|
31462
31525
|
* @private
|
|
31463
31526
|
*/
|
|
31464
31527
|
getDraggableSelection() {
|
|
@@ -31865,6 +31928,7 @@ const schemeCategory10 = [
|
|
|
31865
31928
|
const $$ = this;
|
|
31866
31929
|
const { $el, config } = $$;
|
|
31867
31930
|
const ids = [];
|
|
31931
|
+
const hasGradient = config.area_linearGradient || config.bar_linearGradient || config.point_radialGradient;
|
|
31868
31932
|
let pattern = notEmpty(config.color_pattern) ? config.color_pattern : ordinal(getColorFromCss($el.chart) || schemeCategory10).range();
|
|
31869
31933
|
const originalColorPattern = pattern;
|
|
31870
31934
|
if (isFunction(config.color_tiles)) {
|
|
@@ -31895,7 +31959,18 @@ const schemeCategory10 = [
|
|
|
31895
31959
|
color = isLine ? originalColorPattern[ids.indexOf(id) % originalColorPattern.length] : pattern[ids.indexOf(id) % pattern.length];
|
|
31896
31960
|
colors[id] = color;
|
|
31897
31961
|
}
|
|
31898
|
-
|
|
31962
|
+
color = isFunction(callback) ? callback.call($$.api, color, d) : color;
|
|
31963
|
+
if (hasGradient) {
|
|
31964
|
+
const stop = $$.$el.defs.selectAll(
|
|
31965
|
+
`[id$='-gradient${$$.getTargetSelectorSuffix(id)}'] stop`
|
|
31966
|
+
);
|
|
31967
|
+
let hasSameColor;
|
|
31968
|
+
stop.each(function(d2, i) {
|
|
31969
|
+
hasSameColor = i === 0 ? this.style.stopColor : this.style.stopColor === hasSameColor;
|
|
31970
|
+
});
|
|
31971
|
+
hasSameColor === true && stop.attr("stop-color", color);
|
|
31972
|
+
}
|
|
31973
|
+
return color;
|
|
31899
31974
|
};
|
|
31900
31975
|
},
|
|
31901
31976
|
generateLevelColor() {
|
|
@@ -31920,7 +31995,7 @@ const schemeCategory10 = [
|
|
|
31920
31995
|
},
|
|
31921
31996
|
/**
|
|
31922
31997
|
* Append data backgound color filter definition
|
|
31923
|
-
* @param {string|object|
|
|
31998
|
+
* @param {string|object|function} color Color string, object, or function
|
|
31924
31999
|
* @param {object} attr filter attribute
|
|
31925
32000
|
* @private
|
|
31926
32001
|
*/
|
|
@@ -32087,7 +32162,11 @@ const schemeCategory10 = [
|
|
|
32087
32162
|
const { axis, config, scale } = $$;
|
|
32088
32163
|
const pfx = `axis_${axisId}`;
|
|
32089
32164
|
if ($$.isStackNormalized()) {
|
|
32090
|
-
|
|
32165
|
+
const axisDataIds = targets.filter((t) => axis.getId(t.id) === axisId).map((t) => t.id);
|
|
32166
|
+
const hasGroupedData = axisDataIds.some((id) => $$.isGrouped(id));
|
|
32167
|
+
if (hasGroupedData) {
|
|
32168
|
+
return [0, 100];
|
|
32169
|
+
}
|
|
32091
32170
|
}
|
|
32092
32171
|
const isLog = (scale == null ? void 0 : scale[axisId]) && scale[axisId].type === "log";
|
|
32093
32172
|
const targetsByAxisId = targets.filter((t) => axis.getId(t.id) === axisId);
|
|
@@ -32405,7 +32484,7 @@ function getFormat($$, typeValue, v) {
|
|
|
32405
32484
|
},
|
|
32406
32485
|
/**
|
|
32407
32486
|
* Get default value format function
|
|
32408
|
-
* @returns {
|
|
32487
|
+
* @returns {function} formatter function
|
|
32409
32488
|
* @private
|
|
32410
32489
|
*/
|
|
32411
32490
|
getDefaultValueFormat() {
|
|
@@ -32929,7 +33008,7 @@ function getFormattedText(id, formatted = true) {
|
|
|
32929
33008
|
* @param {Array} targetIdz Data ids
|
|
32930
33009
|
* @param {object} dimension Dimension object
|
|
32931
33010
|
* @param {object} sizes Size object
|
|
32932
|
-
* @returns {
|
|
33011
|
+
* @returns {function} Update position function
|
|
32933
33012
|
* @private
|
|
32934
33013
|
*/
|
|
32935
33014
|
getUpdateLegendPositions(targetIdz, dimension, sizes) {
|
|
@@ -33003,7 +33082,7 @@ function getFormattedText(id, formatted = true) {
|
|
|
33003
33082
|
* Generate legend item elements
|
|
33004
33083
|
* @param {Array} targetIdz Data ids
|
|
33005
33084
|
* @param {object} itemTileSize Item tile size {width, height}
|
|
33006
|
-
* @param {
|
|
33085
|
+
* @param {function} updatePositions Update position function
|
|
33007
33086
|
* @param {object} posFn Position functions
|
|
33008
33087
|
* @private
|
|
33009
33088
|
*/
|
|
@@ -33558,8 +33637,8 @@ FormatSpecifier.prototype.toString = function() {
|
|
|
33558
33637
|
return Math.abs(x = Math.round(x)) >= 1e21 ? x.toLocaleString("en").replace(/,/g, "") : x.toString(10);
|
|
33559
33638
|
}
|
|
33560
33639
|
function formatDecimalParts(x, p) {
|
|
33561
|
-
if ((
|
|
33562
|
-
var i, coefficient = x.slice(0, i);
|
|
33640
|
+
if (!isFinite(x) || x === 0) return null;
|
|
33641
|
+
var i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e"), coefficient = x.slice(0, i);
|
|
33563
33642
|
return [
|
|
33564
33643
|
coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient,
|
|
33565
33644
|
+x.slice(i + 1)
|
|
@@ -33626,7 +33705,7 @@ function formatDecimalParts(x, p) {
|
|
|
33626
33705
|
var prefixExponent;
|
|
33627
33706
|
/* harmony default export */ function formatPrefixAuto(x, p) {
|
|
33628
33707
|
var d = formatDecimalParts(x, p);
|
|
33629
|
-
if (!d) return
|
|
33708
|
+
if (!d) return prefixExponent = void 0, x.toPrecision(p);
|
|
33630
33709
|
var coefficient = d[0], exponent = d[1], i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, n = coefficient.length;
|
|
33631
33710
|
return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0];
|
|
33632
33711
|
}
|
|
@@ -33677,13 +33756,13 @@ var prefixExponent;
|
|
|
33677
33756
|
var map = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"];
|
|
33678
33757
|
/* harmony default export */ function src_locale(locale) {
|
|
33679
33758
|
var group = locale.grouping === void 0 || locale.thousands === void 0 ? src_identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""), currencyPrefix = locale.currency === void 0 ? "" : locale.currency[0] + "", currencySuffix = locale.currency === void 0 ? "" : locale.currency[1] + "", decimal = locale.decimal === void 0 ? "." : locale.decimal + "", numerals = locale.numerals === void 0 ? src_identity : formatNumerals(map.call(locale.numerals, String)), percent = locale.percent === void 0 ? "%" : locale.percent + "", minus = locale.minus === void 0 ? "\u2212" : locale.minus + "", nan = locale.nan === void 0 ? "NaN" : locale.nan + "";
|
|
33680
|
-
function newFormat(specifier) {
|
|
33759
|
+
function newFormat(specifier, options) {
|
|
33681
33760
|
specifier = formatSpecifier(specifier);
|
|
33682
33761
|
var fill = specifier.fill, align = specifier.align, sign = specifier.sign, symbol = specifier.symbol, zero = specifier.zero, width = specifier.width, comma = specifier.comma, precision = specifier.precision, trim = specifier.trim, type = specifier.type;
|
|
33683
33762
|
if (type === "n") comma = true, type = "g";
|
|
33684
33763
|
else if (!formatTypes[type]) precision === void 0 && (precision = 12), trim = true, type = "g";
|
|
33685
33764
|
if (zero || fill === "0" && align === "=") zero = true, fill = "0", align = "=";
|
|
33686
|
-
var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "";
|
|
33765
|
+
var prefix = (options && options.prefix !== void 0 ? options.prefix : "") + (symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : ""), suffix = (symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : "") + (options && options.suffix !== void 0 ? options.suffix : "");
|
|
33687
33766
|
var formatType = formatTypes[type], maybeSuffix = /[defgprs%]/.test(type);
|
|
33688
33767
|
precision = precision === void 0 ? 6 : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision));
|
|
33689
33768
|
function format(value) {
|
|
@@ -33698,7 +33777,7 @@ var map = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "\xB5",
|
|
|
33698
33777
|
if (trim) value = formatTrim(value);
|
|
33699
33778
|
if (valueNegative && +value === 0 && sign !== "+") valueNegative = false;
|
|
33700
33779
|
valuePrefix = (valueNegative ? sign === "(" ? sign : minus : sign === "-" || sign === "(" ? "" : sign) + valuePrefix;
|
|
33701
|
-
valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
|
|
33780
|
+
valueSuffix = (type === "s" && !isNaN(value) && prefixExponent !== void 0 ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : "");
|
|
33702
33781
|
if (maybeSuffix) {
|
|
33703
33782
|
i = -1, n = value.length;
|
|
33704
33783
|
while (++i < n) {
|
|
@@ -33735,9 +33814,9 @@ var map = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "\xB5",
|
|
|
33735
33814
|
return format;
|
|
33736
33815
|
}
|
|
33737
33816
|
function formatPrefix(specifier, value) {
|
|
33738
|
-
var
|
|
33817
|
+
var e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, k = Math.pow(10, -e), f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier), { suffix: prefixes[8 + e / 3] });
|
|
33739
33818
|
return function(value2) {
|
|
33740
|
-
return f(k * value2)
|
|
33819
|
+
return f(k * value2);
|
|
33741
33820
|
};
|
|
33742
33821
|
}
|
|
33743
33822
|
return {
|
|
@@ -34261,8 +34340,8 @@ function getScale(type = "linear", min, max) {
|
|
|
34261
34340
|
* @param {number} min Min range value
|
|
34262
34341
|
* @param {number} max Max range value
|
|
34263
34342
|
* @param {Array} domain Domain value
|
|
34264
|
-
* @param {
|
|
34265
|
-
* @returns {
|
|
34343
|
+
* @param {function} offset The offset getter to be sum
|
|
34344
|
+
* @returns {function} scale
|
|
34266
34345
|
* @private
|
|
34267
34346
|
*/
|
|
34268
34347
|
getXScale(min, max, domain, offset) {
|
|
@@ -34279,7 +34358,7 @@ function getScale(type = "linear", min, max) {
|
|
|
34279
34358
|
* @param {number} min Min value
|
|
34280
34359
|
* @param {number} max Max value
|
|
34281
34360
|
* @param {Array} domain Domain value
|
|
34282
|
-
* @returns {
|
|
34361
|
+
* @returns {function} Scale function
|
|
34283
34362
|
* @private
|
|
34284
34363
|
*/
|
|
34285
34364
|
getYScale(id, min, max, domain) {
|
|
@@ -34292,7 +34371,7 @@ function getScale(type = "linear", min, max) {
|
|
|
34292
34371
|
* Get y Axis scale
|
|
34293
34372
|
* @param {string} id Axis id
|
|
34294
34373
|
* @param {boolean} isSub Weather is sub Axis
|
|
34295
|
-
* @returns {
|
|
34374
|
+
* @returns {function} Scale function
|
|
34296
34375
|
* @private
|
|
34297
34376
|
*/
|
|
34298
34377
|
getYScaleById(id, isSub = false) {
|
|
@@ -34304,8 +34383,8 @@ function getScale(type = "linear", min, max) {
|
|
|
34304
34383
|
/**
|
|
34305
34384
|
* Get customized x axis scale
|
|
34306
34385
|
* @param {d3.scaleLinear|d3.scaleTime} scaleValue Scale function
|
|
34307
|
-
* @param {
|
|
34308
|
-
* @returns {
|
|
34386
|
+
* @param {function} offsetValue Offset getter to be sum
|
|
34387
|
+
* @returns {function} Scale function
|
|
34309
34388
|
* @private
|
|
34310
34389
|
*/
|
|
34311
34390
|
getCustomizedXScale(scaleValue, offsetValue) {
|
|
@@ -34755,8 +34834,8 @@ function getScale(type = "linear", min, max) {
|
|
|
34755
34834
|
* @param {boolean} withShape Set shpes' prefix class
|
|
34756
34835
|
* @param {string} selector CSS selector
|
|
34757
34836
|
* @param {Array} props CSS props list
|
|
34758
|
-
* @param {
|
|
34759
|
-
* @returns {
|
|
34837
|
+
* @param {function} propsFn Function to retrieve value or determine for props
|
|
34838
|
+
* @returns {function}
|
|
34760
34839
|
* @private
|
|
34761
34840
|
*/
|
|
34762
34841
|
setCssRule(withShape, selector, props, propsFn) {
|
|
@@ -34778,7 +34857,7 @@ function getScale(type = "linear", min, max) {
|
|
|
34778
34857
|
},
|
|
34779
34858
|
/**
|
|
34780
34859
|
* Get style prop value
|
|
34781
|
-
* @param {
|
|
34860
|
+
* @param {function|string} v Value
|
|
34782
34861
|
* @returns {string|null}
|
|
34783
34862
|
* @private
|
|
34784
34863
|
*/
|
|
@@ -35049,7 +35128,7 @@ function updateTextImagePos(textNode, pos) {
|
|
|
35049
35128
|
if (isNumber(value)) {
|
|
35050
35129
|
this.textContent = value;
|
|
35051
35130
|
} else {
|
|
35052
|
-
setTextValue(node, value);
|
|
35131
|
+
setTextValue(node, value, void 0, true);
|
|
35053
35132
|
}
|
|
35054
35133
|
});
|
|
35055
35134
|
updateTextImage.call($$);
|
|
@@ -35080,7 +35159,7 @@ function updateTextImagePos(textNode, pos) {
|
|
|
35080
35159
|
/**
|
|
35081
35160
|
* Update data label text background color
|
|
35082
35161
|
* @param {object} d Data object
|
|
35083
|
-
* @param {object|string|
|
|
35162
|
+
* @param {object|string|function} option option object
|
|
35084
35163
|
* @returns {string|null}
|
|
35085
35164
|
* @private
|
|
35086
35165
|
*/
|
|
@@ -35109,8 +35188,8 @@ function updateTextImagePos(textNode, pos) {
|
|
|
35109
35188
|
},
|
|
35110
35189
|
/**
|
|
35111
35190
|
* Redraw chartText
|
|
35112
|
-
* @param {
|
|
35113
|
-
* @param {
|
|
35191
|
+
* @param {function} getX Positioning function for x
|
|
35192
|
+
* @param {function} getY Positioning function for y
|
|
35114
35193
|
* @param {boolean} forFlow Weather is flow
|
|
35115
35194
|
* @param {boolean} withTransition transition is enabled
|
|
35116
35195
|
* @returns {Array}
|
|
@@ -35224,7 +35303,7 @@ function updateTextImagePos(textNode, pos) {
|
|
|
35224
35303
|
const isBarType = $$.isBarType(d);
|
|
35225
35304
|
const isTreemapType = $$.isTreemapType(d);
|
|
35226
35305
|
if (config.data_labels.centered && (isBarType || isTreemapType)) {
|
|
35227
|
-
const rect =
|
|
35306
|
+
const rect = getBBox(textElement);
|
|
35228
35307
|
if (isBarType) {
|
|
35229
35308
|
const isPositive = $$.getRangedData(d, null, "bar") >= 0;
|
|
35230
35309
|
if (isRotated) {
|
|
@@ -35235,7 +35314,10 @@ function updateTextImagePos(textNode, pos) {
|
|
|
35235
35314
|
return isPositive ? h : -h - 2;
|
|
35236
35315
|
}
|
|
35237
35316
|
} else if (isTreemapType) {
|
|
35238
|
-
return type === "x" ? (points[1][0] - points[0][0]) / 2 : (
|
|
35317
|
+
return type === "x" ? (points[1][0] - points[0][0]) / 2 : (
|
|
35318
|
+
// X: Move to horizontal center of rect
|
|
35319
|
+
(points[1][1] - points[0][1]) / 2 - rect.y - rect.height / 2
|
|
35320
|
+
);
|
|
35239
35321
|
}
|
|
35240
35322
|
}
|
|
35241
35323
|
return 0;
|
|
@@ -35501,9 +35583,9 @@ function getTextXPos(pos = "left", width) {
|
|
|
35501
35583
|
/**
|
|
35502
35584
|
* Returns the tooltip content(HTML string)
|
|
35503
35585
|
* @param {object} d data
|
|
35504
|
-
* @param {
|
|
35505
|
-
* @param {
|
|
35506
|
-
* @param {
|
|
35586
|
+
* @param {function} defaultTitleFormat Default title format
|
|
35587
|
+
* @param {function} defaultValueFormat Default format for each data value in the tooltip.
|
|
35588
|
+
* @param {function} color Color function
|
|
35507
35589
|
* @returns {string} html
|
|
35508
35590
|
* @private
|
|
35509
35591
|
*/
|
|
@@ -35517,9 +35599,16 @@ function getTextXPos(pos = "left", width) {
|
|
|
35517
35599
|
});
|
|
35518
35600
|
const titleFormat = (...arg) => sanitize((titleFn || defaultTitleFormat)(...arg));
|
|
35519
35601
|
const nameFormat = (...arg) => sanitize((nameFn || ((name) => name))(...arg));
|
|
35520
|
-
const valueFormat = (
|
|
35521
|
-
|
|
35522
|
-
|
|
35602
|
+
const valueFormat = (v, ratio, id, index) => {
|
|
35603
|
+
let fn = valueFn;
|
|
35604
|
+
if (!fn) {
|
|
35605
|
+
if (state.hasTreemap || $$.isStackNormalized() && (!$$.isStackNormalizedPerGroup() || $$.isGrouped(id))) {
|
|
35606
|
+
fn = (v2, ratio2) => `${(ratio2 * 100).toFixed(2)}%`;
|
|
35607
|
+
} else {
|
|
35608
|
+
fn = defaultValueFormat;
|
|
35609
|
+
}
|
|
35610
|
+
}
|
|
35611
|
+
return sanitize(fn(v, ratio, id, index));
|
|
35523
35612
|
};
|
|
35524
35613
|
const order = config.tooltip_order;
|
|
35525
35614
|
const getRowValue = (row2) => $$.axis && $$.isBubbleZType(row2) ? $$.getBubbleZData(row2.value, "z") : $$.getBaseValue(row2);
|
|
@@ -35858,7 +35947,7 @@ function getTextXPos(pos = "left", width) {
|
|
|
35858
35947
|
if (tooltip && tooltip.style("display") !== "none" && (!config.tooltip_doNotHide || force)) {
|
|
35859
35948
|
const selectedData = JSON.parse((_a = tooltip.datum().current) != null ? _a : {});
|
|
35860
35949
|
callFn(config.tooltip_onhide, api, selectedData);
|
|
35861
|
-
tooltip.style("display", "none").
|
|
35950
|
+
tooltip.style("display", "none").datum(null);
|
|
35862
35951
|
callFn(config.tooltip_onhidden, api, selectedData);
|
|
35863
35952
|
}
|
|
35864
35953
|
},
|
|
@@ -37214,7 +37303,7 @@ function getGroupedDataPointsFn(d) {
|
|
|
37214
37303
|
* data2 data4 data2 data4
|
|
37215
37304
|
* -------------------------
|
|
37216
37305
|
* 0 1
|
|
37217
|
-
* @param {
|
|
37306
|
+
* @param {function} typeFilter Chart type filter function
|
|
37218
37307
|
* @returns {object} Indices object with its position
|
|
37219
37308
|
*/
|
|
37220
37309
|
getShapeIndices(typeFilter) {
|
|
@@ -37359,7 +37448,7 @@ function getGroupedDataPointsFn(d) {
|
|
|
37359
37448
|
},
|
|
37360
37449
|
/**
|
|
37361
37450
|
* Get Shape's offset data
|
|
37362
|
-
* @param {
|
|
37451
|
+
* @param {function} typeFilter Type filter function
|
|
37363
37452
|
* @returns {object}
|
|
37364
37453
|
* @private
|
|
37365
37454
|
*/
|
|
@@ -37860,14 +37949,18 @@ class ChartInternal {
|
|
|
37860
37949
|
if (hasInteraction && state.inputType) {
|
|
37861
37950
|
const isTouch = state.inputType === "touch";
|
|
37862
37951
|
const { onclick, onover, onout } = config;
|
|
37863
|
-
$el.svg.on("click", (onclick == null ? void 0 : onclick.bind($$.api)) || null).on(
|
|
37952
|
+
$el.svg.on("click", (onclick == null ? void 0 : onclick.bind($$.api)) || null).on(
|
|
37953
|
+
isTouch ? "touchstart" : "mouseenter",
|
|
37954
|
+
(onover == null ? void 0 : onover.bind($$.api)) || null,
|
|
37955
|
+
isTouch ? { passive: true } : void 0
|
|
37956
|
+
).on(isTouch ? "touchend" : "mouseleave", (onout == null ? void 0 : onout.bind($$.api)) || null);
|
|
37864
37957
|
}
|
|
37865
37958
|
config.svg_classname && $el.svg.attr("class", config.svg_classname);
|
|
37866
37959
|
const hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
|
|
37867
37960
|
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_a = $$.hasLegendDefsPoint) == null ? void 0 : _a.call($$))) {
|
|
37868
37961
|
$el.defs = $el.svg.append("defs");
|
|
37869
37962
|
if (hasAxis) {
|
|
37870
|
-
["id", "idXAxis", "idYAxis", "idGrid"].forEach((v) => {
|
|
37963
|
+
["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach((v) => {
|
|
37871
37964
|
$$.appendClip($el.defs, state.clip[v]);
|
|
37872
37965
|
});
|
|
37873
37966
|
}
|
|
@@ -38237,7 +38330,7 @@ function loadConfig(config) {
|
|
|
38237
38330
|
},
|
|
38238
38331
|
/**
|
|
38239
38332
|
* Force to redraw.
|
|
38240
|
-
* - **NOTE:** When zoom/subchart is used, the zoomed state will be
|
|
38333
|
+
* - **NOTE:** When zoom/subchart is used, the zoomed state will be reset.
|
|
38241
38334
|
* @function flush
|
|
38242
38335
|
* @instance
|
|
38243
38336
|
* @memberof Chart
|
|
@@ -38326,15 +38419,15 @@ function loadConfig(config) {
|
|
|
38326
38419
|
* Get or set config option value.
|
|
38327
38420
|
* - **NOTE**
|
|
38328
38421
|
* - The option key name must be specified as the last level.
|
|
38329
|
-
* -
|
|
38422
|
+
* - When no argument is given, it will return all specified generation options object only. (will exclude any other options not specified at the initialization)
|
|
38330
38423
|
* @function config
|
|
38331
38424
|
* @instance
|
|
38332
38425
|
* @memberof Chart
|
|
38333
38426
|
* @param {string} name The option key name.
|
|
38334
|
-
* @param {
|
|
38427
|
+
* @param {string|number|boolean|object|Array} [value] The value accepted for indicated option.
|
|
38335
38428
|
* @param {boolean} [redraw] Set to redraw with the new option changes.
|
|
38336
|
-
* - **NOTE:** Doesn't guarantee work in all circumstances. It can be applied for limited options only.
|
|
38337
|
-
* @returns {
|
|
38429
|
+
* - **NOTE:** Doesn't guarantee to work in all circumstances. It can be applied for limited options only.
|
|
38430
|
+
* @returns {string|number|boolean|object|Array} The option value or all options object
|
|
38338
38431
|
* @example
|
|
38339
38432
|
*
|
|
38340
38433
|
* // Getter
|
|
@@ -38431,7 +38524,7 @@ util_extend(api_data_data, {
|
|
|
38431
38524
|
* @function data․values
|
|
38432
38525
|
* @instance
|
|
38433
38526
|
* @memberof Chart
|
|
38434
|
-
* @param {string|Array|null} targetIds This API returns the values of specified target. If this argument is not given, null will be
|
|
38527
|
+
* @param {string|Array|null} targetIds This API returns the values of specified target. If this argument is not given, null will be returned
|
|
38435
38528
|
* @param {boolean} [flat=true] Get flatten values
|
|
38436
38529
|
* @returns {Array} Data values
|
|
38437
38530
|
* @example
|
|
@@ -38477,6 +38570,7 @@ util_extend(api_data_data, {
|
|
|
38477
38570
|
},
|
|
38478
38571
|
/**
|
|
38479
38572
|
* Get and set colors of the data loaded in the chart.
|
|
38573
|
+
* - **NOTE:** If gradient option is set, the color update will affect only gradient stops have the same color.
|
|
38480
38574
|
* @function data․colors
|
|
38481
38575
|
* @instance
|
|
38482
38576
|
* @memberof Chart
|
|
@@ -38682,7 +38776,7 @@ function renderText(ctx, glyph) {
|
|
|
38682
38776
|
* - Text element's position(especially "transformed") can't be preserved correctly according the page's layout condition.
|
|
38683
38777
|
* - If need to preserve accurate text position, embed the web font data within to the page and set `preserveFontStyle=false`.
|
|
38684
38778
|
* - Checkout the embed example: <a href="https://stackblitz.com/edit/zfbya9-8nf9nn?file=index.html">https://stackblitz.com/edit/zfbya9-8nf9nn?file=index.html</a>
|
|
38685
|
-
* @param {
|
|
38779
|
+
* @param {function(string): void} [callback] The callback to be invoked when export is ready.
|
|
38686
38780
|
* @returns {string} dataURI
|
|
38687
38781
|
* @example
|
|
38688
38782
|
* chart.export();
|
|
@@ -38936,7 +39030,7 @@ const legend_legend = {
|
|
|
38936
39030
|
* | categories | Array | The categories specified by axis.x.categories or data.x will be updated. categories must be Array. |
|
|
38937
39031
|
* | classes | Object | The classes specified by data.classes will be updated. classes must be Object that has target id as keys. |
|
|
38938
39032
|
* | colors | Object | The colors specified by data.colors will be updated. colors must be Object that has target id as keys. |
|
|
38939
|
-
* | data |
|
|
39033
|
+
* | data | Object | Data objects to be loaded. Checkout the example. |
|
|
38940
39034
|
* | done | Function | The specified function will be called after data loaded.|
|
|
38941
39035
|
* | headers | string | Set request header if loading via `data.url`.<br>@see [data․headers](Options.html#.data%25E2%2580%25A4headers) |
|
|
38942
39036
|
* | keys | Object | Choose which JSON objects keys correspond to desired data.<br>**NOTE:** Only for JSON object given as array.<br>@see [data․keys](Options.html#.data%25E2%2580%25A4keys) |
|
|
@@ -38995,7 +39089,7 @@ const legend_legend = {
|
|
|
38995
39089
|
*
|
|
38996
39090
|
* chart.load({
|
|
38997
39091
|
* columns: [
|
|
38998
|
-
* // when existing chart has `x` value, should provide
|
|
39092
|
+
* // when existing chart has `x` value, should provide corresponding 'x' value.
|
|
38999
39093
|
* // with 'append' option, the 'data1' will have `[36,30,24,37]`.
|
|
39000
39094
|
* ["x", "2021-02-01T08:00:00"],
|
|
39001
39095
|
* ["data1", 37]
|
|
@@ -39085,7 +39179,7 @@ const legend_legend = {
|
|
|
39085
39179
|
* | key | Type | Description |
|
|
39086
39180
|
* | --- | --- | --- |
|
|
39087
39181
|
* | ids | String | Array | Target id data to be unloaded. If not given, all data will be unloaded. |
|
|
39088
|
-
* | done |
|
|
39182
|
+
* | done | Function | Callback after data is unloaded. |
|
|
39089
39183
|
* | resizeAfter | boolean | Resize after the unload. Default value is `false`.<br>- This option won't call `onresize` neither `onresized`.<br>- When set to 'true', will call `.flush(true)` at the end of unload. |
|
|
39090
39184
|
* @example
|
|
39091
39185
|
* // Unload data2 and data3
|
|
@@ -39242,7 +39336,7 @@ const tooltip_tooltip = {
|
|
|
39242
39336
|
*
|
|
39243
39337
|
* @example
|
|
39244
39338
|
* // show the 2nd x Axis coordinate tooltip
|
|
39245
|
-
* // for Arc(gauge, donut & pie) and radar type,
|
|
39339
|
+
* // for Arc(gauge, donut & pie) and radar type, approach showing tooltip by using "index" number.
|
|
39246
39340
|
* chart.tooltip.show({
|
|
39247
39341
|
* index: 1
|
|
39248
39342
|
* });
|
|
@@ -39606,7 +39700,7 @@ util_extend(subchart, {
|
|
|
39606
39700
|
}
|
|
39607
39701
|
},
|
|
39608
39702
|
/**
|
|
39609
|
-
* Toggle the
|
|
39703
|
+
* Toggle the visibility of subchart
|
|
39610
39704
|
* - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`.
|
|
39611
39705
|
* @function subchart․toggle
|
|
39612
39706
|
* @instance
|
|
@@ -40703,7 +40797,7 @@ util_extend(zoom, {
|
|
|
40703
40797
|
},
|
|
40704
40798
|
/**
|
|
40705
40799
|
* Set zoom transform to event rect
|
|
40706
|
-
* @param {
|
|
40800
|
+
* @param {function} x x Axis scale function
|
|
40707
40801
|
* @param {Array} domain Domain value to be set
|
|
40708
40802
|
* @private
|
|
40709
40803
|
*/
|
|
@@ -41013,7 +41107,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
41013
41107
|
* Returns the toggle method of the target
|
|
41014
41108
|
* @param {object} that shape
|
|
41015
41109
|
* @param {object} d Data object
|
|
41016
|
-
* @returns {
|
|
41110
|
+
* @returns {function} toggle method
|
|
41017
41111
|
* @private
|
|
41018
41112
|
*/
|
|
41019
41113
|
getToggle(that, d) {
|
|
@@ -41112,7 +41206,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
41112
41206
|
* The callback will receive d as an argument and it has some parameters like id, value, index. This callback should return boolean.
|
|
41113
41207
|
* @name data․selection․isselectable
|
|
41114
41208
|
* @memberof Options
|
|
41115
|
-
* @type {
|
|
41209
|
+
* @type {function}
|
|
41116
41210
|
* @default function() { return true; }
|
|
41117
41211
|
* @example
|
|
41118
41212
|
* data: {
|
|
@@ -41124,7 +41218,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
41124
41218
|
data_selection_isselectable: () => true,
|
|
41125
41219
|
/**
|
|
41126
41220
|
* Set multiple data points selection enabled.<br><br>
|
|
41127
|
-
* If this option set true,
|
|
41221
|
+
* If this option set true, multiple data points can have the selected state at the same time. If false set, only one data point can have the selected state and the others will be unselected when the new data point is selected.
|
|
41128
41222
|
* @name data․selection․multiple
|
|
41129
41223
|
* @memberof Options
|
|
41130
41224
|
* @type {boolean}
|
|
@@ -41157,7 +41251,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
41157
41251
|
* Set a callback for on data selection.
|
|
41158
41252
|
* @name data․onselected
|
|
41159
41253
|
* @memberof Options
|
|
41160
|
-
* @type {
|
|
41254
|
+
* @type {function}
|
|
41161
41255
|
* @default function() {}
|
|
41162
41256
|
* @example
|
|
41163
41257
|
* data: {
|
|
@@ -41174,7 +41268,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
41174
41268
|
* Set a callback for on data un-selection.
|
|
41175
41269
|
* @name data․onunselected
|
|
41176
41270
|
* @memberof Options
|
|
41177
|
-
* @type {
|
|
41271
|
+
* @type {function}
|
|
41178
41272
|
* @default function() {}
|
|
41179
41273
|
* @example
|
|
41180
41274
|
* data: {
|
|
@@ -41204,11 +41298,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
41204
41298
|
* @property {boolean} [subchart.showHandle=false] Show sub chart's handle.
|
|
41205
41299
|
* @property {boolean} [subchart.axis.x.show=true] Show or hide x axis.
|
|
41206
41300
|
* @property {boolean} [subchart.axis.x.tick.show=true] Show or hide x axis tick line.
|
|
41207
|
-
* @property {
|
|
41301
|
+
* @property {function|string} [subchart.axis.x.tick.format] Use custom format for x axis ticks - see [axis.x.tick.format](#.axis․x․tick․format) for details.
|
|
41208
41302
|
* @property {boolean} [subchart.axis.x.tick.text.show=true] Show or hide x axis tick text.
|
|
41209
41303
|
* @property {Array} [subchart.init.range] Set initial selection domain range.
|
|
41210
41304
|
* @property {number} [subchart.size.height] Change the height of the subchart.
|
|
41211
|
-
* @property {
|
|
41305
|
+
* @property {function} [subchart.onbrush] Set callback for brush event.<br>
|
|
41212
41306
|
* Specified function receives the current zoomed x domain.
|
|
41213
41307
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Interaction.SubChart)
|
|
41214
41308
|
* @example
|
|
@@ -41277,14 +41371,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
41277
41371
|
* @property {Array} [zoom.extent=[1, 10]] Change zoom extent.
|
|
41278
41372
|
* @property {number|Date} [zoom.x.min] Set x Axis minimum zoom range
|
|
41279
41373
|
* @property {number|Date} [zoom.x.max] Set x Axis maximum zoom range
|
|
41280
|
-
* @property {
|
|
41374
|
+
* @property {function} [zoom.onzoomstart=undefined] Set callback that is called when zooming starts.<br>
|
|
41281
41375
|
* Specified function receives the zoom event.
|
|
41282
|
-
* @property {
|
|
41376
|
+
* @property {function} [zoom.onzoom=undefined] Set callback that is called when the chart is zooming.<br>
|
|
41283
41377
|
* Specified function receives the zoomed domain.
|
|
41284
|
-
* @property {
|
|
41378
|
+
* @property {function} [zoom.onzoomend=undefined] Set callback that is called when zooming ends.<br>
|
|
41285
41379
|
* Specified function receives the zoomed domain.
|
|
41286
41380
|
* @property {boolean|object} [zoom.resetButton=true] Set to display zoom reset button for 'drag' type zoom
|
|
41287
|
-
* @property {
|
|
41381
|
+
* @property {function} [zoom.resetButton.onclick] Set callback when clicks the reset button. The callback will receive reset button element reference as argument.
|
|
41288
41382
|
* @property {string} [zoom.resetButton.text='Reset Zoom'] Text value for zoom reset button.
|
|
41289
41383
|
* @see [Demo:zoom](https://naver.github.io/billboard.js/demo/#Interaction.Zoom)
|
|
41290
41384
|
* @see [Demo:drag zoom](https://naver.github.io/billboard.js/demo/#Interaction.DragZoom)
|
|
@@ -41655,7 +41749,7 @@ const axis = {
|
|
|
41655
41749
|
* - If json specified, keys is required as well as data.json.
|
|
41656
41750
|
* - If tab isn't visible(by evaluating `document.hidden`), will not be executed to prevent unnecessary work.
|
|
41657
41751
|
* @example
|
|
41658
|
-
* // 2 data points will be
|
|
41752
|
+
* // 2 data points will be appended to the tail and popped from the head.
|
|
41659
41753
|
* // After that, 4 data points will be appended and no data points will be poppoed.
|
|
41660
41754
|
* chart.flow({
|
|
41661
41755
|
* columns: [
|
|
@@ -42289,7 +42383,7 @@ class AxisRendererHelper {
|
|
|
42289
42383
|
/**
|
|
42290
42384
|
* Get tick transform setter function
|
|
42291
42385
|
* @param {string} id Axis id
|
|
42292
|
-
* @returns {
|
|
42386
|
+
* @returns {(selection: d3Selection, scale) => void} transfrom setter function
|
|
42293
42387
|
* @private
|
|
42294
42388
|
*/
|
|
42295
42389
|
getTickTransformSetter(id) {
|
|
@@ -43010,7 +43104,7 @@ class Axis_Axis {
|
|
|
43010
43104
|
}
|
|
43011
43105
|
tickValues && axis.tickValues(tickValues);
|
|
43012
43106
|
axis.tickFormat(
|
|
43013
|
-
tickFormat || !isX && ($$.isStackNormalized() && ((x) => `${x}%`))
|
|
43107
|
+
tickFormat || !isX && ($$.isStackNormalized() && $$.hasAxisGroupedData(id) && ((x) => `${x}%`))
|
|
43014
43108
|
);
|
|
43015
43109
|
if (isCategory) {
|
|
43016
43110
|
axis.tickCentered(config.axis_x_tick_centered);
|
|
@@ -43638,6 +43732,7 @@ class Axis_Axis {
|
|
|
43638
43732
|
const isPrevented = isBoolean(preventDefault) && preventDefault || false;
|
|
43639
43733
|
const preventThreshold = !isNaN(preventDefault) && preventDefault || null;
|
|
43640
43734
|
let startPx;
|
|
43735
|
+
const passiveOption = !isPrevented && preventThreshold === null;
|
|
43641
43736
|
const preventEvent = (event) => {
|
|
43642
43737
|
const eventType = event.type;
|
|
43643
43738
|
const touch = event.changedTouches[0];
|
|
@@ -43658,7 +43753,7 @@ class Axis_Axis {
|
|
|
43658
43753
|
eventRect.on("touchstart", (event) => {
|
|
43659
43754
|
state.event = event;
|
|
43660
43755
|
$$.updateEventRect();
|
|
43661
|
-
}).on("touchstart.eventRect touchmove.eventRect", (event) => {
|
|
43756
|
+
}, { passive: passiveOption }).on("touchstart.eventRect touchmove.eventRect", (event) => {
|
|
43662
43757
|
state.event = event;
|
|
43663
43758
|
if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
|
|
43664
43759
|
if (state.dragging || state.flowing || $$.hasArcType() || event.touches.length > 1) {
|
|
@@ -43669,21 +43764,21 @@ class Axis_Axis {
|
|
|
43669
43764
|
} else {
|
|
43670
43765
|
unselectRect();
|
|
43671
43766
|
}
|
|
43672
|
-
},
|
|
43767
|
+
}, { passive: passiveOption }).on("touchend.eventRect", (event) => {
|
|
43673
43768
|
state.event = event;
|
|
43674
43769
|
if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
|
|
43675
43770
|
if ($$.hasArcType() || !$$.toggleShape || state.cancelClick) {
|
|
43676
43771
|
state.cancelClick && (state.cancelClick = false);
|
|
43677
43772
|
}
|
|
43678
43773
|
}
|
|
43679
|
-
},
|
|
43774
|
+
}, { passive: passiveOption });
|
|
43680
43775
|
svg.on("touchstart", (event) => {
|
|
43681
43776
|
state.event = event;
|
|
43682
43777
|
const { target } = event;
|
|
43683
43778
|
if (target && target !== eventRect.node()) {
|
|
43684
43779
|
unselectRect();
|
|
43685
43780
|
}
|
|
43686
|
-
});
|
|
43781
|
+
}, { passive: passiveOption });
|
|
43687
43782
|
},
|
|
43688
43783
|
/**
|
|
43689
43784
|
* Update event rect size
|
|
@@ -43885,7 +43980,7 @@ class Axis_Axis {
|
|
|
43885
43980
|
const dist = $$.dist(closest, mouse);
|
|
43886
43981
|
if ($$.isBarType(closest.id) || dist < $$.getPointSensitivity(closest)) {
|
|
43887
43982
|
$$.$el.svg.select(`.${$EVENT.eventRect}`).style("cursor", "pointer");
|
|
43888
|
-
if (triggerEvent && !state.mouseover) {
|
|
43983
|
+
if (triggerEvent && (!state.mouseover || state.mouseover.x !== closest.x || state.mouseover.id !== closest.id)) {
|
|
43889
43984
|
config.data_onover.call($$.api, closest);
|
|
43890
43985
|
state.mouseover = closest;
|
|
43891
43986
|
}
|
|
@@ -44058,7 +44153,7 @@ const src_linear_linear = (t) => +t;
|
|
|
44058
44153
|
/**
|
|
44059
44154
|
* Generate flow
|
|
44060
44155
|
* @param {object} args option object
|
|
44061
|
-
* @returns {
|
|
44156
|
+
* @returns {function}
|
|
44062
44157
|
* @private
|
|
44063
44158
|
*/
|
|
44064
44159
|
generateFlow(args) {
|
|
@@ -45038,7 +45133,7 @@ function smoothLines(el, type) {
|
|
|
45038
45133
|
* A function to format tick value. Format string is also available for timeseries data.
|
|
45039
45134
|
* @name axis․x․tick․format
|
|
45040
45135
|
* @memberof Options
|
|
45041
|
-
* @type {
|
|
45136
|
+
* @type {function|string}
|
|
45042
45137
|
* @default undefined
|
|
45043
45138
|
* @see [D3's time specifier](https://d3js.org/d3-time-format#locale_format)
|
|
45044
45139
|
* @example
|
|
@@ -45067,7 +45162,7 @@ function smoothLines(el, type) {
|
|
|
45067
45162
|
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
45068
45163
|
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.x.tick.culling.lines=false`.
|
|
45069
45164
|
* - `false`: all of ticks will be shown.<br><br>
|
|
45070
|
-
* The number of ticks to be shown can be
|
|
45165
|
+
* The number of ticks to be shown can be changed by `axis.x.tick.culling.max`.
|
|
45071
45166
|
* @name axis․x․tick․culling
|
|
45072
45167
|
* @memberof Options
|
|
45073
45168
|
* @type {boolean}
|
|
@@ -45278,10 +45373,10 @@ function smoothLines(el, type) {
|
|
|
45278
45373
|
/**
|
|
45279
45374
|
* Set the x values of ticks manually.<br><br>
|
|
45280
45375
|
* If this option is provided, the position of the ticks will be determined based on those values.<br>
|
|
45281
|
-
* This option works with `timeseries` data and the x values will be parsed
|
|
45376
|
+
* This option works with `timeseries` data and the x values will be parsed according to the type of the value and data.xFormat option.
|
|
45282
45377
|
* @name axis․x․tick․values
|
|
45283
45378
|
* @memberof Options
|
|
45284
|
-
* @type {Array|
|
|
45379
|
+
* @type {Array|function}
|
|
45285
45380
|
* @default null
|
|
45286
45381
|
* @example
|
|
45287
45382
|
* axis: {
|
|
@@ -45502,7 +45597,7 @@ function smoothLines(el, type) {
|
|
|
45502
45597
|
* - **timeseries:** Numeric time value
|
|
45503
45598
|
* ex. the given value `1000*60*60*24`, which is numeric time equivalent of a day, is same as the width of 1 tick width
|
|
45504
45599
|
* - If want values to be treated as pixels, specify `unit:"px"`.
|
|
45505
|
-
* - The pixel value will be
|
|
45600
|
+
* - The pixel value will be converted based on the scale values. Hence can not reflect accurate padding result.
|
|
45506
45601
|
* @name axis․x․padding
|
|
45507
45602
|
* @memberof Options
|
|
45508
45603
|
* @type {object|number}
|
|
@@ -45553,7 +45648,7 @@ function smoothLines(el, type) {
|
|
|
45553
45648
|
* - **NOTE:** Specifying value, will limit the zoom scope selection within.
|
|
45554
45649
|
* @name axis․x․extent
|
|
45555
45650
|
* @memberof Options
|
|
45556
|
-
* @type {Array|
|
|
45651
|
+
* @type {Array|function}
|
|
45557
45652
|
* @default undefined
|
|
45558
45653
|
* @example
|
|
45559
45654
|
* axis: {
|
|
@@ -45819,7 +45914,7 @@ function smoothLines(el, type) {
|
|
|
45819
45914
|
* This option accepts d3.format object as well as a function you define.
|
|
45820
45915
|
* @name axis․y․tick․format
|
|
45821
45916
|
* @memberof Options
|
|
45822
|
-
* @type {
|
|
45917
|
+
* @type {function}
|
|
45823
45918
|
* @default undefined
|
|
45824
45919
|
* @example
|
|
45825
45920
|
* axis: {
|
|
@@ -45838,7 +45933,7 @@ function smoothLines(el, type) {
|
|
|
45838
45933
|
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
45839
45934
|
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y.tick.culling.lines=false`.
|
|
45840
45935
|
* - `false`: all of ticks will be shown.<br><br>
|
|
45841
|
-
* The number of ticks to be shown can be
|
|
45936
|
+
* The number of ticks to be shown can be changed by `axis.y.tick.culling.max`.
|
|
45842
45937
|
* @name axis․y․tick․culling
|
|
45843
45938
|
* @memberof Options
|
|
45844
45939
|
* @type {boolean}
|
|
@@ -45944,7 +46039,7 @@ function smoothLines(el, type) {
|
|
|
45944
46039
|
* Set y axis tick values manually.
|
|
45945
46040
|
* @name axis․y․tick․values
|
|
45946
46041
|
* @memberof Options
|
|
45947
|
-
* @type {Array|
|
|
46042
|
+
* @type {Array|function}
|
|
45948
46043
|
* @default null
|
|
45949
46044
|
* @example
|
|
45950
46045
|
* axis: {
|
|
@@ -46080,7 +46175,7 @@ function smoothLines(el, type) {
|
|
|
46080
46175
|
* @private
|
|
46081
46176
|
* @type {object}
|
|
46082
46177
|
* @property {object} time time object
|
|
46083
|
-
* @property {
|
|
46178
|
+
* @property {function} [time.value] D3's time interval function (https://github.com/d3/d3-time#intervals)
|
|
46084
46179
|
* @example
|
|
46085
46180
|
* axis: {
|
|
46086
46181
|
* y: {
|
|
@@ -46179,6 +46274,18 @@ function smoothLines(el, type) {
|
|
|
46179
46274
|
|
|
46180
46275
|
;// ./src/config/Options/axis/y2.ts
|
|
46181
46276
|
/* harmony default export */ var y2 = ({
|
|
46277
|
+
/**
|
|
46278
|
+
* Set clip-path attribute for y2 axis element
|
|
46279
|
+
* - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
|
|
46280
|
+
* @name axis․y2․clipPath
|
|
46281
|
+
* @memberof Options
|
|
46282
|
+
* @type {boolean}
|
|
46283
|
+
* @default true
|
|
46284
|
+
* @example
|
|
46285
|
+
* // don't set 'clip-path' attribute
|
|
46286
|
+
* clipPath: false
|
|
46287
|
+
*/
|
|
46288
|
+
axis_y2_clipPath: true,
|
|
46182
46289
|
/**
|
|
46183
46290
|
* Show or hide y2 axis.
|
|
46184
46291
|
* - **NOTE**:
|
|
@@ -46324,7 +46431,7 @@ function smoothLines(el, type) {
|
|
|
46324
46431
|
* This option works in the same way as axis.y.format.
|
|
46325
46432
|
* @name axis․y2․tick․format
|
|
46326
46433
|
* @memberof Options
|
|
46327
|
-
* @type {
|
|
46434
|
+
* @type {function}
|
|
46328
46435
|
* @default undefined
|
|
46329
46436
|
* @example
|
|
46330
46437
|
* axis: {
|
|
@@ -46342,7 +46449,7 @@ function smoothLines(el, type) {
|
|
|
46342
46449
|
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
46343
46450
|
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y2.tick.culling.lines=false`.
|
|
46344
46451
|
* - `false`: all of ticks will be shown.<br><br>
|
|
46345
|
-
* The number of ticks to be shown can be
|
|
46452
|
+
* The number of ticks to be shown can be changed by `axis.y2.tick.culling.max`.
|
|
46346
46453
|
* @name axis․y2․tick․culling
|
|
46347
46454
|
* @memberof Options
|
|
46348
46455
|
* @type {boolean}
|
|
@@ -46449,7 +46556,7 @@ function smoothLines(el, type) {
|
|
|
46449
46556
|
* Set y2 axis tick values manually.
|
|
46450
46557
|
* @name axis․y2․tick․values
|
|
46451
46558
|
* @memberof Options
|
|
46452
|
-
* @type {Array|
|
|
46559
|
+
* @type {Array|function}
|
|
46453
46560
|
* @default null
|
|
46454
46561
|
* @example
|
|
46455
46562
|
* axis: {
|
|
@@ -46681,16 +46788,16 @@ var axis_spreadValues = (a, b) => {
|
|
|
46681
46788
|
/**
|
|
46682
46789
|
* Setup the way to evaluate tick text size.
|
|
46683
46790
|
* - **NOTE:**
|
|
46684
|
-
* -
|
|
46791
|
+
* - When setting `false` or a custom evaluator, it is highly recommended to memoize evaluated text dimension value to not degrade performance.
|
|
46685
46792
|
* @name axis․evalTextSize
|
|
46686
46793
|
* @memberof Options
|
|
46687
|
-
* @type {boolean|
|
|
46794
|
+
* @type {boolean|function}
|
|
46688
46795
|
* @default true
|
|
46689
46796
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.AxisEvalTextSize)
|
|
46690
46797
|
* @example
|
|
46691
46798
|
* axis: {
|
|
46692
46799
|
* // will evaluate getting text size every time.
|
|
46693
|
-
* evalTextSize: false
|
|
46800
|
+
* evalTextSize: false,
|
|
46694
46801
|
*
|
|
46695
46802
|
* // set a custom evaluator
|
|
46696
46803
|
* evalTextSize: function(textElement, axisId) {
|
|
@@ -46734,8 +46841,8 @@ var axis_spreadValues = (a, b) => {
|
|
|
46734
46841
|
* Set axis tooltip.
|
|
46735
46842
|
* - **NOTE:**
|
|
46736
46843
|
* - When enabled, will disable default focus grid line.
|
|
46737
|
-
* - For `timeseries` x Axis,
|
|
46738
|
-
* - For `category` x Axis,
|
|
46844
|
+
* - For `timeseries` x Axis, tooltip will be formatted using x Axis' tick format.
|
|
46845
|
+
* - For `category` x Axis, tooltip will be displaying scales' value text.
|
|
46739
46846
|
* @name axis․tooltip
|
|
46740
46847
|
* @memberof Options
|
|
46741
46848
|
* @type {boolean}
|
|
@@ -46748,11 +46855,11 @@ var axis_spreadValues = (a, b) => {
|
|
|
46748
46855
|
* axis: {
|
|
46749
46856
|
* tooltip: true, // default background color is
|
|
46750
46857
|
*
|
|
46751
|
-
* // set
|
|
46858
|
+
* // set background color for axis tooltip texts
|
|
46752
46859
|
* tooltip: {
|
|
46753
46860
|
* backgroundColor: "red",
|
|
46754
46861
|
*
|
|
46755
|
-
* // set
|
|
46862
|
+
* // set different background colors per axes
|
|
46756
46863
|
* // NOTE: In this case, only specified axes tooltip will appear.
|
|
46757
46864
|
* backgroundColor: {
|
|
46758
46865
|
* x: "green",
|
|
@@ -46857,7 +46964,7 @@ var axis_spreadValues = (a, b) => {
|
|
|
46857
46964
|
*/
|
|
46858
46965
|
data_xs: {},
|
|
46859
46966
|
/**
|
|
46860
|
-
* Set a format specifier to parse string
|
|
46967
|
+
* Set a format specifier to parse string specified as x.
|
|
46861
46968
|
* @name data․xFormat
|
|
46862
46969
|
* @memberof Options
|
|
46863
46970
|
* @type {string}
|
|
@@ -46906,7 +47013,7 @@ var axis_spreadValues = (a, b) => {
|
|
|
46906
47013
|
* x: "x",
|
|
46907
47014
|
* columns: [
|
|
46908
47015
|
* // The line graph will start to be drawn following the x axis sequence
|
|
46909
|
-
* // Below data,
|
|
47016
|
+
* // Below data, will start drawing x=1: 200, x=2: 300, x=3: 100
|
|
46910
47017
|
* ["x", 3, 1, 2],
|
|
46911
47018
|
* ["data1", 100, 200, 300]
|
|
46912
47019
|
* ]
|
|
@@ -46967,16 +47074,41 @@ var axis_spreadValues = (a, b) => {
|
|
|
46967
47074
|
* - **NOTE:**
|
|
46968
47075
|
* - For stacking, '[data.groups](#.data%25E2%2580%25A4groups)' option should be set
|
|
46969
47076
|
* - y Axis will be set in percentage value (0 ~ 100%)
|
|
46970
|
-
* - Must have
|
|
47077
|
+
* - Must have positive values
|
|
47078
|
+
* - Data not in any group will not be normalized when using perGroup option
|
|
46971
47079
|
* @name data․stack․normalize
|
|
46972
47080
|
* @memberof Options
|
|
46973
|
-
* @type {boolean}
|
|
47081
|
+
* @type {boolean|object}
|
|
46974
47082
|
* @default false
|
|
46975
|
-
* @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataStackNormalized)
|
|
47083
|
+
* @see [Demo: Data Stack Normalized](https://naver.github.io/billboard.js/demo/#Data.DataStackNormalized)
|
|
47084
|
+
* @see [Demo: Data Stack Normalized per Group](https://naver.github.io/billboard.js/demo/#Data.DataStackNormalizedGroup)
|
|
46976
47085
|
* @example
|
|
46977
47086
|
* data: {
|
|
46978
47087
|
* stack: {
|
|
47088
|
+
* // Normalize all grouped data together (all groups combined to 0-100%)
|
|
46979
47089
|
* normalize: true
|
|
47090
|
+
*
|
|
47091
|
+
* // Normalize per group (each group independently becomes 0-100%)
|
|
47092
|
+
* // Data not in any group will display with their original values.
|
|
47093
|
+
* // If non-grouped data shares the same axis (e.g., y), it will be
|
|
47094
|
+
* // displayed on the 0-100 absolute scale. To display original values,
|
|
47095
|
+
* // assign them to a separate axis (e.g., y2).
|
|
47096
|
+
* normalize: {
|
|
47097
|
+
* perGroup: true
|
|
47098
|
+
* }
|
|
47099
|
+
* },
|
|
47100
|
+
* groups: [
|
|
47101
|
+
* ["data1", "data2"] // This group will be normalized to 0-100%
|
|
47102
|
+
* ],
|
|
47103
|
+
* // data3 is not in any group, so it displays original values
|
|
47104
|
+
* // Assign it to y2 axis to use a separate scale
|
|
47105
|
+
* axes: {
|
|
47106
|
+
* data3: "y2"
|
|
47107
|
+
* }
|
|
47108
|
+
* },
|
|
47109
|
+
* axis: {
|
|
47110
|
+
* y2: {
|
|
47111
|
+
* show: true
|
|
46980
47112
|
* }
|
|
46981
47113
|
* }
|
|
46982
47114
|
*/
|
|
@@ -47347,6 +47479,155 @@ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
|
|
|
47347
47479
|
return arc;
|
|
47348
47480
|
}
|
|
47349
47481
|
|
|
47482
|
+
;// ./src/ChartInternal/internals/text.arc.ts
|
|
47483
|
+
|
|
47484
|
+
|
|
47485
|
+
|
|
47486
|
+
|
|
47487
|
+
const BREAK_POINT_OFFSET = 15;
|
|
47488
|
+
const DEFAULT_LINE_DISTANCE = 20;
|
|
47489
|
+
const TEXT_VERTICAL_OFFSET = 0.35;
|
|
47490
|
+
function getArcType(excludeMultiGauge = false) {
|
|
47491
|
+
const $$ = this;
|
|
47492
|
+
return ["donut", "pie", "polar", "gauge"].find(
|
|
47493
|
+
(type) => $$.hasType(type) && !(type === "gauge" && excludeMultiGauge && $$.hasMultiArcGauge())
|
|
47494
|
+
);
|
|
47495
|
+
}
|
|
47496
|
+
function getConfig() {
|
|
47497
|
+
const $$ = this;
|
|
47498
|
+
const { config } = $$;
|
|
47499
|
+
const chartType = getArcType.call($$, true);
|
|
47500
|
+
const lineConfig = chartType && config[`${chartType}_label_line`];
|
|
47501
|
+
const isValidConfig = isObjectType(lineConfig);
|
|
47502
|
+
const defaultFormatter = (value, ratio, id) => id;
|
|
47503
|
+
const line = {
|
|
47504
|
+
show: lineConfig === true || isValidConfig && (lineConfig == null ? void 0 : lineConfig.show) !== false,
|
|
47505
|
+
distance: isValidConfig && (lineConfig == null ? void 0 : lineConfig.distance) || DEFAULT_LINE_DISTANCE
|
|
47506
|
+
};
|
|
47507
|
+
if (lineConfig === true) {
|
|
47508
|
+
return {
|
|
47509
|
+
chartType,
|
|
47510
|
+
line,
|
|
47511
|
+
text: { formatter: defaultFormatter }
|
|
47512
|
+
};
|
|
47513
|
+
}
|
|
47514
|
+
if (!isValidConfig) {
|
|
47515
|
+
return {
|
|
47516
|
+
chartType,
|
|
47517
|
+
line: { show: false, distance: DEFAULT_LINE_DISTANCE },
|
|
47518
|
+
text: { formatter: null }
|
|
47519
|
+
};
|
|
47520
|
+
}
|
|
47521
|
+
let formatter = defaultFormatter;
|
|
47522
|
+
if (isFunction(lineConfig.text)) {
|
|
47523
|
+
formatter = lineConfig.text;
|
|
47524
|
+
} else if (lineConfig.text === false) {
|
|
47525
|
+
formatter = null;
|
|
47526
|
+
}
|
|
47527
|
+
return {
|
|
47528
|
+
chartType,
|
|
47529
|
+
line,
|
|
47530
|
+
text: { formatter }
|
|
47531
|
+
};
|
|
47532
|
+
}
|
|
47533
|
+
function getLinePosition(d, lineDistance) {
|
|
47534
|
+
const $$ = this;
|
|
47535
|
+
const { state } = $$;
|
|
47536
|
+
const updated = $$.updateAngle(d);
|
|
47537
|
+
if (!updated) {
|
|
47538
|
+
return null;
|
|
47539
|
+
}
|
|
47540
|
+
let { outerRadius } = $$.getRadius(d);
|
|
47541
|
+
let arcOuterRadius = outerRadius;
|
|
47542
|
+
if ($$.hasType("polar")) {
|
|
47543
|
+
arcOuterRadius = $$.getPolarOuterRadius(d, outerRadius);
|
|
47544
|
+
outerRadius = state.radius;
|
|
47545
|
+
}
|
|
47546
|
+
let midAngle = (updated.startAngle + updated.endAngle) / 2;
|
|
47547
|
+
const isFullCircleArc = Math.abs(updated.endAngle - updated.startAngle - 2 * Math.PI) < 0.01;
|
|
47548
|
+
if (isFullCircleArc) {
|
|
47549
|
+
midAngle = Math.PI / 2;
|
|
47550
|
+
}
|
|
47551
|
+
const sinAngle = Math.sin(midAngle);
|
|
47552
|
+
const cosAngle = -Math.cos(midAngle);
|
|
47553
|
+
const startPoint = {
|
|
47554
|
+
x: sinAngle * arcOuterRadius,
|
|
47555
|
+
y: cosAngle * arcOuterRadius
|
|
47556
|
+
};
|
|
47557
|
+
const breakRadius = outerRadius + BREAK_POINT_OFFSET;
|
|
47558
|
+
const breakPoint = {
|
|
47559
|
+
x: sinAngle * breakRadius,
|
|
47560
|
+
y: cosAngle * breakRadius
|
|
47561
|
+
};
|
|
47562
|
+
const isRight = sinAngle >= 0;
|
|
47563
|
+
const endPoint = {
|
|
47564
|
+
x: breakPoint.x + lineDistance * (isRight ? 1 : -1),
|
|
47565
|
+
y: breakPoint.y
|
|
47566
|
+
};
|
|
47567
|
+
return { startPoint, breakPoint, endPoint, isRight, midAngle };
|
|
47568
|
+
}
|
|
47569
|
+
function isLabelWithLine() {
|
|
47570
|
+
return getConfig.call(this).line.show;
|
|
47571
|
+
}
|
|
47572
|
+
function redrawArcLabelLines(duration) {
|
|
47573
|
+
const $$ = this;
|
|
47574
|
+
const { $el: { arcs }, $T } = $$;
|
|
47575
|
+
const { line: lineConfig, text: textConfig } = getConfig.call($$);
|
|
47576
|
+
const lineDistance = lineConfig.distance;
|
|
47577
|
+
let cachedFontSize = null;
|
|
47578
|
+
arcs.selectAll(`.${$ARC.chartArc}`).each(function(d) {
|
|
47579
|
+
var _a, _b, _c;
|
|
47580
|
+
const g = src_select(this);
|
|
47581
|
+
const linePos = getLinePosition.call($$, d, lineDistance);
|
|
47582
|
+
const { ratio, meetsThreshold, updated } = (_a = d._cache) != null ? _a : {};
|
|
47583
|
+
if (!updated || !linePos) {
|
|
47584
|
+
return;
|
|
47585
|
+
}
|
|
47586
|
+
const isVisible = $$.isTargetToShow(d.data.id) && meetsThreshold;
|
|
47587
|
+
const { startPoint, breakPoint, endPoint, isRight } = linePos;
|
|
47588
|
+
const points = `${startPoint.x},${startPoint.y} ${breakPoint.x},${breakPoint.y} ${endPoint.x},${endPoint.y}`;
|
|
47589
|
+
if (lineConfig.show) {
|
|
47590
|
+
let line = g.select(`.${$ARC.arcLabelLine}`);
|
|
47591
|
+
if (line.empty()) {
|
|
47592
|
+
line = g.append("polyline").attr("class", $ARC.arcLabelLine);
|
|
47593
|
+
}
|
|
47594
|
+
$T(line, duration).attr("points", points).style("stroke", $$.color(d.data)).style("opacity", isVisible ? null : "0");
|
|
47595
|
+
}
|
|
47596
|
+
let labelLineText = g.select(`.${$ARC.arcLabelLineText}`);
|
|
47597
|
+
if (labelLineText.empty()) {
|
|
47598
|
+
labelLineText = g.append("text").attr("class", $ARC.arcLabelLineText).style("pointer-events", "none");
|
|
47599
|
+
}
|
|
47600
|
+
if (isVisible) {
|
|
47601
|
+
const { value } = updated;
|
|
47602
|
+
const { id } = d.data;
|
|
47603
|
+
const text = ((_c = (_b = textConfig.formatter) != null ? _b : $$.getArcLabelConfig("format")) != null ? _c : $$.defaultArcValueFormat)(value, ratio, id).toString();
|
|
47604
|
+
setTextValue(labelLineText, text, [-1, 1], false);
|
|
47605
|
+
const pos = {
|
|
47606
|
+
x: endPoint.x + 5 * (isRight ? 1 : -1),
|
|
47607
|
+
// 5: label offset from endpoint
|
|
47608
|
+
y: endPoint.y
|
|
47609
|
+
};
|
|
47610
|
+
labelLineText.style("text-anchor", isRight ? "start" : "end");
|
|
47611
|
+
const textNode = labelLineText.node();
|
|
47612
|
+
const tspanNodes = textNode == null ? void 0 : textNode.querySelectorAll("tspan");
|
|
47613
|
+
if (cachedFontSize === null) {
|
|
47614
|
+
cachedFontSize = parseFloat(win.getComputedStyle(textNode).fontSize) || 12;
|
|
47615
|
+
}
|
|
47616
|
+
if (tspanNodes && tspanNodes.length > 1) {
|
|
47617
|
+
const lineCount = tspanNodes.length;
|
|
47618
|
+
const centerOffset = (lineCount - 3) / 2;
|
|
47619
|
+
pos.y += (-centerOffset + TEXT_VERTICAL_OFFSET) * cachedFontSize;
|
|
47620
|
+
} else {
|
|
47621
|
+
pos.y += TEXT_VERTICAL_OFFSET * cachedFontSize;
|
|
47622
|
+
}
|
|
47623
|
+
$T(labelLineText, duration).attr("transform", `translate(${pos.x},${pos.y})`).style("opacity", null).style("fill", $$.updateTextColor.bind($$)(d));
|
|
47624
|
+
} else {
|
|
47625
|
+
$T(labelLineText, duration).style("opacity", "0");
|
|
47626
|
+
}
|
|
47627
|
+
});
|
|
47628
|
+
}
|
|
47629
|
+
|
|
47630
|
+
|
|
47350
47631
|
;// ./src/ChartInternal/shape/arc.ts
|
|
47351
47632
|
var arc_defProp = Object.defineProperty;
|
|
47352
47633
|
var arc_defProps = Object.defineProperties;
|
|
@@ -47374,6 +47655,62 @@ var arc_spreadProps = (a, b) => arc_defProps(a, arc_getOwnPropDescs(b));
|
|
|
47374
47655
|
|
|
47375
47656
|
|
|
47376
47657
|
|
|
47658
|
+
|
|
47659
|
+
function arc_getArcType($$) {
|
|
47660
|
+
return ["donut", "pie", "polar", "gauge"].find((type) => $$.hasType(type));
|
|
47661
|
+
}
|
|
47662
|
+
function calculateRangeOrGaugePosition($$, d, updated, forRange) {
|
|
47663
|
+
var _a, _b;
|
|
47664
|
+
const { config, state: { radiusExpanded } } = $$;
|
|
47665
|
+
const angle = updated.endAngle - Math.PI / 2;
|
|
47666
|
+
const sinAngle = Math.sin(angle);
|
|
47667
|
+
const pos = {
|
|
47668
|
+
x: Math.cos(angle) * (radiusExpanded + (forRange ? 5 : 25)),
|
|
47669
|
+
// 5: range offset, 25: gauge offset
|
|
47670
|
+
y: sinAngle * (radiusExpanded + 15 - Math.abs(sinAngle * 10)) + 3
|
|
47671
|
+
// 10: y factor, 3: y offset
|
|
47672
|
+
};
|
|
47673
|
+
if (forRange) {
|
|
47674
|
+
const rangeTextPosition = config.arc_rangeText_position;
|
|
47675
|
+
if (rangeTextPosition) {
|
|
47676
|
+
const rangeValues = config.arc_rangeText_values;
|
|
47677
|
+
const position = isFunction(rangeTextPosition) ? rangeTextPosition(rangeValues[d.index]) : rangeTextPosition;
|
|
47678
|
+
pos.x += (_a = position == null ? void 0 : position.x) != null ? _a : 0;
|
|
47679
|
+
pos.y += (_b = position == null ? void 0 : position.y) != null ? _b : 0;
|
|
47680
|
+
}
|
|
47681
|
+
}
|
|
47682
|
+
return pos;
|
|
47683
|
+
}
|
|
47684
|
+
function calculateLabelRatio($$, d, outerRadius, distance) {
|
|
47685
|
+
const { config } = $$;
|
|
47686
|
+
const chartType = arc_getArcType($$);
|
|
47687
|
+
let ratio = chartType ? config[`${chartType}_label_ratio`] : void 0;
|
|
47688
|
+
if (ratio) {
|
|
47689
|
+
ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, distance) : ratio;
|
|
47690
|
+
} else {
|
|
47691
|
+
const LABEL_MIN_SIZE = 36;
|
|
47692
|
+
const LABEL_RATIO_THRESHOLD = 0.375;
|
|
47693
|
+
const LABEL_RATIO_BASE = 1.175;
|
|
47694
|
+
const LABEL_RATIO_LARGE = 0.8;
|
|
47695
|
+
const labelSpaceRatio = LABEL_MIN_SIZE / outerRadius;
|
|
47696
|
+
const isSmallChart = labelSpaceRatio > LABEL_RATIO_THRESHOLD;
|
|
47697
|
+
ratio = outerRadius && distance ? (isSmallChart ? LABEL_RATIO_BASE - labelSpaceRatio : LABEL_RATIO_LARGE) * outerRadius / distance : 0;
|
|
47698
|
+
}
|
|
47699
|
+
return ratio;
|
|
47700
|
+
}
|
|
47701
|
+
function calculateStandardArcPosition($$, d, updated) {
|
|
47702
|
+
let { outerRadius } = $$.getRadius(d);
|
|
47703
|
+
if ($$.hasType("polar")) {
|
|
47704
|
+
outerRadius = $$.getPolarOuterRadius(d, outerRadius);
|
|
47705
|
+
}
|
|
47706
|
+
const [x, y] = $$.svgArc.centroid(updated).map((v) => isNaN(v) ? 0 : v);
|
|
47707
|
+
const distance = Math.sqrt(x * x + y * y);
|
|
47708
|
+
const ratio = calculateLabelRatio($$, d, outerRadius, distance);
|
|
47709
|
+
return {
|
|
47710
|
+
pos: { x, y },
|
|
47711
|
+
ratio
|
|
47712
|
+
};
|
|
47713
|
+
}
|
|
47377
47714
|
function getRadiusFn(expandRate = 0) {
|
|
47378
47715
|
const $$ = this;
|
|
47379
47716
|
const { config, state } = $$;
|
|
@@ -47481,7 +47818,9 @@ function getAttrTweenFn(fn) {
|
|
|
47481
47818
|
const padding = config[`${dataType}_padding`];
|
|
47482
47819
|
const w = config.gauge_width || config.donut_width;
|
|
47483
47820
|
const gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length * config.gauge_arcs_minWidth;
|
|
47484
|
-
|
|
47821
|
+
const LABEL_RADIUS_RATIO = 0.85;
|
|
47822
|
+
const labelWithLineRatio = isLabelWithLine.call($$) ? LABEL_RADIUS_RATIO : 1;
|
|
47823
|
+
state.radiusExpanded = Math.min(state.arcWidth, state.arcHeight) / 2 * ($$.hasMultiArcGauge() && config.gauge_label_show ? LABEL_RADIUS_RATIO : labelWithLineRatio);
|
|
47485
47824
|
state.radius = state.radiusExpanded * 0.95;
|
|
47486
47825
|
state.innerRadiusRatio = w ? (state.radius - w) / state.radius : 0.6;
|
|
47487
47826
|
state.gaugeArcWidth = w || (gaugeArcWidth <= state.radius - state.innerRadius ? state.radius - state.innerRadius : gaugeArcWidth <= state.radius ? gaugeArcWidth : state.radius);
|
|
@@ -47620,7 +47959,7 @@ function getAttrTweenFn(fn) {
|
|
|
47620
47959
|
/**
|
|
47621
47960
|
* Get expanded arc path function
|
|
47622
47961
|
* @param {number} rate Expand rate
|
|
47623
|
-
* @returns {
|
|
47962
|
+
* @returns {function} Expanded arc path getter function
|
|
47624
47963
|
* @private
|
|
47625
47964
|
*/
|
|
47626
47965
|
getSvgArcExpanded(rate = 1) {
|
|
@@ -47683,46 +48022,24 @@ function getAttrTweenFn(fn) {
|
|
|
47683
48022
|
* @private
|
|
47684
48023
|
*/
|
|
47685
48024
|
transformForArcLabel(textNode, d, forRange = false) {
|
|
47686
|
-
var _a, _b, _c;
|
|
47687
48025
|
const $$ = this;
|
|
47688
|
-
const { config, state: { radiusExpanded } } = $$;
|
|
47689
48026
|
const updated = $$.updateAngle(d, forRange);
|
|
47690
|
-
|
|
47691
|
-
|
|
48027
|
+
if (!updated) {
|
|
48028
|
+
return "";
|
|
48029
|
+
}
|
|
48030
|
+
let pos;
|
|
47692
48031
|
let ratio = 1;
|
|
47693
|
-
if (
|
|
47694
|
-
|
|
47695
|
-
|
|
47696
|
-
|
|
47697
|
-
|
|
47698
|
-
|
|
47699
|
-
|
|
47700
|
-
|
|
47701
|
-
const position = isFunction(rangeTextPosition) ? rangeTextPosition(rangeValues[d.index]) : rangeTextPosition;
|
|
47702
|
-
pos.x += (_a = position == null ? void 0 : position.x) != null ? _a : 0;
|
|
47703
|
-
pos.y += (_b = position == null ? void 0 : position.y) != null ? _b : 0;
|
|
47704
|
-
}
|
|
47705
|
-
} else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
|
47706
|
-
let { outerRadius } = $$.getRadius(d);
|
|
47707
|
-
if ($$.hasType("polar")) {
|
|
47708
|
-
outerRadius = $$.getPolarOuterRadius(d, outerRadius);
|
|
47709
|
-
}
|
|
47710
|
-
const c = this.svgArc.centroid(updated);
|
|
47711
|
-
const [x, y] = c.map((v) => isNaN(v) ? 0 : v);
|
|
47712
|
-
const h = Math.sqrt(x * x + y * y);
|
|
47713
|
-
pos.x = x;
|
|
47714
|
-
pos.y = y;
|
|
47715
|
-
ratio = (_c = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).map((v) => config[`${v}_label_ratio`])) == null ? void 0 : _c[0];
|
|
47716
|
-
if (ratio) {
|
|
47717
|
-
ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
|
|
47718
|
-
} else {
|
|
47719
|
-
ratio = outerRadius && (h ? (36 / outerRadius > 0.375 ? 1.175 - 36 / outerRadius : 0.8) * outerRadius / h : 0);
|
|
47720
|
-
}
|
|
47721
|
-
}
|
|
47722
|
-
updateTextImagePos.call($$, textNode, pos);
|
|
47723
|
-
translate = `translate(${pos.x * ratio},${pos.y * ratio})`;
|
|
48032
|
+
if (forRange || $$.hasMultiArcGauge()) {
|
|
48033
|
+
pos = calculateRangeOrGaugePosition($$, d, updated, forRange);
|
|
48034
|
+
} else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
|
48035
|
+
const result = calculateStandardArcPosition($$, d, updated);
|
|
48036
|
+
pos = result.pos;
|
|
48037
|
+
ratio = result.ratio;
|
|
48038
|
+
} else {
|
|
48039
|
+
return "";
|
|
47724
48040
|
}
|
|
47725
|
-
|
|
48041
|
+
updateTextImagePos.call($$, textNode, pos);
|
|
48042
|
+
return `translate(${pos.x * ratio},${pos.y * ratio})`;
|
|
47726
48043
|
},
|
|
47727
48044
|
convertToArcData(d) {
|
|
47728
48045
|
return this.addName({
|
|
@@ -47733,20 +48050,18 @@ function getAttrTweenFn(fn) {
|
|
|
47733
48050
|
});
|
|
47734
48051
|
},
|
|
47735
48052
|
textForArcLabel(selection) {
|
|
48053
|
+
var _a;
|
|
47736
48054
|
const $$ = this;
|
|
47737
48055
|
const hasGauge = $$.hasType("gauge");
|
|
48056
|
+
const chartType = (_a = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _a[0];
|
|
47738
48057
|
if ($$.shouldShowArcLabel()) {
|
|
47739
48058
|
selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", (d) => $$.updateTextBGColor.bind($$)(d, $$.config.data_labels_backgroundColors)).each(function(d) {
|
|
47740
|
-
var _a;
|
|
47741
48059
|
const node = src_select(this);
|
|
47742
48060
|
const updated = $$.updateAngle(d);
|
|
47743
48061
|
const ratio = $$.getRatio("arc", updated);
|
|
47744
|
-
const
|
|
47745
|
-
|
|
47746
|
-
|
|
47747
|
-
(_a = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _a[0]
|
|
47748
|
-
);
|
|
47749
|
-
if (isUnderThreshold) {
|
|
48062
|
+
const meetsThreshold = meetsLabelThreshold.call($$, ratio, chartType);
|
|
48063
|
+
d._cache = { updated, ratio, meetsThreshold };
|
|
48064
|
+
if (meetsThreshold) {
|
|
47750
48065
|
const { value } = updated || d;
|
|
47751
48066
|
const text = ($$.getArcLabelConfig("format") || $$.defaultArcValueFormat)(value, ratio, d.data.id).toString();
|
|
47752
48067
|
setTextValue(node, text, [-1, 1], hasGauge);
|
|
@@ -47853,7 +48168,7 @@ function getAttrTweenFn(fn) {
|
|
|
47853
48168
|
])
|
|
47854
48169
|
);
|
|
47855
48170
|
mainPieEnter.append("g").attr("class", classArcs).merge(mainPieUpdate);
|
|
47856
|
-
mainPieEnter.append("text").attr("dy", hasGauge && !$$.hasMultiTargets() ? "-.1em" :
|
|
48171
|
+
mainPieEnter.append("text").attr("dy", hasGauge && !$$.hasMultiTargets() ? "-.1em" : null).style("opacity", "0").style("text-anchor", $$.getStylePropValue("middle")).style("pointer-events", $$.getStylePropValue("none"));
|
|
47857
48172
|
$el.text = chartArcs.selectAll(`.${$COMMON.target} text`);
|
|
47858
48173
|
},
|
|
47859
48174
|
initArc() {
|
|
@@ -48163,7 +48478,7 @@ function getAttrTweenFn(fn) {
|
|
|
48163
48478
|
const id = (arcData == null ? void 0 : arcData.id) || void 0;
|
|
48164
48479
|
$$.callOverOutForTouch(arcData);
|
|
48165
48480
|
isUndefined(id) ? unselectArc() : selectArc(this, arcData, id);
|
|
48166
|
-
});
|
|
48481
|
+
}, { passive: true });
|
|
48167
48482
|
}
|
|
48168
48483
|
},
|
|
48169
48484
|
redrawArcText(duration) {
|
|
@@ -48193,6 +48508,7 @@ function getAttrTweenFn(fn) {
|
|
|
48193
48508
|
!isFullCircle && arcs.select(`.${$GAUGE.chartArcsGaugeMax}`).attr("dx", `${state.innerRadius + (state.radius - state.innerRadius) / 2}px`).attr("dy", "1.2em").text($$.textForGaugeMinMax(config.gauge_max, true));
|
|
48194
48509
|
}
|
|
48195
48510
|
}
|
|
48511
|
+
isLabelWithLine.call($$) && redrawArcLabelLines.call($$, duration);
|
|
48196
48512
|
},
|
|
48197
48513
|
/**
|
|
48198
48514
|
* Get Arc element by id or index
|
|
@@ -48379,7 +48695,7 @@ function point_y(p) {
|
|
|
48379
48695
|
},
|
|
48380
48696
|
/**
|
|
48381
48697
|
* Redraw function
|
|
48382
|
-
* @param {
|
|
48698
|
+
* @param {function} drawFn Retuned functino from .generateDrawCandlestick()
|
|
48383
48699
|
* @param {boolean} withTransition With or without transition
|
|
48384
48700
|
* @param {boolean} isSub Subchart draw
|
|
48385
48701
|
* @returns {Array}
|
|
@@ -48399,7 +48715,7 @@ function point_y(p) {
|
|
|
48399
48715
|
* Generate area path data
|
|
48400
48716
|
* @param {object} areaIndices Indices
|
|
48401
48717
|
* @param {boolean} isSub Weather is sub axis
|
|
48402
|
-
* @returns {
|
|
48718
|
+
* @returns {function}
|
|
48403
48719
|
* @private
|
|
48404
48720
|
*/
|
|
48405
48721
|
generateDrawArea(areaIndices, isSub) {
|
|
@@ -48543,7 +48859,7 @@ function getConnectLineType(id) {
|
|
|
48543
48859
|
},
|
|
48544
48860
|
/**
|
|
48545
48861
|
* Redraw function
|
|
48546
|
-
* @param {
|
|
48862
|
+
* @param {function} drawFn Retuned function from .getDrawShape() => .generateDrawBar()
|
|
48547
48863
|
* @param {boolean} withTransition With or without transition
|
|
48548
48864
|
* @param {boolean} isSub Subchart draw
|
|
48549
48865
|
* @returns {Array}
|
|
@@ -48590,7 +48906,7 @@ function getConnectLineType(id) {
|
|
|
48590
48906
|
* -------------------------
|
|
48591
48907
|
* 0 1
|
|
48592
48908
|
* @param {boolean} isSub If is for subchart
|
|
48593
|
-
* @returns {
|
|
48909
|
+
* @returns {function}
|
|
48594
48910
|
* @private
|
|
48595
48911
|
*/
|
|
48596
48912
|
generateDrawBar(barIndices, isSub) {
|
|
@@ -48885,7 +49201,7 @@ var candlestick_spreadValues = (a, b) => {
|
|
|
48885
49201
|
* Get draw function
|
|
48886
49202
|
* @param {object} indices Indice data
|
|
48887
49203
|
* @param {boolean} isSub Subchart draw
|
|
48888
|
-
* @returns {
|
|
49204
|
+
* @returns {function}
|
|
48889
49205
|
* @private
|
|
48890
49206
|
*/
|
|
48891
49207
|
generateDrawCandlestick(indices, isSub) {
|
|
@@ -48929,7 +49245,7 @@ var candlestick_spreadValues = (a, b) => {
|
|
|
48929
49245
|
* Generate shape drawing points
|
|
48930
49246
|
* @param {object} indices Indice data
|
|
48931
49247
|
* @param {boolean} isSub Subchart draw
|
|
48932
|
-
* @returns {
|
|
49248
|
+
* @returns {function}
|
|
48933
49249
|
*/
|
|
48934
49250
|
generateGetCandlestickPoints(indices, isSub = false) {
|
|
48935
49251
|
const $$ = this;
|
|
@@ -48975,7 +49291,7 @@ var candlestick_spreadValues = (a, b) => {
|
|
|
48975
49291
|
},
|
|
48976
49292
|
/**
|
|
48977
49293
|
* Redraw function
|
|
48978
|
-
* @param {
|
|
49294
|
+
* @param {function} drawFn Retuned functino from .generateDrawCandlestick()
|
|
48979
49295
|
* @param {boolean} withTransition With or without transition
|
|
48980
49296
|
* @param {boolean} isSub Subchart draw
|
|
48981
49297
|
* @returns {Array}
|
|
@@ -49187,7 +49503,7 @@ function updateRatio(data) {
|
|
|
49187
49503
|
$$.showTooltip([data], event.target);
|
|
49188
49504
|
/^(touchstart|mouseover)$/.test(event.type) && $$.setOverOut(true, data);
|
|
49189
49505
|
}
|
|
49190
|
-
}).on(isTouch ? "touchend" : "mouseout", (event) => {
|
|
49506
|
+
}, isTouch ? { passive: true } : void 0).on(isTouch ? "touchend" : "mouseout", (event) => {
|
|
49191
49507
|
const data = getTarget(event);
|
|
49192
49508
|
if (config.interaction_onout) {
|
|
49193
49509
|
$$.hideTooltip();
|
|
@@ -49438,7 +49754,7 @@ function getRegions(d, _regions, isTimeSeries) {
|
|
|
49438
49754
|
},
|
|
49439
49755
|
/**
|
|
49440
49756
|
* Redraw function
|
|
49441
|
-
* @param {
|
|
49757
|
+
* @param {function} drawFn Retuned functino from .generateDrawCandlestick()
|
|
49442
49758
|
* @param {boolean} withTransition With or without transition
|
|
49443
49759
|
* @param {boolean} isSub Subchart draw
|
|
49444
49760
|
* @returns {Array}
|
|
@@ -49455,7 +49771,7 @@ function getRegions(d, _regions, isTimeSeries) {
|
|
|
49455
49771
|
/**
|
|
49456
49772
|
* Get the curve interpolate
|
|
49457
49773
|
* @param {Array} d Data object
|
|
49458
|
-
* @returns {
|
|
49774
|
+
* @returns {function}
|
|
49459
49775
|
* @private
|
|
49460
49776
|
*/
|
|
49461
49777
|
getCurve(d) {
|
|
@@ -49525,8 +49841,8 @@ function getRegions(d, _regions, isTimeSeries) {
|
|
|
49525
49841
|
/**
|
|
49526
49842
|
* Set regions dasharray and get path
|
|
49527
49843
|
* @param {Array} d Data object
|
|
49528
|
-
* @param {
|
|
49529
|
-
* @param {
|
|
49844
|
+
* @param {function} x x scale function
|
|
49845
|
+
* @param {function} y y scale function
|
|
49530
49846
|
* @param {object} _regions regions to be set
|
|
49531
49847
|
* @returns {stirng} Path string
|
|
49532
49848
|
* @private
|
|
@@ -50123,7 +50439,7 @@ function insertPointInfoDefs(point, id) {
|
|
|
50123
50439
|
},
|
|
50124
50440
|
/**
|
|
50125
50441
|
* Get generate point function
|
|
50126
|
-
* @returns {
|
|
50442
|
+
* @returns {function}
|
|
50127
50443
|
* @private
|
|
50128
50444
|
*/
|
|
50129
50445
|
generatePoint() {
|
|
@@ -50472,9 +50788,9 @@ const cacheKeyTextWidth = KEY.radarTextWidth;
|
|
|
50472
50788
|
const index = $$.getDataIndexFromEvent(event);
|
|
50473
50789
|
$$.selectRectForSingle(svg.node(), index);
|
|
50474
50790
|
isMouse ? $$.setOverOut(true, index) : $$.callOverOutForTouch(index);
|
|
50475
|
-
}).on("mouseout", isMouse ? hide : null);
|
|
50791
|
+
}, isMouse ? void 0 : { passive: true }).on("mouseout", isMouse ? hide : null);
|
|
50476
50792
|
if (!isMouse) {
|
|
50477
|
-
svg.on("touchstart", hide);
|
|
50793
|
+
svg.on("touchstart", hide, { passive: true });
|
|
50478
50794
|
}
|
|
50479
50795
|
},
|
|
50480
50796
|
updateRadarShape() {
|
|
@@ -51042,7 +51358,7 @@ function getHierachyData(data) {
|
|
|
51042
51358
|
$$.showTooltip([data], event.currentTarget);
|
|
51043
51359
|
/^(touchstart|mouseover)$/.test(event.type) && $$.setOverOut(true, data);
|
|
51044
51360
|
}
|
|
51045
|
-
}).on(isTouch ? "touchend" : "mouseout", (event) => {
|
|
51361
|
+
}, isTouch ? { passive: true } : void 0).on(isTouch ? "touchend" : "mouseout", (event) => {
|
|
51046
51362
|
const data = getTarget(event);
|
|
51047
51363
|
if (config.interaction_onout) {
|
|
51048
51364
|
$$.hideTooltip();
|
|
@@ -51053,7 +51369,7 @@ function getHierachyData(data) {
|
|
|
51053
51369
|
},
|
|
51054
51370
|
/**
|
|
51055
51371
|
* Get tiling function
|
|
51056
|
-
* @returns {
|
|
51372
|
+
* @returns {function}
|
|
51057
51373
|
* @private
|
|
51058
51374
|
*/
|
|
51059
51375
|
getTreemapTile() {
|
|
@@ -51154,20 +51470,28 @@ function getHierachyData(data) {
|
|
|
51154
51470
|
/**
|
|
51155
51471
|
* Get treemap data label format function
|
|
51156
51472
|
* @param {object} d Data object
|
|
51157
|
-
* @returns {
|
|
51473
|
+
* @returns {function} Label formatter function
|
|
51158
51474
|
* @private
|
|
51159
51475
|
*/
|
|
51160
51476
|
treemapDataLabelFormat(d) {
|
|
51161
51477
|
const $$ = this;
|
|
51162
|
-
const { config } = $$;
|
|
51478
|
+
const { $el: { treemap }, config, scale: { x, y } } = $$;
|
|
51163
51479
|
const { id, value } = d;
|
|
51164
51480
|
const format = config.treemap_label_format;
|
|
51165
51481
|
const ratio = $$.getRatio("treemap", d);
|
|
51166
51482
|
const percentValue = (ratio * 100).toFixed(2);
|
|
51167
51483
|
const meetLabelThreshold = config.treemap_label_show && meetsLabelThreshold.call($$, ratio, "treemap") ? null : "0";
|
|
51484
|
+
const treemapNode = treemap.selectAll("g").filter((node) => node.data.id === id).datum();
|
|
51485
|
+
let width = 0;
|
|
51486
|
+
let height = 0;
|
|
51487
|
+
if (treemapNode) {
|
|
51488
|
+
const { x0, x1, y0, y1 } = treemapNode;
|
|
51489
|
+
width = x(x1) - x(x0);
|
|
51490
|
+
height = y(y1) - y(y0);
|
|
51491
|
+
}
|
|
51168
51492
|
return function(node) {
|
|
51169
51493
|
node.style("opacity", meetLabelThreshold);
|
|
51170
|
-
return isFunction(format) ? format.bind($$.api)(value, ratio, id) : `${id}
|
|
51494
|
+
return isFunction(format) ? format.bind($$.api)(value, ratio, id, { width, height }) : `${id}
|
|
51171
51495
|
${percentValue}%`;
|
|
51172
51496
|
};
|
|
51173
51497
|
}
|
|
@@ -51182,7 +51506,7 @@ ${percentValue}%`;
|
|
|
51182
51506
|
* @type {object}
|
|
51183
51507
|
* @property {object} point Point object
|
|
51184
51508
|
* @property {boolean} [point.show=true] Whether to show each point in line.
|
|
51185
|
-
* @property {number|
|
|
51509
|
+
* @property {number|function} [point.r=2.5] The radius size of each point.
|
|
51186
51510
|
* - **NOTE:** Disabled for 'bubble' type
|
|
51187
51511
|
* @property {boolean|object} [point.radialGradient=false] Set the radial gradient on point.<br><br>
|
|
51188
51512
|
* Or customize by giving below object value:
|
|
@@ -51199,7 +51523,7 @@ ${percentValue}%`;
|
|
|
51199
51523
|
* - **NOTE:**
|
|
51200
51524
|
* - `null` will make to not set inline 'opacity' css prop.
|
|
51201
51525
|
* - when no value(or undefined) is set, it defaults to set opacity value according its chart types.
|
|
51202
|
-
* @property {number|string|
|
|
51526
|
+
* @property {number|string|function} [point.sensitivity=10] The sensitivity value for interaction boundary.
|
|
51203
51527
|
* - **Available Values:**
|
|
51204
51528
|
* - {number}: Absolute sensitivity value which is the distance from the data point in pixel.
|
|
51205
51529
|
* - "radius": sensitivity based on point's radius
|
|
@@ -51246,7 +51570,7 @@ ${percentValue}%`;
|
|
|
51246
51570
|
* return r;
|
|
51247
51571
|
* },
|
|
51248
51572
|
*
|
|
51249
|
-
* // will generate
|
|
51573
|
+
* // will generate following radialGradient:
|
|
51250
51574
|
* // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/radialGradient
|
|
51251
51575
|
* // <radualGradient cx="0.3" cy="0.3" r="0.7">
|
|
51252
51576
|
* // <stop offset="0.1" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
|
|
@@ -51362,7 +51686,7 @@ ${percentValue}%`;
|
|
|
51362
51686
|
* // <g class='bb-areas'> will be positioned behind the line <g class='bb-lines'> in stacking order
|
|
51363
51687
|
* front: false,
|
|
51364
51688
|
*
|
|
51365
|
-
* // will generate
|
|
51689
|
+
* // will generate following linearGradient:
|
|
51366
51690
|
* // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient
|
|
51367
51691
|
* // <linearGradient x1="0" x2="0" y1="0" y2="1">
|
|
51368
51692
|
* // <stop offset="0" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
|
|
@@ -51416,8 +51740,8 @@ ${percentValue}%`;
|
|
|
51416
51740
|
* @property {number} [bar.padding=0] The padding pixel value between each bar.
|
|
51417
51741
|
* @property {number} [bar.radius] Set the radius of bar edge in pixel.
|
|
51418
51742
|
* @property {number} [bar.radius.ratio] Set the radius ratio of bar edge in relative the bar's width.
|
|
51419
|
-
* @property {number} [bar.sensitivity=2] The
|
|
51420
|
-
* @property {number|
|
|
51743
|
+
* @property {number} [bar.sensitivity=2] The sensitivity offset value for interaction boundary.
|
|
51744
|
+
* @property {number|function|object} [bar.width] Change the width of bar chart.
|
|
51421
51745
|
* @property {number} [bar.width.ratio=0.6] Change the width of bar chart by ratio.
|
|
51422
51746
|
* - **NOTE:** Criteria for ratio.
|
|
51423
51747
|
* - When x ticks count is same with the data count, the baseline for ratio is the minimum interval value of x ticks.
|
|
@@ -51444,12 +51768,12 @@ ${percentValue}%`;
|
|
|
51444
51768
|
* // make bar shape to be positioned over the other shape elements
|
|
51445
51769
|
* front: true,
|
|
51446
51770
|
*
|
|
51447
|
-
* // remove nullish data on bar indices
|
|
51771
|
+
* // remove nullish data on bar indices positions
|
|
51448
51772
|
* indices: {
|
|
51449
51773
|
* removeNull: true
|
|
51450
51774
|
* },
|
|
51451
51775
|
*
|
|
51452
|
-
* // will generate
|
|
51776
|
+
* // will generate following linearGradient:
|
|
51453
51777
|
* // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient
|
|
51454
51778
|
* // <linearGradient x1="0" x2="0" y1="0" y2="1">
|
|
51455
51779
|
* // <stop offset="0" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
|
|
@@ -51547,12 +51871,12 @@ ${percentValue}%`;
|
|
|
51547
51871
|
* @memberof Options
|
|
51548
51872
|
* @type {object}
|
|
51549
51873
|
* @property {object} bubble bubble object
|
|
51550
|
-
* @property {number|
|
|
51874
|
+
* @property {number|function} [bubble.maxR=35] Set the max bubble radius value
|
|
51551
51875
|
* @property {boolean} [bubble.zerobased=false] Set if min or max value will be 0 on bubble chart.
|
|
51552
51876
|
* @example
|
|
51553
51877
|
* bubble: {
|
|
51554
51878
|
* // ex) If 100 is the highest value among data bound, the representation bubble of 100 will have radius of 50.
|
|
51555
|
-
* // And the lesser will have radius relatively from
|
|
51879
|
+
* // And the lesser will have radius relatively from the max value.
|
|
51556
51880
|
* maxR: 50,
|
|
51557
51881
|
*
|
|
51558
51882
|
* // or set radius callback
|
|
@@ -51606,7 +51930,7 @@ ${percentValue}%`;
|
|
|
51606
51930
|
* }
|
|
51607
51931
|
* },
|
|
51608
51932
|
* color: {
|
|
51609
|
-
* //
|
|
51933
|
+
* // specify bearish color
|
|
51610
51934
|
* down: "red",
|
|
51611
51935
|
*
|
|
51612
51936
|
* // or specify color per dataset
|
|
@@ -51659,7 +51983,7 @@ ${percentValue}%`;
|
|
|
51659
51983
|
* // hide all data points ('point.show=false' also has similar effect)
|
|
51660
51984
|
* point: false,
|
|
51661
51985
|
*
|
|
51662
|
-
* // show data points for only indicated
|
|
51986
|
+
* // show data points for only indicated data
|
|
51663
51987
|
* point: [
|
|
51664
51988
|
* "data1", "data3"
|
|
51665
51989
|
* ],
|
|
@@ -51694,7 +52018,7 @@ ${percentValue}%`;
|
|
|
51694
52018
|
* // hide all data points ('point.show=false' also has similar effect)
|
|
51695
52019
|
* point: false,
|
|
51696
52020
|
*
|
|
51697
|
-
* // show data points for only indicated
|
|
52021
|
+
* // show data points for only indicated data
|
|
51698
52022
|
* point: [
|
|
51699
52023
|
* "data1", "data3"
|
|
51700
52024
|
* ],
|
|
@@ -51753,14 +52077,14 @@ ${percentValue}%`;
|
|
|
51753
52077
|
* @memberof Options
|
|
51754
52078
|
* @type {object}
|
|
51755
52079
|
* @property {object} arc Arc object
|
|
51756
|
-
* @property {number|
|
|
52080
|
+
* @property {number|function} [arc.cornerRadius=0] Set corner radius of Arc(donut/gauge/pie/polar) shape.
|
|
51757
52081
|
* - **NOTE:**
|
|
51758
52082
|
* - Corner radius can't surpass the `(outerRadius - innerRadius) /2` of indicated shape.
|
|
51759
52083
|
* @property {number} [arc.cornerRadius.ratio=0] Set ratio relative of outer radius.
|
|
51760
52084
|
* @property {object} [arc.needle] Set needle options.
|
|
51761
52085
|
* @property {boolean} [arc.needle.show=false] Show or hide needle.
|
|
51762
52086
|
* @property {string} [arc.needle.color] Set needle filled color.
|
|
51763
|
-
* @property {
|
|
52087
|
+
* @property {function} [arc.needle.path] Set custom needle path function.
|
|
51764
52088
|
* - **NOTE:**
|
|
51765
52089
|
* - The path should be starting from 0,0 (which is center) to top center coordinate.
|
|
51766
52090
|
* - The function will receive, `length`{number} parameter which indicating the needle length in pixel relative to radius.
|
|
@@ -51784,8 +52108,8 @@ ${percentValue}%`;
|
|
|
51784
52108
|
* @property {string} [arc.rangeText.unit="absolute"] Specify the range text unit.
|
|
51785
52109
|
* - "absolute": Show absolute value
|
|
51786
52110
|
* - "%": Show percentage value
|
|
51787
|
-
* @property {boolean} [arc.rangeText.
|
|
51788
|
-
* @property {
|
|
52111
|
+
* @property {boolean} [arc.rangeText.fixed=false] Set if range text shown will be fixed w/o data toggle update. Only available for gauge chart.
|
|
52112
|
+
* @property {function} [arc.rangeText.format] Set format function for the range text.
|
|
51789
52113
|
* @property {number} [arc.rangeText.position] Set position function or object for the range text.
|
|
51790
52114
|
* @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutCornerRadius)
|
|
51791
52115
|
* @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#PieChartOptions.CornerRadius)
|
|
@@ -51898,10 +52222,21 @@ ${percentValue}%`;
|
|
|
51898
52222
|
* @type {object}
|
|
51899
52223
|
* @property {object} donut Donut object
|
|
51900
52224
|
* @property {boolean} [donut.label.show=true] Show or hide label on each donut piece.
|
|
51901
|
-
* @property {
|
|
52225
|
+
* @property {function} [donut.label.format] Set formatter for the label on each donut piece.
|
|
51902
52226
|
* @property {number} [donut.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
51903
|
-
* @property {number|
|
|
51904
|
-
* @property {object
|
|
52227
|
+
* @property {number|function} [donut.label.ratio=undefined] Set ratio of labels position.
|
|
52228
|
+
* @property {boolean|object} [donut.label.line=false] Enable label with lines (displayed outside with connector lines).
|
|
52229
|
+
* - `true`: Enable label with lines with default settings
|
|
52230
|
+
* - `false`: Labels are displayed inside the donut slices (default behavior).
|
|
52231
|
+
* - `{show: boolean, distance: number, text: boolean}`: Enable label with lines with custom settings. When object member is not provided, it will be set to default values.
|
|
52232
|
+
* @property {boolean} [donut.label.line.show=true] Show or hide connector lines.
|
|
52233
|
+
* @property {number} [donut.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
|
|
52234
|
+
* @property {boolean|function} [donut.label.line.text=true] Show text at the end of the connector line (outside the shape).
|
|
52235
|
+
* - `true`: show data "id" text
|
|
52236
|
+
* - `false`: use default formatter(label.format) to show text
|
|
52237
|
+
* - `function(value, ratio, id)`: Custom formatter function for the text.
|
|
52238
|
+
* - **NOTE:** When the viewport size decreases, the size is adjusted based on the shape, so text may appear clipped. In this case, consider setting `overflow: visible` on the SVG node.
|
|
52239
|
+
* @property {object|function} [donut.label.image] Set image to be displayed next to the label text.<br><br>
|
|
51905
52240
|
* When function is specified, will receives 3 arguments such as `v, id, i` and it must return an image object with `url`, `width`, `height`, and optional `pos` properties.<br><br>
|
|
51906
52241
|
* The arguments are:<br>
|
|
51907
52242
|
* - `v` is the value of the data point where the label is shown.
|
|
@@ -51926,6 +52261,7 @@ ${percentValue}%`;
|
|
|
51926
52261
|
* @see [Demo: Needle](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutNeedle)
|
|
51927
52262
|
* @see [Demo: Range Text](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutRangeText)
|
|
51928
52263
|
* @see [Demo: Label Image](https://naver.github.io/billboard.js/demo/#DonutChartOptions.LabelImage)
|
|
52264
|
+
* @see [Demo: Label Line](https://naver.github.io/billboard.js/demo/#DonutChartOptions.LabelLine)
|
|
51929
52265
|
* @see [Demo: Label Ratio](https://naver.github.io/billboard.js/demo/#DonutChartOptions.LabelRatio)
|
|
51930
52266
|
* @see [Demo: Multiline Label](https://naver.github.io/billboard.js/demo/#DonutChartOptions.MultilineLabel)
|
|
51931
52267
|
* @see [Demo: Multiline Title](https://naver.github.io/billboard.js/demo/#DonutChartOptions.MultilineTitle)
|
|
@@ -51955,6 +52291,20 @@ ${percentValue}%`;
|
|
|
51955
52291
|
* // or set ratio number
|
|
51956
52292
|
* ratio: 0.5,
|
|
51957
52293
|
*
|
|
52294
|
+
* // Enable label with lines (displayed outside with connector lines)
|
|
52295
|
+
* line: false, // default - labels inside
|
|
52296
|
+
* line: true, // enable label with lines with default settings
|
|
52297
|
+
* line: { // enable label with lines with custom settings
|
|
52298
|
+
* show: true,
|
|
52299
|
+
* distance: 20, // horizontal line distance in pixels
|
|
52300
|
+
*
|
|
52301
|
+
* // show text at the end of connector line (outside the shape)
|
|
52302
|
+
* text: true, // use default formatter
|
|
52303
|
+
* text: function(value, ratio, id) { // custom formatter
|
|
52304
|
+
* return d3.format(".1%")(ratio);
|
|
52305
|
+
* }
|
|
52306
|
+
* },
|
|
52307
|
+
*
|
|
51958
52308
|
* // set image to be displayed next to the label text
|
|
51959
52309
|
* image: {
|
|
51960
52310
|
* url: "./sample.svg",
|
|
@@ -52026,6 +52376,7 @@ ${percentValue}%`;
|
|
|
52026
52376
|
donut_label_show: true,
|
|
52027
52377
|
donut_label_format: void 0,
|
|
52028
52378
|
donut_label_threshold: 0.05,
|
|
52379
|
+
donut_label_line: false,
|
|
52029
52380
|
donut_label_image: void 0,
|
|
52030
52381
|
donut_label_ratio: void 0,
|
|
52031
52382
|
donut_width: void 0,
|
|
@@ -52081,15 +52432,27 @@ ${percentValue}%`;
|
|
|
52081
52432
|
* @property {boolean} [gauge.background=""] Set background color. (The `.bb-chart-arcs-background` element)
|
|
52082
52433
|
* @property {boolean} [gauge.fullCircle=false] Show full circle as donut. When set to 'true', the max label will not be showed due to start and end points are same location.
|
|
52083
52434
|
* @property {boolean} [gauge.label.show=true] Show or hide label on gauge.
|
|
52084
|
-
* @property {
|
|
52085
|
-
* @property {
|
|
52435
|
+
* @property {function} [gauge.label.extents] Set customized min/max label text.
|
|
52436
|
+
* @property {function} [gauge.label.format] Set formatter for the label on gauge. Label text can be multilined with `\n` character.<br>
|
|
52086
52437
|
* Will pass following arguments to the given function:
|
|
52087
52438
|
* - value {number}: absolute value
|
|
52088
52439
|
* - ratio {number}: value's ratio
|
|
52089
52440
|
* - id {string}: data's id value
|
|
52090
|
-
* @property {number|
|
|
52441
|
+
* @property {number|function} [gauge.label.ratio=undefined] Set ratio of labels position.
|
|
52091
52442
|
* @property {number} [gauge.label.threshold=0] Set threshold ratio to show/hide labels.
|
|
52092
|
-
* @property {object
|
|
52443
|
+
* @property {boolean|object} [gauge.label.line=false] Enable label with lines (displayed outside with connector lines).
|
|
52444
|
+
* - **NOTE:** Only applicable for single gauge (not for `gauge.type="multi"`).
|
|
52445
|
+
* - `true`: Enable label with lines with default settings
|
|
52446
|
+
* - `false`: Labels are displayed inside the gauge (default behavior).
|
|
52447
|
+
* - `{show: boolean, distance: number, text: boolean}`: Enable label with lines with custom settings. When object member is not provided, it will be set to default values.
|
|
52448
|
+
* @property {boolean} [gauge.label.line.show=true] Show or hide connector lines.
|
|
52449
|
+
* @property {number} [gauge.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
|
|
52450
|
+
* @property {boolean|function} [gauge.label.line.text=true] Show text at the end of the connector line (outside the shape).
|
|
52451
|
+
* - `true`: show data "id" text
|
|
52452
|
+
* - `false`: use default formatter(label.format) to show text
|
|
52453
|
+
* - `function(value, ratio, id)`: Custom formatter function for the text.
|
|
52454
|
+
* - **NOTE:** When the viewport size decreases, the size is adjusted based on the shape, so text may appear clipped. In this case, consider setting `overflow: visible` on the SVG node.
|
|
52455
|
+
* @property {object|function} [gauge.label.image] Set image to be displayed next to the label text.<br><br>
|
|
52093
52456
|
* When function is specified, will receives 3 arguments such as `v, id, i` and it must return an image object with `url`, `width`, `height`, and optional `pos` properties.<br><br>
|
|
52094
52457
|
* The arguments are:<br>
|
|
52095
52458
|
* - `v` is the value of the data point where the label is shown.
|
|
@@ -52142,6 +52505,7 @@ ${percentValue}%`;
|
|
|
52142
52505
|
* @see [Demo: archLength](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeArcLength)
|
|
52143
52506
|
* @see [Demo: startingAngle](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeStartingAngle)
|
|
52144
52507
|
* @see [Demo: label image](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeLabelImage)
|
|
52508
|
+
* @see [Demo: label line](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeLabelLine)
|
|
52145
52509
|
* @see [Demo: label ratio](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeLabelRatio)
|
|
52146
52510
|
* @example
|
|
52147
52511
|
* gauge: {
|
|
@@ -52164,6 +52528,20 @@ ${percentValue}%`;
|
|
|
52164
52528
|
* // if data value is below than 0.1, text label will be hidden.
|
|
52165
52529
|
* threshold: 0.1,
|
|
52166
52530
|
*
|
|
52531
|
+
* // Enable label with lines (displayed outside with connector lines)
|
|
52532
|
+
* // NOTE: Only works with single gauge (not gauge.type="multi")
|
|
52533
|
+
* line: true, // enable label with lines with default settings
|
|
52534
|
+
* line: { // enable label with lines with custom settings
|
|
52535
|
+
* show: true, // enable lines (default: true when line is enabled)
|
|
52536
|
+
* distance: 30, // distance of horizontal line in pixels (default: 20)
|
|
52537
|
+
*
|
|
52538
|
+
* // show text at the end of connector line (outside the shape)
|
|
52539
|
+
* text: true, // use default formatter
|
|
52540
|
+
* text: function(value, ratio, id) { // custom formatter
|
|
52541
|
+
* return d3.format(".1%")(ratio);
|
|
52542
|
+
* }
|
|
52543
|
+
* },
|
|
52544
|
+
*
|
|
52167
52545
|
* // set ratio callback. Should return ratio value
|
|
52168
52546
|
* ratio: function(d, radius, h) {
|
|
52169
52547
|
* ...
|
|
@@ -52257,6 +52635,7 @@ ${percentValue}%`;
|
|
|
52257
52635
|
gauge_label_format: void 0,
|
|
52258
52636
|
gauge_label_ratio: void 0,
|
|
52259
52637
|
gauge_label_threshold: 0,
|
|
52638
|
+
gauge_label_line: false,
|
|
52260
52639
|
gauge_label_image: void 0,
|
|
52261
52640
|
gauge_enforceMinMax: false,
|
|
52262
52641
|
gauge_min: 0,
|
|
@@ -52282,10 +52661,21 @@ ${percentValue}%`;
|
|
|
52282
52661
|
* @type {object}
|
|
52283
52662
|
* @property {object} pie Pie object
|
|
52284
52663
|
* @property {boolean} [pie.label.show=true] Show or hide label on each pie piece.
|
|
52285
|
-
* @property {
|
|
52286
|
-
* @property {number|
|
|
52664
|
+
* @property {function} [pie.label.format] Set formatter for the label on each pie piece.
|
|
52665
|
+
* @property {number|function} [pie.label.ratio=undefined] Set ratio of labels position.
|
|
52287
52666
|
* @property {number} [pie.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
52288
|
-
* @property {object
|
|
52667
|
+
* @property {boolean|object} [pie.label.line=false] Enable label with lines (displayed outside with connector lines).
|
|
52668
|
+
* - `true`: Enable label with lines with default settings
|
|
52669
|
+
* - `false`: Labels are displayed inside the pie slices (default behavior).
|
|
52670
|
+
* - `{show: boolean, distance: number, text: boolean}`: Enable label with lines with custom settings. When object member is not provided, it will be set to default values.
|
|
52671
|
+
* @property {boolean} [pie.label.line.show=true] Show or hide connector lines.
|
|
52672
|
+
* @property {number} [pie.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
|
|
52673
|
+
* @property {boolean|function} [pie.label.line.text=true] Show text at the end of the connector line (outside the shape).
|
|
52674
|
+
* - `true`: show data "id" text
|
|
52675
|
+
* - `false`: use default formatter(label.format) to show text
|
|
52676
|
+
* - `function(value, ratio, id)`: Custom formatter function for the text.
|
|
52677
|
+
* - **NOTE:** When the viewport size decreases, the size is adjusted based on the shape, so text may appear clipped. In this case, consider setting `overflow: visible` on the SVG node.
|
|
52678
|
+
* @property {object|function} [pie.label.image] Set image to be displayed next to the label text.<br><br>
|
|
52289
52679
|
* When function is specified, will receives 3 arguments such as `v, id, i` and it must return an image object with `url`, `width`, `height`, and optional `pos` properties.<br><br>
|
|
52290
52680
|
* The arguments are:<br>
|
|
52291
52681
|
* - `v` is the value of the data point where the label is shown.
|
|
@@ -52310,6 +52700,7 @@ ${percentValue}%`;
|
|
|
52310
52700
|
* @see [Demo: outerRadius](https://naver.github.io/billboard.js/demo/#PieChartOptions.OuterRadius)
|
|
52311
52701
|
* @see [Demo: startingAngle](https://naver.github.io/billboard.js/demo/#PieChartOptions.StartingAngle)
|
|
52312
52702
|
* @see [Demo: label image](https://naver.github.io/billboard.js/demo/#PieChartOptions.LabelImage)
|
|
52703
|
+
* @see [Demo: label line](https://naver.github.io/billboard.js/demo/#PieChartOptions.LabelLine)
|
|
52313
52704
|
* @example
|
|
52314
52705
|
* pie: {
|
|
52315
52706
|
* label: {
|
|
@@ -52333,6 +52724,20 @@ ${percentValue}%`;
|
|
|
52333
52724
|
* // or set ratio number
|
|
52334
52725
|
* ratio: 0.5,
|
|
52335
52726
|
*
|
|
52727
|
+
* // Enable label with lines (displayed outside with connector lines)
|
|
52728
|
+
* line: false, // default - labels inside
|
|
52729
|
+
* line: true, // enable label with lines with default settings
|
|
52730
|
+
* line: { // enable label with lines with custom settings
|
|
52731
|
+
* show: true,
|
|
52732
|
+
* distance: 20, // horizontal line distance in pixels
|
|
52733
|
+
*
|
|
52734
|
+
* // show text at the end of connector line (outside the shape)
|
|
52735
|
+
* text: true, // use default formatter
|
|
52736
|
+
* text: function(value, ratio, id) { // custom formatter
|
|
52737
|
+
* return d3.format(".1%")(ratio);
|
|
52738
|
+
* }
|
|
52739
|
+
* },
|
|
52740
|
+
*
|
|
52336
52741
|
* // set image to be displayed next to the label text
|
|
52337
52742
|
* image: {
|
|
52338
52743
|
* url: "./sample.svg",
|
|
@@ -52414,6 +52819,7 @@ ${percentValue}%`;
|
|
|
52414
52819
|
pie_label_format: void 0,
|
|
52415
52820
|
pie_label_ratio: void 0,
|
|
52416
52821
|
pie_label_threshold: 0.05,
|
|
52822
|
+
pie_label_line: false,
|
|
52417
52823
|
pie_label_image: void 0,
|
|
52418
52824
|
pie_expand: {},
|
|
52419
52825
|
pie_expand_rate: 0.98,
|
|
@@ -52434,10 +52840,21 @@ ${percentValue}%`;
|
|
|
52434
52840
|
* @type {object}
|
|
52435
52841
|
* @property {object} polar Polar object
|
|
52436
52842
|
* @property {boolean} [polar.label.show=true] Show or hide label on each polar piece.
|
|
52437
|
-
* @property {
|
|
52843
|
+
* @property {function} [polar.label.format] Set formatter for the label on each polar piece.
|
|
52438
52844
|
* @property {number} [polar.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
52439
|
-
* @property {number|
|
|
52440
|
-
* @property {object
|
|
52845
|
+
* @property {number|function} [polar.label.ratio=undefined] Set ratio of labels position.
|
|
52846
|
+
* @property {boolean|object} [polar.label.line=false] Enable label with lines (displayed outside with connector lines).
|
|
52847
|
+
* - `true`: Enable label with lines with default settings
|
|
52848
|
+
* - `false`: Labels are displayed inside the polar slices (default behavior).
|
|
52849
|
+
* - `{show: boolean, distance: number, text: boolean}`: Enable label with lines with custom settings. When object member is not provided, it will be set to default values.
|
|
52850
|
+
* @property {boolean} [polar.label.line.show=true] Show or hide connector lines.
|
|
52851
|
+
* @property {number} [polar.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
|
|
52852
|
+
* @property {boolean|function} [polar.label.line.text=true] Show text at the end of the connector line (outside the shape).
|
|
52853
|
+
* - `true`: show data "id" text
|
|
52854
|
+
* - `false`: use default formatter(label.format) to show text
|
|
52855
|
+
* - `function(value, ratio, id)`: Custom formatter function for the text.
|
|
52856
|
+
* - **NOTE:** When the viewport size decreases, the size is adjusted based on the shape, so text may appear clipped. In this case, consider setting `overflow: visible` on the SVG node.
|
|
52857
|
+
* @property {object|function} [polar.label.image] Set image to be displayed next to the label text.<br><br>
|
|
52441
52858
|
* When function is specified, will receives 3 arguments such as `v, id, i` and it must return an image object with `url`, `width`, `height`, and optional `pos` properties.<br><br>
|
|
52442
52859
|
* The arguments are:<br>
|
|
52443
52860
|
* - `v` is the value of the data point where the label is shown.
|
|
@@ -52452,13 +52869,14 @@ ${percentValue}%`;
|
|
|
52452
52869
|
* @property {number} [polar.level.depth=3] Set the level depth.
|
|
52453
52870
|
* @property {boolean} [polar.level.show=true] Show or hide level.
|
|
52454
52871
|
* @property {string} [polar.level.text.backgroundColor="#fff"] Set label text's background color.
|
|
52455
|
-
* @property {
|
|
52872
|
+
* @property {function} [polar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
|
|
52456
52873
|
* @property {boolean} [polar.level.text.show=true] Show or hide level text.
|
|
52457
52874
|
* @property {number} [polar.padAngle=0] Set padding between data.
|
|
52458
52875
|
* @property {number} [polar.padding=0] Sets the gap between pie arcs.
|
|
52459
52876
|
* @property {number} [polar.startingAngle=0] Set starting angle where data draws.
|
|
52460
52877
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.PolarChart)
|
|
52461
52878
|
* @see [Demo: label image](https://naver.github.io/billboard.js/demo/#PolarChartOptions.LabelImage)
|
|
52879
|
+
* @see [Demo: label line](https://naver.github.io/billboard.js/demo/#PolarChartOptions.LabelLine)
|
|
52462
52880
|
* @example
|
|
52463
52881
|
* polar: {
|
|
52464
52882
|
* label: {
|
|
@@ -52482,6 +52900,20 @@ ${percentValue}%`;
|
|
|
52482
52900
|
* // or set ratio number
|
|
52483
52901
|
* ratio: 0.5,
|
|
52484
52902
|
*
|
|
52903
|
+
* // Enable label with lines (displayed outside with connector lines)
|
|
52904
|
+
* line: false, // default - labels inside
|
|
52905
|
+
* line: true, // enable label with lines with default settings
|
|
52906
|
+
* line: { // enable label with lines with custom settings
|
|
52907
|
+
* show: true,
|
|
52908
|
+
* distance: 20, // horizontal line distance in pixels
|
|
52909
|
+
*
|
|
52910
|
+
* // show text at the end of connector line (outside the shape)
|
|
52911
|
+
* text: true, // use default formatter
|
|
52912
|
+
* text: function(value, ratio, id) { // custom formatter
|
|
52913
|
+
* return d3.format(".1%")(ratio);
|
|
52914
|
+
* }
|
|
52915
|
+
* },
|
|
52916
|
+
*
|
|
52485
52917
|
* // set image to be displayed next to the label text
|
|
52486
52918
|
* image: {
|
|
52487
52919
|
* url: "./sample.svg",
|
|
@@ -52546,6 +52978,7 @@ ${percentValue}%`;
|
|
|
52546
52978
|
polar_label_show: true,
|
|
52547
52979
|
polar_label_format: void 0,
|
|
52548
52980
|
polar_label_threshold: 0.05,
|
|
52981
|
+
polar_label_line: false,
|
|
52549
52982
|
polar_label_image: void 0,
|
|
52550
52983
|
polar_label_ratio: void 0,
|
|
52551
52984
|
polar_level_depth: 3,
|
|
@@ -52577,7 +53010,7 @@ ${percentValue}%`;
|
|
|
52577
53010
|
* @property {boolean} [radar.direction.clockwise=false] Set the direction to be drawn.
|
|
52578
53011
|
* @property {number} [radar.level.depth=3] Set the level depth.
|
|
52579
53012
|
* @property {boolean} [radar.level.show=true] Show or hide level.
|
|
52580
|
-
* @property {
|
|
53013
|
+
* @property {function} [radar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
|
|
52581
53014
|
* @property {boolean} [radar.level.text.show=true] Show or hide level text.
|
|
52582
53015
|
* @property {number} [radar.size.ratio=0.87] Set size ratio.
|
|
52583
53016
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.RadarChart)
|
|
@@ -52645,7 +53078,12 @@ ${percentValue}%`;
|
|
|
52645
53078
|
* - sliceDice ([d3.treemapSliceDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSliceDice))
|
|
52646
53079
|
* - squrify ([d3.treemapSquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSquarify))
|
|
52647
53080
|
* - resquarify ([d3.treemapResquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapResquarify))
|
|
52648
|
-
* @property {
|
|
53081
|
+
* @property {function} [treemap.label.format] Set formatter for the label text.<br>
|
|
53082
|
+
* - **Arguments:**
|
|
53083
|
+
* - `value {number}`: Data value
|
|
53084
|
+
* - `ratio {number}`: The `ratio` of how much space this tile occupies relative to the total area (0~1)
|
|
53085
|
+
* - `id {string}`: Data id
|
|
53086
|
+
* - `size {object}`: Tile size `{width, height}` in pixels
|
|
52649
53087
|
* @property {number} [treemap.label.threshold=0.05] Set threshold ratio to show/hide labels text.
|
|
52650
53088
|
* @property {number} [treemap.label.show=true] Show or hide label text.
|
|
52651
53089
|
* @see [Demo: treemap](https://naver.github.io/billboard.js/demo/#Chart.TreemapChart)
|
|
@@ -52658,12 +53096,33 @@ ${percentValue}%`;
|
|
|
52658
53096
|
* // show or hide label text
|
|
52659
53097
|
* show: false,
|
|
52660
53098
|
*
|
|
52661
|
-
* //
|
|
52662
|
-
* format: function(value, ratio, id) {
|
|
53099
|
+
* // Example 1: Format with currency
|
|
53100
|
+
* format: function(value, ratio, id, size) {
|
|
53101
|
+
* // size: {width, height} - tile size in pixels
|
|
52663
53102
|
* return d3.format("$")(value);
|
|
53103
|
+
* },
|
|
52664
53104
|
*
|
|
52665
|
-
*
|
|
52666
|
-
*
|
|
53105
|
+
* // Example 2: Show different content based on tile size
|
|
53106
|
+
* format: function(value, ratio, id, size) {
|
|
53107
|
+
* if (size.width > 100 && size.height > 50) {
|
|
53108
|
+
* return `${id}\n${d3.format("$")(value)}\n(${(ratio * 100).toFixed(1)}%)`;
|
|
53109
|
+
* } else if (size.width > 50) {
|
|
53110
|
+
* return `${id}\n${d3.format("$")(value)}`;
|
|
53111
|
+
* } else {
|
|
53112
|
+
* return d3.format("$")(value);
|
|
53113
|
+
* }
|
|
53114
|
+
* },
|
|
53115
|
+
*
|
|
53116
|
+
* // Example 3: Include tile dimensions in label
|
|
53117
|
+
* format: function(value, ratio, id, size) {
|
|
53118
|
+
* return `${id}\n${value}\n${size.width.toFixed(0)}x${size.height.toFixed(0)}px`;
|
|
53119
|
+
* },
|
|
53120
|
+
*
|
|
53121
|
+
* // Example 4: Conditional formatting based on ratio
|
|
53122
|
+
* format: function(value, ratio, id, size) {
|
|
53123
|
+
* return ratio > 0.1 ?
|
|
53124
|
+
* `${id}\n${value} (${(ratio * 100).toFixed(1)}%)` :
|
|
53125
|
+
* value;
|
|
52667
53126
|
* },
|
|
52668
53127
|
*
|
|
52669
53128
|
* // set ratio number
|
|
@@ -52772,10 +53231,10 @@ const bb = {
|
|
|
52772
53231
|
* bb.version; // "1.0.0"
|
|
52773
53232
|
* @memberof bb
|
|
52774
53233
|
*/
|
|
52775
|
-
version: "3.
|
|
53234
|
+
version: "3.18.0-next.1",
|
|
52776
53235
|
/**
|
|
52777
53236
|
* Generate chart
|
|
52778
|
-
* - **NOTE:** Bear in mind for the
|
|
53237
|
+
* - **NOTE:** Bear in mind for the possibility of ***throwing an error***, during the generation when:
|
|
52779
53238
|
* - Unused option value is given.
|
|
52780
53239
|
* - ex) For `data.type="pie"` option, setting 'axis' option can cause unexpected generation error.
|
|
52781
53240
|
* - Insufficient value is given for certain option used.
|