@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,158 +0,0 @@
|
|
|
1
|
-
import { group, sort } from 'd3';
|
|
2
|
-
import { getDataCategoryValue, getLabelsSize, getLeftPosition } from '../../../utils';
|
|
3
|
-
import { getXValue, getYValue } from '../utils';
|
|
4
|
-
function getLabelData(point, series, xMax) {
|
|
5
|
-
const text = String(point.data.label || point.data.y);
|
|
6
|
-
const style = series.dataLabels.style;
|
|
7
|
-
const size = getLabelsSize({ labels: [text], style, html: series.dataLabels.html });
|
|
8
|
-
const labelData = {
|
|
9
|
-
text,
|
|
10
|
-
x: point.x,
|
|
11
|
-
y: point.y - series.dataLabels.padding,
|
|
12
|
-
style,
|
|
13
|
-
size: { width: size.maxWidth, height: size.maxHeight },
|
|
14
|
-
textAnchor: 'middle',
|
|
15
|
-
series: series,
|
|
16
|
-
active: true,
|
|
17
|
-
};
|
|
18
|
-
const left = getLeftPosition(labelData);
|
|
19
|
-
if (left < 0) {
|
|
20
|
-
labelData.x = labelData.x + Math.abs(left);
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
const right = left + labelData.size.width;
|
|
24
|
-
if (right > xMax) {
|
|
25
|
-
labelData.x = labelData.x - (right - xMax);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return labelData;
|
|
29
|
-
}
|
|
30
|
-
function getXValues(series, xAxis, xScale) {
|
|
31
|
-
const categories = xAxis.categories || [];
|
|
32
|
-
const xValues = series.reduce((acc, s) => {
|
|
33
|
-
s.data.forEach((d) => {
|
|
34
|
-
const key = String(xAxis.type === 'category'
|
|
35
|
-
? getDataCategoryValue({ axisDirection: 'x', categories, data: d })
|
|
36
|
-
: d.x);
|
|
37
|
-
if (!acc.has(key)) {
|
|
38
|
-
acc.set(key, getXValue({ point: d, xAxis, xScale }));
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
return acc;
|
|
42
|
-
}, new Map());
|
|
43
|
-
if (xAxis.type === 'category') {
|
|
44
|
-
return categories.reduce((acc, category) => {
|
|
45
|
-
const xValue = xValues.get(category);
|
|
46
|
-
if (typeof xValue === 'number') {
|
|
47
|
-
acc.push([category, xValue]);
|
|
48
|
-
}
|
|
49
|
-
return acc;
|
|
50
|
-
}, []);
|
|
51
|
-
}
|
|
52
|
-
return sort(Array.from(xValues), ([_x, xValue]) => xValue);
|
|
53
|
-
}
|
|
54
|
-
export const prepareAreaData = (args) => {
|
|
55
|
-
const { series, xAxis, xScale, yAxis, yScale, boundsHeight: plotHeight } = args;
|
|
56
|
-
const [_xMin, xRangeMax] = xScale.range();
|
|
57
|
-
const xMax = xRangeMax / (1 - xAxis.maxPadding);
|
|
58
|
-
return Array.from(group(series, (s) => s.stackId)).reduce((result, [_stackId, seriesStack]) => {
|
|
59
|
-
const xValues = getXValues(seriesStack, xAxis, xScale);
|
|
60
|
-
const accumulatedYValues = new Map();
|
|
61
|
-
xValues.forEach(([key]) => {
|
|
62
|
-
accumulatedYValues.set(key, 0);
|
|
63
|
-
});
|
|
64
|
-
const seriesStackData = seriesStack.reduce((acc, s) => {
|
|
65
|
-
const yAxisIndex = s.yAxis;
|
|
66
|
-
const seriesYAxis = yAxis[yAxisIndex];
|
|
67
|
-
const seriesYScale = yScale[yAxisIndex];
|
|
68
|
-
const yMin = getYValue({ point: { y: 0 }, yAxis: seriesYAxis, yScale: seriesYScale });
|
|
69
|
-
const seriesData = s.data.reduce((m, d) => {
|
|
70
|
-
const key = String(xAxis.type === 'category'
|
|
71
|
-
? getDataCategoryValue({
|
|
72
|
-
axisDirection: 'x',
|
|
73
|
-
categories: xAxis.categories || [],
|
|
74
|
-
data: d,
|
|
75
|
-
})
|
|
76
|
-
: d.x);
|
|
77
|
-
return m.set(key, d);
|
|
78
|
-
}, new Map());
|
|
79
|
-
const points = xValues.reduce((pointsAcc, [x, xValue]) => {
|
|
80
|
-
const accumulatedYValue = accumulatedYValues.get(x) || 0;
|
|
81
|
-
const d = seriesData.get(x) ||
|
|
82
|
-
{
|
|
83
|
-
x,
|
|
84
|
-
// FIXME: think about how to break the series into separate areas(null Y values)
|
|
85
|
-
y: 0,
|
|
86
|
-
};
|
|
87
|
-
const yValue = getYValue({ point: d, yAxis: seriesYAxis, yScale: seriesYScale }) -
|
|
88
|
-
accumulatedYValue;
|
|
89
|
-
accumulatedYValues.set(x, yMin - yValue);
|
|
90
|
-
pointsAcc.push({
|
|
91
|
-
y0: yMin - accumulatedYValue,
|
|
92
|
-
x: xValue,
|
|
93
|
-
y: yValue,
|
|
94
|
-
data: d,
|
|
95
|
-
series: s,
|
|
96
|
-
});
|
|
97
|
-
return pointsAcc;
|
|
98
|
-
}, []);
|
|
99
|
-
let labels = [];
|
|
100
|
-
const htmlElements = [];
|
|
101
|
-
if (s.dataLabels.enabled) {
|
|
102
|
-
const labelItems = points.map((p) => getLabelData(p, s, xMax));
|
|
103
|
-
if (s.dataLabels.html) {
|
|
104
|
-
const htmlLabels = labelItems.map((l) => {
|
|
105
|
-
return {
|
|
106
|
-
x: l.x - l.size.width / 2,
|
|
107
|
-
y: l.y,
|
|
108
|
-
content: l.text,
|
|
109
|
-
};
|
|
110
|
-
});
|
|
111
|
-
htmlElements.push(...htmlLabels);
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
labels = labelItems;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
let markers = [];
|
|
118
|
-
if (s.marker.states.normal.enabled || s.marker.states.hover.enabled) {
|
|
119
|
-
markers = points.map((p) => ({
|
|
120
|
-
point: p,
|
|
121
|
-
active: true,
|
|
122
|
-
hovered: false,
|
|
123
|
-
}));
|
|
124
|
-
}
|
|
125
|
-
acc.push({
|
|
126
|
-
points,
|
|
127
|
-
markers,
|
|
128
|
-
labels,
|
|
129
|
-
color: s.color,
|
|
130
|
-
opacity: s.opacity,
|
|
131
|
-
width: s.lineWidth,
|
|
132
|
-
series: s,
|
|
133
|
-
hovered: false,
|
|
134
|
-
active: true,
|
|
135
|
-
id: s.id,
|
|
136
|
-
htmlElements,
|
|
137
|
-
});
|
|
138
|
-
return acc;
|
|
139
|
-
}, []);
|
|
140
|
-
if (series.some((s) => s.stacking === 'percent')) {
|
|
141
|
-
xValues.forEach(([x], index) => {
|
|
142
|
-
const stackHeight = accumulatedYValues.get(x) || 0;
|
|
143
|
-
let acc = 0;
|
|
144
|
-
const ratio = plotHeight / stackHeight;
|
|
145
|
-
seriesStackData.forEach((item) => {
|
|
146
|
-
const point = item.points[index];
|
|
147
|
-
if (point) {
|
|
148
|
-
const height = (point.y0 - point.y) * ratio;
|
|
149
|
-
point.y0 = plotHeight - height - acc;
|
|
150
|
-
point.y = point.y0 + height;
|
|
151
|
-
acc += height;
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
return result.concat(seriesStackData);
|
|
157
|
-
}, []);
|
|
158
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { AreaSeriesData } from '../../../../../../types';
|
|
2
|
-
import { HtmlItem, LabelData } from '../../../types';
|
|
3
|
-
import { PreparedAreaSeries } from '../../useSeries/types';
|
|
4
|
-
export type PointData = {
|
|
5
|
-
y0: number;
|
|
6
|
-
x: number;
|
|
7
|
-
y: number;
|
|
8
|
-
data: AreaSeriesData;
|
|
9
|
-
series: PreparedAreaSeries;
|
|
10
|
-
};
|
|
11
|
-
export type MarkerData = {
|
|
12
|
-
point: PointData;
|
|
13
|
-
active: boolean;
|
|
14
|
-
hovered: boolean;
|
|
15
|
-
};
|
|
16
|
-
export type PreparedAreaData = {
|
|
17
|
-
id: string;
|
|
18
|
-
points: PointData[];
|
|
19
|
-
markers: MarkerData[];
|
|
20
|
-
color: string;
|
|
21
|
-
opacity: number;
|
|
22
|
-
width: number;
|
|
23
|
-
series: PreparedAreaSeries;
|
|
24
|
-
hovered: boolean;
|
|
25
|
-
active: boolean;
|
|
26
|
-
labels: LabelData[];
|
|
27
|
-
htmlElements: HtmlItem[];
|
|
28
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -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 { PreparedBarXData } from './types';
|
|
5
|
-
export { prepareBarXData } from './prepare-data';
|
|
6
|
-
export * from './types';
|
|
7
|
-
type Args = {
|
|
8
|
-
dispatcher: Dispatch<object>;
|
|
9
|
-
preparedData: PreparedBarXData[];
|
|
10
|
-
seriesOptions: PreparedSeriesOptions;
|
|
11
|
-
htmlLayout: HTMLElement | null;
|
|
12
|
-
};
|
|
13
|
-
export declare const BarXSeriesShapes: (args: Args) => React.JSX.Element;
|
|
@@ -1,96 +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 { filterOverlappingLabels } from '../../../utils';
|
|
6
|
-
import { HtmlLayer } from '../HtmlLayer';
|
|
7
|
-
export { prepareBarXData } from './prepare-data';
|
|
8
|
-
export * from './types';
|
|
9
|
-
const b = block('d3-bar-x');
|
|
10
|
-
export const BarXSeriesShapes = (args) => {
|
|
11
|
-
const { dispatcher, preparedData, seriesOptions, htmlLayout } = args;
|
|
12
|
-
const ref = React.useRef(null);
|
|
13
|
-
React.useEffect(() => {
|
|
14
|
-
var _a;
|
|
15
|
-
if (!ref.current) {
|
|
16
|
-
return () => { };
|
|
17
|
-
}
|
|
18
|
-
const svgElement = select(ref.current);
|
|
19
|
-
const hoverOptions = get(seriesOptions, 'bar-x.states.hover');
|
|
20
|
-
const inactiveOptions = get(seriesOptions, 'bar-x.states.inactive');
|
|
21
|
-
svgElement.selectAll('*').remove();
|
|
22
|
-
const rectSelection = svgElement
|
|
23
|
-
.selectAll('allRects')
|
|
24
|
-
.data(preparedData)
|
|
25
|
-
.join('rect')
|
|
26
|
-
.attr('class', b('segment'))
|
|
27
|
-
.attr('x', (d) => d.x)
|
|
28
|
-
.attr('y', (d) => d.y)
|
|
29
|
-
.attr('height', (d) => d.height)
|
|
30
|
-
.attr('width', (d) => d.width)
|
|
31
|
-
.attr('fill', (d) => d.data.color || d.series.color)
|
|
32
|
-
.attr('opacity', (d) => d.opacity)
|
|
33
|
-
.attr('cursor', (d) => d.series.cursor);
|
|
34
|
-
let dataLabels = preparedData.map((d) => d.label).filter(Boolean);
|
|
35
|
-
if (!((_a = preparedData[0]) === null || _a === void 0 ? void 0 : _a.series.dataLabels.allowOverlap)) {
|
|
36
|
-
dataLabels = filterOverlappingLabels(dataLabels);
|
|
37
|
-
}
|
|
38
|
-
const labelSelection = svgElement
|
|
39
|
-
.selectAll('text')
|
|
40
|
-
.data(dataLabels)
|
|
41
|
-
.join('text')
|
|
42
|
-
.text((d) => d.text)
|
|
43
|
-
.attr('class', b('label'))
|
|
44
|
-
.attr('x', (d) => d.x)
|
|
45
|
-
.attr('y', (d) => d.y)
|
|
46
|
-
.attr('text-anchor', (d) => d.textAnchor)
|
|
47
|
-
.style('font-size', (d) => d.style.fontSize)
|
|
48
|
-
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
49
|
-
.style('fill', (d) => d.style.fontColor || null);
|
|
50
|
-
dispatcher.on('hover-shape.bar-x', (data) => {
|
|
51
|
-
const hoverEnabled = hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled;
|
|
52
|
-
const inactiveEnabled = inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled;
|
|
53
|
-
if (!data) {
|
|
54
|
-
if (hoverEnabled) {
|
|
55
|
-
rectSelection.attr('fill', (d) => d.data.color || d.series.color);
|
|
56
|
-
}
|
|
57
|
-
if (inactiveEnabled) {
|
|
58
|
-
rectSelection.attr('opacity', null);
|
|
59
|
-
labelSelection.attr('opacity', null);
|
|
60
|
-
}
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (hoverEnabled) {
|
|
64
|
-
const hoveredValues = data.map((d) => d.data.x);
|
|
65
|
-
rectSelection.attr('fill', (d) => {
|
|
66
|
-
var _a;
|
|
67
|
-
const fillColor = d.data.color || d.series.color;
|
|
68
|
-
if (hoveredValues.includes(d.data.x)) {
|
|
69
|
-
return (((_a = color(fillColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.brightness).toString()) ||
|
|
70
|
-
fillColor);
|
|
71
|
-
}
|
|
72
|
-
return fillColor;
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
if (inactiveEnabled) {
|
|
76
|
-
const hoveredSeries = data.map((d) => d.series.id);
|
|
77
|
-
rectSelection.attr('opacity', (d) => {
|
|
78
|
-
return hoveredSeries.includes(d.series.id)
|
|
79
|
-
? null
|
|
80
|
-
: (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.opacity) || null;
|
|
81
|
-
});
|
|
82
|
-
labelSelection.attr('opacity', (d) => {
|
|
83
|
-
return hoveredSeries.includes(d.series.id)
|
|
84
|
-
? null
|
|
85
|
-
: (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.opacity) || null;
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
return () => {
|
|
90
|
-
dispatcher.on('hover-shape.bar-x', null);
|
|
91
|
-
};
|
|
92
|
-
}, [dispatcher, preparedData, seriesOptions]);
|
|
93
|
-
return (React.createElement(React.Fragment, null,
|
|
94
|
-
React.createElement("g", { ref: ref, className: b() }),
|
|
95
|
-
React.createElement(HtmlLayer, { preparedData: preparedData, htmlLayout: htmlLayout })));
|
|
96
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ChartScale } from '../../useAxisScales';
|
|
2
|
-
import type { PreparedAxis } from '../../useChartOptions/types';
|
|
3
|
-
import type { PreparedBarXSeries, PreparedSeriesOptions } from '../../useSeries/types';
|
|
4
|
-
import { PreparedBarXData } from './types';
|
|
5
|
-
export declare const prepareBarXData: (args: {
|
|
6
|
-
series: PreparedBarXSeries[];
|
|
7
|
-
seriesOptions: PreparedSeriesOptions;
|
|
8
|
-
xAxis: PreparedAxis;
|
|
9
|
-
xScale: ChartScale;
|
|
10
|
-
yAxis: PreparedAxis[];
|
|
11
|
-
yScale: ChartScale[];
|
|
12
|
-
boundsHeight: number;
|
|
13
|
-
}) => PreparedBarXData[];
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { ascending, descending, max, sort } from 'd3';
|
|
2
|
-
import get from 'lodash/get';
|
|
3
|
-
import { getDataCategoryValue, getLabelsSize } from '../../../utils';
|
|
4
|
-
import { MIN_BAR_GAP, MIN_BAR_GROUP_GAP, MIN_BAR_WIDTH } from '../constants';
|
|
5
|
-
function getLabelData(d) {
|
|
6
|
-
if (!d.series.dataLabels.enabled) {
|
|
7
|
-
return undefined;
|
|
8
|
-
}
|
|
9
|
-
const text = String(d.data.label || d.data.y);
|
|
10
|
-
const style = d.series.dataLabels.style;
|
|
11
|
-
const html = d.series.dataLabels.html;
|
|
12
|
-
const { maxHeight: height, maxWidth: width } = getLabelsSize({
|
|
13
|
-
labels: [text],
|
|
14
|
-
style,
|
|
15
|
-
html,
|
|
16
|
-
});
|
|
17
|
-
let y = Math.max(height, d.y - d.series.dataLabels.padding);
|
|
18
|
-
if (d.series.dataLabels.inside) {
|
|
19
|
-
y = d.y + d.height / 2;
|
|
20
|
-
}
|
|
21
|
-
const x = d.x + d.width / 2;
|
|
22
|
-
return {
|
|
23
|
-
text,
|
|
24
|
-
x: html ? x - width / 2 : x,
|
|
25
|
-
y: html ? y - height : y,
|
|
26
|
-
style,
|
|
27
|
-
size: { width, height },
|
|
28
|
-
textAnchor: 'middle',
|
|
29
|
-
series: d.series,
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
export const prepareBarXData = (args) => {
|
|
33
|
-
const { series, seriesOptions, xAxis, xScale, yScale, boundsHeight: plotHeight } = args;
|
|
34
|
-
const categories = get(xAxis, 'categories', []);
|
|
35
|
-
const barMaxWidth = get(seriesOptions, 'bar-x.barMaxWidth');
|
|
36
|
-
const barPadding = get(seriesOptions, 'bar-x.barPadding');
|
|
37
|
-
const groupPadding = get(seriesOptions, 'bar-x.groupPadding');
|
|
38
|
-
const sortingOptions = get(seriesOptions, 'bar-x.dataSorting');
|
|
39
|
-
const comparator = (sortingOptions === null || sortingOptions === void 0 ? void 0 : sortingOptions.direction) === 'desc' ? descending : ascending;
|
|
40
|
-
const sortKey = (() => {
|
|
41
|
-
switch (sortingOptions === null || sortingOptions === void 0 ? void 0 : sortingOptions.key) {
|
|
42
|
-
case 'y': {
|
|
43
|
-
return 'data.y';
|
|
44
|
-
}
|
|
45
|
-
case 'name': {
|
|
46
|
-
return 'series.name';
|
|
47
|
-
}
|
|
48
|
-
default: {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
})();
|
|
53
|
-
const data = {};
|
|
54
|
-
series.forEach((s) => {
|
|
55
|
-
s.data.forEach((d) => {
|
|
56
|
-
const xValue = xAxis.type === 'category'
|
|
57
|
-
? getDataCategoryValue({ axisDirection: 'x', categories, data: d })
|
|
58
|
-
: d.x;
|
|
59
|
-
if (xValue) {
|
|
60
|
-
if (!data[xValue]) {
|
|
61
|
-
data[xValue] = {};
|
|
62
|
-
}
|
|
63
|
-
const xGroup = data[xValue];
|
|
64
|
-
if (!xGroup[s.stackId]) {
|
|
65
|
-
xGroup[s.stackId] = [];
|
|
66
|
-
}
|
|
67
|
-
xGroup[s.stackId].push({ data: d, series: s });
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
let bandWidth = Infinity;
|
|
72
|
-
if (xAxis.type === 'category') {
|
|
73
|
-
const xBandScale = xScale;
|
|
74
|
-
bandWidth = xBandScale.bandwidth();
|
|
75
|
-
}
|
|
76
|
-
else {
|
|
77
|
-
const xLinearScale = xScale;
|
|
78
|
-
const xValues = series.reduce((acc, s) => {
|
|
79
|
-
s.data.forEach((dataItem) => acc.push(Number(dataItem.x)));
|
|
80
|
-
return acc;
|
|
81
|
-
}, []);
|
|
82
|
-
xValues.sort().forEach((xValue, index) => {
|
|
83
|
-
if (index > 0 && xValue !== xValues[index - 1]) {
|
|
84
|
-
const dist = xLinearScale(xValue) - xLinearScale(xValues[index - 1]);
|
|
85
|
-
if (dist < bandWidth) {
|
|
86
|
-
bandWidth = dist;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
const maxGroupSize = max(Object.values(data), (d) => Object.values(d).length) || 1;
|
|
92
|
-
const groupGap = Math.max(bandWidth * groupPadding, MIN_BAR_GROUP_GAP);
|
|
93
|
-
const groupWidth = bandWidth - groupGap;
|
|
94
|
-
const rectGap = Math.max(bandWidth * barPadding, MIN_BAR_GAP);
|
|
95
|
-
const rectWidth = Math.max(MIN_BAR_WIDTH, Math.min(groupWidth / maxGroupSize - rectGap, barMaxWidth));
|
|
96
|
-
const result = [];
|
|
97
|
-
Object.entries(data).forEach(([xValue, val]) => {
|
|
98
|
-
const stacks = Object.values(val);
|
|
99
|
-
const currentGroupWidth = rectWidth * stacks.length + rectGap * (stacks.length - 1);
|
|
100
|
-
stacks.forEach((yValues, groupItemIndex) => {
|
|
101
|
-
let stackHeight = 0;
|
|
102
|
-
const stackItems = [];
|
|
103
|
-
const sortedData = sortKey
|
|
104
|
-
? sort(yValues, (a, b) => comparator(get(a, sortKey), get(b, sortKey)))
|
|
105
|
-
: yValues;
|
|
106
|
-
sortedData.forEach((yValue) => {
|
|
107
|
-
const yAxisIndex = yValue.series.yAxis;
|
|
108
|
-
const seriesYScale = yScale[yAxisIndex];
|
|
109
|
-
let xCenter;
|
|
110
|
-
if (xAxis.type === 'category') {
|
|
111
|
-
const xBandScale = xScale;
|
|
112
|
-
xCenter = (xBandScale(xValue) || 0) + xBandScale.bandwidth() / 2;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
const xLinearScale = xScale;
|
|
116
|
-
xCenter = xLinearScale(Number(xValue));
|
|
117
|
-
}
|
|
118
|
-
const x = xCenter - currentGroupWidth / 2 + (rectWidth + rectGap) * groupItemIndex;
|
|
119
|
-
const yDataValue = yValue.data.y;
|
|
120
|
-
const y = seriesYScale(yDataValue);
|
|
121
|
-
const base = seriesYScale(0);
|
|
122
|
-
const height = yDataValue > 0 ? base - y : y - base;
|
|
123
|
-
const barData = {
|
|
124
|
-
x,
|
|
125
|
-
y: yDataValue > 0 ? y - stackHeight : seriesYScale(0),
|
|
126
|
-
width: rectWidth,
|
|
127
|
-
height,
|
|
128
|
-
opacity: get(yValue.data, 'opacity', null),
|
|
129
|
-
data: yValue.data,
|
|
130
|
-
series: yValue.series,
|
|
131
|
-
htmlElements: [],
|
|
132
|
-
};
|
|
133
|
-
const label = getLabelData(barData);
|
|
134
|
-
if (yValue.series.dataLabels.html && label) {
|
|
135
|
-
barData.htmlElements.push({
|
|
136
|
-
x: label.x,
|
|
137
|
-
y: label.y,
|
|
138
|
-
content: label.text,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
barData.label = getLabelData(barData);
|
|
143
|
-
}
|
|
144
|
-
stackItems.push(barData);
|
|
145
|
-
stackHeight += height + 1;
|
|
146
|
-
});
|
|
147
|
-
if (series.some((s) => s.stacking === 'percent')) {
|
|
148
|
-
let acc = 0;
|
|
149
|
-
const ratio = plotHeight / (stackHeight - stackItems.length);
|
|
150
|
-
stackItems.forEach((item) => {
|
|
151
|
-
item.height = item.height * ratio;
|
|
152
|
-
item.y = plotHeight - item.height - acc;
|
|
153
|
-
acc += item.height + 1;
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
result.push(...stackItems);
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
return result;
|
|
160
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { TooltipDataChunkBarX } from '../../../../../../types';
|
|
2
|
-
import { HtmlItem, LabelData } from '../../../types';
|
|
3
|
-
import { PreparedBarXSeries } from '../../useSeries/types';
|
|
4
|
-
export type PreparedBarXData = Omit<TooltipDataChunkBarX, 'series'> & {
|
|
5
|
-
x: number;
|
|
6
|
-
y: number;
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
opacity: number | null;
|
|
10
|
-
series: PreparedBarXSeries;
|
|
11
|
-
label?: LabelData;
|
|
12
|
-
htmlElements: HtmlItem[];
|
|
13
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { Dispatch } from 'd3';
|
|
3
|
-
import type { PreparedSeriesOptions } from '../../useSeries/types';
|
|
4
|
-
import type { PreparedBarYData } from './types';
|
|
5
|
-
export { prepareBarYData } from './prepare-data';
|
|
6
|
-
type Args = {
|
|
7
|
-
dispatcher: Dispatch<object>;
|
|
8
|
-
preparedData: PreparedBarYData[];
|
|
9
|
-
seriesOptions: PreparedSeriesOptions;
|
|
10
|
-
htmlLayout: HTMLElement | null;
|
|
11
|
-
};
|
|
12
|
-
export declare const BarYSeriesShapes: (args: Args) => React.JSX.Element;
|
|
@@ -1,84 +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 { HtmlLayer } from '../HtmlLayer';
|
|
6
|
-
export { prepareBarYData } from './prepare-data';
|
|
7
|
-
const b = block('d3-bar-y');
|
|
8
|
-
export const BarYSeriesShapes = (args) => {
|
|
9
|
-
const { dispatcher, preparedData, seriesOptions, htmlLayout } = args;
|
|
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 rectSelection = svgElement
|
|
18
|
-
.selectAll('rect')
|
|
19
|
-
.data(preparedData)
|
|
20
|
-
.join('rect')
|
|
21
|
-
.attr('class', b('segment'))
|
|
22
|
-
.attr('x', (d) => d.x)
|
|
23
|
-
.attr('y', (d) => d.y)
|
|
24
|
-
.attr('height', (d) => d.height)
|
|
25
|
-
.attr('width', (d) => d.width)
|
|
26
|
-
.attr('fill', (d) => d.color)
|
|
27
|
-
.attr('opacity', (d) => d.data.opacity || null)
|
|
28
|
-
.attr('cursor', (d) => d.series.cursor);
|
|
29
|
-
const dataLabels = preparedData.reduce((acc, d) => {
|
|
30
|
-
if (d.label) {
|
|
31
|
-
acc.push(d.label);
|
|
32
|
-
}
|
|
33
|
-
return acc;
|
|
34
|
-
}, []);
|
|
35
|
-
const labelSelection = svgElement
|
|
36
|
-
.selectAll('text')
|
|
37
|
-
.data(dataLabels)
|
|
38
|
-
.join('text')
|
|
39
|
-
.text((d) => d.text)
|
|
40
|
-
.attr('class', b('label'))
|
|
41
|
-
.attr('x', (d) => d.x)
|
|
42
|
-
.attr('y', (d) => d.y)
|
|
43
|
-
.attr('text-anchor', (d) => d.textAnchor)
|
|
44
|
-
.style('font-size', (d) => d.style.fontSize)
|
|
45
|
-
.style('font-weight', (d) => d.style.fontWeight || null)
|
|
46
|
-
.style('fill', (d) => d.style.fontColor || null);
|
|
47
|
-
const hoverOptions = get(seriesOptions, 'bar-y.states.hover');
|
|
48
|
-
const inactiveOptions = get(seriesOptions, 'bar-y.states.inactive');
|
|
49
|
-
dispatcher.on('hover-shape.bar-y', (data) => {
|
|
50
|
-
if (hoverOptions === null || hoverOptions === void 0 ? void 0 : hoverOptions.enabled) {
|
|
51
|
-
const hovered = data === null || data === void 0 ? void 0 : data.reduce((acc, d) => {
|
|
52
|
-
acc.add(d.data.y);
|
|
53
|
-
return acc;
|
|
54
|
-
}, new Set());
|
|
55
|
-
rectSelection.attr('fill', (d) => {
|
|
56
|
-
var _a;
|
|
57
|
-
const fillColor = d.color;
|
|
58
|
-
if (hovered === null || hovered === void 0 ? void 0 : hovered.has(d.data.y)) {
|
|
59
|
-
return (((_a = color(fillColor)) === null || _a === void 0 ? void 0 : _a.brighter(hoverOptions.brightness).toString()) ||
|
|
60
|
-
fillColor);
|
|
61
|
-
}
|
|
62
|
-
return fillColor;
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
if (inactiveOptions === null || inactiveOptions === void 0 ? void 0 : inactiveOptions.enabled) {
|
|
66
|
-
const hoveredSeries = data === null || data === void 0 ? void 0 : data.map((d) => d.series.id);
|
|
67
|
-
const newOpacity = (d) => {
|
|
68
|
-
if ((hoveredSeries === null || hoveredSeries === void 0 ? void 0 : hoveredSeries.length) && !hoveredSeries.includes(d.series.id)) {
|
|
69
|
-
return inactiveOptions.opacity || null;
|
|
70
|
-
}
|
|
71
|
-
return null;
|
|
72
|
-
};
|
|
73
|
-
rectSelection.attr('opacity', newOpacity);
|
|
74
|
-
labelSelection.attr('opacity', newOpacity);
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
return () => {
|
|
78
|
-
dispatcher.on('hover-shape.bar-y', null);
|
|
79
|
-
};
|
|
80
|
-
}, [dispatcher, preparedData, seriesOptions]);
|
|
81
|
-
return (React.createElement(React.Fragment, null,
|
|
82
|
-
React.createElement("g", { ref: ref, className: b() }),
|
|
83
|
-
React.createElement(HtmlLayer, { preparedData: preparedData, htmlLayout: htmlLayout })));
|
|
84
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ChartScale } from '../../useAxisScales';
|
|
2
|
-
import type { PreparedAxis } from '../../useChartOptions/types';
|
|
3
|
-
import type { PreparedBarYSeries, PreparedSeriesOptions } from '../../useSeries/types';
|
|
4
|
-
import type { PreparedBarYData } from './types';
|
|
5
|
-
export declare const prepareBarYData: (args: {
|
|
6
|
-
series: PreparedBarYSeries[];
|
|
7
|
-
seriesOptions: PreparedSeriesOptions;
|
|
8
|
-
xAxis: PreparedAxis;
|
|
9
|
-
xScale: ChartScale;
|
|
10
|
-
yAxis: PreparedAxis[];
|
|
11
|
-
yScale: ChartScale[];
|
|
12
|
-
}) => PreparedBarYData[];
|