@gravity-ui/chartkit 5.17.1 → 5.18.0
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/build/components/ChartKit.css +0 -1
- package/build/components/SplitPane/Pane.d.ts +14 -0
- package/build/components/SplitPane/Pane.js +26 -0
- package/build/components/SplitPane/Resizer.d.ts +18 -0
- package/build/components/SplitPane/Resizer.js +26 -0
- package/build/components/SplitPane/SplitPane.d.ts +59 -0
- package/build/components/SplitPane/SplitPane.js +235 -0
- package/build/{plugins/highcharts/renderer/components/StyledSplitPane → components/SplitPane}/StyledSplitPane.css +0 -1
- package/build/{plugins/highcharts/renderer/components/StyledSplitPane → components/SplitPane}/StyledSplitPane.d.ts +1 -1
- package/build/{plugins/highcharts/renderer/components/StyledSplitPane → components/SplitPane}/StyledSplitPane.js +3 -3
- package/build/components/SplitPane/constants.d.ts +4 -0
- package/build/components/SplitPane/constants.js +4 -0
- package/build/components/SplitPane/index.d.ts +8 -0
- package/build/components/SplitPane/index.js +18 -0
- package/build/components/SplitPane/types.d.ts +2 -0
- package/build/constants/index.d.ts +1 -0
- package/build/constants/index.js +1 -0
- package/build/constants/misc.d.ts +10 -0
- package/build/constants/misc.js +19 -0
- package/build/hooks/index.d.ts +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/misc.d.ts +1 -0
- package/build/hooks/misc.js +8 -0
- package/build/plugins/d3/index.d.ts +1 -1
- package/build/plugins/d3/index.js +2 -1
- package/build/plugins/d3/renderer/D3Widget.d.ts +5 -1
- package/build/plugins/d3/renderer/D3Widget.js +31 -66
- package/build/plugins/d3/renderer/withSplitPane/TooltipContent.d.ts +8 -0
- package/build/plugins/d3/renderer/withSplitPane/TooltipContent.js +12 -0
- package/build/plugins/d3/renderer/withSplitPane/useWithSplitPaneState.d.ts +19 -0
- package/build/plugins/d3/renderer/withSplitPane/useWithSplitPaneState.js +46 -0
- package/build/plugins/d3/renderer/withSplitPane/withSplitPane.d.ts +4 -0
- package/build/plugins/d3/renderer/withSplitPane/withSplitPane.js +100 -0
- package/build/plugins/d3/types.d.ts +2 -2
- package/build/plugins/highcharts/renderer/HighchartsWidget.d.ts +2 -2
- package/build/plugins/highcharts/renderer/components/withSplitPane/withSplitPane.js +1 -1
- package/build/types/index.js +1 -0
- package/build/types/widget-data/pie.d.ts +1 -1
- package/build/types/widget.d.ts +6 -3
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.js +1 -0
- package/build/utils/misc.d.ts +2 -0
- package/build/utils/misc.js +7 -0
- package/package.json +4 -4
- package/build/plugins/d3/examples/ExampleWrapper.d.ts +0 -7
- package/build/plugins/d3/examples/ExampleWrapper.js +0 -5
- package/build/plugins/d3/examples/area/Basic.d.ts +0 -2
- package/build/plugins/d3/examples/area/Basic.js +0 -34
- package/build/plugins/d3/examples/area/NegativeValues.d.ts +0 -2
- package/build/plugins/d3/examples/area/NegativeValues.js +0 -24
- package/build/plugins/d3/examples/area/PercentStacking.d.ts +0 -2
- package/build/plugins/d3/examples/area/PercentStacking.js +0 -47
- package/build/plugins/d3/examples/area/StackedArea.d.ts +0 -2
- package/build/plugins/d3/examples/area/StackedArea.js +0 -47
- package/build/plugins/d3/examples/area/TwoYAxis.d.ts +0 -2
- package/build/plugins/d3/examples/area/TwoYAxis.js +0 -58
- package/build/plugins/d3/examples/bar-x/Basic.d.ts +0 -4
- package/build/plugins/d3/examples/bar-x/Basic.js +0 -88
- package/build/plugins/d3/examples/bar-x/DataLabels.d.ts +0 -2
- package/build/plugins/d3/examples/bar-x/DataLabels.js +0 -48
- package/build/plugins/d3/examples/bar-x/GroupedColumns.d.ts +0 -2
- package/build/plugins/d3/examples/bar-x/GroupedColumns.js +0 -48
- package/build/plugins/d3/examples/bar-x/NegativeValues.d.ts +0 -2
- package/build/plugins/d3/examples/bar-x/NegativeValues.js +0 -41
- package/build/plugins/d3/examples/bar-x/PercentStack.d.ts +0 -2
- package/build/plugins/d3/examples/bar-x/PercentStack.js +0 -47
- package/build/plugins/d3/examples/bar-x/StackedColumns.d.ts +0 -2
- package/build/plugins/d3/examples/bar-x/StackedColumns.js +0 -47
- package/build/plugins/d3/examples/bar-x/TwoYAxis.d.ts +0 -2
- package/build/plugins/d3/examples/bar-x/TwoYAxis.js +0 -58
- package/build/plugins/d3/examples/bar-y/Basic.d.ts +0 -2
- package/build/plugins/d3/examples/bar-y/Basic.js +0 -45
- package/build/plugins/d3/examples/bar-y/GroupedColumns.d.ts +0 -2
- package/build/plugins/d3/examples/bar-y/GroupedColumns.js +0 -50
- package/build/plugins/d3/examples/bar-y/NegativeValues.d.ts +0 -2
- package/build/plugins/d3/examples/bar-y/NegativeValues.js +0 -40
- package/build/plugins/d3/examples/bar-y/PercentStacking.d.ts +0 -2
- package/build/plugins/d3/examples/bar-y/PercentStacking.js +0 -49
- package/build/plugins/d3/examples/bar-y/StackedColumns.d.ts +0 -2
- package/build/plugins/d3/examples/bar-y/StackedColumns.js +0 -49
- package/build/plugins/d3/examples/combined/LineAndBarX.d.ts +0 -2
- package/build/plugins/d3/examples/combined/LineAndBarX.js +0 -63
- package/build/plugins/d3/examples/line/Basic.d.ts +0 -2
- package/build/plugins/d3/examples/line/Basic.js +0 -68
- package/build/plugins/d3/examples/line/DataLabels.d.ts +0 -2
- package/build/plugins/d3/examples/line/DataLabels.js +0 -91
- package/build/plugins/d3/examples/line/LineWithMarkers.d.ts +0 -2
- package/build/plugins/d3/examples/line/LineWithMarkers.js +0 -69
- package/build/plugins/d3/examples/line/LogarithmicAxis.d.ts +0 -2
- package/build/plugins/d3/examples/line/LogarithmicAxis.js +0 -38
- package/build/plugins/d3/examples/line/Shapes.d.ts +0 -2
- package/build/plugins/d3/examples/line/Shapes.js +0 -93
- package/build/plugins/d3/examples/line/TwoYAxis.d.ts +0 -2
- package/build/plugins/d3/examples/line/TwoYAxis.js +0 -58
- package/build/plugins/d3/examples/mars-weather.d.ts +0 -13
- package/build/plugins/d3/examples/mars-weather.js +0 -1203
- package/build/plugins/d3/examples/nintendoGames.d.ts +0 -92
- package/build/plugins/d3/examples/nintendoGames.js +0 -12264
- package/build/plugins/d3/examples/pie/Basic.d.ts +0 -2
- package/build/plugins/d3/examples/pie/Basic.js +0 -32
- package/build/plugins/d3/examples/pie/Donut.d.ts +0 -2
- package/build/plugins/d3/examples/pie/Donut.js +0 -33
- package/build/plugins/d3/examples/pie/DonutWithTotals.d.ts +0 -2
- package/build/plugins/d3/examples/pie/DonutWithTotals.js +0 -36
- package/build/plugins/d3/examples/scatter/Basic.d.ts +0 -2
- package/build/plugins/d3/examples/scatter/Basic.js +0 -47
- package/build/plugins/d3/examples/scatter/TwoYAxis.d.ts +0 -2
- package/build/plugins/d3/examples/scatter/TwoYAxis.js +0 -58
- package/build/plugins/d3/renderer/components/AxisX.d.ts +0 -19
- package/build/plugins/d3/renderer/components/AxisX.js +0 -108
- package/build/plugins/d3/renderer/components/AxisY.d.ts +0 -11
- package/build/plugins/d3/renderer/components/AxisY.js +0 -199
- package/build/plugins/d3/renderer/components/Chart.d.ts +0 -10
- package/build/plugins/d3/renderer/components/Chart.js +0 -145
- package/build/plugins/d3/renderer/components/Legend.d.ts +0 -12
- package/build/plugins/d3/renderer/components/Legend.js +0 -278
- package/build/plugins/d3/renderer/components/PlotTitle.d.ts +0 -7
- package/build/plugins/d3/renderer/components/PlotTitle.js +0 -12
- package/build/plugins/d3/renderer/components/Title.d.ts +0 -7
- package/build/plugins/d3/renderer/components/Title.js +0 -8
- package/build/plugins/d3/renderer/components/Tooltip/DefaultContent.d.ts +0 -10
- package/build/plugins/d3/renderer/components/Tooltip/DefaultContent.js +0 -102
- package/build/plugins/d3/renderer/components/Tooltip/index.d.ts +0 -12
- package/build/plugins/d3/renderer/components/Tooltip/index.js +0 -28
- package/build/plugins/d3/renderer/components/index.d.ts +0 -1
- package/build/plugins/d3/renderer/components/index.js +0 -1
- package/build/plugins/d3/renderer/components/styles.css +0 -140
- package/build/plugins/d3/renderer/constants/defaults/axis.d.ts +0 -14
- package/build/plugins/d3/renderer/constants/defaults/axis.js +0 -18
- package/build/plugins/d3/renderer/constants/defaults/index.d.ts +0 -3
- package/build/plugins/d3/renderer/constants/defaults/index.js +0 -3
- package/build/plugins/d3/renderer/constants/defaults/legend.d.ts +0 -12
- package/build/plugins/d3/renderer/constants/defaults/legend.js +0 -12
- package/build/plugins/d3/renderer/constants/defaults/series-options.d.ts +0 -24
- package/build/plugins/d3/renderer/constants/defaults/series-options.js +0 -106
- package/build/plugins/d3/renderer/constants/index.d.ts +0 -3
- package/build/plugins/d3/renderer/constants/index.js +0 -24
- package/build/plugins/d3/renderer/d3-dispatcher.d.ts +0 -1
- package/build/plugins/d3/renderer/d3-dispatcher.js +0 -4
- package/build/plugins/d3/renderer/hooks/index.d.ts +0 -10
- package/build/plugins/d3/renderer/hooks/index.js +0 -10
- package/build/plugins/d3/renderer/hooks/useAxisScales/index.d.ts +0 -25
- package/build/plugins/d3/renderer/hooks/useAxisScales/index.js +0 -183
- package/build/plugins/d3/renderer/hooks/useChartDimensions/index.d.ts +0 -16
- package/build/plugins/d3/renderer/hooks/useChartDimensions/index.js +0 -34
- package/build/plugins/d3/renderer/hooks/useChartDimensions/utils.d.ts +0 -10
- package/build/plugins/d3/renderer/hooks/useChartDimensions/utils.js +0 -32
- package/build/plugins/d3/renderer/hooks/useChartOptions/chart.d.ts +0 -6
- package/build/plugins/d3/renderer/hooks/useChartOptions/chart.js +0 -28
- package/build/plugins/d3/renderer/hooks/useChartOptions/index.d.ts +0 -7
- package/build/plugins/d3/renderer/hooks/useChartOptions/index.js +0 -21
- package/build/plugins/d3/renderer/hooks/useChartOptions/title.d.ts +0 -5
- package/build/plugins/d3/renderer/hooks/useChartOptions/title.js +0 -18
- package/build/plugins/d3/renderer/hooks/useChartOptions/tooltip.d.ts +0 -5
- package/build/plugins/d3/renderer/hooks/useChartOptions/tooltip.js +0 -5
- package/build/plugins/d3/renderer/hooks/useChartOptions/types.d.ts +0 -47
- package/build/plugins/d3/renderer/hooks/useChartOptions/x-axis.d.ts +0 -7
- package/build/plugins/d3/renderer/hooks/useChartOptions/x-axis.js +0 -114
- package/build/plugins/d3/renderer/hooks/useChartOptions/y-axis.d.ts +0 -7
- package/build/plugins/d3/renderer/hooks/useChartOptions/y-axis.js +0 -116
- package/build/plugins/d3/renderer/hooks/useSeries/constants.d.ts +0 -8
- package/build/plugins/d3/renderer/hooks/useSeries/constants.js +0 -19
- package/build/plugins/d3/renderer/hooks/useSeries/index.d.ts +0 -29
- package/build/plugins/d3/renderer/hooks/useSeries/index.js +0 -82
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-area.d.ts +0 -19
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-area.js +0 -63
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-x.d.ts +0 -10
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-x.js +0 -38
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-y.d.ts +0 -10
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-bar-y.js +0 -49
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-legend.d.ts +0 -27
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-legend.js +0 -144
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-line.d.ts +0 -22
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-line.js +0 -82
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-options.d.ts +0 -3
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-options.js +0 -5
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-pie.d.ts +0 -9
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-pie.js +0 -62
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-scatter.d.ts +0 -11
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-scatter.js +0 -47
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-treemap.d.ts +0 -11
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-treemap.js +0 -38
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-waterfall.d.ts +0 -10
- package/build/plugins/d3/renderer/hooks/useSeries/prepare-waterfall.js +0 -37
- package/build/plugins/d3/renderer/hooks/useSeries/prepareSeries.d.ts +0 -10
- package/build/plugins/d3/renderer/hooks/useSeries/prepareSeries.js +0 -65
- package/build/plugins/d3/renderer/hooks/useSeries/types.d.ts +0 -254
- package/build/plugins/d3/renderer/hooks/useSeries/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useSeries/utils.d.ts +0 -7
- package/build/plugins/d3/renderer/hooks/useSeries/utils.js +0 -33
- package/build/plugins/d3/renderer/hooks/useShapes/HtmlLayer.d.ts +0 -8
- package/build/plugins/d3/renderer/hooks/useShapes/HtmlLayer.js +0 -22
- package/build/plugins/d3/renderer/hooks/useShapes/area/index.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/area/index.js +0 -144
- package/build/plugins/d3/renderer/hooks/useShapes/area/prepare-data.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/area/prepare-data.js +0 -158
- package/build/plugins/d3/renderer/hooks/useShapes/area/types.d.ts +0 -28
- package/build/plugins/d3/renderer/hooks/useShapes/area/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/index.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/index.js +0 -96
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/prepare-data.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/prepare-data.js +0 -160
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/types.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useShapes/bar-x/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/index.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/index.js +0 -84
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/prepare-data.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/prepare-data.js +0 -169
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/types.d.ts +0 -14
- package/build/plugins/d3/renderer/hooks/useShapes/bar-y/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useShapes/constants.d.ts +0 -3
- package/build/plugins/d3/renderer/hooks/useShapes/constants.js +0 -3
- package/build/plugins/d3/renderer/hooks/useShapes/index.d.ts +0 -33
- package/build/plugins/d3/renderer/hooks/useShapes/index.js +0 -153
- package/build/plugins/d3/renderer/hooks/useShapes/line/index.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/line/index.js +0 -131
- package/build/plugins/d3/renderer/hooks/useShapes/line/prepare-data.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useShapes/line/prepare-data.js +0 -91
- package/build/plugins/d3/renderer/hooks/useShapes/line/types.d.ts +0 -30
- package/build/plugins/d3/renderer/hooks/useShapes/line/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useShapes/marker.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useShapes/marker.js +0 -76
- package/build/plugins/d3/renderer/hooks/useShapes/pie/index.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useShapes/pie/index.js +0 -172
- package/build/plugins/d3/renderer/hooks/useShapes/pie/prepare-data.d.ts +0 -9
- package/build/plugins/d3/renderer/hooks/useShapes/pie/prepare-data.js +0 -186
- package/build/plugins/d3/renderer/hooks/useShapes/pie/types.d.ts +0 -42
- package/build/plugins/d3/renderer/hooks/useShapes/pie/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useShapes/pie/utils.d.ts +0 -4
- package/build/plugins/d3/renderer/hooks/useShapes/pie/utils.js +0 -15
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/index.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/index.js +0 -69
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/prepare-data.d.ts +0 -11
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/prepare-data.js +0 -31
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/types.d.ts +0 -18
- package/build/plugins/d3/renderer/hooks/useShapes/scatter/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useShapes/styles.css +0 -36
- package/build/plugins/d3/renderer/hooks/useShapes/treemap/index.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/treemap/index.js +0 -99
- package/build/plugins/d3/renderer/hooks/useShapes/treemap/prepare-data.d.ts +0 -7
- package/build/plugins/d3/renderer/hooks/useShapes/treemap/prepare-data.js +0 -114
- package/build/plugins/d3/renderer/hooks/useShapes/treemap/types.d.ts +0 -17
- package/build/plugins/d3/renderer/hooks/useShapes/treemap/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useShapes/utils.d.ts +0 -29
- package/build/plugins/d3/renderer/hooks/useShapes/utils.js +0 -53
- package/build/plugins/d3/renderer/hooks/useShapes/waterfall/index.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useShapes/waterfall/index.js +0 -128
- package/build/plugins/d3/renderer/hooks/useShapes/waterfall/prepare-data.d.ts +0 -12
- package/build/plugins/d3/renderer/hooks/useShapes/waterfall/prepare-data.js +0 -133
- package/build/plugins/d3/renderer/hooks/useShapes/waterfall/types.d.ts +0 -15
- package/build/plugins/d3/renderer/hooks/useShapes/waterfall/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useSplit/index.d.ts +0 -14
- package/build/plugins/d3/renderer/hooks/useSplit/index.js +0 -57
- package/build/plugins/d3/renderer/hooks/useSplit/types.d.ts +0 -17
- package/build/plugins/d3/renderer/hooks/useSplit/types.js +0 -1
- package/build/plugins/d3/renderer/hooks/useTooltip/index.d.ts +0 -13
- package/build/plugins/d3/renderer/hooks/useTooltip/index.js +0 -17
- package/build/plugins/d3/renderer/hooks/useTooltip/types.d.ts +0 -1
- package/build/plugins/d3/renderer/hooks/useTooltip/types.js +0 -1
- package/build/plugins/d3/renderer/types/index.d.ts +0 -24
- package/build/plugins/d3/renderer/types/index.js +0 -1
- package/build/plugins/d3/renderer/utils/axis-generators/bottom.d.ts +0 -24
- package/build/plugins/d3/renderer/utils/axis-generators/bottom.js +0 -126
- package/build/plugins/d3/renderer/utils/axis-generators/index.d.ts +0 -1
- package/build/plugins/d3/renderer/utils/axis-generators/index.js +0 -1
- package/build/plugins/d3/renderer/utils/axis.d.ts +0 -31
- package/build/plugins/d3/renderer/utils/axis.js +0 -71
- package/build/plugins/d3/renderer/utils/color.d.ts +0 -10
- package/build/plugins/d3/renderer/utils/color.js +0 -43
- package/build/plugins/d3/renderer/utils/get-closest-data.d.ts +0 -15
- package/build/plugins/d3/renderer/utils/get-closest-data.js +0 -172
- package/build/plugins/d3/renderer/utils/index.d.ts +0 -78
- package/build/plugins/d3/renderer/utils/index.js +0 -211
- package/build/plugins/d3/renderer/utils/labels.d.ts +0 -6
- package/build/plugins/d3/renderer/utils/labels.js +0 -44
- package/build/plugins/d3/renderer/utils/legend.d.ts +0 -8
- package/build/plugins/d3/renderer/utils/legend.js +0 -23
- package/build/plugins/d3/renderer/utils/math.d.ts +0 -25
- package/build/plugins/d3/renderer/utils/math.js +0 -51
- package/build/plugins/d3/renderer/utils/series/index.d.ts +0 -1
- package/build/plugins/d3/renderer/utils/series/index.js +0 -1
- package/build/plugins/d3/renderer/utils/series/waterfall.d.ts +0 -4
- package/build/plugins/d3/renderer/utils/series/waterfall.js +0 -25
- package/build/plugins/d3/renderer/utils/symbol.d.ts +0 -3
- package/build/plugins/d3/renderer/utils/symbol.js +0 -36
- package/build/plugins/d3/renderer/utils/text.d.ts +0 -29
- package/build/plugins/d3/renderer/utils/text.js +0 -139
- package/build/plugins/d3/renderer/utils/time.d.ts +0 -3
- package/build/plugins/d3/renderer/utils/time.js +0 -34
- package/build/plugins/d3/renderer/validation/__mocks__/index.d.ts +0 -3
- package/build/plugins/d3/renderer/validation/__mocks__/index.js +0 -44
- package/build/plugins/d3/renderer/validation/index.d.ts +0 -2
- package/build/plugins/d3/renderer/validation/index.js +0 -221
- package/build/plugins/d3/utils/index.d.ts +0 -4
- package/build/plugins/d3/utils/index.js +0 -4
- package/build/plugins/d3/utils/pie-center-text.d.ts +0 -7
- package/build/plugins/d3/utils/pie-center-text.js +0 -23
- /package/build/{plugins/d3/renderer/hooks/useChartOptions → components/SplitPane}/types.js +0 -0
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import get from 'lodash/get';
|
|
2
|
-
import { getXValue, getYValue } from '../utils';
|
|
3
|
-
const getFilteredLinearScatterData = (data) => {
|
|
4
|
-
return data.filter((d) => typeof d.x === 'number' && typeof d.y === 'number');
|
|
5
|
-
};
|
|
6
|
-
export const prepareScatterData = (args) => {
|
|
7
|
-
const { series, xAxis, xScale, yAxis, yScale } = args;
|
|
8
|
-
return series.reduce((acc, s) => {
|
|
9
|
-
const yAxisIndex = get(s, 'yAxis', 0);
|
|
10
|
-
const seriesYAxis = yAxis[yAxisIndex];
|
|
11
|
-
const seriesYScale = yScale[yAxisIndex];
|
|
12
|
-
const filteredData = xAxis.type === 'category' || seriesYAxis.type === 'category'
|
|
13
|
-
? s.data
|
|
14
|
-
: getFilteredLinearScatterData(s.data);
|
|
15
|
-
filteredData.forEach((d) => {
|
|
16
|
-
acc.push({
|
|
17
|
-
point: {
|
|
18
|
-
data: d,
|
|
19
|
-
series: s,
|
|
20
|
-
x: getXValue({ point: d, xAxis, xScale }),
|
|
21
|
-
y: getYValue({ point: d, yAxis: seriesYAxis, yScale: seriesYScale }),
|
|
22
|
-
opacity: get(d, 'opacity', null),
|
|
23
|
-
},
|
|
24
|
-
hovered: false,
|
|
25
|
-
active: true,
|
|
26
|
-
htmlElements: [],
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
return acc;
|
|
30
|
-
}, []);
|
|
31
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { ScatterSeriesData } from '../../../../../../types';
|
|
2
|
-
import { HtmlItem } from '../../../types';
|
|
3
|
-
import { PreparedScatterSeries } from '../../useSeries/types';
|
|
4
|
-
type PointData = {
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
opacity: number | null;
|
|
8
|
-
data: ScatterSeriesData;
|
|
9
|
-
series: PreparedScatterSeries;
|
|
10
|
-
};
|
|
11
|
-
export type MarkerData = {
|
|
12
|
-
point: PointData;
|
|
13
|
-
active: boolean;
|
|
14
|
-
hovered: boolean;
|
|
15
|
-
htmlElements: HtmlItem[];
|
|
16
|
-
};
|
|
17
|
-
export type PreparedScatterData = MarkerData;
|
|
18
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
.chartkit-d3-scatter__point {
|
|
2
|
-
stroke-width: 1px;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.chartkit-d3-pie__segment {
|
|
6
|
-
stroke: var(--g-color-base-background);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.chartkit-d3-pie__label {
|
|
10
|
-
fill: var(--g-color-text-complementary);
|
|
11
|
-
font-size: 11px;
|
|
12
|
-
font-weight: bold;
|
|
13
|
-
alignment-baseline: before-edge;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.chartkit-d3-bar-x__label {
|
|
17
|
-
fill: var(--g-color-text-complementary);
|
|
18
|
-
user-select: none;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.chartkit-d3-bar-y__label {
|
|
22
|
-
fill: var(--g-color-text-complementary);
|
|
23
|
-
user-select: none;
|
|
24
|
-
alignment-baseline: after-edge;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.chartkit-d3-treemap__label {
|
|
28
|
-
fill: var(--g-color-text-complementary);
|
|
29
|
-
alignment-baseline: text-before-edge;
|
|
30
|
-
user-select: none;
|
|
31
|
-
pointer-events: none;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.chartkit-d3-waterfall__connector {
|
|
35
|
-
stroke: var(--g-color-line-generic-active);
|
|
36
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Dispatch } from 'd3';
|
|
3
|
-
import { PreparedSeriesOptions } from '../../useSeries/types';
|
|
4
|
-
import type { PreparedTreemapData } from './types';
|
|
5
|
-
type ShapeProps = {
|
|
6
|
-
dispatcher: Dispatch<object>;
|
|
7
|
-
preparedData: PreparedTreemapData;
|
|
8
|
-
seriesOptions: PreparedSeriesOptions;
|
|
9
|
-
htmlLayout: HTMLElement | null;
|
|
10
|
-
};
|
|
11
|
-
export declare const TreemapSeriesShape: (props: ShapeProps) => React.JSX.Element;
|
|
12
|
-
export {};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { color, select } from 'd3';
|
|
3
|
-
import get from 'lodash/get';
|
|
4
|
-
import { block } from '../../../../../../utils/cn';
|
|
5
|
-
import { setEllipsisForOverflowTexts } from '../../../utils';
|
|
6
|
-
import { HtmlLayer } from '../HtmlLayer';
|
|
7
|
-
const b = block('d3-treemap');
|
|
8
|
-
export const TreemapSeriesShape = (props) => {
|
|
9
|
-
const { dispatcher, preparedData, seriesOptions, htmlLayout } = props;
|
|
10
|
-
const ref = React.useRef(null);
|
|
11
|
-
React.useEffect(() => {
|
|
12
|
-
if (!ref.current) {
|
|
13
|
-
return () => { };
|
|
14
|
-
}
|
|
15
|
-
const svgElement = select(ref.current);
|
|
16
|
-
svgElement.selectAll('*').remove();
|
|
17
|
-
const { labelData, leaves, series } = preparedData;
|
|
18
|
-
const leaf = svgElement
|
|
19
|
-
.selectAll('g')
|
|
20
|
-
.data(leaves)
|
|
21
|
-
.join('g')
|
|
22
|
-
.attr('transform', (d) => `translate(${d.x0},${d.y0})`)
|
|
23
|
-
.attr('cursor', series.cursor);
|
|
24
|
-
const rectSelection = leaf
|
|
25
|
-
.append('rect')
|
|
26
|
-
.attr('id', (d) => d.id || d.name)
|
|
27
|
-
.attr('fill', (d) => {
|
|
28
|
-
var _a;
|
|
29
|
-
if (d.data.color) {
|
|
30
|
-
return d.data.color;
|
|
31
|
-
}
|
|
32
|
-
const levelOptions = (_a = series.levels) === null || _a === void 0 ? void 0 : _a.find((l) => l.index === d.depth);
|
|
33
|
-
return (levelOptions === null || levelOptions === void 0 ? void 0 : levelOptions.color) || series.color;
|
|
34
|
-
})
|
|
35
|
-
.attr('width', (d) => d.x1 - d.x0)
|
|
36
|
-
.attr('height', (d) => d.y1 - d.y0);
|
|
37
|
-
const labelSelection = svgElement
|
|
38
|
-
.selectAll('tspan')
|
|
39
|
-
.data(labelData)
|
|
40
|
-
.join('text')
|
|
41
|
-
.text((d) => d.text)
|
|
42
|
-
.attr('class', b('label'))
|
|
43
|
-
.attr('x', (d) => d.x)
|
|
44
|
-
.attr('y', (d) => d.y)
|
|
45
|
-
.style('font-size', () => series.dataLabels.style.fontSize)
|
|
46
|
-
.style('font-weight', () => { var _a; return ((_a = series.dataLabels.style) === null || _a === void 0 ? void 0 : _a.fontWeight) || null; })
|
|
47
|
-
.style('fill', () => { var _a; return ((_a = series.dataLabels.style) === null || _a === void 0 ? void 0 : _a.fontColor) || null; })
|
|
48
|
-
.call(setEllipsisForOverflowTexts, (d) => d.width);
|
|
49
|
-
const eventName = `hover-shape.treemap`;
|
|
50
|
-
const hoverOptions = get(seriesOptions, 'treemap.states.hover');
|
|
51
|
-
const inactiveOptions = get(seriesOptions, 'treemap.states.inactive');
|
|
52
|
-
dispatcher.on(eventName, (data) => {
|
|
53
|
-
var _a;
|
|
54
|
-
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
55
|
-
const inactiveEnabled = inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled;
|
|
56
|
-
const hoveredData = (_a = data === null || data === void 0 ? void 0 : data[0]) === null || _a === void 0 ? void 0 : _a.data;
|
|
57
|
-
rectSelection.datum((d, index, list) => {
|
|
58
|
-
const currentRect = select(list[index]);
|
|
59
|
-
const hovered = Boolean(hoverEnabled && hoveredData === d.data);
|
|
60
|
-
const inactive = Boolean(inactiveEnabled && hoveredData && !hovered);
|
|
61
|
-
currentRect
|
|
62
|
-
.attr('fill', (currentD) => {
|
|
63
|
-
var _a, _b;
|
|
64
|
-
const levelOptions = (_a = series.levels) === null || _a === void 0 ? void 0 : _a.find((l) => l.index === currentD.depth);
|
|
65
|
-
const initialColor = (levelOptions === null || levelOptions === void 0 ? void 0 : levelOptions.color) || d.data.color || series.color;
|
|
66
|
-
if (hovered) {
|
|
67
|
-
return (((_b = color(initialColor)) === null || _b === void 0 ? void 0 : _b.brighter(hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.brightness).toString()) || initialColor);
|
|
68
|
-
}
|
|
69
|
-
return initialColor;
|
|
70
|
-
})
|
|
71
|
-
.attr('opacity', () => {
|
|
72
|
-
if (inactive) {
|
|
73
|
-
return (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.opacity) || null;
|
|
74
|
-
}
|
|
75
|
-
return null;
|
|
76
|
-
});
|
|
77
|
-
return d;
|
|
78
|
-
});
|
|
79
|
-
labelSelection.datum((d, index, list) => {
|
|
80
|
-
const currentLabel = select(list[index]);
|
|
81
|
-
const hovered = Boolean(hoverEnabled && hoveredData === d.nodeData);
|
|
82
|
-
const inactive = Boolean(inactiveEnabled && hoveredData && !hovered);
|
|
83
|
-
currentLabel.attr('opacity', () => {
|
|
84
|
-
if (inactive) {
|
|
85
|
-
return (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.opacity) || null;
|
|
86
|
-
}
|
|
87
|
-
return null;
|
|
88
|
-
});
|
|
89
|
-
return d;
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
return () => {
|
|
93
|
-
dispatcher.on(eventName, null);
|
|
94
|
-
};
|
|
95
|
-
}, [dispatcher, preparedData, seriesOptions]);
|
|
96
|
-
return (React.createElement(React.Fragment, null,
|
|
97
|
-
React.createElement("g", { ref: ref, className: b() }),
|
|
98
|
-
React.createElement(HtmlLayer, { preparedData: preparedData, htmlLayout: htmlLayout })));
|
|
99
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { PreparedTreemapSeries } from '../../useSeries/types';
|
|
2
|
-
import type { PreparedTreemapData } from './types';
|
|
3
|
-
export declare function prepareTreemapData(args: {
|
|
4
|
-
series: PreparedTreemapSeries;
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
}): PreparedTreemapData;
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { stratify, treemap, treemapBinary, treemapDice, treemapSlice, treemapSliceDice, treemapSquarify, } from 'd3';
|
|
2
|
-
import { LayoutAlgorithm } from '../../../../../../constants';
|
|
3
|
-
import { getLabelsSize } from '../../../utils';
|
|
4
|
-
const DEFAULT_PADDING = 1;
|
|
5
|
-
function getLabels(args) {
|
|
6
|
-
const { data, html, padding, align } = args;
|
|
7
|
-
return data.reduce((acc, d) => {
|
|
8
|
-
const texts = Array.isArray(d.data.name) ? d.data.name : [d.data.name];
|
|
9
|
-
texts.forEach((text, index) => {
|
|
10
|
-
var _a;
|
|
11
|
-
const { maxHeight: lineHeight, maxWidth: labelWidth } = (_a = getLabelsSize({ labels: [text], html })) !== null && _a !== void 0 ? _a : {};
|
|
12
|
-
const left = d.x0 + padding;
|
|
13
|
-
const right = d.x1 - padding;
|
|
14
|
-
const width = Math.max(0, right - left);
|
|
15
|
-
let x = left;
|
|
16
|
-
const y = index * lineHeight + d.y0 + padding;
|
|
17
|
-
switch (align) {
|
|
18
|
-
case 'left': {
|
|
19
|
-
x = left;
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
case 'center': {
|
|
23
|
-
x = Math.max(left, left + (width - labelWidth) / 2);
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
case 'right': {
|
|
27
|
-
x = Math.max(left, right - labelWidth);
|
|
28
|
-
break;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
const item = html
|
|
32
|
-
? {
|
|
33
|
-
content: text,
|
|
34
|
-
x,
|
|
35
|
-
y,
|
|
36
|
-
}
|
|
37
|
-
: {
|
|
38
|
-
text,
|
|
39
|
-
x,
|
|
40
|
-
y,
|
|
41
|
-
width,
|
|
42
|
-
nodeData: d.data,
|
|
43
|
-
};
|
|
44
|
-
acc.push(item);
|
|
45
|
-
});
|
|
46
|
-
return acc;
|
|
47
|
-
}, []);
|
|
48
|
-
}
|
|
49
|
-
export function prepareTreemapData(args) {
|
|
50
|
-
var _a;
|
|
51
|
-
const { series, width, height } = args;
|
|
52
|
-
const dataWithRootNode = getSeriesDataWithRootNode(series);
|
|
53
|
-
const hierarchy = stratify()
|
|
54
|
-
.id((d) => {
|
|
55
|
-
if (d.id) {
|
|
56
|
-
return d.id;
|
|
57
|
-
}
|
|
58
|
-
return Array.isArray(d.name) ? d.name.join() : d.name;
|
|
59
|
-
})
|
|
60
|
-
.parentId((d) => d.parentId)(dataWithRootNode)
|
|
61
|
-
.sum((d) => d.value || 0);
|
|
62
|
-
const treemapInstance = treemap();
|
|
63
|
-
switch (series.layoutAlgorithm) {
|
|
64
|
-
case LayoutAlgorithm.Binary: {
|
|
65
|
-
treemapInstance.tile(treemapBinary);
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
case LayoutAlgorithm.Dice: {
|
|
69
|
-
treemapInstance.tile(treemapDice);
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
case LayoutAlgorithm.Slice: {
|
|
73
|
-
treemapInstance.tile(treemapSlice);
|
|
74
|
-
break;
|
|
75
|
-
}
|
|
76
|
-
case LayoutAlgorithm.SliceDice: {
|
|
77
|
-
treemapInstance.tile(treemapSliceDice);
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
case LayoutAlgorithm.Squarify: {
|
|
81
|
-
treemapInstance.tile(treemapSquarify);
|
|
82
|
-
break;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
const root = treemapInstance.size([width, height]).paddingInner((d) => {
|
|
86
|
-
var _a, _b;
|
|
87
|
-
const levelOptions = (_a = series.levels) === null || _a === void 0 ? void 0 : _a.find((l) => l.index === d.depth + 1);
|
|
88
|
-
return (_b = levelOptions === null || levelOptions === void 0 ? void 0 : levelOptions.padding) !== null && _b !== void 0 ? _b : DEFAULT_PADDING;
|
|
89
|
-
})(hierarchy);
|
|
90
|
-
const leaves = root.leaves();
|
|
91
|
-
let labelData = [];
|
|
92
|
-
const htmlElements = [];
|
|
93
|
-
if ((_a = series.dataLabels) === null || _a === void 0 ? void 0 : _a.enabled) {
|
|
94
|
-
const { html, padding, align } = series.dataLabels;
|
|
95
|
-
const labels = getLabels({ html, padding, align, data: leaves });
|
|
96
|
-
if (html) {
|
|
97
|
-
htmlElements.push(...labels);
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
labelData = labels;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return { labelData, leaves, series, htmlElements };
|
|
104
|
-
}
|
|
105
|
-
function getSeriesDataWithRootNode(series) {
|
|
106
|
-
return series.data.reduce((acc, d) => {
|
|
107
|
-
const dataChunk = Object.assign({}, d);
|
|
108
|
-
if (!dataChunk.parentId) {
|
|
109
|
-
dataChunk.parentId = series.id;
|
|
110
|
-
}
|
|
111
|
-
acc.push(dataChunk);
|
|
112
|
-
return acc;
|
|
113
|
-
}, [{ name: series.name, id: series.id }]);
|
|
114
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { HierarchyRectangularNode } from 'd3';
|
|
2
|
-
import type { TreemapSeriesData } from '../../../../../../types';
|
|
3
|
-
import { HtmlItem } from '../../../types';
|
|
4
|
-
import type { PreparedTreemapSeries } from '../../useSeries/types';
|
|
5
|
-
export type TreemapLabelData = {
|
|
6
|
-
text: string;
|
|
7
|
-
x: number;
|
|
8
|
-
y: number;
|
|
9
|
-
width: number;
|
|
10
|
-
nodeData: TreemapSeriesData;
|
|
11
|
-
};
|
|
12
|
-
export type PreparedTreemapData = {
|
|
13
|
-
labelData: TreemapLabelData[];
|
|
14
|
-
leaves: HierarchyRectangularNode<TreemapSeriesData<any>>[];
|
|
15
|
-
series: PreparedTreemapSeries;
|
|
16
|
-
htmlElements: HtmlItem[];
|
|
17
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { BaseType } from 'd3';
|
|
2
|
-
import { DashStyle } from '../../../../../constants';
|
|
3
|
-
import type { BasicInactiveState } from '../../../../../types';
|
|
4
|
-
import type { ChartScale } from '../useAxisScales';
|
|
5
|
-
import type { PreparedAxis } from '../useChartOptions/types';
|
|
6
|
-
export declare function getXValue(args: {
|
|
7
|
-
point: {
|
|
8
|
-
x?: number | string;
|
|
9
|
-
};
|
|
10
|
-
xAxis: PreparedAxis;
|
|
11
|
-
xScale: ChartScale;
|
|
12
|
-
}): number;
|
|
13
|
-
export declare function getYValue(args: {
|
|
14
|
-
point: {
|
|
15
|
-
y?: number | string;
|
|
16
|
-
};
|
|
17
|
-
yAxis: PreparedAxis;
|
|
18
|
-
yScale: ChartScale;
|
|
19
|
-
}): number;
|
|
20
|
-
export declare const shapeKey: (d: unknown) => string | -1;
|
|
21
|
-
export declare function setActiveState<T extends {
|
|
22
|
-
active?: boolean;
|
|
23
|
-
}>(args: {
|
|
24
|
-
element: BaseType;
|
|
25
|
-
datum: T;
|
|
26
|
-
state: BasicInactiveState | undefined;
|
|
27
|
-
active: boolean;
|
|
28
|
-
}): T;
|
|
29
|
-
export declare const getLineDashArray: (dashStyle: DashStyle, strokeWidth?: number) => string;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { select } from 'd3';
|
|
2
|
-
import get from 'lodash/get';
|
|
3
|
-
import { getDataCategoryValue } from '../../utils';
|
|
4
|
-
export function getXValue(args) {
|
|
5
|
-
const { point, xAxis, xScale } = args;
|
|
6
|
-
if (xAxis.type === 'category') {
|
|
7
|
-
const xBandScale = xScale;
|
|
8
|
-
const categories = get(xAxis, 'categories', []);
|
|
9
|
-
const dataCategory = getDataCategoryValue({ axisDirection: 'x', categories, data: point });
|
|
10
|
-
return (xBandScale(dataCategory) || 0) + xBandScale.step() / 2;
|
|
11
|
-
}
|
|
12
|
-
const xLinearScale = xScale;
|
|
13
|
-
return xLinearScale(point.x);
|
|
14
|
-
}
|
|
15
|
-
export function getYValue(args) {
|
|
16
|
-
const { point, yAxis, yScale } = args;
|
|
17
|
-
if (yAxis.type === 'category') {
|
|
18
|
-
const yBandScale = yScale;
|
|
19
|
-
const categories = get(yAxis, 'categories', []);
|
|
20
|
-
const dataCategory = getDataCategoryValue({ axisDirection: 'y', categories, data: point });
|
|
21
|
-
return (yBandScale(dataCategory) || 0) + yBandScale.step() / 2;
|
|
22
|
-
}
|
|
23
|
-
const yLinearScale = yScale;
|
|
24
|
-
return yLinearScale(point.y);
|
|
25
|
-
}
|
|
26
|
-
export const shapeKey = (d) => d.id || -1;
|
|
27
|
-
export function setActiveState(args) {
|
|
28
|
-
const { element, datum, state, active } = args;
|
|
29
|
-
const elementSelection = select(element);
|
|
30
|
-
if (datum.active !== active) {
|
|
31
|
-
datum.active = active;
|
|
32
|
-
const opacity = datum.active ? null : state === null || state === void 0 ? void 0 : state.opacity;
|
|
33
|
-
elementSelection.attr('opacity', opacity || null);
|
|
34
|
-
}
|
|
35
|
-
return datum;
|
|
36
|
-
}
|
|
37
|
-
export const getLineDashArray = (dashStyle, strokeWidth = 2) => {
|
|
38
|
-
const value = dashStyle.toLowerCase();
|
|
39
|
-
const arrayValue = value
|
|
40
|
-
.replace('shortdashdotdot', '3,1,1,1,1,1,')
|
|
41
|
-
.replace('shortdashdot', '3,1,1,1')
|
|
42
|
-
.replace('shortdot', '1,1,')
|
|
43
|
-
.replace('shortdash', '3,1,')
|
|
44
|
-
.replace('longdash', '8,3,')
|
|
45
|
-
.replace(/dot/g, '1,3,')
|
|
46
|
-
.replace('dash', '4,3,')
|
|
47
|
-
.replace(/,$/, '')
|
|
48
|
-
.split(',')
|
|
49
|
-
.map((part) => {
|
|
50
|
-
return `${parseInt(part, 10) * strokeWidth}`;
|
|
51
|
-
});
|
|
52
|
-
return arrayValue.join(',').replace(/NaN/g, 'none');
|
|
53
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Dispatch } from 'd3';
|
|
3
|
-
import type { PreparedSeriesOptions } from '../../useSeries/types';
|
|
4
|
-
import type { PreparedWaterfallData } from './types';
|
|
5
|
-
export { prepareWaterfallData } from './prepare-data';
|
|
6
|
-
export * from './types';
|
|
7
|
-
type Args = {
|
|
8
|
-
dispatcher: Dispatch<object>;
|
|
9
|
-
preparedData: PreparedWaterfallData[];
|
|
10
|
-
seriesOptions: PreparedSeriesOptions;
|
|
11
|
-
htmlLayout: HTMLElement | null;
|
|
12
|
-
};
|
|
13
|
-
export declare const WaterfallSeriesShapes: (args: Args) => React.JSX.Element;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { color, line as lineGenerator, select } from 'd3';
|
|
3
|
-
import get from 'lodash/get';
|
|
4
|
-
import { DashStyle } from '../../../../../../constants';
|
|
5
|
-
import { block } from '../../../../../../utils/cn';
|
|
6
|
-
import { filterOverlappingLabels, getWaterfallPointColor } from '../../../utils';
|
|
7
|
-
import { HtmlLayer } from '../HtmlLayer';
|
|
8
|
-
import { getLineDashArray } from '../utils';
|
|
9
|
-
export { prepareWaterfallData } from './prepare-data';
|
|
10
|
-
export * from './types';
|
|
11
|
-
const b = block('d3-waterfall');
|
|
12
|
-
export const WaterfallSeriesShapes = (args) => {
|
|
13
|
-
const { dispatcher, preparedData, seriesOptions, htmlLayout } = args;
|
|
14
|
-
const ref = React.useRef(null);
|
|
15
|
-
const connectorSelector = `.${b('connector')}`;
|
|
16
|
-
React.useEffect(() => {
|
|
17
|
-
var _a;
|
|
18
|
-
if (!ref.current) {
|
|
19
|
-
return () => { };
|
|
20
|
-
}
|
|
21
|
-
const svgElement = select(ref.current);
|
|
22
|
-
const hoverOptions = get(seriesOptions, 'waterfall.states.hover');
|
|
23
|
-
const inactiveOptions = get(seriesOptions, 'waterfall.states.inactive');
|
|
24
|
-
svgElement.selectAll('*').remove();
|
|
25
|
-
const rectSelection = svgElement
|
|
26
|
-
.selectAll('allRects')
|
|
27
|
-
.data(preparedData)
|
|
28
|
-
.join('rect')
|
|
29
|
-
.attr('class', b('segment'))
|
|
30
|
-
.attr('x', (d) => d.x)
|
|
31
|
-
.attr('y', (d) => d.y)
|
|
32
|
-
.attr('height', (d) => d.height)
|
|
33
|
-
.attr('width', (d) => d.width)
|
|
34
|
-
.attr('fill', (d) => getWaterfallPointColor(d.data, d.series))
|
|
35
|
-
.attr('opacity', (d) => d.opacity)
|
|
36
|
-
.attr('cursor', (d) => d.series.cursor);
|
|
37
|
-
let dataLabels = preparedData.map((d) => d.label).filter(Boolean);
|
|
38
|
-
if (!((_a = preparedData[0]) === null || _a === void 0 ? void 0 : _a.series.dataLabels.allowOverlap)) {
|
|
39
|
-
dataLabels = filterOverlappingLabels(dataLabels);
|
|
40
|
-
}
|
|
41
|
-
const labelSelection = svgElement
|
|
42
|
-
.selectAll('text')
|
|
43
|
-
.data(dataLabels)
|
|
44
|
-
.join('text')
|
|
45
|
-
.text((d) => d.text)
|
|
46
|
-
.attr('class', b('label'))
|
|
47
|
-
.attr('x', (d) => d.x)
|
|
48
|
-
.attr('y', (d) => d.y)
|
|
49
|
-
.attr('text-anchor', (d) => d.textAnchor)
|
|
50
|
-
.style('font-size', (d) => d.style.fontSize)
|
|
51
|
-
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
52
|
-
.style('fill', (d) => d.style.fontColor || null);
|
|
53
|
-
// Add the connector line between bars
|
|
54
|
-
svgElement
|
|
55
|
-
.selectAll(connectorSelector)
|
|
56
|
-
.data(preparedData)
|
|
57
|
-
.join('path')
|
|
58
|
-
.attr('class', b('connector'))
|
|
59
|
-
.attr('d', (d, index) => {
|
|
60
|
-
const line = lineGenerator();
|
|
61
|
-
const prev = preparedData[index - 1];
|
|
62
|
-
if (!prev) {
|
|
63
|
-
return null;
|
|
64
|
-
}
|
|
65
|
-
const points = [];
|
|
66
|
-
if (Number(prev.data.y) > 0) {
|
|
67
|
-
points.push([prev.x, prev.y]);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
points.push([prev.x, prev.y + prev.height]);
|
|
71
|
-
}
|
|
72
|
-
if (Number(d.data.y) > 0 && !d.data.total) {
|
|
73
|
-
points.push([d.x + d.width, d.y + d.height]);
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
points.push([d.x + d.width, d.y]);
|
|
77
|
-
}
|
|
78
|
-
return line(points);
|
|
79
|
-
})
|
|
80
|
-
.attr('stroke-width', 1)
|
|
81
|
-
.attr('stroke-dasharray', () => getLineDashArray(DashStyle.Dash, 1));
|
|
82
|
-
dispatcher.on('hover-shape.waterfall', (data) => {
|
|
83
|
-
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
84
|
-
const inactiveEnabled = inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled;
|
|
85
|
-
if (!data) {
|
|
86
|
-
if (hoverEnabled) {
|
|
87
|
-
rectSelection.attr('fill', (d) => getWaterfallPointColor(d.data, d.series));
|
|
88
|
-
}
|
|
89
|
-
if (inactiveEnabled) {
|
|
90
|
-
rectSelection.attr('opacity', null);
|
|
91
|
-
labelSelection.attr('opacity', null);
|
|
92
|
-
}
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
if (hoverEnabled) {
|
|
96
|
-
const hoveredValues = data.map((d) => d.data.x);
|
|
97
|
-
rectSelection.attr('fill', (d) => {
|
|
98
|
-
var _a;
|
|
99
|
-
const fillColor = getWaterfallPointColor(d.data, d.series);
|
|
100
|
-
if (hoveredValues.includes(d.data.x)) {
|
|
101
|
-
const brightness = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.brightness;
|
|
102
|
-
return ((_a = color(fillColor)) === null || _a === void 0 ? void 0 : _a.brighter(brightness).toString()) || fillColor;
|
|
103
|
-
}
|
|
104
|
-
return fillColor;
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
if (inactiveEnabled) {
|
|
108
|
-
const hoveredSeries = data.map((d) => d.series.id);
|
|
109
|
-
rectSelection.attr('opacity', (d) => {
|
|
110
|
-
return hoveredSeries.includes(d.series.id)
|
|
111
|
-
? null
|
|
112
|
-
: (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.opacity) || null;
|
|
113
|
-
});
|
|
114
|
-
labelSelection.attr('opacity', (d) => {
|
|
115
|
-
return hoveredSeries.includes(d.series.id)
|
|
116
|
-
? null
|
|
117
|
-
: (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.opacity) || null;
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
});
|
|
121
|
-
return () => {
|
|
122
|
-
dispatcher.on('hover-shape.waterfall', null);
|
|
123
|
-
};
|
|
124
|
-
}, [dispatcher, preparedData, seriesOptions]);
|
|
125
|
-
return (React.createElement(React.Fragment, null,
|
|
126
|
-
React.createElement("g", { ref: ref, className: b() }),
|
|
127
|
-
React.createElement(HtmlLayer, { preparedData: preparedData, htmlLayout: htmlLayout })));
|
|
128
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ChartScale } from '../../useAxisScales';
|
|
2
|
-
import type { PreparedAxis } from '../../useChartOptions/types';
|
|
3
|
-
import type { PreparedSeriesOptions, PreparedWaterfallSeries } from '../../useSeries/types';
|
|
4
|
-
import type { PreparedWaterfallData } from './types';
|
|
5
|
-
export declare const prepareWaterfallData: (args: {
|
|
6
|
-
series: PreparedWaterfallSeries[];
|
|
7
|
-
seriesOptions: PreparedSeriesOptions;
|
|
8
|
-
xAxis: PreparedAxis;
|
|
9
|
-
xScale: ChartScale;
|
|
10
|
-
yAxis: PreparedAxis[];
|
|
11
|
-
yScale: ChartScale[];
|
|
12
|
-
}) => PreparedWaterfallData[];
|