billboard.js 3.17.4 → 3.18.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +12 -12
- package/README.md +12 -12
- package/dist/billboard.css +15 -1
- package/dist/billboard.js +756 -305
- package/dist/billboard.min.css +2 -2
- package/dist/billboard.min.js +10 -10
- package/dist/billboard.pkgd.js +757 -306
- package/dist/billboard.pkgd.min.js +22 -22
- 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 +3 -2
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-stanford.js +5 -4
- package/dist/plugin/billboardjs-plugin-stanford.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-tableview.js +3 -3
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- 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 +3 -2
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +10 -10
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +6 -5
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +3 -3
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
- 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 +938 -348
- 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 +3 -3
- 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 +9 -9
- 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)
|
|
@@ -3229,9 +3231,9 @@ class Cache {
|
|
|
3229
3231
|
/**
|
|
3230
3232
|
* Add cache
|
|
3231
3233
|
* @param {string} key Cache key
|
|
3232
|
-
* @param {
|
|
3234
|
+
* @param {string|number|boolean|object|Array|function|null|undefined} value Value to be stored
|
|
3233
3235
|
* @param {boolean} isDataType Weather the cache is data typed '{id:'data', id_org: 'data', values: [{x:0, index:0,...}, ...]}'
|
|
3234
|
-
* @returns {
|
|
3236
|
+
* @returns {string|number|boolean|object|Array|function|null|undefined} Added data value
|
|
3235
3237
|
* @private
|
|
3236
3238
|
*/
|
|
3237
3239
|
add(key, value, isDataType = false) {
|
|
@@ -3250,7 +3252,7 @@ class Cache {
|
|
|
3250
3252
|
* Get cahce
|
|
3251
3253
|
* @param {string|Array} key Cache key
|
|
3252
3254
|
* @param {boolean} isDataType Weather the cache is data typed '{id:'data', id_org: 'data', values: [{x:0, index:0,...}, ...]}'
|
|
3253
|
-
* @returns {
|
|
3255
|
+
* @returns {string|number|boolean|object|Array|function|null} Cached value
|
|
3254
3256
|
* @private
|
|
3255
3257
|
*/
|
|
3256
3258
|
get(key, isDataType = false) {
|
|
@@ -3714,7 +3716,7 @@ function setXS(ids, data, params) {
|
|
|
3714
3716
|
/**
|
|
3715
3717
|
* Convert data according its type
|
|
3716
3718
|
* @param {object} args data object
|
|
3717
|
-
* @param {
|
|
3719
|
+
* @param {function} [callback] callback for url(XHR) type loading
|
|
3718
3720
|
* @private
|
|
3719
3721
|
*/
|
|
3720
3722
|
convertData(args, callback) {
|
|
@@ -3865,7 +3867,17 @@ function setXS(ids, data, params) {
|
|
|
3865
3867
|
},
|
|
3866
3868
|
isStackNormalized() {
|
|
3867
3869
|
const { config } = this;
|
|
3868
|
-
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);
|
|
3869
3881
|
},
|
|
3870
3882
|
/**
|
|
3871
3883
|
* Check if given id is grouped data or has grouped data
|
|
@@ -3877,6 +3889,19 @@ function setXS(ids, data, params) {
|
|
|
3877
3889
|
const groups = this.config.data_groups;
|
|
3878
3890
|
return id ? groups.some((v) => v.indexOf(id) >= 0 && v.length > 1) : groups.length > 0;
|
|
3879
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
|
+
},
|
|
3880
3905
|
getXKey(id) {
|
|
3881
3906
|
const $$ = this;
|
|
3882
3907
|
const { config } = $$;
|
|
@@ -4068,16 +4093,27 @@ function setXS(ids, data, params) {
|
|
|
4068
4093
|
},
|
|
4069
4094
|
/**
|
|
4070
4095
|
* Get sum of data per index
|
|
4096
|
+
* @param {string} targetId Target ID to get total for (only for normalized stack per group)
|
|
4071
4097
|
* @private
|
|
4072
4098
|
* @returns {Array}
|
|
4073
4099
|
*/
|
|
4074
|
-
getTotalPerIndex() {
|
|
4100
|
+
getTotalPerIndex(targetId) {
|
|
4075
4101
|
const $$ = this;
|
|
4076
|
-
const
|
|
4102
|
+
const { config } = $$;
|
|
4103
|
+
const cacheKey = targetId ? `${KEY.dataTotalPerIndex}-${targetId}` : KEY.dataTotalPerIndex;
|
|
4077
4104
|
let sum = $$.cache.get(cacheKey);
|
|
4078
4105
|
if (($$.config.data_groups.length || $$.isStackNormalized()) && !sum) {
|
|
4079
4106
|
sum = [];
|
|
4080
|
-
|
|
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) => {
|
|
4081
4117
|
row.values.forEach((v, i) => {
|
|
4082
4118
|
if (!sum[i]) {
|
|
4083
4119
|
sum[i] = 0;
|
|
@@ -4085,6 +4121,7 @@ function setXS(ids, data, params) {
|
|
|
4085
4121
|
sum[i] += ~~v.value;
|
|
4086
4122
|
});
|
|
4087
4123
|
});
|
|
4124
|
+
$$.cache.add(cacheKey, sum);
|
|
4088
4125
|
}
|
|
4089
4126
|
return sum;
|
|
4090
4127
|
},
|
|
@@ -4100,7 +4137,10 @@ function setXS(ids, data, params) {
|
|
|
4100
4137
|
let total = $$.cache.get(cacheKey);
|
|
4101
4138
|
if (!isNumber(total)) {
|
|
4102
4139
|
total = $$.data.targets.reduce((acc, t) => {
|
|
4103
|
-
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);
|
|
4104
4144
|
}, 0);
|
|
4105
4145
|
$$.cache.add(cacheKey, total);
|
|
4106
4146
|
}
|
|
@@ -4195,7 +4235,7 @@ function setXS(ids, data, params) {
|
|
|
4195
4235
|
return sortValue(xs);
|
|
4196
4236
|
},
|
|
4197
4237
|
/**
|
|
4198
|
-
* Add to
|
|
4238
|
+
* Add to thetarget Ids
|
|
4199
4239
|
* @param {string} type State's prop name
|
|
4200
4240
|
* @param {Array|string} targetIds Target ids array
|
|
4201
4241
|
* @private
|
|
@@ -4293,7 +4333,7 @@ function setXS(ids, data, params) {
|
|
|
4293
4333
|
/**
|
|
4294
4334
|
* Get data.order compare function
|
|
4295
4335
|
* @param {boolean} isReversed for Arc & Treemap type sort order needs to be reversed
|
|
4296
|
-
* @returns {
|
|
4336
|
+
* @returns {function} compare function
|
|
4297
4337
|
* @private
|
|
4298
4338
|
*/
|
|
4299
4339
|
getSortCompareFn(isReversed = false) {
|
|
@@ -4575,12 +4615,27 @@ function setXS(ids, data, params) {
|
|
|
4575
4615
|
}
|
|
4576
4616
|
} else if (type === "index") {
|
|
4577
4617
|
const dataValues = api.data.values.bind(api);
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
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
|
+
}
|
|
4584
4639
|
}
|
|
4585
4640
|
}
|
|
4586
4641
|
const divisor = total[d.index];
|
|
@@ -4758,8 +4813,6 @@ function callDone(fn, resizeAfter = false) {
|
|
|
4758
4813
|
done();
|
|
4759
4814
|
return;
|
|
4760
4815
|
}
|
|
4761
|
-
const targets = $el.svg.selectAll(targetIds.map((id) => $$.selectorTarget(id)));
|
|
4762
|
-
$T(targets).style("opacity", "0").remove().call(endall, done);
|
|
4763
4816
|
targetIds.forEach((id) => {
|
|
4764
4817
|
var _a2;
|
|
4765
4818
|
const suffixId = $$.getTargetSelectorSuffix(id);
|
|
@@ -4773,6 +4826,8 @@ function callDone(fn, resizeAfter = false) {
|
|
|
4773
4826
|
state.hasFunnel && $$.updateFunnel($$.data.targets);
|
|
4774
4827
|
state.hasTreemap && $$.updateTargetsForTreemap($$.data.targets);
|
|
4775
4828
|
$$.updateTypesElements();
|
|
4829
|
+
const targets = $el.svg.selectAll(targetIds.map((id) => $$.selectorTarget(id)));
|
|
4830
|
+
$T(targets).style("opacity", "0").remove().call(endall, done);
|
|
4776
4831
|
}
|
|
4777
4832
|
});
|
|
4778
4833
|
|
|
@@ -4877,7 +4932,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
|
|
|
4877
4932
|
},
|
|
4878
4933
|
/**
|
|
4879
4934
|
* Return draggable selection function
|
|
4880
|
-
* @returns {
|
|
4935
|
+
* @returns {function}
|
|
4881
4936
|
* @private
|
|
4882
4937
|
*/
|
|
4883
4938
|
getDraggableSelection() {
|
|
@@ -5159,6 +5214,7 @@ const schemeCategory10 = [
|
|
|
5159
5214
|
const $$ = this;
|
|
5160
5215
|
const { $el, config } = $$;
|
|
5161
5216
|
const ids = [];
|
|
5217
|
+
const hasGradient = config.area_linearGradient || config.bar_linearGradient || config.point_radialGradient;
|
|
5162
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();
|
|
5163
5219
|
const originalColorPattern = pattern;
|
|
5164
5220
|
if (isFunction(config.color_tiles)) {
|
|
@@ -5189,7 +5245,18 @@ const schemeCategory10 = [
|
|
|
5189
5245
|
color = isLine ? originalColorPattern[ids.indexOf(id) % originalColorPattern.length] : pattern[ids.indexOf(id) % pattern.length];
|
|
5190
5246
|
colors[id] = color;
|
|
5191
5247
|
}
|
|
5192
|
-
|
|
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;
|
|
5193
5260
|
};
|
|
5194
5261
|
},
|
|
5195
5262
|
generateLevelColor() {
|
|
@@ -5214,7 +5281,7 @@ const schemeCategory10 = [
|
|
|
5214
5281
|
},
|
|
5215
5282
|
/**
|
|
5216
5283
|
* Append data backgound color filter definition
|
|
5217
|
-
* @param {string|object|
|
|
5284
|
+
* @param {string|object|function} color Color string, object, or function
|
|
5218
5285
|
* @param {object} attr filter attribute
|
|
5219
5286
|
* @private
|
|
5220
5287
|
*/
|
|
@@ -5381,7 +5448,11 @@ const schemeCategory10 = [
|
|
|
5381
5448
|
const { axis, config, scale } = $$;
|
|
5382
5449
|
const pfx = `axis_${axisId}`;
|
|
5383
5450
|
if ($$.isStackNormalized()) {
|
|
5384
|
-
|
|
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
|
+
}
|
|
5385
5456
|
}
|
|
5386
5457
|
const isLog = (scale == null ? void 0 : scale[axisId]) && scale[axisId].type === "log";
|
|
5387
5458
|
const targetsByAxisId = targets.filter((t) => axis.getId(t.id) === axisId);
|
|
@@ -5699,7 +5770,7 @@ function getFormat($$, typeValue, v) {
|
|
|
5699
5770
|
},
|
|
5700
5771
|
/**
|
|
5701
5772
|
* Get default value format function
|
|
5702
|
-
* @returns {
|
|
5773
|
+
* @returns {function} formatter function
|
|
5703
5774
|
* @private
|
|
5704
5775
|
*/
|
|
5705
5776
|
getDefaultValueFormat() {
|
|
@@ -6223,7 +6294,7 @@ function getFormattedText(id, formatted = true) {
|
|
|
6223
6294
|
* @param {Array} targetIdz Data ids
|
|
6224
6295
|
* @param {object} dimension Dimension object
|
|
6225
6296
|
* @param {object} sizes Size object
|
|
6226
|
-
* @returns {
|
|
6297
|
+
* @returns {function} Update position function
|
|
6227
6298
|
* @private
|
|
6228
6299
|
*/
|
|
6229
6300
|
getUpdateLegendPositions(targetIdz, dimension, sizes) {
|
|
@@ -6297,7 +6368,7 @@ function getFormattedText(id, formatted = true) {
|
|
|
6297
6368
|
* Generate legend item elements
|
|
6298
6369
|
* @param {Array} targetIdz Data ids
|
|
6299
6370
|
* @param {object} itemTileSize Item tile size {width, height}
|
|
6300
|
-
* @param {
|
|
6371
|
+
* @param {function} updatePositions Update position function
|
|
6301
6372
|
* @param {object} posFn Position functions
|
|
6302
6373
|
* @private
|
|
6303
6374
|
*/
|
|
@@ -6592,8 +6663,8 @@ function getScale(type = "linear", min, max) {
|
|
|
6592
6663
|
* @param {number} min Min range value
|
|
6593
6664
|
* @param {number} max Max range value
|
|
6594
6665
|
* @param {Array} domain Domain value
|
|
6595
|
-
* @param {
|
|
6596
|
-
* @returns {
|
|
6666
|
+
* @param {function} offset The offset getter to be sum
|
|
6667
|
+
* @returns {function} scale
|
|
6597
6668
|
* @private
|
|
6598
6669
|
*/
|
|
6599
6670
|
getXScale(min, max, domain, offset) {
|
|
@@ -6610,7 +6681,7 @@ function getScale(type = "linear", min, max) {
|
|
|
6610
6681
|
* @param {number} min Min value
|
|
6611
6682
|
* @param {number} max Max value
|
|
6612
6683
|
* @param {Array} domain Domain value
|
|
6613
|
-
* @returns {
|
|
6684
|
+
* @returns {function} Scale function
|
|
6614
6685
|
* @private
|
|
6615
6686
|
*/
|
|
6616
6687
|
getYScale(id, min, max, domain) {
|
|
@@ -6623,7 +6694,7 @@ function getScale(type = "linear", min, max) {
|
|
|
6623
6694
|
* Get y Axis scale
|
|
6624
6695
|
* @param {string} id Axis id
|
|
6625
6696
|
* @param {boolean} isSub Weather is sub Axis
|
|
6626
|
-
* @returns {
|
|
6697
|
+
* @returns {function} Scale function
|
|
6627
6698
|
* @private
|
|
6628
6699
|
*/
|
|
6629
6700
|
getYScaleById(id, isSub = false) {
|
|
@@ -6635,8 +6706,8 @@ function getScale(type = "linear", min, max) {
|
|
|
6635
6706
|
/**
|
|
6636
6707
|
* Get customized x axis scale
|
|
6637
6708
|
* @param {d3.scaleLinear|d3.scaleTime} scaleValue Scale function
|
|
6638
|
-
* @param {
|
|
6639
|
-
* @returns {
|
|
6709
|
+
* @param {function} offsetValue Offset getter to be sum
|
|
6710
|
+
* @returns {function} Scale function
|
|
6640
6711
|
* @private
|
|
6641
6712
|
*/
|
|
6642
6713
|
getCustomizedXScale(scaleValue, offsetValue) {
|
|
@@ -7086,8 +7157,8 @@ function getScale(type = "linear", min, max) {
|
|
|
7086
7157
|
* @param {boolean} withShape Set shpes' prefix class
|
|
7087
7158
|
* @param {string} selector CSS selector
|
|
7088
7159
|
* @param {Array} props CSS props list
|
|
7089
|
-
* @param {
|
|
7090
|
-
* @returns {
|
|
7160
|
+
* @param {function} propsFn Function to retrieve value or determine for props
|
|
7161
|
+
* @returns {function}
|
|
7091
7162
|
* @private
|
|
7092
7163
|
*/
|
|
7093
7164
|
setCssRule(withShape, selector, props, propsFn) {
|
|
@@ -7109,7 +7180,7 @@ function getScale(type = "linear", min, max) {
|
|
|
7109
7180
|
},
|
|
7110
7181
|
/**
|
|
7111
7182
|
* Get style prop value
|
|
7112
|
-
* @param {
|
|
7183
|
+
* @param {function|string} v Value
|
|
7113
7184
|
* @returns {string|null}
|
|
7114
7185
|
* @private
|
|
7115
7186
|
*/
|
|
@@ -7373,7 +7444,7 @@ function updateTextImagePos(textNode, pos) {
|
|
|
7373
7444
|
if (isNumber(value)) {
|
|
7374
7445
|
this.textContent = value;
|
|
7375
7446
|
} else {
|
|
7376
|
-
setTextValue(node, value);
|
|
7447
|
+
setTextValue(node, value, void 0, true);
|
|
7377
7448
|
}
|
|
7378
7449
|
});
|
|
7379
7450
|
updateTextImage.call($$);
|
|
@@ -7404,7 +7475,7 @@ function updateTextImagePos(textNode, pos) {
|
|
|
7404
7475
|
/**
|
|
7405
7476
|
* Update data label text background color
|
|
7406
7477
|
* @param {object} d Data object
|
|
7407
|
-
* @param {object|string|
|
|
7478
|
+
* @param {object|string|function} option option object
|
|
7408
7479
|
* @returns {string|null}
|
|
7409
7480
|
* @private
|
|
7410
7481
|
*/
|
|
@@ -7433,8 +7504,8 @@ function updateTextImagePos(textNode, pos) {
|
|
|
7433
7504
|
},
|
|
7434
7505
|
/**
|
|
7435
7506
|
* Redraw chartText
|
|
7436
|
-
* @param {
|
|
7437
|
-
* @param {
|
|
7507
|
+
* @param {function} getX Positioning function for x
|
|
7508
|
+
* @param {function} getY Positioning function for y
|
|
7438
7509
|
* @param {boolean} forFlow Weather is flow
|
|
7439
7510
|
* @param {boolean} withTransition transition is enabled
|
|
7440
7511
|
* @returns {Array}
|
|
@@ -7548,7 +7619,7 @@ function updateTextImagePos(textNode, pos) {
|
|
|
7548
7619
|
const isBarType = $$.isBarType(d);
|
|
7549
7620
|
const isTreemapType = $$.isTreemapType(d);
|
|
7550
7621
|
if (config.data_labels.centered && (isBarType || isTreemapType)) {
|
|
7551
|
-
const rect =
|
|
7622
|
+
const rect = getBBox(textElement);
|
|
7552
7623
|
if (isBarType) {
|
|
7553
7624
|
const isPositive = $$.getRangedData(d, null, "bar") >= 0;
|
|
7554
7625
|
if (isRotated) {
|
|
@@ -7559,7 +7630,10 @@ function updateTextImagePos(textNode, pos) {
|
|
|
7559
7630
|
return isPositive ? h : -h - 2;
|
|
7560
7631
|
}
|
|
7561
7632
|
} else if (isTreemapType) {
|
|
7562
|
-
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
|
+
);
|
|
7563
7637
|
}
|
|
7564
7638
|
}
|
|
7565
7639
|
return 0;
|
|
@@ -7825,9 +7899,9 @@ function getTextXPos(pos = "left", width) {
|
|
|
7825
7899
|
/**
|
|
7826
7900
|
* Returns the tooltip content(HTML string)
|
|
7827
7901
|
* @param {object} d data
|
|
7828
|
-
* @param {
|
|
7829
|
-
* @param {
|
|
7830
|
-
* @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
|
|
7831
7905
|
* @returns {string} html
|
|
7832
7906
|
* @private
|
|
7833
7907
|
*/
|
|
@@ -7841,9 +7915,16 @@ function getTextXPos(pos = "left", width) {
|
|
|
7841
7915
|
});
|
|
7842
7916
|
const titleFormat = (...arg) => sanitize((titleFn || defaultTitleFormat)(...arg));
|
|
7843
7917
|
const nameFormat = (...arg) => sanitize((nameFn || ((name) => name))(...arg));
|
|
7844
|
-
const valueFormat = (
|
|
7845
|
-
|
|
7846
|
-
|
|
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));
|
|
7847
7928
|
};
|
|
7848
7929
|
const order = config.tooltip_order;
|
|
7849
7930
|
const getRowValue = (row2) => $$.axis && $$.isBubbleZType(row2) ? $$.getBubbleZData(row2.value, "z") : $$.getBaseValue(row2);
|
|
@@ -8182,7 +8263,7 @@ function getTextXPos(pos = "left", width) {
|
|
|
8182
8263
|
if (tooltip && tooltip.style("display") !== "none" && (!config.tooltip_doNotHide || force)) {
|
|
8183
8264
|
const selectedData = JSON.parse((_a = tooltip.datum().current) != null ? _a : {});
|
|
8184
8265
|
callFn(config.tooltip_onhide, api, selectedData);
|
|
8185
|
-
tooltip.style("display", "none").
|
|
8266
|
+
tooltip.style("display", "none").datum(null);
|
|
8186
8267
|
callFn(config.tooltip_onhidden, api, selectedData);
|
|
8187
8268
|
}
|
|
8188
8269
|
},
|
|
@@ -8624,7 +8705,7 @@ function getGroupedDataPointsFn(d) {
|
|
|
8624
8705
|
* data2 data4 data2 data4
|
|
8625
8706
|
* -------------------------
|
|
8626
8707
|
* 0 1
|
|
8627
|
-
* @param {
|
|
8708
|
+
* @param {function} typeFilter Chart type filter function
|
|
8628
8709
|
* @returns {object} Indices object with its position
|
|
8629
8710
|
*/
|
|
8630
8711
|
getShapeIndices(typeFilter) {
|
|
@@ -8769,7 +8850,7 @@ function getGroupedDataPointsFn(d) {
|
|
|
8769
8850
|
},
|
|
8770
8851
|
/**
|
|
8771
8852
|
* Get Shape's offset data
|
|
8772
|
-
* @param {
|
|
8853
|
+
* @param {function} typeFilter Type filter function
|
|
8773
8854
|
* @returns {object}
|
|
8774
8855
|
* @private
|
|
8775
8856
|
*/
|
|
@@ -9270,14 +9351,18 @@ class ChartInternal {
|
|
|
9270
9351
|
if (hasInteraction && state.inputType) {
|
|
9271
9352
|
const isTouch = state.inputType === "touch";
|
|
9272
9353
|
const { onclick, onover, onout } = config;
|
|
9273
|
-
$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);
|
|
9274
9359
|
}
|
|
9275
9360
|
config.svg_classname && $el.svg.attr("class", config.svg_classname);
|
|
9276
9361
|
const hasColorPatterns = isFunction(config.color_tiles) && $$.patterns;
|
|
9277
9362
|
if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_a = $$.hasLegendDefsPoint) == null ? void 0 : _a.call($$))) {
|
|
9278
9363
|
$el.defs = $el.svg.append("defs");
|
|
9279
9364
|
if (hasAxis) {
|
|
9280
|
-
["id", "idXAxis", "idYAxis", "idGrid"].forEach((v) => {
|
|
9365
|
+
["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach((v) => {
|
|
9281
9366
|
$$.appendClip($el.defs, state.clip[v]);
|
|
9282
9367
|
});
|
|
9283
9368
|
}
|
|
@@ -9647,7 +9732,7 @@ function loadConfig(config) {
|
|
|
9647
9732
|
},
|
|
9648
9733
|
/**
|
|
9649
9734
|
* Force to redraw.
|
|
9650
|
-
* - **NOTE:** When zoom/subchart is used, the zoomed state will be
|
|
9735
|
+
* - **NOTE:** When zoom/subchart is used, the zoomed state will be reset.
|
|
9651
9736
|
* @function flush
|
|
9652
9737
|
* @instance
|
|
9653
9738
|
* @memberof Chart
|
|
@@ -9736,15 +9821,15 @@ function loadConfig(config) {
|
|
|
9736
9821
|
* Get or set config option value.
|
|
9737
9822
|
* - **NOTE**
|
|
9738
9823
|
* - The option key name must be specified as the last level.
|
|
9739
|
-
* -
|
|
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)
|
|
9740
9825
|
* @function config
|
|
9741
9826
|
* @instance
|
|
9742
9827
|
* @memberof Chart
|
|
9743
9828
|
* @param {string} name The option key name.
|
|
9744
|
-
* @param {
|
|
9829
|
+
* @param {string|number|boolean|object|Array} [value] The value accepted for indicated option.
|
|
9745
9830
|
* @param {boolean} [redraw] Set to redraw with the new option changes.
|
|
9746
|
-
* - **NOTE:** Doesn't guarantee work in all circumstances. It can be applied for limited options only.
|
|
9747
|
-
* @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
|
|
9748
9833
|
* @example
|
|
9749
9834
|
*
|
|
9750
9835
|
* // Getter
|
|
@@ -9841,7 +9926,7 @@ extend(api_data_data, {
|
|
|
9841
9926
|
* @function data․values
|
|
9842
9927
|
* @instance
|
|
9843
9928
|
* @memberof Chart
|
|
9844
|
-
* @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
|
|
9845
9930
|
* @param {boolean} [flat=true] Get flatten values
|
|
9846
9931
|
* @returns {Array} Data values
|
|
9847
9932
|
* @example
|
|
@@ -9887,6 +9972,7 @@ extend(api_data_data, {
|
|
|
9887
9972
|
},
|
|
9888
9973
|
/**
|
|
9889
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.
|
|
9890
9976
|
* @function data․colors
|
|
9891
9977
|
* @instance
|
|
9892
9978
|
* @memberof Chart
|
|
@@ -10092,7 +10178,7 @@ function renderText(ctx, glyph) {
|
|
|
10092
10178
|
* - Text element's position(especially "transformed") can't be preserved correctly according the page's layout condition.
|
|
10093
10179
|
* - If need to preserve accurate text position, embed the web font data within to the page and set `preserveFontStyle=false`.
|
|
10094
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>
|
|
10095
|
-
* @param {
|
|
10181
|
+
* @param {function(string): void} [callback] The callback to be invoked when export is ready.
|
|
10096
10182
|
* @returns {string} dataURI
|
|
10097
10183
|
* @example
|
|
10098
10184
|
* chart.export();
|
|
@@ -10346,7 +10432,7 @@ const legend_legend = {
|
|
|
10346
10432
|
* | categories | Array | The categories specified by axis.x.categories or data.x will be updated. categories must be Array. |
|
|
10347
10433
|
* | classes | Object | The classes specified by data.classes will be updated. classes must be Object that has target id as keys. |
|
|
10348
10434
|
* | colors | Object | The colors specified by data.colors will be updated. colors must be Object that has target id as keys. |
|
|
10349
|
-
* | data |
|
|
10435
|
+
* | data | Object | Data objects to be loaded. Checkout the example. |
|
|
10350
10436
|
* | done | Function | The specified function will be called after data loaded.|
|
|
10351
10437
|
* | headers | string | Set request header if loading via `data.url`.<br>@see [data․headers](Options.html#.data%25E2%2580%25A4headers) |
|
|
10352
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) |
|
|
@@ -10405,7 +10491,7 @@ const legend_legend = {
|
|
|
10405
10491
|
*
|
|
10406
10492
|
* chart.load({
|
|
10407
10493
|
* columns: [
|
|
10408
|
-
* // when existing chart has `x` value, should provide
|
|
10494
|
+
* // when existing chart has `x` value, should provide corresponding 'x' value.
|
|
10409
10495
|
* // with 'append' option, the 'data1' will have `[36,30,24,37]`.
|
|
10410
10496
|
* ["x", "2021-02-01T08:00:00"],
|
|
10411
10497
|
* ["data1", 37]
|
|
@@ -10495,7 +10581,7 @@ const legend_legend = {
|
|
|
10495
10581
|
* | key | Type | Description |
|
|
10496
10582
|
* | --- | --- | --- |
|
|
10497
10583
|
* | ids | String | Array | Target id data to be unloaded. If not given, all data will be unloaded. |
|
|
10498
|
-
* | done |
|
|
10584
|
+
* | done | Function | Callback after data is unloaded. |
|
|
10499
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. |
|
|
10500
10586
|
* @example
|
|
10501
10587
|
* // Unload data2 and data3
|
|
@@ -10652,7 +10738,7 @@ const tooltip_tooltip = {
|
|
|
10652
10738
|
*
|
|
10653
10739
|
* @example
|
|
10654
10740
|
* // show the 2nd x Axis coordinate tooltip
|
|
10655
|
-
* // for Arc(gauge, donut & pie) and radar type,
|
|
10741
|
+
* // for Arc(gauge, donut & pie) and radar type, approach showing tooltip by using "index" number.
|
|
10656
10742
|
* chart.tooltip.show({
|
|
10657
10743
|
* index: 1
|
|
10658
10744
|
* });
|
|
@@ -11016,7 +11102,7 @@ extend(subchart, {
|
|
|
11016
11102
|
}
|
|
11017
11103
|
},
|
|
11018
11104
|
/**
|
|
11019
|
-
* Toggle the
|
|
11105
|
+
* Toggle the visibility of subchart
|
|
11020
11106
|
* - **NOTE:** for ESM imports, needs to import 'subchart' exports and instantiate it by calling `subchart()`.
|
|
11021
11107
|
* @function subchart․toggle
|
|
11022
11108
|
* @instance
|
|
@@ -11665,7 +11751,7 @@ extend(zoom, {
|
|
|
11665
11751
|
},
|
|
11666
11752
|
/**
|
|
11667
11753
|
* Set zoom transform to event rect
|
|
11668
|
-
* @param {
|
|
11754
|
+
* @param {function} x x Axis scale function
|
|
11669
11755
|
* @param {Array} domain Domain value to be set
|
|
11670
11756
|
* @private
|
|
11671
11757
|
*/
|
|
@@ -11975,7 +12061,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
11975
12061
|
* Returns the toggle method of the target
|
|
11976
12062
|
* @param {object} that shape
|
|
11977
12063
|
* @param {object} d Data object
|
|
11978
|
-
* @returns {
|
|
12064
|
+
* @returns {function} toggle method
|
|
11979
12065
|
* @private
|
|
11980
12066
|
*/
|
|
11981
12067
|
getToggle(that, d) {
|
|
@@ -12074,7 +12160,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12074
12160
|
* The callback will receive d as an argument and it has some parameters like id, value, index. This callback should return boolean.
|
|
12075
12161
|
* @name data․selection․isselectable
|
|
12076
12162
|
* @memberof Options
|
|
12077
|
-
* @type {
|
|
12163
|
+
* @type {function}
|
|
12078
12164
|
* @default function() { return true; }
|
|
12079
12165
|
* @example
|
|
12080
12166
|
* data: {
|
|
@@ -12086,7 +12172,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12086
12172
|
data_selection_isselectable: () => true,
|
|
12087
12173
|
/**
|
|
12088
12174
|
* Set multiple data points selection enabled.<br><br>
|
|
12089
|
-
* 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.
|
|
12090
12176
|
* @name data․selection․multiple
|
|
12091
12177
|
* @memberof Options
|
|
12092
12178
|
* @type {boolean}
|
|
@@ -12119,7 +12205,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12119
12205
|
* Set a callback for on data selection.
|
|
12120
12206
|
* @name data․onselected
|
|
12121
12207
|
* @memberof Options
|
|
12122
|
-
* @type {
|
|
12208
|
+
* @type {function}
|
|
12123
12209
|
* @default function() {}
|
|
12124
12210
|
* @example
|
|
12125
12211
|
* data: {
|
|
@@ -12136,7 +12222,7 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12136
12222
|
* Set a callback for on data un-selection.
|
|
12137
12223
|
* @name data․onunselected
|
|
12138
12224
|
* @memberof Options
|
|
12139
|
-
* @type {
|
|
12225
|
+
* @type {function}
|
|
12140
12226
|
* @default function() {}
|
|
12141
12227
|
* @example
|
|
12142
12228
|
* data: {
|
|
@@ -12166,11 +12252,11 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12166
12252
|
* @property {boolean} [subchart.showHandle=false] Show sub chart's handle.
|
|
12167
12253
|
* @property {boolean} [subchart.axis.x.show=true] Show or hide x axis.
|
|
12168
12254
|
* @property {boolean} [subchart.axis.x.tick.show=true] Show or hide x axis tick line.
|
|
12169
|
-
* @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.
|
|
12170
12256
|
* @property {boolean} [subchart.axis.x.tick.text.show=true] Show or hide x axis tick text.
|
|
12171
12257
|
* @property {Array} [subchart.init.range] Set initial selection domain range.
|
|
12172
12258
|
* @property {number} [subchart.size.height] Change the height of the subchart.
|
|
12173
|
-
* @property {
|
|
12259
|
+
* @property {function} [subchart.onbrush] Set callback for brush event.<br>
|
|
12174
12260
|
* Specified function receives the current zoomed x domain.
|
|
12175
12261
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Interaction.SubChart)
|
|
12176
12262
|
* @example
|
|
@@ -12239,14 +12325,14 @@ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
|
12239
12325
|
* @property {Array} [zoom.extent=[1, 10]] Change zoom extent.
|
|
12240
12326
|
* @property {number|Date} [zoom.x.min] Set x Axis minimum zoom range
|
|
12241
12327
|
* @property {number|Date} [zoom.x.max] Set x Axis maximum zoom range
|
|
12242
|
-
* @property {
|
|
12328
|
+
* @property {function} [zoom.onzoomstart=undefined] Set callback that is called when zooming starts.<br>
|
|
12243
12329
|
* Specified function receives the zoom event.
|
|
12244
|
-
* @property {
|
|
12330
|
+
* @property {function} [zoom.onzoom=undefined] Set callback that is called when the chart is zooming.<br>
|
|
12245
12331
|
* Specified function receives the zoomed domain.
|
|
12246
|
-
* @property {
|
|
12332
|
+
* @property {function} [zoom.onzoomend=undefined] Set callback that is called when zooming ends.<br>
|
|
12247
12333
|
* Specified function receives the zoomed domain.
|
|
12248
12334
|
* @property {boolean|object} [zoom.resetButton=true] Set to display zoom reset button for 'drag' type zoom
|
|
12249
|
-
* @property {
|
|
12335
|
+
* @property {function} [zoom.resetButton.onclick] Set callback when clicks the reset button. The callback will receive reset button element reference as argument.
|
|
12250
12336
|
* @property {string} [zoom.resetButton.text='Reset Zoom'] Text value for zoom reset button.
|
|
12251
12337
|
* @see [Demo:zoom](https://naver.github.io/billboard.js/demo/#Interaction.Zoom)
|
|
12252
12338
|
* @see [Demo:drag zoom](https://naver.github.io/billboard.js/demo/#Interaction.DragZoom)
|
|
@@ -12617,7 +12703,7 @@ const axis = {
|
|
|
12617
12703
|
* - If json specified, keys is required as well as data.json.
|
|
12618
12704
|
* - If tab isn't visible(by evaluating `document.hidden`), will not be executed to prevent unnecessary work.
|
|
12619
12705
|
* @example
|
|
12620
|
-
* // 2 data points will be
|
|
12706
|
+
* // 2 data points will be appended to the tail and popped from the head.
|
|
12621
12707
|
* // After that, 4 data points will be appended and no data points will be poppoed.
|
|
12622
12708
|
* chart.flow({
|
|
12623
12709
|
* columns: [
|
|
@@ -13150,7 +13236,7 @@ class AxisRendererHelper {
|
|
|
13150
13236
|
/**
|
|
13151
13237
|
* Get tick transform setter function
|
|
13152
13238
|
* @param {string} id Axis id
|
|
13153
|
-
* @returns {
|
|
13239
|
+
* @returns {(selection: d3Selection, scale) => void} transfrom setter function
|
|
13154
13240
|
* @private
|
|
13155
13241
|
*/
|
|
13156
13242
|
getTickTransformSetter(id) {
|
|
@@ -13871,7 +13957,7 @@ class Axis_Axis {
|
|
|
13871
13957
|
}
|
|
13872
13958
|
tickValues && axis.tickValues(tickValues);
|
|
13873
13959
|
axis.tickFormat(
|
|
13874
|
-
tickFormat || !isX && ($$.isStackNormalized() && ((x) => `${x}%`))
|
|
13960
|
+
tickFormat || !isX && ($$.isStackNormalized() && $$.hasAxisGroupedData(id) && ((x) => `${x}%`))
|
|
13875
13961
|
);
|
|
13876
13962
|
if (isCategory) {
|
|
13877
13963
|
axis.tickCentered(config.axis_x_tick_centered);
|
|
@@ -14499,6 +14585,7 @@ class Axis_Axis {
|
|
|
14499
14585
|
const isPrevented = isBoolean(preventDefault) && preventDefault || false;
|
|
14500
14586
|
const preventThreshold = !isNaN(preventDefault) && preventDefault || null;
|
|
14501
14587
|
let startPx;
|
|
14588
|
+
const passiveOption = !isPrevented && preventThreshold === null;
|
|
14502
14589
|
const preventEvent = (event) => {
|
|
14503
14590
|
const eventType = event.type;
|
|
14504
14591
|
const touch = event.changedTouches[0];
|
|
@@ -14519,7 +14606,7 @@ class Axis_Axis {
|
|
|
14519
14606
|
eventRect.on("touchstart", (event) => {
|
|
14520
14607
|
state.event = event;
|
|
14521
14608
|
$$.updateEventRect();
|
|
14522
|
-
}).on("touchstart.eventRect touchmove.eventRect", (event) => {
|
|
14609
|
+
}, { passive: passiveOption }).on("touchstart.eventRect touchmove.eventRect", (event) => {
|
|
14523
14610
|
state.event = event;
|
|
14524
14611
|
if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
|
|
14525
14612
|
if (state.dragging || state.flowing || $$.hasArcType() || event.touches.length > 1) {
|
|
@@ -14530,21 +14617,21 @@ class Axis_Axis {
|
|
|
14530
14617
|
} else {
|
|
14531
14618
|
unselectRect();
|
|
14532
14619
|
}
|
|
14533
|
-
},
|
|
14620
|
+
}, { passive: passiveOption }).on("touchend.eventRect", (event) => {
|
|
14534
14621
|
state.event = event;
|
|
14535
14622
|
if (!eventRect.empty() && eventRect.classed($EVENT.eventRect)) {
|
|
14536
14623
|
if ($$.hasArcType() || !$$.toggleShape || state.cancelClick) {
|
|
14537
14624
|
state.cancelClick && (state.cancelClick = false);
|
|
14538
14625
|
}
|
|
14539
14626
|
}
|
|
14540
|
-
},
|
|
14627
|
+
}, { passive: passiveOption });
|
|
14541
14628
|
svg.on("touchstart", (event) => {
|
|
14542
14629
|
state.event = event;
|
|
14543
14630
|
const { target } = event;
|
|
14544
14631
|
if (target && target !== eventRect.node()) {
|
|
14545
14632
|
unselectRect();
|
|
14546
14633
|
}
|
|
14547
|
-
});
|
|
14634
|
+
}, { passive: passiveOption });
|
|
14548
14635
|
},
|
|
14549
14636
|
/**
|
|
14550
14637
|
* Update event rect size
|
|
@@ -14746,7 +14833,7 @@ class Axis_Axis {
|
|
|
14746
14833
|
const dist = $$.dist(closest, mouse);
|
|
14747
14834
|
if ($$.isBarType(closest.id) || dist < $$.getPointSensitivity(closest)) {
|
|
14748
14835
|
$$.$el.svg.select(`.${$EVENT.eventRect}`).style("cursor", "pointer");
|
|
14749
|
-
if (triggerEvent && !state.mouseover) {
|
|
14836
|
+
if (triggerEvent && (!state.mouseover || state.mouseover.x !== closest.x || state.mouseover.id !== closest.id)) {
|
|
14750
14837
|
config.data_onover.call($$.api, closest);
|
|
14751
14838
|
state.mouseover = closest;
|
|
14752
14839
|
}
|
|
@@ -14918,7 +15005,7 @@ var external_commonjs_d3_ease_commonjs2_d3_ease_amd_d3_ease_root_d3_ = __webpack
|
|
|
14918
15005
|
/**
|
|
14919
15006
|
* Generate flow
|
|
14920
15007
|
* @param {object} args option object
|
|
14921
|
-
* @returns {
|
|
15008
|
+
* @returns {function}
|
|
14922
15009
|
* @private
|
|
14923
15010
|
*/
|
|
14924
15011
|
generateFlow(args) {
|
|
@@ -15898,7 +15985,7 @@ function smoothLines(el, type) {
|
|
|
15898
15985
|
* A function to format tick value. Format string is also available for timeseries data.
|
|
15899
15986
|
* @name axis․x․tick․format
|
|
15900
15987
|
* @memberof Options
|
|
15901
|
-
* @type {
|
|
15988
|
+
* @type {function|string}
|
|
15902
15989
|
* @default undefined
|
|
15903
15990
|
* @see [D3's time specifier](https://d3js.org/d3-time-format#locale_format)
|
|
15904
15991
|
* @example
|
|
@@ -15927,7 +16014,7 @@ function smoothLines(el, type) {
|
|
|
15927
16014
|
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
15928
16015
|
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.x.tick.culling.lines=false`.
|
|
15929
16016
|
* - `false`: all of ticks will be shown.<br><br>
|
|
15930
|
-
* 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`.
|
|
15931
16018
|
* @name axis․x․tick․culling
|
|
15932
16019
|
* @memberof Options
|
|
15933
16020
|
* @type {boolean}
|
|
@@ -16138,10 +16225,10 @@ function smoothLines(el, type) {
|
|
|
16138
16225
|
/**
|
|
16139
16226
|
* Set the x values of ticks manually.<br><br>
|
|
16140
16227
|
* If this option is provided, the position of the ticks will be determined based on those values.<br>
|
|
16141
|
-
* 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.
|
|
16142
16229
|
* @name axis․x․tick․values
|
|
16143
16230
|
* @memberof Options
|
|
16144
|
-
* @type {Array|
|
|
16231
|
+
* @type {Array|function}
|
|
16145
16232
|
* @default null
|
|
16146
16233
|
* @example
|
|
16147
16234
|
* axis: {
|
|
@@ -16362,7 +16449,7 @@ function smoothLines(el, type) {
|
|
|
16362
16449
|
* - **timeseries:** Numeric time value
|
|
16363
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
|
|
16364
16451
|
* - If want values to be treated as pixels, specify `unit:"px"`.
|
|
16365
|
-
* - The pixel value will be
|
|
16452
|
+
* - The pixel value will be converted based on the scale values. Hence can not reflect accurate padding result.
|
|
16366
16453
|
* @name axis․x․padding
|
|
16367
16454
|
* @memberof Options
|
|
16368
16455
|
* @type {object|number}
|
|
@@ -16413,7 +16500,7 @@ function smoothLines(el, type) {
|
|
|
16413
16500
|
* - **NOTE:** Specifying value, will limit the zoom scope selection within.
|
|
16414
16501
|
* @name axis․x․extent
|
|
16415
16502
|
* @memberof Options
|
|
16416
|
-
* @type {Array|
|
|
16503
|
+
* @type {Array|function}
|
|
16417
16504
|
* @default undefined
|
|
16418
16505
|
* @example
|
|
16419
16506
|
* axis: {
|
|
@@ -16679,7 +16766,7 @@ function smoothLines(el, type) {
|
|
|
16679
16766
|
* This option accepts d3.format object as well as a function you define.
|
|
16680
16767
|
* @name axis․y․tick․format
|
|
16681
16768
|
* @memberof Options
|
|
16682
|
-
* @type {
|
|
16769
|
+
* @type {function}
|
|
16683
16770
|
* @default undefined
|
|
16684
16771
|
* @example
|
|
16685
16772
|
* axis: {
|
|
@@ -16698,7 +16785,7 @@ function smoothLines(el, type) {
|
|
|
16698
16785
|
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
16699
16786
|
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y.tick.culling.lines=false`.
|
|
16700
16787
|
* - `false`: all of ticks will be shown.<br><br>
|
|
16701
|
-
* 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`.
|
|
16702
16789
|
* @name axis․y․tick․culling
|
|
16703
16790
|
* @memberof Options
|
|
16704
16791
|
* @type {boolean}
|
|
@@ -16804,7 +16891,7 @@ function smoothLines(el, type) {
|
|
|
16804
16891
|
* Set y axis tick values manually.
|
|
16805
16892
|
* @name axis․y․tick․values
|
|
16806
16893
|
* @memberof Options
|
|
16807
|
-
* @type {Array|
|
|
16894
|
+
* @type {Array|function}
|
|
16808
16895
|
* @default null
|
|
16809
16896
|
* @example
|
|
16810
16897
|
* axis: {
|
|
@@ -16940,7 +17027,7 @@ function smoothLines(el, type) {
|
|
|
16940
17027
|
* @private
|
|
16941
17028
|
* @type {object}
|
|
16942
17029
|
* @property {object} time time object
|
|
16943
|
-
* @property {
|
|
17030
|
+
* @property {function} [time.value] D3's time interval function (https://github.com/d3/d3-time#intervals)
|
|
16944
17031
|
* @example
|
|
16945
17032
|
* axis: {
|
|
16946
17033
|
* y: {
|
|
@@ -17039,6 +17126,18 @@ function smoothLines(el, type) {
|
|
|
17039
17126
|
|
|
17040
17127
|
;// ./src/config/Options/axis/y2.ts
|
|
17041
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,
|
|
17042
17141
|
/**
|
|
17043
17142
|
* Show or hide y2 axis.
|
|
17044
17143
|
* - **NOTE**:
|
|
@@ -17184,7 +17283,7 @@ function smoothLines(el, type) {
|
|
|
17184
17283
|
* This option works in the same way as axis.y.format.
|
|
17185
17284
|
* @name axis․y2․tick․format
|
|
17186
17285
|
* @memberof Options
|
|
17187
|
-
* @type {
|
|
17286
|
+
* @type {function}
|
|
17188
17287
|
* @default undefined
|
|
17189
17288
|
* @example
|
|
17190
17289
|
* axis: {
|
|
@@ -17202,7 +17301,7 @@ function smoothLines(el, type) {
|
|
|
17202
17301
|
* - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
|
|
17203
17302
|
* This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y2.tick.culling.lines=false`.
|
|
17204
17303
|
* - `false`: all of ticks will be shown.<br><br>
|
|
17205
|
-
* 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`.
|
|
17206
17305
|
* @name axis․y2․tick․culling
|
|
17207
17306
|
* @memberof Options
|
|
17208
17307
|
* @type {boolean}
|
|
@@ -17309,7 +17408,7 @@ function smoothLines(el, type) {
|
|
|
17309
17408
|
* Set y2 axis tick values manually.
|
|
17310
17409
|
* @name axis․y2․tick․values
|
|
17311
17410
|
* @memberof Options
|
|
17312
|
-
* @type {Array|
|
|
17411
|
+
* @type {Array|function}
|
|
17313
17412
|
* @default null
|
|
17314
17413
|
* @example
|
|
17315
17414
|
* axis: {
|
|
@@ -17541,16 +17640,16 @@ var axis_spreadValues = (a, b) => {
|
|
|
17541
17640
|
/**
|
|
17542
17641
|
* Setup the way to evaluate tick text size.
|
|
17543
17642
|
* - **NOTE:**
|
|
17544
|
-
* -
|
|
17643
|
+
* - When setting `false` or a custom evaluator, it is highly recommended to memoize evaluated text dimension value to not degrade performance.
|
|
17545
17644
|
* @name axis․evalTextSize
|
|
17546
17645
|
* @memberof Options
|
|
17547
|
-
* @type {boolean|
|
|
17646
|
+
* @type {boolean|function}
|
|
17548
17647
|
* @default true
|
|
17549
17648
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.AxisEvalTextSize)
|
|
17550
17649
|
* @example
|
|
17551
17650
|
* axis: {
|
|
17552
17651
|
* // will evaluate getting text size every time.
|
|
17553
|
-
* evalTextSize: false
|
|
17652
|
+
* evalTextSize: false,
|
|
17554
17653
|
*
|
|
17555
17654
|
* // set a custom evaluator
|
|
17556
17655
|
* evalTextSize: function(textElement, axisId) {
|
|
@@ -17594,8 +17693,8 @@ var axis_spreadValues = (a, b) => {
|
|
|
17594
17693
|
* Set axis tooltip.
|
|
17595
17694
|
* - **NOTE:**
|
|
17596
17695
|
* - When enabled, will disable default focus grid line.
|
|
17597
|
-
* - For `timeseries` x Axis,
|
|
17598
|
-
* - 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.
|
|
17599
17698
|
* @name axis․tooltip
|
|
17600
17699
|
* @memberof Options
|
|
17601
17700
|
* @type {boolean}
|
|
@@ -17608,11 +17707,11 @@ var axis_spreadValues = (a, b) => {
|
|
|
17608
17707
|
* axis: {
|
|
17609
17708
|
* tooltip: true, // default background color is
|
|
17610
17709
|
*
|
|
17611
|
-
* // set
|
|
17710
|
+
* // set background color for axis tooltip texts
|
|
17612
17711
|
* tooltip: {
|
|
17613
17712
|
* backgroundColor: "red",
|
|
17614
17713
|
*
|
|
17615
|
-
* // set
|
|
17714
|
+
* // set different background colors per axes
|
|
17616
17715
|
* // NOTE: In this case, only specified axes tooltip will appear.
|
|
17617
17716
|
* backgroundColor: {
|
|
17618
17717
|
* x: "green",
|
|
@@ -17717,7 +17816,7 @@ var axis_spreadValues = (a, b) => {
|
|
|
17717
17816
|
*/
|
|
17718
17817
|
data_xs: {},
|
|
17719
17818
|
/**
|
|
17720
|
-
* Set a format specifier to parse string
|
|
17819
|
+
* Set a format specifier to parse string specified as x.
|
|
17721
17820
|
* @name data․xFormat
|
|
17722
17821
|
* @memberof Options
|
|
17723
17822
|
* @type {string}
|
|
@@ -17766,7 +17865,7 @@ var axis_spreadValues = (a, b) => {
|
|
|
17766
17865
|
* x: "x",
|
|
17767
17866
|
* columns: [
|
|
17768
17867
|
* // The line graph will start to be drawn following the x axis sequence
|
|
17769
|
-
* // Below data,
|
|
17868
|
+
* // Below data, will start drawing x=1: 200, x=2: 300, x=3: 100
|
|
17770
17869
|
* ["x", 3, 1, 2],
|
|
17771
17870
|
* ["data1", 100, 200, 300]
|
|
17772
17871
|
* ]
|
|
@@ -17827,16 +17926,41 @@ var axis_spreadValues = (a, b) => {
|
|
|
17827
17926
|
* - **NOTE:**
|
|
17828
17927
|
* - For stacking, '[data.groups](#.data%25E2%2580%25A4groups)' option should be set
|
|
17829
17928
|
* - y Axis will be set in percentage value (0 ~ 100%)
|
|
17830
|
-
* - Must have
|
|
17929
|
+
* - Must have positive values
|
|
17930
|
+
* - Data not in any group will not be normalized when using perGroup option
|
|
17831
17931
|
* @name data․stack․normalize
|
|
17832
17932
|
* @memberof Options
|
|
17833
|
-
* @type {boolean}
|
|
17933
|
+
* @type {boolean|object}
|
|
17834
17934
|
* @default false
|
|
17835
|
-
* @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)
|
|
17836
17937
|
* @example
|
|
17837
17938
|
* data: {
|
|
17838
17939
|
* stack: {
|
|
17940
|
+
* // Normalize all grouped data together (all groups combined to 0-100%)
|
|
17839
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
|
|
17840
17964
|
* }
|
|
17841
17965
|
* }
|
|
17842
17966
|
*/
|
|
@@ -17887,6 +18011,155 @@ const options = {
|
|
|
17887
18011
|
|
|
17888
18012
|
// EXTERNAL MODULE: external {"commonjs":"d3-interpolate","commonjs2":"d3-interpolate","amd":"d3-interpolate","root":"d3"}
|
|
17889
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
|
+
|
|
17890
18163
|
;// ./src/ChartInternal/shape/arc.ts
|
|
17891
18164
|
var arc_defProp = Object.defineProperty;
|
|
17892
18165
|
var arc_defProps = Object.defineProperties;
|
|
@@ -17914,6 +18187,62 @@ var arc_spreadProps = (a, b) => arc_defProps(a, arc_getOwnPropDescs(b));
|
|
|
17914
18187
|
|
|
17915
18188
|
|
|
17916
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
|
+
}
|
|
17917
18246
|
function getRadiusFn(expandRate = 0) {
|
|
17918
18247
|
const $$ = this;
|
|
17919
18248
|
const { config, state } = $$;
|
|
@@ -18021,7 +18350,9 @@ function getAttrTweenFn(fn) {
|
|
|
18021
18350
|
const padding = config[`${dataType}_padding`];
|
|
18022
18351
|
const w = config.gauge_width || config.donut_width;
|
|
18023
18352
|
const gaugeArcWidth = $$.filterTargetsToShow($$.data.targets).length * config.gauge_arcs_minWidth;
|
|
18024
|
-
|
|
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);
|
|
18025
18356
|
state.radius = state.radiusExpanded * 0.95;
|
|
18026
18357
|
state.innerRadiusRatio = w ? (state.radius - w) / state.radius : 0.6;
|
|
18027
18358
|
state.gaugeArcWidth = w || (gaugeArcWidth <= state.radius - state.innerRadius ? state.radius - state.innerRadius : gaugeArcWidth <= state.radius ? gaugeArcWidth : state.radius);
|
|
@@ -18160,7 +18491,7 @@ function getAttrTweenFn(fn) {
|
|
|
18160
18491
|
/**
|
|
18161
18492
|
* Get expanded arc path function
|
|
18162
18493
|
* @param {number} rate Expand rate
|
|
18163
|
-
* @returns {
|
|
18494
|
+
* @returns {function} Expanded arc path getter function
|
|
18164
18495
|
* @private
|
|
18165
18496
|
*/
|
|
18166
18497
|
getSvgArcExpanded(rate = 1) {
|
|
@@ -18223,46 +18554,24 @@ function getAttrTweenFn(fn) {
|
|
|
18223
18554
|
* @private
|
|
18224
18555
|
*/
|
|
18225
18556
|
transformForArcLabel(textNode, d, forRange = false) {
|
|
18226
|
-
var _a, _b, _c;
|
|
18227
18557
|
const $$ = this;
|
|
18228
|
-
const { config, state: { radiusExpanded } } = $$;
|
|
18229
18558
|
const updated = $$.updateAngle(d, forRange);
|
|
18230
|
-
|
|
18231
|
-
|
|
18559
|
+
if (!updated) {
|
|
18560
|
+
return "";
|
|
18561
|
+
}
|
|
18562
|
+
let pos;
|
|
18232
18563
|
let ratio = 1;
|
|
18233
|
-
if (
|
|
18234
|
-
|
|
18235
|
-
|
|
18236
|
-
|
|
18237
|
-
|
|
18238
|
-
|
|
18239
|
-
|
|
18240
|
-
|
|
18241
|
-
const position = isFunction(rangeTextPosition) ? rangeTextPosition(rangeValues[d.index]) : rangeTextPosition;
|
|
18242
|
-
pos.x += (_a = position == null ? void 0 : position.x) != null ? _a : 0;
|
|
18243
|
-
pos.y += (_b = position == null ? void 0 : position.y) != null ? _b : 0;
|
|
18244
|
-
}
|
|
18245
|
-
} else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
|
|
18246
|
-
let { outerRadius } = $$.getRadius(d);
|
|
18247
|
-
if ($$.hasType("polar")) {
|
|
18248
|
-
outerRadius = $$.getPolarOuterRadius(d, outerRadius);
|
|
18249
|
-
}
|
|
18250
|
-
const c = this.svgArc.centroid(updated);
|
|
18251
|
-
const [x, y] = c.map((v) => isNaN(v) ? 0 : v);
|
|
18252
|
-
const h = Math.sqrt(x * x + y * y);
|
|
18253
|
-
pos.x = x;
|
|
18254
|
-
pos.y = y;
|
|
18255
|
-
ratio = (_c = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).map((v) => config[`${v}_label_ratio`])) == null ? void 0 : _c[0];
|
|
18256
|
-
if (ratio) {
|
|
18257
|
-
ratio = isFunction(ratio) ? ratio.bind($$.api)(d, outerRadius, h) : ratio;
|
|
18258
|
-
} else {
|
|
18259
|
-
ratio = outerRadius && (h ? (36 / outerRadius > 0.375 ? 1.175 - 36 / outerRadius : 0.8) * outerRadius / h : 0);
|
|
18260
|
-
}
|
|
18261
|
-
}
|
|
18262
|
-
updateTextImagePos.call($$, textNode, pos);
|
|
18263
|
-
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 "";
|
|
18264
18572
|
}
|
|
18265
|
-
|
|
18573
|
+
updateTextImagePos.call($$, textNode, pos);
|
|
18574
|
+
return `translate(${pos.x * ratio},${pos.y * ratio})`;
|
|
18266
18575
|
},
|
|
18267
18576
|
convertToArcData(d) {
|
|
18268
18577
|
return this.addName({
|
|
@@ -18273,20 +18582,18 @@ function getAttrTweenFn(fn) {
|
|
|
18273
18582
|
});
|
|
18274
18583
|
},
|
|
18275
18584
|
textForArcLabel(selection) {
|
|
18585
|
+
var _a;
|
|
18276
18586
|
const $$ = this;
|
|
18277
18587
|
const hasGauge = $$.hasType("gauge");
|
|
18588
|
+
const chartType = (_a = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _a[0];
|
|
18278
18589
|
if ($$.shouldShowArcLabel()) {
|
|
18279
18590
|
selection.style("fill", $$.updateTextColor.bind($$)).attr("filter", (d) => $$.updateTextBGColor.bind($$)(d, $$.config.data_labels_backgroundColors)).each(function(d) {
|
|
18280
|
-
var _a;
|
|
18281
18591
|
const node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this);
|
|
18282
18592
|
const updated = $$.updateAngle(d);
|
|
18283
18593
|
const ratio = $$.getRatio("arc", updated);
|
|
18284
|
-
const
|
|
18285
|
-
|
|
18286
|
-
|
|
18287
|
-
(_a = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$))) == null ? void 0 : _a[0]
|
|
18288
|
-
);
|
|
18289
|
-
if (isUnderThreshold) {
|
|
18594
|
+
const meetsThreshold = meetsLabelThreshold.call($$, ratio, chartType);
|
|
18595
|
+
d._cache = { updated, ratio, meetsThreshold };
|
|
18596
|
+
if (meetsThreshold) {
|
|
18290
18597
|
const { value } = updated || d;
|
|
18291
18598
|
const text = ($$.getArcLabelConfig("format") || $$.defaultArcValueFormat)(value, ratio, d.data.id).toString();
|
|
18292
18599
|
setTextValue(node, text, [-1, 1], hasGauge);
|
|
@@ -18393,7 +18700,7 @@ function getAttrTweenFn(fn) {
|
|
|
18393
18700
|
])
|
|
18394
18701
|
);
|
|
18395
18702
|
mainPieEnter.append("g").attr("class", classArcs).merge(mainPieUpdate);
|
|
18396
|
-
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"));
|
|
18397
18704
|
$el.text = chartArcs.selectAll(`.${$COMMON.target} text`);
|
|
18398
18705
|
},
|
|
18399
18706
|
initArc() {
|
|
@@ -18703,7 +19010,7 @@ function getAttrTweenFn(fn) {
|
|
|
18703
19010
|
const id = (arcData == null ? void 0 : arcData.id) || void 0;
|
|
18704
19011
|
$$.callOverOutForTouch(arcData);
|
|
18705
19012
|
isUndefined(id) ? unselectArc() : selectArc(this, arcData, id);
|
|
18706
|
-
});
|
|
19013
|
+
}, { passive: true });
|
|
18707
19014
|
}
|
|
18708
19015
|
},
|
|
18709
19016
|
redrawArcText(duration) {
|
|
@@ -18733,6 +19040,7 @@ function getAttrTweenFn(fn) {
|
|
|
18733
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));
|
|
18734
19041
|
}
|
|
18735
19042
|
}
|
|
19043
|
+
isLabelWithLine.call($$) && redrawArcLabelLines.call($$, duration);
|
|
18736
19044
|
},
|
|
18737
19045
|
/**
|
|
18738
19046
|
* Get Arc element by id or index
|
|
@@ -18791,7 +19099,7 @@ function getAttrTweenFn(fn) {
|
|
|
18791
19099
|
},
|
|
18792
19100
|
/**
|
|
18793
19101
|
* Redraw function
|
|
18794
|
-
* @param {
|
|
19102
|
+
* @param {function} drawFn Retuned functino from .generateDrawCandlestick()
|
|
18795
19103
|
* @param {boolean} withTransition With or without transition
|
|
18796
19104
|
* @param {boolean} isSub Subchart draw
|
|
18797
19105
|
* @returns {Array}
|
|
@@ -18811,7 +19119,7 @@ function getAttrTweenFn(fn) {
|
|
|
18811
19119
|
* Generate area path data
|
|
18812
19120
|
* @param {object} areaIndices Indices
|
|
18813
19121
|
* @param {boolean} isSub Weather is sub axis
|
|
18814
|
-
* @returns {
|
|
19122
|
+
* @returns {function}
|
|
18815
19123
|
* @private
|
|
18816
19124
|
*/
|
|
18817
19125
|
generateDrawArea(areaIndices, isSub) {
|
|
@@ -18955,7 +19263,7 @@ function getConnectLineType(id) {
|
|
|
18955
19263
|
},
|
|
18956
19264
|
/**
|
|
18957
19265
|
* Redraw function
|
|
18958
|
-
* @param {
|
|
19266
|
+
* @param {function} drawFn Retuned function from .getDrawShape() => .generateDrawBar()
|
|
18959
19267
|
* @param {boolean} withTransition With or without transition
|
|
18960
19268
|
* @param {boolean} isSub Subchart draw
|
|
18961
19269
|
* @returns {Array}
|
|
@@ -19002,7 +19310,7 @@ function getConnectLineType(id) {
|
|
|
19002
19310
|
* -------------------------
|
|
19003
19311
|
* 0 1
|
|
19004
19312
|
* @param {boolean} isSub If is for subchart
|
|
19005
|
-
* @returns {
|
|
19313
|
+
* @returns {function}
|
|
19006
19314
|
* @private
|
|
19007
19315
|
*/
|
|
19008
19316
|
generateDrawBar(barIndices, isSub) {
|
|
@@ -19297,7 +19605,7 @@ var candlestick_spreadValues = (a, b) => {
|
|
|
19297
19605
|
* Get draw function
|
|
19298
19606
|
* @param {object} indices Indice data
|
|
19299
19607
|
* @param {boolean} isSub Subchart draw
|
|
19300
|
-
* @returns {
|
|
19608
|
+
* @returns {function}
|
|
19301
19609
|
* @private
|
|
19302
19610
|
*/
|
|
19303
19611
|
generateDrawCandlestick(indices, isSub) {
|
|
@@ -19341,7 +19649,7 @@ var candlestick_spreadValues = (a, b) => {
|
|
|
19341
19649
|
* Generate shape drawing points
|
|
19342
19650
|
* @param {object} indices Indice data
|
|
19343
19651
|
* @param {boolean} isSub Subchart draw
|
|
19344
|
-
* @returns {
|
|
19652
|
+
* @returns {function}
|
|
19345
19653
|
*/
|
|
19346
19654
|
generateGetCandlestickPoints(indices, isSub = false) {
|
|
19347
19655
|
const $$ = this;
|
|
@@ -19387,7 +19695,7 @@ var candlestick_spreadValues = (a, b) => {
|
|
|
19387
19695
|
},
|
|
19388
19696
|
/**
|
|
19389
19697
|
* Redraw function
|
|
19390
|
-
* @param {
|
|
19698
|
+
* @param {function} drawFn Retuned functino from .generateDrawCandlestick()
|
|
19391
19699
|
* @param {boolean} withTransition With or without transition
|
|
19392
19700
|
* @param {boolean} isSub Subchart draw
|
|
19393
19701
|
* @returns {Array}
|
|
@@ -19599,7 +19907,7 @@ function updateRatio(data) {
|
|
|
19599
19907
|
$$.showTooltip([data], event.target);
|
|
19600
19908
|
/^(touchstart|mouseover)$/.test(event.type) && $$.setOverOut(true, data);
|
|
19601
19909
|
}
|
|
19602
|
-
}).on(isTouch ? "touchend" : "mouseout", (event) => {
|
|
19910
|
+
}, isTouch ? { passive: true } : void 0).on(isTouch ? "touchend" : "mouseout", (event) => {
|
|
19603
19911
|
const data = getTarget(event);
|
|
19604
19912
|
if (config.interaction_onout) {
|
|
19605
19913
|
$$.hideTooltip();
|
|
@@ -19850,7 +20158,7 @@ function getRegions(d, _regions, isTimeSeries) {
|
|
|
19850
20158
|
},
|
|
19851
20159
|
/**
|
|
19852
20160
|
* Redraw function
|
|
19853
|
-
* @param {
|
|
20161
|
+
* @param {function} drawFn Retuned functino from .generateDrawCandlestick()
|
|
19854
20162
|
* @param {boolean} withTransition With or without transition
|
|
19855
20163
|
* @param {boolean} isSub Subchart draw
|
|
19856
20164
|
* @returns {Array}
|
|
@@ -19867,7 +20175,7 @@ function getRegions(d, _regions, isTimeSeries) {
|
|
|
19867
20175
|
/**
|
|
19868
20176
|
* Get the curve interpolate
|
|
19869
20177
|
* @param {Array} d Data object
|
|
19870
|
-
* @returns {
|
|
20178
|
+
* @returns {function}
|
|
19871
20179
|
* @private
|
|
19872
20180
|
*/
|
|
19873
20181
|
getCurve(d) {
|
|
@@ -19937,8 +20245,8 @@ function getRegions(d, _regions, isTimeSeries) {
|
|
|
19937
20245
|
/**
|
|
19938
20246
|
* Set regions dasharray and get path
|
|
19939
20247
|
* @param {Array} d Data object
|
|
19940
|
-
* @param {
|
|
19941
|
-
* @param {
|
|
20248
|
+
* @param {function} x x scale function
|
|
20249
|
+
* @param {function} y y scale function
|
|
19942
20250
|
* @param {object} _regions regions to be set
|
|
19943
20251
|
* @returns {stirng} Path string
|
|
19944
20252
|
* @private
|
|
@@ -20535,7 +20843,7 @@ function insertPointInfoDefs(point, id) {
|
|
|
20535
20843
|
},
|
|
20536
20844
|
/**
|
|
20537
20845
|
* Get generate point function
|
|
20538
|
-
* @returns {
|
|
20846
|
+
* @returns {function}
|
|
20539
20847
|
* @private
|
|
20540
20848
|
*/
|
|
20541
20849
|
generatePoint() {
|
|
@@ -20884,9 +21192,9 @@ const cacheKeyTextWidth = KEY.radarTextWidth;
|
|
|
20884
21192
|
const index = $$.getDataIndexFromEvent(event);
|
|
20885
21193
|
$$.selectRectForSingle(svg.node(), index);
|
|
20886
21194
|
isMouse ? $$.setOverOut(true, index) : $$.callOverOutForTouch(index);
|
|
20887
|
-
}).on("mouseout", isMouse ? hide : null);
|
|
21195
|
+
}, isMouse ? void 0 : { passive: true }).on("mouseout", isMouse ? hide : null);
|
|
20888
21196
|
if (!isMouse) {
|
|
20889
|
-
svg.on("touchstart", hide);
|
|
21197
|
+
svg.on("touchstart", hide, { passive: true });
|
|
20890
21198
|
}
|
|
20891
21199
|
},
|
|
20892
21200
|
updateRadarShape() {
|
|
@@ -20998,7 +21306,7 @@ function getHierachyData(data) {
|
|
|
20998
21306
|
$$.showTooltip([data], event.currentTarget);
|
|
20999
21307
|
/^(touchstart|mouseover)$/.test(event.type) && $$.setOverOut(true, data);
|
|
21000
21308
|
}
|
|
21001
|
-
}).on(isTouch ? "touchend" : "mouseout", (event) => {
|
|
21309
|
+
}, isTouch ? { passive: true } : void 0).on(isTouch ? "touchend" : "mouseout", (event) => {
|
|
21002
21310
|
const data = getTarget(event);
|
|
21003
21311
|
if (config.interaction_onout) {
|
|
21004
21312
|
$$.hideTooltip();
|
|
@@ -21009,7 +21317,7 @@ function getHierachyData(data) {
|
|
|
21009
21317
|
},
|
|
21010
21318
|
/**
|
|
21011
21319
|
* Get tiling function
|
|
21012
|
-
* @returns {
|
|
21320
|
+
* @returns {function}
|
|
21013
21321
|
* @private
|
|
21014
21322
|
*/
|
|
21015
21323
|
getTreemapTile() {
|
|
@@ -21110,20 +21418,28 @@ function getHierachyData(data) {
|
|
|
21110
21418
|
/**
|
|
21111
21419
|
* Get treemap data label format function
|
|
21112
21420
|
* @param {object} d Data object
|
|
21113
|
-
* @returns {
|
|
21421
|
+
* @returns {function} Label formatter function
|
|
21114
21422
|
* @private
|
|
21115
21423
|
*/
|
|
21116
21424
|
treemapDataLabelFormat(d) {
|
|
21117
21425
|
const $$ = this;
|
|
21118
|
-
const { config } = $$;
|
|
21426
|
+
const { $el: { treemap }, config, scale: { x, y } } = $$;
|
|
21119
21427
|
const { id, value } = d;
|
|
21120
21428
|
const format = config.treemap_label_format;
|
|
21121
21429
|
const ratio = $$.getRatio("treemap", d);
|
|
21122
21430
|
const percentValue = (ratio * 100).toFixed(2);
|
|
21123
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
|
+
}
|
|
21124
21440
|
return function(node) {
|
|
21125
21441
|
node.style("opacity", meetLabelThreshold);
|
|
21126
|
-
return isFunction(format) ? format.bind($$.api)(value, ratio, id) : `${id}
|
|
21442
|
+
return isFunction(format) ? format.bind($$.api)(value, ratio, id, { width, height }) : `${id}
|
|
21127
21443
|
${percentValue}%`;
|
|
21128
21444
|
};
|
|
21129
21445
|
}
|
|
@@ -21138,7 +21454,7 @@ ${percentValue}%`;
|
|
|
21138
21454
|
* @type {object}
|
|
21139
21455
|
* @property {object} point Point object
|
|
21140
21456
|
* @property {boolean} [point.show=true] Whether to show each point in line.
|
|
21141
|
-
* @property {number|
|
|
21457
|
+
* @property {number|function} [point.r=2.5] The radius size of each point.
|
|
21142
21458
|
* - **NOTE:** Disabled for 'bubble' type
|
|
21143
21459
|
* @property {boolean|object} [point.radialGradient=false] Set the radial gradient on point.<br><br>
|
|
21144
21460
|
* Or customize by giving below object value:
|
|
@@ -21155,7 +21471,7 @@ ${percentValue}%`;
|
|
|
21155
21471
|
* - **NOTE:**
|
|
21156
21472
|
* - `null` will make to not set inline 'opacity' css prop.
|
|
21157
21473
|
* - when no value(or undefined) is set, it defaults to set opacity value according its chart types.
|
|
21158
|
-
* @property {number|string|
|
|
21474
|
+
* @property {number|string|function} [point.sensitivity=10] The sensitivity value for interaction boundary.
|
|
21159
21475
|
* - **Available Values:**
|
|
21160
21476
|
* - {number}: Absolute sensitivity value which is the distance from the data point in pixel.
|
|
21161
21477
|
* - "radius": sensitivity based on point's radius
|
|
@@ -21202,7 +21518,7 @@ ${percentValue}%`;
|
|
|
21202
21518
|
* return r;
|
|
21203
21519
|
* },
|
|
21204
21520
|
*
|
|
21205
|
-
* // will generate
|
|
21521
|
+
* // will generate following radialGradient:
|
|
21206
21522
|
* // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/radialGradient
|
|
21207
21523
|
* // <radualGradient cx="0.3" cy="0.3" r="0.7">
|
|
21208
21524
|
* // <stop offset="0.1" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
|
|
@@ -21318,7 +21634,7 @@ ${percentValue}%`;
|
|
|
21318
21634
|
* // <g class='bb-areas'> will be positioned behind the line <g class='bb-lines'> in stacking order
|
|
21319
21635
|
* front: false,
|
|
21320
21636
|
*
|
|
21321
|
-
* // will generate
|
|
21637
|
+
* // will generate following linearGradient:
|
|
21322
21638
|
* // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient
|
|
21323
21639
|
* // <linearGradient x1="0" x2="0" y1="0" y2="1">
|
|
21324
21640
|
* // <stop offset="0" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
|
|
@@ -21372,8 +21688,8 @@ ${percentValue}%`;
|
|
|
21372
21688
|
* @property {number} [bar.padding=0] The padding pixel value between each bar.
|
|
21373
21689
|
* @property {number} [bar.radius] Set the radius of bar edge in pixel.
|
|
21374
21690
|
* @property {number} [bar.radius.ratio] Set the radius ratio of bar edge in relative the bar's width.
|
|
21375
|
-
* @property {number} [bar.sensitivity=2] The
|
|
21376
|
-
* @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.
|
|
21377
21693
|
* @property {number} [bar.width.ratio=0.6] Change the width of bar chart by ratio.
|
|
21378
21694
|
* - **NOTE:** Criteria for ratio.
|
|
21379
21695
|
* - When x ticks count is same with the data count, the baseline for ratio is the minimum interval value of x ticks.
|
|
@@ -21400,12 +21716,12 @@ ${percentValue}%`;
|
|
|
21400
21716
|
* // make bar shape to be positioned over the other shape elements
|
|
21401
21717
|
* front: true,
|
|
21402
21718
|
*
|
|
21403
|
-
* // remove nullish data on bar indices
|
|
21719
|
+
* // remove nullish data on bar indices positions
|
|
21404
21720
|
* indices: {
|
|
21405
21721
|
* removeNull: true
|
|
21406
21722
|
* },
|
|
21407
21723
|
*
|
|
21408
|
-
* // will generate
|
|
21724
|
+
* // will generate following linearGradient:
|
|
21409
21725
|
* // for more info: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/linearGradient
|
|
21410
21726
|
* // <linearGradient x1="0" x2="0" y1="0" y2="1">
|
|
21411
21727
|
* // <stop offset="0" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
|
|
@@ -21503,12 +21819,12 @@ ${percentValue}%`;
|
|
|
21503
21819
|
* @memberof Options
|
|
21504
21820
|
* @type {object}
|
|
21505
21821
|
* @property {object} bubble bubble object
|
|
21506
|
-
* @property {number|
|
|
21822
|
+
* @property {number|function} [bubble.maxR=35] Set the max bubble radius value
|
|
21507
21823
|
* @property {boolean} [bubble.zerobased=false] Set if min or max value will be 0 on bubble chart.
|
|
21508
21824
|
* @example
|
|
21509
21825
|
* bubble: {
|
|
21510
21826
|
* // ex) If 100 is the highest value among data bound, the representation bubble of 100 will have radius of 50.
|
|
21511
|
-
* // And the lesser will have radius relatively from
|
|
21827
|
+
* // And the lesser will have radius relatively from the max value.
|
|
21512
21828
|
* maxR: 50,
|
|
21513
21829
|
*
|
|
21514
21830
|
* // or set radius callback
|
|
@@ -21562,7 +21878,7 @@ ${percentValue}%`;
|
|
|
21562
21878
|
* }
|
|
21563
21879
|
* },
|
|
21564
21880
|
* color: {
|
|
21565
|
-
* //
|
|
21881
|
+
* // specify bearish color
|
|
21566
21882
|
* down: "red",
|
|
21567
21883
|
*
|
|
21568
21884
|
* // or specify color per dataset
|
|
@@ -21615,7 +21931,7 @@ ${percentValue}%`;
|
|
|
21615
21931
|
* // hide all data points ('point.show=false' also has similar effect)
|
|
21616
21932
|
* point: false,
|
|
21617
21933
|
*
|
|
21618
|
-
* // show data points for only indicated
|
|
21934
|
+
* // show data points for only indicated data
|
|
21619
21935
|
* point: [
|
|
21620
21936
|
* "data1", "data3"
|
|
21621
21937
|
* ],
|
|
@@ -21650,7 +21966,7 @@ ${percentValue}%`;
|
|
|
21650
21966
|
* // hide all data points ('point.show=false' also has similar effect)
|
|
21651
21967
|
* point: false,
|
|
21652
21968
|
*
|
|
21653
|
-
* // show data points for only indicated
|
|
21969
|
+
* // show data points for only indicated data
|
|
21654
21970
|
* point: [
|
|
21655
21971
|
* "data1", "data3"
|
|
21656
21972
|
* ],
|
|
@@ -21709,14 +22025,14 @@ ${percentValue}%`;
|
|
|
21709
22025
|
* @memberof Options
|
|
21710
22026
|
* @type {object}
|
|
21711
22027
|
* @property {object} arc Arc object
|
|
21712
|
-
* @property {number|
|
|
22028
|
+
* @property {number|function} [arc.cornerRadius=0] Set corner radius of Arc(donut/gauge/pie/polar) shape.
|
|
21713
22029
|
* - **NOTE:**
|
|
21714
22030
|
* - Corner radius can't surpass the `(outerRadius - innerRadius) /2` of indicated shape.
|
|
21715
22031
|
* @property {number} [arc.cornerRadius.ratio=0] Set ratio relative of outer radius.
|
|
21716
22032
|
* @property {object} [arc.needle] Set needle options.
|
|
21717
22033
|
* @property {boolean} [arc.needle.show=false] Show or hide needle.
|
|
21718
22034
|
* @property {string} [arc.needle.color] Set needle filled color.
|
|
21719
|
-
* @property {
|
|
22035
|
+
* @property {function} [arc.needle.path] Set custom needle path function.
|
|
21720
22036
|
* - **NOTE:**
|
|
21721
22037
|
* - The path should be starting from 0,0 (which is center) to top center coordinate.
|
|
21722
22038
|
* - The function will receive, `length`{number} parameter which indicating the needle length in pixel relative to radius.
|
|
@@ -21740,8 +22056,8 @@ ${percentValue}%`;
|
|
|
21740
22056
|
* @property {string} [arc.rangeText.unit="absolute"] Specify the range text unit.
|
|
21741
22057
|
* - "absolute": Show absolute value
|
|
21742
22058
|
* - "%": Show percentage value
|
|
21743
|
-
* @property {boolean} [arc.rangeText.
|
|
21744
|
-
* @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.
|
|
21745
22061
|
* @property {number} [arc.rangeText.position] Set position function or object for the range text.
|
|
21746
22062
|
* @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutCornerRadius)
|
|
21747
22063
|
* @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#PieChartOptions.CornerRadius)
|
|
@@ -21854,10 +22170,21 @@ ${percentValue}%`;
|
|
|
21854
22170
|
* @type {object}
|
|
21855
22171
|
* @property {object} donut Donut object
|
|
21856
22172
|
* @property {boolean} [donut.label.show=true] Show or hide label on each donut piece.
|
|
21857
|
-
* @property {
|
|
22173
|
+
* @property {function} [donut.label.format] Set formatter for the label on each donut piece.
|
|
21858
22174
|
* @property {number} [donut.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
21859
|
-
* @property {number|
|
|
21860
|
-
* @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>
|
|
21861
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>
|
|
21862
22189
|
* The arguments are:<br>
|
|
21863
22190
|
* - `v` is the value of the data point where the label is shown.
|
|
@@ -21882,6 +22209,7 @@ ${percentValue}%`;
|
|
|
21882
22209
|
* @see [Demo: Needle](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutNeedle)
|
|
21883
22210
|
* @see [Demo: Range Text](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutRangeText)
|
|
21884
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)
|
|
21885
22213
|
* @see [Demo: Label Ratio](https://naver.github.io/billboard.js/demo/#DonutChartOptions.LabelRatio)
|
|
21886
22214
|
* @see [Demo: Multiline Label](https://naver.github.io/billboard.js/demo/#DonutChartOptions.MultilineLabel)
|
|
21887
22215
|
* @see [Demo: Multiline Title](https://naver.github.io/billboard.js/demo/#DonutChartOptions.MultilineTitle)
|
|
@@ -21911,6 +22239,20 @@ ${percentValue}%`;
|
|
|
21911
22239
|
* // or set ratio number
|
|
21912
22240
|
* ratio: 0.5,
|
|
21913
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
|
+
*
|
|
21914
22256
|
* // set image to be displayed next to the label text
|
|
21915
22257
|
* image: {
|
|
21916
22258
|
* url: "./sample.svg",
|
|
@@ -21982,6 +22324,7 @@ ${percentValue}%`;
|
|
|
21982
22324
|
donut_label_show: true,
|
|
21983
22325
|
donut_label_format: void 0,
|
|
21984
22326
|
donut_label_threshold: 0.05,
|
|
22327
|
+
donut_label_line: false,
|
|
21985
22328
|
donut_label_image: void 0,
|
|
21986
22329
|
donut_label_ratio: void 0,
|
|
21987
22330
|
donut_width: void 0,
|
|
@@ -22037,15 +22380,27 @@ ${percentValue}%`;
|
|
|
22037
22380
|
* @property {boolean} [gauge.background=""] Set background color. (The `.bb-chart-arcs-background` element)
|
|
22038
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.
|
|
22039
22382
|
* @property {boolean} [gauge.label.show=true] Show or hide label on gauge.
|
|
22040
|
-
* @property {
|
|
22041
|
-
* @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>
|
|
22042
22385
|
* Will pass following arguments to the given function:
|
|
22043
22386
|
* - value {number}: absolute value
|
|
22044
22387
|
* - ratio {number}: value's ratio
|
|
22045
22388
|
* - id {string}: data's id value
|
|
22046
|
-
* @property {number|
|
|
22389
|
+
* @property {number|function} [gauge.label.ratio=undefined] Set ratio of labels position.
|
|
22047
22390
|
* @property {number} [gauge.label.threshold=0] Set threshold ratio to show/hide labels.
|
|
22048
|
-
* @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>
|
|
22049
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>
|
|
22050
22405
|
* The arguments are:<br>
|
|
22051
22406
|
* - `v` is the value of the data point where the label is shown.
|
|
@@ -22098,6 +22453,7 @@ ${percentValue}%`;
|
|
|
22098
22453
|
* @see [Demo: archLength](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeArcLength)
|
|
22099
22454
|
* @see [Demo: startingAngle](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeStartingAngle)
|
|
22100
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)
|
|
22101
22457
|
* @see [Demo: label ratio](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeLabelRatio)
|
|
22102
22458
|
* @example
|
|
22103
22459
|
* gauge: {
|
|
@@ -22120,6 +22476,20 @@ ${percentValue}%`;
|
|
|
22120
22476
|
* // if data value is below than 0.1, text label will be hidden.
|
|
22121
22477
|
* threshold: 0.1,
|
|
22122
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
|
+
*
|
|
22123
22493
|
* // set ratio callback. Should return ratio value
|
|
22124
22494
|
* ratio: function(d, radius, h) {
|
|
22125
22495
|
* ...
|
|
@@ -22213,6 +22583,7 @@ ${percentValue}%`;
|
|
|
22213
22583
|
gauge_label_format: void 0,
|
|
22214
22584
|
gauge_label_ratio: void 0,
|
|
22215
22585
|
gauge_label_threshold: 0,
|
|
22586
|
+
gauge_label_line: false,
|
|
22216
22587
|
gauge_label_image: void 0,
|
|
22217
22588
|
gauge_enforceMinMax: false,
|
|
22218
22589
|
gauge_min: 0,
|
|
@@ -22238,10 +22609,21 @@ ${percentValue}%`;
|
|
|
22238
22609
|
* @type {object}
|
|
22239
22610
|
* @property {object} pie Pie object
|
|
22240
22611
|
* @property {boolean} [pie.label.show=true] Show or hide label on each pie piece.
|
|
22241
|
-
* @property {
|
|
22242
|
-
* @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.
|
|
22243
22614
|
* @property {number} [pie.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
22244
|
-
* @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>
|
|
22245
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>
|
|
22246
22628
|
* The arguments are:<br>
|
|
22247
22629
|
* - `v` is the value of the data point where the label is shown.
|
|
@@ -22266,6 +22648,7 @@ ${percentValue}%`;
|
|
|
22266
22648
|
* @see [Demo: outerRadius](https://naver.github.io/billboard.js/demo/#PieChartOptions.OuterRadius)
|
|
22267
22649
|
* @see [Demo: startingAngle](https://naver.github.io/billboard.js/demo/#PieChartOptions.StartingAngle)
|
|
22268
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)
|
|
22269
22652
|
* @example
|
|
22270
22653
|
* pie: {
|
|
22271
22654
|
* label: {
|
|
@@ -22289,6 +22672,20 @@ ${percentValue}%`;
|
|
|
22289
22672
|
* // or set ratio number
|
|
22290
22673
|
* ratio: 0.5,
|
|
22291
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
|
+
*
|
|
22292
22689
|
* // set image to be displayed next to the label text
|
|
22293
22690
|
* image: {
|
|
22294
22691
|
* url: "./sample.svg",
|
|
@@ -22370,6 +22767,7 @@ ${percentValue}%`;
|
|
|
22370
22767
|
pie_label_format: void 0,
|
|
22371
22768
|
pie_label_ratio: void 0,
|
|
22372
22769
|
pie_label_threshold: 0.05,
|
|
22770
|
+
pie_label_line: false,
|
|
22373
22771
|
pie_label_image: void 0,
|
|
22374
22772
|
pie_expand: {},
|
|
22375
22773
|
pie_expand_rate: 0.98,
|
|
@@ -22390,10 +22788,21 @@ ${percentValue}%`;
|
|
|
22390
22788
|
* @type {object}
|
|
22391
22789
|
* @property {object} polar Polar object
|
|
22392
22790
|
* @property {boolean} [polar.label.show=true] Show or hide label on each polar piece.
|
|
22393
|
-
* @property {
|
|
22791
|
+
* @property {function} [polar.label.format] Set formatter for the label on each polar piece.
|
|
22394
22792
|
* @property {number} [polar.label.threshold=0.05] Set threshold ratio to show/hide labels.
|
|
22395
|
-
* @property {number|
|
|
22396
|
-
* @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>
|
|
22397
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>
|
|
22398
22807
|
* The arguments are:<br>
|
|
22399
22808
|
* - `v` is the value of the data point where the label is shown.
|
|
@@ -22408,13 +22817,14 @@ ${percentValue}%`;
|
|
|
22408
22817
|
* @property {number} [polar.level.depth=3] Set the level depth.
|
|
22409
22818
|
* @property {boolean} [polar.level.show=true] Show or hide level.
|
|
22410
22819
|
* @property {string} [polar.level.text.backgroundColor="#fff"] Set label text's background color.
|
|
22411
|
-
* @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)`
|
|
22412
22821
|
* @property {boolean} [polar.level.text.show=true] Show or hide level text.
|
|
22413
22822
|
* @property {number} [polar.padAngle=0] Set padding between data.
|
|
22414
22823
|
* @property {number} [polar.padding=0] Sets the gap between pie arcs.
|
|
22415
22824
|
* @property {number} [polar.startingAngle=0] Set starting angle where data draws.
|
|
22416
22825
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.PolarChart)
|
|
22417
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)
|
|
22418
22828
|
* @example
|
|
22419
22829
|
* polar: {
|
|
22420
22830
|
* label: {
|
|
@@ -22438,6 +22848,20 @@ ${percentValue}%`;
|
|
|
22438
22848
|
* // or set ratio number
|
|
22439
22849
|
* ratio: 0.5,
|
|
22440
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
|
+
*
|
|
22441
22865
|
* // set image to be displayed next to the label text
|
|
22442
22866
|
* image: {
|
|
22443
22867
|
* url: "./sample.svg",
|
|
@@ -22502,6 +22926,7 @@ ${percentValue}%`;
|
|
|
22502
22926
|
polar_label_show: true,
|
|
22503
22927
|
polar_label_format: void 0,
|
|
22504
22928
|
polar_label_threshold: 0.05,
|
|
22929
|
+
polar_label_line: false,
|
|
22505
22930
|
polar_label_image: void 0,
|
|
22506
22931
|
polar_label_ratio: void 0,
|
|
22507
22932
|
polar_level_depth: 3,
|
|
@@ -22533,7 +22958,7 @@ ${percentValue}%`;
|
|
|
22533
22958
|
* @property {boolean} [radar.direction.clockwise=false] Set the direction to be drawn.
|
|
22534
22959
|
* @property {number} [radar.level.depth=3] Set the level depth.
|
|
22535
22960
|
* @property {boolean} [radar.level.show=true] Show or hide level.
|
|
22536
|
-
* @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)`
|
|
22537
22962
|
* @property {boolean} [radar.level.text.show=true] Show or hide level text.
|
|
22538
22963
|
* @property {number} [radar.size.ratio=0.87] Set size ratio.
|
|
22539
22964
|
* @see [Demo](https://naver.github.io/billboard.js/demo/#Chart.RadarChart)
|
|
@@ -22601,7 +23026,12 @@ ${percentValue}%`;
|
|
|
22601
23026
|
* - sliceDice ([d3.treemapSliceDice](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSliceDice))
|
|
22602
23027
|
* - squrify ([d3.treemapSquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapSquarify))
|
|
22603
23028
|
* - resquarify ([d3.treemapResquarify](https://github.com/d3/d3-hierarchy/blob/main/README.md#treemapResquarify))
|
|
22604
|
-
* @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
|
|
22605
23035
|
* @property {number} [treemap.label.threshold=0.05] Set threshold ratio to show/hide labels text.
|
|
22606
23036
|
* @property {number} [treemap.label.show=true] Show or hide label text.
|
|
22607
23037
|
* @see [Demo: treemap](https://naver.github.io/billboard.js/demo/#Chart.TreemapChart)
|
|
@@ -22614,12 +23044,33 @@ ${percentValue}%`;
|
|
|
22614
23044
|
* // show or hide label text
|
|
22615
23045
|
* show: false,
|
|
22616
23046
|
*
|
|
22617
|
-
* //
|
|
22618
|
-
* 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
|
|
22619
23050
|
* return d3.format("$")(value);
|
|
23051
|
+
* },
|
|
22620
23052
|
*
|
|
22621
|
-
*
|
|
22622
|
-
*
|
|
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;
|
|
22623
23074
|
* },
|
|
22624
23075
|
*
|
|
22625
23076
|
* // set ratio number
|
|
@@ -22728,10 +23179,10 @@ const bb = {
|
|
|
22728
23179
|
* bb.version; // "1.0.0"
|
|
22729
23180
|
* @memberof bb
|
|
22730
23181
|
*/
|
|
22731
|
-
version: "3.
|
|
23182
|
+
version: "3.18.0-next.1",
|
|
22732
23183
|
/**
|
|
22733
23184
|
* Generate chart
|
|
22734
|
-
* - **NOTE:** Bear in mind for the
|
|
23185
|
+
* - **NOTE:** Bear in mind for the possibility of ***throwing an error***, during the generation when:
|
|
22735
23186
|
* - Unused option value is given.
|
|
22736
23187
|
* - ex) For `data.type="pie"` option, setting 'axis' option can cause unexpected generation error.
|
|
22737
23188
|
* - Insufficient value is given for certain option used.
|