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.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
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
11
11
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -241,6 +241,7 @@ const $COMMON = {
|
|
|
241
241
|
const $ARC = {
|
|
242
242
|
arc: "bb-arc",
|
|
243
243
|
arcLabelLine: "bb-arc-label-line",
|
|
244
|
+
arcLabelLineText: "bb-arc-label-line-text",
|
|
244
245
|
arcRange: "bb-arc-range",
|
|
245
246
|
arcs: "bb-arcs",
|
|
246
247
|
chartArc: "bb-chart-arc",
|
|
@@ -434,9 +435,9 @@ const $ZOOM = {
|
|
|
434
435
|
* @memberof Options
|
|
435
436
|
* @type {object}
|
|
436
437
|
* @property {object} color color object
|
|
437
|
-
* @property {string|object|
|
|
438
|
+
* @property {string|object|((this: Chart, d: DataItem) => string)} [color.onover] Set the color value for each data point when mouse/touch onover event occurs.
|
|
438
439
|
* @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.
|
|
439
|
-
* @property {
|
|
440
|
+
* @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).
|
|
440
441
|
* - **NOTE:** The pattern element's id will be defined as `bb-colorize-pattern-$COLOR-VALUE`.<br>
|
|
441
442
|
* ex. When color pattern value is `['red', '#fff']` and defined 2 patterns,then ids for pattern elements are:<br>
|
|
442
443
|
* - `bb-colorize-pattern-red`
|
|
@@ -521,7 +522,7 @@ const $ZOOM = {
|
|
|
521
522
|
* If true given, all legend will be hidden. If string or array given, only the legend that has the id will be hidden.
|
|
522
523
|
* @property {string|HTMLElement} [legend.contents.bindto=undefined] Set CSS selector or element reference to bind legend items.
|
|
523
524
|
* - **NOTE:** Should be used along with `legend.contents.template`.
|
|
524
|
-
* @property {string|
|
|
525
|
+
* @property {string|function} [legend.contents.template="<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>"] Set item's template.<br>
|
|
525
526
|
* - If set `string` value, within template the 'color' and 'title' can be replaced using template-like syntax string:
|
|
526
527
|
* - {=COLOR}: data color value
|
|
527
528
|
* - {=TITLE}: data title value
|
|
@@ -555,13 +556,13 @@ const $ZOOM = {
|
|
|
555
556
|
* - To return initial state(which all dataseries are showing), double click current focused legend item again.
|
|
556
557
|
* - for single click case, `click + altKey(Win)/optionKey(Mac OS)` to have same effect.
|
|
557
558
|
* - In this case, default `click` interaction will be disabled.
|
|
558
|
-
* @property {
|
|
559
|
+
* @property {function} [legend.item.onclick=undefined] Set click event handler to the legend item.
|
|
559
560
|
* - **NOTE:**
|
|
560
561
|
* - When set, default `click` interaction will be disabled.
|
|
561
562
|
* - When `interaction.dblclick=true` is set, will be called on double click.
|
|
562
|
-
* @property {
|
|
563
|
+
* @property {function} [legend.item.onover=undefined] Set mouse/touch over event handler to the legend item.
|
|
563
564
|
* - **NOTE:** When set, default `mouseover` interaction will be disabled.
|
|
564
|
-
* @property {
|
|
565
|
+
* @property {function} [legend.item.onout=undefined] Set mouse/touch out event handler to the legend item.
|
|
565
566
|
* - **NOTE:** When set, default `mouseout` interaction will be disabled.
|
|
566
567
|
* @property {number} [legend.item.tile.width=10] Set width for 'rectangle' legend item tile element.
|
|
567
568
|
* @property {number} [legend.item.tile.height=10] Set height for 'rectangle' legend item tile element.
|
|
@@ -638,7 +639,7 @@ const $ZOOM = {
|
|
|
638
639
|
* width: 15,
|
|
639
640
|
* height: 15
|
|
640
641
|
*
|
|
641
|
-
* //
|
|
642
|
+
* // radius is only applicable for 'circle' legend type
|
|
642
643
|
* r: 10
|
|
643
644
|
* }
|
|
644
645
|
* },
|
|
@@ -684,14 +685,14 @@ const $ZOOM = {
|
|
|
684
685
|
/* harmony default export */ var main = ({
|
|
685
686
|
/**
|
|
686
687
|
* Specify the CSS selector or the element which the chart will be set to. D3 selection object can be specified also.<br>
|
|
687
|
-
* If
|
|
688
|
-
* - **NOTE:** In case
|
|
688
|
+
* If another chart is already set, it will be replaced with the new one (only one chart can be set in one element).
|
|
689
|
+
* - **NOTE:** In case the element doesn't exist or not specified, will add a `<div>` element to the body.
|
|
689
690
|
* @name bindto
|
|
690
691
|
* @memberof Options
|
|
691
692
|
* @property {string|HTMLElement|d3.selection|object} [bindto="#chart"] Specify the element where chart will be drawn.
|
|
692
693
|
* @property {string|HTMLElement|d3.selection} bindto.element="#chart" Specify the element where chart will be drawn.
|
|
693
694
|
* @property {string} [bindto.classname=bb] Specify the class name of bind element.<br>
|
|
694
|
-
* **NOTE:** When class name isn't `bb`, then you also need to update the default CSS to be rendered correctly.
|
|
695
|
+
* **NOTE:** When the class name isn't `bb`, then you also need to update the default CSS to be rendered correctly.
|
|
695
696
|
* @default #chart
|
|
696
697
|
* @example
|
|
697
698
|
* bindto: "#myContainer"
|
|
@@ -732,8 +733,8 @@ const $ZOOM = {
|
|
|
732
733
|
/**
|
|
733
734
|
* Set 'clip-path' attribute for chart element
|
|
734
735
|
* - **NOTE:**
|
|
735
|
-
* > When
|
|
736
|
-
* >
|
|
736
|
+
* > When false, chart node element is positioned after the axis node in DOM tree hierarchy.
|
|
737
|
+
* > This is to make the chart element positioned over axis element.
|
|
737
738
|
* @name clipPath
|
|
738
739
|
* @memberof Options
|
|
739
740
|
* @type {boolean}
|
|
@@ -759,7 +760,7 @@ const $ZOOM = {
|
|
|
759
760
|
svg_classname: void 0,
|
|
760
761
|
/**
|
|
761
762
|
* The desired size of the chart element.
|
|
762
|
-
* If value is not specified, the width of the chart will be calculated by the size of the parent element it's appended to.
|
|
763
|
+
* 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.
|
|
763
764
|
* @name size
|
|
764
765
|
* @memberof Options
|
|
765
766
|
* @type {object}
|
|
@@ -777,13 +778,13 @@ const $ZOOM = {
|
|
|
777
778
|
size_height: void 0,
|
|
778
779
|
/**
|
|
779
780
|
* The padding of the chart element.
|
|
780
|
-
* - **NOTE:** for more information, see the "[`Understanding padding`](https://github.com/naver/billboard.js/wiki/Understanding-padding)"
|
|
781
|
+
* - **NOTE:** for more information, see the "[`Understanding padding`](https://github.com/naver/billboard.js/wiki/Understanding-padding)" wiki documentation.
|
|
781
782
|
* @name padding
|
|
782
783
|
* @memberof Options
|
|
783
784
|
* @type {object}
|
|
784
785
|
* @property {object|boolean} [padding=true] Set padding of chart, and accepts object or boolean type.
|
|
785
786
|
* - `Object`: Specify each side's padding.
|
|
786
|
-
* - `false`: Remove padding completely and make shape
|
|
787
|
+
* - `false`: Remove padding completely and make the shape fully occupy the container element.
|
|
787
788
|
* - In this case, axes and subchart will be hidden.
|
|
788
789
|
* - To adjust some padding from this state, use `axis.[x|y].padding` option.
|
|
789
790
|
* @property {string} [padding.mode] padding mode
|
|
@@ -870,7 +871,7 @@ const $ZOOM = {
|
|
|
870
871
|
* Set a callback to execute when the chart is clicked.
|
|
871
872
|
* @name onclick
|
|
872
873
|
* @memberof Options
|
|
873
|
-
* @type {
|
|
874
|
+
* @type {function}
|
|
874
875
|
* @default undefined
|
|
875
876
|
* @example
|
|
876
877
|
* onclick: function(event) {
|
|
@@ -884,7 +885,7 @@ const $ZOOM = {
|
|
|
884
885
|
* Set a callback to execute when mouse/touch enters the chart.
|
|
885
886
|
* @name onover
|
|
886
887
|
* @memberof Options
|
|
887
|
-
* @type {
|
|
888
|
+
* @type {function}
|
|
888
889
|
* @default undefined
|
|
889
890
|
* @example
|
|
890
891
|
* onover: function(event) {
|
|
@@ -898,7 +899,7 @@ const $ZOOM = {
|
|
|
898
899
|
* Set a callback to execute when mouse/touch leaves the chart.
|
|
899
900
|
* @name onout
|
|
900
901
|
* @memberof Options
|
|
901
|
-
* @type {
|
|
902
|
+
* @type {function}
|
|
902
903
|
* @default undefined
|
|
903
904
|
* @example
|
|
904
905
|
* onout: function(event) {
|
|
@@ -912,7 +913,7 @@ const $ZOOM = {
|
|
|
912
913
|
* Set a callback to execute when user resizes the screen.
|
|
913
914
|
* @name onresize
|
|
914
915
|
* @memberof Options
|
|
915
|
-
* @type {
|
|
916
|
+
* @type {function}
|
|
916
917
|
* @default undefined
|
|
917
918
|
* @example
|
|
918
919
|
* onresize: function() {
|
|
@@ -925,7 +926,7 @@ const $ZOOM = {
|
|
|
925
926
|
* Set a callback to execute when screen resize finished.
|
|
926
927
|
* @name onresized
|
|
927
928
|
* @memberof Options
|
|
928
|
-
* @type {
|
|
929
|
+
* @type {function}
|
|
929
930
|
* @default undefined
|
|
930
931
|
* @example
|
|
931
932
|
* onresized: function() {
|
|
@@ -938,7 +939,7 @@ const $ZOOM = {
|
|
|
938
939
|
* Set a callback to execute before the chart is initialized
|
|
939
940
|
* @name onbeforeinit
|
|
940
941
|
* @memberof Options
|
|
941
|
-
* @type {
|
|
942
|
+
* @type {function}
|
|
942
943
|
* @default undefined
|
|
943
944
|
* @example
|
|
944
945
|
* onbeforeinit: function() {
|
|
@@ -951,7 +952,7 @@ const $ZOOM = {
|
|
|
951
952
|
* Set a callback to execute when the chart is initialized.
|
|
952
953
|
* @name oninit
|
|
953
954
|
* @memberof Options
|
|
954
|
-
* @type {
|
|
955
|
+
* @type {function}
|
|
955
956
|
* @default undefined
|
|
956
957
|
* @example
|
|
957
958
|
* oninit: function() {
|
|
@@ -964,7 +965,7 @@ const $ZOOM = {
|
|
|
964
965
|
* Set a callback to execute after the chart is initialized
|
|
965
966
|
* @name onafterinit
|
|
966
967
|
* @memberof Options
|
|
967
|
-
* @type {
|
|
968
|
+
* @type {function}
|
|
968
969
|
* @default undefined
|
|
969
970
|
* @example
|
|
970
971
|
* onafterinit: function() {
|
|
@@ -974,10 +975,10 @@ const $ZOOM = {
|
|
|
974
975
|
*/
|
|
975
976
|
onafterinit: void 0,
|
|
976
977
|
/**
|
|
977
|
-
* Set a callback which is executed when the chart is rendered. Basically, this callback will be called in each time when the chart is
|
|
978
|
+
* 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.
|
|
978
979
|
* @name onrendered
|
|
979
980
|
* @memberof Options
|
|
980
|
-
* @type {
|
|
981
|
+
* @type {function}
|
|
981
982
|
* @default undefined
|
|
982
983
|
* @example
|
|
983
984
|
* onrendered: function() {
|
|
@@ -988,7 +989,7 @@ const $ZOOM = {
|
|
|
988
989
|
onrendered: void 0,
|
|
989
990
|
/**
|
|
990
991
|
* Set duration of transition (in milliseconds) for chart animation.<br><br>
|
|
991
|
-
* - **NOTE:** If `0
|
|
992
|
+
* - **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.
|
|
992
993
|
* @name transition
|
|
993
994
|
* @memberof Options
|
|
994
995
|
* @type {object}
|
|
@@ -1019,11 +1020,11 @@ const $ZOOM = {
|
|
|
1019
1020
|
* @memberof Options
|
|
1020
1021
|
* @type {object}
|
|
1021
1022
|
* @property {object} [render] render object
|
|
1022
|
-
* @property {boolean} [render.lazy=true] Make
|
|
1023
|
+
* @property {boolean} [render.lazy=true] Make it not render at initialization.
|
|
1023
1024
|
* - **NOTE**:
|
|
1024
1025
|
* - Enabled by default when bind element's visibility is hidden.
|
|
1025
1026
|
* - 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.
|
|
1026
|
-
* @property {boolean} [render.observe=true] Observe bind element's visibility(`display` or `
|
|
1027
|
+
* @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.
|
|
1027
1028
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.LazyRender)
|
|
1028
1029
|
* @example
|
|
1029
1030
|
* render: {
|
|
@@ -1045,7 +1046,7 @@ const $ZOOM = {
|
|
|
1045
1046
|
* document.getElementById('chart').style.display = 'block'; // (b)
|
|
1046
1047
|
*
|
|
1047
1048
|
* @example
|
|
1048
|
-
* // chart won't be rendered and not observing bind element's
|
|
1049
|
+
* // chart won't be rendered and not observing bind element's visibility changes
|
|
1049
1050
|
* var chart = bb.generate({
|
|
1050
1051
|
* render: {
|
|
1051
1052
|
* lazy: true,
|
|
@@ -1071,7 +1072,7 @@ const $ZOOM = {
|
|
|
1071
1072
|
* - `[start] {number|Date|string}`: Start position of the region. If not set, the start will be the edge of the chart.
|
|
1072
1073
|
* - `[end] {number|Date|string}`: End position of the region. If not set, the end will be the edge of the chart.
|
|
1073
1074
|
* - `[class] {string}`: Class value to apply to the region.
|
|
1074
|
-
* - `[label] {object}`
|
|
1075
|
+
* - `[label] {object}` Label text option.
|
|
1075
1076
|
* - `text {string}`: Text value.
|
|
1076
1077
|
* - `x {number}`: x Position.
|
|
1077
1078
|
* - `y {number}`: y Position.
|
|
@@ -1161,17 +1162,17 @@ const $ZOOM = {
|
|
|
1161
1162
|
* - **NOTE:** The overlapped data points will be displayed as grouped even if set false.
|
|
1162
1163
|
* @property {boolean} [tooltip.linked=false] Set if tooltips on all visible charts with like x points are shown together when one is shown.
|
|
1163
1164
|
* @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.
|
|
1164
|
-
* @property {
|
|
1165
|
+
* @property {function} [tooltip.format.title] Set format for the title of tooltip.<br>
|
|
1165
1166
|
* Specified function receives x of the data point to show.
|
|
1166
|
-
* @property {
|
|
1167
|
+
* @property {function} [tooltip.format.name] Set format for the name of each data in tooltip.<br>
|
|
1167
1168
|
* 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.
|
|
1168
|
-
* @property {
|
|
1169
|
+
* @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.
|
|
1169
1170
|
* - Will pass following arguments to the given function:
|
|
1170
1171
|
* - `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.
|
|
1171
1172
|
* - `ratio {number}`: Ratio of the data point in the `pie/donut/gauge` and `area/bar` when contains grouped data. Otherwise is `undefined`.
|
|
1172
1173
|
* - `id {string}`: id of the data point
|
|
1173
1174
|
* - `index {number}`: Index of the data point
|
|
1174
|
-
* @property {
|
|
1175
|
+
* @property {function} [tooltip.position] Set custom position function for the tooltip.<br>
|
|
1175
1176
|
* This option can be used to modify the tooltip position by returning object that has top and left.
|
|
1176
1177
|
* - Will pass following arguments to the given function:
|
|
1177
1178
|
* - `data {Array}`: Current selected data array object.
|
|
@@ -1179,7 +1180,7 @@ const $ZOOM = {
|
|
|
1179
1180
|
* - `height {number}`: Height of tooltip.
|
|
1180
1181
|
* - `element {SVGElement}`: Tooltip event bound element
|
|
1181
1182
|
* - `pos {object}`: Current position of the tooltip.
|
|
1182
|
-
* @property {
|
|
1183
|
+
* @property {function|object} [tooltip.contents] Set custom HTML for the tooltip.<br>
|
|
1183
1184
|
* If tooltip.grouped is true, data includes multiple data points.<br><br>
|
|
1184
1185
|
* Specified function receives `data` array and `defaultTitleFormat`, `defaultValueFormat` and `color` functions of the data point to show.
|
|
1185
1186
|
* - **Note:**
|
|
@@ -1208,11 +1209,11 @@ const $ZOOM = {
|
|
|
1208
1209
|
* @property {boolean} [tooltip.init.show=false] Show tooltip at the initialization.
|
|
1209
1210
|
* @property {number} [tooltip.init.x=0] Set x Axis index(or index for Arc(donut, gauge, pie) types) to be shown at the initialization.
|
|
1210
1211
|
* @property {object} [tooltip.init.position] Set the position of tooltip at the initialization.
|
|
1211
|
-
* @property {
|
|
1212
|
-
* @property {
|
|
1213
|
-
* @property {
|
|
1214
|
-
* @property {
|
|
1215
|
-
* @property {string|
|
|
1212
|
+
* @property {function} [tooltip.onshow] Set a callback that will be invoked before the tooltip is shown.
|
|
1213
|
+
* @property {function} [tooltip.onhide] Set a callback that will be invoked before the tooltip is hidden.
|
|
1214
|
+
* @property {function} [tooltip.onshown] Set a callback that will be invoked after the tooltip is shown
|
|
1215
|
+
* @property {function} [tooltip.onhidden] Set a callback that will be invoked after the tooltip is hidden.
|
|
1216
|
+
* @property {string|function|null} [tooltip.order=null] Set tooltip data display order.<br><br>
|
|
1216
1217
|
* **Available Values:**
|
|
1217
1218
|
* - `desc`: In descending data value order
|
|
1218
1219
|
* - `asc`: In ascending data value order
|
|
@@ -1251,7 +1252,7 @@ const $ZOOM = {
|
|
|
1251
1252
|
* // yAxis: Current y Axis position value or function(the value is given for axis based chart type only)
|
|
1252
1253
|
* // }
|
|
1253
1254
|
*
|
|
1254
|
-
* // yAxis will work differently per data
|
|
1255
|
+
* // yAxis will work differently per data lengths
|
|
1255
1256
|
* // - a) Single data: `yAxis` will return `number` value
|
|
1256
1257
|
* // - b) Multiple data: `yAxis` will return a function with property value
|
|
1257
1258
|
*
|
|
@@ -1262,8 +1263,8 @@ const $ZOOM = {
|
|
|
1262
1263
|
* // b) Multiple data:
|
|
1263
1264
|
* // Get y coordinate of value 500, where 'data1' scales(y or y2).
|
|
1264
1265
|
* // When 'data.axes' option is used, data can bound to different axes.
|
|
1265
|
-
* // - when "data.axes={data1: 'y'}",
|
|
1266
|
-
* // - when "data.axes={data1: 'y2'}",
|
|
1266
|
+
* // - when "data.axes={data1: 'y'}", will return y value from y axis scale.
|
|
1267
|
+
* // - when "data.axes={data1: 'y2'}", will return y value from y2 axis scale.
|
|
1267
1268
|
* pos.yAxis(500, "data1"); // will return y coordinate value of data1
|
|
1268
1269
|
*
|
|
1269
1270
|
* pos.yAxis(500); // get y coordinate with value of 500, using y axis scale
|
|
@@ -1399,7 +1400,7 @@ const $ZOOM = {
|
|
|
1399
1400
|
/* harmony default export */ var data = ({
|
|
1400
1401
|
/**
|
|
1401
1402
|
* Specify the key of x values in the data.<br><br>
|
|
1402
|
-
* 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.
|
|
1403
|
+
* 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.
|
|
1403
1404
|
* @name data․x
|
|
1404
1405
|
* @memberof Options
|
|
1405
1406
|
* @type {string}
|
|
@@ -1414,7 +1415,7 @@ const $ZOOM = {
|
|
|
1414
1415
|
* Converts data id value
|
|
1415
1416
|
* @name data․idConverter
|
|
1416
1417
|
* @memberof Options
|
|
1417
|
-
* @type {
|
|
1418
|
+
* @type {function}
|
|
1418
1419
|
* @default function(id) { return id; }
|
|
1419
1420
|
* @example
|
|
1420
1421
|
* data: {
|
|
@@ -1583,8 +1584,8 @@ const $ZOOM = {
|
|
|
1583
1584
|
data_types: {},
|
|
1584
1585
|
/**
|
|
1585
1586
|
* This option changes the order of stacking data and pieces of pie/donut.
|
|
1586
|
-
* - If `null` specified, it will be the order the data loaded.
|
|
1587
|
-
* - 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>
|
|
1587
|
+
* - If `null` specified, it will be the order in which the data is loaded.
|
|
1588
|
+
* - 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>
|
|
1588
1589
|
*
|
|
1589
1590
|
* **Available Values:**
|
|
1590
1591
|
* - `desc`: In descending order
|
|
@@ -1592,10 +1593,10 @@ const $ZOOM = {
|
|
|
1592
1593
|
* - `null`: It keeps the data load order
|
|
1593
1594
|
* - `function(data1, data2) { ... }`: Array.sort compareFunction
|
|
1594
1595
|
*
|
|
1595
|
-
* **NOTE**: order function
|
|
1596
|
+
* **NOTE**: order function only works for Axis based types & Arc types, except `Radar` type.
|
|
1596
1597
|
* @name data․order
|
|
1597
1598
|
* @memberof Options
|
|
1598
|
-
* @type {string|
|
|
1599
|
+
* @type {string|function|null}
|
|
1599
1600
|
* @default desc
|
|
1600
1601
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataOrder)
|
|
1601
1602
|
* @example
|
|
@@ -1650,7 +1651,7 @@ const $ZOOM = {
|
|
|
1650
1651
|
/**
|
|
1651
1652
|
* Set how zero value will be treated on groups.<br>
|
|
1652
1653
|
* Possible values:
|
|
1653
|
-
* - `zero`: 0 will be positioned at absolute axis zero point.
|
|
1654
|
+
* - `zero`: 0 will be positioned at the absolute axis zero point.
|
|
1654
1655
|
* - `positive`: 0 will be positioned at the top of a stack.
|
|
1655
1656
|
* - `negative`: 0 will be positioned at the bottom of a stack.
|
|
1656
1657
|
* @name data․groupsZeroAs
|
|
@@ -1666,10 +1667,10 @@ const $ZOOM = {
|
|
|
1666
1667
|
data_groupsZeroAs: "positive",
|
|
1667
1668
|
/**
|
|
1668
1669
|
* Set color converter function.<br><br>
|
|
1669
|
-
* 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').
|
|
1670
|
+
* 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').
|
|
1670
1671
|
* @name data․color
|
|
1671
1672
|
* @memberof Options
|
|
1672
|
-
* @type {
|
|
1673
|
+
* @type {function}
|
|
1673
1674
|
* @default undefined
|
|
1674
1675
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataColor)
|
|
1675
1676
|
* @example
|
|
@@ -1702,41 +1703,41 @@ const $ZOOM = {
|
|
|
1702
1703
|
* @memberof Options
|
|
1703
1704
|
* @type {object}
|
|
1704
1705
|
* @property {object} data Data object
|
|
1705
|
-
* @property {boolean} [data.labels=false] Show or hide labels on each data
|
|
1706
|
+
* @property {boolean} [data.labels=false] Show or hide labels on each data point
|
|
1706
1707
|
* @property {boolean} [data.labels.centered=false] Centerize labels on `bar` shape. (**NOTE:** works only for 'bar' type)
|
|
1707
|
-
* @property {
|
|
1708
|
+
* @property {function} [data.labels.format] Set formatter function for data labels.<br>
|
|
1708
1709
|
* 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>
|
|
1709
1710
|
* The arguments are:<br>
|
|
1710
1711
|
* - `v` is the value of the data point where the label is shown.
|
|
1711
1712
|
* - `id` is the id of the data where the label is shown.
|
|
1712
1713
|
* - `i` is the index of the data series point where the label is shown.
|
|
1713
|
-
* - `texts` is
|
|
1714
|
+
* - `texts` is an array of whole corresponding data series' text labels.<br><br>
|
|
1714
1715
|
* Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (ex. d3.format('$'))
|
|
1715
|
-
* @property {string|object|
|
|
1716
|
-
* - **NOTE**: When function is set, background colors can be specified one color per dataset.
|
|
1716
|
+
* @property {string|object|function} [data.labels.backgroundColors] Set label text background colors.<br><br>
|
|
1717
|
+
* - **NOTE**: When a function is set, background colors can be specified one color per dataset.
|
|
1717
1718
|
* - Within the function, the last returned color for dataset will be used.
|
|
1718
1719
|
* - Only can control set or unset background color for each values.
|
|
1719
|
-
* @property {string|object|
|
|
1720
|
-
* @property {object|
|
|
1721
|
-
* When function is specified, will
|
|
1720
|
+
* @property {string|object|function} [data.labels.colors] Set label text colors.
|
|
1721
|
+
* @property {object|function} [data.labels.position] Set each dataset position, relative to the original.<br><br>
|
|
1722
|
+
* 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>
|
|
1722
1723
|
* The arguments are:<br>
|
|
1723
1724
|
* - `type` coordinate type string, which will be 'x' or 'y'.
|
|
1724
1725
|
* - `v` is the value of the data point where the label is shown.
|
|
1725
1726
|
* - `id` is the id of the data where the label is shown.
|
|
1726
1727
|
* - `i` is the index of the data series point where the label is shown.
|
|
1727
|
-
* - `texts` is
|
|
1728
|
-
* @property {number} [data.labels.position.x=0] x coordinate position, relative the original.
|
|
1729
|
-
* @property {number} [data.labels.position.y=0] y coordinate position, relative the original.
|
|
1728
|
+
* - `texts` is an array of whole corresponding data series' text labels.<br><br>
|
|
1729
|
+
* @property {number} [data.labels.position.x=0] x coordinate position, relative to the original.
|
|
1730
|
+
* @property {number} [data.labels.position.y=0] y coordinate position, relative to the original.
|
|
1730
1731
|
* @property {object} [data.labels.rotate] Rotate label text. Specify degree value in a range of `0 ~ 360`.
|
|
1731
|
-
* - **NOTE:**
|
|
1732
|
-
* @property {boolean|object} [data.labels.border=false] Add border to data label text. NOTE: When set as `true`, styling
|
|
1732
|
+
* - **NOTE:** Depending on the rotate value, the text position needs to be adjusted manually(using `data.labels.position` option) to be shown nicely.
|
|
1733
|
+
* @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.
|
|
1733
1734
|
* @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.
|
|
1734
1735
|
* @property {number} [data.labels.border.radius=10] Border radius value.
|
|
1735
1736
|
* @property {number} [data.labels.border.strokeWidth=1] Border stroke width.
|
|
1736
1737
|
* @property {string} [data.labels.border.stroke="#000"] Border stroke color.
|
|
1737
1738
|
* @property {string} [data.labels.border.fill="none"] Border fill color.
|
|
1738
|
-
* @property {object|
|
|
1739
|
-
* When function is specified, will
|
|
1739
|
+
* @property {object|function} [data.labels.image] Set image to be displayed next to the label text.<br><br>
|
|
1740
|
+
* 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>
|
|
1740
1741
|
* The arguments are:<br>
|
|
1741
1742
|
* - `v` is the value of the data point where the label is shown.
|
|
1742
1743
|
* - `id` is the id of the data where the label is shown.
|
|
@@ -1745,8 +1746,8 @@ const $ZOOM = {
|
|
|
1745
1746
|
* @property {number} data.labels.image.width Image width in pixels.
|
|
1746
1747
|
* @property {number} data.labels.image.height Image height in pixels.
|
|
1747
1748
|
* @property {object} [data.labels.image.pos] Image position relative to the label text.
|
|
1748
|
-
* @property {number} [data.labels.image.pos.x=0] x coordinate position, relative the original.
|
|
1749
|
-
* @property {number} [data.labels.image.pos.y=0] y coordinate position, relative the original.
|
|
1749
|
+
* @property {number} [data.labels.image.pos.x=0] x coordinate position, relative to the original.
|
|
1750
|
+
* @property {number} [data.labels.image.pos.y=0] y coordinate position, relative to the original.
|
|
1750
1751
|
* @memberof Options
|
|
1751
1752
|
* @type {object}
|
|
1752
1753
|
* @default {}
|
|
@@ -1780,10 +1781,10 @@ const $ZOOM = {
|
|
|
1780
1781
|
* // align text to center of the 'bar' shape (works only for 'bar' type)
|
|
1781
1782
|
* centered: true,
|
|
1782
1783
|
*
|
|
1783
|
-
* // apply
|
|
1784
|
+
* // apply background color for label texts
|
|
1784
1785
|
* backgroundColors: "red",
|
|
1785
1786
|
*
|
|
1786
|
-
* // set
|
|
1787
|
+
* // set different background colors per dataset
|
|
1787
1788
|
* backgroundColors: {
|
|
1788
1789
|
* data1: "green",
|
|
1789
1790
|
* data2: "yellow"
|
|
@@ -1894,7 +1895,7 @@ const $ZOOM = {
|
|
|
1894
1895
|
* pos: { x: 0, y: 0 }
|
|
1895
1896
|
* };
|
|
1896
1897
|
* } else if(v < 5) {
|
|
1897
|
-
* // Return falsy value in case
|
|
1898
|
+
* // Return falsy value in case you don't want to show image
|
|
1898
1899
|
* return null;
|
|
1899
1900
|
* } else {
|
|
1900
1901
|
* return {
|
|
@@ -1915,7 +1916,7 @@ const $ZOOM = {
|
|
|
1915
1916
|
data_labels_imgUrl: void 0,
|
|
1916
1917
|
/**
|
|
1917
1918
|
* Hide each data when the chart appears.<br><br>
|
|
1918
|
-
* If true specified, all of data will be hidden. If multiple ids specified as an array, those will be hidden.
|
|
1919
|
+
* If true is specified, all of data will be hidden. If multiple ids are specified as an array, those will be hidden.
|
|
1919
1920
|
* @name data․hide
|
|
1920
1921
|
* @memberof Options
|
|
1921
1922
|
* @type {boolean|Array}
|
|
@@ -1936,7 +1937,7 @@ const $ZOOM = {
|
|
|
1936
1937
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
|
|
1937
1938
|
* @name data․filter
|
|
1938
1939
|
* @memberof Options
|
|
1939
|
-
* @type {
|
|
1940
|
+
* @type {function}
|
|
1940
1941
|
* @default undefined
|
|
1941
1942
|
* @example
|
|
1942
1943
|
* data: {
|
|
@@ -1951,13 +1952,13 @@ const $ZOOM = {
|
|
|
1951
1952
|
data_filter: void 0,
|
|
1952
1953
|
/**
|
|
1953
1954
|
* Set a callback for click event on each data point.<br><br>
|
|
1954
|
-
* This callback will be called when each data point clicked and will receive `d` and element as the arguments.
|
|
1955
|
+
* This callback will be called when each data point is clicked and will receive `d` and element as the arguments.
|
|
1955
1956
|
* - `d` is the data clicked and element is the element clicked.
|
|
1956
1957
|
* - `element` is the current interacting svg element.
|
|
1957
1958
|
* - In this callback, `this` will be the Chart object.
|
|
1958
1959
|
* @name data․onclick
|
|
1959
1960
|
* @memberof Options
|
|
1960
|
-
* @type {
|
|
1961
|
+
* @type {function}
|
|
1961
1962
|
* @default function() {}
|
|
1962
1963
|
* @example
|
|
1963
1964
|
* data: {
|
|
@@ -1972,13 +1973,13 @@ const $ZOOM = {
|
|
|
1972
1973
|
},
|
|
1973
1974
|
/**
|
|
1974
1975
|
* Set a callback for mouse/touch over event on each data point.<br><br>
|
|
1975
|
-
* This callback will be called when mouse cursor or
|
|
1976
|
+
* 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.
|
|
1976
1977
|
* - `d` is the data where mouse cursor moves onto.
|
|
1977
1978
|
* - `element` is the current interacting svg element.
|
|
1978
1979
|
* - In this callback, `this` will be the Chart object.
|
|
1979
1980
|
* @name data․onover
|
|
1980
1981
|
* @memberof Options
|
|
1981
|
-
* @type {
|
|
1982
|
+
* @type {function}
|
|
1982
1983
|
* @default function() {}
|
|
1983
1984
|
* @example
|
|
1984
1985
|
* data: {
|
|
@@ -1993,13 +1994,13 @@ const $ZOOM = {
|
|
|
1993
1994
|
},
|
|
1994
1995
|
/**
|
|
1995
1996
|
* Set a callback for mouse/touch out event on each data point.<br><br>
|
|
1996
|
-
* This callback will be called when mouse cursor or
|
|
1997
|
+
* This callback will be called when the mouse cursor or touch moves out each data point and will receive `d` as the argument.
|
|
1997
1998
|
* - `d` is the data where mouse cursor moves out.
|
|
1998
1999
|
* - `element` is the current interacting svg element.
|
|
1999
2000
|
* - In this callback, `this` will be the Chart object.
|
|
2000
2001
|
* @name data․onout
|
|
2001
2002
|
* @memberof Options
|
|
2002
|
-
* @type {
|
|
2003
|
+
* @type {function}
|
|
2003
2004
|
* @default function() {}
|
|
2004
2005
|
* @example
|
|
2005
2006
|
* data: {
|
|
@@ -2017,7 +2018,7 @@ const $ZOOM = {
|
|
|
2017
2018
|
* The callback will receive shown data ids in array.
|
|
2018
2019
|
* @name data․onshown
|
|
2019
2020
|
* @memberof Options
|
|
2020
|
-
* @type {
|
|
2021
|
+
* @type {function}
|
|
2021
2022
|
* @default undefined
|
|
2022
2023
|
* @example
|
|
2023
2024
|
* data: {
|
|
@@ -2033,7 +2034,7 @@ const $ZOOM = {
|
|
|
2033
2034
|
* The callback will receive hidden data ids in array.
|
|
2034
2035
|
* @name data․onhidden
|
|
2035
2036
|
* @memberof Options
|
|
2036
|
-
* @type {
|
|
2037
|
+
* @type {function}
|
|
2037
2038
|
* @default undefined
|
|
2038
2039
|
* @example
|
|
2039
2040
|
* data: {
|
|
@@ -2049,7 +2050,7 @@ const $ZOOM = {
|
|
|
2049
2050
|
* - **NOTE:** For 'area-line-range', 'area-step-range' and 'area-spline-range', `mid` data will be taken for the comparison
|
|
2050
2051
|
* @name data․onmin
|
|
2051
2052
|
* @memberof Options
|
|
2052
|
-
* @type {
|
|
2053
|
+
* @type {function}
|
|
2053
2054
|
* @default undefined
|
|
2054
2055
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Data.OnMinMaxCallback)
|
|
2055
2056
|
* @example
|
|
@@ -2064,7 +2065,7 @@ const $ZOOM = {
|
|
|
2064
2065
|
* - **NOTE:** For 'area-line-range', 'area-step-range' and 'area-spline-range', `mid` data will be taken for the comparison
|
|
2065
2066
|
* @name data․onmax
|
|
2066
2067
|
* @memberof Options
|
|
2067
|
-
* @type {
|
|
2068
|
+
* @type {function}
|
|
2068
2069
|
* @default undefined
|
|
2069
2070
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Data.OnMinMaxCallback)
|
|
2070
2071
|
* @example
|
|
@@ -2075,7 +2076,7 @@ const $ZOOM = {
|
|
|
2075
2076
|
*/
|
|
2076
2077
|
data_onmax: void 0,
|
|
2077
2078
|
/**
|
|
2078
|
-
* Load a CSV or JSON file from a URL. NOTE that this will not work if loading via the "file://" protocol as
|
|
2079
|
+
* 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.
|
|
2079
2080
|
* @name data․url
|
|
2080
2081
|
* @memberof Options
|
|
2081
2082
|
* @type {string}
|
|
@@ -2203,7 +2204,7 @@ const $ZOOM = {
|
|
|
2203
2204
|
* }
|
|
2204
2205
|
* }
|
|
2205
2206
|
*
|
|
2206
|
-
* // for '
|
|
2207
|
+
* // for 'candlestick' type, data should contain:
|
|
2207
2208
|
* // - an array of [open, high, low, close, volume(optional)] data following the order
|
|
2208
2209
|
* // - or an object with 'open', 'high', 'low', 'close' and 'value'(optional) key value
|
|
2209
2210
|
* data: {
|
|
@@ -2278,7 +2279,7 @@ const $ZOOM = {
|
|
|
2278
2279
|
* type: "bubble"
|
|
2279
2280
|
* }
|
|
2280
2281
|
*
|
|
2281
|
-
* // for '
|
|
2282
|
+
* // for 'candlestick' type, data should contain:
|
|
2282
2283
|
* // - an array of [open, high, low, close, volume(optional)] data following the order
|
|
2283
2284
|
* // - or an object with 'open', 'high', 'low', 'close' and 'value'(optional) key value
|
|
2284
2285
|
* data: {
|
|
@@ -2366,7 +2367,8 @@ const $ZOOM = {
|
|
|
2366
2367
|
* @property {boolean} [interaction.brighten=true] Make brighter for the selected area (ex. 'pie' type data selected area)
|
|
2367
2368
|
* @property {boolean} [interaction.inputType.mouse=true] enable or disable mouse interaction
|
|
2368
2369
|
* @property {boolean} [interaction.inputType.touch=true] enable or disable touch interaction
|
|
2369
|
-
* @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
|
|
2370
|
+
* @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>
|
|
2371
|
+
* - **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.
|
|
2370
2372
|
* @property {boolean} [interaction.onout=true] Enable or disable "onout" event.<br>
|
|
2371
2373
|
* When is disabled, defocus(hiding tooltip, focused gridline, etc.) event won't work.
|
|
2372
2374
|
* @see [Demo: touch.preventDefault](https://naver.github.io/billboard.js/demo/#Interaction.PreventScrollOnTouch)
|
|
@@ -2494,20 +2496,28 @@ function endall(transition, cb) {
|
|
|
2494
2496
|
transition.call(end);
|
|
2495
2497
|
}
|
|
2496
2498
|
}
|
|
2497
|
-
const
|
|
2499
|
+
const DANGEROUS_TAGS = "script|iframe|object|embed|form|input|button|textarea|select|style|link|meta|base|math|isindex";
|
|
2498
2500
|
const sanitizeRx = {
|
|
2499
2501
|
tags: new RegExp(
|
|
2500
|
-
`<(${
|
|
2502
|
+
`<(${DANGEROUS_TAGS})\\b[\\s\\S]*?>([\\s\\S]*?<\\/(${DANGEROUS_TAGS})\\s*>)?`,
|
|
2501
2503
|
"gi"
|
|
2502
2504
|
),
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
+
// Handles: whitespace, slash, quotes before event handlers (e.g., <img/onerror=...>, <img src="x"onerror=...>)
|
|
2506
|
+
eventHandlers: /[\s/"']+on\w+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+)/gi,
|
|
2507
|
+
// Handles: javascript/data/vbscript URIs with optional whitespace/newlines between protocol and colon
|
|
2508
|
+
dangerousURIs: /(href|src|action|xlink:href)\s*=\s*["']?\s*(javascript|data|vbscript)\s*:/gi
|
|
2505
2509
|
};
|
|
2506
2510
|
function sanitize(str) {
|
|
2507
2511
|
if (!isString(str) || !str || str.indexOf("<") === -1) {
|
|
2508
2512
|
return str;
|
|
2509
2513
|
}
|
|
2510
|
-
|
|
2514
|
+
let result = str;
|
|
2515
|
+
let prev;
|
|
2516
|
+
do {
|
|
2517
|
+
prev = result;
|
|
2518
|
+
result = result.replace(sanitizeRx.tags, "").replace(sanitizeRx.eventHandlers, "").replace(sanitizeRx.dangerousURIs, '$1=""');
|
|
2519
|
+
} while (result !== prev);
|
|
2520
|
+
return result;
|
|
2511
2521
|
}
|
|
2512
2522
|
function setTextValue(node, text, dy = [-1, 1], toMiddle = false) {
|
|
2513
2523
|
if (!node || !isString(text)) {
|
|
@@ -3221,9 +3231,9 @@ class Cache {
|
|
|
3221
3231
|
/**
|
|
3222
3232
|
* Add cache
|
|
3223
3233
|
* @param {string} key Cache key
|
|
3224
|
-
* @param {
|
|
3234
|
+
* @param {string|number|boolean|object|Array|function|null|undefined} value Value to be stored
|
|
3225
3235
|
* @param {boolean} isDataType Weather the cache is data typed '{id:'data', id_org: 'data', values: [{x:0, index:0,...}, ...]}'
|
|
3226
|
-
* @returns {
|
|
3236
|
+
* @returns {string|number|boolean|object|Array|function|null|undefined} Added data value
|
|
3227
3237
|
* @private
|
|
3228
3238
|
*/
|
|
3229
3239
|
add(key, value, isDataType = false) {
|
|
@@ -3242,7 +3252,7 @@ class Cache {
|
|
|
3242
3252
|
* Get cahce
|
|
3243
3253
|
* @param {string|Array} key Cache key
|
|
3244
3254
|
* @param {boolean} isDataType Weather the cache is data typed '{id:'data', id_org: 'data', values: [{x:0, index:0,...}, ...]}'
|
|
3245
|
-
* @returns {
|
|
3255
|
+
* @returns {string|number|boolean|object|Array|function|null} Cached value
|
|
3246
3256
|
* @private
|
|
3247
3257
|
*/
|
|
3248
3258
|
get(key, isDataType = false) {
|
|
@@ -3706,7 +3716,7 @@ function setXS(ids, data, params) {
|
|
|
3706
3716
|
/**
|
|
3707
3717
|
* Convert data according its type
|
|
3708
3718
|
* @param {object} args data object
|
|
3709
|
-
* @param {
|
|
3719
|
+
* @param {function} [callback] callback for url(XHR) type loading
|
|
3710
3720
|
* @private
|
|
3711
3721
|
*/
|
|
3712
3722
|
convertData(args, callback) {
|
|
@@ -3857,7 +3867,17 @@ function setXS(ids, data, params) {
|
|
|
3857
3867
|
},
|
|
3858
3868
|
isStackNormalized() {
|
|
3859
3869
|
const { config } = this;
|
|
3860
|
-
return !!(config.data_stack_normalize && config.data_groups.length);
|
|
3870
|
+
return !!((config.data_stack_normalize === true || isObjectType(config.data_stack_normalize)) && config.data_groups.length);
|
|
3871
|
+
},
|
|
3872
|
+
/**
|
|
3873
|
+
* Check if stack normalization should be applied per group
|
|
3874
|
+
* @returns {boolean}
|
|
3875
|
+
* @private
|
|
3876
|
+
*/
|
|
3877
|
+
isStackNormalizedPerGroup() {
|
|
3878
|
+
var _a;
|
|
3879
|
+
const { config } = this;
|
|
3880
|
+
return !!(isObjectType(config.data_stack_normalize) && ((_a = config.data_stack_normalize) == null ? void 0 : _a.perGroup) && config.data_groups.length);
|
|
3861
3881
|
},
|
|
3862
3882
|
/**
|
|
3863
3883
|
* Check if given id is grouped data or has grouped data
|
|
@@ -3869,6 +3889,19 @@ function setXS(ids, data, params) {
|
|
|
3869
3889
|
const groups = this.config.data_groups;
|
|
3870
3890
|
return id ? groups.some((v) => v.indexOf(id) >= 0 && v.length > 1) : groups.length > 0;
|
|
3871
3891
|
},
|
|
3892
|
+
/**
|
|
3893
|
+
* Check if the given axis has any grouped data
|
|
3894
|
+
* @param {string} axisId Axis ID (e.g., "y", "y2")
|
|
3895
|
+
* @returns {boolean} true if axis has grouped data
|
|
3896
|
+
* @private
|
|
3897
|
+
*/
|
|
3898
|
+
hasAxisGroupedData(axisId) {
|
|
3899
|
+
const $$ = this;
|
|
3900
|
+
const { axis } = $$;
|
|
3901
|
+
const targets = $$.data.targets;
|
|
3902
|
+
const axisDataIds = targets.filter((t) => axis.getId(t.id) === axisId).map((t) => t.id);
|
|
3903
|
+
return axisDataIds.some((id) => $$.isGrouped(id));
|
|
3904
|
+
},
|
|
3872
3905
|
getXKey(id) {
|
|
3873
3906
|
const $$ = this;
|
|
3874
3907
|
const { config } = $$;
|
|
@@ -4060,16 +4093,27 @@ function setXS(ids, data, params) {
|
|
|
4060
4093
|
},
|
|
4061
4094
|
/**
|
|
4062
4095
|
* Get sum of data per index
|
|
4096
|
+
* @param {string} targetId Target ID to get total for (only for normalized stack per group)
|
|
4063
4097
|
* @private
|
|
4064
4098
|
* @returns {Array}
|
|
4065
4099
|
*/
|
|
4066
|
-
getTotalPerIndex() {
|
|
4100
|
+
getTotalPerIndex(targetId) {
|
|
4067
4101
|
const $$ = this;
|
|
4068
|
-
const
|
|
4102
|
+
const { config } = $$;
|
|
4103
|
+
const cacheKey = targetId ? `${KEY.dataTotalPerIndex}-${targetId}` : KEY.dataTotalPerIndex;
|
|
4069
4104
|
let sum = $$.cache.get(cacheKey);
|
|
4070
4105
|
if (($$.config.data_groups.length || $$.isStackNormalized()) && !sum) {
|
|
4071
4106
|
sum = [];
|
|
4072
|
-
|
|
4107
|
+
let { targets } = $$.data;
|
|
4108
|
+
if ($$.isStackNormalizedPerGroup() && targetId) {
|
|
4109
|
+
const group = config.data_groups.find((g) => g.indexOf(targetId) >= 0);
|
|
4110
|
+
if (group) {
|
|
4111
|
+
targets = targets.filter((t) => group.indexOf(t.id) >= 0);
|
|
4112
|
+
} else {
|
|
4113
|
+
return null;
|
|
4114
|
+
}
|
|
4115
|
+
}
|
|
4116
|
+
targets.forEach((row) => {
|
|
4073
4117
|
row.values.forEach((v, i) => {
|
|
4074
4118
|
if (!sum[i]) {
|
|
4075
4119
|
sum[i] = 0;
|
|
@@ -4077,6 +4121,7 @@ function setXS(ids, data, params) {
|
|
|
4077
4121
|
sum[i] += ~~v.value;
|
|
4078
4122
|
});
|
|
4079
4123
|
});
|
|
4124
|
+
$$.cache.add(cacheKey, sum);
|
|
4080
4125
|
}
|
|
4081
4126
|
return sum;
|
|
4082
4127
|
},
|
|
@@ -4092,7 +4137,10 @@ function setXS(ids, data, params) {
|
|
|
4092
4137
|
let total = $$.cache.get(cacheKey);
|
|
4093
4138
|
if (!isNumber(total)) {
|
|
4094
4139
|
total = $$.data.targets.reduce((acc, t) => {
|
|
4095
|
-
return acc + t.values.reduce((sum, v) =>
|
|
4140
|
+
return acc + t.values.reduce((sum, v) => {
|
|
4141
|
+
var _a;
|
|
4142
|
+
return sum + ((_a = v.value) != null ? _a : 0);
|
|
4143
|
+
}, 0);
|
|
4096
4144
|
}, 0);
|
|
4097
4145
|
$$.cache.add(cacheKey, total);
|
|
4098
4146
|
}
|
|
@@ -4187,7 +4235,7 @@ function setXS(ids, data, params) {
|
|
|
4187
4235
|
return sortValue(xs);
|
|
4188
4236
|
},
|
|
4189
4237
|
/**
|
|
4190
|
-
* Add to
|
|
4238
|
+
* Add to thetarget Ids
|
|
4191
4239
|
* @param {string} type State's prop name
|
|
4192
4240
|
* @param {Array|string} targetIds Target ids array
|
|
4193
4241
|
* @private
|
|
@@ -4285,7 +4333,7 @@ function setXS(ids, data, params) {
|
|
|
4285
4333
|
/**
|
|
4286
4334
|
* Get data.order compare function
|
|
4287
4335
|
* @param {boolean} isReversed for Arc & Treemap type sort order needs to be reversed
|
|
4288
|
-
* @returns {
|
|
4336
|
+
* @returns {function} compare function
|
|
4289
4337
|
* @private
|
|
4290
4338
|
*/
|
|
4291
4339
|
getSortCompareFn(isReversed = false) {
|
|
@@ -4567,12 +4615,27 @@ function setXS(ids, data, params) {
|
|
|
4567
4615
|
}
|
|
4568
4616
|
} else if (type === "index") {
|
|
4569
4617
|
const dataValues = api.data.values.bind(api);
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4618
|
+
const { hiddenTargetIds } = state;
|
|
4619
|
+
let total = this.getTotalPerIndex(
|
|
4620
|
+
$$.isStackNormalizedPerGroup() ? d.id : void 0
|
|
4621
|
+
);
|
|
4622
|
+
if (total === null) {
|
|
4623
|
+
return ratio;
|
|
4624
|
+
}
|
|
4625
|
+
if (hiddenTargetIds.length) {
|
|
4626
|
+
let hiddenIds = hiddenTargetIds;
|
|
4627
|
+
if ($$.isStackNormalizedPerGroup() && d.id) {
|
|
4628
|
+
const group = config.data_groups.find((g) => g.indexOf(d.id) >= 0);
|
|
4629
|
+
if (group) {
|
|
4630
|
+
hiddenIds = hiddenIds.filter((id) => group.indexOf(id) >= 0);
|
|
4631
|
+
}
|
|
4632
|
+
}
|
|
4633
|
+
if (hiddenIds.length) {
|
|
4634
|
+
let hiddenSum = dataValues(hiddenIds, false);
|
|
4635
|
+
if (hiddenSum.length) {
|
|
4636
|
+
hiddenSum = hiddenSum.reduce((acc, curr) => acc.map((v, i) => ~~v + curr[i]));
|
|
4637
|
+
total = total.map((v, i) => v - hiddenSum[i]);
|
|
4638
|
+
}
|
|
4576
4639
|
}
|
|
4577
4640
|
}
|
|
4578
4641
|
const divisor = total[d.index];
|
|
@@ -4750,8 +4813,6 @@ function callDone(fn, resizeAfter = false) {
|
|
|
4750
4813
|
done();
|
|
4751
4814
|
return;
|
|
4752
4815
|
}
|
|
4753
|
-
const targets = $el.svg.selectAll(targetIds.map((id) => $$.selectorTarget(id)));
|
|
4754
|
-
$T(targets).style("opacity", "0").remove().call(endall, done);
|
|
4755
4816
|
targetIds.forEach((id) => {
|
|
4756
4817
|
var _a2;
|
|
4757
4818
|
const suffixId = $$.getTargetSelectorSuffix(id);
|
|
@@ -4765,6 +4826,8 @@ function callDone(fn, resizeAfter = false) {
|
|
|
4765
4826
|
state.hasFunnel && $$.updateFunnel($$.data.targets);
|
|
4766
4827
|
state.hasTreemap && $$.updateTargetsForTreemap($$.data.targets);
|
|
4767
4828
|
$$.updateTypesElements();
|
|
4829
|
+
const targets = $el.svg.selectAll(targetIds.map((id) => $$.selectorTarget(id)));
|
|
4830
|
+
$T(targets).style("opacity", "0").remove().call(endall, done);
|
|
4768
4831
|
}
|
|
4769
4832
|
});
|
|
4770
4833
|
|
|
@@ -4869,7 +4932,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
4869
4932
|
},
|
|
4870
4933
|
/**
|
|
4871
4934
|
* Return draggable selection function
|
|
4872
|
-
* @returns {
|
|
4935
|
+
* @returns {function}
|
|
4873
4936
|
* @private
|
|
4874
4937
|
*/
|
|
4875
4938
|
getDraggableSelection() {
|
|
@@ -5151,6 +5214,7 @@ const schemeCategory10 = [
|
|
|
5151
5214
|
const $$ = this;
|
|
5152
5215
|
const { $el, config } = $$;
|
|
5153
5216
|
const ids = [];
|
|
5217
|
+
const hasGradient = config.area_linearGradient || config.bar_linearGradient || config.point_radialGradient;
|
|
5154
5218
|
let pattern = notEmpty(config.color_pattern) ? config.color_pattern : (0,external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleOrdinal)(getColorFromCss($el.chart) || schemeCategory10).range();
|
|
5155
5219
|
const originalColorPattern = pattern;
|
|
5156
5220
|
if (isFunction(config.color_tiles)) {
|
|
@@ -5181,7 +5245,18 @@ const schemeCategory10 = [
|
|
|
5181
5245
|
color = isLine ? originalColorPattern[ids.indexOf(id) % originalColorPattern.length] : pattern[ids.indexOf(id) % pattern.length];
|
|
5182
5246
|
colors[id] = color;
|
|
5183
5247
|
}
|
|
5184
|
-
|
|
5248
|
+
color = isFunction(callback) ? callback.call($$.api, color, d) : color;
|
|
5249
|
+
if (hasGradient) {
|
|
5250
|
+
const stop = $$.$el.defs.selectAll(
|
|
5251
|
+
`[id$='-gradient${$$.getTargetSelectorSuffix(id)}'] stop`
|
|
5252
|
+
);
|
|
5253
|
+
let hasSameColor;
|
|
5254
|
+
stop.each(function(d2, i) {
|
|
5255
|
+
hasSameColor = i === 0 ? this.style.stopColor : this.style.stopColor === hasSameColor;
|
|
5256
|
+
});
|
|
5257
|
+
hasSameColor === true && stop.attr("stop-color", color);
|
|
5258
|
+
}
|
|
5259
|
+
return color;
|
|
5185
5260
|
};
|
|
5186
5261
|
},
|
|
5187
5262
|
generateLevelColor() {
|
|
@@ -5206,7 +5281,7 @@ const schemeCategory10 = [
|
|
|
5206
5281
|
},
|
|
5207
5282
|
/**
|
|
5208
5283
|
* Append data backgound color filter definition
|
|
5209
|
-
* @param {string|object|
|
|
5284
|
+
* @param {string|object|function} color Color string, object, or function
|
|
5210
5285
|
* @param {object} attr filter attribute
|
|
5211
5286
|
* @private
|
|
5212
5287
|
*/
|
|
@@ -5373,7 +5448,11 @@ const schemeCategory10 = [
|
|
|
5373
5448
|
const { axis, config, scale } = $$;
|
|
5374
5449
|
const pfx = `axis_${axisId}`;
|
|
5375
5450
|
if ($$.isStackNormalized()) {
|
|
5376
|
-
|
|
5451
|
+
const axisDataIds = targets.filter((t) => axis.getId(t.id) === axisId).map((t) => t.id);
|
|
5452
|
+
const hasGroupedData = axisDataIds.some((id) => $$.isGrouped(id));
|
|
5453
|
+
if (hasGroupedData) {
|
|
5454
|
+
return [0, 100];
|
|
5455
|
+
}
|
|
5377
5456
|
}
|
|
5378
5457
|
const isLog = (scale == null ? void 0 : scale[axisId]) && scale[axisId].type === "log";
|
|
5379
5458
|
const targetsByAxisId = targets.filter((t) => axis.getId(t.id) === axisId);
|
|
@@ -5691,7 +5770,7 @@ function getFormat($$, typeValue, v) {
|
|
|
5691
5770
|
},
|
|
5692
5771
|
/**
|
|
5693
5772
|
* Get default value format function
|
|
5694
|
-
* @returns {
|
|
5773
|
+
* @returns {function} formatter function
|
|
5695
5774
|
* @private
|
|
5696
5775
|
*/
|
|
5697
5776
|
getDefaultValueFormat() {
|
|
@@ -6215,7 +6294,7 @@ function getFormattedText(id, formatted = true) {
|
|
|
6215
6294
|
* @param {Array} targetIdz Data ids
|
|
6216
6295
|
* @param {object} dimension Dimension object
|
|
6217
6296
|
* @param {object} sizes Size object
|
|
6218
|
-
* @returns {
|
|
6297
|
+
* @returns {function} Update position function
|
|
6219
6298
|
* @private
|
|
6220
6299
|
*/
|
|
6221
6300
|
getUpdateLegendPositions(targetIdz, dimension, sizes) {
|
|
@@ -6289,7 +6368,7 @@ function getFormattedText(id, formatted = true) {
|
|
|
6289
6368
|
* Generate legend item elements
|
|
6290
6369
|
* @param {Array} targetIdz Data ids
|
|
6291
6370
|
* @param {object} itemTileSize Item tile size {width, height}
|
|
6292
|
-
* @param {
|
|
6371
|
+
* @param {function} updatePositions Update position function
|
|
6293
6372
|
* @param {object} posFn Position functions
|
|
6294
6373
|
* @private
|
|
6295
6374
|
*/
|
|
@@ -6584,8 +6663,8 @@ function getScale(type = "linear", min, max) {
|
|
|
6584
6663
|
* @param {number} min Min range value
|
|
6585
6664
|
* @param {number} max Max range value
|
|
6586
6665
|
* @param {Array} domain Domain value
|
|
6587
|
-
* @param {
|
|
6588
|
-
* @returns {
|
|
6666
|
+
* @param {function} offset The offset getter to be sum
|
|
6667
|
+
* @returns {function} scale
|
|
6589
6668
|
* @private
|
|
6590
6669
|
*/
|
|
6591
6670
|
getXScale(min, max, domain, offset) {
|
|
@@ -6602,7 +6681,7 @@ function getScale(type = "linear", min, max) {
|
|
|
6602
6681
|
* @param {number} min Min value
|
|
6603
6682
|
* @param {number} max Max value
|
|
6604
6683
|
* @param {Array} domain Domain value
|
|
6605
|
-
* @returns {
|
|
6684
|
+
* @returns {function} Scale function
|
|
6606
6685
|
* @private
|
|
6607
6686
|
*/
|
|
6608
6687
|
getYScale(id, min, max, domain) {
|
|
@@ -6615,7 +6694,7 @@ function getScale(type = "linear", min, max) {
|
|
|
6615
6694
|
* Get y Axis scale
|
|
6616
6695
|
* @param {string} id Axis id
|
|
6617
6696
|
* @param {boolean} isSub Weather is sub Axis
|
|
6618
|
-
* @returns {
|
|
6697
|
+
* @returns {function} Scale function
|
|
6619
6698
|
* @private
|
|
6620
6699
|
*/
|
|
6621
6700
|
getYScaleById(id, isSub = false) {
|
|
@@ -6627,8 +6706,8 @@ function getScale(type = "linear", min, max) {
|
|
|
6627
6706
|
/**
|
|
6628
6707
|
* Get customized x axis scale
|
|
6629
6708
|
* @param {d3.scaleLinear|d3.scaleTime} scaleValue Scale function
|
|
6630
|
-
* @param {
|
|
6631
|
-
* @returns {
|
|
6709
|
+
* @param {function} offsetValue Offset getter to be sum
|
|
6710
|
+
* @returns {function} Scale function
|
|
6632
6711
|
* @private
|
|
6633
6712
|
*/
|
|
6634
6713
|
getCustomizedXScale(scaleValue, offsetValue) {
|
|
@@ -7078,8 +7157,8 @@ function getScale(type = "linear", min, max) {
|
|
|
7078
7157
|
* @param {boolean} withShape Set shpes' prefix class
|
|
7079
7158
|
* @param {string} selector CSS selector
|
|
7080
7159
|
* @param {Array} props CSS props list
|
|
7081
|
-
* @param {
|
|
7082
|
-
* @returns {
|
|
7160
|
+
* @param {function} propsFn Function to retrieve value or determine for props
|
|
7161
|
+
* @returns {function}
|
|
7083
7162
|
* @private
|
|
7084
7163
|
*/
|
|
7085
7164
|
setCssRule(withShape, selector, props, propsFn) {
|
|
@@ -7101,7 +7180,7 @@ function getScale(type = "linear", min, max) {
|
|
|
7101
7180
|
},
|
|
7102
7181
|
/**
|
|
7103
7182
|
* Get style prop value
|
|
7104
|
-
* @param {
|
|
7183
|
+
* @param {function|string} v Value
|
|
7105
7184
|
* @returns {string|null}
|
|
7106
7185
|
* @private
|
|
7107
7186
|
*/
|
|
@@ -7365,7 +7444,7 @@ function updateTextImagePos(textNode, pos) {
|
|
|
7365
7444
|
if (isNumber(value)) {
|
|
7366
7445
|
this.textContent = value;
|
|
7367
7446
|
} else {
|
|
7368
|
-
setTextValue(node, value);
|
|
7447
|
+
setTextValue(node, value, void 0, true);
|
|
7369
7448
|
}
|
|
7370
7449
|
});
|
|
7371
7450
|
updateTextImage.call($$);
|
|
@@ -7396,7 +7475,7 @@ function updateTextImagePos(textNode, pos) {
|
|
|
7396
7475
|
/**
|
|
7397
7476
|
* Update data label text background color
|
|
7398
7477
|
* @param {object} d Data object
|
|
7399
|
-
* @param {object|string|
|
|
7478
|
+
* @param {object|string|function} option option object
|
|
7400
7479
|
* @returns {string|null}
|
|
7401
7480
|
* @private
|
|
7402
7481
|
*/
|
|
@@ -7425,8 +7504,8 @@ function updateTextImagePos(textNode, pos) {
|
|
|
7425
7504
|
},
|
|
7426
7505
|
/**
|
|
7427
7506
|
* Redraw chartText
|
|
7428
|
-
* @param {
|
|
7429
|
-
* @param {
|
|
7507
|
+
* @param {function} getX Positioning function for x
|
|
7508
|
+
* @param {function} getY Positioning function for y
|
|
7430
7509
|
* @param {boolean} forFlow Weather is flow
|
|
7431
7510
|
* @param {boolean} withTransition transition is enabled
|
|
7432
7511
|
* @returns {Array}
|
|
@@ -7540,7 +7619,7 @@ function updateTextImagePos(textNode, pos) {
|
|
|
7540
7619
|
const isBarType = $$.isBarType(d);
|
|
7541
7620
|
const isTreemapType = $$.isTreemapType(d);
|
|
7542
7621
|
if (config.data_labels.centered && (isBarType || isTreemapType)) {
|
|
7543
|
-
const rect =
|
|
7622
|
+
const rect = getBBox(textElement);
|
|
7544
7623
|
if (isBarType) {
|
|
7545
7624
|
const isPositive = $$.getRangedData(d, null, "bar") >= 0;
|
|
7546
7625
|
if (isRotated) {
|
|
@@ -7551,7 +7630,10 @@ function updateTextImagePos(textNode, pos) {
|
|
|
7551
7630
|
return isPositive ? h : -h - 2;
|
|
7552
7631
|
}
|
|
7553
7632
|
} else if (isTreemapType) {
|
|
7554
|
-
return type === "x" ? (points[1][0] - points[0][0]) / 2 : (
|
|
7633
|
+
return type === "x" ? (points[1][0] - points[0][0]) / 2 : (
|
|
7634
|
+
// X: Move to horizontal center of rect
|
|
7635
|
+
(points[1][1] - points[0][1]) / 2 - rect.y - rect.height / 2
|
|
7636
|
+
);
|
|
7555
7637
|
}
|
|
7556
7638
|
}
|
|
7557
7639
|
return 0;
|
|
@@ -7817,9 +7899,9 @@ function getTextXPos(pos = "left", width) {
|
|
|
7817
7899
|
/**
|
|
7818
7900
|
* Returns the tooltip content(HTML string)
|
|
7819
7901
|
* @param {object} d data
|
|
7820
|
-
* @param {
|
|
7821
|
-
* @param {
|
|
7822
|
-
* @param {
|
|
7902
|
+
* @param {function} defaultTitleFormat Default title format
|
|
7903
|
+
* @param {function} defaultValueFormat Default format for each data value in the tooltip.
|
|
7904
|
+
* @param {function} color Color function
|
|
7823
7905
|
* @returns {string} html
|
|
7824
7906
|
* @private
|
|
7825
7907
|
*/
|
|
@@ -7833,9 +7915,16 @@ function getTextXPos(pos = "left", width) {
|
|
|
7833
7915
|
});
|
|
7834
7916
|
const titleFormat = (...arg) => sanitize((titleFn || defaultTitleFormat)(...arg));
|
|
7835
7917
|
const nameFormat = (...arg) => sanitize((nameFn || ((name) => name))(...arg));
|
|
7836
|
-
const valueFormat = (
|
|
7837
|
-
|
|
7838
|
-
|
|
7918
|
+
const valueFormat = (v, ratio, id, index) => {
|
|
7919
|
+
let fn = valueFn;
|
|
7920
|
+
if (!fn) {
|
|
7921
|
+
if (state.hasTreemap || $$.isStackNormalized() && (!$$.isStackNormalizedPerGroup() || $$.isGrouped(id))) {
|
|
7922
|
+
fn = (v2, ratio2) => `${(ratio2 * 100).toFixed(2)}%`;
|
|
7923
|
+
} else {
|
|
7924
|
+
fn = defaultValueFormat;
|
|
7925
|
+
}
|
|
7926
|
+
}
|
|
7927
|
+
return sanitize(fn(v, ratio, id, index));
|
|
7839
7928
|
};
|
|
7840
7929
|
const order = config.tooltip_order;
|
|
7841
7930
|
const getRowValue = (row2) => $$.axis && $$.isBubbleZType(row2) ? $$.getBubbleZData(row2.value, "z") : $$.getBaseValue(row2);
|
|
@@ -8174,7 +8263,7 @@ function getTextXPos(pos = "left", width) {
|
|
|
8174
8263
|
if (tooltip && tooltip.style("display") !== "none" && (!config.tooltip_doNotHide || force)) {
|
|
8175
8264
|
const selectedData = JSON.parse((_a = tooltip.datum().current) != null ? _a : {});
|
|
8176
8265
|
callFn(config.tooltip_onhide, api, selectedData);
|
|
8177
|
-
tooltip.style("display", "none").
|
|
8266
|
+
tooltip.style("display", "none").datum(null);
|
|
8178
8267
|
callFn(config.tooltip_onhidden, api, selectedData);
|
|
8179
8268
|
}
|
|
8180
8269
|
},
|
|
@@ -8616,7 +8705,7 @@ function getGroupedDataPointsFn(d) {
|
|
|
8616
8705
|
* data2 data4 data2 data4
|
|
8617
8706
|
* -------------------------
|
|
8618
8707
|
* 0 1
|
|
8619
|
-
* @param {
|
|
8708
|
+
* @param {function} typeFilter Chart type filter function
|
|
8620
8709
|
* @returns {object} Indices object with its position
|
|
8621
8710
|
*/
|
|
8622
8711
|
getShapeIndices(typeFilter) {
|
|
@@ -8761,7 +8850,7 @@ function getGroupedDataPointsFn(d) {
|
|
|
8761
8850
|
},
|
|
8762
8851
|
/**
|
|
8763
8852
|
* Get Shape's offset data
|
|
8764
|
-
* @param {
|
|
8853
|
+
* @param {function} typeFilter Type filter function
|
|
8765
8854
|
* @returns {object}
|
|
8766
8855
|
* @private
|
|
8767
8856
|
*/
|
|
@@ -9262,14 +9351,18 @@ class ChartInternal {
|
|
|
9262
9351
|
if (hasInteraction && state.inputType) {
|
|
9263
9352
|
const isTouch = state.inputType === "touch";
|
|
9264
9353
|
const { onclick, onover, onout } = config;
|
|
9265
|
-
$el.svg.on("click", (onclick == null ? void 0 : onclick.bind($$.api)) || null).on(
|
|
9354
|
+
$el.svg.on("click", (onclick == null ? void 0 : onclick.bind($$.api)) || null).on(
|
|
9355
|
+
isTouch ? "touchstart" : "mouseenter",
|
|
9356
|
+
(onover == null ? void 0 : onover.bind($$.api)) || null,
|
|
9357
|
+
isTouch ? { passive: true } : void 0
|
|
9358
|
+
).on(isTouch ? "touchend" : "mouseleave", (onout == null ? void 0 : onout.bind($$.api)) || null);
|
|
9266
9359
|
}
|
|
9267
9360
|
config.svg_classname && $el.svg.attr("class", config.svg_classname);
|
|
9268
9361
|
const hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
|
|
9269
9362
|
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_a = $$.hasLegendDefsPoint) == null ? void 0 : _a.call($$))) {
|
|
9270
9363
|
$el.defs = $el.svg.append("defs");
|
|
9271
9364
|
if (hasAxis) {
|
|
9272
|
-
["id", "idXAxis", "idYAxis", "idGrid"].forEach((v) => {
|
|
9365
|
+
["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach((v) => {
|
|
9273
9366
|
$$.appendClip($el.defs, state.clip[v]);
|
|
9274
9367
|
});
|
|
9275
9368
|
}
|
|
@@ -9639,7 +9732,7 @@ function loadConfig(config) {
|
|
|
9639
9732
|
},
|
|
9640
9733
|
/**
|
|
9641
9734
|
* Force to redraw.
|
|
9642
|
-
* - **NOTE:** When zoom/subchart is used, the zoomed state will be
|
|
9735
|
+
* - **NOTE:** When zoom/subchart is used, the zoomed state will be reset.
|
|
9643
9736
|
* @function flush
|
|
9644
9737
|
* @instance
|
|
9645
9738
|
* @memberof Chart
|
|
@@ -9728,15 +9821,15 @@ function loadConfig(config) {
|
|
|
9728
9821
|
* Get or set config option value.
|
|
9729
9822
|
* - **NOTE**
|
|
9730
9823
|
* - The option key name must be specified as the last level.
|
|
9731
|
-
* -
|
|
9824
|
+
* - When no argument is given, it will return all specified generation options object only. (will exclude any other options not specified at the initialization)
|
|
9732
9825
|
* @function config
|
|
9733
9826
|
* @instance
|
|
9734
9827
|
* @memberof Chart
|
|
9735
9828
|
* @param {string} name The option key name.
|
|
9736
|
-
* @param {
|
|
9829
|
+
* @param {string|number|boolean|object|Array} [value] The value accepted for indicated option.
|
|
9737
9830
|
* @param {boolean} [redraw] Set to redraw with the new option changes.
|
|
9738
|
-
* - **NOTE:** Doesn't guarantee work in all circumstances. It can be applied for limited options only.
|
|
9739
|
-
* @returns {
|
|
9831
|
+
* - **NOTE:** Doesn't guarantee to work in all circumstances. It can be applied for limited options only.
|
|
9832
|
+
* @returns {string|number|boolean|object|Array} The option value or all options object
|
|
9740
9833
|
* @example
|
|
9741
9834
|
*
|
|
9742
9835
|
* // Getter
|
|
@@ -9833,7 +9926,7 @@ extend(api_data_data, {
|
|
|
9833
9926
|
* @function data․values
|
|
9834
9927
|
* @instance
|
|
9835
9928
|
* @memberof Chart
|
|
9836
|
-
* @param {string|Array|null} targetIds This API returns the values of specified target. If this argument is not given, null will be
|
|
9929
|
+
* @param {string|Array|null} targetIds This API returns the values of specified target. If this argument is not given, null will be returned
|
|
9837
9930
|
* @param {boolean} [flat=true] Get flatten values
|
|
9838
9931
|
* @returns {Array} Data values
|
|
9839
9932
|
* @example
|
|
@@ -9879,6 +9972,7 @@ extend(api_data_data, {
|
|
|
9879
9972
|
},
|
|
9880
9973
|
/**
|
|
9881
9974
|
* Get and set colors of the data loaded in the chart.
|
|
9975
|
+
* - **NOTE:** If gradient option is set, the color update will affect only gradient stops have the same color.
|
|
9882
9976
|
* @function data․colors
|
|
9883
9977
|
* @instance
|
|
9884
9978
|
* @memberof Chart
|
|
@@ -10084,7 +10178,7 @@ function renderText(ctx, glyph) {
|
|
|
10084
10178
|
* - Text element's position(especially "transformed") can't be preserved correctly according the page's layout condition.
|
|
10085
10179
|
* - If need to preserve accurate text position, embed the web font data within to the page and set `preserveFontStyle=false`.
|
|
10086
10180
|
* - 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>
|
|
10087
|
-
* @param {
|
|
10181
|
+
* @param {function(string): void} [callback] The callback to be invoked when export is ready.
|
|
10088
10182
|
* @returns {string} dataURI
|
|
10089
10183
|
* @example
|
|
10090
10184
|
* chart.export();
|
|
@@ -10338,7 +10432,7 @@ const legend_legend = {
|
|
|
10338
10432
|
* | categories | Array | The categories specified by axis.x.categories or data.x will be updated. categories must be Array. |
|
|
10339
10433
|
* | classes | Object | The classes specified by data.classes will be updated. classes must be Object that has target id as keys. |
|
|
10340
10434
|
* | colors | Object | The colors specified by data.colors will be updated. colors must be Object that has target id as keys. |
|
|
10341
|
-
* | data |
|
|
10435
|
+
* | data | Object | Data objects to be loaded. Checkout the example. |
|
|
10342
10436
|
* | done | Function | The specified function will be called after data loaded.|
|
|
10343
10437
|
* | headers | string | Set request header if loading via `data.url`.<br>@see [data․headers](Options.html#.data%25E2%2580%25A4headers) |
|
|
10344
10438
|
* | 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) |
|
|
@@ -10397,7 +10491,7 @@ const legend_legend = {
|
|
|
10397
10491
|
*
|
|
10398
10492
|
* chart.load({
|
|
10399
10493
|
* columns: [
|
|
10400
|
-
* // when existing chart has `x` value, should provide
|
|
10494
|
+
* // when existing chart has `x` value, should provide corresponding 'x' value.
|
|
10401
10495
|
* // with 'append' option, the 'data1' will have `[36,30,24,37]`.
|
|
10402
10496
|
* ["x", "2021-02-01T08:00:00"],
|
|
10403
10497
|
* ["data1", 37]
|
|
@@ -10487,7 +10581,7 @@ const legend_legend = {
|
|
|
10487
10581
|
* | key | Type | Description |
|
|
10488
10582
|
* | --- | --- | --- |
|
|
10489
10583
|
* | ids | String | Array | Target id data to be unloaded. If not given, all data will be unloaded. |
|
|
10490
|
-
* | done |
|
|
10584
|
+
* | done | Function | Callback after data is unloaded. |
|
|
10491
10585
|
* | 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. |
|
|
10492
10586
|
* @example
|
|
10493
10587
|
* // Unload data2 and data3
|
|
@@ -10644,7 +10738,7 @@ const tooltip_tooltip = {
|
|
|
10644
10738
|
*
|
|
10645
10739
|
* @example
|
|
10646
10740
|
* // show the 2nd x Axis coordinate tooltip
|
|
10647
|
-
* // for Arc(gauge, donut & pie) and radar type,
|
|
10741
|
+
* // for Arc(gauge, donut & pie) and radar type, approach showing tooltip by using "index" number.
|
|
10648
10742
|
* chart.tooltip.show({
|
|
10649
10743
|
* index: 1
|
|
10650
10744
|
* });
|
|
@@ -11008,7 +11102,7 @@ extend(subchart, {
|
|
|
11008
11102
|
}
|
|
11009
11103
|
},
|
|
11010
11104
|
/**
|
|
11011
|
-
* Toggle the
|
|
11105
|
+
* Toggle the visibility of subchart
|
|
11012
11106
|
* - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`.
|
|
11013
11107
|
* @function subchart․toggle
|
|
11014
11108
|
* @instance
|
|
@@ -11657,7 +11751,7 @@ extend(zoom, {
|
|
|
11657
11751
|
},
|
|
11658
11752
|
/**
|
|
11659
11753
|
* Set zoom transform to event rect
|
|
11660
|
-
* @param {
|
|
11754
|
+
* @param {function} x x Axis scale function
|
|
11661
11755
|
* @param {Array} domain Domain value to be set
|
|
11662
11756
|
* @private
|
|
11663
11757
|
*/
|
|
@@ -11967,7 +12061,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
11967
12061
|
* Returns the toggle method of the target
|
|
11968
12062
|
* @param {object} that shape
|
|
11969
12063
|
* @param {object} d Data object
|
|
11970
|
-
* @returns {
|
|
12064
|
+
* @returns {function} toggle method
|
|
11971
12065
|
* @private
|
|
11972
12066
|
*/
|
|
11973
12067
|
getToggle(that, d) {
|
|
@@ -12066,7 +12160,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12066
12160
|
* The callback will receive d as an argument and it has some parameters like id, value, index. This callback should return boolean.
|
|
12067
12161
|
* @name data․selection․isselectable
|
|
12068
12162
|
* @memberof Options
|
|
12069
|
-
* @type {
|
|
12163
|
+
* @type {function}
|
|
12070
12164
|
* @default function() { return true; }
|
|
12071
12165
|
* @example
|
|
12072
12166
|
* data: {
|
|
@@ -12078,7 +12172,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12078
12172
|
data_selection_isselectable: () => true,
|
|
12079
12173
|
/**
|
|
12080
12174
|
* Set multiple data points selection enabled.<br><br>
|
|
12081
|
-
* If this option set true,
|
|
12175
|
+
* 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.
|
|
12082
12176
|
* @name data․selection․multiple
|
|
12083
12177
|
* @memberof Options
|
|
12084
12178
|
* @type {boolean}
|
|
@@ -12111,7 +12205,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12111
12205
|
* Set a callback for on data selection.
|
|
12112
12206
|
* @name data․onselected
|
|
12113
12207
|
* @memberof Options
|
|
12114
|
-
* @type {
|
|
12208
|
+
* @type {function}
|
|
12115
12209
|
* @default function() {}
|
|
12116
12210
|
* @example
|
|
12117
12211
|
* data: {
|
|
@@ -12128,7 +12222,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12128
12222
|
* Set a callback for on data un-selection.
|
|
12129
12223
|
* @name data․onunselected
|
|
12130
12224
|
* @memberof Options
|
|
12131
|
-
* @type {
|
|
12225
|
+
* @type {function}
|
|
12132
12226
|
* @default function() {}
|
|
12133
12227
|
* @example
|
|
12134
12228
|
* data: {
|
|
@@ -12158,11 +12252,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12158
12252
|
* @property {boolean} [subchart.showHandle=false] Show sub chart's handle.
|
|
12159
12253
|
* @property {boolean} [subchart.axis.x.show=true] Show or hide x axis.
|
|
12160
12254
|
* @property {boolean} [subchart.axis.x.tick.show=true] Show or hide x axis tick line.
|
|
12161
|
-
* @property {
|
|
12255
|
+
* @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.
|
|
12162
12256
|
* @property {boolean} [subchart.axis.x.tick.text.show=true] Show or hide x axis tick text.
|
|
12163
12257
|
* @property {Array} [subchart.init.range] Set initial selection domain range.
|
|
12164
12258
|
* @property {number} [subchart.size.height] Change the height of the subchart.
|
|
12165
|
-
* @property {
|
|
12259
|
+
* @property {function} [subchart.onbrush] Set callback for brush event.<br>
|
|
12166
12260
|
* Specified function receives the current zoomed x domain.
|
|
12167
12261
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Interaction.SubChart)
|
|
12168
12262
|
* @example
|
|
@@ -12231,14 +12325,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12231
12325
|
* @property {Array} [zoom.extent=[1, 10]] Change zoom extent.
|
|
12232
12326
|
* @property {number|Date} [zoom.x.min] Set x Axis minimum zoom range
|
|
12233
12327
|
* @property {number|Date} [zoom.x.max] Set x Axis maximum zoom range
|
|
12234
|
-
* @property {
|
|
12328
|
+
* @property {function} [zoom.onzoomstart=undefined] Set callback that is called when zooming starts.<br>
|
|
12235
12329
|
* Specified function receives the zoom event.
|
|
12236
|
-
* @property {
|
|
12330
|
+
* @property {function} [zoom.onzoom=undefined] Set callback that is called when the chart is zooming.<br>
|
|
12237
12331
|
* Specified function receives the zoomed domain.
|
|
12238
|
-
* @property {
|
|
12332
|
+
* @property {function} [zoom.onzoomend=undefined] Set callback that is called when zooming ends.<br>
|
|
12239
12333
|
* Specified function receives the zoomed domain.
|
|
12240
12334
|
* @property {boolean|object} [zoom.resetButton=true] Set to display zoom reset button for 'drag' type zoom
|
|
12241
|
-
* @property {
|
|
12335
|
+
* @property {function} [zoom.resetButton.onclick] Set callback when clicks the reset button. The callback will receive reset button element reference as argument.
|
|
12242
12336
|
* @property {string} [zoom.resetButton.text='Reset Zoom'] Text value for zoom reset button.
|
|
12243
12337
|
* @see [Demo:zoom](https://naver.github.io/billboard.js/demo/#Interaction.Zoom)
|
|
12244
12338
|
* @see [Demo:drag zoom](https://naver.github.io/billboard.js/demo/#Interaction.DragZoom)
|
|
@@ -12609,7 +12703,7 @@ const axis = {
|
|
|
12609
12703
|
* - If json specified, keys is required as well as data.json.
|
|
12610
12704
|
* - If tab isn't visible(by evaluating `document.hidden`), will not be executed to prevent unnecessary work.
|
|
12611
12705
|
* @example
|
|
12612
|
-
* // 2 data points will be
|
|
12706
|
+
* // 2 data points will be appended to the tail and popped from the head.
|
|
12613
12707
|
* // After that, 4 data points will be appended and no data points will be poppoed.
|
|
12614
12708
|
* chart.flow({
|
|
12615
12709
|
* columns: [
|
|
@@ -13142,7 +13236,7 @@ class AxisRendererHelper {
|
|
|
13142
13236
|
/**
|
|
13143
13237
|
* Get tick transform setter function
|
|
13144
13238
|
* @param {string} id Axis id
|
|
13145
|
-
* @returns {
|
|
13239
|
+
* @returns {(selection: d3Selection, scale) => void} transfrom setter function
|
|
13146
13240
|
* @private
|
|
13147
13241
|
*/
|
|
13148
13242
|
getTickTransformSetter(id) {
|
|
@@ -13863,7 +13957,7 @@ class Axis_Axis {
|
|
|
13863
13957
|
}
|
|
13864
13958
|
tickValues && axis.tickValues(tickValues);
|
|
13865
13959
|
axis.tickFormat(
|
|
13866
|
-
tickFormat || !isX && ($$.isStackNormalized() && ((x) => `${x}%`))
|
|
13960
|
+
tickFormat || !isX && ($$.isStackNormalized() && $$.hasAxisGroupedData(id) && ((x) => `${x}%`))
|
|
13867
13961
|
);
|
|
13868
13962
|
if (isCategory) {
|
|
13869
13963
|
axis.tickCentered(config.axis_x_tick_centered);
|
|
@@ -14491,6 +14585,7 @@ class Axis_Axis {
|
|
|
14491
14585
|
const isPrevented = isBoolean(preventDefault) && preventDefault || false;
|
|
14492
14586
|
const preventThreshold = !isNaN(preventDefault) && preventDefault || null;
|
|
14493
14587
|
let startPx;
|
|
14588
|
+
const passiveOption = !isPrevented && preventThreshold === null;
|
|
14494
14589
|
const preventEvent = (event) => {
|
|
14495
14590
|
const eventType = event.type;
|
|
14496
14591
|
const touch = event.changedTouches[0];
|
|
@@ -14511,7 +14606,7 @@ class Axis_Axis {
|
|
|
14511
14606
|
eventRect.on("touchstart", (event) => {
|
|
14512
14607
|
state.event = event;
|
|
14513
14608
|
$$.updateEventRect();
|
|
14514
|
-
}).on("touchstart.eventRect touchmove.eventRect", (event) => {
|
|
14609
|
+
}, { passive: passiveOption }).on("touchstart.eventRect touchmove.eventRect", (event) => {
|
|
14515
14610
|
state.event = event;
|
|
14516
14611
|
if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
|
|
14517
14612
|
if (state.dragging || state.flowing || $$.hasArcType() || event.touches.length > 1) {
|
|
@@ -14522,21 +14617,21 @@ class Axis_Axis {
|
|
|
14522
14617
|
} else {
|
|
14523
14618
|
unselectRect();
|
|
14524
14619
|
}
|
|
14525
|
-
},
|
|
14620
|
+
}, { passive: passiveOption }).on("touchend.eventRect", (event) => {
|
|
14526
14621
|
state.event = event;
|
|
14527
14622
|
if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
|
|
14528
14623
|
if ($$.hasArcType() || !$$.toggleShape || state.cancelClick) {
|
|
14529
14624
|
state.cancelClick && (state.cancelClick = false);
|
|
14530
14625
|
}
|
|
14531
14626
|
}
|
|
14532
|
-
},
|
|
14627
|
+
}, { passive: passiveOption });
|
|
14533
14628
|
svg.on("touchstart", (event) => {
|
|
14534
14629
|
state.event = event;
|
|
14535
14630
|
const { target } = event;
|
|
14536
14631
|
if (target && target !== eventRect.node()) {
|
|
14537
14632
|
unselectRect();
|
|
14538
14633
|
}
|
|
14539
|
-
});
|
|
14634
|
+
}, { passive: passiveOption });
|
|
14540
14635
|
},
|
|
14541
14636
|
/**
|
|
14542
14637
|
* Update event rect size
|
|
@@ -14738,7 +14833,7 @@ class Axis_Axis {
|
|
|
14738
14833
|
const dist = $$.dist(closest, mouse);
|
|
14739
14834
|
if ($$.isBarType(closest.id) || dist < $$.getPointSensitivity(closest)) {
|
|
14740
14835
|
$$.$el.svg.select(`.${$EVENT.eventRect}`).style("cursor", "pointer");
|
|
14741
|
-
if (triggerEvent && !state.mouseover) {
|
|
14836
|
+
if (triggerEvent && (!state.mouseover || state.mouseover.x !== closest.x || state.mouseover.id !== closest.id)) {
|
|
14742
14837
|
config.data_onover.call($$.api, closest);
|
|
14743
14838
|
state.mouseover = closest;
|
|
14744
14839
|
}
|
|
@@ -14910,7 +15005,7 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
14910
15005
|
/**
|
|
14911
15006
|
* Generate flow
|
|
14912
15007
|
* @param {object} args option object
|
|
14913
|
-
* @returns {
|
|
15008
|
+
* @returns {function}
|
|
14914
15009
|
* @private
|
|
14915
15010
|
*/
|
|
14916
15011
|
generateFlow(args) {
|
|
@@ -15890,7 +15985,7 @@ function smoothLines(el, type) {
|
|
|
15890
15985
|
* A function to format tick value. Format string is also available for timeseries data.
|
|
15891
15986
|
* @name axis․x․tick․format
|
|
15892
15987
|
* @memberof Options
|
|
15893
|
-
* @type {
|
|
15988
|
+
* @type {function|string}
|
|
15894
15989
|
* @default undefined
|
|
15895
15990
|
* @see [D3's time specifier](https://d3js.org/d3-time-format#locale_format)
|
|
15896
15991
|
* @example
|
|
@@ -15919,7 +16014,7 @@ function smoothLines(el, type) {
|
|
|
15919
16014
|
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
15920
16015
|
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.x.tick.culling.lines=false`.
|
|
15921
16016
|
* - `false`: all of ticks will be shown.<br><br>
|
|
15922
|
-
* The number of ticks to be shown can be
|
|
16017
|
+
* The number of ticks to be shown can be changed by `axis.x.tick.culling.max`.
|
|
15923
16018
|
* @name axis․x․tick․culling
|
|
15924
16019
|
* @memberof Options
|
|
15925
16020
|
* @type {boolean}
|
|
@@ -16130,10 +16225,10 @@ function smoothLines(el, type) {
|
|
|
16130
16225
|
/**
|
|
16131
16226
|
* Set the x values of ticks manually.<br><br>
|
|
16132
16227
|
* If this option is provided, the position of the ticks will be determined based on those values.<br>
|
|
16133
|
-
* This option works with `timeseries` data and the x values will be parsed
|
|
16228
|
+
* This option works with `timeseries` data and the x values will be parsed according to the type of the value and data.xFormat option.
|
|
16134
16229
|
* @name axis․x․tick․values
|
|
16135
16230
|
* @memberof Options
|
|
16136
|
-
* @type {Array|
|
|
16231
|
+
* @type {Array|function}
|
|
16137
16232
|
* @default null
|
|
16138
16233
|
* @example
|
|
16139
16234
|
* axis: {
|
|
@@ -16354,7 +16449,7 @@ function smoothLines(el, type) {
|
|
|
16354
16449
|
* - **timeseries:** Numeric time value
|
|
16355
16450
|
* 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
|
|
16356
16451
|
* - If want values to be treated as pixels, specify `unit:"px"`.
|
|
16357
|
-
* - The pixel value will be
|
|
16452
|
+
* - The pixel value will be converted based on the scale values. Hence can not reflect accurate padding result.
|
|
16358
16453
|
* @name axis․x․padding
|
|
16359
16454
|
* @memberof Options
|
|
16360
16455
|
* @type {object|number}
|
|
@@ -16405,7 +16500,7 @@ function smoothLines(el, type) {
|
|
|
16405
16500
|
* - **NOTE:** Specifying value, will limit the zoom scope selection within.
|
|
16406
16501
|
* @name axis․x․extent
|
|
16407
16502
|
* @memberof Options
|
|
16408
|
-
* @type {Array|
|
|
16503
|
+
* @type {Array|function}
|
|
16409
16504
|
* @default undefined
|
|
16410
16505
|
* @example
|
|
16411
16506
|
* axis: {
|
|
@@ -16671,7 +16766,7 @@ function smoothLines(el, type) {
|
|
|
16671
16766
|
* This option accepts d3.format object as well as a function you define.
|
|
16672
16767
|
* @name axis․y․tick․format
|
|
16673
16768
|
* @memberof Options
|
|
16674
|
-
* @type {
|
|
16769
|
+
* @type {function}
|
|
16675
16770
|
* @default undefined
|
|
16676
16771
|
* @example
|
|
16677
16772
|
* axis: {
|
|
@@ -16690,7 +16785,7 @@ function smoothLines(el, type) {
|
|
|
16690
16785
|
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
16691
16786
|
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y.tick.culling.lines=false`.
|
|
16692
16787
|
* - `false`: all of ticks will be shown.<br><br>
|
|
16693
|
-
* The number of ticks to be shown can be
|
|
16788
|
+
* The number of ticks to be shown can be changed by `axis.y.tick.culling.max`.
|
|
16694
16789
|
* @name axis․y․tick․culling
|
|
16695
16790
|
* @memberof Options
|
|
16696
16791
|
* @type {boolean}
|
|
@@ -16796,7 +16891,7 @@ function smoothLines(el, type) {
|
|
|
16796
16891
|
* Set y axis tick values manually.
|
|
16797
16892
|
* @name axis․y․tick․values
|
|
16798
16893
|
* @memberof Options
|
|
16799
|
-
* @type {Array|
|
|
16894
|
+
* @type {Array|function}
|
|
16800
16895
|
* @default null
|
|
16801
16896
|
* @example
|
|
16802
16897
|
* axis: {
|
|
@@ -16932,7 +17027,7 @@ function smoothLines(el, type) {
|
|
|
16932
17027
|
* @private
|
|
16933
17028
|
* @type {object}
|
|
16934
17029
|
* @property {object} time time object
|
|
16935
|
-
* @property {
|
|
17030
|
+
* @property {function} [time.value] D3's time interval function (https://github.com/d3/d3-time#intervals)
|
|
16936
17031
|
* @example
|
|
16937
17032
|
* axis: {
|
|
16938
17033
|
* y: {
|
|
@@ -17031,6 +17126,18 @@ function smoothLines(el, type) {
|
|
|
17031
17126
|
|
|
17032
17127
|
;// ./src/config/Options/axis/y2.ts
|
|
17033
17128
|
/* harmony default export */ var y2 = ({
|
|
17129
|
+
/**
|
|
17130
|
+
* Set clip-path attribute for y2 axis element
|
|
17131
|
+
* - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
|
|
17132
|
+
* @name axis․y2․clipPath
|
|
17133
|
+
* @memberof Options
|
|
17134
|
+
* @type {boolean}
|
|
17135
|
+
* @default true
|
|
17136
|
+
* @example
|
|
17137
|
+
* // don't set 'clip-path' attribute
|
|
17138
|
+
* clipPath: false
|
|
17139
|
+
*/
|
|
17140
|
+
axis_y2_clipPath: true,
|
|
17034
17141
|
/**
|
|
17035
17142
|
* Show or hide y2 axis.
|
|
17036
17143
|
* - **NOTE**:
|
|
@@ -17176,7 +17283,7 @@ function smoothLines(el, type) {
|
|
|
17176
17283
|
* This option works in the same way as axis.y.format.
|
|
17177
17284
|
* @name axis․y2․tick․format
|
|
17178
17285
|
* @memberof Options
|
|
17179
|
-
* @type {
|
|
17286
|
+
* @type {function}
|
|
17180
17287
|
* @default undefined
|
|
17181
17288
|
* @example
|
|
17182
17289
|
* axis: {
|
|
@@ -17194,7 +17301,7 @@ function smoothLines(el, type) {
|
|
|
17194
17301
|
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
17195
17302
|
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y2.tick.culling.lines=false`.
|
|
17196
17303
|
* - `false`: all of ticks will be shown.<br><br>
|
|
17197
|
-
* The number of ticks to be shown can be
|
|
17304
|
+
* The number of ticks to be shown can be changed by `axis.y2.tick.culling.max`.
|
|
17198
17305
|
* @name axis․y2․tick․culling
|
|
17199
17306
|
* @memberof Options
|
|
17200
17307
|
* @type {boolean}
|
|
@@ -17301,7 +17408,7 @@ function smoothLines(el, type) {
|
|
|
17301
17408
|
* Set y2 axis tick values manually.
|
|
17302
17409
|
* @name axis․y2․tick․values
|
|
17303
17410
|
* @memberof Options
|
|
17304
|
-
* @type {Array|
|
|
17411
|
+
* @type {Array|function}
|
|
17305
17412
|
* @default null
|
|
17306
17413
|
* @example
|
|
17307
17414
|
* axis: {
|
|
@@ -17533,16 +17640,16 @@ var axis_spreadValues = (a, b) => {
|
|
|
17533
17640
|
/**
|
|
17534
17641
|
* Setup the way to evaluate tick text size.
|
|
17535
17642
|
* - **NOTE:**
|
|
17536
|
-
* -
|
|
17643
|
+
* - When setting `false` or a custom evaluator, it is highly recommended to memoize evaluated text dimension value to not degrade performance.
|
|
17537
17644
|
* @name axis․evalTextSize
|
|
17538
17645
|
* @memberof Options
|
|
17539
|
-
* @type {boolean|
|
|
17646
|
+
* @type {boolean|function}
|
|
17540
17647
|
* @default true
|
|
17541
17648
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.AxisEvalTextSize)
|
|
17542
17649
|
* @example
|
|
17543
17650
|
* axis: {
|
|
17544
17651
|
* // will evaluate getting text size every time.
|
|
17545
|
-
* evalTextSize: false
|
|
17652
|
+
* evalTextSize: false,
|
|
17546
17653
|
*
|
|
17547
17654
|
* // set a custom evaluator
|
|
17548
17655
|
* evalTextSize: function(textElement, axisId) {
|
|
@@ -17586,8 +17693,8 @@ var axis_spreadValues = (a, b) => {
|
|
|
17586
17693
|
* Set axis tooltip.
|
|
17587
17694
|
* - **NOTE:**
|
|
17588
17695
|
* - When enabled, will disable default focus grid line.
|
|
17589
|
-
* - For `timeseries` x Axis,
|
|
17590
|
-
* - For `category` x Axis,
|
|
17696
|
+
* - For `timeseries` x Axis, tooltip will be formatted using x Axis' tick format.
|
|
17697
|
+
* - For `category` x Axis, tooltip will be displaying scales' value text.
|
|
17591
17698
|
* @name axis․tooltip
|
|
17592
17699
|
* @memberof Options
|
|
17593
17700
|
* @type {boolean}
|
|
@@ -17600,11 +17707,11 @@ var axis_spreadValues = (a, b) => {
|
|
|
17600
17707
|
* axis: {
|
|
17601
17708
|
* tooltip: true, // default background color is
|
|
17602
17709
|
*
|
|
17603
|
-
* // set
|
|
17710
|
+
* // set background color for axis tooltip texts
|
|
17604
17711
|
* tooltip: {
|
|
17605
17712
|
* backgroundColor: "red",
|
|
17606
17713
|
*
|
|
17607
|
-
* // set
|
|
17714
|
+
* // set different background colors per axes
|
|
17608
17715
|
* // NOTE: In this case, only specified axes tooltip will appear.
|
|
17609
17716
|
* backgroundColor: {
|
|
17610
17717
|
* x: "green",
|
|
@@ -17709,7 +17816,7 @@ var axis_spreadValues = (a, b) => {
|
|
|
17709
17816
|
*/
|
|
17710
17817
|
data_xs: {},
|
|
17711
17818
|
/**
|
|
17712
|
-
* Set a format specifier to parse string
|
|
17819
|
+
* Set a format specifier to parse string specified as x.
|
|
17713
17820
|
* @name data․xFormat
|
|
17714
17821
|
* @memberof Options
|
|
17715
17822
|
* @type {string}
|
|
@@ -17758,7 +17865,7 @@ var axis_spreadValues = (a, b) => {
|
|
|
17758
17865
|
* x: "x",
|
|
17759
17866
|
* columns: [
|
|
17760
17867
|
* // The line graph will start to be drawn following the x axis sequence
|
|
17761
|
-
* // Below data,
|
|
17868
|
+
* // Below data, will start drawing x=1: 200, x=2: 300, x=3: 100
|
|
17762
17869
|
* ["x", 3, 1, 2],
|
|
17763
17870
|
* ["data1", 100, 200, 300]
|
|
17764
17871
|
* ]
|
|
@@ -17819,16 +17926,41 @@ var axis_spreadValues = (a, b) => {
|
|
|
17819
17926
|
* - **NOTE:**
|
|
17820
17927
|
* - For stacking, '[data.groups](#.data%25E2%2580%25A4groups)' option should be set
|
|
17821
17928
|
* - y Axis will be set in percentage value (0 ~ 100%)
|
|
17822
|
-
* - Must have
|
|
17929
|
+
* - Must have positive values
|
|
17930
|
+
* - Data not in any group will not be normalized when using perGroup option
|
|
17823
17931
|
* @name data․stack․normalize
|
|
17824
17932
|
* @memberof Options
|
|
17825
|
-
* @type {boolean}
|
|
17933
|
+
* @type {boolean|object}
|
|
17826
17934
|
* @default false
|
|
17827
|
-
* @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataStackNormalized)
|
|
17935
|
+
* @see [Demo: Data Stack Normalized](https://naver.github.io/billboard.js/demo/#Data.DataStackNormalized)
|
|
17936
|
+
* @see [Demo: Data Stack Normalized per Group](https://naver.github.io/billboard.js/demo/#Data.DataStackNormalizedGroup)
|
|
17828
17937
|
* @example
|
|
17829
17938
|
* data: {
|
|
17830
17939
|
* stack: {
|
|
17940
|
+
* // Normalize all grouped data together (all groups combined to 0-100%)
|
|
17831
17941
|
* normalize: true
|
|
17942
|
+
*
|
|
17943
|
+
* // Normalize per group (each group independently becomes 0-100%)
|
|
17944
|
+
* // Data not in any group will display with their original values.
|
|
17945
|
+
* // If non-grouped data shares the same axis (e.g., y), it will be
|
|
17946
|
+
* // displayed on the 0-100 absolute scale. To display original values,
|
|
17947
|
+
* // assign them to a separate axis (e.g., y2).
|
|
17948
|
+
* normalize: {
|
|
17949
|
+
* perGroup: true
|
|
17950
|
+
* }
|
|
17951
|
+
* },
|
|
17952
|
+
* groups: [
|
|
17953
|
+
* ["data1", "data2"] // This group will be normalized to 0-100%
|
|
17954
|
+
* ],
|
|
17955
|
+
* // data3 is not in any group, so it displays original values
|
|
17956
|
+
* // Assign it to y2 axis to use a separate scale
|
|
17957
|
+
* axes: {
|
|
17958
|
+
* data3: "y2"
|
|
17959
|
+
* }
|
|
17960
|
+
* },
|
|
17961
|
+
* axis: {
|
|
17962
|
+
* y2: {
|
|
17963
|
+
* show: true
|
|
17832
17964
|
* }
|
|
17833
17965
|
* }
|
|
17834
17966
|
*/
|
|
@@ -17879,6 +18011,155 @@ const options = {
|
|
|
17879
18011
|
|
|
17880
18012
|
// EXTERNAL MODULE: external {"commonjs":"d3-interpolate","commonjs2":"d3-interpolate","amd":"d3-interpolate","root":"d3"}
|
|
17881
18013
|
var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate_root_d3_ = __webpack_require__(13);
|
|
18014
|
+
;// ./src/ChartInternal/internals/text.arc.ts
|
|
18015
|
+
|
|
18016
|
+
|
|
18017
|
+
|
|
18018
|
+
|
|
18019
|
+
const BREAK_POINT_OFFSET = 15;
|
|
18020
|
+
const DEFAULT_LINE_DISTANCE = 20;
|
|
18021
|
+
const TEXT_VERTICAL_OFFSET = 0.35;
|
|
18022
|
+
function getArcType(excludeMultiGauge = false) {
|
|
18023
|
+
const $$ = this;
|
|
18024
|
+
return ["donut", "pie", "polar", "gauge"].find(
|
|
18025
|
+
(type) => $$.hasType(type) && !(type === "gauge" && excludeMultiGauge && $$.hasMultiArcGauge())
|
|
18026
|
+
);
|
|
18027
|
+
}
|
|
18028
|
+
function getConfig() {
|
|
18029
|
+
const $$ = this;
|
|
18030
|
+
const { config } = $$;
|
|
18031
|
+
const chartType = getArcType.call($$, true);
|
|
18032
|
+
const lineConfig = chartType && config[`${chartType}_label_line`];
|
|
18033
|
+
const isValidConfig = isObjectType(lineConfig);
|
|
18034
|
+
const defaultFormatter = (value, ratio, id) => id;
|
|
18035
|
+
const line = {
|
|
18036
|
+
show: lineConfig === true || isValidConfig && (lineConfig == null ? void 0 : lineConfig.show) !== false,
|
|
18037
|
+
distance: isValidConfig && (lineConfig == null ? void 0 : lineConfig.distance) || DEFAULT_LINE_DISTANCE
|
|
18038
|
+
};
|
|
18039
|
+
if (lineConfig === true) {
|
|
18040
|
+
return {
|
|
18041
|
+
chartType,
|
|
18042
|
+
line,
|
|
18043
|
+
text: { formatter: defaultFormatter }
|
|
18044
|
+
};
|
|
18045
|
+
}
|
|
18046
|
+
if (!isValidConfig) {
|
|
18047
|
+
return {
|
|
18048
|
+
chartType,
|
|
18049
|
+
line: { show: false, distance: DEFAULT_LINE_DISTANCE },
|
|
18050
|
+
text: { formatter: null }
|
|
18051
|
+
};
|
|
18052
|
+
}
|
|
18053
|
+
let formatter = defaultFormatter;
|
|
18054
|
+
if (isFunction(lineConfig.text)) {
|
|
18055
|
+
formatter = lineConfig.text;
|
|
18056
|
+
} else if (lineConfig.text === false) {
|
|
18057
|
+
formatter = null;
|
|
18058
|
+
}
|
|
18059
|
+
return {
|
|
18060
|
+
chartType,
|
|
18061
|
+
line,
|
|
18062
|
+
text: { formatter }
|
|
18063
|
+
};
|
|
18064
|
+
}
|
|
18065
|
+
function getLinePosition(d, lineDistance) {
|
|
18066
|
+
const $$ = this;
|
|
18067
|
+
const { state } = $$;
|
|
18068
|
+
const updated = $$.updateAngle(d);
|
|
18069
|
+
if (!updated) {
|
|
18070
|
+
return null;
|
|
18071
|
+
}
|
|
18072
|
+
let { outerRadius } = $$.getRadius(d);
|
|
18073
|
+
let arcOuterRadius = outerRadius;
|
|
18074
|
+
if ($$.hasType("polar")) {
|
|
18075
|
+
arcOuterRadius = $$.getPolarOuterRadius(d, outerRadius);
|
|
18076
|
+
outerRadius = state.radius;
|
|
18077
|
+
}
|
|
18078
|
+
let midAngle = (updated.startAngle + updated.endAngle) / 2;
|
|
18079
|
+
const isFullCircleArc = Math.abs(updated.endAngle - updated.startAngle - 2 * Math.PI) < 0.01;
|
|
18080
|
+
if (isFullCircleArc) {
|
|
18081
|
+
midAngle = Math.PI / 2;
|
|
18082
|
+
}
|
|
18083
|
+
const sinAngle = Math.sin(midAngle);
|
|
18084
|
+
const cosAngle = -Math.cos(midAngle);
|
|
18085
|
+
const startPoint = {
|
|
18086
|
+
x: sinAngle * arcOuterRadius,
|
|
18087
|
+
y: cosAngle * arcOuterRadius
|
|
18088
|
+
};
|
|
18089
|
+
const breakRadius = outerRadius + BREAK_POINT_OFFSET;
|
|
18090
|
+
const breakPoint = {
|
|
18091
|
+
x: sinAngle * breakRadius,
|
|
18092
|
+
y: cosAngle * breakRadius
|
|
18093
|
+
};
|
|
18094
|
+
const isRight = sinAngle >= 0;
|
|
18095
|
+
const endPoint = {
|
|
18096
|
+
x: breakPoint.x + lineDistance * (isRight ? 1 : -1),
|
|
18097
|
+
y: breakPoint.y
|
|
18098
|
+
};
|
|
18099
|
+
return { startPoint, breakPoint, endPoint, isRight, midAngle };
|
|
18100
|
+
}
|
|
18101
|
+
function isLabelWithLine() {
|
|
18102
|
+
return getConfig.call(this).line.show;
|
|
18103
|
+
}
|
|
18104
|
+
function redrawArcLabelLines(duration) {
|
|
18105
|
+
const $$ = this;
|
|
18106
|
+
const { $el: { arcs }, $T } = $$;
|
|
18107
|
+
const { line: lineConfig, text: textConfig } = getConfig.call($$);
|
|
18108
|
+
const lineDistance = lineConfig.distance;
|
|
18109
|
+
let cachedFontSize = null;
|
|
18110
|
+
arcs.selectAll(`.${$ARC.chartArc}`).each(function(d) {
|
|
18111
|
+
var _a, _b, _c;
|
|
18112
|
+
const g = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
18113
|
+
const linePos = getLinePosition.call($$, d, lineDistance);
|
|
18114
|
+
const { ratio, meetsThreshold, updated } = (_a = d._cache) != null ? _a : {};
|
|
18115
|
+
if (!updated || !linePos) {
|
|
18116
|
+
return;
|
|
18117
|
+
}
|
|
18118
|
+
const isVisible = $$.isTargetToShow(d.data.id) && meetsThreshold;
|
|
18119
|
+
const { startPoint, breakPoint, endPoint, isRight } = linePos;
|
|
18120
|
+
const points = `${startPoint.x},${startPoint.y} ${breakPoint.x},${breakPoint.y} ${endPoint.x},${endPoint.y}`;
|
|
18121
|
+
if (lineConfig.show) {
|
|
18122
|
+
let line = g.select(`.${$ARC.arcLabelLine}`);
|
|
18123
|
+
if (line.empty()) {
|
|
18124
|
+
line = g.append("polyline").attr("class", $ARC.arcLabelLine);
|
|
18125
|
+
}
|
|
18126
|
+
$T(line, duration).attr("points", points).style("stroke", $$.color(d.data)).style("opacity", isVisible ? null : "0");
|
|
18127
|
+
}
|
|
18128
|
+
let labelLineText = g.select(`.${$ARC.arcLabelLineText}`);
|
|
18129
|
+
if (labelLineText.empty()) {
|
|
18130
|
+
labelLineText = g.append("text").attr("class", $ARC.arcLabelLineText).style("pointer-events", "none");
|
|
18131
|
+
}
|
|
18132
|
+
if (isVisible) {
|
|
18133
|
+
const { value } = updated;
|
|
18134
|
+
const { id } = d.data;
|
|
18135
|
+
const text = ((_c = (_b = textConfig.formatter) != null ? _b : $$.getArcLabelConfig("format")) != null ? _c : $$.defaultArcValueFormat)(value, ratio, id).toString();
|
|
18136
|
+
setTextValue(labelLineText, text, [-1, 1], false);
|
|
18137
|
+
const pos = {
|
|
18138
|
+
x: endPoint.x + 5 * (isRight ? 1 : -1),
|
|
18139
|
+
// 5: label offset from endpoint
|
|
18140
|
+
y: endPoint.y
|
|
18141
|
+
};
|
|
18142
|
+
labelLineText.style("text-anchor", isRight ? "start" : "end");
|
|
18143
|
+
const textNode = labelLineText.node();
|
|
18144
|
+
const tspanNodes = textNode == null ? void 0 : textNode.querySelectorAll("tspan");
|
|
18145
|
+
if (cachedFontSize === null) {
|
|
18146
|
+
cachedFontSize = parseFloat(win.getComputedStyle(textNode).fontSize) || 12;
|
|
18147
|
+
}
|
|
18148
|
+
if (tspanNodes && tspanNodes.length > 1) {
|
|
18149
|
+
const lineCount = tspanNodes.length;
|
|
18150
|
+
const centerOffset = (lineCount - 3) / 2;
|
|
18151
|
+
pos.y += (-centerOffset + TEXT_VERTICAL_OFFSET) * cachedFontSize;
|
|
18152
|
+
} else {
|
|
18153
|
+
pos.y += TEXT_VERTICAL_OFFSET * cachedFontSize;
|
|
18154
|
+
}
|
|
18155
|
+
$T(labelLineText, duration).attr("transform", `translate(${pos.x},${pos.y})`).style("opacity", null).style("fill", $$.updateTextColor.bind($$)(d));
|
|
18156
|
+
} else {
|
|
18157
|
+
$T(labelLineText, duration).style("opacity", "0");
|
|
18158
|
+
}
|
|
18159
|
+
});
|
|
18160
|
+
}
|
|
18161
|
+
|
|
18162
|
+
|
|
17882
18163
|
;// ./src/ChartInternal/shape/arc.ts
|
|
17883
18164
|
var arc_defProp = Object.defineProperty;
|
|
17884
18165
|
var arc_defProps = Object.defineProperties;
|
|
@@ -17906,6 +18187,62 @@ var arc_spreadProps = (a, b) => arc_defProps(a, arc_getOwnPropDescs(b));
|
|
|
17906
18187
|
|
|
17907
18188
|
|
|
17908
18189
|
|
|
18190
|
+
|
|
18191
|
+
function arc_getArcType($$) {
|
|
18192
|
+
return ["donut", "pie", "polar", "gauge"].find((type) => $$.hasType(type));
|
|
18193
|
+
}
|
|
18194
|
+
function calculateRangeOrGaugePosition($$, d, updated, forRange) {
|
|
18195
|
+
var _a, _b;
|
|
18196
|
+
const { config, state: { radiusExpanded } } = $$;
|
|
18197
|
+
const angle = updated.endAngle - Math.PI / 2;
|
|
18198
|
+
const sinAngle = Math.sin(angle);
|
|
18199
|
+
const pos = {
|
|
18200
|
+
x: Math.cos(angle) * (radiusExpanded + (forRange ? 5 : 25)),
|
|
18201
|
+
// 5: range offset, 25: gauge offset
|
|
18202
|
+
y: sinAngle * (radiusExpanded + 15 - Math.abs(sinAngle * 10)) + 3
|
|
18203
|
+
// 10: y factor, 3: y offset
|
|
18204
|
+
};
|
|
18205
|
+
if (forRange) {
|
|
18206
|
+
const rangeTextPosition = config.arc_rangeText_position;
|
|
18207
|
+
if (rangeTextPosition) {
|
|
18208
|
+
const rangeValues = config.arc_rangeText_values;
|
|
18209
|
+
const position = isFunction(rangeTextPosition) ? rangeTextPosition(rangeValues[d.index]) : rangeTextPosition;
|
|
18210
|
+
pos.x += (_a = position == null ? void 0 : position.x) != null ? _a : 0;
|
|
18211
|
+
pos.y += (_b = position == null ? void 0 : position.y) != null ? _b : 0;
|
|
18212
|
+
}
|
|
18213
|
+
}
|
|
18214
|
+
return pos;
|
|
18215
|
+
}
|
|
18216
|
+
function calculateLabelRatio($$, d, outerRadius, distance) {
|
|
18217
|
+
const { config } = $$;
|
|
18218
|
+
const chartType = arc_getArcType($$);
|
|
18219
|
+
let ratio = chartType ? config[`${chartType}_label_ratio`] : void 0;
|
|
18220
|
+
if (ratio) {
|
|
18221
|
+
ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, distance) : ratio;
|
|
18222
|
+
} else {
|
|
18223
|
+
const LABEL_MIN_SIZE = 36;
|
|
18224
|
+
const LABEL_RATIO_THRESHOLD = 0.375;
|
|
18225
|
+
const LABEL_RATIO_BASE = 1.175;
|
|
18226
|
+
const LABEL_RATIO_LARGE = 0.8;
|
|
18227
|
+
const labelSpaceRatio = LABEL_MIN_SIZE / outerRadius;
|
|
18228
|
+
const isSmallChart = labelSpaceRatio > LABEL_RATIO_THRESHOLD;
|
|
18229
|
+
ratio = outerRadius && distance ? (isSmallChart ? LABEL_RATIO_BASE - labelSpaceRatio : LABEL_RATIO_LARGE) * outerRadius / distance : 0;
|
|
18230
|
+
}
|
|
18231
|
+
return ratio;
|
|
18232
|
+
}
|
|
18233
|
+
function calculateStandardArcPosition($$, d, updated) {
|
|
18234
|
+
let { outerRadius } = $$.getRadius(d);
|
|
18235
|
+
if ($$.hasType("polar")) {
|
|
18236
|
+
outerRadius = $$.getPolarOuterRadius(d, outerRadius);
|
|
18237
|
+
}
|
|
18238
|
+
const [x, y] = $$.svgArc.centroid(updated).map((v) => isNaN(v) ? 0 : v);
|
|
18239
|
+
const distance = Math.sqrt(x * x + y * y);
|
|
18240
|
+
const ratio = calculateLabelRatio($$, d, outerRadius, distance);
|
|
18241
|
+
return {
|
|
18242
|
+
pos: { x, y },
|
|
18243
|
+
ratio
|
|
18244
|
+
};
|
|
18245
|
+
}
|
|
17909
18246
|
function getRadiusFn(expandRate = 0) {
|
|
17910
18247
|
const $$ = this;
|
|
17911
18248
|
const { config, state } = $$;
|
|
@@ -18013,7 +18350,9 @@ function getAttrTweenFn(fn) {
|
|
|
18013
18350
|
const padding = config[`${dataType}_padding`];
|
|
18014
18351
|
const w = config.gauge_width || config.donut_width;
|
|
18015
18352
|
const gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length * config.gauge_arcs_minWidth;
|
|
18016
|
-
|
|
18353
|
+
const LABEL_RADIUS_RATIO = 0.85;
|
|
18354
|
+
const labelWithLineRatio = isLabelWithLine.call($$) ? LABEL_RADIUS_RATIO : 1;
|
|
18355
|
+
state.radiusExpanded = Math.min(state.arcWidth, state.arcHeight) / 2 * ($$.hasMultiArcGauge() && config.gauge_label_show ? LABEL_RADIUS_RATIO : labelWithLineRatio);
|
|
18017
18356
|
state.radius = state.radiusExpanded * 0.95;
|
|
18018
18357
|
state.innerRadiusRatio = w ? (state.radius - w) / state.radius : 0.6;
|
|
18019
18358
|
state.gaugeArcWidth = w || (gaugeArcWidth <= state.radius - state.innerRadius ? state.radius - state.innerRadius : gaugeArcWidth <= state.radius ? gaugeArcWidth : state.radius);
|
|
@@ -18152,7 +18491,7 @@ function getAttrTweenFn(fn) {
|
|
|
18152
18491
|
/**
|
|
18153
18492
|
* Get expanded arc path function
|
|
18154
18493
|
* @param {number} rate Expand rate
|
|
18155
|
-
* @returns {
|
|
18494
|
+
* @returns {function} Expanded arc path getter function
|
|
18156
18495
|
* @private
|
|
18157
18496
|
*/
|
|
18158
18497
|
getSvgArcExpanded(rate = 1) {
|
|
@@ -18215,46 +18554,24 @@ function getAttrTweenFn(fn) {
|
|
|
18215
18554
|
* @private
|
|
18216
18555
|
*/
|
|
18217
18556
|
transformForArcLabel(textNode, d, forRange = false) {
|
|
18218
|
-
var _a, _b, _c;
|
|
18219
18557
|
const $$ = this;
|
|
18220
|
-
const { config, state: { radiusExpanded } } = $$;
|
|
18221
18558
|
const updated = $$.updateAngle(d, forRange);
|
|
18222
|
-
|
|
18223
|
-
|
|
18559
|
+
if (!updated) {
|
|
18560
|
+
return "";
|
|
18561
|
+
}
|
|
18562
|
+
let pos;
|
|
18224
18563
|
let ratio = 1;
|
|
18225
|
-
if (
|
|
18226
|
-
|
|
18227
|
-
|
|
18228
|
-
|
|
18229
|
-
|
|
18230
|
-
|
|
18231
|
-
|
|
18232
|
-
|
|
18233
|
-
const position = isFunction(rangeTextPosition) ? rangeTextPosition(rangeValues[d.index]) : rangeTextPosition;
|
|
18234
|
-
pos.x += (_a = position == null ? void 0 : position.x) != null ? _a : 0;
|
|
18235
|
-
pos.y += (_b = position == null ? void 0 : position.y) != null ? _b : 0;
|
|
18236
|
-
}
|
|
18237
|
-
} else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
|
18238
|
-
let { outerRadius } = $$.getRadius(d);
|
|
18239
|
-
if ($$.hasType("polar")) {
|
|
18240
|
-
outerRadius = $$.getPolarOuterRadius(d, outerRadius);
|
|
18241
|
-
}
|
|
18242
|
-
const c = this.svgArc.centroid(updated);
|
|
18243
|
-
const [x, y] = c.map((v) => isNaN(v) ? 0 : v);
|
|
18244
|
-
const h = Math.sqrt(x * x + y * y);
|
|
18245
|
-
pos.x = x;
|
|
18246
|
-
pos.y = y;
|
|
18247
|
-
ratio = (_c = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).map((v) => config[`${v}_label_ratio`])) == null ? void 0 : _c[0];
|
|
18248
|
-
if (ratio) {
|
|
18249
|
-
ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
|
|
18250
|
-
} else {
|
|
18251
|
-
ratio = outerRadius && (h ? (36 / outerRadius > 0.375 ? 1.175 - 36 / outerRadius : 0.8) * outerRadius / h : 0);
|
|
18252
|
-
}
|
|
18253
|
-
}
|
|
18254
|
-
updateTextImagePos.call($$, textNode, pos);
|
|
18255
|
-
translate = `translate(${pos.x * ratio},${pos.y * ratio})`;
|
|
18564
|
+
if (forRange || $$.hasMultiArcGauge()) {
|
|
18565
|
+
pos = calculateRangeOrGaugePosition($$, d, updated, forRange);
|
|
18566
|
+
} else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
|
18567
|
+
const result = calculateStandardArcPosition($$, d, updated);
|
|
18568
|
+
pos = result.pos;
|
|
18569
|
+
ratio = result.ratio;
|
|
18570
|
+
} else {
|
|
18571
|
+
return "";
|
|
18256
18572
|
}
|
|
18257
|
-
|
|
18573
|
+
updateTextImagePos.call($$, textNode, pos);
|
|
18574
|
+
return `translate(${pos.x * ratio},${pos.y * ratio})`;
|
|
18258
18575
|
},
|
|
18259
18576
|
convertToArcData(d) {
|
|
18260
18577
|
return this.addName({
|
|
@@ -18265,20 +18582,18 @@ function getAttrTweenFn(fn) {
|
|
|
18265
18582
|
});
|
|
18266
18583
|
},
|
|
18267
18584
|
textForArcLabel(selection) {
|
|
18585
|
+
var _a;
|
|
18268
18586
|
const $$ = this;
|
|
18269
18587
|
const hasGauge = $$.hasType("gauge");
|
|
18588
|
+
const chartType = (_a = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _a[0];
|
|
18270
18589
|
if ($$.shouldShowArcLabel()) {
|
|
18271
18590
|
selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", (d) => $$.updateTextBGColor.bind($$)(d, $$.config.data_labels_backgroundColors)).each(function(d) {
|
|
18272
|
-
var _a;
|
|
18273
18591
|
const node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
18274
18592
|
const updated = $$.updateAngle(d);
|
|
18275
18593
|
const ratio = $$.getRatio("arc", updated);
|
|
18276
|
-
const
|
|
18277
|
-
|
|
18278
|
-
|
|
18279
|
-
(_a = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _a[0]
|
|
18280
|
-
);
|
|
18281
|
-
if (isUnderThreshold) {
|
|
18594
|
+
const meetsThreshold = meetsLabelThreshold.call($$, ratio, chartType);
|
|
18595
|
+
d._cache = { updated, ratio, meetsThreshold };
|
|
18596
|
+
if (meetsThreshold) {
|
|
18282
18597
|
const { value } = updated || d;
|
|
18283
18598
|
const text = ($$.getArcLabelConfig("format") || $$.defaultArcValueFormat)(value, ratio, d.data.id).toString();
|
|
18284
18599
|
setTextValue(node, text, [-1, 1], hasGauge);
|
|
@@ -18385,7 +18700,7 @@ function getAttrTweenFn(fn) {
|
|
|
18385
18700
|
])
|
|
18386
18701
|
);
|
|
18387
18702
|
mainPieEnter.append("g").attr("class", classArcs).merge(mainPieUpdate);
|
|
18388
|
-
mainPieEnter.append("text").attr("dy", hasGauge && !$$.hasMultiTargets() ? "-.1em" :
|
|
18703
|
+
mainPieEnter.append("text").attr("dy", hasGauge && !$$.hasMultiTargets() ? "-.1em" : null).style("opacity", "0").style("text-anchor", $$.getStylePropValue("middle")).style("pointer-events", $$.getStylePropValue("none"));
|
|
18389
18704
|
$el.text = chartArcs.selectAll(`.${$COMMON.target} text`);
|
|
18390
18705
|
},
|
|
18391
18706
|
initArc() {
|
|
@@ -18695,7 +19010,7 @@ function getAttrTweenFn(fn) {
|
|
|
18695
19010
|
const id = (arcData == null ? void 0 : arcData.id) || void 0;
|
|
18696
19011
|
$$.callOverOutForTouch(arcData);
|
|
18697
19012
|
isUndefined(id) ? unselectArc() : selectArc(this, arcData, id);
|
|
18698
|
-
});
|
|
19013
|
+
}, { passive: true });
|
|
18699
19014
|
}
|
|
18700
19015
|
},
|
|
18701
19016
|
redrawArcText(duration) {
|
|
@@ -18725,6 +19040,7 @@ function getAttrTweenFn(fn) {
|
|
|
18725
19040
|
!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));
|
|
18726
19041
|
}
|
|
18727
19042
|
}
|
|
19043
|
+
isLabelWithLine.call($$) && redrawArcLabelLines.call($$, duration);
|
|
18728
19044
|
},
|
|
18729
19045
|
/**
|
|
18730
19046
|
* Get Arc element by id or index
|
|
@@ -18783,7 +19099,7 @@ function getAttrTweenFn(fn) {
|
|
|
18783
19099
|
},
|
|
18784
19100
|
/**
|
|
18785
19101
|
* Redraw function
|
|
18786
|
-
* @param {
|
|
19102
|
+
* @param {function} drawFn Retuned functino from .generateDrawCandlestick()
|
|
18787
19103
|
* @param {boolean} withTransition With or without transition
|
|
18788
19104
|
* @param {boolean} isSub Subchart draw
|
|
18789
19105
|
* @returns {Array}
|
|
@@ -18803,7 +19119,7 @@ function getAttrTweenFn(fn) {
|
|
|
18803
19119
|
* Generate area path data
|
|
18804
19120
|
* @param {object} areaIndices Indices
|
|
18805
19121
|
* @param {boolean} isSub Weather is sub axis
|
|
18806
|
-
* @returns {
|
|
19122
|
+
* @returns {function}
|
|
18807
19123
|
* @private
|
|
18808
19124
|
*/
|
|
18809
19125
|
generateDrawArea(areaIndices, isSub) {
|
|
@@ -18947,7 +19263,7 @@ function getConnectLineType(id) {
|
|
|
18947
19263
|
},
|
|
18948
19264
|
/**
|
|
18949
19265
|
* Redraw function
|
|
18950
|
-
* @param {
|
|
19266
|
+
* @param {function} drawFn Retuned function from .getDrawShape() => .generateDrawBar()
|
|
18951
19267
|
* @param {boolean} withTransition With or without transition
|
|
18952
19268
|
* @param {boolean} isSub Subchart draw
|
|
18953
19269
|
* @returns {Array}
|
|
@@ -18994,7 +19310,7 @@ function getConnectLineType(id) {
|
|
|
18994
19310
|
* -------------------------
|
|
18995
19311
|
* 0 1
|
|
18996
19312
|
* @param {boolean} isSub If is for subchart
|
|
18997
|
-
* @returns {
|
|
19313
|
+
* @returns {function}
|
|
18998
19314
|
* @private
|
|
18999
19315
|
*/
|
|
19000
19316
|
generateDrawBar(barIndices, isSub) {
|
|
@@ -19289,7 +19605,7 @@ var candlestick_spreadValues = (a, b) => {
|
|
|
19289
19605
|
* Get draw function
|
|
19290
19606
|
* @param {object} indices Indice data
|
|
19291
19607
|
* @param {boolean} isSub Subchart draw
|
|
19292
|
-
* @returns {
|
|
19608
|
+
* @returns {function}
|
|
19293
19609
|
* @private
|
|
19294
19610
|
*/
|
|
19295
19611
|
generateDrawCandlestick(indices, isSub) {
|
|
@@ -19333,7 +19649,7 @@ var candlestick_spreadValues = (a, b) => {
|
|
|
19333
19649
|
* Generate shape drawing points
|
|
19334
19650
|
* @param {object} indices Indice data
|
|
19335
19651
|
* @param {boolean} isSub Subchart draw
|
|
19336
|
-
* @returns {
|
|
19652
|
+
* @returns {function}
|
|
19337
19653
|
*/
|
|
19338
19654
|
generateGetCandlestickPoints(indices, isSub = false) {
|
|
19339
19655
|
const $$ = this;
|
|
@@ -19379,7 +19695,7 @@ var candlestick_spreadValues = (a, b) => {
|
|
|
19379
19695
|
},
|
|
19380
19696
|
/**
|
|
19381
19697
|
* Redraw function
|
|
19382
|
-
* @param {
|
|
19698
|
+
* @param {function} drawFn Retuned functino from .generateDrawCandlestick()
|
|
19383
19699
|
* @param {boolean} withTransition With or without transition
|
|
19384
19700
|
* @param {boolean} isSub Subchart draw
|
|
19385
19701
|
* @returns {Array}
|
|
@@ -19591,7 +19907,7 @@ function updateRatio(data) {
|
|
|
19591
19907
|
$$.showTooltip([data], event.target);
|
|
19592
19908
|
/^(touchstart|mouseover)$/.test(event.type) && $$.setOverOut(true, data);
|
|
19593
19909
|
}
|
|
19594
|
-
}).on(isTouch ? "touchend" : "mouseout", (event) => {
|
|
19910
|
+
}, isTouch ? { passive: true } : void 0).on(isTouch ? "touchend" : "mouseout", (event) => {
|
|
19595
19911
|
const data = getTarget(event);
|
|
19596
19912
|
if (config.interaction_onout) {
|
|
19597
19913
|
$$.hideTooltip();
|
|
@@ -19842,7 +20158,7 @@ function getRegions(d, _regions, isTimeSeries) {
|
|
|
19842
20158
|
},
|
|
19843
20159
|
/**
|
|
19844
20160
|
* Redraw function
|
|
19845
|
-
* @param {
|
|
20161
|
+
* @param {function} drawFn Retuned functino from .generateDrawCandlestick()
|
|
19846
20162
|
* @param {boolean} withTransition With or without transition
|
|
19847
20163
|
* @param {boolean} isSub Subchart draw
|
|
19848
20164
|
* @returns {Array}
|
|
@@ -19859,7 +20175,7 @@ function getRegions(d, _regions, isTimeSeries) {
|
|
|
19859
20175
|
/**
|
|
19860
20176
|
* Get the curve interpolate
|
|
19861
20177
|
* @param {Array} d Data object
|
|
19862
|
-
* @returns {
|
|
20178
|
+
* @returns {function}
|
|
19863
20179
|
* @private
|
|
19864
20180
|
*/
|
|
19865
20181
|
getCurve(d) {
|
|
@@ -19929,8 +20245,8 @@ function getRegions(d, _regions, isTimeSeries) {
|
|
|
19929
20245
|
/**
|
|
19930
20246
|
* Set regions dasharray and get path
|
|
19931
20247
|
* @param {Array} d Data object
|
|
19932
|
-
* @param {
|
|
19933
|
-
* @param {
|
|
20248
|
+
* @param {function} x x scale function
|
|
20249
|
+
* @param {function} y y scale function
|
|
19934
20250
|
* @param {object} _regions regions to be set
|
|
19935
20251
|
* @returns {stirng} Path string
|
|
19936
20252
|
* @private
|
|
@@ -20527,7 +20843,7 @@ function insertPointInfoDefs(point, id) {
|
|
|
20527
20843
|
},
|
|
20528
20844
|
/**
|
|
20529
20845
|
* Get generate point function
|
|
20530
|
-
* @returns {
|
|
20846
|
+
* @returns {function}
|
|
20531
20847
|
* @private
|
|
20532
20848
|
*/
|
|
20533
20849
|
generatePoint() {
|
|
@@ -20876,9 +21192,9 @@ const cacheKeyTextWidth = KEY.radarTextWidth;
|
|
|
20876
21192
|
const index = $$.getDataIndexFromEvent(event);
|
|
20877
21193
|
$$.selectRectForSingle(svg.node(), index);
|
|
20878
21194
|
isMouse ? $$.setOverOut(true, index) : $$.callOverOutForTouch(index);
|
|
20879
|
-
}).on("mouseout", isMouse ? hide : null);
|
|
21195
|
+
}, isMouse ? void 0 : { passive: true }).on("mouseout", isMouse ? hide : null);
|
|
20880
21196
|
if (!isMouse) {
|
|
20881
|
-
svg.on("touchstart", hide);
|
|
21197
|
+
svg.on("touchstart", hide, { passive: true });
|
|
20882
21198
|
}
|
|
20883
21199
|
},
|
|
20884
21200
|
updateRadarShape() {
|
|
@@ -20990,7 +21306,7 @@ function getHierachyData(data) {
|
|
|
20990
21306
|
$$.showTooltip([data], event.currentTarget);
|
|
20991
21307
|
/^(touchstart|mouseover)$/.test(event.type) && $$.setOverOut(true, data);
|
|
20992
21308
|
}
|
|
20993
|
-
}).on(isTouch ? "touchend" : "mouseout", (event) => {
|
|
21309
|
+
}, isTouch ? { passive: true } : void 0).on(isTouch ? "touchend" : "mouseout", (event) => {
|
|
20994
21310
|
const data = getTarget(event);
|
|
20995
21311
|
if (config.interaction_onout) {
|
|
20996
21312
|
$$.hideTooltip();
|
|
@@ -21001,7 +21317,7 @@ function getHierachyData(data) {
|
|
|
21001
21317
|
},
|
|
21002
21318
|
/**
|
|
21003
21319
|
* Get tiling function
|
|
21004
|
-
* @returns {
|
|
21320
|
+
* @returns {function}
|
|
21005
21321
|
* @private
|
|
21006
21322
|
*/
|
|
21007
21323
|
getTreemapTile() {
|
|
@@ -21102,20 +21418,28 @@ function getHierachyData(data) {
|
|
|
21102
21418
|
/**
|
|
21103
21419
|
* Get treemap data label format function
|
|
21104
21420
|
* @param {object} d Data object
|
|
21105
|
-
* @returns {
|
|
21421
|
+
* @returns {function} Label formatter function
|
|
21106
21422
|
* @private
|
|
21107
21423
|
*/
|
|
21108
21424
|
treemapDataLabelFormat(d) {
|
|
21109
21425
|
const $$ = this;
|
|
21110
|
-
const { config } = $$;
|
|
21426
|
+
const { $el: { treemap }, config, scale: { x, y } } = $$;
|
|
21111
21427
|
const { id, value } = d;
|
|
21112
21428
|
const format = config.treemap_label_format;
|
|
21113
21429
|
const ratio = $$.getRatio("treemap", d);
|
|
21114
21430
|
const percentValue = (ratio * 100).toFixed(2);
|
|
21115
21431
|
const meetLabelThreshold = config.treemap_label_show && meetsLabelThreshold.call($$, ratio, "treemap") ? null : "0";
|
|
21432
|
+
const treemapNode = treemap.selectAll("g").filter((node) => node.data.id === id).datum();
|
|
21433
|
+
let width = 0;
|
|
21434
|
+
let height = 0;
|
|
21435
|
+
if (treemapNode) {
|
|
21436
|
+
const { x0, x1, y0, y1 } = treemapNode;
|
|
21437
|
+
width = x(x1) - x(x0);
|
|
21438
|
+
height = y(y1) - y(y0);
|
|
21439
|
+
}
|
|
21116
21440
|
return function(node) {
|
|
21117
21441
|
node.style("opacity", meetLabelThreshold);
|
|
21118
|
-
return isFunction(format) ? format.bind($$.api)(value, ratio, id) : `${id}
|
|
21442
|
+
return isFunction(format) ? format.bind($$.api)(value, ratio, id, { width, height }) : `${id}
|
|
21119
21443
|
${percentValue}%`;
|
|
21120
21444
|
};
|
|
21121
21445
|
}
|
|
@@ -21130,7 +21454,7 @@ ${percentValue}%`;
|
|
|
21130
21454
|
* @type {object}
|
|
21131
21455
|
* @property {object} point Point object
|
|
21132
21456
|
* @property {boolean} [point.show=true] Whether to show each point in line.
|
|
21133
|
-
* @property {number|
|
|
21457
|
+
* @property {number|function} [point.r=2.5] The radius size of each point.
|
|
21134
21458
|
* - **NOTE:** Disabled for 'bubble' type
|
|
21135
21459
|
* @property {boolean|object} [point.radialGradient=false] Set the radial gradient on point.<br><br>
|
|
21136
21460
|
* Or customize by giving below object value:
|
|
@@ -21147,7 +21471,7 @@ ${percentValue}%`;
|
|
|
21147
21471
|
* - **NOTE:**
|
|
21148
21472
|
* - `null` will make to not set inline 'opacity' css prop.
|
|
21149
21473
|
* - when no value(or undefined) is set, it defaults to set opacity value according its chart types.
|
|
21150
|
-
* @property {number|string|
|
|
21474
|
+
* @property {number|string|function} [point.sensitivity=10] The sensitivity value for interaction boundary.
|
|
21151
21475
|
* - **Available Values:**
|
|
21152
21476
|
* - {number}: Absolute sensitivity value which is the distance from the data point in pixel.
|
|
21153
21477
|
* - "radius": sensitivity based on point's radius
|
|
@@ -21194,7 +21518,7 @@ ${percentValue}%`;
|
|
|
21194
21518
|
* return r;
|
|
21195
21519
|
* },
|
|
21196
21520
|
*
|
|
21197
|
-
* // will generate
|
|
21521
|
+
* // will generate following radialGradient:
|
|
21198
21522
|
* // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/radialGradient
|
|
21199
21523
|
* // <radualGradient cx="0.3" cy="0.3" r="0.7">
|
|
21200
21524
|
* // <stop offset="0.1" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
|
|
@@ -21310,7 +21634,7 @@ ${percentValue}%`;
|
|
|
21310
21634
|
* // <g class='bb-areas'> will be positioned behind the line <g class='bb-lines'> in stacking order
|
|
21311
21635
|
* front: false,
|
|
21312
21636
|
*
|
|
21313
|
-
* // will generate
|
|
21637
|
+
* // will generate following linearGradient:
|
|
21314
21638
|
* // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient
|
|
21315
21639
|
* // <linearGradient x1="0" x2="0" y1="0" y2="1">
|
|
21316
21640
|
* // <stop offset="0" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
|
|
@@ -21364,8 +21688,8 @@ ${percentValue}%`;
|
|
|
21364
21688
|
* @property {number} [bar.padding=0] The padding pixel value between each bar.
|
|
21365
21689
|
* @property {number} [bar.radius] Set the radius of bar edge in pixel.
|
|
21366
21690
|
* @property {number} [bar.radius.ratio] Set the radius ratio of bar edge in relative the bar's width.
|
|
21367
|
-
* @property {number} [bar.sensitivity=2] The
|
|
21368
|
-
* @property {number|
|
|
21691
|
+
* @property {number} [bar.sensitivity=2] The sensitivity offset value for interaction boundary.
|
|
21692
|
+
* @property {number|function|object} [bar.width] Change the width of bar chart.
|
|
21369
21693
|
* @property {number} [bar.width.ratio=0.6] Change the width of bar chart by ratio.
|
|
21370
21694
|
* - **NOTE:** Criteria for ratio.
|
|
21371
21695
|
* - When x ticks count is same with the data count, the baseline for ratio is the minimum interval value of x ticks.
|
|
@@ -21392,12 +21716,12 @@ ${percentValue}%`;
|
|
|
21392
21716
|
* // make bar shape to be positioned over the other shape elements
|
|
21393
21717
|
* front: true,
|
|
21394
21718
|
*
|
|
21395
|
-
* // remove nullish data on bar indices
|
|
21719
|
+
* // remove nullish data on bar indices positions
|
|
21396
21720
|
* indices: {
|
|
21397
21721
|
* removeNull: true
|
|
21398
21722
|
* },
|
|
21399
21723
|
*
|
|
21400
|
-
* // will generate
|
|
21724
|
+
* // will generate following linearGradient:
|
|
21401
21725
|
* // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient
|
|
21402
21726
|
* // <linearGradient x1="0" x2="0" y1="0" y2="1">
|
|
21403
21727
|
* // <stop offset="0" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
|
|
@@ -21495,12 +21819,12 @@ ${percentValue}%`;
|
|
|
21495
21819
|
* @memberof Options
|
|
21496
21820
|
* @type {object}
|
|
21497
21821
|
* @property {object} bubble bubble object
|
|
21498
|
-
* @property {number|
|
|
21822
|
+
* @property {number|function} [bubble.maxR=35] Set the max bubble radius value
|
|
21499
21823
|
* @property {boolean} [bubble.zerobased=false] Set if min or max value will be 0 on bubble chart.
|
|
21500
21824
|
* @example
|
|
21501
21825
|
* bubble: {
|
|
21502
21826
|
* // ex) If 100 is the highest value among data bound, the representation bubble of 100 will have radius of 50.
|
|
21503
|
-
* // And the lesser will have radius relatively from
|
|
21827
|
+
* // And the lesser will have radius relatively from the max value.
|
|
21504
21828
|
* maxR: 50,
|
|
21505
21829
|
*
|
|
21506
21830
|
* // or set radius callback
|
|
@@ -21554,7 +21878,7 @@ ${percentValue}%`;
|
|
|
21554
21878
|
* }
|
|
21555
21879
|
* },
|
|
21556
21880
|
* color: {
|
|
21557
|
-
* //
|
|
21881
|
+
* // specify bearish color
|
|
21558
21882
|
* down: "red",
|
|
21559
21883
|
*
|
|
21560
21884
|
* // or specify color per dataset
|
|
@@ -21607,7 +21931,7 @@ ${percentValue}%`;
|
|
|
21607
21931
|
* // hide all data points ('point.show=false' also has similar effect)
|
|
21608
21932
|
* point: false,
|
|
21609
21933
|
*
|
|
21610
|
-
* // show data points for only indicated
|
|
21934
|
+
* // show data points for only indicated data
|
|
21611
21935
|
* point: [
|
|
21612
21936
|
* "data1", "data3"
|
|
21613
21937
|
* ],
|
|
@@ -21642,7 +21966,7 @@ ${percentValue}%`;
|
|
|
21642
21966
|
* // hide all data points ('point.show=false' also has similar effect)
|
|
21643
21967
|
* point: false,
|
|
21644
21968
|
*
|
|
21645
|
-
* // show data points for only indicated
|
|
21969
|
+
* // show data points for only indicated data
|
|
21646
21970
|
* point: [
|
|
21647
21971
|
* "data1", "data3"
|
|
21648
21972
|
* ],
|
|
@@ -21701,14 +22025,14 @@ ${percentValue}%`;
|
|
|
21701
22025
|
* @memberof Options
|
|
21702
22026
|
* @type {object}
|
|
21703
22027
|
* @property {object} arc Arc object
|
|
21704
|
-
* @property {number|
|
|
22028
|
+
* @property {number|function} [arc.cornerRadius=0] Set corner radius of Arc(donut/gauge/pie/polar) shape.
|
|
21705
22029
|
* - **NOTE:**
|
|
21706
22030
|
* - Corner radius can't surpass the `(outerRadius - innerRadius) /2` of indicated shape.
|
|
21707
22031
|
* @property {number} [arc.cornerRadius.ratio=0] Set ratio relative of outer radius.
|
|
21708
22032
|
* @property {object} [arc.needle] Set needle options.
|
|
21709
22033
|
* @property {boolean} [arc.needle.show=false] Show or hide needle.
|
|
21710
22034
|
* @property {string} [arc.needle.color] Set needle filled color.
|
|
21711
|
-
* @property {
|
|
22035
|
+
* @property {function} [arc.needle.path] Set custom needle path function.
|
|
21712
22036
|
* - **NOTE:**
|
|
21713
22037
|
* - The path should be starting from 0,0 (which is center) to top center coordinate.
|
|
21714
22038
|
* - The function will receive, `length`{number} parameter which indicating the needle length in pixel relative to radius.
|
|
@@ -21732,8 +22056,8 @@ ${percentValue}%`;
|
|
|
21732
22056
|
* @property {string} [arc.rangeText.unit="absolute"] Specify the range text unit.
|
|
21733
22057
|
* - "absolute": Show absolute value
|
|
21734
22058
|
* - "%": Show percentage value
|
|
21735
|
-
* @property {boolean} [arc.rangeText.
|
|
21736
|
-
* @property {
|
|
22059
|
+
* @property {boolean} [arc.rangeText.fixed=false] Set if range text shown will be fixed w/o data toggle update. Only available for gauge chart.
|
|
22060
|
+
* @property {function} [arc.rangeText.format] Set format function for the range text.
|
|
21737
22061
|
* @property {number} [arc.rangeText.position] Set position function or object for the range text.
|
|
21738
22062
|
* @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutCornerRadius)
|
|
21739
22063
|
* @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#PieChartOptions.CornerRadius)
|
|
@@ -21846,10 +22170,21 @@ ${percentValue}%`;
|
|
|
21846
22170
|
* @type {object}
|
|
21847
22171
|
* @property {object} donut Donut object
|
|
21848
22172
|
* @property {boolean} [donut.label.show=true] Show or hide label on each donut piece.
|
|
21849
|
-
* @property {
|
|
22173
|
+
* @property {function} [donut.label.format] Set formatter for the label on each donut piece.
|
|
21850
22174
|
* @property {number} [donut.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
21851
|
-
* @property {number|
|
|
21852
|
-
* @property {object
|
|
22175
|
+
* @property {number|function} [donut.label.ratio=undefined] Set ratio of labels position.
|
|
22176
|
+
* @property {boolean|object} [donut.label.line=false] Enable label with lines (displayed outside with connector lines).
|
|
22177
|
+
* - `true`: Enable label with lines with default settings
|
|
22178
|
+
* - `false`: Labels are displayed inside the donut slices (default behavior).
|
|
22179
|
+
* - `{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.
|
|
22180
|
+
* @property {boolean} [donut.label.line.show=true] Show or hide connector lines.
|
|
22181
|
+
* @property {number} [donut.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
|
|
22182
|
+
* @property {boolean|function} [donut.label.line.text=true] Show text at the end of the connector line (outside the shape).
|
|
22183
|
+
* - `true`: show data "id" text
|
|
22184
|
+
* - `false`: use default formatter(label.format) to show text
|
|
22185
|
+
* - `function(value, ratio, id)`: Custom formatter function for the text.
|
|
22186
|
+
* - **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.
|
|
22187
|
+
* @property {object|function} [donut.label.image] Set image to be displayed next to the label text.<br><br>
|
|
21853
22188
|
* 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>
|
|
21854
22189
|
* The arguments are:<br>
|
|
21855
22190
|
* - `v` is the value of the data point where the label is shown.
|
|
@@ -21874,6 +22209,7 @@ ${percentValue}%`;
|
|
|
21874
22209
|
* @see [Demo: Needle](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutNeedle)
|
|
21875
22210
|
* @see [Demo: Range Text](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutRangeText)
|
|
21876
22211
|
* @see [Demo: Label Image](https://naver.github.io/billboard.js/demo/#DonutChartOptions.LabelImage)
|
|
22212
|
+
* @see [Demo: Label Line](https://naver.github.io/billboard.js/demo/#DonutChartOptions.LabelLine)
|
|
21877
22213
|
* @see [Demo: Label Ratio](https://naver.github.io/billboard.js/demo/#DonutChartOptions.LabelRatio)
|
|
21878
22214
|
* @see [Demo: Multiline Label](https://naver.github.io/billboard.js/demo/#DonutChartOptions.MultilineLabel)
|
|
21879
22215
|
* @see [Demo: Multiline Title](https://naver.github.io/billboard.js/demo/#DonutChartOptions.MultilineTitle)
|
|
@@ -21903,6 +22239,20 @@ ${percentValue}%`;
|
|
|
21903
22239
|
* // or set ratio number
|
|
21904
22240
|
* ratio: 0.5,
|
|
21905
22241
|
*
|
|
22242
|
+
* // Enable label with lines (displayed outside with connector lines)
|
|
22243
|
+
* line: false, // default - labels inside
|
|
22244
|
+
* line: true, // enable label with lines with default settings
|
|
22245
|
+
* line: { // enable label with lines with custom settings
|
|
22246
|
+
* show: true,
|
|
22247
|
+
* distance: 20, // horizontal line distance in pixels
|
|
22248
|
+
*
|
|
22249
|
+
* // show text at the end of connector line (outside the shape)
|
|
22250
|
+
* text: true, // use default formatter
|
|
22251
|
+
* text: function(value, ratio, id) { // custom formatter
|
|
22252
|
+
* return d3.format(".1%")(ratio);
|
|
22253
|
+
* }
|
|
22254
|
+
* },
|
|
22255
|
+
*
|
|
21906
22256
|
* // set image to be displayed next to the label text
|
|
21907
22257
|
* image: {
|
|
21908
22258
|
* url: "./sample.svg",
|
|
@@ -21974,6 +22324,7 @@ ${percentValue}%`;
|
|
|
21974
22324
|
donut_label_show: true,
|
|
21975
22325
|
donut_label_format: void 0,
|
|
21976
22326
|
donut_label_threshold: 0.05,
|
|
22327
|
+
donut_label_line: false,
|
|
21977
22328
|
donut_label_image: void 0,
|
|
21978
22329
|
donut_label_ratio: void 0,
|
|
21979
22330
|
donut_width: void 0,
|
|
@@ -22029,15 +22380,27 @@ ${percentValue}%`;
|
|
|
22029
22380
|
* @property {boolean} [gauge.background=""] Set background color. (The `.bb-chart-arcs-background` element)
|
|
22030
22381
|
* @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.
|
|
22031
22382
|
* @property {boolean} [gauge.label.show=true] Show or hide label on gauge.
|
|
22032
|
-
* @property {
|
|
22033
|
-
* @property {
|
|
22383
|
+
* @property {function} [gauge.label.extents] Set customized min/max label text.
|
|
22384
|
+
* @property {function} [gauge.label.format] Set formatter for the label on gauge. Label text can be multilined with `\n` character.<br>
|
|
22034
22385
|
* Will pass following arguments to the given function:
|
|
22035
22386
|
* - value {number}: absolute value
|
|
22036
22387
|
* - ratio {number}: value's ratio
|
|
22037
22388
|
* - id {string}: data's id value
|
|
22038
|
-
* @property {number|
|
|
22389
|
+
* @property {number|function} [gauge.label.ratio=undefined] Set ratio of labels position.
|
|
22039
22390
|
* @property {number} [gauge.label.threshold=0] Set threshold ratio to show/hide labels.
|
|
22040
|
-
* @property {object
|
|
22391
|
+
* @property {boolean|object} [gauge.label.line=false] Enable label with lines (displayed outside with connector lines).
|
|
22392
|
+
* - **NOTE:** Only applicable for single gauge (not for `gauge.type="multi"`).
|
|
22393
|
+
* - `true`: Enable label with lines with default settings
|
|
22394
|
+
* - `false`: Labels are displayed inside the gauge (default behavior).
|
|
22395
|
+
* - `{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.
|
|
22396
|
+
* @property {boolean} [gauge.label.line.show=true] Show or hide connector lines.
|
|
22397
|
+
* @property {number} [gauge.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
|
|
22398
|
+
* @property {boolean|function} [gauge.label.line.text=true] Show text at the end of the connector line (outside the shape).
|
|
22399
|
+
* - `true`: show data "id" text
|
|
22400
|
+
* - `false`: use default formatter(label.format) to show text
|
|
22401
|
+
* - `function(value, ratio, id)`: Custom formatter function for the text.
|
|
22402
|
+
* - **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.
|
|
22403
|
+
* @property {object|function} [gauge.label.image] Set image to be displayed next to the label text.<br><br>
|
|
22041
22404
|
* 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>
|
|
22042
22405
|
* The arguments are:<br>
|
|
22043
22406
|
* - `v` is the value of the data point where the label is shown.
|
|
@@ -22090,6 +22453,7 @@ ${percentValue}%`;
|
|
|
22090
22453
|
* @see [Demo: archLength](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeArcLength)
|
|
22091
22454
|
* @see [Demo: startingAngle](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeStartingAngle)
|
|
22092
22455
|
* @see [Demo: label image](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeLabelImage)
|
|
22456
|
+
* @see [Demo: label line](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeLabelLine)
|
|
22093
22457
|
* @see [Demo: label ratio](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeLabelRatio)
|
|
22094
22458
|
* @example
|
|
22095
22459
|
* gauge: {
|
|
@@ -22112,6 +22476,20 @@ ${percentValue}%`;
|
|
|
22112
22476
|
* // if data value is below than 0.1, text label will be hidden.
|
|
22113
22477
|
* threshold: 0.1,
|
|
22114
22478
|
*
|
|
22479
|
+
* // Enable label with lines (displayed outside with connector lines)
|
|
22480
|
+
* // NOTE: Only works with single gauge (not gauge.type="multi")
|
|
22481
|
+
* line: true, // enable label with lines with default settings
|
|
22482
|
+
* line: { // enable label with lines with custom settings
|
|
22483
|
+
* show: true, // enable lines (default: true when line is enabled)
|
|
22484
|
+
* distance: 30, // distance of horizontal line in pixels (default: 20)
|
|
22485
|
+
*
|
|
22486
|
+
* // show text at the end of connector line (outside the shape)
|
|
22487
|
+
* text: true, // use default formatter
|
|
22488
|
+
* text: function(value, ratio, id) { // custom formatter
|
|
22489
|
+
* return d3.format(".1%")(ratio);
|
|
22490
|
+
* }
|
|
22491
|
+
* },
|
|
22492
|
+
*
|
|
22115
22493
|
* // set ratio callback. Should return ratio value
|
|
22116
22494
|
* ratio: function(d, radius, h) {
|
|
22117
22495
|
* ...
|
|
@@ -22205,6 +22583,7 @@ ${percentValue}%`;
|
|
|
22205
22583
|
gauge_label_format: void 0,
|
|
22206
22584
|
gauge_label_ratio: void 0,
|
|
22207
22585
|
gauge_label_threshold: 0,
|
|
22586
|
+
gauge_label_line: false,
|
|
22208
22587
|
gauge_label_image: void 0,
|
|
22209
22588
|
gauge_enforceMinMax: false,
|
|
22210
22589
|
gauge_min: 0,
|
|
@@ -22230,10 +22609,21 @@ ${percentValue}%`;
|
|
|
22230
22609
|
* @type {object}
|
|
22231
22610
|
* @property {object} pie Pie object
|
|
22232
22611
|
* @property {boolean} [pie.label.show=true] Show or hide label on each pie piece.
|
|
22233
|
-
* @property {
|
|
22234
|
-
* @property {number|
|
|
22612
|
+
* @property {function} [pie.label.format] Set formatter for the label on each pie piece.
|
|
22613
|
+
* @property {number|function} [pie.label.ratio=undefined] Set ratio of labels position.
|
|
22235
22614
|
* @property {number} [pie.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
22236
|
-
* @property {object
|
|
22615
|
+
* @property {boolean|object} [pie.label.line=false] Enable label with lines (displayed outside with connector lines).
|
|
22616
|
+
* - `true`: Enable label with lines with default settings
|
|
22617
|
+
* - `false`: Labels are displayed inside the pie slices (default behavior).
|
|
22618
|
+
* - `{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.
|
|
22619
|
+
* @property {boolean} [pie.label.line.show=true] Show or hide connector lines.
|
|
22620
|
+
* @property {number} [pie.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
|
|
22621
|
+
* @property {boolean|function} [pie.label.line.text=true] Show text at the end of the connector line (outside the shape).
|
|
22622
|
+
* - `true`: show data "id" text
|
|
22623
|
+
* - `false`: use default formatter(label.format) to show text
|
|
22624
|
+
* - `function(value, ratio, id)`: Custom formatter function for the text.
|
|
22625
|
+
* - **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.
|
|
22626
|
+
* @property {object|function} [pie.label.image] Set image to be displayed next to the label text.<br><br>
|
|
22237
22627
|
* 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>
|
|
22238
22628
|
* The arguments are:<br>
|
|
22239
22629
|
* - `v` is the value of the data point where the label is shown.
|
|
@@ -22258,6 +22648,7 @@ ${percentValue}%`;
|
|
|
22258
22648
|
* @see [Demo: outerRadius](https://naver.github.io/billboard.js/demo/#PieChartOptions.OuterRadius)
|
|
22259
22649
|
* @see [Demo: startingAngle](https://naver.github.io/billboard.js/demo/#PieChartOptions.StartingAngle)
|
|
22260
22650
|
* @see [Demo: label image](https://naver.github.io/billboard.js/demo/#PieChartOptions.LabelImage)
|
|
22651
|
+
* @see [Demo: label line](https://naver.github.io/billboard.js/demo/#PieChartOptions.LabelLine)
|
|
22261
22652
|
* @example
|
|
22262
22653
|
* pie: {
|
|
22263
22654
|
* label: {
|
|
@@ -22281,6 +22672,20 @@ ${percentValue}%`;
|
|
|
22281
22672
|
* // or set ratio number
|
|
22282
22673
|
* ratio: 0.5,
|
|
22283
22674
|
*
|
|
22675
|
+
* // Enable label with lines (displayed outside with connector lines)
|
|
22676
|
+
* line: false, // default - labels inside
|
|
22677
|
+
* line: true, // enable label with lines with default settings
|
|
22678
|
+
* line: { // enable label with lines with custom settings
|
|
22679
|
+
* show: true,
|
|
22680
|
+
* distance: 20, // horizontal line distance in pixels
|
|
22681
|
+
*
|
|
22682
|
+
* // show text at the end of connector line (outside the shape)
|
|
22683
|
+
* text: true, // use default formatter
|
|
22684
|
+
* text: function(value, ratio, id) { // custom formatter
|
|
22685
|
+
* return d3.format(".1%")(ratio);
|
|
22686
|
+
* }
|
|
22687
|
+
* },
|
|
22688
|
+
*
|
|
22284
22689
|
* // set image to be displayed next to the label text
|
|
22285
22690
|
* image: {
|
|
22286
22691
|
* url: "./sample.svg",
|
|
@@ -22362,6 +22767,7 @@ ${percentValue}%`;
|
|
|
22362
22767
|
pie_label_format: void 0,
|
|
22363
22768
|
pie_label_ratio: void 0,
|
|
22364
22769
|
pie_label_threshold: 0.05,
|
|
22770
|
+
pie_label_line: false,
|
|
22365
22771
|
pie_label_image: void 0,
|
|
22366
22772
|
pie_expand: {},
|
|
22367
22773
|
pie_expand_rate: 0.98,
|
|
@@ -22382,10 +22788,21 @@ ${percentValue}%`;
|
|
|
22382
22788
|
* @type {object}
|
|
22383
22789
|
* @property {object} polar Polar object
|
|
22384
22790
|
* @property {boolean} [polar.label.show=true] Show or hide label on each polar piece.
|
|
22385
|
-
* @property {
|
|
22791
|
+
* @property {function} [polar.label.format] Set formatter for the label on each polar piece.
|
|
22386
22792
|
* @property {number} [polar.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
22387
|
-
* @property {number|
|
|
22388
|
-
* @property {object
|
|
22793
|
+
* @property {number|function} [polar.label.ratio=undefined] Set ratio of labels position.
|
|
22794
|
+
* @property {boolean|object} [polar.label.line=false] Enable label with lines (displayed outside with connector lines).
|
|
22795
|
+
* - `true`: Enable label with lines with default settings
|
|
22796
|
+
* - `false`: Labels are displayed inside the polar slices (default behavior).
|
|
22797
|
+
* - `{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.
|
|
22798
|
+
* @property {boolean} [polar.label.line.show=true] Show or hide connector lines.
|
|
22799
|
+
* @property {number} [polar.label.line.distance=20] Set the distance of the horizontal part of the connector line in pixels.
|
|
22800
|
+
* @property {boolean|function} [polar.label.line.text=true] Show text at the end of the connector line (outside the shape).
|
|
22801
|
+
* - `true`: show data "id" text
|
|
22802
|
+
* - `false`: use default formatter(label.format) to show text
|
|
22803
|
+
* - `function(value, ratio, id)`: Custom formatter function for the text.
|
|
22804
|
+
* - **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.
|
|
22805
|
+
* @property {object|function} [polar.label.image] Set image to be displayed next to the label text.<br><br>
|
|
22389
22806
|
* 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>
|
|
22390
22807
|
* The arguments are:<br>
|
|
22391
22808
|
* - `v` is the value of the data point where the label is shown.
|
|
@@ -22400,13 +22817,14 @@ ${percentValue}%`;
|
|
|
22400
22817
|
* @property {number} [polar.level.depth=3] Set the level depth.
|
|
22401
22818
|
* @property {boolean} [polar.level.show=true] Show or hide level.
|
|
22402
22819
|
* @property {string} [polar.level.text.backgroundColor="#fff"] Set label text's background color.
|
|
22403
|
-
* @property {
|
|
22820
|
+
* @property {function} [polar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
|
|
22404
22821
|
* @property {boolean} [polar.level.text.show=true] Show or hide level text.
|
|
22405
22822
|
* @property {number} [polar.padAngle=0] Set padding between data.
|
|
22406
22823
|
* @property {number} [polar.padding=0] Sets the gap between pie arcs.
|
|
22407
22824
|
* @property {number} [polar.startingAngle=0] Set starting angle where data draws.
|
|
22408
22825
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.PolarChart)
|
|
22409
22826
|
* @see [Demo: label image](https://naver.github.io/billboard.js/demo/#PolarChartOptions.LabelImage)
|
|
22827
|
+
* @see [Demo: label line](https://naver.github.io/billboard.js/demo/#PolarChartOptions.LabelLine)
|
|
22410
22828
|
* @example
|
|
22411
22829
|
* polar: {
|
|
22412
22830
|
* label: {
|
|
@@ -22430,6 +22848,20 @@ ${percentValue}%`;
|
|
|
22430
22848
|
* // or set ratio number
|
|
22431
22849
|
* ratio: 0.5,
|
|
22432
22850
|
*
|
|
22851
|
+
* // Enable label with lines (displayed outside with connector lines)
|
|
22852
|
+
* line: false, // default - labels inside
|
|
22853
|
+
* line: true, // enable label with lines with default settings
|
|
22854
|
+
* line: { // enable label with lines with custom settings
|
|
22855
|
+
* show: true,
|
|
22856
|
+
* distance: 20, // horizontal line distance in pixels
|
|
22857
|
+
*
|
|
22858
|
+
* // show text at the end of connector line (outside the shape)
|
|
22859
|
+
* text: true, // use default formatter
|
|
22860
|
+
* text: function(value, ratio, id) { // custom formatter
|
|
22861
|
+
* return d3.format(".1%")(ratio);
|
|
22862
|
+
* }
|
|
22863
|
+
* },
|
|
22864
|
+
*
|
|
22433
22865
|
* // set image to be displayed next to the label text
|
|
22434
22866
|
* image: {
|
|
22435
22867
|
* url: "./sample.svg",
|
|
@@ -22494,6 +22926,7 @@ ${percentValue}%`;
|
|
|
22494
22926
|
polar_label_show: true,
|
|
22495
22927
|
polar_label_format: void 0,
|
|
22496
22928
|
polar_label_threshold: 0.05,
|
|
22929
|
+
polar_label_line: false,
|
|
22497
22930
|
polar_label_image: void 0,
|
|
22498
22931
|
polar_label_ratio: void 0,
|
|
22499
22932
|
polar_level_depth: 3,
|
|
@@ -22525,7 +22958,7 @@ ${percentValue}%`;
|
|
|
22525
22958
|
* @property {boolean} [radar.direction.clockwise=false] Set the direction to be drawn.
|
|
22526
22959
|
* @property {number} [radar.level.depth=3] Set the level depth.
|
|
22527
22960
|
* @property {boolean} [radar.level.show=true] Show or hide level.
|
|
22528
|
-
* @property {
|
|
22961
|
+
* @property {function} [radar.level.text.format] Set format function for the level value.<br>- Default value: `(x) => x % 1 === 0 ? x : x.toFixed(2)`
|
|
22529
22962
|
* @property {boolean} [radar.level.text.show=true] Show or hide level text.
|
|
22530
22963
|
* @property {number} [radar.size.ratio=0.87] Set size ratio.
|
|
22531
22964
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.RadarChart)
|
|
@@ -22593,7 +23026,12 @@ ${percentValue}%`;
|
|
|
22593
23026
|
* - sliceDice ([d3.treemapSliceDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSliceDice))
|
|
22594
23027
|
* - squrify ([d3.treemapSquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSquarify))
|
|
22595
23028
|
* - resquarify ([d3.treemapResquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapResquarify))
|
|
22596
|
-
* @property {
|
|
23029
|
+
* @property {function} [treemap.label.format] Set formatter for the label text.<br>
|
|
23030
|
+
* - **Arguments:**
|
|
23031
|
+
* - `value {number}`: Data value
|
|
23032
|
+
* - `ratio {number}`: The `ratio` of how much space this tile occupies relative to the total area (0~1)
|
|
23033
|
+
* - `id {string}`: Data id
|
|
23034
|
+
* - `size {object}`: Tile size `{width, height}` in pixels
|
|
22597
23035
|
* @property {number} [treemap.label.threshold=0.05] Set threshold ratio to show/hide labels text.
|
|
22598
23036
|
* @property {number} [treemap.label.show=true] Show or hide label text.
|
|
22599
23037
|
* @see [Demo: treemap](https://naver.github.io/billboard.js/demo/#Chart.TreemapChart)
|
|
@@ -22606,12 +23044,33 @@ ${percentValue}%`;
|
|
|
22606
23044
|
* // show or hide label text
|
|
22607
23045
|
* show: false,
|
|
22608
23046
|
*
|
|
22609
|
-
* //
|
|
22610
|
-
* format: function(value, ratio, id) {
|
|
23047
|
+
* // Example 1: Format with currency
|
|
23048
|
+
* format: function(value, ratio, id, size) {
|
|
23049
|
+
* // size: {width, height} - tile size in pixels
|
|
22611
23050
|
* return d3.format("$")(value);
|
|
23051
|
+
* },
|
|
22612
23052
|
*
|
|
22613
|
-
*
|
|
22614
|
-
*
|
|
23053
|
+
* // Example 2: Show different content based on tile size
|
|
23054
|
+
* format: function(value, ratio, id, size) {
|
|
23055
|
+
* if (size.width > 100 && size.height > 50) {
|
|
23056
|
+
* return `${id}\n${d3.format("$")(value)}\n(${(ratio * 100).toFixed(1)}%)`;
|
|
23057
|
+
* } else if (size.width > 50) {
|
|
23058
|
+
* return `${id}\n${d3.format("$")(value)}`;
|
|
23059
|
+
* } else {
|
|
23060
|
+
* return d3.format("$")(value);
|
|
23061
|
+
* }
|
|
23062
|
+
* },
|
|
23063
|
+
*
|
|
23064
|
+
* // Example 3: Include tile dimensions in label
|
|
23065
|
+
* format: function(value, ratio, id, size) {
|
|
23066
|
+
* return `${id}\n${value}\n${size.width.toFixed(0)}x${size.height.toFixed(0)}px`;
|
|
23067
|
+
* },
|
|
23068
|
+
*
|
|
23069
|
+
* // Example 4: Conditional formatting based on ratio
|
|
23070
|
+
* format: function(value, ratio, id, size) {
|
|
23071
|
+
* return ratio > 0.1 ?
|
|
23072
|
+
* `${id}\n${value} (${(ratio * 100).toFixed(1)}%)` :
|
|
23073
|
+
* value;
|
|
22615
23074
|
* },
|
|
22616
23075
|
*
|
|
22617
23076
|
* // set ratio number
|
|
@@ -22720,10 +23179,10 @@ const bb = {
|
|
|
22720
23179
|
* bb.version; // "1.0.0"
|
|
22721
23180
|
* @memberof bb
|
|
22722
23181
|
*/
|
|
22723
|
-
version: "3.
|
|
23182
|
+
version: "3.18.0-next.1",
|
|
22724
23183
|
/**
|
|
22725
23184
|
* Generate chart
|
|
22726
|
-
* - **NOTE:** Bear in mind for the
|
|
23185
|
+
* - **NOTE:** Bear in mind for the possibility of ***throwing an error***, during the generation when:
|
|
22727
23186
|
* - Unused option value is given.
|
|
22728
23187
|
* - ex) For `data.type="pie"` option, setting 'axis' option can cause unexpected generation error.
|
|
22729
23188
|
* - Insufficient value is given for certain option used.
|